Title: [253428] trunk/Source/WebCore
Revision
253428
Author
[email protected]
Date
2019-12-12 07:48:22 -0800 (Thu, 12 Dec 2019)

Log Message

[LFC][IFC] Fix fast/text/whitespace/simple-line-layout-tab-position.html
https://bugs.webkit.org/show_bug.cgi?id=205160
<rdar://problem/57876474>

Reviewed by Antti Koivisto.

Use the content box (and not the border box) as the start position when measuring text and also include
the not-yet committed content.
e.g. <pre style="padding: 100px;">text[tab character]</pre>
When we measure the width of the [tab] character, the start position input to the text measuring is
1. relative to the content box (0px vs 100px)
2. includes the [text] not-yet committed content width

This patch also ensures that we only fast-path the collapsible whitespace characters.

* layout/inlineformatting/LineLayoutContext.cpp:
(WebCore::Layout::LineLayoutContext::placeInlineItem):
* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253427 => 253428)


--- trunk/Source/WebCore/ChangeLog	2019-12-12 15:18:05 UTC (rev 253427)
+++ trunk/Source/WebCore/ChangeLog	2019-12-12 15:48:22 UTC (rev 253428)
@@ -1,3 +1,25 @@
+2019-12-12  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Fix fast/text/whitespace/simple-line-layout-tab-position.html
+        https://bugs.webkit.org/show_bug.cgi?id=205160
+        <rdar://problem/57876474>
+
+        Reviewed by Antti Koivisto.
+
+        Use the content box (and not the border box) as the start position when measuring text and also include
+        the not-yet committed content.
+        e.g. <pre style="padding: 100px;">text[tab character]</pre>
+        When we measure the width of the [tab] character, the start position input to the text measuring is
+        1. relative to the content box (0px vs 100px)
+        2. includes the [text] not-yet committed content width
+
+        This patch also ensures that we only fast-path the collapsible whitespace characters.
+
+        * layout/inlineformatting/LineLayoutContext.cpp:
+        (WebCore::Layout::LineLayoutContext::placeInlineItem):
+        * layout/inlineformatting/text/TextUtil.cpp:
+        (WebCore::Layout::TextUtil::width):
+
 2019-12-12  Antti Koivisto  <[email protected]>
 
         REGRESSION(r252979): Avoid unnecessary work when searching for the flow when constructing line layout iteratorAvoid unnecessary work when searching for the flow when constructing line layout iterator

Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp (253427 => 253428)


--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2019-12-12 15:18:05 UTC (rev 253427)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2019-12-12 15:48:22 UTC (rev 253428)
@@ -146,7 +146,7 @@
 
 LineLayoutContext::IsEndOfLine LineLayoutContext::placeInlineItem(LineBuilder& line, const InlineItem& inlineItem)
 {
-    auto currentLogicalRight = line.lineBox().logicalRight();
+    auto currentLogicalRight = line.lineBox().logicalWidth() + m_uncommittedContent.width();
     auto itemLogicalWidth = inlineItemWidth(formattingContext(), inlineItem, currentLogicalRight);
 
     // Floats are special, they are intrusive but they don't really participate in the line layout context.

Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (253427 => 253428)


--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-12 15:18:05 UTC (rev 253427)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2019-12-12 15:48:22 UTC (rev 253428)
@@ -37,8 +37,8 @@
 
 InlineLayoutUnit TextUtil::width(const InlineTextItem& inlineTextItem, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft)
 {
-    // Fast path for single whitespace character.
-    if (inlineTextItem.isWhitespace() && (to - from) == 1) {
+    // Fast path for collapsed whitespace.
+    if (inlineTextItem.isCollapsible()) {
         auto font = inlineTextItem.style().fontCascade();
         return font.spaceWidth() + font.wordSpacing();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to