Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / elements-test.js
index f7bd4fe..009560a 100644 (file)
@@ -170,6 +170,11 @@ InspectorTest.selectNodeAndWaitForStylesWithComputed = function(idValue, callbac
     InspectorTest.selectNodeAndWaitForStyles(idValue, stylesCallback);
 }
 
+InspectorTest.firstElementsTreeOutline = function()
+{
+    return WebInspector.panels.elements._treeOutlines[0];
+}
+
 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatched, omitLonghands, includeSelectorGroupMarks)
 {
     function extractText(element)
@@ -213,7 +218,11 @@ InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch
             if (section.element.previousSibling && section.element.previousSibling.className === "sidebar-separator")
                 InspectorTest.addResult("======== " + section.element.previousSibling.textContent + " ========");
             InspectorTest.addResult((section.expanded ? "[expanded] " : "[collapsed] ") + (section.noAffect ? "[no-affect] " : ""));
-            var chainEntries = section.titleElement.children;
+            var chainEntries = section.titleElement.querySelectorAll(".media-list .media");
+            chainEntries = Array.prototype.slice.call(chainEntries);
+            if (section.titleElement.children[1])
+                chainEntries.push(section.titleElement.children[1]);
+
             for (var j = 0; j < chainEntries.length; ++j) {
                 var chainEntry = chainEntries[j];
                 var entryLine = includeSelectorGroupMarks ? buildMarkedSelectors(chainEntry.children[1]) : chainEntry.children[1].textContent;
@@ -488,7 +497,7 @@ InspectorTest.dumpElementsTree = function(rootNode, depth, resultsArray)
         }
     }
 
-    var treeOutline = WebInspector.panels.elements.treeOutline;
+    var treeOutline = InspectorTest.firstElementsTreeOutline();
     treeOutline._updateModifiedNodes();
     print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", depth || 10000);
 };
@@ -508,8 +517,8 @@ InspectorTest.expandElementsTree = function(callback)
 
     function onAllNodesAvailable()
     {
-        WebInspector.panels.elements.treeOutline._updateModifiedNodes();
-        expand(WebInspector.panels.elements.treeOutline);
+        InspectorTest.firstElementsTreeOutline()._updateModifiedNodes();
+        expand(InspectorTest.firstElementsTreeOutline());
         callback();
     }
     WebInspector.inspectorView.showPanel("elements");
@@ -726,16 +735,24 @@ InspectorTest.addNewRule = function(selector, callback)
     InspectorTest.addSniffer(WebInspector.BlankStylePropertiesSection.prototype, "makeNormal", callback);
 }
 
-};
+InspectorTest.dumpInspectorHighlight = function(node, callback)
+{
+    node.boxModel(function(boxModel) {
+        var rectNames = ["margin", "border", "padding", "content"];
+        for (var i = 0; i < rectNames.length; i++) {
+            var rect = boxModel[rectNames[i]];
+            InspectorTest.addResult(rectNames[i] + " rect is " + (rect[4] - rect[0]) + " x " + (rect[5] - rect[1]) + " at (" + rect[0] + ", " + rect[1] + ")");
+        }
+        callback();
+   });
+}
 
-function dumpInspectorHighlightRects()
+InspectorTest.dumpInspectorHighlightShape = function(node, callback)
 {
-    var rectNames = ["margin", "border", "padding", "content"];
-    var rects = window.internals.inspectorHighlightRects(document);
-    for (var i = 0; i < rects.length; i++)
-    {
-        var rectName = (i < rectNames.length ? rectNames[i] : "untitled");
-        var rect = rects.item(i);
-        output(rectName + " rect is " + rect.width + " x " + rect.height + " at (" + rect.left + ", " + rect.top + ")");
-    }
+    node.boxModel(function(shapes) {
+        InspectorTest.addResult(JSON.stringify(shapes.shapeOutside.shape));
+        callback();
+    });
 }
+
+};