Diff
Modified: trunk/Source/WebCore/ChangeLog (273637 => 273638)
--- trunk/Source/WebCore/ChangeLog 2021-02-28 19:42:46 UTC (rev 273637)
+++ trunk/Source/WebCore/ChangeLog 2021-02-28 19:58:22 UTC (rev 273638)
@@ -1,3 +1,25 @@
+2021-02-28 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] LineBox's horizontalAlignmentOffset is the root inline box's logical left
+ https://bugs.webkit.org/show_bug.cgi?id=222521
+
+ Reviewed by Sam Weinig.
+
+ That's where the line content starts.
+
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ * layout/inlineformatting/InlineLineBox.cpp:
+ (WebCore::Layout::m_contentLogicalWidth):
+ (WebCore::Layout::LineBox::logicalRectForTextRun const):
+ (WebCore::Layout::m_horizontalAlignmentOffset): Deleted.
+ * layout/inlineformatting/InlineLineBox.h:
+ (WebCore::Layout::LineBox::setLogicalHeight):
+ (WebCore::Layout::LineBox::horizontalAlignmentOffset const): Deleted.
+ (WebCore::Layout::LineBox::setHorizontalAlignmentOffset): Deleted.
+
2021-02-28 Sam Weinig <[email protected]>
Consider removing support for CSS value keywords with the -khtml- prefix
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (273637 => 273638)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2021-02-28 19:42:46 UTC (rev 273637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2021-02-28 19:58:22 UTC (rev 273638)
@@ -585,7 +585,7 @@
updateBoxGeometryForInlineBoxes();
auto constructLineGeometry = [&] {
- formattingState.addLine({ lineBoxLogicalRect, enclosingTopAndBottom, lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth });
+ formattingState.addLine({ lineBoxLogicalRect, enclosingTopAndBottom, lineBox.alignmentBaseline(), rootInlineBoxLogicalRect.left(), lineContent.contentLogicalWidth });
};
constructLineGeometry();
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (273637 => 273638)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-02-28 19:42:46 UTC (rev 273637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-02-28 19:58:22 UTC (rev 273638)
@@ -202,7 +202,6 @@
void LineBoxBuilder::constructInlineLevelBoxes(LineBox& lineBox, const Line::RunList& runs)
{
- auto horizontalAligmentOffset = lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { });
struct SimplifiedVerticalAlignment {
InlineLayoutUnit lineBoxTop { 0 };
InlineLayoutUnit lineBoxBottom { 0 };
@@ -241,7 +240,7 @@
}
// Construct the missing LineBox::InlineBoxes starting with the topmost layout box.
for (auto* layoutBox : WTF::makeReversedRange(layoutBoxesWithoutInlineBoxes)) {
- auto inlineBox = LineBox::InlineLevelBox::createInlineBox(*layoutBox, horizontalAligmentOffset, lineBox.contentLogicalWidth());
+ auto inlineBox = LineBox::InlineLevelBox::createInlineBox(*layoutBox, rootInlineBox.logicalLeft(), lineBox.contentLogicalWidth());
setVerticalGeometryForInlineBox(*inlineBox);
lineBox.addInlineLevelBox(WTFMove(inlineBox));
}
@@ -268,7 +267,7 @@
};
lineHasContent = lineHasContent || runHasContent();
- auto logicalLeft = horizontalAligmentOffset + run.logicalLeft();
+ auto logicalLeft = rootInlineBox.logicalLeft() + run.logicalLeft();
if (run.isBox()) {
auto& inlineLevelBoxGeometry = formattingContext().geometryForBox(layoutBox);
auto marginBoxHeight = inlineLevelBoxGeometry.marginBoxHeight();
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp (273637 => 273638)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp 2021-02-28 19:42:46 UTC (rev 273637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp 2021-02-28 19:58:22 UTC (rev 273638)
@@ -86,7 +86,6 @@
LineBox::LineBox(const Box& rootLayoutBox, const InlineLayoutPoint& logicalTopleft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalWidth, Optional<InlineLayoutUnit> horizontalAlignmentOffset, size_t numberOfRuns)
: m_logicalRect(logicalTopleft, InlineLayoutSize { lineLogicalWidth, { } })
, m_contentLogicalWidth(contentLogicalWidth)
- , m_horizontalAlignmentOffset(horizontalAlignmentOffset)
, m_rootInlineBox(makeUniqueRef<LineBox::InlineLevelBox>(rootLayoutBox, horizontalAlignmentOffset.valueOr(InlineLayoutUnit { }), InlineLayoutSize { contentLogicalWidth, { } }, InlineLevelBox::Type::RootInlineBox))
{
m_nonRootInlineLevelBoxList.reserveInitialCapacity(numberOfRuns);
@@ -115,7 +114,7 @@
runlogicalTop += parentInlineBox->logicalTop();
}
InlineLayoutUnit logicalHeight = fontMetrics.height();
- return { runlogicalTop, m_horizontalAlignmentOffset.valueOr(InlineLayoutUnit { }) + run.logicalLeft(), run.logicalWidth(), logicalHeight };
+ return { runlogicalTop, m_rootInlineBox->logicalLeft() + run.logicalLeft(), run.logicalWidth(), logicalHeight };
}
InlineRect LineBox::logicalRectForLineBreakBox(const Box& layoutBox) const
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h (273637 => 273638)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2021-02-28 19:42:46 UTC (rev 273637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2021-02-28 19:58:22 UTC (rev 273638)
@@ -140,8 +140,6 @@
InlineLayoutSize logicalSize() const { return logicalRect().size(); }
InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
- Optional<InlineLayoutUnit> horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
-
// Note that the line can have many inline boxes and be "empty" the same time e.g. <div><span></span><span></span></div>
bool hasContent() const { return m_hasContent; }
bool hasInlineBox() const { return m_boxTypes.contains(InlineLevelBox::Type::InlineBox); }
@@ -166,7 +164,6 @@
friend class LineBoxBuilder;
void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_logicalRect.setHeight(logicalHeight); }
- void setHorizontalAlignmentOffset(InlineLayoutUnit horizontalAlignmentOffset) { m_horizontalAlignmentOffset = horizontalAlignmentOffset; }
void addInlineLevelBox(std::unique_ptr<InlineLevelBox>&&);
@@ -181,7 +178,6 @@
InlineRect m_logicalRect;
InlineLayoutUnit m_contentLogicalWidth { 0 };
bool m_hasContent { false };
- Optional<InlineLayoutUnit> m_horizontalAlignmentOffset;
OptionSet<InlineLevelBox::Type> m_boxTypes;
UniqueRef<InlineLevelBox> m_rootInlineBox;