Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: LayoutTests/inspector-protocol/dom/dom-relayout-boundary.html

Issue 23201018: DevTools: add "Jump to Relayout Boundary" context menu item in Elements panel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: renamed output parameters, try run Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/dom/dom-relayout-boundary-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/dom/dom-relayout-boundary.html
diff --git a/LayoutTests/inspector-protocol/dom/dom-relayout-boundary.html b/LayoutTests/inspector-protocol/dom/dom-relayout-boundary.html
new file mode 100644
index 0000000000000000000000000000000000000000..2b36a9943d03bddbe4b5d0dc99b6aac92d7e8511
--- /dev/null
+++ b/LayoutTests/inspector-protocol/dom/dom-relayout-boundary.html
@@ -0,0 +1,137 @@
+<html>
+<head>
+<style>
+.relayout-boundary {
+ width: 200px;
+ height: 40px;
+ overflow: hidden;
+}
+
+</style>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ var nodeByIdAttribute = {};
+ var nodeById = {};
+
+ getDocument();
+
+ function getAttribute(node, attribute)
+ {
+ if (!node.attributes)
+ return;
+ for (var i = 0; i < node.attributes.length; i += 2) {
+ if (node.attributes[i] === attribute)
+ return node.attributes[i + 1];
+ }
+ }
+
+ function nodeLabel(node)
+ {
+ var result = node.localName;
+ var id = getAttribute(node, "id");
+ if (id)
+ result += "#" + id;
+ return result;
+ }
+
+ function addNode(node)
+ {
+ nodeById[node.nodeId] = node;
+ var idAttribute = getAttribute(node, "id");
+ if (idAttribute)
+ nodeByIdAttribute[idAttribute] = node;
+ if (node.children)
+ addNodes(node.children);
+ }
+
+ function addNodes(nodes)
+ {
+ nodes.forEach(addNode);
+ }
+
+ InspectorTest.eventHandler["DOM.setChildNodes"] = function setChildNodes(messageObject)
+ {
+ addNodes(messageObject.params.nodes);
+ };
+
+ function getDocument()
+ {
+ // We must first get the document so that later on we may get sensible nodeIds.
+ step({
+ command: "DOM.getDocument",
+ parameters: {},
+ callback: getAllNodes
+ });
+ };
+
+ function getAllNodes(error, result)
+ {
+ addNode(result.root);
+ step({
+ command: "DOM.requestChildNodes",
+ parameters: {"nodeId": result.root.nodeId, "depth": -1},
+ callback: dumpRelayoutBoundary.bind(this, 0)
+ });
+ };
+
+ var nodeIdsToTest = [
+ "outer",
+ "boundary",
+ "inner",
+ "hidden"
+ ];
+
+ function dumpRelayoutBoundary(nextId)
+ {
+ if (nextId >= nodeIdsToTest.length) {
+ InspectorTest.completeTest();
+ return;
+ }
+ var node = nodeByIdAttribute[nodeIdsToTest[nextId]];
+ function dumpResultsAndContinue(error, result)
+ {
+ var text;
+ if (error) {
+ text = error;
+ } else {
+ var boundaryNode = nodeById[result.nodeId];
+ text = boundaryNode ? nodeLabel(boundaryNode) : "null";
+ }
+ InspectorTest.log("Relayout boundary for " + nodeLabel(node) + " is: " + text);
+ dumpRelayoutBoundary(nextId + 1);
+ }
+ step({
+ command: "DOM.getRelayoutBoundary",
+ parameters: {"nodeId": node.nodeId},
+ callback: dumpResultsAndContinue
+ });
+ }
+
+ function step(test)
+ {
+ InspectorTest.sendCommand(test.command, test.parameters, function(messageObject) {
+ if (test.callback)
+ test.callback(messageObject.error && messageObject.error.message, messageObject.result);
+ });
+ };
+ setTimeout(InspectorTest.completeTest.bind(InspectorTest), 3400);
+};
+
+window.addEventListener("DOMContentLoaded", function () {
+ runTest();
+}, false);
+</script>
+</head>
+<body>
+<div id="outer"></div>
+<div class="relayout-boundary" id="boundary">
+ <div id="inner"></div>
+ <div style="display: none">
+ <div id="hidden"></div>
+ </div>
+</div>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/dom/dom-relayout-boundary-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698