Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / selectors / style-sharing-children-prevent-sharing.html
blobf5cf93b39f479fdc9d44e9381ff43a0d2b64f363
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <style>
4 .root + #lastChildRules {
5 color: red;
7 </style>
9 <div id="y" class="root">
10 <div></div>
11 </div>
13 <div id="x" class="root">
14 <div></div>
15 </div>
17 <script>
18 description("Test dynamic changes to the childrenSupportStyleSharing flag.");
20 var x = document.getElementById("x");
21 var y = document.getElementById("y");
23 // Attach the whole tree, this makes x and y share, and the children of x and y share.
24 document.body.offsetTop;
26 // Add a child that make us match sibling rules. This will set the ChildrenAffectedByDirectAdjacentRules
27 // flag on #x preventing its children from sharing in the future.
28 var lastChildRules = x.appendChild(document.createElement("div"));
29 lastChildRules.id = "lastChildRules";
30 x.appendChild(document.createElement("div"));
32 // Add a new child to #y. Normally it could share with children of #x since both #x and #y share,
33 // but now #x has children affected by RestyleFlags so they can no longer share.
34 // FIXME: This element could technically share with the other <div> inside #y, but recalcStyle
35 // goes from lastChild -> firstChild so we haven't added the firstChild (which doesn't need a recalc)
36 // to the candidate list yet.
37 y.appendChild(document.createElement("div"));
39 document.body.offsetTop;
41 if (window.internals) {
42 shouldBeTrue("internals.isSharingStyle(x, y)");
43 shouldBeTrue("internals.isSharingStyle(x.firstElementChild, y.firstElementChild)");
44 shouldBeFalse("internals.isSharingStyle(x.firstElementChild, y.firstElementChild.nextElementSibling)");
45 shouldBeFalse("internals.isSharingStyle(lastChildRules, x.firstElementChild)");
46 shouldBeFalse("internals.isSharingStyle(lastChildRules, y.firstElementChild)");
48 // FIXME: We should see if we can look at direct siblings somehow since these elements do
49 // match the same rules at the same depth, recalcStyle is just in the wrong order to allow
50 // them to share.
51 shouldBeFalse("internals.isSharingStyle(y.firstElementChild, y.firstElementChild.nextElementSibling)");
53 </script>