[LFC][IFC] Display::Run::TextContent::expand(unsigned) is called with the value of -1.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2020 15:19:14 +0000 (15:19 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2020 15:19:14 +0000 (15:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=208558
<rdar://problem/60026658>

Reviewed by Antti Koivisto.

* layout/displaytree/DisplayRun.h:
(WebCore::Display::Run::TextContent::shrink):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::Run::removeTrailingWhitespace):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/displaytree/DisplayRun.h
Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp

index 717c3e5..cd9e4f4 100644 (file)
@@ -1,5 +1,18 @@
 2020-03-04  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][IFC] Display::Run::TextContent::expand(unsigned) is called with the value of -1.
+        https://bugs.webkit.org/show_bug.cgi?id=208558
+        <rdar://problem/60026658>
+
+        Reviewed by Antti Koivisto.
+
+        * layout/displaytree/DisplayRun.h:
+        (WebCore::Display::Run::TextContent::shrink):
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::Run::removeTrailingWhitespace):
+
+2020-03-04  Zalan Bujtas  <zalan@apple.com>
+
         [First paint] Going from visually empty to non-empty should immediately trigger layer unfreezing
         https://bugs.webkit.org/show_bug.cgi?id=208385
         <rdar://problem/59895900>
index 375449a..87e44b6 100644 (file)
@@ -54,6 +54,7 @@ struct Run {
         void setNeedsHyphen() { m_needsHyphen = true; }
 
         void expand(unsigned delta) { m_length += delta; }
+        void shrink(unsigned delta) { m_length -= delta; }
 
     private:
         unsigned m_start { 0 };
index e24ceee..64a00e5 100644 (file)
@@ -833,7 +833,8 @@ void LineBuilder::Run::removeTrailingWhitespace()
     // According to https://www.w3.org/TR/css-text-3/#white-space-property matrix
     // Trimmable whitespace is always collapsable so the length of the trailing trimmable whitespace is always 1 (or non-existent).
     ASSERT(m_textContent->length());
-    m_textContent->expand(-1);
+    constexpr size_t trailingTrimmableContentLength = 1;
+    m_textContent->shrink(trailingTrimmableContentLength);
     visuallyCollapseTrailingWhitespace();
 }