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

Unified Diff: third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed repaint tests. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html b/third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html
new file mode 100644
index 0000000000000000000000000000000000000000..bc2ddd44a908488454a8fc1c60e4a6fe4e45dfc8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html
@@ -0,0 +1,279 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<html>
+ <body>
+ <div id="host">
+ <div id="slotted" slot="s1"></div>
+ </div>
+<script src="resources/alignment-parsing-utils.js"></script>
+<script>
+description('Test to verify auto value resolution works as expected in root elements (eg. document root / shadow roots / slotted elements / elements inside<slot>)');
+
+var block = document.getElementById("host");
+
+debug("");
+debug("*** Test 'auto' value resolution for the document root node. ***");
+
+debug("");
+debug("Check out how the DOM's root element resolves the align-self 'auto' values.");
+document.documentElement.style.alignSelf = "center";
+checkValues(document.documentElement, "alignSelf", "align-self", "center", "center");
+document.documentElement.style.alignSelf = "auto";
+checkValues(document.documentElement, "alignSelf", "align-self", "auto", "normal");
+
+debug("");
+debug("Check out how the DOM's root element align-items's value is used to resolve its children's align-self 'auto' values.");
+document.documentElement.style.alignItems = "center";
+checkValues(document.documentElement, "alignItems", "align-items", "center", "center");
+document.body.style.alignItems = "auto"; // The 'auto' value is not valid for align-items.
+document.body.style.alignSelf = "auto";
+checkValues(document.body, "alignItems", "align-items", "", "normal");
+checkValues(document.body, "alignSelf", "align-self", "auto", "center");
+block.style.alignItems = ""; // Default value is 'normal' for align-items.
+block.style.alignSelf = "auto";
+checkValues(block, "alignItems", "align-items", "", "normal");
+checkValues(block, "alignSelf", "align-self", "auto", "normal");
+
+debug("");
+debug("Check out how the DOM's root element deals with 'auto' value in align-items.");
+document.documentElement.style.alignItems = "auto"; // The 'auto' value is not valid for align-items.
+checkValues(document.documentElement, "alignItems", "align-items", "center", "center");
+document.documentElement.style.alignItems = ""; // Default value is 'normal' for align-items.
+checkValues(document.documentElement, "alignItems", "align-items", "", "normal");
+
+debug("");
+debug("Check out how the DOM's root element resolves the justify-self 'auto' values.");
+document.documentElement.style.justifySelf = "left";
+checkValues(document.documentElement, "justifySelf", "justify-self", "left", "left");
+document.documentElement.style.justifySelf = "auto";
+checkValues(document.documentElement, "justifySelf", "justify-self", "auto", "normal");
+
+debug("");
+debug("Check out how the DOM's root element align-items's value is used to resolve its children's align-self 'auto' values.");
+document.documentElement.style.justifyItems = "center";
+checkValues(document.documentElement, "justifyItems", "justify-items", "center", "center");
+document.body.style.justifyItems = "auto";
+document.body.style.justifySelf = "auto";
+checkValues(document.body, "justifyItems", "justify-items", "auto", "normal");
+checkValues(document.body, "justifySelf", "justify-self", "auto", "center");
+block.style.justifyItems = "auto";
+block.style.justifySelf = "auto";
+checkValues(block, "justifyItems", "justify-items", "auto", "normal");
+checkValues(block, "justifySelf", "justify-self", "auto", "normal");
+
+debug("");
+debug("Check out how the DOM's root element deals with 'auto' value in justify-items.");
+document.documentElement.style.justifyItems = "auto";
+checkValues(document.documentElement, "justifyItems", "justify-items", "auto", "normal");
+checkValues(document.body, "justifySelf", "justify-self", "auto", "normal");
+checkValues(block, "justifySelf", "justify-self", "auto", "normal");
+
+debug("");
+debug("Check out how the DOM's root element justify-items's value with 'legacy' keyword is used to resolve any descendant's justify-items 'auto' values.");
+document.documentElement.style.justifyItems = "legacy center";
+checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
+document.body.style.justifyItems = "auto";
+document.body.style.justifySelf = "auto";
+checkValues(document.body, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(document.body, "justifySelf", "justify-self", "auto", "center");
+block.style.justifyItems = "auto";
+block.style.justifySelf = "auto";
+checkValues(block, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(block, "justifySelf", "justify-self", "auto", "center");
+
+debug("");
+debug("Check out how the DOM's root element recomputes its descendant's style when 'legacy' keyword is removed from its justify-items value.");
+document.documentElement.style.justifyItems = "auto";
+checkValues(document.body, "justifyItems", "justify-items", "auto", "normal");
+checkValues(document.body, "justifySelf", "justify-self", "auto", "normal");
+checkValues(block, "justifyItems", "justify-items", "auto", "normal");
+checkValues(block, "justifySelf", "justify-self", "auto", "normal");
+
+debug("");
+debug("*** Test 'auto' value resolution for the shadow DOM root node. ***");
+
+var shadowHost = document.getElementById("host")
+var shadowRoot = shadowHost.attachShadow({mode:"open"});
+var shadowNode = document.createElement('div');
+shadowRoot.appendChild(shadowNode);
+
+debug("");
+debug("Shadow Node inherits from ShadowHost to resolve the 'auto' values.");
+
+shadowHost.style.alignItems = "center";
+shadowNode.style.alignItems = "right";
+
+checkValues(shadowHost, "alignItems", "align-items", "center", "center");
+checkValues(shadowNode, "alignItems", "align-items", "right", "right");
+shadowNode.style.alignItems = "";
+checkValues(shadowNode, "alignItems", "align-items", "", "normal");
+shadowNode.style.alignSelf = "auto";
+checkValues(shadowNode, "alignSelf", "align-self", "auto", "center");
+
+shadowHost.style.justifyItems = "center";
+shadowNode.style.justifyItems = "right";
+
+checkValues(shadowHost, "justifyItems", "justify-items", "center", "center");
+checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
+shadowNode.style.justifyItems = "";
+checkValues(shadowNode, "justifyItems", "justify-items", "", "normal");
+shadowNode.style.justifySelf = "auto";
+checkValues(shadowNode, "justifySelf", "justify-self", "auto", "center");
+
+debug("");
+debug("Check out how the 'legacy' keyword from propagates from the DOM Tree to the Shadow Node.");
+
+shadowHost.style.justifyItems = "auto";
+shadowNode.style.justifyItems = "right";
+shadowNode.style.justifySelf = "auto";
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
+checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
+checkValues(shadowNode, "justifySelf", "justify-self", "auto", "normal");
+
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
+document.documentElement.style.justifyItems = "legacy center";
+checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
+checkValues(shadowNode, "justifySelf", "justify-self", "auto", "center");
+shadowNode.style.justifyItems = "auto";
+checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center");
+document.documentElement.style.justifyItems = "auto";
+
+debug("");
+debug("*** Test 'auto' value resolution for the shadow DOM 'slotted' elements. ***");
+
+var slotted = document.getElementById("slotted");
+
+debug("");
+debug("The 'slotted' element's parent is 'shadowHost' while 'slot' is not assigned.")
+
+shadowHost.style.alignItems = "center";
+shadowNode.style.alignItems = "right";
+
+slotted.style.alignItems = "left";
+checkValues(slotted, "alignItems", "align-items", "left", "left");
+slotted.style.alignItems = "";
+checkValues(slotted, "alignItems", "align-items", "", "normal");
+slotted.style.alignSelf = "start";
+checkValues(slotted, "alignSelf", "align-self", "start", "start");
+slotted.style.alignSelf = "auto";
+checkValues(slotted, "alignSelf", "align-self", "auto", "center");
+
+shadowHost.style.justifyItems = "center";
+shadowNode.style.justifyItems = "right";
+
+slotted.style.justifyItems = "left";
+checkValues(slotted, "justifyItems", "justify-items", "left", "left");
+slotted.style.justifyItems = "";
+checkValues(slotted, "justifyItems", "justify-items", "", "normal");
+slotted.style.justifySelf = "start";
+checkValues(slotted, "justifySelf", "justify-self", "start", "start");
+slotted.style.justifySelf = "auto";
+checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
+
+debug("");
+debug("Check out how the 'legacy' keyword affects the 'slotted' elements while 'slot' is not assigned.");
+
+shadowHost.style.justifyItems = "auto";
+shadowNode.style.justifyItems = "right";
+
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
+checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
+document.documentElement.style.justifyItems = "legacy center";
+checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center");
+slotted.style.justifyItems = "auto";
+checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center");
+slotted.style.justifySelf = "auto";
+checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
+shadowNode.style.justifyItems = "auto";
+checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
+document.documentElement.style.justifyItems = "auto";
+
+var slot = document.createElement('slot');
+slot.setAttribute('name', 's1');
+shadowNode.appendChild(slot);
+
+debug("");
+debug("The 'slotted' element uses the 'slot' element's parent (Shadow Node) after the 'slot' is assigned.");
+
+shadowHost.style.alignItems = "center";
+shadowNode.style.alignItems = "right";
+
+slotted.style.alignItems = "left";
+checkValues(slotted, "alignItems", "align-items", "left", "left");
+slotted.style.alignItems = "";
+checkValues(slotted, "alignItems", "align-items", "", "normal");
+slotted.style.alignSelf = "start";
+checkValues(slotted, "alignSelf", "align-self", "start", "start");
+slotted.style.alignSelf = "auto";
+checkValues(slotted, "alignSelf", "align-self", "auto", "right");
+
+shadowHost.style.justifyItems = "center";
+shadowNode.style.justifyItems = "right";
+
+slotted.style.justifyItems = "left";
+checkValues(slotted, "justifyItems", "justify-items", "left", "left");
+slotted.style.justifyItems = "";
+checkValues(slotted, "justifyItems", "justify-items", "", "normal");
+slotted.style.justifySelf = "start";
+checkValues(slotted, "justifySelf", "justify-self", "start", "start");
+slotted.style.justifySelf = "auto";
+checkValues(slotted, "justifySelf", "justify-self", "auto", "right");
+
+debug("");
+debug("Check out how the 'legacy' keyword affects the 'slotted' elements after the 'slot' is assigned.");
+
+shadowHost.style.justifyItems = "auto";
+shadowNode.style.justifyItems = "right";
+
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
+checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
+document.documentElement.style.justifyItems = "legacy center";
+checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
+checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center");
+slotted.style.justifyItems = "auto";
+checkValues(slotted, "justifyItems", "justify-items", "auto", "normal"); // Shadow host is not the parent now, but ShadowNode.
+slotted.style.justifySelf = "auto";
+checkValues(slotted, "justifySelf", "justify-self", "auto", "right"); // Shadow host is not the parent now, but ShadowNode.
+shadowNode.style.justifyItems = "auto";
+checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center");
+checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center"); // Now that shadowNode is auto, 'legacy' applies.
+checkValues(slotted, "justifySelf", "justify-self", "auto", "center"); // Now that shadowNode is auto, 'legacy' applies.
+document.documentElement.style.justifyItems = "auto";
+
+debug("");
+debug("The 'slot' element uses its parent inside the ShadowDOM tree to resolve the 'auto' values .");
+
+shadowHost.style.alignItems = "center";
+shadowNode.style.alignItems = "right";
+
+slot.style.alignItems = "left";
+checkValues(slot, "alignItems", "align-items", "left", "left");
+slot.style.alignItems = "";
+checkValues(slot, "alignItems", "align-items", "", "normal");
+
+slot.style.alignSelf = "left";
+checkValues(slot, "alignSelf", "align-self", "left", "left");
+slot.style.alignSelf = "auto";
+checkValues(slot, "alignSelf", "align-self", "auto", "right");
+
+shadowHost.style.justifyItems = "center";
+shadowNode.style.justifyItems = "right";
+
+slot.style.justifyItems = "left";
+checkValues(slot, "justifyItems", "justify-items", "left", "left");
+slot.style.justifyItems = "auto";
+checkValues(slot, "justifyItems", "justify-items", "auto", "normal");
+slot.style.justifySelf = "left";
+checkValues(slot, "justifySelf", "justify-self", "left", "left");
+slot.style.justifySelf = "auto";
+checkValues(slot, "justifySelf", "justify-self", "auto", "right");
+
+</script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698