OLD | NEW |
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_line_breaker.h" | 5 #include "core/layout/ng/inline/ng_line_breaker.h" |
6 | 6 |
7 #include "core/layout/ng/inline/ng_inline_break_token.h" | 7 #include "core/layout/ng/inline/ng_inline_break_token.h" |
8 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h" | 8 #include "core/layout/ng/inline/ng_inline_layout_algorithm.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_text_fragment.h" | 10 #include "core/layout/ng/inline/ng_text_fragment.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 item_result->borders_paddings_block_end = | 450 item_result->borders_paddings_block_end = |
451 borders.block_end + paddings.block_end; | 451 borders.block_end + paddings.block_end; |
452 if (item.HasStartEdge()) { | 452 if (item.HasStartEdge()) { |
453 item_result->margins = ComputeMargins(*constraint_space_, style, | 453 item_result->margins = ComputeMargins(*constraint_space_, style, |
454 constraint_space_->WritingMode(), | 454 constraint_space_->WritingMode(), |
455 constraint_space_->Direction()); | 455 constraint_space_->Direction()); |
456 item_result->inline_size = item_result->margins.inline_start + | 456 item_result->inline_size = item_result->margins.inline_start + |
457 borders.inline_start + paddings.inline_start; | 457 borders.inline_start + paddings.inline_start; |
458 position_ += item_result->inline_size; | 458 position_ += item_result->inline_size; |
459 | 459 |
| 460 // While the spec defines "non-zero margins, padding, or borders" prevents |
| 461 // line boxes to be zero-height, tests indicate that only inline direction |
| 462 // of them do so. See should_create_line_box_. |
| 463 // Force to create a box, because such inline boxes affect line heights. |
460 item_result->needs_box_when_empty = | 464 item_result->needs_box_when_empty = |
461 item_result->inline_size || item_result->margins.inline_start; | 465 item_result->inline_size || item_result->margins.inline_start; |
462 if (item_result->needs_box_when_empty && !should_create_line_box_) | 466 if (item_result->needs_box_when_empty && !should_create_line_box_) |
463 SetShouldCreateLineBox(); | 467 SetShouldCreateLineBox(); |
464 } | 468 } |
465 } | 469 } |
466 SetCurrentStyle(style); | 470 SetCurrentStyle(style); |
467 MoveToNextOf(item); | 471 MoveToNextOf(item); |
468 } | 472 } |
469 | 473 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } | 656 } |
653 | 657 |
654 RefPtr<NGInlineBreakToken> NGLineBreaker::CreateBreakToken() const { | 658 RefPtr<NGInlineBreakToken> NGLineBreaker::CreateBreakToken() const { |
655 const Vector<NGInlineItem>& items = node_.Items(); | 659 const Vector<NGInlineItem>& items = node_.Items(); |
656 if (item_index_ >= items.size()) | 660 if (item_index_ >= items.size()) |
657 return nullptr; | 661 return nullptr; |
658 return NGInlineBreakToken::Create(node_, item_index_, offset_); | 662 return NGInlineBreakToken::Create(node_, item_index_, offset_); |
659 } | 663 } |
660 | 664 |
661 } // namespace blink | 665 } // namespace blink |
OLD | NEW |