DescriptionTop 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 #Messages
Total messages: 39 (26 generated)
|