Changeset 54638 in webkit


Ignore:
Timestamp:
Feb 10, 2010 7:04:38 PM (14 years ago)
Author:
Beth Dakin
Message:

WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
Mask not invalidating

Reviewed by Simon Fraser and Darin Adler.

SVGMaskElement is the only class that keeps a HashMap of canvas
resources rather than just a pointer to a resource. This
patch makes SVGMaskElement invalidate all of its resources in the
HashMap instead of just one.

  • svg/SVGMaskElement.cpp:

(WebCore::SVGMaskElement::svgAttributeChanged):
(WebCore::SVGMaskElement::childrenChanged):
(WebCore::SVGMaskElement::invalidateCanvasResources):

  • svg/SVGMaskElement.h:
  • svg/SVGStyledElement.cpp:

(WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
(WebCore::SVGStyledElement::invalidateCanvasResources):

  • svg/SVGStyledElement.h:

LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
Mask not invalidating

Reviewed by Simon Fraser and Darin Adler.

  • platform/mac/svg/custom/mask-invalidation-expected.checksum: Added.
  • platform/mac/svg/custom/mask-invalidation-expected.png: Added.
  • platform/mac/svg/custom/mask-invalidation-expected.txt: Added.
  • svg/custom/mask-invalidation.svg: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r54628 r54638  
     12010-02-10  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Simon Fraser and Darin Adler.
     4
     5        Test for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
     6        Mask not invalidating
     7
     8        * platform/mac/svg/custom/mask-invalidation-expected.checksum: Added.
     9        * platform/mac/svg/custom/mask-invalidation-expected.png: Added.
     10        * platform/mac/svg/custom/mask-invalidation-expected.txt: Added.
     11        * svg/custom/mask-invalidation.svg: Added.
     12
    1132010-02-10  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/WebCore/ChangeLog

    r54637 r54638  
     12010-02-10  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Simon Fraser and Darin Adler.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
     6        Mask not invalidating
     7
     8        SVGMaskElement is the only class that keeps a HashMap of canvas
     9        resources rather than just a pointer to a resource. This
     10        patch makes SVGMaskElement invalidate all of its resources in the
     11        HashMap instead of just one.
     12
     13        * svg/SVGMaskElement.cpp:
     14        (WebCore::SVGMaskElement::svgAttributeChanged):
     15        (WebCore::SVGMaskElement::childrenChanged):
     16        (WebCore::SVGMaskElement::invalidateCanvasResources):
     17        * svg/SVGMaskElement.h:
     18        * svg/SVGStyledElement.cpp:
     19        (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
     20        (WebCore::SVGStyledElement::invalidateCanvasResources):
     21        * svg/SVGStyledElement.h:
     22
    1232010-02-10  Stephan Aßmus  <superstippi@gmx.de>
    224
  • trunk/WebCore/svg/SVGMaskElement.cpp

    r54503 r54638  
    106106    SVGStyledElement::svgAttributeChanged(attrName);
    107107
    108     if (m_masker.isEmpty())
    109         return;
    110 
    111108    if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
    112109        attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
     
    117114        SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
    118115        SVGStyledElement::isKnownAttribute(attrName))
    119         for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
    120             it->second->invalidate();
     116        invalidateCanvasResources();
    121117}
    122118
     
    152148{
    153149    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    154 
    155     if (m_masker.isEmpty())
    156         return;
    157 
    158     for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
    159         it->second->invalidate();
     150    invalidateCanvasResources();
    160151}
    161152
     
    286277}
    287278
     279void SVGMaskElement::invalidateCanvasResources()
     280{
     281    // Don't call through to the base class since the base class will just
     282    // invalidate one item in the HashMap.
     283    HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator end = m_masker.end();
     284    for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator it = m_masker.begin(); it != end; ++it)
     285        it->second->invalidate();
     286}
     287
    288288}
    289289
  • trunk/WebCore/svg/SVGMaskElement.h

    r53879 r54638  
    7272        DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
    7373
     74        virtual void invalidateCanvasResources();
     75
    7476        HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
    7577    };
  • trunk/WebCore/svg/SVGStyledElement.cpp

    r54009 r54638  
    252252
    253253        SVGElement* element = static_cast<SVGElement*>(node);
    254         if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) {
    255             if (SVGResource* resource = styledElement->canvasResource(node->renderer()))
    256                 resource->invalidate();
    257         }
     254        if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0))
     255            styledElement->invalidateCanvasResources();
    258256
    259257        node = node->parentNode();
    260258    }
     259}
     260
     261void SVGStyledElement::invalidateCanvasResources()
     262{
     263    if (SVGResource* resource = canvasResource(renderer()))
     264        resource->invalidate();
    261265}
    262266
  • trunk/WebCore/svg/SVGStyledElement.h

    r54009 r54638  
    7272        static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
    7373
     74        virtual void invalidateCanvasResources();
     75
    7476    private:
    7577        DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
Note: See TracChangeset for help on using the changeset viewer.