Diff
Modified: trunk/Source/WebCore/ChangeLog (281305 => 281306)
--- trunk/Source/WebCore/ChangeLog 2021-08-20 10:16:50 UTC (rev 281305)
+++ trunk/Source/WebCore/ChangeLog 2021-08-20 12:34:51 UTC (rev 281306)
@@ -1,3 +1,25 @@
+2021-08-20 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Add support for -webkit-nbsp-mode: space
+ https://bugs.webkit.org/show_bug.cgi?id=228805
+
+ Reviewed by Antti Koivisto.
+
+ Treat non-breaking space as regular space.
+ TextUtil::findNextBreakablePosition already covers the "find the soft wrapping opportunity" part.
+
+ e.g.
+ <div style="-webkit-nbsp-mode: space">1 2</div>
+ produces 3 InlineTextItem objects as follows
+ [1][whitespace][2]
+ as opposed to just 1 [1non-breakable-space2]
+
+ * layout/formattingContexts/inline/InlineTextItem.cpp:
+ (WebCore::Layout::moveToNextNonWhitespacePosition):
+ (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+ * layout/integration/LayoutIntegrationCoverage.cpp:
+ (WebCore::LayoutIntegration::canUseForStyle):
+
2021-08-20 Philippe Normand <[email protected]>
REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp (281305 => 281306)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp 2021-08-20 10:16:50 UTC (rev 281305)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp 2021-08-20 12:34:51 UTC (rev 281306)
@@ -42,12 +42,12 @@
size_t length { 0 };
bool isWordSeparator { true };
};
-static std::optional<WhitespaceContent> moveToNextNonWhitespacePosition(const StringView& textContent, size_t startPosition, bool preserveNewline, bool preserveTab)
+static std::optional<WhitespaceContent> moveToNextNonWhitespacePosition(const StringView& textContent, size_t startPosition, bool preserveNewline, bool preserveTab, bool treatNonBreakingSpaceAsRegularSpace)
{
auto hasWordSeparatorCharacter = false;
auto isWhitespaceCharacter = [&](auto character) {
// white space processing in CSS affects only the document white space characters: spaces (U+0020), tabs (U+0009), and segment breaks.
- auto isTreatedAsSpaceCharacter = character == space || (character == newlineCharacter && !preserveNewline) || (character == tabCharacter && !preserveTab);
+ auto isTreatedAsSpaceCharacter = character == space || (character == newlineCharacter && !preserveNewline) || (character == tabCharacter && !preserveTab) || (character == noBreakSpace && treatNonBreakingSpaceAsRegularSpace);
hasWordSeparatorCharacter = hasWordSeparatorCharacter || isTreatedAsSpaceCharacter;
return isTreatedAsSpaceCharacter || character == tabCharacter;
};
@@ -81,6 +81,7 @@
auto& font = style.fontCascade();
auto whitespaceContentIsTreatedAsSingleSpace = !TextUtil::shouldPreserveSpacesAndTabs(inlineTextBox);
auto shouldPreserveNewline = TextUtil::shouldPreserveNewline(inlineTextBox);
+ auto shouldTreatNonBreakingSpaceAsRegularSpace = style.nbspMode() == NBSPMode::Space;
auto lineBreakIterator = LazyLineBreakIterator { text, style.computedLocale(), TextUtil::lineBreakIteratorMode(style.lineBreak()) };
unsigned currentPosition = 0;
@@ -102,7 +103,7 @@
continue;
}
- if (auto whitespaceContent = moveToNextNonWhitespacePosition(text, currentPosition, shouldPreserveNewline, !whitespaceContentIsTreatedAsSingleSpace)) {
+ if (auto whitespaceContent = moveToNextNonWhitespacePosition(text, currentPosition, shouldPreserveNewline, !whitespaceContentIsTreatedAsSingleSpace, shouldTreatNonBreakingSpaceAsRegularSpace)) {
ASSERT(whitespaceContent->length);
auto appendWhitespaceItem = [&] (auto startPosition, auto itemLength) {
auto simpleSingleWhitespaceContent = inlineTextBox.canUseSimplifiedContentMeasuring() && (itemLength == 1 || whitespaceContentIsTreatedAsSingleSpace);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (281305 => 281306)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-08-20 10:16:50 UTC (rev 281305)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-08-20 12:34:51 UTC (rev 281306)
@@ -132,9 +132,6 @@
case AvoidanceReason::FlowHasOverflowNotVisible:
stream << "overflow: hidden | scroll | auto";
break;
- case AvoidanceReason::FlowHasWebKitNBSPMode:
- stream << "-webkit-nbsp-mode: space";
- break;
case AvoidanceReason::FlowIsNotLTR:
stream << "dir is not LTR";
break;
@@ -581,8 +578,6 @@
SET_REASON_AND_RETURN_IF_NEEDED(FlowHasBorderFitLines, reasons, includeReasons);
if (style.lineBreak() != LineBreak::Auto)
SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonAutoLineBreak, reasons, includeReasons);
- if (style.nbspMode() != NBSPMode::Normal)
- SET_REASON_AND_RETURN_IF_NEEDED(FlowHasWebKitNBSPMode, reasons, includeReasons);
// Special handling of text-security:disc is not yet implemented in the simple line layout code path.
// See RenderBlock::updateSecurityDiscCharacters.
if (style.textSecurity() != TextSecurity::None)
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (281305 => 281306)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-08-20 10:16:50 UTC (rev 281305)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-08-20 12:34:51 UTC (rev 281306)
@@ -51,7 +51,7 @@
FlowHasUnsupportedUnderlineDecoration = 1LLU << 11,
FlowHasJustifiedNonLatinText = 1LLU << 12,
FlowHasOverflowNotVisible = 1LLU << 13,
- FlowHasWebKitNBSPMode = 1LLU << 14,
+ // Unused = 1LLU << 14,
FlowIsNotLTR = 1LLU << 15,
FlowHasLineBoxContainProperty = 1LLU << 16,
FlowIsNotTopToBottom = 1LLU << 17,