Commit bfb708ff authored by kojii's avatar kojii Committed by Commit Bot

[LayoutNG] Fix not to add borders/paddings to every line

The initial CL to support borders/paddings of the containing block of
inlines[1] added the block start of borders/paddings to every line.

This patch fixes to add it only once, to the content_size_, the same way
as NGBlockLayoutAlgorithm does.

[1] https://codereview.chromium.org/2886453005

BUG=636993, 725359
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_layout_ng

Review-Url: https://codereview.chromium.org/2914523002
Cr-Commit-Position: refs/heads/master@{#475810}
parent 4223216d
......@@ -477,7 +477,6 @@ crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-093
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-101.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-103.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-104.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-125.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-129.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-bleed-001.xht [ Failure ]
crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-bleed-002.xht [ Failure ]
......
......@@ -305,8 +305,7 @@ bool NGInlineLayoutAlgorithm::PlaceItems(
// The baselines are always placed at pixel boundaries. Not doing so results
// in incorrect layout of text decorations, most notably underlines.
LayoutUnit baseline = content_size_ + line_box.Metrics().ascent +
border_and_padding_.block_start;
LayoutUnit baseline = content_size_ + line_box.Metrics().ascent;
baseline = LayoutUnit(baseline.Round());
// Check if the line fits into the constraint space in block direction.
......@@ -431,6 +430,10 @@ void NGInlineLayoutAlgorithm::FindNextLayoutOpportunity() {
}
RefPtr<NGLayoutResult> NGInlineLayoutAlgorithm::Layout() {
// If we are resuming from a break token our start border and padding is
// within a previous fragment.
content_size_ = BreakToken() ? LayoutUnit() : border_and_padding_.block_start;
NGLineBreaker line_breaker(Node(), constraint_space_, BreakToken());
NGInlineItemResults item_results;
while (true) {
......@@ -442,7 +445,7 @@ RefPtr<NGLayoutResult> NGInlineLayoutAlgorithm::Layout() {
}
// TODO(crbug.com/716930): Avoid calculating border/padding twice.
if (!Node()->Items().IsEmpty())
if (!BreakToken())
content_size_ -= border_and_padding_.block_start;
// TODO(kojii): Check if the line box width should be content or available.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment