SVGLoad event fires too early
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 10:21:49 +0000 (10:21 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 10:21:49 +0000 (10:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78084

Reviewed by Hajime Morita.

Source/WebCore:

SVGLoad event fires too early, making it impossible to use the vanilla repaint.js harness (runRepaintTest).

We're using a hack called runSVGRepaintTest() at the moment in trunk, which runs runRepaintTest() from a 0ms timer,
which is not reliable. The main difference between HTML onload and SVG onload is that HTMLs event is a "window event",
thus dispatched through DOMWindow (eg. <body onload="alert(event.target)" will yield Document,
<svg onload="alert(evt.target)"> will say SVGSVGElement).

Consider:
<svg onload="alert('1')>
<g onload="alert('2)">
<rect onload="alert('3')"/>
</svg>

As soon as the <rect> finishes parsing (SVGElement::finishedParsingChildren), it's SVGLoad event is fired.
So first you'll see '3', then '2', then '1'.

Using:
<svg onload="alert('1')>
<g onload="alert('2)">
<image xlink:href="someExternal.jpg" onload="alert('3')"/>
</svg>

will yield the same SVGLoad order. When using <image externalREsourcesRequired="true", first the '1' will fire,
then '3', then '2', all as expected and specified in SVG.

http://www.w3.org/TR/SVG/interact.html#LoadEvent says:
"The event is triggered at the point at which the user agent has fully parsed the element and its descendants and is
ready to act appropriately upon that element, such as being ready to render the element to the target device. Referenced
external resources that are required must be loaded, parsed and ready to render before the event is triggered. Optional
external resources are not required to be ready for the event to be triggered."

What we don't implement correctly is the second part of the first sentence: "and is ready to act appropriately upon that
element, such as being ready to render the element to the target device". We currently fire the SVGLoad event, right after
</svg> is seen, if no externalResourceRequired="true" attributes are set anywhere. This is not wrong, but not correct for
WebKit, as we're not yet "ready to render".

HTML fires its window onload event from Document::implicitClose(), where it calls Document::dispatchWindowLoadEvent.
At this point we're ready to render. So I'm now aligning the timing of the outermost <svg> elements SVGLoad event, to be
equal to HTML. This lets use use the repaint.js harness w/o any special SVG tricks.

Covered by existing tests.

* dom/Document.cpp:
(WebCore::Document::implicitClose): Dispatch SVGLoad event for outermost <svg> elements from here, as HTML does for its window onload event.
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Sends a SVGLoad event to all outermost <svg> elements in a document, if possible.
There can be multiple ones, if using <svg><foreignObject><svg>... - the <svg> in the <fO> also acts as outermost <svg> element.
* svg/SVGDocumentExtensions.h: Add new dispatchSVGLoadEventToOutermostSVGElements() helper.
* svg/SVGElement.cpp:
(WebCore::SVGElement::isOutermostSVGSVGElement): Moved from SVGSVGElement into SVGElement, and renamed from isOutermostSVG().
(WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't dispatch load events to outermost <svg> elements, if Document::implicitClose() wasn't called yet.
(WebCore::SVGElement::finishParsingChildren): Stop using the default SVGLoad dispatching logic for outermost <svg> elements.
* svg/SVGElement.h: Add isOutermostSVGSVGElement().
* svg/SVGSVGElement.cpp: Rename isOutermostSVG to isOutermostSVGSVGElement.
(WebCore::SVGSVGElement::currentScale):
(WebCore::SVGSVGElement::setCurrentScale):
(WebCore::SVGSVGElement::localCoordinateSpaceTransform):
(WebCore::SVGSVGElement::createRenderer):
* svg/SVGSVGElement.h: Move isOutermostSVG() to SVGElement.
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::title): Rename isOutermostSVG to isOutermostSVGSVGElement.

LayoutTests:

Remove runSVGRepaintTest() from repaint.js again, and convert all *.svg tests to use runRepaintTest() directly.
This is now possible as the outermost <svg> elements load event timing as aligned with HTML.

* fast/repaint/resources/repaint.js: Remove runSVGRepaintTest(), it's no longer needed.
(runRepaintTest): s/document.rootElement/document.documentElement/ to make it work for all HTML/XHTML and SVG documents (XHTML was broken).
* platform/chromium/test_expectations.txt:
* platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png:
* platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt:
* platform/mac/svg/custom/getTransformToElement-expected.png:
* platform/mac/svg/custom/getTransformToElement-expected.txt:
* platform/mac/svg/custom/polyline-setattribute-points-null-expected.png:
* platform/mac/svg/custom/polyline-setattribute-points-null-expected.txt:
* platform/mac/svg/custom/text-ctm-expected.png:
* platform/mac/svg/custom/text-ctm-expected.txt:
* platform/mac/svg/custom/text-hit-test-expected.png:
* platform/mac/svg/custom/text-hit-test-expected.txt:
* platform/mac/svg/filters/filter-refresh-expected.png:
* svg/carto.net/tabgroup.svg:
* svg/carto.net/window.svg:
* svg/css/shadow-changes.svg:
* svg/custom/loadevents-externalresourcesrequired.svg:
* svg/dom/SVGPathSegList-segment-modification.svg:
* svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml:
* svg/dom/SVGRectElement/rect-modify-rx.svg:
* svg/filters/animate-fill.svg:
* svg/filters/feImage-reference-invalidation.svg:
* svg/filters/feImage-target-add-to-document.svg:
* svg/filters/feImage-target-changes-id.svg:
* svg/filters/feImage-target-id-change.svg:
* svg/filters/feImage-target-reappend-to-document.svg:
* svg/filters/feImage-target-remove-from-document.svg:
* svg/filters/filter-refresh.svg:
* svg/filters/filter-width-update.svg:
* svg/filters/invalidate-on-child-layout.svg:
* svg/hixie/perf/001.xml:
* svg/hixie/perf/002.xml:
* svg/hixie/perf/003.xml:
* svg/hixie/perf/004.xml:
* svg/hixie/perf/005.xml:
* svg/hixie/perf/006.xml:
* svg/hixie/perf/007.xml:
* svg/repaint/container-repaint.svg:
* svg/repaint/filter-child-repaint.svg:
* svg/repaint/image-href-change.svg:
* svg/repaint/image-with-clip-path.svg:
* svg/text/text-text-05-t.svg:
* svg/zoom/page/absolute-sized-document-no-scrollbars.svg:
* svg/zoom/page/absolute-sized-document-scrollbars.svg:
* svg/zoom/page/relative-sized-document-scrollbars.svg:
* svg/zoom/page/zoom-coords-viewattr-01-b.svg:
* svg/zoom/page/zoom-foreignObject.svg:
* svg/zoom/page/zoom-mask-with-percentages.svg:
* svg/zoom/resources/testPageZoom.js:
(repaintTest):
* svg/zoom/text/absolute-sized-document-no-scrollbars.svg:
* svg/zoom/text/absolute-sized-document-scrollbars.svg:
* svg/zoom/text/relative-sized-document-scrollbars.svg:
* svg/zoom/text/zoom-coords-viewattr-01-b.svg:
* svg/zoom/text/zoom-foreignObject.svg:

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

64 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/repaint/resources/repaint.js
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png
LayoutTests/platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt
LayoutTests/platform/mac/svg/custom/getTransformToElement-expected.png
LayoutTests/platform/mac/svg/custom/getTransformToElement-expected.txt
LayoutTests/platform/mac/svg/custom/polyline-setattribute-points-null-expected.png
LayoutTests/platform/mac/svg/custom/polyline-setattribute-points-null-expected.txt
LayoutTests/platform/mac/svg/custom/text-ctm-expected.png
LayoutTests/platform/mac/svg/custom/text-ctm-expected.txt
LayoutTests/platform/mac/svg/custom/text-hit-test-expected.png
LayoutTests/platform/mac/svg/custom/text-hit-test-expected.txt
LayoutTests/platform/mac/svg/filters/filter-refresh-expected.png
LayoutTests/svg/carto.net/tabgroup.svg
LayoutTests/svg/carto.net/window.svg
LayoutTests/svg/css/shadow-changes.svg
LayoutTests/svg/custom/loadevents-externalresourcesrequired.svg
LayoutTests/svg/dom/SVGPathSegList-segment-modification.svg
LayoutTests/svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml
LayoutTests/svg/dom/SVGRectElement/rect-modify-rx.svg
LayoutTests/svg/filters/animate-fill.svg
LayoutTests/svg/filters/feImage-reference-invalidation.svg
LayoutTests/svg/filters/feImage-target-add-to-document.svg
LayoutTests/svg/filters/feImage-target-changes-id.svg
LayoutTests/svg/filters/feImage-target-id-change.svg
LayoutTests/svg/filters/feImage-target-reappend-to-document.svg
LayoutTests/svg/filters/feImage-target-remove-from-document.svg
LayoutTests/svg/filters/filter-refresh.svg
LayoutTests/svg/filters/filter-width-update.svg
LayoutTests/svg/filters/invalidate-on-child-layout.svg
LayoutTests/svg/hixie/perf/001.xml
LayoutTests/svg/hixie/perf/002.xml
LayoutTests/svg/hixie/perf/003.xml
LayoutTests/svg/hixie/perf/004.xml
LayoutTests/svg/hixie/perf/005.xml
LayoutTests/svg/hixie/perf/006.xml
LayoutTests/svg/hixie/perf/007.xml
LayoutTests/svg/repaint/container-repaint.svg
LayoutTests/svg/repaint/filter-child-repaint.svg
LayoutTests/svg/repaint/image-href-change.svg
LayoutTests/svg/repaint/image-with-clip-path.svg
LayoutTests/svg/text/text-text-05-t.svg
LayoutTests/svg/zoom/page/absolute-sized-document-no-scrollbars.svg
LayoutTests/svg/zoom/page/absolute-sized-document-scrollbars.svg
LayoutTests/svg/zoom/page/relative-sized-document-scrollbars.svg
LayoutTests/svg/zoom/page/zoom-coords-viewattr-01-b.svg
LayoutTests/svg/zoom/page/zoom-foreignObject.svg
LayoutTests/svg/zoom/page/zoom-mask-with-percentages.svg
LayoutTests/svg/zoom/resources/testPageZoom.js
LayoutTests/svg/zoom/text/absolute-sized-document-no-scrollbars.svg
LayoutTests/svg/zoom/text/absolute-sized-document-scrollbars.svg
LayoutTests/svg/zoom/text/relative-sized-document-scrollbars.svg
LayoutTests/svg/zoom/text/zoom-coords-viewattr-01-b.svg
LayoutTests/svg/zoom/text/zoom-foreignObject.svg
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebCore/svg/SVGDocumentExtensions.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGSVGElement.h
Source/WebCore/svg/SVGStyledElement.cpp

index d349fb8..bce47e1 100644 (file)
@@ -1,3 +1,70 @@
+2012-02-08  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        SVGLoad event fires too early
+        https://bugs.webkit.org/show_bug.cgi?id=78084
+
+        Reviewed by Hajime Morita.
+
+        Remove runSVGRepaintTest() from repaint.js again, and convert all *.svg tests to use runRepaintTest() directly.
+        This is now possible as the outermost <svg> elements load event timing as aligned with HTML.
+
+        * fast/repaint/resources/repaint.js: Remove runSVGRepaintTest(), it's no longer needed.
+        (runRepaintTest): s/document.rootElement/document.documentElement/ to make it work for all HTML/XHTML and SVG documents (XHTML was broken).
+        * platform/chromium/test_expectations.txt:
+        * platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png:
+        * platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt:
+        * platform/mac/svg/custom/getTransformToElement-expected.png:
+        * platform/mac/svg/custom/getTransformToElement-expected.txt:
+        * platform/mac/svg/custom/polyline-setattribute-points-null-expected.png:
+        * platform/mac/svg/custom/polyline-setattribute-points-null-expected.txt:
+        * platform/mac/svg/custom/text-ctm-expected.png:
+        * platform/mac/svg/custom/text-ctm-expected.txt:
+        * platform/mac/svg/custom/text-hit-test-expected.png:
+        * platform/mac/svg/custom/text-hit-test-expected.txt:
+        * platform/mac/svg/filters/filter-refresh-expected.png:
+        * svg/carto.net/tabgroup.svg:
+        * svg/carto.net/window.svg:
+        * svg/css/shadow-changes.svg:
+        * svg/custom/loadevents-externalresourcesrequired.svg:
+        * svg/dom/SVGPathSegList-segment-modification.svg:
+        * svg/dom/SVGPathSegList-xml-dom-synchronization2.xhtml:
+        * svg/dom/SVGRectElement/rect-modify-rx.svg:
+        * svg/filters/animate-fill.svg:
+        * svg/filters/feImage-reference-invalidation.svg:
+        * svg/filters/feImage-target-add-to-document.svg:
+        * svg/filters/feImage-target-changes-id.svg:
+        * svg/filters/feImage-target-id-change.svg:
+        * svg/filters/feImage-target-reappend-to-document.svg:
+        * svg/filters/feImage-target-remove-from-document.svg:
+        * svg/filters/filter-refresh.svg:
+        * svg/filters/filter-width-update.svg:
+        * svg/filters/invalidate-on-child-layout.svg:
+        * svg/hixie/perf/001.xml:
+        * svg/hixie/perf/002.xml:
+        * svg/hixie/perf/003.xml:
+        * svg/hixie/perf/004.xml:
+        * svg/hixie/perf/005.xml:
+        * svg/hixie/perf/006.xml:
+        * svg/hixie/perf/007.xml:
+        * svg/repaint/container-repaint.svg:
+        * svg/repaint/filter-child-repaint.svg:
+        * svg/repaint/image-href-change.svg:
+        * svg/repaint/image-with-clip-path.svg:
+        * svg/text/text-text-05-t.svg:
+        * svg/zoom/page/absolute-sized-document-no-scrollbars.svg:
+        * svg/zoom/page/absolute-sized-document-scrollbars.svg:
+        * svg/zoom/page/relative-sized-document-scrollbars.svg:
+        * svg/zoom/page/zoom-coords-viewattr-01-b.svg:
+        * svg/zoom/page/zoom-foreignObject.svg:
+        * svg/zoom/page/zoom-mask-with-percentages.svg:
+        * svg/zoom/resources/testPageZoom.js:
+        (repaintTest):
+        * svg/zoom/text/absolute-sized-document-no-scrollbars.svg:
+        * svg/zoom/text/absolute-sized-document-scrollbars.svg:
+        * svg/zoom/text/relative-sized-document-scrollbars.svg:
+        * svg/zoom/text/zoom-coords-viewattr-01-b.svg:
+        * svg/zoom/text/zoom-foreignObject.svg:
+
 2012-02-07  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: Closed computed style sidebar pane rebuilds, resulting in slowness
index 3e8eab1..c92c750 100644 (file)
@@ -3,8 +3,8 @@ function runRepaintTest()
     if (window.layoutTestController) {
         if (document.body)
             document.body.offsetTop;
-        else if (document.rootElement)
-            document.rootElement.offsetTop;
+        else if (document.documentElement)
+            document.documentElement.offsetTop;
 
         layoutTestController.display();
         repaintTest();
@@ -12,14 +12,3 @@ function runRepaintTest()
         setTimeout(repaintTest, 100);
     }
 }
-
-function runSVGRepaintTest()
-{
-    // The SVG onload event is fired earlier than the HTML load event. To make display() reliable,
-    // call it from a timer, to simulate the same fire time as the HTML load event, until it's fixed.
-    if (window.layoutTestController) {
-        layoutTestController.waitUntilDone();
-        setTimeout(runRepaintTest, 0);
-    } else
-        runRepaintTest();
-}
index cdd5434..c78e25c 100644 (file)
@@ -4042,5 +4042,13 @@ BUGWK77736 : svg/zoom/text/zoom-hixie-mixed-008.xml = IMAGE+TEXT
 BUGWK77736 MAC WIN : svg/zoom/text/zoom-hixie-mixed-009.xml = IMAGE
 BUGWK77736 : svg/zoom/text/zoom-hixie-rendering-model-004.xhtml = IMAGE+TEXT
 
+// SVGLoad event timing changes require some rebaselines.
+BUGWK78084 : svg/custom/SVGPoint-matrixTransform.svg = IMAGE+TEXT
+BUGWK78084 : svg/custom/getTransformToElement.svg = IMAGE+TEXT
+BUGWK78084 : svg/custom/polyline-setattribute-points-null.svg = IMAGE+TEXT
+BUGWK78084 : svg/custom/repaint-on-image-bounds-change.svg = IMAGE+TEXT
+BUGWK78084 : svg/custom/text-ctm.svg = IMAGE+TEXT
+BUGWK78084 : svg/custom/text-hit-test.svg = IMAGE+TEXT
+
 BUGWK78038 DEBUG : compositing/iframes/invisible-nested-iframe-show.html = PASS CRASH
 BUGWK78038 DEBUG : compositing/iframes/layout-on-compositing-change.html = PASS CRASH
index 5d7a7c7..1afc5f7 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png and b/LayoutTests/platform/mac/svg/custom/SVGPoint-matrixTransform-expected.png differ
index d4f4bcb..0e659bc 100644 (file)
@@ -1,7 +1,7 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (40,10) size 86x38
-    RenderSVGText {text} at (20,5) size 43x19 contains 1 chunk(s)
-      RenderSVGInlineText {#text} at (0,0) size 43x19
+  RenderSVGRoot {svg} at (40,12) size 86x36
+    RenderSVGText {text} at (20,6) size 43x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 43x18
         chunk 1 text run 1 at (20.00,20.00) startOffset 0 endOffset 6 width 43.00: "Passed"
index d6ac5b1..8635ce5 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/custom/getTransformToElement-expected.png and b/LayoutTests/platform/mac/svg/custom/getTransformToElement-expected.png differ
index 74828a2..c6e0ab1 100644 (file)
@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderSVGRoot {svg} at (20,56) size 101x157
     RenderSVGContainer {g} at (0,0) size 0x0 [transform={m=((0.00,0.00)(0.00,0.00)) t=(0.00,0.00)}]
-    RenderSVGContainer {g} at (20,56) size 42x18 [transform={m=((1.00,0.00)(0.00,1.00)) t=(15.00,15.00)}]
-      RenderSVGText {text} at (50,123) size 84x34 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 84x34
-          chunk 1 text run 1 at (50.00,150.00) startOffset 0 endOffset 6 width 84.00: "Passed"
+    RenderSVGContainer {g} at (20,56) size 41x18 [transform={m=((1.00,0.00)(0.00,1.00)) t=(15.00,15.00)}]
+      RenderSVGText {text} at (50,122) size 82x35 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 82x35
+          chunk 1 text run 1 at (50.00,150.00) startOffset 0 endOffset 6 width 82.00: "Passed"
     RenderSVGContainer {g} at (49,141) size 72x72 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(0.00,0.00)}]
       RenderSVGRect {rect} at (49,141) size 72x72 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,0.00)}] [x=50.00] [y=50.00] [width=70.00] [height=30.00]
index 7cf2d00..b6da2f3 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/custom/polyline-setattribute-points-null-expected.png and b/LayoutTests/platform/mac/svg/custom/polyline-setattribute-points-null-expected.png differ
index b147551..defc6c2 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 20: Error: Problem parsing points="undefined"
+CONSOLE MESSAGE: line 1: Error: Problem parsing points="undefined"
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
index 4bba224..1f53a23 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/custom/text-ctm-expected.png and b/LayoutTests/platform/mac/svg/custom/text-ctm-expected.png differ
index 8188799..4bd9d4a 100644 (file)
@@ -1,9 +1,9 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (100,70) size 86x38
-    RenderSVGContainer {g} at (100,70) size 86x38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}]
-      RenderSVGViewportContainer {svg} at (100,70) size 86x38
-        RenderSVGText {text} at (70,55) size 43x19 contains 1 chunk(s)
-          RenderSVGInlineText {#text} at (0,0) size 43x19
+  RenderSVGRoot {svg} at (100,72) size 86x36
+    RenderSVGContainer {g} at (100,72) size 86x36 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}]
+      RenderSVGViewportContainer {svg} at (100,72) size 86x36
+        RenderSVGText {text} at (70,56) size 43x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 43x18
             chunk 1 text run 1 at (70.00,70.00) startOffset 0 endOffset 6 width 43.00: "Passed"
index 407d6ec..304174d 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/custom/text-hit-test-expected.png and b/LayoutTests/platform/mac/svg/custom/text-hit-test-expected.png differ
index d488cdc..a36576a 100644 (file)
@@ -9,7 +9,7 @@ layer at (0,0) size 800x600
       RenderSVGText {text} at (10,115) size 44x19 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 44x19
           chunk 1 text run 1 at (10.00,130.00) startOffset 0 endOffset 7 width 43.50: "Status:"
-      RenderSVGText {text} at (90,115) size 43x19 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 43x19
+      RenderSVGText {text} at (90,116) size 43x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 43x18
           chunk 1 text run 1 at (90.00,130.00) startOffset 0 endOffset 6 width 43.00: "Passed"
 caret: position 0 of child 0 {#text} of child 1 {text} of child 3 {g} of child 1 {svg} of document
index 5deed5e..62be4f5 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/filters/filter-refresh-expected.png and b/LayoutTests/platform/mac/svg/filters/filter-refresh-expected.png differ
index 098316f..e8a87e4 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?AdobeSVGViewer save="snapshot"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 1024 768" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 1024 768" onload="runRepaintTest()">
     <script type="text/ecmascript" xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <script type="text/ecmascript" xlink:href="resources/helper_functions.js"></script>
     <script type="text/ecmascript" xlink:href="resources/timer.js"></script>
@@ -39,8 +39,6 @@
                //tabgroupTriangle.disableAllTabs();
                //tabgroupTriangle.enableSingleTab(3);
                //tabgroupTriangle.enableAllTabs();
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
             function tabChanged(id,title,index) {
                 alert("tab nr "+index+" with title '"+title+"' was activated in tabgroup '"+id+"'");
index 0500523..ed24d1f 100644 (file)
@@ -9,7 +9,7 @@
         >
 ]>
 <?AdobeSVGViewer save="snapshot"?>
-<svg width="100%" height="100%" viewBox="0 0 1024 700" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:attrib="http://www.carto.net/attrib" xmlns:batik="http://xml.apache.org/batik/ext" onload="runSVGRepaintTest()">
+<svg width="100%" height="100%" viewBox="0 0 1024 700" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:attrib="http://www.carto.net/attrib" xmlns:batik="http://xml.apache.org/batik/ext" onload="runRepaintTest()">
         <script type="text/ecmascript" xlink:href="../../fast/repaint/resources/repaint.js"></script>
         <script type="text/ecmascript" xlink:href="resources/helper_functions.js"/>
         <script type="text/ecmascript" xlink:href="resources/mapApp.js"/>
@@ -21,6 +21,8 @@
         // to createCalled() were added to prevent a race in which the test may
         // terminate before the final window decoration is added.
         // See <https://bugs.webkit.org/show_bug.cgi?id=21531>.
+        if (window.layoutTestController) 
+            layoutTestController.waitUntilDone();
 
         var numberOfWindows = 7;
         var createCalls = 0;
index aa02b06..b055495 100644 (file)
@@ -1,12 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
 <script xlink:href="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
 <script type="text/javascript">
 function repaintTest() {
     var group = document.getElementsByTagName('g')[0];
     group.style.WebkitSvgShadow = "rgba(64,64,64, 0.7) -9px -9px 6px";
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
 }
 </script>
 <g id="svg-shadow-example" style="-webkit-svg-shadow: rgba(106,119,64, 0.7) 5px 5px 9px;">
index 3656a3c..bb377de 100644 (file)
@@ -7,7 +7,7 @@
       var results = new Array();
 
       function reportLoadEvent(el) {
-        results.push(el.localName);
+               results.push(el.localName);
       }
       function runTest()
       {
index 8a584ee..2cda2aa 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink='http://www.w3.org/1999/xlink' width="300px" height="300px" viewBox="0 0 300 300" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink='http://www.w3.org/1999/xlink' width="300px" height="300px" viewBox="0 0 300 300" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
     <script type="text/javascript">
     function repaintTest() {
@@ -8,8 +8,6 @@
         var moveSeg = segList.getItem(0);    // This represents the M 80 40 segment (Move to)
         moveSeg.x = 50;
         moveSeg.y = 50;
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
     </script>
     <path id="smile" d="M 80 40 S 120 80 160 40" stroke="black" stroke-width="3" fill="none"/>
index c5d90a2..b471ad0 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" standalone="no"?>
-<svg width="600" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg width="600" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
   <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
   <path d="M50,150 l45,-43 l24,64 l-69,-21z" fill="#FF0000" stroke="#000000" stroke-width="5"/>
   <text x="10" y="20" style="font-weight:bold">Right after loading, a segment is added to the path.</text>
@@ -29,9 +29,6 @@
         if(start_d == end_d) {
             end.textContent += ' (failed)';
         }
-
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
 ]]>
 </script>
index 7c4ffe7..be6b0f5 100644 (file)
@@ -1,13 +1,10 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
   <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
   <rect width='100' height='100' fill='red'/>
   <rect id='r' width='100' height='100' rx='100' fill='green'/>
   <script>
     function repaintTest() {
       document.getElementById('r').setAttributeNS(null, "rx", "0");
-
-      if (window.layoutTestController)
-        layoutTestController.notifyDone();
     }
   </script>
 </svg>
index 22c5ab2..3a74899 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>The rectangle should rapidly animate to green.</title>
 <defs>
@@ -10,9 +10,6 @@
 <script>
     function repaintTest() {
         document.getElementById('rect').setAttribute('fill', 'green');
-
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
 </script>
 </svg>
index 9036654..5b9d98c 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green square.</title>
     <defs>
@@ -15,9 +15,6 @@
     <![CDATA[
         function repaintTest() {
             document.getElementById("feimage").setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect2");
-
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
         }
     ]]>
     </script>
index 32cdb97..6155fc8 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green 100x100 square.</title>
     <defs>
@@ -18,9 +18,6 @@
             var newFEImage = document.createElementNS("http://www.w3.org/2000/svg", "feImage");
             newFEImage.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#green-rect");
             document.getElementById("filter").appendChild(newFEImage);
-
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
         }
     ]]>
     </script>
index ce1e17b..bb63464 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green 100x100 square.</title>
     <defs>
@@ -14,9 +14,6 @@
     <![CDATA[
         function repaintTest() {
             document.getElementById("notexistant").setAttribute("id", "rect");
-
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
         }
     ]]>
     </script>
index 20818c0..5622d57 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green 100x100 square.</title>
     <defs>
@@ -14,9 +14,6 @@
     <![CDATA[
         function repaintTest() {
             document.getElementById("feimage").setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect");
-
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
         }
     ]]>
     </script>
index 02f2768..69d7966 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green 100x100 square.</title>
     <defs>
@@ -19,6 +19,9 @@
             var greenImage = document.getElementById("feimage-green");
             document.getElementById("filter").removeChild(greenImage);
 
+            if (window.layoutTestController)
+                layoutTestController.waitUntilDone();
+
             setTimeout(function() {
                 document.getElementById("filter").appendChild(greenImage);
                 if (window.layoutTestController)
index c6f5a5b..286eed4 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
     <title>There should be a single green 100x100 square.</title>
     <defs>
@@ -16,9 +16,6 @@
     <![CDATA[
         function repaintTest() {
             document.getElementById("filter").removeChild(document.getElementById("feimage-red"));
-
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
         }
     ]]>
     </script>
index a6deaae..43fa894 100644 (file)
@@ -1,5 +1,5 @@
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
-  style="width:300px;height:400px" onload="runSVGRepaintTest()">
+  style="width:300px;height:400px" onload="runRepaintTest()">
 
 <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
 <!-- This tests filters failing to refresh after the initial rendering
@@ -110,9 +110,6 @@ There should be no red squares in the output. -->
       }
 
       document.getElementById('filtered').setAttribute('filter', 'url(#toGreen)');
-
-      if (window.layoutTestController)
-          layoutTestController.notifyDone();
     }
 ]]></script>
 
index 9c27c23..deadf24 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
 <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
 <defs>
 <filter filterUnits="userSpaceOnUse" id="blur" x="0" y="0" width="40" height="140">
@@ -11,8 +11,6 @@
 <script>
     function repaintTest() {
         document.getElementsByTagName("filter")[0].setAttribute("width", "140");
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
 </script>
 </svg>
index 46c21dd..024a0e2 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
 <script xlink:href="../../fast/repaint/resources/repaint.js"></script>
 <script>
 <![CDATA[
@@ -6,9 +6,6 @@ function repaintTest() {
     var circle = document.getElementById("circle");
     circle.setAttribute("cx", 100);
     circle.setAttribute("cy", 100);
-
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
 }
 ]]>
 </script>
index 802386c..e05ec17 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
   var dx = 5;
   var dy = -5;
   var count = 0;
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
    if ((cx + r + dx > 390) || (cx - r + dx < -190))
      dx =- dx;
index 884a9ab..404d04b 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
   var dx = 5;
   var dy = -5;
   var count = 0;
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
    if ((cx + r + dx > 390) || (cx - r + dx < -190))
      dx =- dx;
index 23a2236..06679b6 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
@@ -46,7 +46,8 @@
   var maxPerBlock = Xs.length / (idealTime / delay);
   var maxBlocks = Xs.length / maxPerBlock;
   var count = 0;
-
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
     for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
       var index = count * maxPerBlock + subcount;
index 07925c7..808e4e9 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
@@ -46,7 +46,8 @@
   var maxPerBlock = Xs.length / (idealTime / delay);
   var maxBlocks = Xs.length / maxPerBlock;
   var count = 0;
-
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
     for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
       var index = count * maxPerBlock + subcount;
index e96f1e3..f08e08c 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
@@ -52,7 +52,8 @@
   var maxPerBlock = Xs.length / (idealTime / delay);
   var maxBlocks = Xs.length / maxPerBlock;
   var count = 0;
-
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
     for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
       var index = count * maxPerBlock + subcount;
index 1bea2f6..e746689 100644 (file)
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
@@ -52,7 +52,8 @@
   var maxPerBlock = Xs.length / (idealTime / delay);
   var maxBlocks = Xs.length / maxPerBlock;
   var count = 0;
-
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
     for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
       var index = count * maxPerBlock + subcount;
index 1c53f60..869748a 100644 (file)
@@ -1,4 +1,4 @@
- <svg viewBox="0 0 800 400" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:country="http://example.com/" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+ <svg viewBox="0 0 800 400" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:country="http://example.com/" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
  <script xlink:href="../../../fast/repaint/resources/repaint.js"></script>
  <script type="text/javascript">
   var start = new Date();
   var delta = 60;
   var current = low;
   var idealTime = ((high - low) / delta) * delay;
-
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
   function repaintTest() {
     svg.setAttribute("width", current);
     if (current < high) {
index f258ef7..a4e7c1f 100644 (file)
@@ -1,10 +1,8 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
 <script xlink:href="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
   <script type="text/javascript">
   function repaintTest() {
       document.getElementById('mover').setAttribute('y', 100);
-      if (window.layoutTestController)
-          layoutTestController.notifyDone();
   }
   </script>
   <!-- After repositioning, the red rect should be completely hidden behind the second green rect. -->
index c7b0e4b..3714eb3 100644 (file)
@@ -1,12 +1,10 @@
 <?xml version="1.0" standalone="no"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg width="128px" height="128px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+<svg width="128px" height="128px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
 <script xlink:href="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
   <script type="text/javascript">
   function repaintTest() {
     document.getElementById('poke').style.fill = 'green';
-    if (window.layoutTestController)
-      layoutTestController.notifyDone();
   }
   </script>
  
index 7485414..6b0fc8c 100644 (file)
@@ -1,4 +1,4 @@
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runSVGRepaintTest()">
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()">
     <script xlink:href="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
     <text y="-50">200x200 green rect should be visible</text>
 
     var greenSquare = "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gWkSUNDX1BST0ZJTEUAAQEAAAWUYXBwbAIgAABtbnRyUkdCIFhZWiAH2QACABkACwAaAAthY3NwQVBQTAAAAABhcHBsAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWFwcGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAAG9kc2NtAAABeAAAA1ZjcHJ0AAAE0AAAADh3dHB0AAAFCAAAABRyWFlaAAAFHAAAABRnWFlaAAAFMAAAABRiWFlaAAAFRAAAABRyVFJDAAAFWAAAAA5jaGFkAAAFaAAAACxiVFJDAAAFWAAAAA5nVFJDAAAFWAAAAA5kZXNjAAAAAAAAABRHZW5lcmljIFJHQiBQcm9maWxlAAAAAAAAAAAAAAAUR2VuZXJpYyBSR0IgUHJvZmlsZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbWx1YwAAAAAAAAATAAAADHB0QlIAAAAmAAAA9GZyRlUAAAAoAAABGnpoVFcAAAAWAAABQml0SVQAAAAoAAABWG5iTk8AAAAmAAABgGtvS1IAAAAWAAABpmRlREUAAAAsAAABvHN2U0UAAAAmAAABgHpoQ04AAAAWAAAB6GphSlAAAAAaAAAB/nB0UE8AAAAmAAACGG5sTkwAAAAoAAACPmVzRVMAAAAmAAACGGZpRkkAAAAoAAACZnBsUEwAAAAsAAACjnJ1UlUAAAAiAAACumFyRUcAAAAmAAAC3GVuVVMAAAAmAAADAmRhREsAAAAuAAADKABQAGUAcgBmAGkAbAAgAFIARwBCACAARwBlAG4A6QByAGkAYwBvAFAAcgBvAGYAaQBsACAAZwDpAG4A6QByAGkAcQB1AGUAIABSAFYAQpAadSgAIABSAEcAQgAggnJfaWPPj/AAUAByAG8AZgBpAGwAbwAgAFIARwBCACAAZwBlAG4AZQByAGkAYwBvAEcAZQBuAGUAcgBpAHMAawAgAFIARwBCAC0AcAByAG8AZgBpAGzHfLwYACAAUgBHAEIAINUEuFzTDMd8AEEAbABsAGcAZQBtAGUAaQBuAGUAcwAgAFIARwBCAC0AUAByAG8AZgBpAGxmbpAaACAAUgBHAEIAIGPPj/Blh072TgCCLAAgAFIARwBCACAw1zDtMNUwoTCkMOsAUABlAHIAZgBpAGwAIABSAEcAQgAgAGcAZQBuAOkAcgBpAGMAbwBBAGwAZwBlAG0AZQBlAG4AIABSAEcAQgAtAHAAcgBvAGYAaQBlAGwAWQBsAGUAaQBuAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGkAbABpAFUAbgBpAHcAZQByAHMAYQBsAG4AeQAgAHAAcgBvAGYAaQBsACAAUgBHAEIEHgQxBEkEOAQ5ACAEPwRABD4ERAQ4BDsETAAgAFIARwBCBkUGRAZBACAGKgY5BjEGSgZBACAAUgBHAEIAIAYnBkQGOQYnBkUARwBlAG4AZQByAGkAYwAgAFIARwBCACAAUAByAG8AZgBpAGwAZQBHAGUAbgBlAHIAZQBsACAAUgBHAEIALQBiAGUAcwBrAHIAaQB2AGUAbABzAGUAAHRleHQAAAAAQ29weXJpZ2h0IDIwMDcgQXBwbGUgSW5jLiwgYWxsIHJpZ2h0cyByZXNlcnZlZC4AWFlaIAAAAAAAAPNSAAEAAAABFs9YWVogAAAAAAAAdE0AAD3uAAAD0FhZWiAAAAAAAABadQAArHMAABc0WFlaIAAAAAAAACgaAAAVnwAAuDZjdXJ2AAAAAAAAAAEBzQAAc2YzMgAAAAAAAQxCAAAF3v//8yYAAAeSAAD9kf//+6L///2jAAAD3AAAwGz/4QCARXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAKgAgAEAAAAAQAAAMigAwAEAAAAAQAAAMgAAAAA/9sAQwAgFhgcGBQgHBocJCIgJjBQNDAsLDBiRko6UHRmenhyZnBugJC4nICIropucKDaoq6+xM7Qznya4vLgyPC4ys7G/9sAQwEiJCQwKjBeNDRexoRwhMbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbG/8AAEQgAyADIAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8ApUUUVynGFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAf//Z";
 
     var image = document.getElementById("image");
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText(true);
+        layoutTestController.waitUntilDone();
+    }
 
     function repaintTest() {
         image.onload = function() {
index c71173a..e41ca70 100644 (file)
     var green = "data:image/gif;base64,R0lGODlhAQABAIAAAAD/AAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
     var red = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
 
-       var count = 0;
-       function startTest() {
-               if (count == 0)
-                       runSVGRepaintTest();
-               count = count + 1;
-       }
+    var count = 0;
+    function startTest() {
+        if (count == 0)
+            runRepaintTest();
+        count = count + 1;
+    }
 
     var r = document.querySelector('#r');
     var g = document.querySelector('#g');
         r.setAttribute('width', size);
         r.setAttribute('height', size);
         g.setAttribute("transform","translate(" + offset + ",50)");
-               i.setAttribute("externalResourcesRequired", "true");
+        i.setAttribute("externalResourcesRequired", "true");
         i.setAttributeNS('http://www.w3.org/1999/xlink', 'href', img);
     };
 
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText(true);
+        layoutTestController.waitUntilDone();
+    }
 
     function finishTest() {
         if (window.layoutTestController)
index 5186b75..bf7be16 100644 (file)
@@ -8,7 +8,7 @@
 <!--                                                                      -->
 <!-- Author : Vincent Hardy,  06-Jan-2004                                 --><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 
-<svg onload="runSVGRepaintTest()" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
+<svg onload="runRepaintTest()" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
     <SVGTestCase xmlns:testcase="http://www.w3.org/2000/02/svg/testsuite/description/" xmlns="http://www.w3.org/2000/02/svg/testsuite/description/" owner="VH" desc="Tests that the viewer can handle the rotate         attribute on the text element" status="accepted" version="$Revision: 1.8 $" testname="$RCSfile: text-text-05-t.svg,v $">
         <OperatorScript>
             <Paragraph>
@@ -165,8 +165,6 @@ if (window.layoutTestController)
 
 function repaintTest() {
     document.execCommand("SelectAll");
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
 }
 </script>
 </svg>
index d58001b..2f585b6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in once should not lead to visible scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runRepaintTest()">
     <rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
 
     <defs>
index f6b338c..600b0e7 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in three times should show up scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runRepaintTest()">
     <rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
 
     <defs>
index d6b7208..e308cce 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in once should not lead to visible scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" onload="runRepaintTest()">
     <rect x="1%" y="1%" width="98%" height="98%" fill="none" stroke="#000000"/>
 
     <defs>
index deac2d4..d096f35 100644 (file)
@@ -28,7 +28,7 @@ fill='none' stroke='blue'/>">
 <!-- Author : Vincent Hardy                                                -->
 <!-- Modified for svg 1.1 by Ola Andersson, 07-Mar-2002                    -->
 <!--======================================================================-->
-<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="runSVGRepaintTest()">
+<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="runRepaintTest()">
     <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
         <OperatorScript version="$Revision: 1.6 $" testname="coords-viewattr-01-b.svg">
             <Paragraph>
index 2b3d10f..83e25b7 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<svg xmlns="http://www.w3.org/2000/svg" onload="runSVGRepaintTest()"
+<svg xmlns="http://www.w3.org/2000/svg" onload="runRepaintTest()"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xhtml="http://www.w3.org/1999/xhtml">
 <foreignObject x="10" y="10" width="580" height="380" transform="scale(5) skewY(5) skewX(5)">
index 8123a55..f380e60 100644 (file)
@@ -26,7 +26,7 @@
 <!-- @version $Id: maskRegions.svg 475477 2006-11-15 22:44:28Z cam $ -->
 <!-- ========================================================================= -->
 
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500" onload="runRepaintTest()">
 <title>Mask</title>
     <!-- ============================================================= -->
     <!-- Test content                                                  -->
index 222965a..93130ba 100644 (file)
@@ -9,13 +9,14 @@ function repaintTest() {
             eventSender.zoomPageIn();
     }
 
-    if (window.postZoomCallback) {
-        window.postZoomCallback();
-        completeDynamicTest();
-    } else {
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
-    }
+    if (!window.postZoomCallback)
+        return;
+
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    window.postZoomCallback();
+    completeDynamicTest();
 }
 
 function completeDynamicTest() {
index ae7d3d0..3efc547 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in once should not lead to visible scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runRepaintTest()">
     <rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
 
     <defs>
index 75d481d..b966202 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in three times should show up scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="480" height="360" onload="runRepaintTest()">
     <rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
 
     <defs>
index fd48d4e..ada871b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
 <!-- DRT uses 800x600 default, so zooming in once should not lead to visible scrollbars -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" onload="runSVGRepaintTest()">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" onload="runRepaintTest()">
     <rect x="1%" y="1%" width="98%" height="98%" fill="none" stroke="#000000"/>
 
     <defs>
index c61b2c9..2aeeb5e 100644 (file)
@@ -28,7 +28,7 @@ fill='none' stroke='blue'/>">
 <!-- Author : Vincent Hardy                                                -->
 <!-- Modified for svg 1.1 by Ola Andersson, 07-Mar-2002                    -->
 <!--======================================================================-->
-<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="runSVGRepaintTest()">
+<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="runRepaintTest()">
     <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
         <OperatorScript version="$Revision: 1.6 $" testname="coords-viewattr-01-b.svg">
             <Paragraph>
index 299e059..cb35666 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<svg xmlns="http://www.w3.org/2000/svg" onload="runSVGRepaintTest()"
+<svg xmlns="http://www.w3.org/2000/svg" onload="runRepaintTest()"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xhtml="http://www.w3.org/1999/xhtml">
 <foreignObject x="10" y="10" width="580" height="380" transform="scale(5) skewY(5) skewX(5)">
index 3bba576..0d04131 100644 (file)
@@ -1,3 +1,72 @@
+2012-02-08  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        SVGLoad event fires too early
+        https://bugs.webkit.org/show_bug.cgi?id=78084
+
+        Reviewed by Hajime Morita.
+
+        SVGLoad event fires too early, making it impossible to use the vanilla repaint.js harness (runRepaintTest).
+
+        We're using a hack called runSVGRepaintTest() at the moment in trunk, which runs runRepaintTest() from a 0ms timer,
+        which is not reliable. The main difference between HTML onload and SVG onload is that HTMLs event is a "window event",
+        thus dispatched through DOMWindow (eg. <body onload="alert(event.target)" will yield Document,
+        <svg onload="alert(evt.target)"> will say SVGSVGElement).
+
+        Consider:
+        <svg onload="alert('1')>
+        <g onload="alert('2)">
+        <rect onload="alert('3')"/>
+        </svg>
+
+        As soon as the <rect> finishes parsing (SVGElement::finishedParsingChildren), it's SVGLoad event is fired.
+        So first you'll see '3', then '2', then '1'.
+
+        Using:
+        <svg onload="alert('1')>
+        <g onload="alert('2)">
+        <image xlink:href="someExternal.jpg" onload="alert('3')"/>
+        </svg>
+
+        will yield the same SVGLoad order. When using <image externalREsourcesRequired="true", first the '1' will fire,
+        then '3', then '2', all as expected and specified in SVG.
+
+        http://www.w3.org/TR/SVG/interact.html#LoadEvent says:
+        "The event is triggered at the point at which the user agent has fully parsed the element and its descendants and is
+        ready to act appropriately upon that element, such as being ready to render the element to the target device. Referenced
+        external resources that are required must be loaded, parsed and ready to render before the event is triggered. Optional
+        external resources are not required to be ready for the event to be triggered."
+
+        What we don't implement correctly is the second part of the first sentence: "and is ready to act appropriately upon that
+        element, such as being ready to render the element to the target device". We currently fire the SVGLoad event, right after
+        </svg> is seen, if no externalResourceRequired="true" attributes are set anywhere. This is not wrong, but not correct for
+        WebKit, as we're not yet "ready to render".
+
+        HTML fires its window onload event from Document::implicitClose(), where it calls Document::dispatchWindowLoadEvent.
+        At this point we're ready to render. So I'm now aligning the timing of the outermost <svg> elements SVGLoad event, to be
+        equal to HTML. This lets use use the repaint.js harness w/o any special SVG tricks.
+
+        Covered by existing tests.
+
+        * dom/Document.cpp:
+        (WebCore::Document::implicitClose): Dispatch SVGLoad event for outermost <svg> elements from here, as HTML does for its window onload event.
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Sends a SVGLoad event to all outermost <svg> elements in a document, if possible.
+        There can be multiple ones, if using <svg><foreignObject><svg>... - the <svg> in the <fO> also acts as outermost <svg> element.
+        * svg/SVGDocumentExtensions.h: Add new dispatchSVGLoadEventToOutermostSVGElements() helper.
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::isOutermostSVGSVGElement): Moved from SVGSVGElement into SVGElement, and renamed from isOutermostSVG().
+        (WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't dispatch load events to outermost <svg> elements, if Document::implicitClose() wasn't called yet.
+        (WebCore::SVGElement::finishParsingChildren): Stop using the default SVGLoad dispatching logic for outermost <svg> elements.
+        * svg/SVGElement.h: Add isOutermostSVGSVGElement().
+        * svg/SVGSVGElement.cpp: Rename isOutermostSVG to isOutermostSVGSVGElement.
+        (WebCore::SVGSVGElement::currentScale):
+        (WebCore::SVGSVGElement::setCurrentScale):
+        (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
+        (WebCore::SVGSVGElement::createRenderer):
+        * svg/SVGSVGElement.h: Move isOutermostSVG() to SVGElement.
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::title): Rename isOutermostSVG to isOutermostSVGSVGElement.
+
 2012-02-08  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [CRASH] InspectorDOMAgent::updateTouchEventEmulationInPage()
index 647377e..39a97b2 100644 (file)
 #include "SVGDocumentExtensions.h"
 #include "SVGElementFactory.h"
 #include "SVGNames.h"
+#include "SVGSVGElement.h"
 #include "SVGStyleElement.h"
 #endif
 
@@ -2257,6 +2258,15 @@ void Document::implicitClose()
 
     ImageLoader::dispatchPendingBeforeLoadEvents();
     ImageLoader::dispatchPendingLoadEvents();
+
+#if ENABLE(SVG)
+    // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
+    // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
+    // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
+    if (svgExtensions())
+        accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements();
+#endif
+
     dispatchWindowLoadEvent();
     enqueuePageshowEvent(PageshowEventNotPersisted);
     enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
@@ -2326,9 +2336,6 @@ void Document::implicitClose()
 #endif
 
 #if ENABLE(SVG)
-    // FIXME: Officially, time 0 is when the outermost <svg> receives its
-    // SVGLoad event, but we don't implement those yet.  This is close enough
-    // for now.  In some cases we should have fired earlier.
     if (svgExtensions())
         accessSVGExtensions()->startAnimations();
 #endif
index 1dd6160..7116110 100644 (file)
@@ -117,6 +117,20 @@ void SVGDocumentExtensions::unpauseAnimations()
         (*itr)->unpauseAnimations();
 }
 
+void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
+{
+    Vector<RefPtr<SVGSVGElement> > timeContainers;
+    timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end());
+
+    Vector<RefPtr<SVGSVGElement> >::iterator end = timeContainers.end();
+    for (Vector<RefPtr<SVGSVGElement> >::iterator it = timeContainers.begin(); it != end; ++it) {
+        SVGSVGElement* outerSVG = (*it).get();
+        if (!outerSVG->isOutermostSVGSVGElement())
+            continue;
+        outerSVG->sendSVGLoadEventIfPossible();
+    }
+}
+
 bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time)
 {
     ASSERT(element);
index 459ff06..db608bd 100644 (file)
@@ -57,6 +57,7 @@ public:
     void pauseAnimations();
     void unpauseAnimations();
     bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time);
+    void dispatchSVGLoadEventToOutermostSVGElements();
     
     void addAnimationElementToTarget(SVGSMILElement*, SVGElement*);
     void removeAnimationElementFromTarget(SVGSMILElement*, SVGElement*);
index b1a162d..a617f91 100644 (file)
@@ -105,6 +105,20 @@ SVGElementRareData* SVGElement::ensureRareSVGData()
     return data;
 }
 
+bool SVGElement::isOutermostSVGSVGElement() const
+{
+    // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc.
+    if (!parentNode())
+        return true;
+
+    // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element.
+    if (parentNode()->hasTagName(SVGNames::foreignObjectTag))
+        return true;
+
+    // This is true whenever this is the outermost SVG, even if there are HTML elements outside it
+    return !parentNode()->isSVGElement();
+}
+
 void SVGElement::reportAttributeParsingError(SVGParsingError error, Attribute* attribute)
 {
     if (error == NoError)
@@ -340,6 +354,20 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents)
         if (hasLoadListener(currentTarget.get()))
             currentTarget->dispatchEvent(Event::create(eventNames().loadEvent, false, false));
         currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>();
+        SVGElement* element = static_cast<SVGElement*>(currentTarget.get());
+        if (!element || !element->isOutermostSVGSVGElement())
+            continue;
+
+        // Consider <svg onload="foo()"><image xlink:href="foo.png" externalResourcesRequired="true"/></svg>.
+        // If foo.png is not yet loaded, the first SVGLoad event will go to the <svg> element, sent through
+        // Document::implicitClose(). Then the SVGLoad event will fire for <image>, once its loaded.
+        ASSERT(sendParentLoadEvents);
+
+        // If the load event was not sent yet by Document::implicitClose(), but the <image> from the example
+        // above, just appeared, don't send the SVGLoad event to the outermost <svg>, but wait for the document
+        // to be "ready to render", first.
+        if (!document()->loadEventFinished())
+            break;
     }
 }
 
@@ -347,6 +375,10 @@ void SVGElement::finishParsingChildren()
 {
     StyledElement::finishParsingChildren();
 
+    // The outermost SVGSVGElement SVGLoad event is fired through Document::dispatchWindowLoadEvent.
+    if (isOutermostSVGSVGElement())
+        return;
+
     // finishParsingChildren() is called when the close tag is reached for an element (e.g. </svg>)
     // we send SVGLoad events here if we can, otherwise they'll be sent when any required loads finish
     sendSVGLoadEventIfPossible();
index 06fac05..c5c5ac5 100644 (file)
@@ -46,6 +46,8 @@ public:
     static PassRefPtr<SVGElement> create(const QualifiedName&, Document*);
     virtual ~SVGElement();
 
+    bool isOutermostSVGSVGElement() const;
+
     String xmlbase() const;
     void setXmlbase(const String&, ExceptionCode&);
 
index f889d63..590eec9 100644 (file)
@@ -186,7 +186,7 @@ SVGViewSpec* SVGSVGElement::currentView() const
 
 float SVGSVGElement::currentScale() const
 {
-    if (!inDocument() || !isOutermostSVG())
+    if (!inDocument() || !isOutermostSVGSVGElement())
         return 1;
 
     Frame* frame = document()->frame();
@@ -204,7 +204,7 @@ float SVGSVGElement::currentScale() const
 
 void SVGSVGElement::setCurrentScale(float scale)
 {
-    if (!inDocument() || !isOutermostSVG())
+    if (!inDocument() || !isOutermostSVGSVGElement())
         return;
 
     Frame* frame = document()->frame();
@@ -428,7 +428,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc
     }
 
     AffineTransform transform;
-    if (!isOutermostSVG()) {
+    if (!isOutermostSVGSVGElement()) {
         SVGLengthContext lengthContext(this);
         transform.translate(x().value(lengthContext), y().value(lengthContext));
     } else if (mode == SVGLocatable::ScreenScope) {
@@ -455,7 +455,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc
 
 RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*)
 {
-    if (isOutermostSVG())
+    if (isOutermostSVGSVGElement())
         return new (arena) RenderSVGRoot(this);
 
     return new (arena) RenderSVGViewportContainer(this);
@@ -512,20 +512,6 @@ bool SVGSVGElement::selfHasRelativeLengths() const
         || hasAttribute(SVGNames::viewBoxAttr);
 }
 
-bool SVGSVGElement::isOutermostSVG() const
-{
-    // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc.
-    if (!parentNode())
-        return true;
-
-    // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element.
-    if (parentNode()->hasTagName(SVGNames::foreignObjectTag))
-        return true;
-
-    // This is true whenever this is the outermost SVG, even if there are HTML elements outside it
-    return !parentNode()->isSVGElement();
-}
-
 FloatRect SVGSVGElement::currentViewBoxRect() const
 {
     if (useCurrentView()) {
index c14b9c7..10c59c2 100644 (file)
@@ -126,8 +126,6 @@ public:
 
     void setupInitialView(const String& fragmentIdentifier, Element* anchorNode);
 
-    bool isOutermostSVG() const;
-
     Element* getElementById(const AtomicString&) const;
 
     bool widthAttributeEstablishesViewport() const;
index 45a4dce..518b5b3 100644 (file)
@@ -84,7 +84,7 @@ String SVGStyledElement::title() const
     // <title> elements are the title of the document, not a tooltip) so we instantly return.
     if (hasTagName(SVGNames::svgTag)) {
         const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(this);
-        if (svg->isOutermostSVG())
+        if (svg->isOutermostSVGSVGElement())
             return String();
     }