11 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
12 <script type=
"text/javascript">
16 var nodeByIdAttribute
= {};
21 function getAttribute(node
, attribute
)
25 for (var i
= 0; i
< node
.attributes
.length
; i
+= 2) {
26 if (node
.attributes
[i
] === attribute
)
27 return node
.attributes
[i
+ 1];
31 function nodeLabel(node
)
33 var result
= node
.localName
;
34 var id
= getAttribute(node
, "id");
40 function addNode(node
)
42 nodeById
[node
.nodeId
] = node
;
43 var idAttribute
= getAttribute(node
, "id");
45 nodeByIdAttribute
[idAttribute
] = node
;
47 addNodes(node
.children
);
50 function addNodes(nodes
)
52 nodes
.forEach(addNode
);
55 InspectorTest
.eventHandler
["DOM.setChildNodes"] = function setChildNodes(messageObject
)
57 addNodes(messageObject
.params
.nodes
);
60 function getDocument()
62 // We must first get the document so that later on we may get sensible nodeIds.
64 command
: "DOM.getDocument",
70 function getAllNodes(error
, result
)
74 command
: "DOM.requestChildNodes",
75 parameters
: {"nodeId": result
.root
.nodeId
, "depth": -1},
76 callback
: dumpRelayoutBoundary
.bind(this, 0)
87 function dumpRelayoutBoundary(nextId
)
89 if (nextId
>= nodeIdsToTest
.length
) {
90 InspectorTest
.completeTest();
93 var node
= nodeByIdAttribute
[nodeIdsToTest
[nextId
]];
94 function dumpResultsAndContinue(error
, result
)
100 var boundaryNode
= nodeById
[result
.nodeId
];
101 text
= boundaryNode
? nodeLabel(boundaryNode
) : "null";
103 InspectorTest
.log("Relayout boundary for " + nodeLabel(node
) + " is: " + text
);
104 dumpRelayoutBoundary(nextId
+ 1);
107 command
: "DOM.getRelayoutBoundary",
108 parameters
: {"nodeId": node
.nodeId
},
109 callback
: dumpResultsAndContinue
115 InspectorTest
.sendCommand(test
.command
, test
.parameters
, function(messageObject
) {
117 test
.callback(messageObject
.error
&& messageObject
.error
.message
, messageObject
.result
);
120 setTimeout(InspectorTest
.completeTest
.bind(InspectorTest
), 3400);
123 window
.addEventListener("DOMContentLoaded", function () {
129 <div id=
"outer"></div>
130 <div class=
"relayout-boundary" id=
"boundary">
131 <div id=
"inner"></div>
132 <div style=
"display: none">
133 <div id=
"hidden"></div>