Title: [123459] trunk
Revision
123459
Author
commit-qu...@webkit.org
Date
2012-07-24 05:00:33 -0700 (Tue, 24 Jul 2012)

Log Message

Web Inspector: Protocol Extension: add getFlowByName command
https://bugs.webkit.org/show_bug.cgi?id=91855

Patch by Andrei Poenaru <poen...@adobe.com> on 2012-07-24
Reviewed by Pavel Feldman.

Source/WebCore:

The "getFlowByName" command should return a NamedFlow for a given document and name.

Test: inspector/styles/protocol-css-regions-commands.html

* inspector/Inspector.json:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getFlowByName):
(WebCore):
* inspector/InspectorCSSAgent.h:
(InspectorCSSAgent):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
(WebInspector.NamedFlow):
(WebInspector.NamedFlow.parsePayload):

LayoutTests:

Created a single test suite for the WebInspector protocol extension for CSS Regions.

* inspector/styles/protocol-css-regions-commands-expected.txt: Added.
* inspector/styles/protocol-css-regions-commands.html: Added.
* inspector/styles/protocol-getNamedFlowCollection-command-expected.txt: Removed.
* inspector/styles/protocol-getNamedFlowCollection-command.html: Removed.
* platform/efl/TestExpectations:
* platform/qt/Skipped:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123458 => 123459)


--- trunk/LayoutTests/ChangeLog	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/LayoutTests/ChangeLog	2012-07-24 12:00:33 UTC (rev 123459)
@@ -1,3 +1,19 @@
+2012-07-24  Andrei Poenaru  <poen...@adobe.com>
+
+        Web Inspector: Protocol Extension: add getFlowByName command
+        https://bugs.webkit.org/show_bug.cgi?id=91855
+
+        Reviewed by Pavel Feldman.
+
+        Created a single test suite for the WebInspector protocol extension for CSS Regions.
+
+        * inspector/styles/protocol-css-regions-commands-expected.txt: Added.
+        * inspector/styles/protocol-css-regions-commands.html: Added.
+        * inspector/styles/protocol-getNamedFlowCollection-command-expected.txt: Removed.
+        * inspector/styles/protocol-getNamedFlowCollection-command.html: Removed.
+        * platform/efl/TestExpectations:
+        * platform/qt/Skipped:
+
 2012-07-24  Anthony Scian  <asc...@rim.com>
 
         Web Inspector [JSC]: Enable initiator column in network panel.

Added: trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt (0 => 123459)


--- trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt	2012-07-24 12:00:33 UTC (rev 123459)
@@ -0,0 +1,21 @@
+Tests the following commands:
+
+getNamedFlowCollection Bug 91607
+getFlowByName Bug 91855
+
+
+Running: testGetNamedFlowCollection
+=== CSS Named Flows ===
+flow1
+flow2
+flow3
+
+Running: testGetFlowByName1
+=== Named Flow "flow2" from main document ===
+name: flow2
+overset: false
+
+Running: testGetFlowByName2
+=== Name Flow "flow4" from main document ===
+There is no Named Flow "flow4" in the main document
+

Added: trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html (0 => 123459)


--- trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html	2012-07-24 12:00:33 UTC (rev 123459)
@@ -0,0 +1,128 @@
+<html>
+<head>
+<script src=""
+<script>
+
+function createDynamicElements()
+{
+    var frameDoc = window.frames[0].document;
+
+    var el = frameDoc.createElement("article");
+    el.style.webkitFlowInto = "flow4";
+    frameDoc.body.appendChild(el);
+
+    el = frameDoc.createElement("div");
+    el.style.webkitFlowFrom = "flow4";
+    frameDoc.body.appendChild(el);
+
+    runTest();
+}
+
+function test()
+{
+    WebInspector.showPanel("elements");
+    InspectorTest.runTestSuite([
+        function testGetNamedFlowCollection(next)
+        {
+            WebInspector.domAgent.requestDocument(documentCallback);
+
+            function documentCallback(document)
+            {
+                WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
+            }
+
+            function namedFlowCallback(namedFlows)
+            {
+                InspectorTest.addResult("=== CSS Named Flows ===");
+
+                if (!namedFlows) {
+                    InspectorTest.addResult("[!] Failed to get Named Flows");
+                    InspectorTest.completeTest();
+                    return;
+                }
+
+                namedFlows.sort();
+
+                for (var i = 0; i < namedFlows.length; ++i)
+                    InspectorTest.addResult(namedFlows[i]);
+
+                next();
+            }
+        },
+
+        function testGetFlowByName1(next)
+        {
+            WebInspector.domAgent.requestDocument(documentCallback);
+
+            function documentCallback(document)
+            {
+                WebInspector.cssModel.getFlowByNameAsync(document.id, "flow2", namedFlowCallback);
+            }
+
+            function namedFlowCallback(namedFlow)
+            {
+                InspectorTest.addResult("=== Named Flow \"flow2\" from main document ===");
+
+                if (!namedFlow) {
+                    InspectorTest.addResult("[!] Failed to get Named Flow");
+                    InspectorTest.completeTest();
+                    return;
+                }
+
+                InspectorTest.addResult("name: " + namedFlow.name);
+                InspectorTest.addResult("overset: " + namedFlow.overset);
+
+                next();
+            }
+        },
+
+        function testGetFlowByName2(next)
+        {
+            WebInspector.domAgent.requestDocument(documentCallback);
+
+            function documentCallback(document)
+            {
+                WebInspector.cssModel.getFlowByNameAsync(document.id, "flow4", namedFlowCallback);
+            }
+
+            function namedFlowCallback(namedFlow)
+            {
+                InspectorTest.addResult("=== Name Flow \"flow4\" from main document ===");
+
+                if (namedFlow) {
+                    InspectorTest.addResult("[!] Failed")
+                    InspectorTest.completeTest();
+                    return;
+                }
+
+                InspectorTest.addResult("There is no Named Flow \"flow4\" in the main document");
+                next();
+            }
+        },
+    ]);
+}
+</script>
+</head>
+
+<body _onload_="createDynamicElements()">
+<p>
+Tests the following commands:
+<ul>
+    <li>getNamedFlowCollection <a href="" 91607</a></li>
+    <li>getFlowByName <a href="" 91855</a></li>
+</ul>
+</p>
+
+<article style="-webkit-flow-into: flow1"></article>
+<div style="-webkit-flow-from: flow1"></div>
+
+<article style="-webkit-flow-into: flow2"></article>
+<div style="-webkit-flow-from: flow2"></div>
+
+<article style="-webkit-flow-into: flow3"></article>
+<div style="-webkit-flow-from: flow3"></div>
+
+<iframe></iframe>
+
+</body>
+</html>

Deleted: trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt (123458 => 123459)


--- trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt	2012-07-24 12:00:33 UTC (rev 123459)
@@ -1,11 +0,0 @@
-Tests that the "getNamedFlowCollection" command returns the CSS Named Flows in the page. Bug 91607
-
-flow1
-flow2
-flow3
-
-=== CSS Named Flows ===
-flow1
-flow2
-flow3
-

Deleted: trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html (123458 => 123459)


--- trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html	2012-07-24 12:00:33 UTC (rev 123459)
@@ -1,75 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-
-function createDynamicElements()
-{
-    var frameDoc = window.frames[0].document;
-
-    var el = frameDoc.createElement("article");
-    el.innerText = "flow4";
-    el.style.webkitFlowInto = "flow4";
-    frameDoc.body.appendChild(el);
-
-    el = frameDoc.createElement("div");
-    el.style.webkitFlowFrom = "flow4";
-    frameDoc.body.appendChild(el);
-}
-
-function test()
-{
-    WebInspector.showPanel("elements");
-    InspectorTest.evaluateInPage("createDynamicElements()", testStep);
-
-    function testStep()
-    {
-        function namedFlowCallback(namedFlows)
-        {
-            InspectorTest.addResult("=== CSS Named Flows ===");
-
-            if (!namedFlows)
-            {
-                InspectorTest.addResult("[!] Failed to get Named Flows");
-                InspectorTest.completeTest();
-                return;
-            }
-
-            namedFlows.sort();
-
-            for (var i = 0; i < namedFlows.length; ++i)
-                InspectorTest.addResult(namedFlows[i]);
-
-            InspectorTest.completeTest();
-        }
-
-        function documentCallback(document)
-        {
-            WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
-        }
-
-        WebInspector.domAgent.requestDocument(documentCallback);
-    }
-}
-</script>
-</head>
-
-<body _onload_="runTest()">
-<p>
-Tests that the "getNamedFlowCollection" command returns the CSS Named Flows in the page.
-<a href="" 91607</a>
-</p>
-
-<article style="-webkit-flow-into: flow1">flow1</article>
-<div style="-webkit-flow-from: flow1"></div>
-
-<article style="-webkit-flow-into: flow2">flow2</article>
-<div style="-webkit-flow-from: flow2"></div>
-
-<article style="-webkit-flow-into: flow3">flow3</article>
-<div style="-webkit-flow-from: flow3"></div>
-
-<iframe></iframe>
-
-</body>
-</html>

Modified: trunk/LayoutTests/platform/efl/TestExpectations (123458 => 123459)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-07-24 12:00:33 UTC (rev 123459)
@@ -42,7 +42,7 @@
 
 // CSS Regions support not yet enabled, tracking in a separate EFL bug.
 BUGWK83897 SKIP : fast/regions = PASS
-BUGWK83897 SKIP : inspector/styles/protocol-getNamedFlowCollection-command.html = PASS
+BUGWK83897 SKIP : inspector/styles/protocol-css-regions-commands.html = PASS
 
 // Exclusions implementation not complete yet.
 BUGWK83898 SKIP : fast/exclusions = PASS

Modified: trunk/LayoutTests/platform/qt/Skipped (123458 => 123459)


--- trunk/LayoutTests/platform/qt/Skipped	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-07-24 12:00:33 UTC (rev 123459)
@@ -2601,6 +2601,10 @@
 css2.1/20110323/text-indent-intrinsic-003.htm
 css2.1/20110323/text-indent-intrinsic-004.htm
 
+# [Qt] new test introduced in r123205 fails on Qt
+# https://bugs.webkit.org/show_bug.cgi?id=91967
+inspector/styles/protocol-css-regions-commands.html
+
 # [Qt] new test introduced in r123281 fails on Qt
 # https://bugs.webkit.org/show_bug.cgi?id=91968
 fast/sub-pixel/table-rows-have-stable-height.html

Modified: trunk/Source/WebCore/ChangeLog (123458 => 123459)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 12:00:33 UTC (rev 123459)
@@ -1,3 +1,26 @@
+2012-07-24  Andrei Poenaru  <poen...@adobe.com>
+
+        Web Inspector: Protocol Extension: add getFlowByName command
+        https://bugs.webkit.org/show_bug.cgi?id=91855
+
+        Reviewed by Pavel Feldman.
+
+        The "getFlowByName" command should return a NamedFlow for a given document and name.
+
+        Test: inspector/styles/protocol-css-regions-commands.html
+
+        * inspector/Inspector.json:
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::getFlowByName):
+        (WebCore):
+        * inspector/InspectorCSSAgent.h:
+        (InspectorCSSAgent):
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
+        (WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
+        (WebInspector.NamedFlow):
+        (WebInspector.NamedFlow.parsePayload):
+
 2012-07-23  Oswald Buddenhagen  <oswald.buddenha...@nokia.com>
 
         [Qt] Fix compilation against namespaced Qt

Modified: trunk/Source/WebCore/inspector/Inspector.json (123458 => 123459)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-07-24 12:00:33 UTC (rev 123459)
@@ -2128,6 +2128,17 @@
                     { "name": "totalTime", "type": "number", "description": "Total processing time for all selectors in the profile (in milliseconds.)" },
                     { "name": "data", "type": "array", "items": { "$ref": "SelectorProfileEntry" }, "description": "CSS selector profile entries." }
                 ]
+            },
+            {
+                "id": "NamedFlow",
+                "type": "object",
+                "properties": [
+                    { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+                    { "name": "name", "type": "string", "description": "Named Flow identifier." },
+                    { "name": "overset", "type": "boolean", "description": "The \"overset\" attribute of a Named Flow." }
+                ],
+                "description": "This object represents a Named Flow.",
+                "hidden": true
             }
         ],
         "commands": [
@@ -2277,13 +2288,25 @@
             {
                 "name": "getNamedFlowCollection",
                 "parameters": [
-                    { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection."}
+                    { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection." }
                 ],
                 "returns": [
                     { "name": "namedFlows", "type": "array", "items": { "type": "string" }, "description": "An array containing the Named Flows in the document." }
                 ],
                 "description": "Returns the Named Flows from the document.",
                 "hidden": true
+            },
+            {
+                "name": "getFlowByName",
+                "parameters": [
+                    { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+                    { "name": "name", "type": "string", "description": "Named Flow identifier." }
+                ],
+                "returns": [
+                    { "name": "namedFlow", "$ref": "NamedFlow", "description": "A Named Flow." }
+                ],
+                "description": "Returns the Named Flow identified by the given name",
+                "hidden": true
             }
         ],
         "events": [

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (123458 => 123459)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2012-07-24 12:00:33 UTC (rev 123459)
@@ -51,6 +51,7 @@
 #include "StyleResolver.h"
 #include "StyleRule.h"
 #include "StyleSheetList.h"
+#include "WebKitNamedFlow.h"
 #include "WebKitNamedFlowCollection.h"
 
 #include <wtf/CurrentTime.h>
@@ -803,6 +804,24 @@
     result = namedFlows.release();
 }
 
+void InspectorCSSAgent::getFlowByName(ErrorString* errorString, int nodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result)
+{
+    Document* document = m_domAgent->assertDocument(errorString, nodeId);
+    if (!document)
+        return;
+
+    WebKitNamedFlow* namedFlow = document->namedFlows()->flowByName(flowName);
+    if (!namedFlow) {
+        *errorString = "No target CSS Named Flow found";
+        return;
+    }
+
+    result = TypeBuilder::CSS::NamedFlow::create()
+        .setNodeId(nodeId)
+        .setName(flowName)
+        .setOverset(namedFlow->overset());
+}
+
 void InspectorCSSAgent::startSelectorProfiler(ErrorString*)
 {
     m_currentSelectorProfile = adoptPtr(new SelectorProfile());

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (123458 => 123459)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h	2012-07-24 12:00:33 UTC (rev 123459)
@@ -111,6 +111,7 @@
     virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result);
     virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& result);
     virtual void getNamedFlowCollection(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result);
+    virtual void getFlowByName(ErrorString*, int nodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result);
 
     virtual void startSelectorProfiler(ErrorString*);
     virtual void stopSelectorProfiler(ErrorString*, RefPtr<TypeBuilder::CSS::SelectorProfile>&);

Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (123458 => 123459)


--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-24 11:48:20 UTC (rev 123458)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-24 12:00:33 UTC (rev 123459)
@@ -178,10 +178,33 @@
                 userCallback(namedFlowPayload);
         }
 
-        CSSAgent.getNamedFlowCollection(nodeId, callback.bind(null, userCallback));
+        CSSAgent.getNamedFlowCollection(nodeId, callback.bind(this, userCallback));
     },
 
     /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} flowName
+     * @param {function(?WebInspector.NamedFlow)} userCallback
+     */
+    getFlowByNameAsync: function(nodeId, flowName, userCallback)
+    {
+        /**
+         * @param {function(?WebInspector.NamedFlow)} userCallback
+         * @param {?Protocol.Error} error
+         * @param {?CSSAgent.NamedFlow=} namedFlowPayload
+         */
+        function callback(userCallback, error, namedFlowPayload)
+        {
+            if (error || !namedFlowPayload)
+                userCallback(null);
+            else
+                userCallback(WebInspector.NamedFlow.parsePayload(namedFlowPayload));
+        }
+
+        CSSAgent.getFlowByName(nodeId, flowName, callback.bind(this, userCallback));
+    },
+
+    /**
      * @param {CSSAgent.CSSRuleId} ruleId
      * @param {DOMAgent.NodeId} nodeId
      * @param {string} newSelector
@@ -1219,6 +1242,26 @@
 }
 
 /**
+ * @constructor
+ * @param {CSSAgent.NamedFlow} payload
+ */
+WebInspector.NamedFlow = function(payload)
+{
+    this.nodeId = payload.nodeId;
+    this.name = payload.name;
+    this.overset = payload.overset;
+}
+
+/**
+ * @param {CSSAgent.NamedFlow} payload
+ * @return {WebInspector.NamedFlow}
+ */
+WebInspector.NamedFlow.parsePayload = function(payload)
+{
+    return new WebInspector.NamedFlow(payload);
+}
+
+/**
  * @type {WebInspector.CSSStyleModel}
  */
 WebInspector.cssModel = null;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to