Diff
Modified: trunk/Source/WebCore/ChangeLog (270735 => 270736)
--- trunk/Source/WebCore/ChangeLog 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/ChangeLog 2020-12-12 18:40:45 UTC (rev 270736)
@@ -1,3 +1,24 @@
+2020-12-12 Zalan Bujtas <[email protected]>
+
+ REGRESSION(r270715) [LFC][IFC] Whitespace as expansion opportunity should not change as we expand the runs
+ https://bugs.webkit.org/show_bug.cgi?id=219826
+
+ Reviewed by Antti Koivisto.
+
+ This is the property of the entire run and should be set based on the box and whether the initial part of the run
+ is whitespace or not.
+
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::Run::Run):
+ (WebCore::Layout::Line::Run::expand):
+ (WebCore::Layout::Line::Run::visuallyCollapseTrailingWhitespace):
+ * layout/inlineformatting/InlineLine.h:
+ * layout/inlineformatting/InlineTextItem.cpp:
+ (WebCore::Layout::InlineTextItem::shouldPreserveSpacesAndTabs):
+ * layout/inlineformatting/text/TextUtil.cpp:
+ (WebCore::Layout::TextUtil::shouldPreserveSpacesAndTabs):
+ * layout/inlineformatting/text/TextUtil.h:
+
2020-12-11 Peng Liu <[email protected]>
[Media in GPU Process][MSE] Implement SourceBuffer::reportExtraMemoryAllocated()
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (270735 => 270736)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-12-12 18:40:45 UTC (rev 270736)
@@ -472,13 +472,13 @@
, m_layoutBox(&inlineTextItem.layoutBox())
, m_logicalLeft(logicalLeft)
, m_logicalWidth(logicalWidth)
- , m_shouldPreserveWhitespace(inlineTextItem.isWhitespace() && InlineTextItem::shouldPreserveSpacesAndTabs(inlineTextItem))
+ , m_whitespaceIsExpansionOpportunity(!TextUtil::shouldPreserveSpacesAndTabs(inlineTextItem.layoutBox()))
, m_trailingWhitespaceType(trailingWhitespaceType(inlineTextItem))
, m_textContent({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length(), inlineTextItem.inlineTextBox().content() })
{
if (m_trailingWhitespaceType != TrailingWhitespace::None) {
m_trailingWhitespaceWidth = logicalWidth;
- if (!m_shouldPreserveWhitespace)
+ if (m_whitespaceIsExpansionOpportunity)
m_expansionOpportunityCount = 1;
}
}
@@ -500,7 +500,7 @@
return;
}
m_trailingWhitespaceWidth += logicalWidth;
- if (!InlineTextItem::shouldPreserveSpacesAndTabs(inlineTextItem))
+ if (m_whitespaceIsExpansionOpportunity)
++m_expansionOpportunityCount;
setExpansionBehavior(DefaultExpansion);
m_textContent->expand(m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length());
@@ -542,7 +542,7 @@
m_trailingWhitespaceWidth = { };
m_trailingWhitespaceType = TrailingWhitespace::None;
- if (!m_shouldPreserveWhitespace) {
+ if (m_whitespaceIsExpansionOpportunity) {
ASSERT(m_expansionOpportunityCount);
m_expansionOpportunityCount--;
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (270735 => 270736)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-12-12 18:40:45 UTC (rev 270736)
@@ -124,7 +124,7 @@
const Box* m_layoutBox { nullptr };
InlineLayoutUnit m_logicalLeft { 0 };
InlineLayoutUnit m_logicalWidth { 0 };
- bool m_shouldPreserveWhitespace { false };
+ bool m_whitespaceIsExpansionOpportunity { false };
TrailingWhitespace m_trailingWhitespaceType { TrailingWhitespace::None };
InlineLayoutUnit m_trailingWhitespaceWidth { 0 };
Optional<LineRun::Text> m_textContent;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (270735 => 270736)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-12-12 18:40:45 UTC (rev 270736)
@@ -160,8 +160,7 @@
bool InlineTextItem::shouldPreserveSpacesAndTabs(const InlineTextItem& inlineTextItem)
{
ASSERT(inlineTextItem.isWhitespace());
- auto whitespace = inlineTextItem.style().whiteSpace();
- return whitespace == WhiteSpace::Pre || whitespace == WhiteSpace::PreWrap || whitespace == WhiteSpace::BreakSpaces;
+ return TextUtil::shouldPreserveSpacesAndTabs(inlineTextItem.layoutBox());
}
}
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (270735 => 270736)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2020-12-12 18:40:45 UTC (rev 270736)
@@ -161,6 +161,12 @@
return nextBreakablePositionIgnoringNBSPWithoutShortcut(lineBreakIterator, startPosition);
}
+bool TextUtil::shouldPreserveSpacesAndTabs(const Box& layoutBox)
+{
+ auto whitespace = layoutBox.style().whiteSpace();
+ return whitespace == WhiteSpace::Pre || whitespace == WhiteSpace::PreWrap || whitespace == WhiteSpace::BreakSpaces;
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h (270735 => 270736)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2020-12-12 13:36:33 UTC (rev 270735)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2020-12-12 18:40:45 UTC (rev 270736)
@@ -54,6 +54,8 @@
static SplitData split(const InlineTextItem&, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft);
static unsigned findNextBreakablePosition(LazyLineBreakIterator&, unsigned startPosition, const RenderStyle&);
+ static bool shouldPreserveSpacesAndTabs(const Box&);
+
private:
static InlineLayoutUnit fixedPitchWidth(const StringView&, const RenderStyle&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft);
};