Title: [127640] branches/chromium/1229

Diff

Copied: branches/chromium/1229/LayoutTests/svg/custom/loadevents-async-expected.txt (from rev 125147, trunk/LayoutTests/svg/custom/loadevents-async-expected.txt) (0 => 127640)


--- branches/chromium/1229/LayoutTests/svg/custom/loadevents-async-expected.txt	                        (rev 0)
+++ branches/chromium/1229/LayoutTests/svg/custom/loadevents-async-expected.txt	2012-09-05 20:40:24 UTC (rev 127640)
@@ -0,0 +1,11 @@
+This test ensures that tree mutation on the load doesn't break consistency.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS invoked is false
+PASS invoked is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/chromium/1229/LayoutTests/svg/custom/loadevents-async.html (from rev 125147, trunk/LayoutTests/svg/custom/loadevents-async.html) (0 => 127640)


--- branches/chromium/1229/LayoutTests/svg/custom/loadevents-async.html	                        (rev 0)
+++ branches/chromium/1229/LayoutTests/svg/custom/loadevents-async.html	2012-09-05 20:40:24 UTC (rev 127640)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test ensures that tree mutation on the load doesn't break consistency.");
+var invoked = false;
+var spanElement = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+var divElement = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
+var useElement = document.createElementNS("http://www.w3.org/2000/svg", "use");
+var emptyDocument = document.implementation.createDocument("", "", null);
+
+document.body.appendChild(spanElement);
+divElement.appendChild(useElement);
+useElement.addEventListener("load", function () { emptyDocument.adoptNode(useElement); invoked = true; }, false);
+spanElement.appendChild(divElement);
+document.body.appendChild(useElement);
+shouldBeFalse("invoked");
+
+jsTestIsAsync = true;
+setTimeout(function() {
+    shouldBeTrue("invoked");
+    finishJSTest();
+}, 1);
+
+</script>
+<script src=""
+<body>
+</html>

Modified: branches/chromium/1229/Source/WebCore/svg/SVGElement.cpp (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGElement.cpp	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGElement.cpp	2012-09-05 20:40:24 UTC (rev 127640)
@@ -477,6 +477,22 @@
     }
 }
 
+void SVGElement::sendSVGLoadEventIfPossibleAsynchronously()
+{
+    svgLoadEventTimer()->startOneShot(0);
+}
+
+void SVGElement::svgLoadEventTimerFired(Timer<SVGElement>*)
+{
+    sendSVGLoadEventIfPossible();
+}
+
+Timer<SVGElement>* SVGElement::svgLoadEventTimer()
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
 void SVGElement::finishParsingChildren()
 {
     StyledElement::finishParsingChildren();

Modified: branches/chromium/1229/Source/WebCore/svg/SVGElement.h (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGElement.h	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGElement.h	2012-09-05 20:40:24 UTC (rev 127640)
@@ -27,6 +27,7 @@
 #include "SVGParsingError.h"
 #include "SVGPropertyInfo.h"
 #include "StyledElement.h"
+#include "Timer.h"
 #include <wtf/HashMap.h>
 
 namespace WebCore {
@@ -72,6 +73,9 @@
     virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
 
     void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false);
+    void sendSVGLoadEventIfPossibleAsynchronously();
+    void svgLoadEventTimerFired(Timer<SVGElement>*);
+    virtual Timer<SVGElement>* svgLoadEventTimer();
 
     virtual AffineTransform* supplementalTransform() { return 0; }
 

Modified: branches/chromium/1229/Source/WebCore/svg/SVGExternalResourcesRequired.cpp (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGExternalResourcesRequired.cpp	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGExternalResourcesRequired.cpp	2012-09-05 20:40:24 UTC (rev 127640)
@@ -103,7 +103,7 @@
     if (externalResourcesRequiredBaseValue())
         return;
     setHaveFiredLoadEvent(true);
-    targetElement->sendSVGLoadEventIfPossible();
+    targetElement->sendSVGLoadEventIfPossibleAsynchronously();
 }
 
 void SVGExternalResourcesRequired::finishParsingChildren()

Modified: branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.cpp (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.cpp	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.cpp	2012-09-05 20:40:24 UTC (rev 127640)
@@ -47,6 +47,7 @@
 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
     : SVGElement(tagName, document)
     , ScriptElement(this, wasInsertedByParser, alreadyStarted)
+    , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
 {
     ASSERT(hasTagName(SVGNames::scriptTag));
     registerAnimatedPropertiesForSVGScriptElement();

Modified: branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.h (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.h	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGScriptElement.h	2012-09-05 20:40:24 UTC (rev 127640)
@@ -75,6 +75,7 @@
     virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { ScriptElement::setHaveFiredLoadEvent(haveFiredLoadEvent); }
     virtual bool isParserInserted() const { return ScriptElement::isParserInserted(); }
     virtual bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); }
+    virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; }
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement)
         DECLARE_ANIMATED_STRING(Href, href)
@@ -82,6 +83,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 
     String m_type;
+    Timer<SVGElement> m_svgLoadEventTimer;
 };
 
 } // namespace WebCore

Modified: branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.cpp (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.cpp	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.cpp	2012-09-05 20:40:24 UTC (rev 127640)
@@ -37,6 +37,7 @@
 inline SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser)
     : SVGElement(tagName, document)
     , StyleElement(document, createdByParser)
+    , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
 {
     ASSERT(hasTagName(SVGNames::styleTag));
 }

Modified: branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.h (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.h	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGStyleElement.h	2012-09-05 20:40:24 UTC (rev 127640)
@@ -63,6 +63,9 @@
     virtual bool isLoading() const { return StyleElement::isLoading(); }
     virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); }
     virtual void startLoadingDynamicSheet() { StyleElement::startLoadingDynamicSheet(document()); }
+    virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; }
+
+    Timer<SVGElement> m_svgLoadEventTimer;
 };
 
 } // namespace WebCore

Modified: branches/chromium/1229/Source/WebCore/svg/SVGUseElement.cpp (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGUseElement.cpp	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGUseElement.cpp	2012-09-05 20:40:24 UTC (rev 127640)
@@ -89,6 +89,7 @@
     , m_wasInsertedByParser(wasInsertedByParser)
     , m_haveFiredLoadEvent(false)
     , m_needsShadowTreeRecreation(false)
+    , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
 {
     ASSERT(hasCustomCallbacks());
     ASSERT(hasTagName(SVGNames::useTag));

Modified: branches/chromium/1229/Source/WebCore/svg/SVGUseElement.h (127639 => 127640)


--- branches/chromium/1229/Source/WebCore/svg/SVGUseElement.h	2012-09-05 20:31:57 UTC (rev 127639)
+++ branches/chromium/1229/Source/WebCore/svg/SVGUseElement.h	2012-09-05 20:40:24 UTC (rev 127640)
@@ -124,12 +124,14 @@
     virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { m_haveFiredLoadEvent = haveFiredLoadEvent; }
     virtual bool isParserInserted() const { return m_wasInsertedByParser; }
     virtual bool haveFiredLoadEvent() const { return m_haveFiredLoadEvent; }
+    virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; }
 
     bool m_wasInsertedByParser;
     bool m_haveFiredLoadEvent;
     bool m_needsShadowTreeRecreation;
     RefPtr<SVGElementInstance> m_targetElementInstance;
     CachedResourceHandle<CachedSVGDocument> m_cachedDocument;
+    Timer<SVGElement> m_svgLoadEventTimer;
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to