Title: [267922] trunk/Source/WebCore
- Revision
- 267922
- Author
- [email protected]
- Date
- 2020-10-03 07:39:32 -0700 (Sat, 03 Oct 2020)
Log Message
[LFC][IFC][Soft hyphen] Do not split InlineItems at soft hyphens when hyphenations is disabled
https://bugs.webkit.org/show_bug.cgi?id=217266
Reviewed by Antti Koivisto.
-webkit-hyphens: none; disables hyphenation. Soft hyphens are not wrap opportunities anymore.
<div>1­2­3­4</div> generates one InlineTextItem: [1­2­3­4].
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (267921 => 267922)
--- trunk/Source/WebCore/ChangeLog 2020-10-03 14:01:27 UTC (rev 267921)
+++ trunk/Source/WebCore/ChangeLog 2020-10-03 14:39:32 UTC (rev 267922)
@@ -1,5 +1,18 @@
2020-10-03 Zalan Bujtas <[email protected]>
+ [LFC][IFC][Soft hyphen] Do not split InlineItems at soft hyphens when hyphenations is disabled
+ https://bugs.webkit.org/show_bug.cgi?id=217266
+
+ Reviewed by Antti Koivisto.
+
+ -webkit-hyphens: none; disables hyphenation. Soft hyphens are not wrap opportunities anymore.
+ <div>1­2­3­4</div> generates one InlineTextItem: [1­2­3­4].
+
+ * layout/inlineformatting/InlineTextItem.cpp:
+ (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+
+2020-10-03 Zalan Bujtas <[email protected]>
+
[LFC][IFC][Soft hyphen] LineBuilder should hold on to all the wrap opportunities
https://bugs.webkit.org/show_bug.cgi?id=217265
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (267921 => 267922)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-10-03 14:01:27 UTC (rev 267921)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-10-03 14:39:32 UTC (rev 267922)
@@ -114,11 +114,30 @@
continue;
}
- auto length = moveToNextBreakablePosition(currentPosition, lineBreakIterator, style);
- ASSERT(length);
- auto hasTrailingSoftHyphen = text[currentPosition + length - 1] == softHyphen;
- inlineContent.append(InlineTextItem::createNonWhitespaceItem(inlineTextBox, currentPosition, length, hasTrailingSoftHyphen, inlineItemWidth(currentPosition, length)));
- currentPosition += length;
+ auto hasTrailingSoftHyphen = false;
+ auto initialNonWhitespacePosition = currentPosition;
+ auto isAtSoftHyphen = [&](auto position) {
+ return text[position] == softHyphen;
+ };
+ if (style.hyphens() == Hyphens::None) {
+ // Let's merge candidate InlineTextItems separated by soft hyphen when the style says so.
+ while (currentPosition < text.length()) {
+ auto nonWhiteSpaceLength = moveToNextBreakablePosition(currentPosition, lineBreakIterator, style);
+ ASSERT(nonWhiteSpaceLength);
+ currentPosition += nonWhiteSpaceLength;
+ if (!isAtSoftHyphen(currentPosition - 1))
+ break;
+ }
+ } else {
+ auto nonWhiteSpaceLength = moveToNextBreakablePosition(initialNonWhitespacePosition, lineBreakIterator, style);
+ ASSERT(nonWhiteSpaceLength);
+ currentPosition += nonWhiteSpaceLength;
+ hasTrailingSoftHyphen = isAtSoftHyphen(currentPosition - 1);
+ }
+ ASSERT(initialNonWhitespacePosition < currentPosition);
+ ASSERT_IMPLIES(style.hyphens() == Hyphens::None, !hasTrailingSoftHyphen);
+ auto length = currentPosition - initialNonWhitespacePosition;
+ inlineContent.append(InlineTextItem::createNonWhitespaceItem(inlineTextBox, initialNonWhitespacePosition, length, hasTrailingSoftHyphen, inlineItemWidth(initialNonWhitespacePosition, length)));
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes