achicu@adobe.com | 0e035b1 | 2013-12-05 23:37:08 +0000 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <style> |
| 5 | #flow |
| 6 | { |
| 7 | -webkit-flow-into: flow; |
| 8 | } |
| 9 | .contentNode1 |
| 10 | { |
| 11 | width: 100%; |
| 12 | height: 50px; |
| 13 | } |
| 14 | .contentNode2 |
| 15 | { |
| 16 | width: 100%; |
| 17 | height: 150px; |
| 18 | } |
| 19 | .region |
| 20 | { |
| 21 | -webkit-flow-from: flow; |
| 22 | width: 100px; |
| 23 | height: 100px; |
| 24 | } |
| 25 | </style> |
commit-queue@webkit.org | 0c88cda | 2015-08-06 21:17:03 +0000 | [diff] [blame] | 26 | <script type="text/javascript" src="../../http/tests/inspector/resources/inspector-test.js"></script> |
achicu@adobe.com | 0e035b1 | 2013-12-05 23:37:08 +0000 | [diff] [blame] | 27 | <script> |
| 28 | function test() |
| 29 | { |
| 30 | var queryList = ["#flow", ".contentNode1", ".contentNode2", "body", "#region1", "#region2"]; |
| 31 | var documentNodeId; |
| 32 | |
achicu@adobe.com | 0e035b1 | 2013-12-05 23:37:08 +0000 | [diff] [blame] | 33 | WebInspector.domTreeManager.requestDocument(function(documentNode) { |
| 34 | documentNodeId = documentNode.id; |
| 35 | WebInspector.domTreeManager.getNamedFlowCollection(documentNodeId); |
| 36 | next(); |
| 37 | }); |
| 38 | |
| 39 | function query(selector, callback) |
| 40 | { |
| 41 | InspectorTest.log("\nSelector: " + selector); |
| 42 | WebInspector.domTreeManager.querySelector(documentNodeId, selector, function(contentNodeId) { |
| 43 | if (!contentNodeId) { |
| 44 | InspectorTest.log("DOM node not found."); |
| 45 | callback(); |
| 46 | } |
| 47 | var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId); |
| 48 | WebInspector.domTreeManager.getNodeContentFlowInfo(domNode, function(error, result) { |
| 49 | console.assert(!error); |
| 50 | if (result) { |
| 51 | InspectorTest.log("Region flow name: " + (result.regionFlow ? result.regionFlow.name : "none")); |
| 52 | InspectorTest.log("Content flow name: " + (result.contentFlow ? result.contentFlow.name : "none")); |
| 53 | InspectorTest.log("Regions count: " + (result.regions ? result.regions.length : "N/A")); |
| 54 | InspectorTest.log("Regions: " + (result.regions ? result.regions.map(WebInspector.displayNameForNode).join(", ") : "N/A")); |
| 55 | } else |
| 56 | InspectorTest.log("No region flow information."); |
| 57 | callback(); |
| 58 | }); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | function next() |
| 63 | { |
| 64 | if (!queryList.length) |
| 65 | return InspectorTest.completeTest(); |
| 66 | query(queryList.shift(), next); |
| 67 | } |
| 68 | } |
| 69 | </script> |
| 70 | </head> |
| 71 | <body onload="runTest()"> |
| 72 | <p>Testing that the DOMTreeManager.getNodeContentFlowInfo returns the containing regions.</p> |
| 73 | |
| 74 | <div id="flow"> |
| 75 | <div class="contentNode1"></div> |
| 76 | <div class="contentNode2"></div> |
| 77 | </div> |
| 78 | |
| 79 | <div id="region1" class="region"></div> |
| 80 | <div id="region2" class="region"></div> |
| 81 | </body> |
| 82 | </html> |