Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-2 / pseudo-elements.html
blob3d0e3da34b4d1d4aded2394fb3b5c9b5c9391fc7
1 <html>
2 <head>
3 <style>
4 #inspected:before, .some-other-selector {
5 content: "BEFORE";
8 #inspected:after {
9 content: "AFTER";
11 </style>
12 <style>
13 #empty::before {
14 content: "EmptyBefore";
17 #empty::after {
18 content: "EmptyAfter";
20 </style>
21 <script src="../../../http/tests/inspector/inspector-test.js"></script>
22 <script src="../../../http/tests/inspector/elements-test.js"></script>
23 <script>
25 function removeLastRule()
27 document.styleSheets[0].deleteRule(document.styleSheets[0].cssRules.length - 1);
30 function addAfterRule()
32 document.styleSheets[0].addRule("#inspected:after", "content: \"AFTER\"");
35 function addBeforeRule()
37 document.styleSheets[0].addRule("#inspected:before", "content: \"BEFORE\"");
40 function modifyTextContent()
42 document.getElementById("inspected").textContent = "bar";
45 function clearTextContent()
47 document.getElementById("inspected").textContent = "";
50 function removeNode()
52 document.getElementById("inspected").remove();
55 function test()
57 var containerNode;
58 var inspectedNode;
60 InspectorTest.runTestSuite([
61 function dumpOriginalTree(next)
63 InspectorTest.expandElementsTree(callback);
64 function callback()
66 containerNode = InspectorTest.expandedNodeWithId("container");
67 inspectedNode = InspectorTest.expandedNodeWithId("inspected");
68 InspectorTest.addResult("Original elements tree:");
69 InspectorTest.dumpElementsTree(containerNode);
70 next();
74 function dumpNormalNodeStyles(next)
76 selectNodeAndDumpStyles("inspected", "", next);
79 function dumpBeforeStyles(next)
81 selectNodeAndDumpStyles("inspected", "before", next);
84 function dumpAfterStyles(next)
86 selectNodeAndDumpStyles("inspected", "after", next);
89 function removeAfter(next)
91 executeAndDumpTree("removeLastRule()", WebInspector.DOMModel.Events.NodeRemoved, next);
94 function removeBefore(next)
96 executeAndDumpTree("removeLastRule()", WebInspector.DOMModel.Events.NodeRemoved, next);
99 function addAfter(next)
101 executeAndDumpTree("addAfterRule()", WebInspector.DOMModel.Events.NodeInserted, expandAndDumpTree.bind(this, next));
104 function addBefore(next)
106 executeAndDumpTree("addBeforeRule()", WebInspector.DOMModel.Events.NodeInserted, next);
109 function modifyTextContent(next)
111 executeAndDumpTree("modifyTextContent()", WebInspector.DOMModel.Events.NodeInserted, next);
114 function clearTextContent(next)
116 executeAndDumpTree("clearTextContent()", WebInspector.DOMModel.Events.NodeRemoved, next);
119 function removeNodeAndCheckPseudoElementsUnbound(next)
121 var inspectedBefore = inspectedNode.beforePseudoElement();
122 var inspectedAfter = inspectedNode.afterPseudoElement();
124 executeAndDumpTree("removeNode()", WebInspector.DOMModel.Events.NodeRemoved, callback);
125 function callback()
127 InspectorTest.addResult("inspected:before DOMNode in DOMAgent: " + !!(InspectorTest.domModel.nodeForId(inspectedBefore.id)));
128 InspectorTest.addResult("inspected:after DOMNode in DOMAgent: " + !!(InspectorTest.domModel.nodeForId(inspectedAfter.id)));
129 next();
134 function executeAndDumpTree(pageFunction, eventName, next)
136 InspectorTest.domModel.addEventListener(eventName, domCallback, this);
137 InspectorTest.evaluateInPage(pageFunction);
139 function domCallback()
141 InspectorTest.domModel.removeEventListener(eventName, domCallback, this);
142 InspectorTest.firstElementsTreeOutline().addEventListener(WebInspector.ElementsTreeOutline.Events.ElementsTreeUpdated, treeCallback, this);
145 function treeCallback()
147 InspectorTest.firstElementsTreeOutline().removeEventListener(WebInspector.ElementsTreeOutline.Events.ElementsTreeUpdated, treeCallback, this);
148 InspectorTest.dumpElementsTree(containerNode);
149 next();
153 function expandAndDumpTree(next)
155 InspectorTest.addResult("== Expanding: ==");
156 InspectorTest.expandElementsTree(callback);
157 function callback()
159 InspectorTest.dumpElementsTree(containerNode);
160 next();
164 function selectNodeAndDumpStyles(id, pseudoTypeName, callback)
166 if (pseudoTypeName)
167 InspectorTest.selectPseudoElementAndWaitForStyles("inspected", pseudoTypeName, stylesCallback);
168 else
169 InspectorTest.selectNodeAndWaitForStyles("inspected", stylesCallback);
171 function stylesCallback()
173 InspectorTest.dumpSelectedElementStyles(true, false, false, true);
174 callback();
179 </script>
180 </head>
182 <body onload="runTest()">
184 Tests that pseudo elements and their styles are handled properly.
185 </p>
187 <div id="container">
188 <div id="inspected">Text</div>
189 <div id="empty"></div>
190 </div>
192 </body>
193 </html>