Title: [252869] trunk/Source/WebCore
- Revision
- 252869
- Author
- [email protected]
- Date
- 2019-11-25 16:28:18 -0800 (Mon, 25 Nov 2019)
Log Message
[LFC][IFC] Use FontCascade::spaceWidth to measure single or collapsed whitespace content
https://bugs.webkit.org/show_bug.cgi?id=204594
<rdar://problem/57478360>
Reviewed by Antti Koivisto.
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (252868 => 252869)
--- trunk/Source/WebCore/ChangeLog 2019-11-25 23:18:05 UTC (rev 252868)
+++ trunk/Source/WebCore/ChangeLog 2019-11-26 00:28:18 UTC (rev 252869)
@@ -1,3 +1,14 @@
+2019-11-25 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Use FontCascade::spaceWidth to measure single or collapsed whitespace content
+ https://bugs.webkit.org/show_bug.cgi?id=204594
+ <rdar://problem/57478360>
+
+ Reviewed by Antti Koivisto.
+
+ * layout/inlineformatting/InlineTextItem.cpp:
+ (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+
2019-11-25 Antti Koivisto <[email protected]>
User Variant for RenderBlockFlow line layout
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (252868 => 252869)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2019-11-25 23:18:05 UTC (rev 252868)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2019-11-26 00:28:18 UTC (rev 252869)
@@ -29,6 +29,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "BreakLines.h"
+#include "FontCascade.h"
namespace WebCore {
namespace Layout {
@@ -82,16 +83,18 @@
void InlineTextItem::createAndAppendTextItems(InlineItems& inlineContent, const Box& inlineBox)
{
- auto text = inlineBox.textContext()->content;
+ auto& textContext = *inlineBox.textContext();
+ auto text = textContext.content;
if (!text.length())
return inlineContent.append(InlineTextItem::createEmptyItem(inlineBox));
auto& style = inlineBox.style();
+ auto& font = style.fontCascade();
LazyLineBreakIterator lineBreakIterator(text);
unsigned currentPosition = 0;
auto inlineItemWidth = [&](auto startPosition, auto length) -> Optional<LayoutUnit> {
- if (!inlineBox.textContext()->canUseSimplifiedContentMeasuring)
+ if (!textContext.canUseSimplifiedContentMeasuring)
return { };
return TextUtil::width(inlineBox, startPosition, startPosition + length);
};
@@ -111,7 +114,9 @@
if (isWhitespaceCharacter(text[currentPosition])) {
auto length = moveToNextNonWhitespacePosition(text, currentPosition);
- inlineContent.append(InlineTextItem::createWhitespaceItem(inlineBox, currentPosition, length, inlineItemWidth(currentPosition, length)));
+ auto simpleSingleWhitespaceContent = textContext.canUseSimplifiedContentMeasuring && (length == 1 || style.collapseWhiteSpace());
+ auto width = simpleSingleWhitespaceContent ? makeOptional(LayoutUnit { font.spaceWidth() }) : inlineItemWidth(currentPosition, length);
+ inlineContent.append(InlineTextItem::createWhitespaceItem(inlineBox, currentPosition, length, width));
currentPosition += length;
continue;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes