| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../resources/alignment-parsing-utils-th.js"></script> |
| <html> |
| <body> |
| <p>Test to verify that the new alignment values are parsed as invalid if Grid Layout is disabled and in any case they do not cause a crash because assertions in flexbox layout code.</p> |
| <div id="log"></div> |
| |
| <div id="flexContainer" style="display: flex"> |
| <div id="flexItem"></div> |
| </div> |
| <script> |
| |
| var container = document.getElementById("flexContainer"); |
| var item = document.getElementById("flexItem"); |
| |
| function checkAlignSelfValue(value, computedValue, gridEnabled) |
| { |
| item.style.webkitAlignSelf = value; |
| if (gridEnabled) |
| checkValues(item, "alignSelf", "align-self", value, computedValue); |
| else |
| checkValues(item, "alignSelf", "align-self", "flex-start", "flex-start"); |
| } |
| |
| function checkAlignItemsValue(value, computedValue, gridEnabled) |
| { |
| container.style.webkitAlignItems = value; |
| if (gridEnabled) { |
| checkValues(container, "alignItems", "align-items", value, computedValue); |
| checkValues(item, "alignSelf", "align-self", "auto", "auto"); |
| } else { |
| checkValues(container, "alignItems", "align-items", "flex-end", "flex-end"); |
| checkValues(item, "alignSelf", "align-self", "auto", "auto"); |
| } |
| } |
| |
| function checkSelfAlignmentValues(gridEnabled) |
| { |
| if (window.internals) |
| internals.settings.setCSSGridLayoutEnabled(gridEnabled) |
| |
| item.style.webkitAlignSelf = "flex-start"; |
| |
| checkAlignSelfValue("start unsafe", "start unsafe", gridEnabled) |
| checkAlignSelfValue("start", "start", gridEnabled) |
| checkAlignSelfValue("end", "end", gridEnabled) |
| checkAlignSelfValue("flex-start safe", "flex-start safe", gridEnabled) |
| checkAlignSelfValue("self-start", "self-start", gridEnabled) |
| checkAlignSelfValue("self-end", "self-end", gridEnabled) |
| } |
| |
| function checkDefaultAlignmentValues(gridEnabled) |
| { |
| if (window.internals) |
| internals.settings.setCSSGridLayoutEnabled(gridEnabled) |
| |
| container.style.webkitAlignItems = "flex-end"; |
| item.style.webkitAlignSelf = "auto"; |
| |
| checkAlignItemsValue("start unsafe", "start unsafe", gridEnabled) |
| checkAlignItemsValue("start", "start", gridEnabled) |
| checkAlignItemsValue("end", "end", gridEnabled) |
| checkAlignItemsValue("flex-start safe", "flex-start safe", gridEnabled) |
| checkAlignItemsValue("self-start", "self-start", gridEnabled) |
| checkAlignItemsValue("self-end", "self-end", gridEnabled) |
| } |
| |
| test(function() { |
| checkSelfAlignmentValues(false); |
| }, "New Self-Alignment values should be invalid when grid layout is DISABLED."); |
| |
| test(function() { |
| checkDefaultAlignmentValues(false); |
| }, "New Default-Alignment values should be invalid when grid layout is DISABLED."); |
| |
| test(function() { |
| checkSelfAlignmentValues(true); |
| }, "Even when grid layout is ENABLED, new Self-Alignment values should not violate assertions in FlexibleBox layout logic.."); |
| |
| test(function() { |
| checkDefaultAlignmentValues(true); |
| }, "Even when grid layout is ENABLED, new Default-Alignment values should not violate assertions in FlexibleBox layout logic.."); |
| |
| </script> |
| |
| </body> |
| </html> |