Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: LayoutTests/inspector-protocol/css/css-visited-link-matched-styles.html

Issue 311123002: Revert "DevTools: matched styles respect :visited/:link pseudo classes" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script type="text/javascript" src="css-protocol-test.js"></script>
5 <script type="text/javascript">
6 function test()
7 {
8 var nodeInfo = {};
9 InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
10 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled);
11
12 function onCSSEnabled()
13 {
14 InspectorTest.requestNodeId("#redlink", onNodeReceived);
15 }
16
17 function onNodeReceived(nodeId)
18 {
19 dumpVisitedAndLinkRules(nodeId, onLinkDumped);
20 }
21
22 function onLinkDumped()
23 {
24 InspectorTest.requestNodeId("#shadow-host", onShadowHost);
25 }
26
27 function onShadowHost(nodeId)
28 {
29 var node = nodeInfo[nodeId];
30 if (!node) {
31 InspectorTest.log("ERROR: didn't get node from backend");
32 InspectorTest.completeTest();
33 return;
34 }
35 var shadowRoots = node.shadowRoots || [];
36 if (shadowRoots.length !== 1) {
37 InspectorTest.log("ERROR: shadow host doesn't have any shadow roots" );
38 InspectorTest.completeTest();
39 return;
40 }
41 var shadowRoot = shadowRoots[0];
42 InspectorTest.sendCommandOrDie("DOM.querySelector", {
43 nodeId: shadowRoot.nodeId,
44 selector: ".shadow-link"
45 }, onShadowAnchor);
46 }
47
48 function onShadowAnchor(result)
49 {
50 dumpVisitedAndLinkRules(result.nodeId, InspectorTest.completeTest.bind(I nspectorTest));
51 }
52
53 function setChildNodes(message)
54 {
55 var nodes = message.params.nodes;
56 for (var i = 0; i < nodes.length; ++i) {
57 nodeInfo[nodes[i].nodeId] = nodes[i];
58 delete nodes[i].nodeId;
59 }
60 }
61
62 function dumpVisitedAndLinkRules(nodeId, callback)
63 {
64 InspectorTest.log("==== Styles for unvisited link ====");
65 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, onUnvisitedLinkDum ped);
66 function onUnvisitedLinkDumped()
67 {
68 InspectorTest.sendCommandOrDie("CSS.forcePseudoState", {
69 nodeId: nodeId,
70 forcedPseudoClasses: [ "visited" ]
71 }, onVisitedForced);
72 }
73
74 function onVisitedForced()
75 {
76 InspectorTest.log("==== Styles for visited link ====");
77 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback);
78 }
79 }
80
81 }
82 </script>
83 <style>
84 #redlink:visited {
85 color: red;
86 }
87 #redlink:link {
88 color: blue;
89 }
90
91 #redlink {
92 color: gray;
93 }
94 </style>
95 <template id="shadow">
96 <style>
97 .shadow-link:visited {
98 color: blue;
99 }
100 .shadow-link:link {
101 color: green;
102 }
103 .shadow-link {
104 color: lightgray;
105 }
106 </style>
107 <a class="shadow-link" href="definitely-unvisited-shadow-link-2232">This is shad ow link</a>
108 </template>
109 </head>
110 <body>
111 <a id="redlink" href="definitely-unvisited-link-address-1989-42.html">This i s visited link</a>
112 <div id="shadow-host"></div>
113 <script>
114 var host = document.querySelector("#shadow-host").createShadowRoot();
115 var template = document.querySelector("#shadow");
116 host.appendChild(template.content);
117 template.remove();
118 runTest();
119 </script>
120 </body>
121 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698