Title: [287440] trunk/Source/WebCore
- Revision
- 287440
- Author
- [email protected]
- Date
- 2021-12-25 12:55:09 -0800 (Sat, 25 Dec 2021)
Log Message
[LFC][IFC] Remove redundant InlineContentBreaker::shouldKeepEndOfLineWhitespace
https://bugs.webkit.org/show_bug.cgi?id=234668
Reviewed by Antti Koivisto.
This is in preparation for moving pre-wrap checking out of InlineContentBreaker.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
(WebCore::Layout::InlineContentBreaker::shouldKeepEndOfLineWhitespace const): Deleted.
* layout/formattingContexts/inline/InlineContentBreaker.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (287439 => 287440)
--- trunk/Source/WebCore/ChangeLog 2021-12-25 19:18:36 UTC (rev 287439)
+++ trunk/Source/WebCore/ChangeLog 2021-12-25 20:55:09 UTC (rev 287440)
@@ -1,5 +1,19 @@
2021-12-25 Alan Bujtas <[email protected]>
+ [LFC][IFC] Remove redundant InlineContentBreaker::shouldKeepEndOfLineWhitespace
+ https://bugs.webkit.org/show_bug.cgi?id=234668
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for moving pre-wrap checking out of InlineContentBreaker.
+
+ * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+ (WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
+ (WebCore::Layout::InlineContentBreaker::shouldKeepEndOfLineWhitespace const): Deleted.
+ * layout/formattingContexts/inline/InlineContentBreaker.h:
+
+2021-12-25 Alan Bujtas <[email protected]>
+
[LFC][IFC] Fully collapsible whitespace content should always stay on the current line
https://bugs.webkit.org/show_bug.cgi?id=234667
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (287439 => 287440)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-12-25 19:18:36 UTC (rev 287439)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-12-25 20:55:09 UTC (rev 287440)
@@ -130,16 +130,6 @@
{
}
-bool InlineContentBreaker::shouldKeepEndOfLineWhitespace(const ContinuousContent& continuousContent) const
-{
- // Grab the style and check for white-space property to decide whether we should let this whitespace content overflow the current line.
- // Note that the "keep" in this context means we let the whitespace content sit on the current line.
- // It might very well get collapsed when we close the line (normal/nowrap/pre-line).
- // See https://www.w3.org/TR/css-text-3/#white-space-property
- auto whitespace = continuousContent.runs()[*firstTextRunIndex(continuousContent)].style.whiteSpace();
- return whitespace == WhiteSpace::Normal || whitespace == WhiteSpace::NoWrap || whitespace == WhiteSpace::PreWrap || whitespace == WhiteSpace::PreLine;
-}
-
InlineContentBreaker::Result InlineContentBreaker::processInlineContent(const ContinuousContent& candidateContent, const LineStatus& lineStatus)
{
ASSERT(!std::isnan(lineStatus.availableWidth));
@@ -174,7 +164,7 @@
return InlineContentBreaker::Result { Result::Action::Keep };
} else {
auto spaceRequired = continuousContent.logicalWidth() - continuousContent.trailingCollapsibleWidth();
- if (lineStatus.hasFullyCollapsibleTrailingContent)
+ if (lineStatus.hasFullyCollapsibleTrailingContent || isVisuallyEmptyWhitespaceContent(continuousContent))
spaceRequired -= continuousContent.leadingCollapsibleWidth();
if (spaceRequired <= lineStatus.availableWidth)
return InlineContentBreaker::Result { Result::Action::Keep };
@@ -188,10 +178,14 @@
if (continuousContent.logicalWidth() <= lineStatus.availableWidth + lineStatus.collapsibleOrHangingWidth)
return InlineContentBreaker::Result { Result::Action::Keep };
}
- if (isVisuallyEmptyWhitespaceContent(continuousContent) && shouldKeepEndOfLineWhitespace(continuousContent)) {
+
+ if (isVisuallyEmptyWhitespaceContent(continuousContent)) {
// This overflowing content apparently falls into the remove/hang end-of-line-spaces category.
// see https://www.w3.org/TR/css-text-3/#white-space-property matrix
- return InlineContentBreaker::Result { Result::Action::Keep };
+
+ // FIXME: Replace it with a hanging flag on the continuous content.
+ if (continuousContent.runs()[*firstTextRunIndex(continuousContent)].style.whiteSpace() == WhiteSpace::PreWrap)
+ return InlineContentBreaker::Result { Result::Action::Keep };
}
return { };
};
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h (287439 => 287440)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h 2021-12-25 19:18:36 UTC (rev 287439)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h 2021-12-25 20:55:09 UTC (rev 287440)
@@ -151,7 +151,6 @@
AtHyphenationOpportunities = 1 << 2
};
OptionSet<WordBreakRule> wordBreakBehavior(const RenderStyle&, bool hasWrapOpportunityAtPreviousPosition) const;
- bool shouldKeepEndOfLineWhitespace(const ContinuousContent&) const;
bool isInIntrinsicWidthMode() const { return !!m_intrinsicWidthMode; }
std::optional<IntrinsicWidthMode> m_intrinsicWidthMode;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes