Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[css-grid] Fix grid-template-columns|rows computed style with content…
… alignment https://bugs.webkit.org/show_bug.cgi?id=156793 Reviewed by Darin Adler. Source/WebCore: Computed style of grid-template-columns and grid-template-rows properties was including the distribution offset because of content alignment. We should subtract that offset, like we do for the case of gaps, when we're calculating the computed style. Test: fast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForGridTrackList): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::offsetBetweenTracks): (WebCore::RenderGrid::populateGridPositions): Deleted FIXME. * rendering/RenderGrid.h: LayoutTests: * fast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment-expected.txt: Added. * fast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment.html: Added. Canonical link: https://commits.webkit.org/175082@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
133 additions
and 6 deletions.
- +10 −0 LayoutTests/ChangeLog
- +37 −0 ...ast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment-expected.txt
- +53 −0 ...tTests/fast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment.html
- +21 −0 Source/WebCore/ChangeLog
- +6 −4 Source/WebCore/css/CSSComputedStyleDeclaration.cpp
- +5 −2 Source/WebCore/rendering/RenderGrid.cpp
- +1 −0 Source/WebCore/rendering/RenderGrid.h
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,37 @@ | ||
Test that computed style for grid-template-columns and grid-template-rows works as expected with content alignment and gaps. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS window.getComputedStyle(gridContentStart, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentStart, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentCenter, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentCenter, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentEnd, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentEnd, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentSpaceBetween, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentSpaceBetween, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentSpaceAround, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentSpaceAround, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentSpaceEvenly, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentSpaceEvenly, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridContentStretch, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridContentStretch, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentStart, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentStart, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentCenter, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentCenter, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentEnd, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentEnd, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceBetween, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceBetween, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceAround, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceAround, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceEvenly, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentSpaceEvenly, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS window.getComputedStyle(gridGapsContentStretch, '').getPropertyValue('-webkit-grid-template-columns') is "300px 200px 100px" | ||
PASS window.getComputedStyle(gridGapsContentStretch, '').getPropertyValue('-webkit-grid-template-rows') is "150px 100px 50px" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE HTML> | ||
<link href="resources/grid.css" rel="stylesheet"> | ||
<link href="resources/grid-alignment.css" rel="stylesheet"> | ||
<style> | ||
.grid { | ||
-webkit-grid-template-columns: 300px 200px 100px; | ||
-webkit-grid-template-rows: 150px 100px 50px; | ||
width: 800px; | ||
height: 500px; | ||
} | ||
|
||
.gaps { | ||
-webkit-grid-gap: 10px 20px; | ||
} | ||
</style> | ||
|
||
<div class="grid contentStart" id="gridContentStart"></div> | ||
<div class="grid contentCenter" id="gridContentCenter"></div> | ||
<div class="grid contentEnd" id="gridContentEnd"></div> | ||
<div class="grid contentSpaceBetween" id="gridContentSpaceBetween"></div> | ||
<div class="grid contentSpaceAround" id="gridContentSpaceAround"></div> | ||
<div class="grid contentSpaceEvenly" id="gridContentSpaceEvenly"></div> | ||
<div class="grid contentStretch" id="gridContentStretch"></div> | ||
|
||
<div class="grid gaps contentStart" id="gridGapsContentStart"></div> | ||
<div class="grid gaps contentCenter" id="gridGapsContentCenter"></div> | ||
<div class="grid gaps contentEnd" id="gridGapsContentEnd"></div> | ||
<div class="grid gaps contentSpaceBetween" id="gridGapsContentSpaceBetween"></div> | ||
<div class="grid gaps contentSpaceAround" id="gridGapsContentSpaceAround"></div> | ||
<div class="grid gaps contentSpaceEvenly" id="gridGapsContentSpaceEvenly"></div> | ||
<div class="grid gaps contentStretch" id="gridGapsContentStretch"></div> | ||
|
||
<script src="../../resources/js-test.js"></script> | ||
<script src="resources/grid-definitions-parsing-utils.js"></script> | ||
<script> | ||
description("Test that computed style for grid-template-columns and grid-template-rows works as expected with content alignment and gaps."); | ||
|
||
testGridTemplatesValues(document.getElementById("gridContentStart"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentCenter"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentEnd"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentSpaceBetween"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentSpaceAround"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentSpaceEvenly"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridContentStretch"), "300px 200px 100px", "150px 100px 50px"); | ||
|
||
testGridTemplatesValues(document.getElementById("gridGapsContentStart"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentCenter"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentEnd"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentSpaceBetween"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentSpaceAround"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentSpaceEvenly"), "300px 200px 100px", "150px 100px 50px"); | ||
testGridTemplatesValues(document.getElementById("gridGapsContentStretch"), "300px 200px 100px", "150px 100px 50px"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters