Title: [268950] trunk/Source/WebCore
- Revision
- 268950
- Author
- za...@apple.com
- Date
- 2020-10-24 06:22:44 -0700 (Sat, 24 Oct 2020)
Log Message
[LFC][IFC] Negative margin start pulls the replaced box to logical left direction
https://bugs.webkit.org/show_bug.cgi?id=218147
Reviewed by Antti Koivisto.
Account for negative margin start when computing the logical left position on the line.
This patch fixes LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/multicol-inherit-002-expected.xht.
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::appendNonReplacedInlineBox):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::inlineItemWidth const):
(WebCore::Layout::LineBuilder::nextContentForLine):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (268949 => 268950)
--- trunk/Source/WebCore/ChangeLog 2020-10-24 13:18:55 UTC (rev 268949)
+++ trunk/Source/WebCore/ChangeLog 2020-10-24 13:22:44 UTC (rev 268950)
@@ -1,5 +1,21 @@
2020-10-24 Zalan Bujtas <za...@apple.com>
+ [LFC][IFC] Negative margin start pulls the replaced box to logical left direction
+ https://bugs.webkit.org/show_bug.cgi?id=218147
+
+ Reviewed by Antti Koivisto.
+
+ Account for negative margin start when computing the logical left position on the line.
+ This patch fixes LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/multicol-inherit-002-expected.xht.
+
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::appendNonReplacedInlineBox):
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::inlineItemWidth const):
+ (WebCore::Layout::LineBuilder::nextContentForLine):
+
+2020-10-24 Zalan Bujtas <za...@apple.com>
+
[LFC] BoxGeometry logicalWidth/Height/Rect functions are confusing
https://bugs.webkit.org/show_bug.cgi?id=218145
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (268949 => 268950)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-10-24 13:18:55 UTC (rev 268949)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-10-24 13:22:44 UTC (rev 268950)
@@ -316,11 +316,11 @@
void Line::appendNonReplacedInlineBox(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
- auto& layoutBox = inlineItem.layoutBox();
- auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
- auto horizontalMargin = boxGeometry.horizontalMargin();
- m_runs.append({ inlineItem, contentLogicalWidth() + horizontalMargin.start, logicalWidth });
- m_contentLogicalWidth += logicalWidth + horizontalMargin.start + horizontalMargin.end;
+ auto& boxGeometry = formattingContext().geometryForBox(inlineItem.layoutBox());
+ // Negative margin start pulls the content to the logical left direction.
+ auto adjustedContentStart = contentLogicalWidth() + std::min(boxGeometry.marginStart(), 0_lu);
+ m_runs.append({ inlineItem, adjustedContentStart, logicalWidth });
+ m_contentLogicalWidth += logicalWidth;
m_trimmableTrailingContent.reset();
m_trailingSoftHyphenWidth = { };
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (268949 => 268950)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-24 13:18:55 UTC (rev 268949)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-24 13:22:44 UTC (rev 268950)
@@ -241,7 +241,7 @@
return boxGeometry.marginBoxWidth();
if (layoutBox.isReplacedBox())
- return boxGeometry.borderBoxWidth();
+ return boxGeometry.marginBoxWidth();
if (inlineItem.isContainerStart())
return boxGeometry.marginStart() + boxGeometry.borderLeft() + boxGeometry.paddingLeft().valueOr(0);
@@ -250,7 +250,7 @@
return boxGeometry.marginEnd() + boxGeometry.borderRight() + boxGeometry.paddingRight().valueOr(0);
// Non-replaced inline box (e.g. inline-block)
- return boxGeometry.borderBoxWidth();
+ return boxGeometry.marginBoxWidth();
}
LineBuilder::LineBuilder(const InlineFormattingContext& inlineFormattingContext, const FloatingContext& floatingContext, const ContainerBox& formattingContextRoot, const InlineItems& inlineItems)
@@ -475,10 +475,10 @@
continue;
}
if (inlineItem.isText() || inlineItem.isContainerStart() || inlineItem.isContainerEnd() || inlineItem.isBox()) {
- auto inlineItenmWidth = inlineItemWidth(inlineItem, currentLogicalRight);
- lineCandidate.inlineContent.appendInlineItem(inlineItem, inlineItenmWidth);
- currentLogicalRight += inlineItenmWidth;
- accumulatedWidth += inlineItenmWidth;
+ auto logicalWidth = inlineItemWidth(inlineItem, currentLogicalRight);
+ lineCandidate.inlineContent.appendInlineItem(inlineItem, logicalWidth);
+ currentLogicalRight += logicalWidth;
+ accumulatedWidth += logicalWidth;
continue;
}
if (inlineItem.isWordBreakOpportunity()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes