Title: [145342] trunk
Revision
145342
Author
apav...@chromium.org
Date
2013-03-11 00:16:56 -0700 (Mon, 11 Mar 2013)

Log Message

Web Inspector: [Elements] XSLT transformation result from the xml-stylesheet PI not rendered
https://bugs.webkit.org/show_bug.cgi?id=111313

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Frame document update upon XSL transformation was never instrumented.
This change instruments the Document::applyXSLTransform() method to that end.

Test: http/tests/inspector/styles/xsl-transformed.xml

* dom/Document.cpp:
(WebCore::Document::applyXSLTransform): Instrumented.
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::frameDocumentUpdated): Invoked upon applyXSLTransform().
* inspector/InspectorDOMAgent.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl): Added.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didCommitLoad): Drive-by: simplified.
(WebCore::InspectorInstrumentation::frameDocumentUpdated): Added.

LayoutTests:

* http/tests/inspector/styles/resources/xsl-transformed.xsl: Added.
* http/tests/inspector/styles/xsl-transformed-expected.txt: Added.
* http/tests/inspector/styles/xsl-transformed.xml: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145341 => 145342)


--- trunk/LayoutTests/ChangeLog	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/LayoutTests/ChangeLog	2013-03-11 07:16:56 UTC (rev 145342)
@@ -1,3 +1,14 @@
+2013-03-07  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Elements] XSLT transformation result from the xml-stylesheet PI not rendered
+        https://bugs.webkit.org/show_bug.cgi?id=111313
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector/styles/resources/xsl-transformed.xsl: Added.
+        * http/tests/inspector/styles/xsl-transformed-expected.txt: Added.
+        * http/tests/inspector/styles/xsl-transformed.xml: Added.
+
 2013-03-10  Matt Falkenhagen  <fal...@chromium.org>
 
         Implement inert subtrees needed for modal <dialog>

Added: trunk/LayoutTests/http/tests/inspector/styles/resources/xsl-transformed.xsl (0 => 145342)


--- trunk/LayoutTests/http/tests/inspector/styles/resources/xsl-transformed.xsl	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/resources/xsl-transformed.xsl	2013-03-11 07:16:56 UTC (rev 145342)
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='utf-8'?>
+<xsl:stylesheet version="1.0"
+                id="stylesheet"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:template match="items">
+        <html>
+        <head>
+        <script src=""
+        <script src=""
+        <script src=""
+        <script>
+        function test()
+        {
+            InspectorTest.reloadPage(step1);
+
+            function step1()
+            {
+                InspectorTest.runAfterResourcesAreFinished(["xsl-transformed.xsl"], InspectorTest.expandElementsTree.bind(InspectorTest, step2));
+            }
+
+            function step2()
+            {
+                InspectorTest.dumpElementsTree();
+                InspectorTest.completeTest();
+            }
+        }
+        </script>
+        </head>
+        <body _onload_="runTest()">
+        <p>Tests that XSL-transformed documents in the main frame are rendered correctly in the Elements panel. <a href="" 111313</a></p>
+        <xsl:for-each select="item">
+          <span><xsl:value-of select="."/></span>
+        </xsl:for-each>
+        </body>
+        </html>
+    </xsl:template>
+</xsl:stylesheet>
+

Added: trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed-expected.txt (0 => 145342)


--- trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed-expected.txt	2013-03-11 07:16:56 UTC (rev 145342)
@@ -0,0 +1,33 @@
+Tests that XSL-transformed documents in the main frame are rendered correctly in the Elements panel. Bug 111313
+
+OneTwoThree
+Page reloaded.
+- <html>
+    - <head>
+          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+          <script src=""
+          <script src=""
+          <script src=""
+        - <script>
+              function test()\n        {\n            InspectorTest.reloadPage(step1);\n\n            function step1()\n            {\n                InspectorTest.runAfterResourcesAreFinished(["xsl-transformed.xsl"], InspectorTest.expandElementsTree.bind(InspectorTest, step2));\n            }\n\n            function step2()\n            {\n                InspectorTest.dumpElementsTree();\n                InspectorTest.completeTest();\n            }\n        }\n
+          </script>
+      </head>
+    - <body _onload_="runTest()">
+        - <p>
+              "Tests that XSL-transformed documents in the main frame are rendered correctly in the Elements panel. "
+              <a href="" 111313</a>
+          </p>
+          <span>One</span>
+          <span>Two</span>
+          <span>Three</span>
+        - <div>
+            - <div>
+                - <div class="output" id="output" style="white-space: pre;">
+                      "Page reloaded."
+                      <br>
+                  </div>
+              </div>
+          </div>
+      </body>
+  </html>
+

Added: trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed.xml (0 => 145342)


--- trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed.xml	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/xsl-transformed.xml	2013-03-11 07:16:56 UTC (rev 145342)
@@ -0,0 +1,6 @@
+<?xml-stylesheet type="text/xsl" href=""
+<items>
+  <item>One</item>
+  <item>Two</item>
+  <item>Three</item>
+</items>

Modified: trunk/Source/WebCore/ChangeLog (145341 => 145342)


--- trunk/Source/WebCore/ChangeLog	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/ChangeLog	2013-03-11 07:16:56 UTC (rev 145342)
@@ -1,3 +1,26 @@
+2013-03-07  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Elements] XSLT transformation result from the xml-stylesheet PI not rendered
+        https://bugs.webkit.org/show_bug.cgi?id=111313
+
+        Reviewed by Vsevolod Vlasov.
+
+        Frame document update upon XSL transformation was never instrumented.
+        This change instruments the Document::applyXSLTransform() method to that end.
+
+        Test: http/tests/inspector/styles/xsl-transformed.xml
+
+        * dom/Document.cpp:
+        (WebCore::Document::applyXSLTransform): Instrumented.
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::frameDocumentUpdated): Invoked upon applyXSLTransform().
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl): Added.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didCommitLoad): Drive-by: simplified.
+        (WebCore::InspectorInstrumentation::frameDocumentUpdated): Added.
+
 2013-03-10  Matt Falkenhagen  <fal...@chromium.org>
 
         Implement inert subtrees needed for modal <dialog>

Modified: trunk/Source/WebCore/dom/Document.cpp (145341 => 145342)


--- trunk/Source/WebCore/dom/Document.cpp	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-03-11 07:16:56 UTC (rev 145342)
@@ -4241,7 +4241,9 @@
     if (!processor->transformToString(this, resultMIMEType, newSource, resultEncoding))
         return;
     // FIXME: If the transform failed we should probably report an error (like Mozilla does).
-    processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, this, frame());
+    Frame* ownerFrame = frame();
+    processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, this, ownerFrame);
+    InspectorInstrumentation::frameDocumentUpdated(ownerFrame);
 }
 
 void Document::setTransformSource(PassOwnPtr<TransformSource> source)

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (145341 => 145342)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2013-03-11 07:16:56 UTC (rev 145342)
@@ -1672,6 +1672,22 @@
         m_frontend->shadowRootPopped(hostId, rootId);
 }
 
+void InspectorDOMAgent::frameDocumentUpdated(Frame* frame)
+{
+    Document* document = frame->document();
+    if (!document)
+        return;
+
+    Page* page = frame->page();
+    ASSERT(page);
+    if (frame != page->mainFrame())
+        return;
+
+    // Only update the main frame document, nested frame document updates are not required
+    // (will be handled by loadEventFired()).
+    setDocument(document);
+}
+
 Node* InspectorDOMAgent::nodeForPath(const String& path)
 {
     // The path is of form "1,HTML,2,BODY,1,DIV"

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (145341 => 145342)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2013-03-11 07:16:56 UTC (rev 145342)
@@ -171,6 +171,7 @@
     void didInvalidateStyleAttr(Node*);
     void didPushShadowRoot(Element* host, ShadowRoot*);
     void willPopShadowRoot(Element* host, ShadowRoot*);
+    void frameDocumentUpdated(Frame*);
 
     int pushNodeToFrontend(ErrorString*, int documentNodeId, Node*);
     Node* nodeForId(int nodeId);

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (145341 => 145342)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-03-11 07:16:56 UTC (rev 145342)
@@ -937,6 +937,16 @@
         pageAgent->frameNavigated(loader);
 }
 
+void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+{
+    InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
+    if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
+        return;
+
+    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+        domAgent->frameDocumentUpdated(frame);
+}
+
 void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader)
 {
     if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (145341 => 145342)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-03-11 06:29:59 UTC (rev 145341)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-03-11 07:16:56 UTC (rev 145342)
@@ -213,6 +213,7 @@
     static void loadEventFired(Frame*);
     static void frameDetachedFromParent(Frame*);
     static void didCommitLoad(Frame*, DocumentLoader*);
+    static void frameDocumentUpdated(Frame*);
     static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
     static void frameStartedLoading(Frame*);
     static void frameStoppedLoading(Frame*);
@@ -415,6 +416,7 @@
     static void loadEventFiredImpl(InstrumentingAgents*, Frame*);
     static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
     static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
+    static void frameDocumentUpdatedImpl(InstrumentingAgents*, Frame*);
     static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
     static void frameStartedLoadingImpl(InstrumentingAgents*, Frame*);
     static void frameStoppedLoadingImpl(InstrumentingAgents*, Frame*);
@@ -1641,19 +1643,25 @@
 inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
 {
 #if ENABLE(INSPECTOR)
-    if (!frame)
-        return;
-    Page* page = frame->page();
-    if (!page)
-        return;
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didCommitLoadImpl(instrumentingAgents, page, loader);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        didCommitLoadImpl(instrumentingAgents, frame->page(), loader);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(loader);
 #endif
 }
 
+inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame)
+{
+#if ENABLE(INSPECTOR)
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        frameDocumentUpdatedImpl(instrumentingAgents, frame);
+#else
+    UNUSED_PARAM(frame);
+#endif
+}
+
 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
 {
 #if ENABLE(INSPECTOR)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to