Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CTTE] RenderSVGResourceFilterPrimitive always has an SVGFilterPrimit…
…iveStandardAttributes.

<https://webkit.org/b/121300>

Reviewed by Anders Carlsson.

This renderer is never anonymous, and always has a corresponding SVGFilterPrimitiveStandardAttributes element.

Canonical link: https://commits.webkit.org/139260@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Sep 13, 2013
1 parent a4c6ce1 commit 7b5121a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
9 changes: 9 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,12 @@
2013-09-13 Andreas Kling <akling@apple.com>

[CTTE] RenderSVGResourceFilterPrimitive always has an SVGFilterPrimitiveStandardAttributes.
<https://webkit.org/b/121300>

Reviewed by Anders Carlsson.

This renderer is never anonymous, and always has a corresponding SVGFilterPrimitiveStandardAttributes element.

2013-09-12 Darin Adler <darin@apple.com>

Finish removing layer-violating code from Pasteboard (just for Mac during this first step)
Expand Down
14 changes: 12 additions & 2 deletions Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
Expand Up @@ -33,10 +33,20 @@
#include "RenderSVGResource.h"
#include "SVGFEImage.h"
#include "SVGFilter.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
#include "SVGNames.h"

namespace WebCore {

RenderSVGResourceFilterPrimitive::RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes& filterPrimitiveElement)
: RenderSVGHiddenContainer(&filterPrimitiveElement)
{
}

SVGFilterPrimitiveStandardAttributes& RenderSVGResourceFilterPrimitive::filterPrimitiveElement() const
{
return static_cast<SVGFilterPrimitiveStandardAttributes&>(*RenderSVGHiddenContainer::element());
}

void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
Expand All @@ -51,12 +61,12 @@ void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, cons
return;

const SVGRenderStyle* newStyle = this->style()->svgStyle();
if (element()->hasTagName(SVGNames::feFloodTag)) {
if (filterPrimitiveElement().hasTagName(SVGNames::feFloodTag)) {
if (newStyle->floodColor() != oldStyle->svgStyle()->floodColor())
toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
if (newStyle->floodOpacity() != oldStyle->svgStyle()->floodOpacity())
toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
} else if (element()->hasTagName(SVGNames::feDiffuseLightingTag) || element()->hasTagName(SVGNames::feSpecularLightingTag)) {
} else if (filterPrimitiveElement().hasTagName(SVGNames::feDiffuseLightingTag) || filterPrimitiveElement().hasTagName(SVGNames::feSpecularLightingTag)) {
if (newStyle->lightingColor() != oldStyle->svgStyle()->lightingColor())
toRenderSVGFilter(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
}
Expand Down
Expand Up @@ -35,13 +35,12 @@
namespace WebCore {

class FilterEffect;
class SVGFilterPrimitiveStandardAttributes;

class RenderSVGResourceFilterPrimitive FINAL : public RenderSVGHiddenContainer {
public:
explicit RenderSVGResourceFilterPrimitive(SVGElement* filterPrimitiveElement)
: RenderSVGHiddenContainer(filterPrimitiveElement)
{
}
explicit RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes&);
SVGFilterPrimitiveStandardAttributes& filterPrimitiveElement() const;

virtual void styleDidChange(StyleDifference, const RenderStyle*);

Expand All @@ -58,6 +57,8 @@ class RenderSVGResourceFilterPrimitive FINAL : public RenderSVGHiddenContainer {
return;
static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, attribute);
}
private:
void element() const WTF_DELETED_FUNCTION;
};

} // namespace WebCore
Expand Down
Expand Up @@ -144,7 +144,7 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(FilterEffect* f

RenderObject* SVGFilterPrimitiveStandardAttributes::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderSVGResourceFilterPrimitive(this);
return new (arena) RenderSVGResourceFilterPrimitive(*this);
}

bool SVGFilterPrimitiveStandardAttributes::rendererIsNeeded(const RenderStyle& style)
Expand Down

0 comments on commit 7b5121a

Please sign in to comment.