Changeset 95047 in webkit


Ignore:
Timestamp:
Sep 13, 2011 2:54:02 PM (13 years ago)
Author:
timothy_horton@apple.com
Message:

REGRESSION (64275): Shape pattern-image fill turns black
https://bugs.webkit.org/show_bug.cgi?id=51061
<rdar://problem/8504705>

Reviewed by Simon Fraser.

Source/WebCore:

When destroying a resource, register clients who are losing their
resource as having pending resources, so they can be resolved in the case a
resource with that id is re-registered.

Test: svg/custom/pending-resource-after-removal.xhtml

  • rendering/svg/SVGResourcesCache.cpp:

(WebCore::SVGResourcesCache::resourceDestroyed):

  • svg/SVGStyledElement.h:

(WebCore::toSVGStyledElement): Added.

LayoutTests:

Add a test ensuring that replacing a SVG pattern without changing
the id causes the clients to be updated properly.

  • svg/custom/pending-resource-after-removal-expected.png: Added.
  • svg/custom/pending-resource-after-removal-expected.txt: Added.
  • svg/custom/pending-resource-after-removal.xhtml: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95043 r95047  
     12011-09-13  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (64275): Shape pattern-image fill turns black
     4        https://bugs.webkit.org/show_bug.cgi?id=51061
     5        <rdar://problem/8504705>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a test ensuring that replacing a SVG pattern without changing
     10        the id causes the clients to be updated properly.
     11
     12        * svg/custom/pending-resource-after-removal-expected.png: Added.
     13        * svg/custom/pending-resource-after-removal-expected.txt: Added.
     14        * svg/custom/pending-resource-after-removal.xhtml: Added.
     15
    1162011-09-13  Cary Clark  <caryclark@google.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r95040 r95047  
     12011-09-13  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (64275): Shape pattern-image fill turns black
     4        https://bugs.webkit.org/show_bug.cgi?id=51061
     5        <rdar://problem/8504705>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When destroying a resource, register clients who are losing their
     10        resource as having pending resources, so they can be resolved in the case a
     11        resource with that id is re-registered.
     12
     13        Test: svg/custom/pending-resource-after-removal.xhtml
     14
     15        * rendering/svg/SVGResourcesCache.cpp:
     16        (WebCore::SVGResourcesCache::resourceDestroyed):
     17        * svg/SVGStyledElement.h:
     18        (WebCore::toSVGStyledElement): Added.
     19
    1202011-09-13  Eric Seidel  <eric@webkit.org>
    221
  • trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp

    r83821 r95047  
    2222
    2323#if ENABLE(SVG)
     24#include "HTMLNames.h"
    2425#include "RenderSVGResourceContainer.h"
    2526#include "SVGDocumentExtensions.h"
    2627#include "SVGResources.h"
    2728#include "SVGResourcesCycleSolver.h"
     29#include "SVGStyledElement.h"
    2830
    2931namespace WebCore {
     
    161163
    162164    HashMap<RenderObject*, SVGResources*>::iterator end = cache->m_cache.end();
    163     for (HashMap<RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it)
     165    for (HashMap<RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) {
    164166        it->second->resourceDestroyed(resource);
     167
     168        // Mark users of destroyed resources as pending resolution based on the id of the old resource.
     169        Element* resourceElement = toElement(resource->node());
     170        SVGStyledElement* clientElement = toSVGStyledElement(it->first->node());
     171        SVGDocumentExtensions* extensions = clientElement->document()->accessSVGExtensions();
     172
     173        extensions->addPendingResource(resourceElement->fastGetAttribute(HTMLNames::idAttr), clientElement);
     174    }
    165175}
    166176
  • trunk/Source/WebCore/svg/SVGStyledElement.h

    r94928 r95047  
    9797};
    9898
     99inline SVGStyledElement* toSVGStyledElement(Node* node)
     100{
     101    ASSERT(!node || (node->isStyledElement() && node->isSVGElement()));
     102    return static_cast<SVGStyledElement*>(node);
     103}
     104
    99105} // namespace WebCore
    100106
Note: See TracChangeset for help on using the changeset viewer.