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

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

Issue 2865903002: [LayoutNG] Inline margin/border/padding, inter-item breaking, and tests (Closed)
Patch Set: ikilpatrick review Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h" 5 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h"
6 6
7 #include "core/layout/ng/inline/ng_bidi_paragraph.h" 7 #include "core/layout/ng/inline/ng_bidi_paragraph.h"
8 #include "core/layout/ng/inline/ng_inline_break_token.h" 8 #include "core/layout/ng/inline/ng_inline_break_token.h"
9 #include "core/layout/ng/inline/ng_inline_node.h" 9 #include "core/layout/ng/inline/ng_inline_node.h"
10 #include "core/layout/ng/inline/ng_line_box_fragment.h" 10 #include "core/layout/ng/inline/ng_line_box_fragment.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // TODO(kojii): These are once computed in NGLineBreaker. Should copy to 265 // TODO(kojii): These are once computed in NGLineBreaker. Should copy to
266 // NGInlineItemResult to reuse here. 266 // NGInlineItemResult to reuse here.
267 NGBoxStrut borders = ComputeBorders(*constraint_space_, *item.Style()); 267 NGBoxStrut borders = ComputeBorders(*constraint_space_, *item.Style());
268 NGBoxStrut paddings = ComputePadding(*constraint_space_, *item.Style()); 268 NGBoxStrut paddings = ComputePadding(*constraint_space_, *item.Style());
269 // TODO(kojii): Set paint edges. 269 // TODO(kojii): Set paint edges.
270 box->SetNeedsBoxFragment(position, 270 box->SetNeedsBoxFragment(position,
271 borders.block_start + paddings.block_start, 271 borders.block_start + paddings.block_start,
272 borders.BlockSum() + paddings.BlockSum()); 272 borders.BlockSum() + paddings.BlockSum());
273 } 273 }
274 } else if (item.Type() == NGInlineItem::kCloseTag) { 274 } else if (item.Type() == NGInlineItem::kCloseTag) {
275 position += item_result.inline_size;
275 box = box_states_.OnCloseTag(item, &line_box, box, baseline_type_, 276 box = box_states_.OnCloseTag(item, &line_box, box, baseline_type_,
276 position); 277 position);
278 continue;
277 } else if (item.Type() == NGInlineItem::kAtomicInline) { 279 } else if (item.Type() == NGInlineItem::kAtomicInline) {
278 box = PlaceAtomicInline(item, &item_result, position, &line_box, 280 box = PlaceAtomicInline(item, &item_result, position, &line_box,
279 &text_builder); 281 &text_builder);
280 } else if (item.Type() == NGInlineItem::kOutOfFlowPositioned) { 282 } else if (item.Type() == NGInlineItem::kOutOfFlowPositioned) {
281 // TODO(layout-dev): Report the correct static position for the out of 283 // TODO(layout-dev): Report the correct static position for the out of
282 // flow descendant. We can't do this here yet as it doesn't know the 284 // flow descendant. We can't do this here yet as it doesn't know the
283 // size of the line box. 285 // size of the line box.
284 container_builder_.AddOutOfFlowDescendant( 286 container_builder_.AddOutOfFlowDescendant(
285 // Absolute positioning blockifies the box's display type. 287 // Absolute positioning blockifies the box's display type.
286 // https://drafts.csswg.org/css-display/#transformations 288 // https://drafts.csswg.org/css-display/#transformations
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // Margin struts shouldn't need to be passed through like this once we've 436 // Margin struts shouldn't need to be passed through like this once we've
435 // removed LayoutInline splitting. 437 // removed LayoutInline splitting.
436 if (!container_builder_.BfcOffset()) { 438 if (!container_builder_.BfcOffset()) {
437 container_builder_.SetEndMarginStrut(ConstraintSpace().MarginStrut()); 439 container_builder_.SetEndMarginStrut(ConstraintSpace().MarginStrut());
438 } 440 }
439 441
440 return container_builder_.ToBoxFragment(); 442 return container_builder_.ToBoxFragment();
441 } 443 }
442 444
443 } // namespace blink 445 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698