Title: [210250] trunk
Revision
210250
Author
[email protected]
Date
2017-01-03 14:31:22 -0800 (Tue, 03 Jan 2017)

Log Message

Web Inspector: Fix Content Flow Container Regions Computed Style section
https://bugs.webkit.org/show_bug.cgi?id=166294

Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype._coerceRemoteArrayOfDOMNodes):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.domNodeResolved):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.remoteObjectPropertiesAvailable):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getComputedProperty): Deleted.
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getContentFlowName): Deleted.
Update this to use Array.from() to convert the NodeList to an Array, and then
use the already available RemoteObject's size property instead of getting the
"length" property from the Array.

LayoutTests:

* inspector/dom/content-flow-list.html:
Update the domTree across navigations. Also dynamically add the flows to
ensure we get the events.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210249 => 210250)


--- trunk/LayoutTests/ChangeLog	2017-01-03 22:12:27 UTC (rev 210249)
+++ trunk/LayoutTests/ChangeLog	2017-01-03 22:31:22 UTC (rev 210250)
@@ -1,3 +1,14 @@
+2017-01-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Fix Content Flow Container Regions Computed Style section
+        https://bugs.webkit.org/show_bug.cgi?id=166294
+
+        Reviewed by Brian Burg.
+
+        * inspector/dom/content-flow-list.html:
+        Update the domTree across navigations. Also dynamically add the flows to
+        ensure we get the events.
+
 2017-01-03  Carlos Alberto Lopez Perez  <[email protected]>
 
         A floating element within <li> overlaps with the marker

Modified: trunk/LayoutTests/inspector/dom/content-flow-list.html (210249 => 210250)


--- trunk/LayoutTests/inspector/dom/content-flow-list.html	2017-01-03 22:12:27 UTC (rev 210249)
+++ trunk/LayoutTests/inspector/dom/content-flow-list.html	2017-01-03 22:31:22 UTC (rev 210250)
@@ -9,18 +9,24 @@
 </style>
 <script src=""
 <script>
-function removeFlow()
-{
+function addFlow() {
+    let div = document.createElement("div");
+    div.id = "flow1";
+    document.body.appendChild(div);
+}
+
+function removeFlow() {
     document.getElementById("flow1").remove();
 }
 
 function test()
 {
-    let domTree = WebInspector.frameResourceManager.mainFrame.domTree;
+    let domTree;
 
     function onRootDOMNodeInvalidated()
     {
         domTree.requestContentFlowList();
+        InspectorTest.evaluateInPage("addFlow()");
     }
 
     function onContentFlowWasAdded(event)
@@ -27,7 +33,6 @@
     {
         InspectorTest.expectEqual(event.data.flow.name, "flow1", "ContentFlow was added");
         InspectorTest.expectEqual(domTree.contentFlowCollection.items.size, 1, "Flow count is 1");
-
         InspectorTest.evaluateInPage("removeFlow()");
     }
 
@@ -39,6 +44,7 @@
     }
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function() {
+        domTree = WebInspector.frameResourceManager.mainFrame.domTree;
         domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated);
         domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded);
         domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved, onContentFlowWasRemoved);
@@ -50,8 +56,6 @@
 </script>
 </head>
 <body _onload_="runTest()">
-    <p>Testing that the ContentFlows events are correctly dispatched when new flows are created/removed.</p>
-
-    <div id="flow1"></div>
+<p>Testing that the ContentFlows events are correctly dispatched when new flows are created/removed.</p>
 </body>
 </html>

Modified: trunk/Source/WebInspectorUI/ChangeLog (210249 => 210250)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-01-03 22:12:27 UTC (rev 210249)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-01-03 22:31:22 UTC (rev 210250)
@@ -1,3 +1,21 @@
+2017-01-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Fix Content Flow Container Regions Computed Style section
+        https://bugs.webkit.org/show_bug.cgi?id=166294
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Controllers/DOMTreeManager.js:
+        (WebInspector.DOMTreeManager.prototype._coerceRemoteArrayOfDOMNodes):
+        (WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.domNodeResolved):
+        (WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.remoteObjectPropertiesAvailable):
+        (WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo):
+        (WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getComputedProperty): Deleted.
+        (WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getContentFlowName): Deleted.
+        Update this to use Array.from() to convert the NodeList to an Array, and then
+        use the already available RemoteObject's size property instead of getting the
+        "length" property from the Array.
+
 2017-01-03  Brian Burg  <[email protected]>
 
         Web Inspector: opening Test.html in a normal browser window doesn't log errors to console

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js (210249 => 210250)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2017-01-03 22:12:27 UTC (rev 210249)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2017-01-03 22:31:22 UTC (rev 210250)
@@ -248,7 +248,7 @@
         this._unbind(node);
         this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeRemoved, {node, parent});
     }
-    
+
     _customElementStateChanged(elementId, newState)
     {
         const node = this._idToDOMNode[elementId];
@@ -605,10 +605,22 @@
         flow.removeContentNode(this.nodeForId(contentNodeId));
     }
 
-    _coerceRemoteArrayOfDOMNodes(objectId, callback)
+    _coerceRemoteArrayOfDOMNodes(remoteObject, callback)
     {
-        var length, nodes, received = 0, lastError = null, domTreeManager = this;
+        console.assert(remoteObject.type === "object");
+        console.assert(remoteObject.subtype === "array");
 
+        let length = remoteObject.size;
+        if (!length) {
+            callback(null, []);
+            return;
+        }
+
+        let nodes;
+        let received = 0;
+        let lastError = null;
+        let domTreeManager = this;
+
         function nodeRequested(index, error, nodeId)
         {
             if (error)
@@ -619,28 +631,17 @@
                 callback(lastError, nodes);
         }
 
-        WebInspector.runtimeManager.getPropertiesForRemoteObject(objectId, function(error, properties) {
+        WebInspector.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId, function(error, properties) {
             if (error) {
                 callback(error);
                 return;
             }
 
-            var lengthProperty = properties.get("length");
-            if (!lengthProperty || lengthProperty.value.type !== "number") {
-                callback(null);
-                return;
-            }
-
-            length = lengthProperty.value.value;
-            if (!length) {
-                callback(null, []);
-                return;
-            }
-
             nodes = new Array(length);
-            for (var i = 0; i < length; ++i) {
-                var nodeProperty = properties.get(String(i));
+            for (let i = 0; i < length; ++i) {
+                let nodeProperty = properties.get(String(i));
                 console.assert(nodeProperty.value.type === "object");
+                console.assert(nodeProperty.value.subtype === "node");
                 DOMAgent.requestNode(nodeProperty.value.objectId, nodeRequested.bind(null, i));
             }
         });
@@ -656,11 +657,10 @@
                 resultReadyCallback(error);
                 return;
             }
-            // Serialize "backendFunction" and execute it in the context of the page
-            // passing the DOMNode as the "this" reference.
+
             var evalParameters = {
                 objectId: remoteObject.objectId,
-                functionDeclaration: appendWebInspectorSourceURL(backendFunction.toString()),
+                functionDeclaration: appendWebInspectorSourceURL(inspectedPage_node_getFlowInfo.toString()),
                 doNotPauseOnExceptionsAndMuteConsole: true,
                 returnByValue: false,
                 generatePreview: false
@@ -721,16 +721,13 @@
                 return;
             }
 
-            console.assert(regionsProperty.value.type === "object");
-            console.assert(regionsProperty.value.subtype === "array");
-            this._coerceRemoteArrayOfDOMNodes(regionsProperty.value.objectId, function(error, nodes) {
+            this._coerceRemoteArrayOfDOMNodes(regionsProperty.value, function(error, nodes) {
                 result.regions = nodes;
                 resultReadyCallback(error, result);
             });
         }
 
-        // Note that "backendFunction" is serialized and executed in the context of the page.
-        function backendFunction()
+        function inspectedPage_node_getFlowInfo()
         {
             function getComputedProperty(node, propertyName)
             {
@@ -764,7 +761,7 @@
             if (result.contentFlowName) {
                 var flowThread = node.ownerDocument.webkitGetNamedFlows().namedItem(result.contentFlowName);
                 if (flowThread)
-                    result.regions = flowThread.getRegionsByContent(node);
+                    result.regions = Array.from(flowThread.getRegionsByContent(node));
             }
 
             return result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to