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

Issue 1824323002: [css-grid] Fix positioned children in RTL direction (Closed)

Created:
4 years, 9 months ago by Manuel Rego
Modified:
4 years, 8 months ago
CC:
chromium-reviews, jfernandez, szager+layoutwatch_chromium.org, zoltan1, svillar, blink-reviews-layout_chromium.org, pdr+renderingwatchlist_chromium.org, Manuel Rego, leviw+renderwatch, jchaffraix+rendering, blink-reviews, eae+blinkwatch
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[css-grid] Fix positioned children in RTL direction We were not honouring RTL for positioned children, we didn't have any specific code for that so a lot of cases were not working properly. Refactored the code in offsetAndBreadthForPositionedChild() in order to calculate offset and breadth in a more clean way that works for both LTR and RTL. Added RTL cases for most of the positioned tests, which are now passing with this patch. Converted some of the tests to testharness tests to avoid the need of updating the expected results. BUG=568882

Patch Set 1 #

Patch Set 2 : Use LayoutUnit() instead of LayoutUnit(0) #

Total comments: 8

Patch Set 3 : New version with suggested changes #

Patch Set 4 : Remove unneeded LayoutUnit() #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+495 lines, -67 lines) Patch
M third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-containing-block.html View 2 chunks +120 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-containing-block-expected.txt View 1 chunk +0 lines, -7 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-parent.html View 2 chunks +39 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-parent-expected.txt View 1 chunk +0 lines, -8 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background.html View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-expected.html View 1 chunk +1 line, -2 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl.html View 2 chunks +8 lines, -7 lines 0 comments Download
A + third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl-expected.html View 2 chunks +6 lines, -7 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid.html View 2 chunks +28 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-expected.txt View 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-line.html View 2 chunks +22 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-line-expected.txt View 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-padding.html View 1 chunk +84 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-unknown-named-grid-line.html View 2 chunks +16 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-unknown-named-grid-line-expected.txt View 1 chunk +0 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html View 1 chunk +72 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html View 2 chunks +72 lines, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items-expected.txt View 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutGrid.cpp View 1 2 3 1 chunk +25 lines, -12 lines 7 comments Download

Messages

Total messages: 9 (2 generated)
Manuel Rego
4 years, 9 months ago (2016-03-23 09:57:55 UTC) #3
svillar
Good start. https://codereview.chromium.org/1824323002/diff/20001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/1824323002/diff/20001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1531 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1531: start += isForColumns ? paddingStart() : paddingBefore(); ...
4 years, 9 months ago (2016-03-23 10:43:55 UTC) #4
Manuel Rego
Thanks for the quick review. New version with the suggested changes. https://codereview.chromium.org/1824323002/diff/20001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): ...
4 years, 9 months ago (2016-03-23 11:20:52 UTC) #5
cbiesinger
https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1545 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1545: // If the child doesn't have a static inline ...
4 years, 9 months ago (2016-03-23 19:50:49 UTC) #6
Manuel Rego
https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1545 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1545: // If the child doesn't have a static inline ...
4 years, 8 months ago (2016-03-28 08:57:29 UTC) #7
svillar
https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1526 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1526: if (!startIsAuto) { This deserves a comment about how ...
4 years, 8 months ago (2016-03-29 10:17:58 UTC) #8
Manuel Rego
4 years, 8 months ago (2016-03-29 10:34:51 UTC) #9
Thanks for the review, I'm closing this patch as I'll be splitting it in 2.

https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right):

https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1533: LayoutUnit end =
isForColumns ? clientLogicalWidth() : clientLogicalHeight();
On 2016/03/29 10:17:58, svillar wrote:
> The previous code was using logicalXXX. Is the client size really what we
want?

Previous code was subtracting the border and we can avoid that now
thanks to using the client size.

https://codereview.chromium.org/1824323002/diff/60001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1545: // If the child
doesn't have a static inline position, we need to calculate the offset from the
left (even if we're in RTL).
On 2016/03/29 10:17:58, svillar wrote:
> Perhaps the comment could be improved. Saying "if left: and right: are both
> auto" is much clearer than "have static inline position" IMO.

Not sure if I agree as the term "static position" can be found in the spec.
But I can try to improve it of course.

> This if is rather obscure (seems to ad-hoc for a symmetrical layout like
grid).
> Perhaps we could split this patch in 2, one with the refactoring and another
> with the fix.

Yeah, I'll split this in two patches, one for the refactoring,
and another for adding this "special" if.

Powered by Google App Engine
This is Rietveld 408576698