Index: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc |
index f2543da65ef54e28b6f9ee6494ab46dd7a800974..21d768c611a5703d276e51bb71dc1a69de714713 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc |
@@ -164,7 +164,7 @@ void NGLineBreaker::BreakLine(NGLineInfo* line_info) { |
if (item.Type() == NGInlineItem::kText) { |
state = HandleText(*item_results, item, item_result); |
} else if (item.Type() == NGInlineItem::kAtomicInline) { |
- state = HandleAtomicInline(item, item_result); |
+ state = HandleAtomicInline(item, item_result, *line_info); |
} else if (item.Type() == NGInlineItem::kControl) { |
state = HandleControlItem(item, item_result); |
if (state == LineBreakState::kForcedBreak) { |
@@ -352,15 +352,28 @@ NGLineBreaker::LineBreakState NGLineBreaker::HandleControlItem( |
NGLineBreaker::LineBreakState NGLineBreaker::HandleAtomicInline( |
const NGInlineItem& item, |
- NGInlineItemResult* item_result) { |
+ NGInlineItemResult* item_result, |
+ const NGLineInfo& line_info) { |
DCHECK_EQ(item.Type(), NGInlineItem::kAtomicInline); |
if (!should_create_line_box_) |
SetShouldCreateLineBox(); |
- NGBlockNode node = NGBlockNode(ToLayoutBox(item.GetLayoutObject())); |
+ LayoutBox* layout_box = ToLayoutBox(item.GetLayoutObject()); |
+ NGBlockNode node = NGBlockNode(layout_box); |
const ComputedStyle& style = node.Style(); |
NGConstraintSpaceBuilder constraint_space_builder(constraint_space_); |
+ // Request to compute baseline during the layout, except when we know the box |
+ // would synthesize box-baseline. |
+ if (NGBaseline::ShouldPropagateBaselines(layout_box)) { |
+ constraint_space_builder.AddBaselineRequest( |
+ line_info.UseFirstLineStyle() |
+ ? NGBaselineAlgorithmType::kAtomicInlineForFirstLine |
+ : NGBaselineAlgorithmType::kAtomicInline, |
+ IsHorizontalWritingMode(constraint_space_->WritingMode()) |
+ ? FontBaseline::kAlphabeticBaseline |
+ : FontBaseline::kIdeographicBaseline); |
+ } |
RefPtr<NGConstraintSpace> constraint_space = |
constraint_space_builder.SetIsNewFormattingContext(true) |
.SetIsShrinkToFit(true) |