RenderSVGGradientStop.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "RenderSVGGradientStop.h"
#include "SVGGradientElement.h"
#include "SVGNames.h"
#include "SVGStopElement.h"
namespace WebCore {
using namespace SVGNames;
RenderSVGGradientStop::RenderSVGGradientStop(SVGStopElement* element)
: RenderObject(element)
{
}
RenderSVGGradientStop::~RenderSVGGradientStop()
{
}
void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderObject::styleDidChange(diff, oldStyle);
if (SVGGradientElement* gradient = gradientElement()) {
if (SVGResource* resource = gradient->canvasResource(this))
resource->invalidate();
}
}
void RenderSVGGradientStop::layout()
{
setNeedsLayout(false);
}
SVGGradientElement* RenderSVGGradientStop::gradientElement() const
{
Node* parentNode = node()->parent();
if (parentNode->hasTagName(linearGradientTag) || parentNode->hasTagName(radialGradientTag))
return static_cast<SVGGradientElement*>(parentNode);
return 0;
}
}
#endif // ENABLE(SVG)