Changeset 246680 in webkit
- Timestamp:
- Jun 21, 2019 8:49:21 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246679 r246680 1 2019-06-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Adjust baseline top when the baseline moves. 4 https://bugs.webkit.org/show_bug.cgi?id=199091 5 <rdar://problem/51966257> 6 7 Reviewed by Antti Koivisto. 8 9 Currently only "text-align: bottom" adjusts the baseline top. This patch fixes the "text-align: baseline" case when 10 the growing ascent pushes the baseline top closer to the line top. 11 12 * layout/inlineformatting/InlineLine.cpp: 13 (WebCore::Layout::Line::adjustBaselineAndLineHeight): 14 1 15 2019-06-21 Zalan Bujtas <zalan@apple.com> 2 16 -
trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp
r246679 r246680 314 314 315 315 if (inlineItem.isContainerStart()) { 316 // FIXME: This implies baseline vertical aligment for the inline container. 316 317 auto& fontMetrics = style.fontMetrics(); 317 318 auto halfLeading = halfLeadingMetrics(fontMetrics, style.computedLineHeight()); … … 335 336 // Replaced and non-replaced inline level box. 336 337 switch (inlineItem.style().verticalAlign()) { 337 case VerticalAlign::Baseline: 338 case VerticalAlign::Baseline: { 339 auto newBaselineCandidate = LineBox::Baseline { runHeight, 0 }; 338 340 if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) { 339 341 // Inline-blocks with inline content always have baselines. … … 341 343 // Spec makes us generate at least one line -even if it is empty. 342 344 ASSERT(!formattingState.lineBoxes().isEmpty()); 343 auto inlineBlockBaseline = formattingState.lineBoxes().last().baseline(); 344 m_baseline.descent = std::max(inlineBlockBaseline.descent, m_baseline.descent); 345 m_baseline.ascent = std::max(inlineBlockBaseline.ascent, m_baseline.ascent); 346 m_lineLogicalHeight = std::max(std::max(m_lineLogicalHeight, runHeight), m_baseline.height()); 347 break; 348 } 349 m_baseline.descent = std::max<LayoutUnit>(0, m_baseline.descent); 350 m_baseline.ascent = std::max(runHeight, m_baseline.ascent); 351 m_lineLogicalHeight = std::max(m_lineLogicalHeight, m_baseline.height()); 345 newBaselineCandidate = formattingState.lineBoxes().last().baseline(); 346 } 347 m_baseline.ascent = std::max(newBaselineCandidate.ascent, m_baseline.ascent); 348 m_baseline.descent = std::max(newBaselineCandidate.descent, m_baseline.descent); 349 m_lineLogicalHeight = std::max(std::max(m_lineLogicalHeight, runHeight), m_baseline.height()); 350 // Baseline ascent/descent never shrink -> max. 351 m_baselineTop = std::max(m_baselineTop, m_lineLogicalHeight - m_baseline.height()); 352 352 break; 353 } 353 354 case VerticalAlign::Top: 354 355 // Top align content never changes the baseline offset, it only pushes the bottom of the line further down. … … 356 357 break; 357 358 case VerticalAlign::Bottom: 358 if (m_lineLogicalHeight < runHeight) { 359 m_baselineTop += runHeight - m_lineLogicalHeight; 359 // Bottom aligned, tall content pushes the baseline further down from the line top. 360 if (runHeight > m_lineLogicalHeight) { 361 m_baselineTop += (runHeight - m_lineLogicalHeight); 360 362 m_lineLogicalHeight = runHeight; 361 363 }
Note: See TracChangeset
for help on using the changeset viewer.