Changeset 83821 in webkit


Ignore:
Timestamp:
Apr 14, 2011 12:14:57 AM (13 years ago)
Author:
reni@webkit.org
Message:

2011-04-14 Renata Hodovan <reni@webkit.org>

Reviewed by Nikolas Zimmermann.

CSS related SVG*Element changes doesn't require relayout
https://bugs.webkit.org/show_bug.cgi?id=56906

Testing inherited CSS related SVG property changes by FEFlood, FESpecularLighting and FEDiffuseLighing filters.
Adding a missing test to check the dynamic update of lighting-color property of FESpecularLighting.
All the other modifications are covered by the existing dyanmic-update tests.

  • platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
  • platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
  • platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum: Added.
  • platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png: Added.
  • platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
  • platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
  • platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum: Added.
  • platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png: Added.
  • svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
  • svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html: Added.
  • svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt: Added.
  • svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html: Added.
  • svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
  • svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html: Added.
  • svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt: Added.
  • svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html: Added.
  • svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js: Added. (executeTest):
  • svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js: Added. (executeTest):
  • svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js: Added. (executeTest):
  • svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js: Added. (executeTest):

2011-04-14 Renata Hodovan <reni@webkit.org>

Reviewed by Nikolas Zimmermann.

CSS related SVG*Element changes doesn't require relayout
https://bugs.webkit.org/show_bug.cgi?id=56906

The changes of some CSS related SVGFilter properties e.g. lighting_color, flood_color, flood_opacity
need only repaint. To avoid the default invalidation of filters in SVGResourceCache::clientStyleChange()
we need an early return. So RenderSVGResourceFilterPrimitive::styleDidChange() can handle these properties
via RenderSVGResourceFilter::primitiveAttributeChanged() the same way like we do it for the other SVGAttributes.

Tests: svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html

svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html
svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html
svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html

  • platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::setFloodColor): (WebCore::FEFlood::setFloodOpacity):
  • platform/graphics/filters/FEFlood.h:
  • platform/graphics/filters/FESpecularLighting.cpp: (WebCore::FESpecularLighting::setLightingColor):
  • platform/graphics/filters/FESpecularLighting.h:
  • rendering/svg/RenderSVGResourceFilterPrimitive.cpp: (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
  • rendering/svg/RenderSVGResourceFilterPrimitive.h:
  • rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::clientStyleChanged):
  • svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
  • svg/SVGFEFloodElement.cpp: (WebCore::SVGFEFloodElement::setFilterEffectAttribute):
  • svg/SVGFEFloodElement.h:
  • svg/SVGFESpecularLightingElement.cpp: (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
Location:
trunk
Files:
20 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83820 r83821  
     12011-04-14  Renata Hodovan  <reni@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        CSS related SVG*Element changes doesn't require relayout
     6        https://bugs.webkit.org/show_bug.cgi?id=56906
     7
     8        Testing inherited CSS related SVG property changes by FEFlood, FESpecularLighting and FEDiffuseLighing filters.
     9        Adding a missing test to check the dynamic update of lighting-color property of FESpecularLighting.
     10        All the other modifications are covered by the existing dyanmic-update tests.
     11
     12        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
     13        * platform/mac/svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
     14        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.checksum: Added.
     15        * platform/mac/svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.png: Added.
     16        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.checksum: Added.
     17        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.png: Added.
     18        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.checksum: Added.
     19        * platform/mac/svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.png: Added.
     20        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
     21        * svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html: Added.
     22        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color-expected.txt: Added.
     23        * svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html: Added.
     24        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop-expected.txt: Added.
     25        * svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html: Added.
     26        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop-expected.txt: Added.
     27        * svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html: Added.
     28        * svg/dynamic-updates/script-tests/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js: Added.
     29        (executeTest):
     30        * svg/dynamic-updates/script-tests/SVGFEFloodElement-inherit-flood-color-css-prop.js: Added.
     31        (executeTest):
     32        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.js: Added.
     33        (executeTest):
     34        * svg/dynamic-updates/script-tests/SVGFESpecularLightingElement-lighting-color-css-prop.js: Added.
     35        (executeTest):
     36
    1372011-04-13  James Robinson  <jamesr@chromium.org>
    238
  • trunk/Source/WebCore/ChangeLog

    r83820 r83821  
     12011-04-14  Renata Hodovan  <reni@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        CSS related SVG*Element changes doesn't require relayout
     6        https://bugs.webkit.org/show_bug.cgi?id=56906
     7
     8        The changes of some CSS related SVGFilter properties e.g. lighting_color, flood_color, flood_opacity
     9        need only repaint. To avoid the default invalidation of filters in SVGResourceCache::clientStyleChange()
     10        we need an early return. So RenderSVGResourceFilterPrimitive::styleDidChange() can handle these properties
     11        via RenderSVGResourceFilter::primitiveAttributeChanged() the same way like we do it for the other SVGAttributes.
     12
     13        Tests: svg/dynamic-updates/SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.html
     14               svg/dynamic-updates/SVGFEFloodElement-inherit-flood-color.html
     15               svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html
     16               svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html
     17
     18        * platform/graphics/filters/FEFlood.cpp:
     19        (WebCore::FEFlood::setFloodColor):
     20        (WebCore::FEFlood::setFloodOpacity):
     21        * platform/graphics/filters/FEFlood.h:
     22        * platform/graphics/filters/FESpecularLighting.cpp:
     23        (WebCore::FESpecularLighting::setLightingColor):
     24        * platform/graphics/filters/FESpecularLighting.h:
     25        * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
     26        (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange):
     27        * rendering/svg/RenderSVGResourceFilterPrimitive.h:
     28        * rendering/svg/SVGResourcesCache.cpp:
     29        (WebCore::SVGResourcesCache::clientStyleChanged):
     30        * svg/SVGFEDiffuseLightingElement.cpp:
     31        (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
     32        * svg/SVGFEFloodElement.cpp:
     33        (WebCore::SVGFEFloodElement::setFilterEffectAttribute):
     34        * svg/SVGFEFloodElement.h:
     35        * svg/SVGFESpecularLightingElement.cpp:
     36        (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
     37
    1382011-04-13  James Robinson  <jamesr@chromium.org>
    239
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.cpp

    r82571 r83821  
    5050}
    5151
    52 void FEFlood::setFloodColor(const Color& color)
     52bool FEFlood::setFloodColor(const Color& color)
    5353{
     54    if (m_floodColor == color)
     55        return false;
    5456    m_floodColor = color;
     57    return true;
    5558}
    5659
     
    6063}
    6164
    62 void FEFlood::setFloodOpacity(float floodOpacity)
     65bool FEFlood::setFloodOpacity(float floodOpacity)
    6366{
     67    if (m_floodOpacity == floodOpacity)
     68        return false;
    6469    m_floodOpacity = floodOpacity;
     70    return true;
    6571}
    6672
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.h

    r82571 r83821  
    3535
    3636    Color floodColor() const;
    37     void setFloodColor(const Color &);
     37    bool setFloodColor(const Color &);
    3838
    3939    float floodOpacity() const;
    40     void setFloodOpacity(float);
     40    bool setFloodOpacity(float);
    4141
    4242    virtual void apply();
  • trunk/Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp

    r82571 r83821  
    5555}
    5656
    57 void FESpecularLighting::setLightingColor(const Color& lightingColor)
     57bool FESpecularLighting::setLightingColor(const Color& lightingColor)
    5858{
     59    if (m_lightingColor == lightingColor)
     60        return false;
    5961    m_lightingColor = lightingColor;
     62    return true;
    6063}
    6164
  • trunk/Source/WebCore/platform/graphics/filters/FESpecularLighting.h

    r82571 r83821  
    3535
    3636    Color lightingColor() const;
    37     void setLightingColor(const Color&);
     37    bool setLightingColor(const Color&);
    3838
    3939    float surfaceScale() const;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp

    r82571 r83821  
    22 * Copyright (C) 2010 University of Szeged
    33 * Copyright (C) 2010 Zoltan Herczeg
     4 * Copyright (C) 2011 Renata Hodovan (reni@webkit.org)
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    3334#include "SVGFEImage.h"
    3435#include "SVGFilter.h"
     36#include "SVGNames.h"
    3537
    3638namespace WebCore {
     39
     40
     41void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
     42{
     43    RenderSVGHiddenContainer::styleDidChange(diff, oldStyle);
     44
     45    RenderObject* filter = parent();
     46    if (!filter)
     47        return;
     48    ASSERT(filter->isSVGResourceFilter());
     49
     50    if (diff == StyleDifferenceEqual || !oldStyle)
     51        return;
     52
     53    const SVGRenderStyle* newStyle = this->style()->svgStyle();
     54    if (node()->hasTagName(SVGNames::feFloodTag)) {
     55        if (newStyle->floodColor() != oldStyle->svgStyle()->floodColor())
     56            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
     57        if (newStyle->floodOpacity() != oldStyle->svgStyle()->floodOpacity())
     58            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
     59    } else if (node()->hasTagName(SVGNames::feDiffuseLightingTag) || node()->hasTagName(SVGNames::feSpecularLightingTag)) {
     60        if (newStyle->lightingColor() != oldStyle->svgStyle()->lightingColor())
     61            static_cast<RenderSVGResourceFilter*>(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
     62    }
     63}
    3764
    3865FloatRect RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion(FilterEffect* effect)
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.h

    r82571 r83821  
    4444    }
    4545
     46    virtual void styleDidChange(StyleDifference, const RenderStyle*);
     47
    4648    virtual const char* renderName() const { return "RenderSVGResourceFilterPrimitive"; }
    4749    virtual bool isSVGResourceFilterPrimitive() const { return true; }
  • trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp

    r82571 r83821  
    127127        return;
    128128
     129    // In this case the proper SVGFE*Element will imply whether the modifided CSS properties implies a relayout or repaint.
     130    if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepaint)
     131        return;
     132
    129133    clientUpdatedFromElement(renderer, newStyle);
    130134    RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
  • trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp

    r82571 r83821  
    8888{
    8989    FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect);
     90
     91    if (attrName == SVGNames::lighting_colorAttr) {
     92        RenderObject* renderer = this->renderer();
     93        ASSERT(renderer);
     94        ASSERT(renderer->style());
     95        return diffuseLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
     96    }
    9097    if (attrName == SVGNames::surfaceScaleAttr)
    9198        return diffuseLighting->setSurfaceScale(surfaceScale());
    9299    if (attrName == SVGNames::diffuseConstantAttr)
    93100        return diffuseLighting->setDiffuseConstant(diffuseConstant());
    94     if (attrName == SVGNames::lighting_colorAttr) {
    95         RefPtr<RenderStyle> filterStyle = styleForRenderer();
    96         return diffuseLighting->setLightingColor(filterStyle->svgStyle()->lightingColor());
    97     }
    98101
    99102    LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSource());
  • trunk/Source/WebCore/svg/SVGFEFloodElement.cpp

    r82571 r83821  
    2626#include "Attribute.h"
    2727#include "RenderStyle.h"
     28#include "SVGNames.h"
    2829#include "SVGRenderStyle.h"
    2930
     
    3839{
    3940    return adoptRef(new SVGFEFloodElement(tagName, document));
     41}
     42
     43
     44bool SVGFEFloodElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
     45{
     46    RenderObject* renderer = this->renderer();
     47    ASSERT(renderer);
     48    RenderStyle* style = renderer->style();
     49    ASSERT(style);
     50    FEFlood* flood = static_cast<FEFlood*>(effect);
     51
     52    if (attrName == SVGNames::flood_colorAttr)
     53        return flood->setFloodColor(style->svgStyle()->floodColor());
     54    if (attrName == SVGNames::flood_opacityAttr)
     55        return flood->setFloodOpacity(style->svgStyle()->floodOpacity());
     56
     57    ASSERT_NOT_REACHED();
     58    return false;
    4059}
    4160
  • trunk/Source/WebCore/svg/SVGFEFloodElement.h

    r82571 r83821  
    3737    virtual void fillAttributeToPropertyTypeMap();
    3838    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     39    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
    3940    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    4041};
  • trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp

    r82571 r83821  
    9393{
    9494    FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effect);
     95
     96    if (attrName == SVGNames::lighting_colorAttr) {
     97        RenderObject* renderer = this->renderer();
     98        ASSERT(renderer);
     99        ASSERT(renderer->style());
     100        return specularLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
     101    }
    95102    if (attrName == SVGNames::surfaceScaleAttr)
    96103        return specularLighting->setSurfaceScale(surfaceScale());
Note: See TracChangeset for help on using the changeset viewer.