Crash in WebCore::RenderSVGContainer::paint
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 14:42:10 +0000 (14:42 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 14:42:10 +0000 (14:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86392

Reviewed by Rob Buis.

Source/WebCore:

Modernize the <marker> code, switch to the same design pattern used for handling zero-length subpaths.
Decouple the generation of the marker start/mid/end positions from the actual usage of these information.
Only generate those marker positions if the underlying Path changes, and never else.

When figuring out the bounds for a shape, access to current set of RenderSVGResourceMarker start/mid/end resources
and ask the marker resources for their bounds using the previously figured out marker positions on the Path.
Drawing markers is handled in the same way.

Remove SVGMarkerLayoutInfo alltogether which stored raw pointers to the RenderSVGResourceMarkers.
We assumed that those objects would stay alive from layout() to paint(), but that assumption is wrong.

Tests: svg/custom/bug86392.html
       svg/custom/marker-zero-length-linecaps-expected.svg
       svg/custom/marker-zero-length-linecaps.svg

* CMakeLists.txt: Remove SVGMarkerLayoutInfo.*.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.order: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* rendering/svg/RenderSVGAllInOne.cpp: Ditto.
* rendering/svg/RenderSVGShape.cpp: Handle markers just like the existing zero leng subpath code, which is superior.
(WebCore::RenderSVGShape::createShape):
(WebCore::RenderSVGShape::layout):
(WebCore::RenderSVGShape::shouldGenerateMarkerPositions):
(WebCore::RenderSVGShape::paint):
(WebCore::markerForType):
(WebCore::RenderSVGShape::markerRect):
(WebCore::RenderSVGShape::inflateWithStrokeAndMarkerBounds):
(WebCore::RenderSVGShape::drawMarkers):
(WebCore::RenderSVGShape::processMarkerPositions):
* rendering/svg/RenderSVGShape.h:
(RenderSVGShape):
* rendering/svg/SVGMarkerData.h:
(WebCore::MarkerPosition::MarkerPosition):
(MarkerPosition):
(WebCore::SVGMarkerData::SVGMarkerData):
(WebCore::SVGMarkerData::updateFromPathElement):
(WebCore::SVGMarkerData::pathIsDone):
(SVGMarkerData):
(WebCore::SVGMarkerData::currentAngle):
* rendering/svg/SVGMarkerLayoutInfo.cpp: Removed.
* rendering/svg/SVGMarkerLayoutInfo.h: Removed.
* rendering/svg/SVGResourcesCache.cpp:
(WebCore::resourcesCacheFromRenderObject):
(WebCore::SVGResourcesCache::cachedResourcesForRenderObject):
* rendering/svg/SVGResourcesCache.h:
(SVGResourcesCache):

LayoutTests:

* svg/custom/bug86392-expected.txt: Added.
* svg/custom/bug86392.html: Added.
* svg/custom/marker-zero-length-linecaps-expected.svg: Added.
* svg/custom/marker-zero-length-linecaps.svg: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@117971 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/custom/bug86392-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/bug86392.html [new file with mode: 0644]
LayoutTests/svg/custom/marker-zero-length-linecaps-expected.svg [new file with mode: 0644]
LayoutTests/svg/custom/marker-zero-length-linecaps.svg [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.order
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/svg/RenderSVGAllInOne.cpp
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGShape.h
Source/WebCore/rendering/svg/SVGMarkerData.h
Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp [deleted file]
Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h [deleted file]
Source/WebCore/rendering/svg/SVGResourcesCache.cpp
Source/WebCore/rendering/svg/SVGResourcesCache.h

index ec5e77b..0957938 100644 (file)
@@ -1,3 +1,15 @@
+2012-05-22  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Crash in WebCore::RenderSVGContainer::paint
+        https://bugs.webkit.org/show_bug.cgi?id=86392
+
+        Reviewed by Rob Buis.
+
+        * svg/custom/bug86392-expected.txt: Added.
+        * svg/custom/bug86392.html: Added.
+        * svg/custom/marker-zero-length-linecaps-expected.svg: Added.
+        * svg/custom/marker-zero-length-linecaps.svg: Added.
+
 2012-05-22  Thiago Marcos P. Santos  <thiago.santos@intel.com>
 
         [EFL] Gardening of failing tests and new passes
diff --git a/LayoutTests/svg/custom/bug86392-expected.txt b/LayoutTests/svg/custom/bug86392-expected.txt
new file mode 100644 (file)
index 0000000..12376f2
--- /dev/null
@@ -0,0 +1 @@
+PASS: WebKit did not crash.
diff --git a/LayoutTests/svg/custom/bug86392.html b/LayoutTests/svg/custom/bug86392.html
new file mode 100644 (file)
index 0000000..9758901
--- /dev/null
@@ -0,0 +1,59 @@
+<html>
+<head>
+<style>
+#el1 {
+    border-left-style: double;
+}
+#el3 {
+    content: counter(c);
+}
+</style>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function executeTest() {
+    el0=document.createElementNS('http://www.w3.org/2000/svg', 'svg')
+    el0.setAttribute('marker-mid', 'url(#el4)')
+    document.body.appendChild(el0)
+    el1=document.createElementNS('http://www.w3.org/2000/svg', 'svg')
+    el1.setAttribute('id','el1')
+    document.body.appendChild(el1)
+    el2=document.createElementNS('http://www.w3.org/2000/svg', 'path')
+    el2.setAttribute('d', 'M 0 0 s 0 0 0 0 C 0 0 0 0 0 400 c 0 0 0 400 400 0')
+    el0.appendChild(el2)
+    el3=document.createElementNS('http://www.w3.org/2000/svg', 'svg')
+    el3.setAttribute('id','el3')
+    el1.appendChild(el3)
+    el4=document.createElementNS('http://www.w3.org/2000/svg', 'marker')
+    el4.setAttribute('id','el4')
+    el3.appendChild(el4)
+    scrollTo(0, 60)
+    document.body.style.zoom=0.1
+    document.designMode='on'
+    document.execCommand('selectall')
+    document.designMode='off'
+}
+
+window.onload = function(){
+    if (location.hash != "#2") {
+        if (location.hash)
+            location.hash = "#" + (parseInt(location.hash.slice(1)) + 1).toString();
+        else
+            location.hash = "#1";
+        executeTest();
+        setTimeout(function(){ location.reload() },0);
+    } else {
+        document.getElementById("div1").textContent = "PASS: WebKit did not crash.";
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+}
+</script>
+</head>
+<body>
+<div id="div1"></div>
+</body>
+</html>
diff --git a/LayoutTests/svg/custom/marker-zero-length-linecaps-expected.svg b/LayoutTests/svg/custom/marker-zero-length-linecaps-expected.svg
new file mode 100644 (file)
index 0000000..2e71410
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+    <path d="m 50 50 l 0 0" stroke="red" stroke-width="25" stroke-linecap="round"/>
+    <rect x="50" y="50" width="75" height="75" fill="green" opacity="0.5"/>
+
+    <path d="m 150 50 l 0 0" stroke="red" stroke-width="25" stroke-linecap="square"/>
+    <rect x="150" y="50" width="75" height="75" fill="green" opacity="0.5"/>
+</svg>
diff --git a/LayoutTests/svg/custom/marker-zero-length-linecaps.svg b/LayoutTests/svg/custom/marker-zero-length-linecaps.svg
new file mode 100644 (file)
index 0000000..b898291
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+    <title>Markers and zero-length 'path' and 'line' segments, when linecaps must be drawn for such segments.</title>
+    <defs>
+        <marker id="testMarker" viewBox="0 0 10 10">
+            <rect width="10" height="10" fill="green" opacity="0.5"/>
+        </marker>
+    </defs>
+    <path d="m 50 50 l 0 0" stroke="red" stroke-width="25" stroke-linecap="round" marker-end="url(#testMarker)"/>
+    <path d="m 150 50 l 0 0" stroke="red" stroke-width="25" stroke-linecap="square" marker-end="url(#testMarker)"/>
+</svg>
index 33d4f4f..e79b7e8 100644 (file)
@@ -1799,7 +1799,6 @@ IF (ENABLE_SVG)
         rendering/svg/RenderSVGViewportContainer.cpp
         rendering/svg/SVGInlineFlowBox.cpp
         rendering/svg/SVGInlineTextBox.cpp
-        rendering/svg/SVGMarkerLayoutInfo.cpp
         rendering/svg/SVGPathData.cpp
         rendering/svg/SVGRenderSupport.cpp
         rendering/svg/SVGRenderTreeAsText.cpp
index c51f03b..dc0841c 100644 (file)
@@ -1,3 +1,61 @@
+2012-05-22  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Crash in WebCore::RenderSVGContainer::paint
+        https://bugs.webkit.org/show_bug.cgi?id=86392
+
+        Reviewed by Rob Buis.
+
+        Modernize the <marker> code, switch to the same design pattern used for handling zero-length subpaths.
+        Decouple the generation of the marker start/mid/end positions from the actual usage of these information.
+        Only generate those marker positions if the underlying Path changes, and never else.
+
+        When figuring out the bounds for a shape, access to current set of RenderSVGResourceMarker start/mid/end resources
+        and ask the marker resources for their bounds using the previously figured out marker positions on the Path.
+        Drawing markers is handled in the same way.
+
+        Remove SVGMarkerLayoutInfo alltogether which stored raw pointers to the RenderSVGResourceMarkers.
+        We assumed that those objects would stay alive from layout() to paint(), but that assumption is wrong.
+
+        Tests: svg/custom/bug86392.html
+               svg/custom/marker-zero-length-linecaps-expected.svg
+               svg/custom/marker-zero-length-linecaps.svg
+
+        * CMakeLists.txt: Remove SVGMarkerLayoutInfo.*.
+        * GNUmakefile.list.am: Ditto.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.order: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * rendering/svg/RenderSVGAllInOne.cpp: Ditto.
+        * rendering/svg/RenderSVGShape.cpp: Handle markers just like the existing zero leng subpath code, which is superior.
+        (WebCore::RenderSVGShape::createShape):
+        (WebCore::RenderSVGShape::layout):
+        (WebCore::RenderSVGShape::shouldGenerateMarkerPositions):
+        (WebCore::RenderSVGShape::paint):
+        (WebCore::markerForType):
+        (WebCore::RenderSVGShape::markerRect):
+        (WebCore::RenderSVGShape::inflateWithStrokeAndMarkerBounds):
+        (WebCore::RenderSVGShape::drawMarkers):
+        (WebCore::RenderSVGShape::processMarkerPositions):
+        * rendering/svg/RenderSVGShape.h:
+        (RenderSVGShape):
+        * rendering/svg/SVGMarkerData.h:
+        (WebCore::MarkerPosition::MarkerPosition):
+        (MarkerPosition):
+        (WebCore::SVGMarkerData::SVGMarkerData):
+        (WebCore::SVGMarkerData::updateFromPathElement):
+        (WebCore::SVGMarkerData::pathIsDone):
+        (SVGMarkerData):
+        (WebCore::SVGMarkerData::currentAngle):
+        * rendering/svg/SVGMarkerLayoutInfo.cpp: Removed.
+        * rendering/svg/SVGMarkerLayoutInfo.h: Removed.
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::resourcesCacheFromRenderObject):
+        (WebCore::SVGResourcesCache::cachedResourcesForRenderObject):
+        * rendering/svg/SVGResourcesCache.h:
+        (SVGResourcesCache):
+
 2012-05-22  Alexander Pavlov  <apavlov@chromium.org>
 
         [Chromium] Implement the ContextMenuItem SubMenu type
index b40ed0c..3479158 100644 (file)
@@ -4087,8 +4087,6 @@ webcore_sources += \
        Source/WebCore/rendering/svg/SVGInlineTextBox.cpp \
        Source/WebCore/rendering/svg/SVGInlineTextBox.h \
        Source/WebCore/rendering/svg/SVGMarkerData.h \
-       Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp \
-       Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h \
        Source/WebCore/rendering/svg/SVGPathData.cpp \
        Source/WebCore/rendering/svg/SVGPathData.h \
        Source/WebCore/rendering/svg/SVGRenderSupport.cpp \
index 4619b4d..06b1d5c 100644 (file)
@@ -2575,7 +2575,6 @@ HEADERS += \
     rendering/svg/SVGInlineFlowBox.h \
     rendering/svg/SVGInlineTextBox.h \
     rendering/svg/SVGMarkerData.h \
-    rendering/svg/SVGMarkerLayoutInfo.h \
     rendering/svg/SVGPathData.h \
     rendering/svg/SVGRenderSupport.h \
     rendering/svg/SVGRenderTreeAsText.h \
@@ -3538,7 +3537,6 @@ contains(DEFINES, ENABLE_SVG=1) {
               rendering/svg/RenderSVGViewportContainer.cpp \
               rendering/svg/SVGInlineFlowBox.cpp \
               rendering/svg/SVGInlineTextBox.cpp \
-              rendering/svg/SVGMarkerLayoutInfo.cpp \
               rendering/svg/SVGPathData.cpp \
               rendering/svg/SVGRenderSupport.cpp \
               rendering/svg/SVGRenderTreeAsText.cpp \
index a14d1f1..c89b622 100644 (file)
             'rendering/svg/SVGInlineTextBox.cpp',
             'rendering/svg/SVGInlineTextBox.h',
             'rendering/svg/SVGMarkerData.h',
-            'rendering/svg/SVGMarkerLayoutInfo.cpp',
-            'rendering/svg/SVGMarkerLayoutInfo.h',
             'rendering/svg/SVGPathData.cpp',
             'rendering/svg/SVGPathData.h',
             'rendering/svg/SVGRenderSupport.cpp',
             'rendering/svg/SVGInlineTextBox.cpp',
             'rendering/svg/SVGInlineTextBox.h',
             'rendering/svg/SVGMarkerData.h',
-            'rendering/svg/SVGMarkerLayoutInfo.cpp',
-            'rendering/svg/SVGMarkerLayoutInfo.h',
             'rendering/svg/SVGPathData.cpp',
             'rendering/svg/SVGPathData.h',
             'rendering/svg/SVGRenderSupport.cpp',
index 2dc3e32..1af438b 100644 (file)
@@ -28902,10 +28902,8 @@ __ZN7WebCore23RenderSVGResourceMarker12calcViewportEv
 __ZN7WebCore18RenderSVGContainer23calculateLocalTransformEv
 __ZN7WebCore13RenderSVGPath29calculateMarkerBoundsIfNeededEv
 __ZNK7WebCore14SVGPathElement15supportsMarkersEv
-__ZN7WebCore19SVGMarkerLayoutInfo19calculateBoundariesEPNS_23RenderSVGResourceMarkerES2_S2_fRKNS_4PathE
 __ZN7WebCoreL25processStartAndMidMarkersEPvPKNS_11PathElementE
 __ZN7WebCore13SVGMarkerData30updateMarkerDataForPathElementEPKNS_11PathElementE
-__ZN7WebCore19SVGMarkerLayoutInfo17addLayoutedMarkerEPNS_23RenderSVGResourceMarkerERKNS_10FloatPointEf
 __ZNK7WebCore23RenderSVGResourceMarker20markerTransformationERKNS_10FloatPointEff
 __ZNK7WebCore8SVGAngle5valueEv
 __ZNK7WebCore23RenderSVGResourceMarker27markerContentTransformationERKNS_15AffineTransformERKNS_10FloatPointEf
index 3ffdad6..d602fb7 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\rendering\svg\SVGMarkerLayoutInfo.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug_Cairo_CFLite|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release_Cairo_CFLite|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug_All|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Production|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\rendering\svg\SVGMarkerLayoutInfo.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\rendering\svg\SVGPathData.cpp"
                                >
                                <FileConfiguration
index d4dc3a7..412b571 100644 (file)
                436708E912D9CA4B00044234 /* RenderSVGTransformableContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AA12D9CA4B00044234 /* RenderSVGTransformableContainer.h */; };
                436708EB12D9CA4B00044234 /* RenderSVGViewportContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */; };
                436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AF12D9CA4B00044234 /* SVGMarkerData.h */; };
-               436708F012D9CA4B00044234 /* SVGMarkerLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */; };
                436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B312D9CA4B00044234 /* SVGRenderSupport.h */; };
                436708F412D9CA4B00044234 /* SVGRenderTreeAsText.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B512D9CA4B00044234 /* SVGRenderTreeAsText.h */; };
                436708F612D9CA4B00044234 /* SVGResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B712D9CA4B00044234 /* SVGResources.h */; };
                436708AB12D9CA4B00044234 /* RenderSVGViewportContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGViewportContainer.cpp; sourceTree = "<group>"; };
                436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGViewportContainer.h; sourceTree = "<group>"; };
                436708AF12D9CA4B00044234 /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; };
-               436708B012D9CA4B00044234 /* SVGMarkerLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMarkerLayoutInfo.cpp; sourceTree = "<group>"; };
-               436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerLayoutInfo.h; sourceTree = "<group>"; };
                436708B212D9CA4B00044234 /* SVGRenderSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderSupport.cpp; sourceTree = "<group>"; };
                436708B312D9CA4B00044234 /* SVGRenderSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRenderSupport.h; sourceTree = "<group>"; };
                436708B412D9CA4B00044234 /* SVGRenderTreeAsText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderTreeAsText.cpp; sourceTree = "<group>"; };
                                0854B00E1255E4E600B9CDD0 /* SVGInlineTextBox.cpp */,
                                0854B00F1255E4E600B9CDD0 /* SVGInlineTextBox.h */,
                                436708AF12D9CA4B00044234 /* SVGMarkerData.h */,
-                               436708B012D9CA4B00044234 /* SVGMarkerLayoutInfo.cpp */,
-                               436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */,
                                715379FE146BD9D6008BD615 /* SVGPathData.cpp */,
                                715379FF146BD9D6008BD615 /* SVGPathData.h */,
                                197B180A150634C000E4ADA8 /* SVGRenderingContext.cpp */,
                                B2227A410D00BF220071B782 /* SVGLocatable.h in Headers */,
                                436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */,
                                B2227A440D00BF220071B782 /* SVGMarkerElement.h in Headers */,
-                               436708F012D9CA4B00044234 /* SVGMarkerLayoutInfo.h in Headers */,
                                B2227A470D00BF220071B782 /* SVGMaskElement.h in Headers */,
                                0806E57A12893045007CED32 /* SVGMatrix.h in Headers */,
                                B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */,
index 334f6ee..a6bcd02 100644 (file)
@@ -58,7 +58,6 @@
 #include "RenderSVGViewportContainer.cpp"
 #include "SVGInlineFlowBox.cpp"
 #include "SVGInlineTextBox.cpp"
-#include "SVGMarkerLayoutInfo.cpp"
 #include "SVGPathData.cpp"
 #include "SVGRenderSupport.cpp"
 #include "SVGRenderTreeAsText.cpp"
index 9769f92..9c71399 100755 (executable)
@@ -40,7 +40,6 @@
 #include "RenderSVGResourceMarker.h"
 #include "RenderSVGResourceSolidColor.h"
 #include "SVGPathData.h"
-#include "SVGPathElement.h"
 #include "SVGRenderingContext.h"
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
@@ -72,9 +71,10 @@ void RenderSVGShape::createShape()
     m_path = adoptPtr(new Path);
     ASSERT(isEmpty());
 
-    SVGPathElement* element = static_cast<SVGPathElement*>(node());
+    SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
     updatePathFromGraphicsElement(element, path());
     processZeroLengthSubpaths();
+    processMarkerPositions();
 }
 
 bool RenderSVGShape::isEmpty() const
@@ -187,10 +187,8 @@ void RenderSVGShape::layout()
     }
 
     // Invalidate all resources of this client if our layout changed.
-    if (everHadLayout() && selfNeedsLayout()) {
+    if (everHadLayout() && selfNeedsLayout())
         SVGResourcesCache::clientLayoutChanged(this);
-        m_markerLayoutInfo.clear();
-    }
 
     // At this point LayoutRepainter already grabbed the old bounds,
     // recalculate them now so repaintAfterLayout() uses the new bounds.
@@ -240,6 +238,22 @@ bool RenderSVGShape::shouldStrokeZeroLengthSubpath() const
     return style()->svgStyle()->hasStroke() && style()->svgStyle()->capStyle() != ButtCap;
 }
 
+bool RenderSVGShape::shouldGenerateMarkerPositions() const
+{
+    if (!style()->svgStyle()->hasMarkers())
+        return false;
+
+    SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
+    if (!element->supportsMarkers())
+        return false;
+
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
+    if (!resources)
+        return false;
+
+    return resources->markerStart() || resources->markerMid() || resources->markerEnd();
+}
+
 FloatRect RenderSVGShape::zeroLengthSubpathRect(const FloatPoint& linecapPosition, float strokeWidth) const
 {
     return FloatRect(linecapPosition.x() - strokeWidth / 2, linecapPosition.y() - strokeWidth / 2, strokeWidth, strokeWidth);
@@ -353,9 +367,8 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
                     childPaintInfo.context->setShouldAntialias(false);
 
                 fillAndStrokePath(childPaintInfo.context);
-
-                if (svgStyle->hasMarkers())
-                    m_markerLayoutInfo.drawMarkers(childPaintInfo);
+                if (!m_markerPositions.isEmpty())
+                    drawMarkers(childPaintInfo);
             }
         }
 
@@ -400,30 +413,40 @@ bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
     return false;
 }
 
-FloatRect RenderSVGShape::calculateMarkerBoundsIfNeeded()
+static inline RenderSVGResourceMarker* markerForType(SVGMarkerType type, RenderSVGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, RenderSVGResourceMarker* markerEnd)
 {
-    SVGElement* svgElement = static_cast<SVGElement*>(node());
-    ASSERT(svgElement && svgElement->document());
-    if (!svgElement->isStyled())
-        return FloatRect();
+    switch (type) {
+    case StartMarker:
+        return markerStart;
+    case MidMarker:
+        return markerMid;
+    case EndMarker:
+        return markerEnd;
+    }
 
-    SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
-    if (!styledElement->supportsMarkers())
-        return FloatRect();
+    ASSERT_NOT_REACHED();
+    return 0;
+}
 
-    ASSERT(style()->svgStyle()->hasMarkers());
+FloatRect RenderSVGShape::markerRect(float strokeWidth) const
+{
+    ASSERT(!m_markerPositions.isEmpty());
 
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
-    if (!resources)
-        return FloatRect();
+    ASSERT(resources);
 
     RenderSVGResourceMarker* markerStart = resources->markerStart();
     RenderSVGResourceMarker* markerMid = resources->markerMid();
     RenderSVGResourceMarker* markerEnd = resources->markerEnd();
-    if (!markerStart && !markerMid && !markerEnd)
-        return FloatRect();
+    ASSERT(markerStart || markerMid || markerEnd);
 
-    return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth(), path());
+    FloatRect boundaries;
+    unsigned size = m_markerPositions.size();
+    for (unsigned i = 0; i < size; ++i) {
+        if (RenderSVGResourceMarker* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd))
+            boundaries.unite(marker->markerBoundaries(marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth)));
+    }
+    return boundaries;
 }
 
 void RenderSVGShape::updateCachedBoundaries()
@@ -463,7 +486,6 @@ float RenderSVGShape::strokeWidth() const
 void RenderSVGShape::inflateWithStrokeAndMarkerBounds()
 {
     const SVGRenderStyle* svgStyle = style()->svgStyle();
-    FloatRect strokeRect;
     if (svgStyle->hasStroke()) {
         BoundingRectStrokeStyleApplier strokeStyle(this, style());
 
@@ -479,10 +501,29 @@ void RenderSVGShape::inflateWithStrokeAndMarkerBounds()
         } else
             m_strokeAndMarkerBoundingBox.unite(path().strokeBoundingRect(&strokeStyle));
     }
-    if (svgStyle->hasMarkers()) {
-        FloatRect markerBounds = calculateMarkerBoundsIfNeeded();
-        if (!markerBounds.isEmpty())
-            m_strokeAndMarkerBoundingBox.unite(markerBounds);
+    if (!m_markerPositions.isEmpty())
+        m_strokeAndMarkerBoundingBox.unite(markerRect(strokeWidth()));
+}
+
+void RenderSVGShape::drawMarkers(PaintInfo& paintInfo)
+{
+    ASSERT(!m_markerPositions.isEmpty());
+
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
+    if (!resources)
+        return;
+
+    RenderSVGResourceMarker* markerStart = resources->markerStart();
+    RenderSVGResourceMarker* markerMid = resources->markerMid();
+    RenderSVGResourceMarker* markerEnd = resources->markerEnd();
+    if (!markerStart && !markerMid && !markerEnd)
+        return;
+
+    float strokeWidth = this->strokeWidth();
+    unsigned size = m_markerPositions.size();
+    for (unsigned i = 0; i < size; ++i) {
+        if (RenderSVGResourceMarker* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd))
+            marker->draw(paintInfo, marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth));
     }
 }
 
@@ -501,6 +542,20 @@ void RenderSVGShape::processZeroLengthSubpaths()
     subpathData.pathIsDone();
 }
 
+void RenderSVGShape::processMarkerPositions()
+{
+    m_markerPositions.clear();
+
+    if (!shouldGenerateMarkerPositions())
+        return;
+
+    ASSERT(m_path);
+
+    SVGMarkerData markerData(m_markerPositions);
+    m_path->apply(&markerData, SVGMarkerData::updateFromPathElement);
+    markerData.pathIsDone();
+}
+
 }
 
 #endif // ENABLE(SVG)
index 76ac560..5d97bfd 100644 (file)
@@ -30,7 +30,7 @@
 #include "AffineTransform.h"
 #include "FloatRect.h"
 #include "RenderSVGModelObject.h"
-#include "SVGMarkerLayoutInfo.h"
+#include "SVGMarkerData.h"
 #include "StrokeStyleApplier.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
@@ -93,9 +93,6 @@ protected:
     virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const;
     float strokeWidth() const;
     void setIsPaintingFallback(bool isFallback) { m_fillFallback = isFallback; }
-    FloatRect calculateMarkerBoundsIfNeeded();
-    void processZeroLengthSubpaths();
-
     bool hasPath() const { return m_path.get(); }
     bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; }
 
@@ -126,21 +123,27 @@ private:
     Path* zeroLengthLinecapPath(const FloatPoint&);
     bool shouldStrokeZeroLengthSubpath() const;
     FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const;
+    void processZeroLengthSubpaths();
+
+    bool shouldGenerateMarkerPositions() const;
+    FloatRect markerRect(float strokeWidth) const;
+    void processMarkerPositions();
 
     void fillShape(RenderStyle*, GraphicsContext*, Path*, RenderSVGShape*);
     void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*,
                     const Color&, int);
     void fillAndStrokePath(GraphicsContext*);
     void inflateWithStrokeAndMarkerBounds();
+    void drawMarkers(PaintInfo&);
 
 private:
     FloatRect m_fillBoundingBox;
     FloatRect m_strokeAndMarkerBoundingBox;
     FloatRect m_repaintBoundingBox;
-    SVGMarkerLayoutInfo m_markerLayoutInfo;
     AffineTransform m_localTransform;
     OwnPtr<Path> m_path;
     Vector<FloatPoint> m_zeroLengthLinecapLocations;
+    Vector<MarkerPosition> m_markerPositions;
 
     bool m_needsBoundariesUpdate : 1;
     bool m_needsShapeUpdate : 1;
index 57c35cd..7e2ce0e 100644 (file)
@@ -29,25 +29,58 @@ namespace WebCore {
 
 class RenderSVGResourceMarker;
 
+enum SVGMarkerType {
+    StartMarker,
+    MidMarker,
+    EndMarker
+};
+
+struct MarkerPosition {
+    MarkerPosition(SVGMarkerType useType, const FloatPoint& useOrigin, float useAngle)
+        : type(useType)
+        , origin(useOrigin)
+        , angle(useAngle)
+    {
+    }
+
+    SVGMarkerType type;
+    FloatPoint origin;
+    float angle;
+};
+
 class SVGMarkerData {
 public:
-    enum Type {
-        Unknown = 0,
-        Start,
-        Mid,
-        End
-    };
-
-    SVGMarkerData(const Type& type = Unknown, RenderSVGResourceMarker* marker = 0)
-        : m_type(type)
-        , m_marker(marker)
+    SVGMarkerData(Vector<MarkerPosition>& positions)
+        : m_positions(positions)
+        , m_elementIndex(0)
     {
     }
 
-    FloatPoint origin() const { return m_origin; }
-    RenderSVGResourceMarker* marker() const { return m_marker; }
+    static void updateFromPathElement(void* info, const PathElement* element)
+    {
+        SVGMarkerData* markerData = static_cast<SVGMarkerData*>(info);
+
+        // First update the outslope for the previous element.
+        markerData->updateOutslope(element->points[0]);
+
+        // Record the marker for the previous element.
+        if (markerData->m_elementIndex > 0) {
+            SVGMarkerType markerType = markerData->m_elementIndex == 1 ? StartMarker : MidMarker;
+            markerData->m_positions.append(MarkerPosition(markerType, markerData->m_origin, markerData->currentAngle(markerType)));
+        }
+
+        // Update our marker data for this element.
+        markerData->updateMarkerDataForPathElement(element);
+        ++markerData->m_elementIndex;
+    }
 
-    float currentAngle() const
+    void pathIsDone()
+    {
+        m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndMarker)));
+    }
+
+private:
+    float currentAngle(SVGMarkerType type) const
     {
         FloatSize inslopeChange = m_inslopePoints[1] - m_inslopePoints[0];
         FloatSize outslopeChange = m_outslopePoints[1] - m_outslopePoints[0];
@@ -55,29 +88,17 @@ public:
         double inslope = rad2deg(atan2(inslopeChange.height(), inslopeChange.width()));
         double outslope = rad2deg(atan2(outslopeChange.height(), outslopeChange.width()));
 
-        double angle = 0;
-        switch (m_type) {
-        case Start:
-            angle = outslope;
-            break;
-        case Mid:
-            angle = (inslope + outslope) / 2;
-            break;
-        case End:
-            angle = inslope;
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-            break;
+        switch (type) {
+        case StartMarker:
+            return narrowPrecisionToFloat(outslope);
+        case MidMarker:
+            return narrowPrecisionToFloat((inslope + outslope) / 2);
+        case EndMarker:
+            return narrowPrecisionToFloat(inslope);
         }
 
-        return narrowPrecisionToFloat(angle);
-    }
-
-    void updateTypeAndMarker(const Type& type, RenderSVGResourceMarker* marker)
-    {
-        m_type = type;
-        m_marker = marker;
+        ASSERT_NOT_REACHED();
+        return 0;
     }
 
     void updateOutslope(const FloatPoint& point)
@@ -113,15 +134,14 @@ public:
         }
     }
 
-private:
     void updateInslope(const FloatPoint& point)
     {
         m_inslopePoints[0] = m_origin;
         m_inslopePoints[1] = point;
     }
 
-    Type m_type;
-    RenderSVGResourceMarker* m_marker;
+    Vector<MarkerPosition>& m_positions;
+    unsigned m_elementIndex;
     FloatPoint m_origin;
     FloatPoint m_subpathStart;
     FloatPoint m_inslopePoints[2];
diff --git a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp
deleted file mode 100644 (file)
index 27b37f1..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
- * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
- * Copyright (C) 2009 Google, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGMarkerLayoutInfo.h"
-
-#include "RenderSVGResourceMarker.h"
-
-namespace WebCore {
-
-SVGMarkerLayoutInfo::SVGMarkerLayoutInfo()
-    : m_midMarker(0)
-    , m_elementIndex(0)
-    , m_strokeWidth(0)
-{
-}
-
-SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo()
-{
-}
-
-static inline void processStartAndMidMarkers(void* infoPtr, const PathElement* element)
-{
-    SVGMarkerLayoutInfo& info = *reinterpret_cast<SVGMarkerLayoutInfo*>(infoPtr);
-    SVGMarkerData& markerData = info.markerData();
-    int& elementIndex = info.elementIndex();
-
-    // First update the outslope for the previous element
-    markerData.updateOutslope(element->points[0]);
-
-    // Draw the marker for the previous element
-    RenderSVGResourceMarker* marker = markerData.marker();
-    if (elementIndex > 0 && marker)
-        info.addLayoutedMarker(marker, markerData.origin(), markerData.currentAngle());
-
-    // Update our marker data for this element
-    markerData.updateMarkerDataForPathElement(element);
-
-    // After drawing the start marker, switch to drawing mid markers
-    if (elementIndex == 1)
-        markerData.updateTypeAndMarker(SVGMarkerData::Mid, info.midMarker());
-
-    ++elementIndex;
-}
-
-FloatRect SVGMarkerLayoutInfo::calculateBoundaries(RenderSVGResourceMarker* startMarker, RenderSVGResourceMarker* midMarker, RenderSVGResourceMarker* endMarker, float strokeWidth, const Path& path)
-{
-    m_layout.clear();
-    m_midMarker = midMarker;
-    m_strokeWidth = strokeWidth;
-    m_elementIndex = 0;
-    m_markerData = SVGMarkerData(SVGMarkerData::Start, startMarker);
-    path.apply(this, processStartAndMidMarkers);
-
-    if (endMarker) {
-        m_markerData.updateTypeAndMarker(SVGMarkerData::End, endMarker);
-        addLayoutedMarker(endMarker, m_markerData.origin(), m_markerData.currentAngle());
-    }
-
-    if (m_layout.isEmpty())
-        return FloatRect();
-
-    Vector<MarkerLayout>::iterator it = m_layout.begin();
-    Vector<MarkerLayout>::iterator end = m_layout.end();
-
-    FloatRect bounds;
-    for (; it != end; ++it) {
-        MarkerLayout& layout = *it;
-
-        RenderSVGResourceMarker* markerContent = layout.marker;
-        ASSERT(markerContent);
-
-        bounds.unite(markerContent->markerBoundaries(layout.matrix));
-    }
-
-    return bounds;
-}
-
-void SVGMarkerLayoutInfo::clear()
-{
-    m_midMarker = 0;
-    m_elementIndex = 0;
-    m_strokeWidth = 0;
-    m_markerData.updateTypeAndMarker(SVGMarkerData::Unknown, 0);
-    m_layout.clear();
-}
-
-void SVGMarkerLayoutInfo::drawMarkers(PaintInfo& paintInfo)
-{
-    if (m_layout.isEmpty())
-        return;
-
-    Vector<MarkerLayout>::iterator it = m_layout.begin();
-    Vector<MarkerLayout>::iterator end = m_layout.end();
-
-    for (; it != end; ++it) {
-        MarkerLayout& layout = *it;
-        layout.marker->draw(paintInfo, layout.matrix);
-    }
-}
-
-void SVGMarkerLayoutInfo::addLayoutedMarker(RenderSVGResourceMarker* marker, const FloatPoint& origin, float angle)
-{
-    ASSERT(marker);
-    m_layout.append(MarkerLayout(marker, marker->markerTransformation(origin, angle, m_strokeWidth)));
-}
-
-}
-
-#endif // ENABLE(SVG)
diff --git a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h
deleted file mode 100644 (file)
index c2301cc..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SVGMarkerLayoutInfo_h
-#define SVGMarkerLayoutInfo_h
-
-#if ENABLE(SVG)
-#include "AffineTransform.h"
-#include "RenderObject.h"
-#include "SVGMarkerData.h"
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class Path;
-class RenderSVGResourceMarker;
-
-struct MarkerLayout {
-    MarkerLayout(RenderSVGResourceMarker* markerObj = 0, AffineTransform matrixObj = AffineTransform())
-        : marker(markerObj)
-        , matrix(matrixObj)
-    {
-        ASSERT(marker);
-    }
-
-    RenderSVGResourceMarker* marker;
-    AffineTransform matrix;
-};
-
-class SVGMarkerLayoutInfo {
-    WTF_MAKE_NONCOPYABLE(SVGMarkerLayoutInfo);
-public:
-    SVGMarkerLayoutInfo();
-    ~SVGMarkerLayoutInfo();
-
-    FloatRect calculateBoundaries(RenderSVGResourceMarker* startMarker, RenderSVGResourceMarker* midMarker, RenderSVGResourceMarker* endMarker, float strokeWidth, const Path&);
-    void drawMarkers(PaintInfo&);
-
-    // Used by static inline helper functions in SVGMarkerLayoutInfo.cpp
-    SVGMarkerData& markerData() { return m_markerData; }
-    RenderSVGResourceMarker* midMarker() const { return m_midMarker; }
-    int& elementIndex() { return m_elementIndex; }
-    void addLayoutedMarker(RenderSVGResourceMarker*, const FloatPoint& origin, float angle);
-    void clear();
-
-private:
-    RenderSVGResourceMarker* m_midMarker;
-
-    // Used while layouting markers
-    int m_elementIndex;
-    SVGMarkerData m_markerData;
-    float m_strokeWidth;
-
-    // Holds the final computed result
-    Vector<MarkerLayout> m_layout;
-};
-
-}
-
-#endif
-#endif
index 03e6c7b..1715f6c 100644 (file)
@@ -89,7 +89,7 @@ void SVGResourcesCache::removeResourcesFromRenderObject(RenderObject* object)
     delete m_cache.take(object);
 }
 
-static inline SVGResourcesCache* resourcesCacheFromRenderObject(RenderObject* renderer)
+static inline SVGResourcesCache* resourcesCacheFromRenderObject(const RenderObject* renderer)
 {
     Document* document = renderer->document();
     ASSERT(document);
@@ -103,7 +103,7 @@ static inline SVGResourcesCache* resourcesCacheFromRenderObject(RenderObject* re
     return cache;
 }
 
-SVGResources* SVGResourcesCache::cachedResourcesForRenderObject(RenderObject* renderer)
+SVGResources* SVGResourcesCache::cachedResourcesForRenderObject(const RenderObject* renderer)
 {
     ASSERT(renderer);
     SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
@@ -170,8 +170,8 @@ void SVGResourcesCache::resourceDestroyed(RenderSVGResourceContainer* resource)
     // The resource itself may have clients, that need to be notified.
     cache->removeResourcesFromRenderObject(resource);
 
-    HashMap<RenderObject*, SVGResources*>::iterator end = cache->m_cache.end();
-    for (HashMap<RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) {
+    HashMap<const RenderObject*, SVGResources*>::iterator end = cache->m_cache.end();
+    for (HashMap<const RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) {
         it->second->resourceDestroyed(resource);
 
         // Mark users of destroyed resources as pending resolution based on the id of the old resource.
index 897c184..72e526a 100644 (file)
@@ -39,7 +39,7 @@ public:
 
     void addResourcesFromRenderObject(RenderObject*, const RenderStyle*);
     void removeResourcesFromRenderObject(RenderObject*);
-    static SVGResources* cachedResourcesForRenderObject(RenderObject*);
+    static SVGResources* cachedResourcesForRenderObject(const RenderObject*);
 
     // Called from all SVG renderers destroy() methods - except for RenderSVGResourceContainer.
     static void clientDestroyed(RenderObject*);
@@ -57,7 +57,7 @@ public:
     static void resourceDestroyed(RenderSVGResourceContainer*);
 
 private:
-    HashMap<RenderObject*, SVGResources*> m_cache;
+    HashMap<const RenderObject*, SVGResources*> m_cache;
 };
 
 }