Title: [120951] trunk
Revision
120951
Author
[email protected]
Date
2012-06-21 11:24:01 -0700 (Thu, 21 Jun 2012)

Log Message

Add pending resource even if others are pending
https://bugs.webkit.org/show_bug.cgi?id=89633

Reviewed by Dirk Schulze.

Source/WebCore:

An element can have multiple simultaneous pending resources but some of
this code was legacy, before the hasPendingResource()->hasPendingResources()
change (r105573). This patch continues adding a pending resource even if
there are other pending resources. In some cases, this can lead to marking
a resource as pending twice but the performance impact of that is negligible.

Other than SVGUseElement, SVGTrefElement and SVGFEImageElement are also
changed. These elements are unaffected because they can only have
a single resource at the moment (href), with other Style url() references
being handled by their parent containers.

Tests: svg/custom/use-multiple-pending-resources-expected.svg
       svg/custom/use-multiple-pending-resources.svg

* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::buildPendingResource):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):
(WebCore::SVGTRefElement::buildPendingResource):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::buildPendingResource):

LayoutTests:

* svg/custom/use-multiple-pending-resources-expected.svg: Added.
* svg/custom/use-multiple-pending-resources.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120950 => 120951)


--- trunk/LayoutTests/ChangeLog	2012-06-21 18:21:45 UTC (rev 120950)
+++ trunk/LayoutTests/ChangeLog	2012-06-21 18:24:01 UTC (rev 120951)
@@ -1,3 +1,13 @@
+2012-06-21  Philip Rogers  <[email protected]>
+
+        Add pending resource even if others are pending
+        https://bugs.webkit.org/show_bug.cgi?id=89633
+
+        Reviewed by Dirk Schulze.
+
+        * svg/custom/use-multiple-pending-resources-expected.svg: Added.
+        * svg/custom/use-multiple-pending-resources.svg: Added.
+
 2012-06-21  Tony Chang  <[email protected]>
 
         Unreviewed gardening. Removing pixel results for CSS computed style tests which are text only tests.

Added: trunk/LayoutTests/svg/custom/use-multiple-pending-resources-expected.svg (0 => 120951)


--- trunk/LayoutTests/svg/custom/use-multiple-pending-resources-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/use-multiple-pending-resources-expected.svg	2012-06-21 18:24:01 UTC (rev 120951)
@@ -0,0 +1,26 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <defs>
+    <rect id="rect1" width="200" height="200" fill="green" />
+    <clipPath id="clip1">
+      <rect width="100" height="100" fill="red" />
+    </clipPath>
+    <rect id="rect2" width="200" height="200" fill="green" />
+    <clipPath id="clip2">
+      <rect width="100" height="100" fill="red" />
+    </clipPath>
+  </defs>
+
+  <text x="0" y="120">Test for WK89633: test passes if there are 4 green squares.</text>
+  <g transform="translate(0, 0)">
+    <use xlink:href=""  clip-path="url(#clip1)"/>
+  </g>
+  <g transform="translate(120, 0)">
+    <use xlink:href=""  clip-path="url(#clip2)"/>
+  </g>
+  <g transform="translate(240, 0)">
+    <use xlink:href=""  clip-path="url(#clip2)"/>
+  </g>
+  <g transform="translate(360, 0)">
+    <use xlink:href=""  clip-path="url(#clip1)"/>
+  </g>
+</svg>

Added: trunk/LayoutTests/svg/custom/use-multiple-pending-resources.svg (0 => 120951)


--- trunk/LayoutTests/svg/custom/use-multiple-pending-resources.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/use-multiple-pending-resources.svg	2012-06-21 18:24:01 UTC (rev 120951)
@@ -0,0 +1,29 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <defs>
+    <rect id="rect1" width="200" height="200" fill="green" />
+    <clipPath id="clip1">
+      <rect width="100" height="100" fill="red" />
+    </clipPath>
+  </defs>
+
+  <text x="0" y="120">Test for WK89633: test passes if there are 4 green squares.</text>
+  <g transform="translate(0, 0)">
+    <use xlink:href=""  clip-path="url(#clip1)"/>
+  </g>
+  <g transform="translate(120, 0)">
+    <use xlink:href=""  clip-path="url(#clip2)"/>
+  </g>
+  <g transform="translate(240, 0)">
+    <use xlink:href=""  clip-path="url(#clip2)"/>
+  </g>
+  <g transform="translate(360, 0)">
+    <use xlink:href=""  clip-path="url(#clip1)"/>
+  </g>
+
+  <defs>
+    <rect id="rect2" width="200" height="200" fill="green" />
+    <clipPath id="clip2">
+      <rect width="100" height="100" fill="red" />
+    </clipPath>
+  </defs>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (120950 => 120951)


--- trunk/Source/WebCore/ChangeLog	2012-06-21 18:21:45 UTC (rev 120950)
+++ trunk/Source/WebCore/ChangeLog	2012-06-21 18:24:01 UTC (rev 120951)
@@ -1,3 +1,32 @@
+2012-06-21  Philip Rogers  <[email protected]>
+
+        Add pending resource even if others are pending
+        https://bugs.webkit.org/show_bug.cgi?id=89633
+
+        Reviewed by Dirk Schulze.
+
+        An element can have multiple simultaneous pending resources but some of
+        this code was legacy, before the hasPendingResource()->hasPendingResources()
+        change (r105573). This patch continues adding a pending resource even if
+        there are other pending resources. In some cases, this can lead to marking
+        a resource as pending twice but the performance impact of that is negligible.
+
+        Other than SVGUseElement, SVGTrefElement and SVGFEImageElement are also
+        changed. These elements are unaffected because they can only have
+        a single resource at the moment (href), with other Style url() references
+        being handled by their parent containers.
+
+        Tests: svg/custom/use-multiple-pending-resources-expected.svg
+               svg/custom/use-multiple-pending-resources.svg
+
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::buildPendingResource):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::detachTarget):
+        (WebCore::SVGTRefElement::buildPendingResource):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::buildPendingResource):
+
 2012-06-21  Kalev Lember  <[email protected]>
 
         [GTK] Replace the use of "struct stat" with GStatBuf

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (120950 => 120951)


--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2012-06-21 18:21:45 UTC (rev 120950)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2012-06-21 18:24:01 UTC (rev 120951)
@@ -96,9 +96,6 @@
     String id;
     Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
     if (!target) {
-        if (hasPendingResources())
-            return;
-
         if (id.isEmpty())
             requestImageResource();
         else {

Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (120950 => 120951)


--- trunk/Source/WebCore/svg/SVGTRefElement.cpp	2012-06-21 18:21:45 UTC (rev 120950)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp	2012-06-21 18:24:01 UTC (rev 120951)
@@ -188,7 +188,7 @@
     // Mark the referenced ID as pending.
     String id;
     SVGURIReference::targetElementFromIRIString(href(), document(), &id);
-    if (!hasPendingResources() && !id.isEmpty())
+    if (!id.isEmpty())
         document()->accessSVGExtensions()->addPendingResource(id, this);
 }
 
@@ -270,10 +270,9 @@
     String id;
     Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
     if (!target) {
-        if (hasPendingResources() || id.isEmpty())
+        if (id.isEmpty())
             return;
 
-        ASSERT(!hasPendingResources());
         document()->accessSVGExtensions()->addPendingResource(id, this);
         ASSERT(hasPendingResources());
         return;

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (120950 => 120951)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-06-21 18:21:45 UTC (rev 120950)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-06-21 18:24:01 UTC (rev 120951)
@@ -418,10 +418,9 @@
         // We can't observe if the target somewhen enters the external document, nor should we do it.
         if (externalDocument())
             return;
-        if (hasPendingResources() || id.isEmpty())
+        if (id.isEmpty())
             return;
 
-        ASSERT(!hasPendingResources());
         referencedDocument()->accessSVGExtensions()->addPendingResource(id, this);
         ASSERT(hasPendingResources());
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to