Changeset 216536 in webkit
- Timestamp:
- May 9, 2017 1:48:20 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r216532 r216536 1 2017-05-09 Javier Fernandez <jfernandez@igalia.com> 2 3 space-evenly misbehaves with flexbox 4 https://bugs.webkit.org/show_bug.cgi?id=170445 5 6 Reviewed by David Hyatt. 7 8 Added test cases for the 'space-evenly' value for align-content and justify-content. 9 10 * css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line-expected.txt: 11 * css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html: 12 * css3/flexbox/css-properties-expected.txt: 13 * css3/flexbox/css-properties.html: 14 * css3/flexbox/flex-justify-content-expected.txt: 15 * css3/flexbox/flex-justify-content.html: 16 * css3/flexbox/multiline-align-content-expected.txt: 17 * css3/flexbox/multiline-align-content-horizontal-column-expected.txt: 18 * css3/flexbox/multiline-align-content-horizontal-column.html: 19 * css3/flexbox/multiline-align-content.html: 20 * css3/flexbox/resources/flexbox.css: 21 (.align-content-space-around): 22 (.justify-content-space-around): 23 * css3/flexbox/true-centering-expected.txt: 24 * css3/flexbox/true-centering.html: 25 1 26 2017-05-09 Matt Lewis <jlewis3@apple.com> 2 27 -
trunk/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line-expected.txt
r213149 r216536 12 12 PASS .default, .verticalWriting 11 13 13 PASS .default, .verticalWriting 12 14 PASS .default, .verticalWriting 13 14 15 Test for BUG=324178: Chrome incorrectly honors "align-content" in "flex-wrap: wrap" flex containers that only have a single line 15 16 17 This text should be at the top of its container 16 18 This text should be at the top of its container 17 19 This text should be at the top of its container -
trunk/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html
r213149 r216536 44 44 <div data-offset-y="0">This text should be at the top of its container</div> 45 45 </div> 46 <div class="default" style="align-content: space-evenly"> 47 <div data-offset-y="0">This text should be at the top of its container</div> 48 </div> 46 49 <div class="default" style="align-content: stretch"> 47 50 <div data-offset-y="0">This text should be at the top of its container</div> -
trunk/LayoutTests/css3/flexbox/css-properties-expected.txt
r213149 r216536 27 27 PASS flexbox.style.justifyContent is "space-between" 28 28 PASS window.getComputedStyle(flexbox, null).justifyContent is "space-between" 29 PASS flexbox.style.justifyContent is "space-evenly" 30 PASS window.getComputedStyle(flexbox, null).justifyContent is "space-evenly" 29 31 PASS flexbox.style.justifyContent is "" 30 32 PASS window.getComputedStyle(flexbox, null).justifyContent is "normal" … … 211 213 PASS flexbox.style.alignContent is "space-around" 212 214 PASS window.getComputedStyle(flexbox, null).alignContent is "space-around" 215 PASS flexbox.style.alignContent is "space-evenly" 216 PASS window.getComputedStyle(flexbox, null).alignContent is "space-evenly" 213 217 PASS flexbox.style.alignContent is "stretch" 214 218 PASS window.getComputedStyle(flexbox, null).alignContent is "stretch" -
trunk/LayoutTests/css3/flexbox/css-properties.html
r213149 r216536 76 76 shouldBeEqualToString('window.getComputedStyle(flexbox, null).justifyContent', 'space-between'); 77 77 78 flexbox.style.justifyContent = 'space-evenly'; 79 shouldBeEqualToString('flexbox.style.justifyContent', 'space-evenly'); 80 shouldBeEqualToString('window.getComputedStyle(flexbox, null).justifyContent', 'space-evenly'); 81 78 82 flexbox.style.justifyContent = ''; 79 83 shouldBeEqualToString('flexbox.style.justifyContent', ''); … … 302 306 shouldBeEqualToString('window.getComputedStyle(flexbox, null).alignContent', 'space-around'); 303 307 308 flexbox.style.alignContent = 'space-evenly'; 309 shouldBeEqualToString('flexbox.style.alignContent', 'space-evenly'); 310 shouldBeEqualToString('window.getComputedStyle(flexbox, null).alignContent', 'space-evenly'); 311 304 312 flexbox.style.alignContent = 'stretch'; 305 313 shouldBeEqualToString('flexbox.style.alignContent', 'stretch'); -
trunk/LayoutTests/css3/flexbox/flex-justify-content-expected.txt
r213149 r216536 15 15 PASS .flexbox 14 16 16 PASS .flexbox 15 17 PASS .flexbox 16 18 PASS .flexbox 17 19 PASS .flexbox 18 20 PASS .flexbox 19 21 PASS .flexbox 20 17 22 -
trunk/LayoutTests/css3/flexbox/flex-justify-content.html
r213149 r216536 97 97 <div class="flexbox" style="justify-content: space-around"></div> 98 98 99 <div class="flexbox" style="justify-content: space-evenly"> 100 <div data-expected-width="100" data-offset-x="75" style="flex: 1 0 0; max-width: 100px;"></div> 101 <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div> 102 <div data-expected-width="100" data-offset-x="425" style="width: 100px;"></div> 103 </div> 104 105 <div class="flexbox" style="justify-content: space-evenly"> 106 <div data-expected-width="200" data-offset-x="0" style="flex: 1 100px;"></div> 107 <div data-expected-width="200" data-offset-x="200" style="flex: 1 100px;"></div> 108 <div data-expected-width="200" data-offset-x="400" style="flex: 1 100px;"></div> 109 </div> 110 111 <!-- If there's only one child, we justify-content: center. --> 112 <div class="flexbox" style="justify-content: space-evenly"> 113 <div data-expected-width="100" data-offset-x="250" style="flex: 1 0 0; max-width: 100px;"></div> 114 </div> 115 116 <!-- True centering on overflow. --> 117 <div class="flexbox" style="justify-content: space-evenly"> 118 <div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div> 119 </div> 120 121 <!-- Make sure we don't crash with no children. --> 122 <div class="flexbox" style="justify-content: space-evenly"></div> 123 99 124 <!-- margin:auto applies before justify-content. --> 100 125 <div class="flexbox" style="justify-content: flex-end"> -
trunk/LayoutTests/css3/flexbox/multiline-align-content-expected.txt
r213149 r216536 36 36 PASS .flexbox 35 37 37 PASS .flexbox 36 38 PASS .flexbox 37 39 PASS .flexbox 38 40 PASS .flexbox 39 41 PASS .flexbox 40 42 PASS .flexbox 41 43 PASS .flexbox 42 44 PASS .flexbox 43 45 PASS .flexbox 44 38 46 Test to make sure that align-content works properly. 39 47 -
trunk/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column-expected.txt
r213149 r216536 48 48 PASS .flexbox 47 49 49 PASS .flexbox 48 50 PASS .flexbox 49 51 PASS .flexbox 50 52 PASS .flexbox 51 53 PASS .flexbox 52 54 PASS .flexbox 53 55 PASS .flexbox 54 56 PASS .flexbox 55 57 PASS .flexbox 56 50 58 horizontal-tb ltr column wrap align-content-flex-start 51 59 horizontal-tb ltr column wrap align-content-flex-end … … 53 61 horizontal-tb ltr column wrap align-content-space-between 54 62 horizontal-tb ltr column wrap align-content-space-around 63 horizontal-tb ltr column wrap align-content-space-evenly 55 64 horizontal-tb ltr column wrap align-content-stretch 56 65 horizontal-tb ltr column wrap-reverse align-content-flex-start … … 59 68 horizontal-tb ltr column wrap-reverse align-content-space-between 60 69 horizontal-tb ltr column wrap-reverse align-content-space-around 70 horizontal-tb ltr column wrap-reverse align-content-space-evenly 61 71 horizontal-tb ltr column wrap-reverse align-content-stretch 62 72 horizontal-tb rtl column wrap align-content-flex-start … … 65 75 horizontal-tb rtl column wrap align-content-space-between 66 76 horizontal-tb rtl column wrap align-content-space-around 77 horizontal-tb rtl column wrap align-content-space-evenly 67 78 horizontal-tb rtl column wrap align-content-stretch 68 79 horizontal-tb rtl column wrap-reverse align-content-flex-start … … 71 82 horizontal-tb rtl column wrap-reverse align-content-space-between 72 83 horizontal-tb rtl column wrap-reverse align-content-space-around 84 horizontal-tb rtl column wrap-reverse align-content-space-evenly 73 85 horizontal-tb rtl column wrap-reverse align-content-stretch 74 86 horizontal-tb ltr column-reverse wrap align-content-flex-start … … 77 89 horizontal-tb ltr column-reverse wrap align-content-space-between 78 90 horizontal-tb ltr column-reverse wrap align-content-space-around 91 horizontal-tb ltr column-reverse wrap align-content-space-evenly 79 92 horizontal-tb ltr column-reverse wrap align-content-stretch 80 93 horizontal-tb ltr column-reverse wrap-reverse align-content-flex-start … … 83 96 horizontal-tb ltr column-reverse wrap-reverse align-content-space-between 84 97 horizontal-tb ltr column-reverse wrap-reverse align-content-space-around 98 horizontal-tb ltr column-reverse wrap-reverse align-content-space-evenly 85 99 horizontal-tb ltr column-reverse wrap-reverse align-content-stretch 86 100 horizontal-tb rtl column-reverse wrap align-content-flex-start … … 89 103 horizontal-tb rtl column-reverse wrap align-content-space-between 90 104 horizontal-tb rtl column-reverse wrap align-content-space-around 105 horizontal-tb rtl column-reverse wrap align-content-space-evenly 91 106 horizontal-tb rtl column-reverse wrap align-content-stretch 92 107 horizontal-tb rtl column-reverse wrap-reverse align-content-flex-start … … 95 110 horizontal-tb rtl column-reverse wrap-reverse align-content-space-between 96 111 horizontal-tb rtl column-reverse wrap-reverse align-content-space-around 112 horizontal-tb rtl column-reverse wrap-reverse align-content-space-evenly 97 113 horizontal-tb rtl column-reverse wrap-reverse align-content-stretch 98 114 -
trunk/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column.html
r213149 r216536 48 48 align-content: space-around; 49 49 } 50 .align-content-space-evenly { 51 align-content: space-evenly; 52 } 50 53 .align-content-stretch { 51 54 align-content: stretch; … … 75 78 'space-between': [0, 500], 76 79 'space-around': [100, 400], 77 'stretch': [0, 300], 78 }, 79 'wrap-reverse': { 80 'flex-start': [500, 400], 81 'flex-end': [100, 0], 82 'center': [300, 200], 83 'space-between': [500, 0], 84 'space-around': [400, 100], 80 'space-evenly': [133, 367], 81 'stretch': [0, 300], 82 }, 83 'wrap-reverse': { 84 'flex-start': [500, 400], 85 'flex-end': [100, 0], 86 'center': [300, 200], 87 'space-between': [500, 0], 88 'space-around': [400, 100], 89 'space-evenly': [367, 133], 85 90 'stretch': [300, 0], 86 91 }, … … 93 98 'space-between': [500, 0], 94 99 'space-around': [400, 100], 95 'stretch': [300, 0], 96 }, 97 'wrap-reverse': { 98 'flex-start': [0, 100], 99 'flex-end': [400, 500], 100 'center': [200, 300], 101 'space-between': [0, 500], 102 'space-around': [100, 400], 100 'space-evenly': [367, 133], 101 'stretch': [300, 0], 102 }, 103 'wrap-reverse': { 104 'flex-start': [0, 100], 105 'flex-end': [400, 500], 106 'center': [200, 300], 107 'space-between': [0, 500], 108 'space-around': [100, 400], 109 'space-evenly': [133, 367], 103 110 'stretch': [0, 300], 104 111 }, … … 114 121 'space-between': [0, 500], 115 122 'space-around': [100, 400], 116 'stretch': [0, 300], 117 }, 118 'wrap-reverse': { 119 'flex-start': [500, 400], 120 'flex-end': [100, 0], 121 'center': [300, 200], 122 'space-between': [500, 0], 123 'space-around': [400, 100], 123 'space-evenly': [133, 367], 124 'stretch': [0, 300], 125 }, 126 'wrap-reverse': { 127 'flex-start': [500, 400], 128 'flex-end': [100, 0], 129 'center': [300, 200], 130 'space-between': [500, 0], 131 'space-around': [400, 100], 132 'space-evenly': [367, 133], 124 133 'stretch': [300, 0], 125 134 }, … … 132 141 'space-between': [500, 0], 133 142 'space-around': [400, 100], 134 'stretch': [300, 0], 135 }, 136 'wrap-reverse': { 137 'flex-start': [0, 100], 138 'flex-end': [400, 500], 139 'center': [200, 300], 140 'space-between': [0, 500], 141 'space-around': [100, 400], 143 'space-evenly': [367, 133], 144 'stretch': [300, 0], 145 }, 146 'wrap-reverse': { 147 'flex-start': [0, 100], 148 'flex-end': [400, 500], 149 'center': [200, 300], 150 'space-between': [0, 500], 151 'space-around': [100, 400], 152 'space-evenly': [133, 367], 142 153 'stretch': [0, 300], 143 154 }, … … 173 184 var directions = ['ltr', 'rtl']; 174 185 var wraps = ['wrap', 'wrap-reverse']; 175 var alignContents = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 's tretch'];186 var alignContents = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch']; 176 187 177 188 writingModes.forEach(function(writingMode) { -
trunk/LayoutTests/css3/flexbox/multiline-align-content.html
r213149 r216536 107 107 </div> 108 108 109 <div data-expected-height="120" class="flexbox horizontal" style="align-content: space-evenly"> 110 <div data-offset-x="0" data-offset-y="15" data-expected-height="20"></div> 111 <div data-offset-x="100" data-offset-y="15" data-expected-height="20"></div> 112 <div data-offset-x="0" data-offset-y="50" data-expected-height="20"></div> 113 <div data-offset-x="0" data-offset-y="85" data-expected-height="20"></div> 114 </div> 115 109 116 <div data-expected-height="120" class="flexbox horizontal" style="align-content: space-around"> 110 117 <div data-offset-x="0" data-offset-y="10" data-expected-height="20"></div> … … 153 160 </div> 154 161 162 <!-- If we overflow, we should true center. --> 163 <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> 164 <div data-offset-x="0" data-offset-y="-15" data-expected-height="20"></div> 165 <div data-offset-x="100" data-offset-y="-15" data-expected-height="20"></div> 166 <div data-offset-x="0" data-offset-y="5" data-expected-height="20"></div> 167 <div data-offset-x="0" data-offset-y="25" data-expected-height="20"></div> 168 </div> 169 155 170 <!-- Stretch should only grow, not shrink. --> 156 171 <div data-expected-height="30" class="flexbox horizontal" style="align-content: stretch; height: 30px"> … … 166 181 <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-around; height: 30px"> 167 182 </div> 183 <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> 184 </div> 168 185 <div data-expected-height="30" class="flexbox horizontal" style="align-content: stretch; height: 30px"> 169 186 </div> … … 174 191 </div> 175 192 <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-around; height: 30px"> 193 <div data-offset-x="0" data-offset-y="0" data-expected-height="30"></div> 194 </div> 195 <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> 176 196 <div data-offset-x="0" data-offset-y="0" data-expected-height="30"></div> 177 197 </div> … … 221 241 <div data-offset-x="50" data-offset-y="0" data-expected-width="20"></div> 222 242 <div data-offset-x="10" data-offset-y="0" data-expected-width="20"></div> 243 </div> 244 245 <div data-expected-width="120" class="flexbox vertical-rl" style="align-content: space-evenly"> 246 <div data-offset-x="85" data-offset-y="0" data-expected-width="20"></div> 247 <div data-offset-x="85" data-offset-y="10" data-expected-width="20"></div> 248 <div data-offset-x="50" data-offset-y="0" data-expected-width="20"></div> 249 <div data-offset-x="15" data-offset-y="0" data-expected-width="20"></div> 223 250 </div> 224 251 … … 262 289 </div> 263 290 291 <!-- If we overflow, we should true center. --> 292 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px;"> 293 <div data-offset-x="25" data-offset-y="0" data-expected-width="20"></div> 294 <div data-offset-x="25" data-offset-y="10" data-expected-width="20"></div> 295 <div data-offset-x="5" data-offset-y="0" data-expected-width="20"></div> 296 <div data-offset-x="-15" data-offset-y="0" data-expected-width="20"></div> 297 </div> 298 264 299 <!-- Stretch should only grow, not shrink. --> 265 300 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px;"> … … 275 310 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-around; width: 30px"> 276 311 </div> 312 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px"> 313 </div> 277 314 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px"> 278 315 </div> … … 285 322 <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> 286 323 </div> 324 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px"> 325 <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> 326 </div> 287 327 <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px"> 288 328 <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> -
trunk/LayoutTests/css3/flexbox/resources/flexbox.css
r145937 r216536 71 71 align-content: space-around; 72 72 } 73 .align-content-space-around { 74 -webkit-align-content: space-evenly; 75 align-content: space-evenly; 76 } 73 77 .align-content-stretch { 74 78 -webkit-align-content: stretch; … … 142 146 justify-content: space-around; 143 147 } 148 .justify-content-space-around { 149 -webkit-justify-content: space-evenly; 150 justify-content: space-evenly; 151 } -
trunk/LayoutTests/css3/flexbox/true-centering-expected.txt
r213149 r216536 31 31 PASS .flexbox 30 32 32 PASS .flexbox 31 33 PASS .flexbox 32 33 34 horizontal-tb ltr row 34 35 horizontal-tb rtl row -
trunk/LayoutTests/css3/flexbox/true-centering.html
r213149 r216536 80 80 </div> 81 81 82 <div class="flexbox" style="align-items: center; justify-content: space-evenly;"> 83 <div data-offset-x="-10" data-offset-y="-5"></div> 84 <div data-offset-x="50" data-offset-y="-5"></div> 85 </div> 86 82 87 <div class="flexbox" style="align-items: flex-start; justify-content: flex-start;"> 83 88 <div data-offset-x=0 data-offset-y=0></div> -
trunk/Source/WebCore/ChangeLog
r216535 r216536 1 2017-05-09 Javier Fernandez <jfernandez@igalia.com> 2 3 space-evenly misbehaves with flexbox 4 https://bugs.webkit.org/show_bug.cgi?id=170445 5 6 Reviewed by David Hyatt. 7 8 The CSS Box Alignment specification defines the <content-distribution> 9 set as some of the allowed values for the Content Distribution 10 properties, align-content and justify-content. The 'space-evenly' value 11 is not among the ones allowed for these properties according to the CSS 12 Flexible Box specification. 13 14 The CSS Flexbible box specification states that it must follow the CSS 15 Box Alignment specification, so this new value must be considered as 16 part of an upgraded level of the spec, which should be implemented 17 eventually. 18 19 Since we have already shipped an implementation of the new CSS Box 20 Alignment values for CSS Grid Layout, we need to implement it for 21 Flexbox as well. 22 23 No new tests, but several new test cases added. 24 25 * rendering/RenderFlexibleBox.cpp: 26 (WebCore::initialJustifyContentOffset): 27 (WebCore::justifyContentSpaceBetweenChildren): 28 (WebCore::initialAlignContentOffset): 29 (WebCore::alignContentSpaceBetweenChildren): 30 1 31 2017-05-09 Michael Catanzaro <mcatanzaro@igalia.com> 2 32 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r213748 r216536 1292 1292 return availableFreeSpace / 2; 1293 1293 } 1294 if (justifyContentDistribution == ContentDistributionSpaceEvenly) { 1295 if (availableFreeSpace > 0 && numberOfChildren) 1296 return availableFreeSpace / (numberOfChildren + 1); 1297 // Fallback to 'center' 1298 return availableFreeSpace / 2; 1299 } 1294 1300 return 0; 1295 1301 } … … 1302 1308 if (justifyContentDistribution == ContentDistributionSpaceAround) 1303 1309 return availableFreeSpace / numberOfChildren; 1310 if (justifyContentDistribution == ContentDistributionSpaceEvenly) 1311 return availableFreeSpace / (numberOfChildren + 1); 1304 1312 } 1305 1313 return 0; … … 1647 1655 return availableFreeSpace / 2; 1648 1656 } 1657 if (alignContentDistribution == ContentDistributionSpaceEvenly) { 1658 if (availableFreeSpace > 0) 1659 return availableFreeSpace / (numberOfLines + 1); 1660 // Fallback to 'center' 1661 return availableFreeSpace / 2; 1662 } 1649 1663 return LayoutUnit(); 1650 1664 } … … 1657 1671 if (alignContentDistribution == ContentDistributionSpaceAround || alignContentDistribution == ContentDistributionStretch) 1658 1672 return availableFreeSpace / numberOfLines; 1673 if (alignContentDistribution == ContentDistributionSpaceEvenly) 1674 return availableFreeSpace / (numberOfLines + 1); 1659 1675 } 1660 1676 return LayoutUnit();
Note: See TracChangeset
for help on using the changeset viewer.