Modified: trunk/Source/WebCore/ChangeLog (266780 => 266781)
--- trunk/Source/WebCore/ChangeLog 2020-09-09 14:55:22 UTC (rev 266780)
+++ trunk/Source/WebCore/ChangeLog 2020-09-09 15:16:19 UTC (rev 266781)
@@ -1,5 +1,25 @@
2020-09-09 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Line should not know about floats
+ https://bugs.webkit.org/show_bug.cgi?id=216278
+
+ Reviewed by Antti Koivisto.
+
+ Floats are not part of the line (they only constrain the horizontal space).
+
+ * layout/inlineformatting/InlineLine.h:
+ (WebCore::Layout::Line::setHasIntrusiveFloat): Deleted.
+ (WebCore::Layout::Line::hasIntrusiveFloat const): Deleted.
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::layoutInlineContent):
+ (WebCore::Layout::LineBuilder::initialize):
+ (WebCore::Layout::LineBuilder::close):
+ (WebCore::Layout::LineBuilder::commitFloats):
+ (WebCore::Layout::LineBuilder::handleFloatsAndInlineContent):
+ * layout/inlineformatting/InlineLineBuilder.h:
+
+2020-09-09 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Line::lineLogicalWidth is really the horizontal constraint value
https://bugs.webkit.org/show_bug.cgi?id=216277
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (266780 => 266781)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-09-09 14:55:22 UTC (rev 266780)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-09-09 15:16:19 UTC (rev 266781)
@@ -46,9 +46,6 @@
void close(bool isLastLineWithInlineContent);
void clearContent();
- void setHasIntrusiveFloat(bool hasIntrusiveFloat) { m_hasIntrusiveFloat = hasIntrusiveFloat; }
- bool hasIntrusiveFloat() const { return m_hasIntrusiveFloat; }
-
void append(const InlineItem&, InlineLayoutUnit logicalWidth);
void appendPartialTrailingTextItem(const InlineTextItem&, InlineLayoutUnit logicalWidth, bool needsHypen);
@@ -181,7 +178,6 @@
InlineLayoutUnit m_lineLogicalLeft { 0 };
InlineLayoutUnit m_horizontalConstraint { 0 };
InlineLayoutUnit m_contentLogicalWidth { 0 };
- bool m_hasIntrusiveFloat { false };
bool m_isVisuallyEmpty { true };
Optional<bool> m_lineIsVisuallyEmptyBeforeTrimmableTrailingContent;
bool m_shouldIgnoreTrailingLetterSpacing { false };
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (266780 => 266781)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-09-09 14:55:22 UTC (rev 266780)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-09-09 15:16:19 UTC (rev 266781)
@@ -301,7 +301,7 @@
auto lineLogicalTopLeft = InlineLayoutPoint { usedConstraints.logicalLeft, initialConstraints.vertical.logicalTop };
auto isLastLine = isLastLineWithInlineContent(committedRange, needsLayoutRange.end, committedContent.partialTrailingContent.hasValue());
auto lineIsVisuallyEmpty = m_line.isVisuallyEmpty() ? LineBox::IsLineVisuallyEmpty::Yes : LineBox::IsLineVisuallyEmpty::No;
- return LineContent { committedContent.partialTrailingContent, committedRange, m_floats, m_line.hasIntrusiveFloat()
+ return LineContent { committedContent.partialTrailingContent, committedRange, m_floats, m_contentIsConstrainedByFloat
, lineLogicalTopLeft
, m_line.horizontalConstraint()
, LineBox { formattingContext(), m_line.horizontalConstraint(), m_line.contentLogicalWidth(), m_line.runs(), lineIsVisuallyEmpty
@@ -324,7 +324,7 @@
m_lastWrapOpportunityItem = { };
m_line.open(lineConstraints.availableLogicalWidth);
- m_line.setHasIntrusiveFloat(lineConstraints.isConstrainedByFloat);
+ m_contentIsConstrainedByFloat = lineConstraints.isConstrainedByFloat;
}
LineBuilder::CommittedContent LineBuilder::placeInlineContent(const InlineItemRange& needsLayoutRange, Optional<unsigned> partialLeadingContentLength)
@@ -366,7 +366,7 @@
LineBuilder::InlineItemRange LineBuilder::close(const InlineItemRange& needsLayoutRange, const CommittedContent& committedContent)
{
- ASSERT(committedContent.inlineItemCount || !m_floats.isEmpty() || m_line.hasIntrusiveFloat());
+ ASSERT(committedContent.inlineItemCount || !m_floats.isEmpty() || m_contentIsConstrainedByFloat);
auto numberOfCommittedItems = committedContent.inlineItemCount + m_floats.size();
auto trailingInlineItemIndex = needsLayoutRange.start + numberOfCommittedItems - 1;
auto lineRange = InlineItemRange { needsLayoutRange.start, trailingInlineItemIndex + 1 };
@@ -500,7 +500,6 @@
auto& floatContent = lineCandidate.floatContent;
auto leftIntrusiveFloatsWidth = InlineLayoutUnit { };
auto rightIntrusiveFloatsWidth = InlineLayoutUnit { };
- auto hasIntrusiveFloat = false;
for (auto& floatCandidate : floatContent.list()) {
if (!floatCandidate.isIntrusive && commitIntrusiveOnly == CommitIntrusiveFloatsOnly::Yes)
@@ -507,7 +506,7 @@
continue;
m_floats.append({ floatCandidate.isIntrusive, floatCandidate.item });
if (floatCandidate.isIntrusive) {
- hasIntrusiveFloat = true;
+ m_contentIsConstrainedByFloat = true;
// This float is intrusive and it shrinks the current line.
// Shrink available space for current line.
if (floatCandidate.item->layoutBox().isLeftFloatingPositioned())
@@ -516,7 +515,6 @@
rightIntrusiveFloatsWidth += floatCandidate.logicalWidth;
}
}
- m_line.setHasIntrusiveFloat(hasIntrusiveFloat);
if (leftIntrusiveFloatsWidth || rightIntrusiveFloatsWidth) {
if (leftIntrusiveFloatsWidth)
m_line.moveLogicalLeft(leftIntrusiveFloatsWidth);
@@ -545,7 +543,7 @@
auto& floatContent = lineCandidate.floatContent;
// Check if this new content fits.
auto availableWidth = m_line.availableWidth() - floatContent.intrusiveWidth();
- auto isLineConsideredEmpty = m_line.isVisuallyEmpty() && !m_line.hasIntrusiveFloat();
+ auto isLineConsideredEmpty = m_line.isVisuallyEmpty() && !m_contentIsConstrainedByFloat;
auto lineStatus = LineBreaker::LineStatus { availableWidth, m_line.trimmableTrailingWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
auto result = lineBreaker.shouldWrapInlineContent(candidateRuns, inlineContent.logicalWidth(), lineStatus);
if (result.lastWrapOpportunityItem)
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (266780 => 266781)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-09-09 14:55:22 UTC (rev 266780)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-09-09 15:16:19 UTC (rev 266781)
@@ -120,6 +120,7 @@
Optional<InlineTextItem> m_partialLeadingTextItem;
const InlineItem* m_lastWrapOpportunityItem { nullptr };
unsigned m_successiveHyphenatedLineCount { 0 };
+ bool m_contentIsConstrainedByFloat { false };
};
}