6 transform: translateZ(
10px);
10 background-color: #eee;
14 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
15 <script src=
"../../http/tests/inspector/layers-test.js"></script>
17 function initialize_LayersPanelnMouseEvents()
20 InspectorTest
.findLayerTreeElement = function(layer
)
22 var layerTree
= WebInspector
.panels
.layers
._layerTreeOutline
._treeOutline
;
23 var element
= layer
[WebInspector
.LayerTreeElement
._symbol
];
25 return element
.listItemElement
;
28 InspectorTest
.dispatchMouseEventToLayerTree = function(eventType
, button
, layer
)
30 var element
= InspectorTest
.findLayerTreeElement(layer
);
31 InspectorTest
.assertTrue(!!element
);
32 InspectorTest
.dispatchMouseEvent(eventType
, button
, element
, element
.clientWidth
>> 1, element
.clientHeight
>> 1);
35 InspectorTest
.dumpSelectedStyles = function(message
, element
)
38 if (element
.classList
.contains("selected"))
39 classes
.push("selected");
40 if (element
.classList
.contains("hovered"))
41 classes
.push("hovered");
43 InspectorTest
.addResult(message
+ ": " + classes
.join(", "));
52 var layerB1
= InspectorTest
.findLayerByNodeIdAttribute("b1");
53 var treeElementB1
= InspectorTest
.findLayerTreeElement(layerB1
);
55 var layerB3
= InspectorTest
.findLayerByNodeIdAttribute("b3");
56 var treeElementB3
= InspectorTest
.findLayerTreeElement(layerB3
);
58 function dumpElementSelectionState()
60 InspectorTest
.dumpSelectedStyles("Layer b1 in tree", treeElementB1
);
61 InspectorTest
.dumpSelectedStyles("Layer b3 in tree", treeElementB3
);
63 InspectorTest
.addResult("Hovering b1 in tree");
64 InspectorTest
.dispatchMouseEventToLayerTree("mousemove", -1, layerB1
);
65 dumpElementSelectionState();
67 InspectorTest
.addResult("Hovering b3 in tree");
68 InspectorTest
.dispatchMouseEventToLayerTree("mousemove", -1, layerB3
);
69 dumpElementSelectionState();
71 InspectorTest
.addResult("Hovering away from tree");
72 InspectorTest
.dispatchMouseEventToLayerTree("mouseout", -1, layerB3
);
73 dumpElementSelectionState();
75 InspectorTest
.addResult("Selecting b1 in tree");
76 InspectorTest
.dispatchMouseEventToLayerTree("mousedown", 0, layerB1
);
77 dumpElementSelectionState();
79 InspectorTest
.addResult("Selecting b3 in tree");
80 InspectorTest
.dispatchMouseEventToLayerTree("mousedown", 0, layerB3
);
81 dumpElementSelectionState();
83 InspectorTest
.completeTest();
85 InspectorTest
.requestLayers(InspectorTest
.safeWrap(step1
));
89 <body onload=
"runTest()">
90 <div id=
"a" style=
"width: 200px; height: 200px" class=
"layer">
91 <div class=
"layer" id=
"b1" style=
"width: 150px; height: 100px"></div>
92 <div id=
"b2" class=
"layer" style=
"width: 140px; height: 110px">
93 <div id=
"b3" class=
"layer" style=
"width: 140px; height: 110px;"></div>
94 <div id=
"c" class=
"layer" style=
"width: 100px; height: 90px"></div>