Title: [289303] branches/safari-613-branch
Revision
289303
Author
[email protected]
Date
2022-02-07 18:55:12 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288547. rdar://problem/87824766

    (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present
    https://bugs.webkit.org/show_bug.cgi?id=235547
    <rdar://87824766>

    Reviewed by Antti Koivisto.

    Source/WebCore:

    The float box coordinates are always visual. They need to be converted to
    logical to be able to properly constrain the available space on the current line.

    Test: fast/inline/intrusive-float-with-rtl-content.html

    * layout/formattingContexts/inline/InlineLineBuilder.cpp:
    (WebCore::Layout::LineBuilder::floatConstraints const):

    LayoutTests:

    * fast/inline/intrusive-float-with-rtl-content-expected.html: Added.
    * fast/inline/intrusive-float-with-rtl-content.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (289302 => 289303)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:55:08 UTC (rev 289302)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:55:12 UTC (rev 289303)
@@ -1,5 +1,44 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288547. rdar://problem/87824766
+
+    (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present
+    https://bugs.webkit.org/show_bug.cgi?id=235547
+    <rdar://87824766>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The float box coordinates are always visual. They need to be converted to
+    logical to be able to properly constrain the available space on the current line.
+    
+    Test: fast/inline/intrusive-float-with-rtl-content.html
+    
+    * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+    (WebCore::Layout::LineBuilder::floatConstraints const):
+    
+    LayoutTests:
+    
+    * fast/inline/intrusive-float-with-rtl-content-expected.html: Added.
+    * fast/inline/intrusive-float-with-rtl-content.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-25  Alan Bujtas  <[email protected]>
+
+            (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present
+            https://bugs.webkit.org/show_bug.cgi?id=235547
+            <rdar://87824766>
+
+            Reviewed by Antti Koivisto.
+
+            * fast/inline/intrusive-float-with-rtl-content-expected.html: Added.
+            * fast/inline/intrusive-float-with-rtl-content.html: Added.
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288543. rdar://problem/84958961
 
     REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)

Added: branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content-expected.html (0 => 289303)


--- branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content-expected.html	2022-02-08 02:55:12 UTC (rev 289303)
@@ -0,0 +1,8 @@
+<style>
+div {
+  width: 100px;
+  height: 220px;
+  background-color: green;
+}
+</style>
+<div></div>

Added: branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content.html (0 => 289303)


--- branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/inline/intrusive-float-with-rtl-content.html	2022-02-08 02:55:12 UTC (rev 289303)
@@ -0,0 +1,95 @@
+<style>
+body {
+  font-family: Ahem;
+  font-size: 20px;
+  position: relative;
+}
+
+.container {
+  width: 100px;
+  height: 20px;
+  background-color: green;
+}
+
+.floatBox {
+  float: left;
+  width: 20px;
+  height: 20px;
+  background-color: green;
+}
+
+.content {
+  direction: rtl;
+  color: red;
+}
+
+.ref {
+    position: absolute;
+    top: 0px;
+    color: green;
+    white-space: pre;
+}
+</style>
+<div class=container>
+  <div class=floatBox></div>
+  <div class=content>X</div>
+</div>
+<div class=ref>    X</div>
+
+<div class=container>
+  <div class=floatBox style="float: right;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 20px;">   X </div>
+
+<div class=container>
+  <div class=floatBox style="float: right; width: 40px;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 40px;">  X  </div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=floatBox style="float: right; width: 60px;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 60px;"> X   </div>
+
+<div class=container style="height: 40px;">
+  <div class=floatBox></div>
+  <div class=floatBox style="float: right; width: 80px;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 100px;">    X</div>
+
+<div class=container>
+  <div class=floatBox style="float: right;"></div>
+  <div class=content style="border-right: 20px solid green;">X</div>
+</div>
+<div class=ref style="top: 120px;">   X </div>
+
+<div class=container>
+  <div class=floatBox style="float: right;"></div>
+  <div class=content style="border-right: 40px solid green;">X</div>
+</div>
+<div class=ref style="top: 140px;">  X  </div>
+
+<div class=container>
+  <div class=floatBox style="float: right;"></div>
+  <div class=content style="border-left: 40px solid green; border-right: 40px solid green;">X</div>
+</div>
+<div class=ref style="top: 160px;">  X  </div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=floatBox style="float: right; width: 20px;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 180px;">   X </div>
+
+<div class=container>
+  <div class=floatBox style="width: 40px;"></div>
+  <div class=floatBox style="float: right; width: 40px;"></div>
+  <div class=content>X</div>
+</div>
+<div class=ref style="top: 200px;">  X  </div>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289302 => 289303)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:55:08 UTC (rev 289302)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:55:12 UTC (rev 289303)
@@ -1,5 +1,49 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288547. rdar://problem/87824766
+
+    (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present
+    https://bugs.webkit.org/show_bug.cgi?id=235547
+    <rdar://87824766>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The float box coordinates are always visual. They need to be converted to
+    logical to be able to properly constrain the available space on the current line.
+    
+    Test: fast/inline/intrusive-float-with-rtl-content.html
+    
+    * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+    (WebCore::Layout::LineBuilder::floatConstraints const):
+    
+    LayoutTests:
+    
+    * fast/inline/intrusive-float-with-rtl-content-expected.html: Added.
+    * fast/inline/intrusive-float-with-rtl-content.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-25  Alan Bujtas  <[email protected]>
+
+            (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present
+            https://bugs.webkit.org/show_bug.cgi?id=235547
+            <rdar://87824766>
+
+            Reviewed by Antti Koivisto.
+
+            The float box coordinates are always visual. They need to be converted to
+            logical to be able to properly constrain the available space on the current line.
+
+            Test: fast/inline/intrusive-float-with-rtl-content.html
+
+            * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+            (WebCore::Layout::LineBuilder::floatConstraints const):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288539. rdar://problem/87986840
 
     Expand RefPtr / Ref use in FrameLoader

Modified: branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (289302 => 289303)


--- branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-02-08 02:55:08 UTC (rev 289302)
+++ branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-02-08 02:55:12 UTC (rev 289303)
@@ -543,7 +543,19 @@
 
     // Check for intruding floats and adjust logical left/available width for this line accordingly.
     auto floatingContext = FloatingContext { formattingContext(), *floatingState };
-    auto constraints = floatingContext.constraints(toLayoutUnit(lineLogicalRect.top()), toLayoutUnit(lineLogicalRect.bottom()));
+    auto toLogicalFloatPosition = [&] (const auto& constraints) -> FloatingContext::Constraints {
+        if (root().style().isLeftToRightDirection())
+            return constraints;
+        auto logicalConstraints = FloatingContext::Constraints { };
+        auto borderBoxWidth = layoutState().geometryForBox(root()).borderBoxWidth();
+        if (constraints.left)
+            logicalConstraints.right = PointInContextRoot { borderBoxWidth - constraints.left->x, constraints.left->y };
+        if (constraints.right)
+            logicalConstraints.left = PointInContextRoot { borderBoxWidth - constraints.right->x, constraints.right->y };
+        return logicalConstraints;
+    };
+    auto constraints = toLogicalFloatPosition(floatingContext.constraints(toLayoutUnit(lineLogicalRect.top()), toLayoutUnit(lineLogicalRect.bottom())));
+
     // Check if these values actually constrain the line.
     if (constraints.left && constraints.left->x <= lineLogicalRect.left())
         constraints.left = { };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to