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

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc

Issue 2914523002: [LayoutNG] Fix not to add borders/paddings to every line (Closed)
Patch Set: Fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
index f9b7422e2f6b6cb8f80074d41933ab761be24b85..de74bbffe1c283ac7929a2d31e94346cec13d956 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -304,8 +304,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.
@@ -412,6 +411,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) {
@@ -423,7 +426,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.
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698