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

Issue 2807113002: [LayoutNG] Use NGLogical[Offset|Size] for NGFragment

Created:
3 years, 8 months ago by eae
Modified:
3 years, 8 months ago
CC:
atotic+reviews_chromium.org, blink-reviews, blink-reviews-layout_chromium.org, cbiesinger, chromium-reviews, dgrogan+ng_chromium.org, eae+blinkwatch, glebl+reviews_chromium.org, jchaffraix+rendering, leviw+renderwatch, ojan+watch_chromium.org, pdr+renderingwatchlist_chromium.org, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[LayoutNG] Use NGLogical[Offset|Size] for NGFragment Replace use of raw LayoutUnits and custom physical to logical conversion logic in NGFragment and instead expose Size() and Offset() methods using the NGLogicalOffset and NGLogicalOffset types respectively. This reduces not only code duplication but also the number of coordinate conversions. More importantly it limits the use of raw LayoutUnits and the logical vs physical coordinate ambiguity by using compiler enforced explicit types. R=ikilpatrick@chromium.org CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_layout_ng

Patch Set 1 #

Total comments: 2

Messages

Total messages: 14 (8 generated)
eae
3 years, 8 months ago (2017-04-10 16:00:21 UTC) #8
cbiesinger
https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc File third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc (right): https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc#newcode14 third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc:14: : NGLogicalOffset(top, left); Is that correct? For vertical-rl, I ...
3 years, 8 months ago (2017-04-10 20:55:51 UTC) #9
atotic
https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc File third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc (right): https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc#newcode14 third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc:14: : NGLogicalOffset(top, left); On 2017/04/10 at 20:55:51, cbiesinger wrote: ...
3 years, 8 months ago (2017-04-10 22:44:35 UTC) #11
eae
On 2017/04/10 20:55:51, cbiesinger wrote: > https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc > File third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc > (right): > > https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc#newcode14 ...
3 years, 8 months ago (2017-04-11 03:59:02 UTC) #12
eae
On 2017/04/10 22:44:35, atotic wrote: > https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc > File third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc > (right): > > https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc#newcode14 ...
3 years, 8 months ago (2017-04-11 05:09:41 UTC) #13
eae
3 years, 8 months ago (2017-04-11 05:09:44 UTC) #14
On 2017/04/10 22:44:35, atotic wrote:
>
https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/c...
> File third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc
> (right):
> 
>
https://codereview.chromium.org/2807113002/diff/1/third_party/WebKit/Source/c...
> third_party/WebKit/Source/core/layout/ng/geometry/ng_physical_offset.cc:14: :
> NGLogicalOffset(top, left);
> On 2017/04/10 at 20:55:51, cbiesinger wrote:
> > Is that correct? For vertical-rl, I am not sure that left is the inline
> offset, shouldn't it be width-left?
> 
> I agree. 
> 
> Computing physical offset of fragment from logical might be even more
> complicated.
> 
> In algorithms:
> for physical position, you want offset of top/left corner.
> for logical position, you want offset of inline-start/block-start corner.
> 
> These corners are not the same in vertical modes. inline-start/block-start is
> right/bottom corner in vertical-rl.
> 
> To compute these, you need two sizes, parent and fragment.
> 
> There should be methods on NGPhysicalFragment that also expose PhysicalSize
and
> PhysicalOffset.

Those are great suggestions, I'll update the Cl.

Thanks!

Powered by Google App Engine
This is Rietveld 408576698