Title: [246475] trunk/Source/WebCore
- Revision
- 246475
- Author
- [email protected]
- Date
- 2019-06-16 12:28:14 -0700 (Sun, 16 Jun 2019)
Log Message
[LFC][IFC] Use the borderBox rect consistently to size the inline box.
https://bugs.webkit.org/show_bug.cgi?id=198899
Reviewed by Antti Koivisto.
<rdar://problem/51781969>
Use the margin box height (when applicable) to adjust the line height and use the borderBox rect (or font size) height to size the inline box.
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::borderBoxHeight const):
(WebCore::Display::Box::marginBoxHeight const):
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::appendInlineContainerStart):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::inlineItemContentHeight const):
(WebCore::Layout::Line::inlineItemHeight const): Deleted.
* layout/inlineformatting/InlineLine.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246474 => 246475)
--- trunk/Source/WebCore/ChangeLog 2019-06-16 18:23:46 UTC (rev 246474)
+++ trunk/Source/WebCore/ChangeLog 2019-06-16 19:28:14 UTC (rev 246475)
@@ -1,3 +1,24 @@
+2019-06-16 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Use the borderBox rect consistently to size the inline box.
+ https://bugs.webkit.org/show_bug.cgi?id=198899
+
+ Reviewed by Antti Koivisto.
+ <rdar://problem/51781969>
+
+ Use the margin box height (when applicable) to adjust the line height and use the borderBox rect (or font size) height to size the inline box.
+
+ * layout/displaytree/DisplayBox.h:
+ (WebCore::Display::Box::borderBoxHeight const):
+ (WebCore::Display::Box::marginBoxHeight const):
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::appendInlineContainerStart):
+ (WebCore::Layout::Line::appendTextContent):
+ (WebCore::Layout::Line::appendNonReplacedInlineBox):
+ (WebCore::Layout::Line::inlineItemContentHeight const):
+ (WebCore::Layout::Line::inlineItemHeight const): Deleted.
+ * layout/inlineformatting/InlineLine.h:
+
2019-06-15 Simon Fraser <[email protected]>
Make layerTreeAsText() output a bit less verbose
Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (246474 => 246475)
--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2019-06-16 18:23:46 UTC (rev 246474)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2019-06-16 19:28:14 UTC (rev 246475)
@@ -119,7 +119,9 @@
LayoutUnit paddingBoxHeight() const { return paddingTop().valueOr(0) + contentBoxHeight() + paddingBottom().valueOr(0); }
LayoutUnit paddingBoxWidth() const { return paddingLeft().valueOr(0) + contentBoxWidth() + paddingRight().valueOr(0); }
+ LayoutUnit borderBoxHeight() const { return borderTop() + paddingBoxHeight() + borderBottom(); }
LayoutUnit borderBoxWidth() const { return borderLeft() + paddingBoxWidth() + borderRight(); }
+ LayoutUnit marginBoxHeight() const { return marginBefore() + borderBoxHeight() + marginAfter(); }
LayoutUnit marginBoxWidth() const { return marginStart() + borderBoxWidth() + marginEnd(); }
Rect marginBox() const;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (246474 => 246475)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-06-16 18:23:46 UTC (rev 246474)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-06-16 19:28:14 UTC (rev 246475)
@@ -177,7 +177,7 @@
logicalRect.setWidth(logicalWidth);
if (!m_skipVerticalAligment) {
- auto logicalHeight = inlineItemHeight(inlineItem);
+ auto logicalHeight = inlineItemContentHeight(inlineItem);
adjustBaselineAndLineHeight(inlineItem, logicalHeight);
logicalRect.setHeight(logicalHeight);
}
@@ -224,7 +224,7 @@
logicalRect.setLeft(contentLogicalRight());
logicalRect.setWidth(logicalWidth);
if (!m_skipVerticalAligment)
- logicalRect.setHeight(inlineItemHeight(inlineItem));
+ logicalRect.setHeight(inlineItemContentHeight(inlineItem));
auto textContext = Content::Run::TextContext { inlineItem.start(), inlineItem.isCollapsed() ? 1 : inlineItem.length() };
auto lineItem = std::make_unique<Content::Run>(inlineItem, logicalRect, textContext, isCompletelyCollapsed, canBeExtended);
@@ -244,9 +244,8 @@
logicalRect.setLeft(contentLogicalRight() + horizontalMargin.start);
logicalRect.setWidth(logicalWidth);
if (!m_skipVerticalAligment) {
- auto logicalHeight = inlineItemHeight(inlineItem);
- adjustBaselineAndLineHeight(inlineItem, logicalHeight);
- logicalRect.setHeight(logicalHeight);
+ adjustBaselineAndLineHeight(inlineItem, displayBox.marginBoxHeight());
+ logicalRect.setHeight(inlineItemContentHeight(inlineItem));
}
m_content->runs().append(std::make_unique<Content::Run>(inlineItem, logicalRect, Content::Run::TextContext { }, false, false));
@@ -320,7 +319,7 @@
}
}
-LayoutUnit Line::inlineItemHeight(const InlineItem& inlineItem) const
+LayoutUnit Line::inlineItemContentHeight(const InlineItem& inlineItem) const
{
ASSERT(!m_skipVerticalAligment);
auto& fontMetrics = inlineItem.style().fontMetrics();
@@ -332,16 +331,16 @@
auto& displayBox = m_layoutState.displayBoxForLayoutBox(layoutBox);
if (layoutBox.isFloatingPositioned())
- return displayBox.marginBox().height();
+ return displayBox.borderBoxHeight();
if (layoutBox.isReplaced())
- return displayBox.height();
+ return displayBox.borderBoxHeight();
if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
return fontMetrics.height() + displayBox.verticalBorder() + displayBox.verticalPadding().valueOr(0);
// Non-replaced inline box (e.g. inline-block)
- return displayBox.marginBox().height();
+ return displayBox.borderBoxHeight();
}
LineBox::Baseline Line::halfLeadingMetrics(const FontMetrics& fontMetrics, LayoutUnit lineLogicalHeight)
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (246474 => 246475)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-06-16 18:23:46 UTC (rev 246474)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-06-16 19:28:14 UTC (rev 246475)
@@ -122,7 +122,7 @@
void removeTrailingTrimmableContent();
void adjustBaselineAndLineHeight(const InlineItem&, LayoutUnit runHeight);
- LayoutUnit inlineItemHeight(const InlineItem&) const;
+ LayoutUnit inlineItemContentHeight(const InlineItem&) const;
bool isVisuallyEmpty() const;
const LayoutState& m_layoutState;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes