Title: [246481] trunk/Source/WebCore
- Revision
- 246481
- Author
- [email protected]
- Date
- 2019-06-16 13:04:31 -0700 (Sun, 16 Jun 2019)
Log Message
[LFC][IFC] Ignore descent when in limited/full quirks mode
https://bugs.webkit.org/show_bug.cgi?id=198893
<rdar://problem/51780634>
Reviewed by Antti Koivisto.
In limited/full quirks mode, line's descent should be ignored when computing the final line height when
1. the line has baseline aligned content only and
2. these baseline aligned boxes don't have descent.
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::isVisuallyEmpty const):
(WebCore::Layout::Line::close):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246480 => 246481)
--- trunk/Source/WebCore/ChangeLog 2019-06-16 20:02:17 UTC (rev 246480)
+++ trunk/Source/WebCore/ChangeLog 2019-06-16 20:04:31 UTC (rev 246481)
@@ -1,5 +1,21 @@
2019-06-16 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Ignore descent when in limited/full quirks mode
+ https://bugs.webkit.org/show_bug.cgi?id=198893
+ <rdar://problem/51780634>
+
+ Reviewed by Antti Koivisto.
+
+ In limited/full quirks mode, line's descent should be ignored when computing the final line height when
+ 1. the line has baseline aligned content only and
+ 2. these baseline aligned boxes don't have descent.
+
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::isVisuallyEmpty const):
+ (WebCore::Layout::Line::close):
+
+2019-06-16 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Line::isVisuallyEmpty should check inline-block boxes.
https://bugs.webkit.org/show_bug.cgi?id=198894
<rdar://problem/51780886>
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (246480 => 246481)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-06-16 20:02:17 UTC (rev 246480)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-06-16 20:04:31 UTC (rev 246481)
@@ -100,19 +100,24 @@
m_contentLogicalHeight = { };
}
+ auto hasDescent = false;
+ auto hasNonBaselineAlignedContent = false;
for (auto& run : m_content->runs()) {
LayoutUnit logicalTop;
auto& inlineItem = run->inlineItem;
auto& layoutBox = inlineItem.layoutBox();
+ auto verticalAlign = inlineItem.style().verticalAlign();
auto ascent = inlineItem.style().fontMetrics().ascent();
- switch (inlineItem.style().verticalAlign()) {
+ switch (verticalAlign) {
case VerticalAlign::Baseline:
- if (inlineItem.isLineBreak() || inlineItem.isText())
+ if (inlineItem.isLineBreak() || inlineItem.isText()) {
logicalTop = baselineOffset() - ascent;
- else if (inlineItem.isContainerStart()) {
+ hasDescent = hasDescent || !run->isCollapsed;
+ } else if (inlineItem.isContainerStart()) {
auto& displayBox = m_layoutState.displayBoxForLayoutBox(layoutBox);
logicalTop = baselineOffset() - ascent - displayBox.borderTop() - displayBox.paddingTop().valueOr(0);
+ hasDescent = hasDescent || (displayBox.horizontalBorder() || (displayBox.horizontalPadding() && displayBox.horizontalPadding().value()));
} else if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
auto& formattingState = downcast<InlineFormattingState>(m_layoutState.establishedFormattingState(layoutBox));
// Spec makes us generate at least one line -even if it is empty.
@@ -119,6 +124,7 @@
ASSERT(!formattingState.lineBoxes().isEmpty());
auto inlineBlockBaseline = formattingState.lineBoxes().last().baseline();
logicalTop = baselineOffset() - inlineBlockBaseline.ascent;
+ hasDescent = hasDescent || inlineBlockBaseline.descent;
} else
logicalTop = baselineOffset() - run->logicalRect.height();
break;
@@ -132,8 +138,14 @@
ASSERT_NOT_IMPLEMENTED_YET();
break;
}
+ hasNonBaselineAlignedContent = hasNonBaselineAlignedContent || verticalAlign != VerticalAlign::Baseline;
run->logicalRect.setTop(logicalTop);
}
+ // Remove descent when all content is baseline aligned but none of them have descent.
+ if (!m_layoutState.inNoQuirksMode() && !hasNonBaselineAlignedContent && !hasDescent) {
+ m_contentLogicalHeight -= m_baseline.descent;
+ m_baseline.descent = { };
+ }
}
m_content->setLogicalRect({ logicalTop(), logicalLeft(), contentLogicalWidth(), logicalHeight() });
m_content->setBaseline(m_baseline);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes