Title: [270228] trunk/Source/WebCore
- Revision
- 270228
- Author
- [email protected]
- Date
- 2020-11-29 11:10:00 -0800 (Sun, 29 Nov 2020)
Log Message
[LFC][IFC] Remove LineBuilder::availableWidth
https://bugs.webkit.org/show_bug.cgi?id=219330
Reviewed by Antti Koivisto.
There is no "global" available width while building the line. It may very well change as
inline level boxes stretch the line and additional floats turn to intrusive.
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):
(WebCore::Layout::LineBuilder::handleFloatOrInlineContent):
(WebCore::Layout::LineBuilder::rebuildLineForTrailingSoftHyphen):
* layout/inlineformatting/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::availableWidth const): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (270227 => 270228)
--- trunk/Source/WebCore/ChangeLog 2020-11-29 18:46:55 UTC (rev 270227)
+++ trunk/Source/WebCore/ChangeLog 2020-11-29 19:10:00 UTC (rev 270228)
@@ -1,5 +1,22 @@
2020-11-29 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Remove LineBuilder::availableWidth
+ https://bugs.webkit.org/show_bug.cgi?id=219330
+
+ Reviewed by Antti Koivisto.
+
+ There is no "global" available width while building the line. It may very well change as
+ inline level boxes stretch the line and additional floats turn to intrusive.
+
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::close):
+ (WebCore::Layout::LineBuilder::handleFloatOrInlineContent):
+ (WebCore::Layout::LineBuilder::rebuildLineForTrailingSoftHyphen):
+ * layout/inlineformatting/InlineLineBuilder.h:
+ (WebCore::Layout::LineBuilder::availableWidth const): Deleted.
+
+2020-11-29 Zalan Bujtas <[email protected]>
+
[LFC][IFC] FloatingContext should take const FloatingState&
https://bugs.webkit.org/show_bug.cgi?id=219331
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (270227 => 270228)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-11-29 18:46:55 UTC (rev 270227)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-11-29 19:10:00 UTC (rev 270228)
@@ -331,11 +331,12 @@
// Line is empty, we only managed to place float boxes.
return lineRange;
}
- m_line.removeCollapsibleContent(availableWidth());
+ auto availableWidth = m_horizontalSpaceForLine - m_line.contentLogicalWidth();
+ m_line.removeCollapsibleContent(availableWidth);
auto horizontalAlignment = root().style().textAlign();
auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
if (runsExpandHorizontally)
- m_line.applyRunExpansion(availableWidth());
+ m_line.applyRunExpansion(m_horizontalSpaceForLine - m_line.contentLogicalWidth());
auto lineEndsWithHyphen = false;
if (!m_line.isConsideredEmpty()) {
ASSERT(!m_line.runs().isEmpty());
@@ -530,9 +531,10 @@
ASSERT(inlineContent.trailingLineBreak() || inlineContent.trailingWordBreakOpportunity());
return { inlineContent.trailingLineBreak() ? InlineContentBreaker::IsEndOfLine::Yes : InlineContentBreaker::IsEndOfLine::No };
}
+ auto availableWidth = m_horizontalSpaceForLine - m_line.contentLogicalWidth();
if (lineCandidate.floatItem) {
auto floatBoxWidth = inlineItemWidth(*lineCandidate.floatItem, { });
- if (floatBoxWidth > availableWidth() && !m_line.isConsideredEmpty())
+ if (floatBoxWidth > availableWidth && !m_line.isConsideredEmpty())
return { InlineContentBreaker::IsEndOfLine::Yes };
// This float shrinks the current line.
auto& floatBox = lineCandidate.floatItem->layoutBox();
@@ -555,7 +557,7 @@
// Check if this new content fits.
auto& continuousInlineContent = lineCandidate.inlineContent();
auto isLineConsideredEmpty = m_line.isConsideredEmpty() && !m_contentIsConstrainedByFloat;
- auto lineStatus = InlineContentBreaker::LineStatus { m_line.contentLogicalWidth(), availableWidth(), m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
+ auto lineStatus = InlineContentBreaker::LineStatus { m_line.contentLogicalWidth(), availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
auto result = inlineContentBreaker.processInlineContent(continuousInlineContent, lineStatus);
if (result.lastWrapOpportunityItem)
m_wrapOpportunityList.append(result.lastWrapOpportunityItem);
@@ -666,9 +668,10 @@
// FIXME: If this turns out to be a perf issue, we could also traverse the wrap list and keep adding the items
// while watching the available width very closely.
auto committedCount = rebuildLine(layoutRange, softWrapOpportunityItem);
+ auto availableWidth = m_horizontalSpaceForLine - m_line.contentLogicalWidth();
auto trailingSoftHyphenWidth = m_line.trailingSoftHyphenWidth();
// Check if the trailing hyphen now fits the line (or we don't need hyhen anymore).
- if (!trailingSoftHyphenWidth || trailingSoftHyphenWidth <= availableWidth()) {
+ if (!trailingSoftHyphenWidth || trailingSoftHyphenWidth <= availableWidth) {
if (trailingSoftHyphenWidth)
m_line.addTrailingHyphen(*trailingSoftHyphenWidth);
return committedCount;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (270227 => 270228)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-11-29 18:46:55 UTC (rev 270227)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-11-29 19:10:00 UTC (rev 270228)
@@ -101,7 +101,6 @@
InlineLayoutUnit inlineItemWidth(const InlineItem&, InlineLayoutUnit contentLogicalLeft) const;
bool isLastLineWithInlineContent(const InlineItemRange& lineRange, size_t lastInlineItemIndex, bool hasPartialTrailingContent) const;
- InlineLayoutUnit availableWidth() const { return m_horizontalSpaceForLine - m_line.contentLogicalWidth(); }
const InlineFormattingContext& formattingContext() const { return m_inlineFormattingContext; }
const ContainerBox& root() const { return m_formattingContextRoot; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes