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

Issue 2655783006: Top down version of algorithm to position margins and floats in LayoutNG (Closed)

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

Description

Top down version of algorithm to position margins and floats in LayoutNG This changes the current bottom up version of the algorithm that doesn't handle a couple of impoortant use cases. For example when floats needed to be positioned before processing the next in-flow child. High level overview of changes: - Changed the direction of block offset calculation for fragment(from bottom up to top down approach). Details: If child can determine its position in space it will return BFC offset to its parent. The child is able to calculate its position in space using NGMarginStrut that is set from the parent to child's CS. - Floats are only positioned when the position is known otherwise they are stored in UnpositionedFloats and will be positioned by the next in-flow child that knows its position. - ConstraintSpace uses BFC offset instead of logical offset. - Fixed: Exclusions are stored in BFC coordinates now (this is needed to support intruding floats) - Fixed: LayoutOpportunity returns a correct opportunity if AvailableSize is indefinite. - Fixed: the top edge alignment rule for floats - Fixed: Correct handling of adjoing blocks with clearance - Fixed: Correct opportunity is returned if opportunity_candidate == float.size() - Broken: Multicol. It will be fixed shortly. Priority 2 - Broken: Writing modes. It will be fixed shortly. Priority 1 http://crrev.com/2651793013 - Tests: - enabled 6 margins/floats unittest, disabled 11 multicol unittests - updated layout tests expectations for layout_ng virtual test suite The most common issue with the currently enabled LayoutTests is that LayoutNG doesn't support layout test/inline yet. As a result LayoutNG doesn't get sizing information from LayoutText/LayoutInline blocks so the algorithm positions them as empty blocks. Things that are not supported at this moment: - Offset adjustment if a float is attached to a different parent - multicol, writing modes - Unpositioned floats needed to be available for positioning for text node descendants. This is needed to handle use cases like: <div id="empty"> <float> </div> <div> <div> ... <text style="margin-top: 10px"> </div> We can only position floats after we know the vertical baseline of the text block. BUG=635619 Review-Url: https://codereview.chromium.org/2655783006 Cr-Commit-Position: refs/heads/master@{#447424} Committed: https://chromium.googlesource.com/chromium/src/+/ff3381d6a029803db825aa0a52a49510f6273e5c

Patch Set 1 #

Total comments: 30

Patch Set 2 : fix comments #

Total comments: 23

Patch Set 3 : add UpdateFragmentBfcOffset, refactor PositionFragmentWithKnownBfcOffset, git rebase-update etc. #

Total comments: 6

Patch Set 4 : update TestExpectations #

Patch Set 5 : fix "value of type 'blink::EClear' is not contextually convertible to 'bool'" #

Patch Set 6 : git rebase-update #

Patch Set 7 : git rebase-update #

Unified diffs Side-by-side diffs Delta from patch set Stats (+668 lines, -594 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 6 17 chunks +213 lines, -140 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h View 1 2 4 chunks +7 lines, -39 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc View 1 2 3 4 5 6 17 chunks +254 lines, -189 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc View 1 2 3 4 5 22 chunks +58 lines, -37 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_box_fragment.h View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_box_fragment.cc View 1 2 1 chunk +11 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h View 6 chunks +10 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc View 1 2 3 3 chunks +12 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h View 2 chunks +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc View 1 2 3 5 chunks +12 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc View 1 2 3 2 chunks +11 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_floating_object.h View 2 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h View 1 2 5 chunks +21 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc View 1 2 3 chunks +9 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h View 1 2 3 1 chunk +4 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc View 3 chunks +8 lines, -25 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h View 2 chunks +10 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_units.h View 1 1 chunk +5 lines, -26 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_units.cc View 1 2 chunks +4 lines, -63 lines 0 comments Download

Messages

Total messages: 39 (26 generated)
Gleb Lanbin
3 years, 11 months ago (2017-01-25 20:18:56 UTC) #2
ikilpatrick
about to leave for flight... to be continued. https://codereview.chromium.org/2655783006/diff/20001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/20001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode372 third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:372: curr_margin_strut_ ...
3 years, 11 months ago (2017-01-26 00:49:58 UTC) #5
ikilpatrick
I'll do a more in-depth review on the weekend when I'm not jet-lagged :) https://codereview.chromium.org/2655783006/diff/20001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc ...
3 years, 11 months ago (2017-01-26 04:37:26 UTC) #6
mstensho (USE GERRIT)
Not a complete review from me. From the description: > - Unpositioned floats needed to ...
3 years, 11 months ago (2017-01-26 09:19:08 UTC) #8
Gleb Lanbin
PTAL On 2017/01/26 09:19:08, mstensho wrote: > Not a complete review from me. From the ...
3 years, 10 months ago (2017-01-30 18:17:50 UTC) #9
ikilpatrick
this is looking really good, thanks for your patience :) https://codereview.chromium.org/2655783006/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode26 ...
3 years, 10 months ago (2017-01-30 22:26:49 UTC) #10
Gleb Lanbin
https://codereview.chromium.org/2655783006/diff/20001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/20001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode74 third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:74: const LayoutUnit& float_offset, On 2017/01/26 04:37:25, ikilpatrick wrote: > ...
3 years, 10 months ago (2017-01-31 00:25:02 UTC) #11
ikilpatrick
lgtm https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode478 third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:478: if (fragment.BfcOffset()) { maybe add a comment for ...
3 years, 10 months ago (2017-01-31 01:08:56 UTC) #13
ikilpatrick
still lgtm \o/ https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode425 third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:425: if (block_size) { may also want ...
3 years, 10 months ago (2017-01-31 01:10:01 UTC) #14
Gleb Lanbin
thanks for the review https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc File third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc (right): https://codereview.chromium.org/2655783006/diff/80001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode425 third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:425: if (block_size) { On 2017/01/31 ...
3 years, 10 months ago (2017-01-31 18:58:04 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2655783006/160001
3 years, 10 months ago (2017-02-01 02:30:18 UTC) #35
commit-bot: I haz the power
Committed patchset #7 (id:160001) as https://chromium.googlesource.com/chromium/src/+/ff3381d6a029803db825aa0a52a49510f6273e5c
3 years, 10 months ago (2017-02-01 02:40:32 UTC) #38
ikilpatrick
3 years, 10 months ago (2017-02-01 02:45:40 UTC) #39
Message was sent while issue was closed.
On 2017/02/01 02:40:32, commit-bot: I haz the power wrote:
> Committed patchset #7 (id:160001) as
>
https://chromium.googlesource.com/chromium/src/+/ff3381d6a029803db825aa0a52a4...

\o/

Powered by Google App Engine
This is Rietveld 408576698