| OLD | NEW |
| 1 function initialize_LayerTreeTests() | 1 function initialize_LayerTreeTests() |
| 2 { | 2 { |
| 3 InspectorTest.layerTreeModel = function() | 3 InspectorTest.layerTreeModel = function() |
| 4 { | 4 { |
| 5 if (!InspectorTest._layerTreeModel) | 5 if (!InspectorTest._layerTreeModel) |
| 6 InspectorTest._layerTreeModel = WebInspector.LayerTreeModel.fromTarg
et(InspectorTest.mainTarget); | 6 InspectorTest._layerTreeModel = Layers.LayerTreeModel.fromTarget(Ins
pectorTest.mainTarget); |
| 7 return InspectorTest._layerTreeModel; | 7 return InspectorTest._layerTreeModel; |
| 8 } | 8 } |
| 9 | 9 |
| 10 InspectorTest.labelForLayer = function(layer) | 10 InspectorTest.labelForLayer = function(layer) |
| 11 { | 11 { |
| 12 var node = layer.nodeForSelfOrAncestor(); | 12 var node = layer.nodeForSelfOrAncestor(); |
| 13 var label = node ? WebInspector.DOMPresentationUtils.fullQualifiedSelect
or(node, false) : "<invalid node id>"; | 13 var label = node ? Components.DOMPresentationUtils.fullQualifiedSelector
(node, false) : "<invalid node id>"; |
| 14 var height = layer.height(); | 14 var height = layer.height(); |
| 15 var width = layer.width(); | 15 var width = layer.width(); |
| 16 if (height <= 200 && width <= 200) | 16 if (height <= 200 && width <= 200) |
| 17 label += " " + height + "x" + width; | 17 label += " " + height + "x" + width; |
| 18 if (typeof layer.__extraData !== "undefined") | 18 if (typeof layer.__extraData !== "undefined") |
| 19 label += " (" + layer.__extraData + ")"; | 19 label += " (" + layer.__extraData + ")"; |
| 20 return label; | 20 return label; |
| 21 } | 21 } |
| 22 | 22 |
| 23 InspectorTest.dumpLayerTree = function(prefix, root) | 23 InspectorTest.dumpLayerTree = function(prefix, root) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 InspectorTest.addResult(prefix + InspectorTest.labelForLayer(root)); | 35 InspectorTest.addResult(prefix + InspectorTest.labelForLayer(root)); |
| 36 root.children().forEach(InspectorTest.dumpLayerTree.bind(InspectorTest,
prefix + " ")); | 36 root.children().forEach(InspectorTest.dumpLayerTree.bind(InspectorTest,
prefix + " ")); |
| 37 } | 37 } |
| 38 | 38 |
| 39 InspectorTest.dumpLayers3DView = function(prefix, root) | 39 InspectorTest.dumpLayers3DView = function(prefix, root) |
| 40 { | 40 { |
| 41 if (!prefix) | 41 if (!prefix) |
| 42 prefix = ""; | 42 prefix = ""; |
| 43 if (!root) | 43 if (!root) |
| 44 root = WebInspector.panels.layers._layers3DView._rotatingContainerEl
ement; | 44 root = UI.panels.layers._layers3DView._rotatingContainerElement; |
| 45 if (root.__layer) | 45 if (root.__layer) |
| 46 InspectorTest.addResult(prefix + InspectorTest.labelForLayer(root.__
layer)); | 46 InspectorTest.addResult(prefix + InspectorTest.labelForLayer(root.__
layer)); |
| 47 for (var element = root.firstElementChild; element; element = element.ne
xtSibling) | 47 for (var element = root.firstElementChild; element; element = element.ne
xtSibling) |
| 48 InspectorTest.dumpLayers3DView(prefix + " ", element); | 48 InspectorTest.dumpLayers3DView(prefix + " ", element); |
| 49 } | 49 } |
| 50 | 50 |
| 51 InspectorTest.evaluateAndRunWhenTreeChanges = function(expression, callback) | 51 InspectorTest.evaluateAndRunWhenTreeChanges = function(expression, callback) |
| 52 { | 52 { |
| 53 function eventHandler() | 53 function eventHandler() |
| 54 { | 54 { |
| 55 InspectorTest.layerTreeModel().removeEventListener(WebInspector.Laye
rTreeModel.Events.LayerTreeChanged, eventHandler); | 55 InspectorTest.layerTreeModel().removeEventListener(Layers.LayerTreeM
odel.Events.LayerTreeChanged, eventHandler); |
| 56 callback(); | 56 callback(); |
| 57 } | 57 } |
| 58 InspectorTest.evaluateInPage(expression, function() { | 58 InspectorTest.evaluateInPage(expression, function() { |
| 59 InspectorTest.layerTreeModel().addEventListener(WebInspector.LayerTr
eeModel.Events.LayerTreeChanged, eventHandler); | 59 InspectorTest.layerTreeModel().addEventListener(Layers.LayerTreeMode
l.Events.LayerTreeChanged, eventHandler); |
| 60 }); | 60 }); |
| 61 } | 61 } |
| 62 | 62 |
| 63 InspectorTest.findLayerByNodeIdAttribute = function(nodeIdAttribute) | 63 InspectorTest.findLayerByNodeIdAttribute = function(nodeIdAttribute) |
| 64 { | 64 { |
| 65 var result; | 65 var result; |
| 66 function testLayer(layer) | 66 function testLayer(layer) |
| 67 { | 67 { |
| 68 var node = layer.node(); | 68 var node = layer.node(); |
| 69 if (!node) | 69 if (!node) |
| 70 return false; | 70 return false; |
| 71 if (!node || node.getAttribute("id") !== nodeIdAttribute) | 71 if (!node || node.getAttribute("id") !== nodeIdAttribute) |
| 72 return false; | 72 return false; |
| 73 result = layer; | 73 result = layer; |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 InspectorTest.layerTreeModel().layerTree().forEachLayer(testLayer); | 76 InspectorTest.layerTreeModel().layerTree().forEachLayer(testLayer); |
| 77 if (!result) | 77 if (!result) |
| 78 InspectorTest.addResult("ERROR: No layer for " + nodeIdAttribute); | 78 InspectorTest.addResult("ERROR: No layer for " + nodeIdAttribute); |
| 79 return result; | 79 return result; |
| 80 } | 80 } |
| 81 | 81 |
| 82 InspectorTest.requestLayers = function(callback) | 82 InspectorTest.requestLayers = function(callback) |
| 83 { | 83 { |
| 84 InspectorTest.layerTreeModel().addEventListener(WebInspector.LayerTreeMo
del.Events.LayerTreeChanged, onLayerTreeChanged); | 84 InspectorTest.layerTreeModel().addEventListener(Layers.LayerTreeModel.Ev
ents.LayerTreeChanged, onLayerTreeChanged); |
| 85 InspectorTest.layerTreeModel().enable(); | 85 InspectorTest.layerTreeModel().enable(); |
| 86 function onLayerTreeChanged() | 86 function onLayerTreeChanged() |
| 87 { | 87 { |
| 88 InspectorTest.layerTreeModel().removeEventListener(WebInspector.Laye
rTreeModel.Events.LayerTreeChanged, onLayerTreeChanged); | 88 InspectorTest.layerTreeModel().removeEventListener(Layers.LayerTreeM
odel.Events.LayerTreeChanged, onLayerTreeChanged); |
| 89 callback(); | 89 callback(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 InspectorTest.dumpModelScrollRects = function() | 93 InspectorTest.dumpModelScrollRects = function() |
| 94 { | 94 { |
| 95 function dumpScrollRectsForLayer(layer) | 95 function dumpScrollRectsForLayer(layer) |
| 96 { | 96 { |
| 97 if (layer._scrollRects.length > 0) | 97 if (layer._scrollRects.length > 0) |
| 98 InspectorTest.addObject(layer._scrollRects); | 98 InspectorTest.addObject(layer._scrollRects); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 117 }; | 117 }; |
| 118 if (eventType === "mouseout") { | 118 if (eventType === "mouseout") { |
| 119 eventArguments.screenX = 0; | 119 eventArguments.screenX = 0; |
| 120 eventArguments.screenY = 0; | 120 eventArguments.screenY = 0; |
| 121 eventArguments.clientX = 0; | 121 eventArguments.clientX = 0; |
| 122 eventArguments.clientY = 0; | 122 eventArguments.clientY = 0; |
| 123 } | 123 } |
| 124 element.dispatchEvent(new MouseEvent(eventType, eventArguments)); | 124 element.dispatchEvent(new MouseEvent(eventType, eventArguments)); |
| 125 } | 125 } |
| 126 } | 126 } |
| OLD | NEW |