OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <script> | 3 <script> |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1); | 5 testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1); |
6 </script> | 6 </script> |
7 <link href="resources/grid.css" rel="stylesheet"> | 7 <link href="resources/grid.css" rel="stylesheet"> |
8 <style> | 8 <style> |
9 .grid { | 9 .grid { |
10 grid-definition-columns: 200px 200px; | 10 grid-template-columns: 200px 200px; |
11 grid-definition-rows: 100px 100px; | 11 grid-template-rows: 100px 100px; |
12 height: 200px; | 12 height: 200px; |
13 width: 400px; | 13 width: 400px; |
14 } | 14 } |
15 | 15 |
16 .percentPadding { | 16 .percentPadding { |
17 width: 0px; | 17 width: 0px; |
18 height: 0px; | 18 height: 0px; |
19 padding: 50%; | 19 padding: 50%; |
20 } | 20 } |
21 | 21 |
22 .percentMargin { | 22 .percentMargin { |
23 width: 0px; | 23 width: 0px; |
24 height: 0px; | 24 height: 0px; |
25 margin: 50%; | 25 margin: 50%; |
26 } | 26 } |
27 | 27 |
28 .percentPaddingAndMargin { | 28 .percentPaddingAndMargin { |
29 width: 0px; | 29 width: 0px; |
30 height: 0px; | 30 height: 0px; |
31 padding: 10%; | 31 padding: 10%; |
32 margin: 20%; | 32 margin: 20%; |
33 } | 33 } |
34 </style> | 34 </style> |
35 <script src="../../resources/check-layout.js"></script> | 35 <script src="../../resources/check-layout.js"></script> |
36 <script> | 36 <script> |
37 function changeGridTrackSizesAndCheckLayout() | 37 function changeGridTrackSizesAndCheckLayout() |
38 { | 38 { |
39 var grid = document.getElementsByClassName("grid")[0]; | 39 var grid = document.getElementsByClassName("grid")[0]; |
40 grid.offsetLeft; | 40 grid.offsetLeft; |
41 grid.style.gridDefinitionColumns = "100px 300px"; | 41 grid.style.gridTemplateColumns = "100px 300px"; |
42 grid.style.gridDefinitionRows = "50px 150px"; | 42 grid.style.gridTemplateRows = "50px 150px"; |
43 checkLayout('.grid'); | 43 checkLayout('.grid'); |
44 } | 44 } |
45 window.addEventListener("load", changeGridTrackSizesAndCheckLayout, false); | 45 window.addEventListener("load", changeGridTrackSizesAndCheckLayout, false); |
46 </script> | 46 </script> |
47 <body> | 47 <body> |
48 | 48 |
49 <p>Test that changing grid tracks size forces the grid items' to resolve percent
age padding and margin</p> | 49 <p>Test that changing grid tracks size forces the grid items' to resolve percent
age padding and margin</p> |
50 | 50 |
51 <div class="grid"> | 51 <div class="grid"> |
52 <div class="firstRowFirstColumn percentPadding" data-expected-padding-top="5
0" data-expected-padding-right="50" data-expected-padding-bottom="50" data-expec
ted-padding-left="50"></div> | 52 <div class="firstRowFirstColumn percentPadding" data-expected-padding-top="5
0" data-expected-padding-right="50" data-expected-padding-bottom="50" data-expec
ted-padding-left="50"></div> |
53 <div class="firstRowSecondColumn percentMargin" data-expected-margin-top="15
0" data-expected-margin-right="150" data-expected-margin-bottom="150" data-expec
ted-margin-left="150"></div> | 53 <div class="firstRowSecondColumn percentMargin" data-expected-margin-top="15
0" data-expected-margin-right="150" data-expected-margin-bottom="150" data-expec
ted-margin-left="150"></div> |
54 <div class="secondRowFirstColumn percentPaddingAndMargin" data-expected-padd
ing-top="10" data-expected-padding-right="10" data-expected-padding-bottom="10"
data-expected-padding-left="10" data-expected-margin-top="20" data-expected-marg
in-right="20" data-expected-margin-bottom="20" data-expected-margin-left="20"></
div> | 54 <div class="secondRowFirstColumn percentPaddingAndMargin" data-expected-padd
ing-top="10" data-expected-padding-right="10" data-expected-padding-bottom="10"
data-expected-padding-left="10" data-expected-margin-top="20" data-expected-marg
in-right="20" data-expected-margin-bottom="20" data-expected-margin-left="20"></
div> |
55 <div class="secondRowSecondColumn percentPaddingAndMargin" data-expected-pad
ding-top="30" data-expected-padding-right="30" data-expected-padding-bottom="30"
data-expected-padding-left="30" data-expected-margin-top="60" data-expected-mar
gin-right="60" data-expected-margin-bottom="60" data-expected-margin-left="60"><
/div> | 55 <div class="secondRowSecondColumn percentPaddingAndMargin" data-expected-pad
ding-top="30" data-expected-padding-right="30" data-expected-padding-bottom="30"
data-expected-padding-left="30" data-expected-margin-top="60" data-expected-mar
gin-right="60" data-expected-margin-bottom="60" data-expected-margin-left="60"><
/div> |
56 </div> | 56 </div> |
57 | 57 |
58 </body> | 58 </body> |
59 </html> | 59 </html> |
OLD | NEW |