Title: [276668] branches/safari-611-branch
Revision
276668
Author
[email protected]
Date
2021-04-27 14:07:32 -0700 (Tue, 27 Apr 2021)

Log Message

Cherry-pick r276357. rdar://problem/77211423

    REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
    https://bugs.webkit.org/show_bug.cgi?id=224839
    <rdar://74958484>

    Reviewed by Darin Adler.

    Source/WebCore:

    Pass in locale information when constructing the text iterator for the content (locale affects soft wrap opportunities).

    Test: fast/text/line-break-with-locale.html

    * layout/inlineformatting/InlineTextItem.cpp:
    (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
    * layout/inlineformatting/text/TextUtil.cpp: In addition to locale, add missing line breaking mode.
    (WebCore::Layout::TextUtil::lineBreakIteratorMode):
    * layout/inlineformatting/text/TextUtil.h:

    LayoutTests:

    * fast/text/line-break-with-locale-expected.html: Added.
    * fast/text/line-break-with-locale.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (276667 => 276668)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-04-27 21:07:32 UTC (rev 276668)
@@ -1,5 +1,45 @@
 2021-04-27  Russell Epstein  <[email protected]>
 
+        Cherry-pick r276357. rdar://problem/77211423
+
+    REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
+    https://bugs.webkit.org/show_bug.cgi?id=224839
+    <rdar://74958484>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    Pass in locale information when constructing the text iterator for the content (locale affects soft wrap opportunities).
+    
+    Test: fast/text/line-break-with-locale.html
+    
+    * layout/inlineformatting/InlineTextItem.cpp:
+    (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+    * layout/inlineformatting/text/TextUtil.cpp: In addition to locale, add missing line breaking mode.
+    (WebCore::Layout::TextUtil::lineBreakIteratorMode):
+    * layout/inlineformatting/text/TextUtil.h:
+    
+    LayoutTests:
+    
+    * fast/text/line-break-with-locale-expected.html: Added.
+    * fast/text/line-break-with-locale.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-21  Zalan Bujtas  <[email protected]>
+
+            REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
+            https://bugs.webkit.org/show_bug.cgi?id=224839
+            <rdar://74958484>
+
+            Reviewed by Darin Adler.
+
+            * fast/text/line-break-with-locale-expected.html: Added.
+            * fast/text/line-break-with-locale.html: Added.
+
+2021-04-27  Russell Epstein  <[email protected]>
+
         Cherry-pick r276012. rdar://problem/77211405
 
     REGRESSION(Safari 14): iframe with blob url does not work with sandboxing

Added: branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale-expected.html (0 => 276668)


--- branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale-expected.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale-expected.html	2021-04-27 21:07:32 UTC (rev 276668)
@@ -0,0 +1,8 @@
+<style>
+div {
+  width: 72px;
+  height: 78px;
+  background-color: green;
+}
+</style>
+<div></div>

Added: branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale.html (0 => 276668)


--- branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/line-break-with-locale.html	2021-04-27 21:07:32 UTC (rev 276668)
@@ -0,0 +1,11 @@
+<html lang="ja">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<style>
+div {
+  width: 72px;
+  font-size: 25.5px;
+  color: green;
+  background-color: green;
+}
+</style>
+<div>っっっっ</div>

Modified: branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations (276667 => 276668)


--- branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-04-27 21:07:32 UTC (rev 276668)
@@ -3496,3 +3496,4 @@
 
 # Not all OSes support the same set of emoji.
 fast/text/mending-heart.html [ Failure ] 
+fast/text/line-break-with-locale.html [ ImageOnlyFailure ]

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (276667 => 276668)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-27 21:07:32 UTC (rev 276668)
@@ -1,5 +1,52 @@
 2021-04-27  Russell Epstein  <[email protected]>
 
+        Cherry-pick r276357. rdar://problem/77211423
+
+    REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
+    https://bugs.webkit.org/show_bug.cgi?id=224839
+    <rdar://74958484>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    Pass in locale information when constructing the text iterator for the content (locale affects soft wrap opportunities).
+    
+    Test: fast/text/line-break-with-locale.html
+    
+    * layout/inlineformatting/InlineTextItem.cpp:
+    (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+    * layout/inlineformatting/text/TextUtil.cpp: In addition to locale, add missing line breaking mode.
+    (WebCore::Layout::TextUtil::lineBreakIteratorMode):
+    * layout/inlineformatting/text/TextUtil.h:
+    
+    LayoutTests:
+    
+    * fast/text/line-break-with-locale-expected.html: Added.
+    * fast/text/line-break-with-locale.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-21  Zalan Bujtas  <[email protected]>
+
+            REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
+            https://bugs.webkit.org/show_bug.cgi?id=224839
+            <rdar://74958484>
+
+            Reviewed by Darin Adler.
+
+            Pass in locale information when constructing the text iterator for the content (locale affects soft wrap opportunities).
+
+            Test: fast/text/line-break-with-locale.html
+
+            * layout/inlineformatting/InlineTextItem.cpp:
+            (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+            * layout/inlineformatting/text/TextUtil.cpp: In addition to locale, add missing line breaking mode.
+            (WebCore::Layout::TextUtil::lineBreakIteratorMode):
+            * layout/inlineformatting/text/TextUtil.h:
+
+2021-04-27  Russell Epstein  <[email protected]>
+
         Cherry-pick r276352. rdar://problem/77211405
 
     Use BlobURL::getOriginURL in more places

Modified: branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (276667 => 276668)


--- branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp	2021-04-27 21:07:32 UTC (rev 276668)
@@ -74,7 +74,7 @@
     auto& style = inlineTextBox.style();
     auto& font = style.fontCascade();
     auto whitespaceContentIsTreatedAsSingleSpace = !TextUtil::shouldPreserveSpacesAndTabs(inlineTextBox);
-    LazyLineBreakIterator lineBreakIterator(text);
+    auto lineBreakIterator = LazyLineBreakIterator { text, style.computedLocale(), TextUtil::lineBreakIteratorMode(style.lineBreak()) };
     unsigned currentPosition = 0;
 
     auto inlineItemWidth = [&](auto startPosition, auto length) -> Optional<InlineLayoutUnit> {

Modified: branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (276667 => 276668)


--- branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp	2021-04-27 21:07:32 UTC (rev 276668)
@@ -164,6 +164,24 @@
     return whitespace == WhiteSpace::Pre || whitespace == WhiteSpace::PreWrap || whitespace == WhiteSpace::BreakSpaces;
 }
 
+LineBreakIteratorMode TextUtil::lineBreakIteratorMode(LineBreak lineBreak)
+{
+    switch (lineBreak) {
+    case LineBreak::Auto:
+    case LineBreak::AfterWhiteSpace:
+    case LineBreak::Anywhere:
+        return LineBreakIteratorMode::Default;
+    case LineBreak::Loose:
+        return LineBreakIteratorMode::Loose;
+    case LineBreak::Normal:
+        return LineBreakIteratorMode::Normal;
+    case LineBreak::Strict:
+        return LineBreakIteratorMode::Strict;
+    }
+    ASSERT_NOT_REACHED();
+    return LineBreakIteratorMode::Default;
 }
+
 }
+}
 #endif

Modified: branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.h (276667 => 276668)


--- branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.h	2021-04-27 21:07:27 UTC (rev 276667)
+++ branches/safari-611-branch/Source/WebCore/layout/inlineformatting/text/TextUtil.h	2021-04-27 21:07:32 UTC (rev 276668)
@@ -52,7 +52,9 @@
         InlineLayoutUnit logicalWidth { 0 };
     };
     static SplitData split(const InlineTextItem&, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft);
+
     static unsigned findNextBreakablePosition(LazyLineBreakIterator&, unsigned startPosition, const RenderStyle&);
+    static LineBreakIteratorMode lineBreakIteratorMode(LineBreak);
 
     static bool shouldPreserveSpacesAndTabs(const Box&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to