Title: [287495] trunk
Revision
287495
Author
[email protected]
Date
2021-12-31 12:08:22 -0800 (Fri, 31 Dec 2021)

Log Message

REGRESSION (r287028): Incorrect root inline box horizontal position when text-align offset is present
https://bugs.webkit.org/show_bug.cgi?id=234767

Reviewed by Antti Koivisto.

Source/WebCore:

Display line has the content's visual left (rtl vs ltr) which should be used to position the root inline box.
We use the same offset when construcing the non-root display boxes.

Test: fast/text/root-inline-box-offset-with-text-align.html

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):

LayoutTests:

* fast/text/root-inline-box-offset-with-text-align-expected.html: Added.
* fast/text/root-inline-box-offset-with-text-align.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287494 => 287495)


--- trunk/LayoutTests/ChangeLog	2021-12-31 19:46:47 UTC (rev 287494)
+++ trunk/LayoutTests/ChangeLog	2021-12-31 20:08:22 UTC (rev 287495)
@@ -1,3 +1,13 @@
+2021-12-31  Alan Bujtas  <[email protected]>
+
+        REGRESSION (r287028): Incorrect root inline box horizontal position when text-align offset is present
+        https://bugs.webkit.org/show_bug.cgi?id=234767
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/root-inline-box-offset-with-text-align-expected.html: Added.
+        * fast/text/root-inline-box-offset-with-text-align.html: Added.
+
 2021-12-31  Diego Pino Garcia  <[email protected]>
 
         [GTK][WPE] Unreviewed test gardening, move several fast/scrolling tests failures to GLIB

Added: trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align-expected.html (0 => 287495)


--- trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align-expected.html	2021-12-31 20:08:22 UTC (rev 287495)
@@ -0,0 +1,23 @@
+<style>
+div { 
+  width: 20px;
+  height: 20px;
+  background: green;
+  position: relative;
+}
+</style>
+<div></div>
+<div style="left: 20px;"></div>
+<div style="left: 40px;"></div>
+
+<div></div>
+<div style="left: 20px;"></div>
+<div style="left: 40px;"></div>
+
+<div></div>
+<div style="left: 20px;"></div>
+<div style="left: 40px;"></div>
+
+<div></div>
+<div style="left: 20px;"></div>
+<div style="left: 40px;"></div>

Added: trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align.html (0 => 287495)


--- trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/root-inline-box-offset-with-text-align.html	2021-12-31 20:08:22 UTC (rev 287495)
@@ -0,0 +1,26 @@
+<style>
+div { 
+  width: 60px;
+  font-family: Ahem;
+  font-size: 20px;
+  color: green;
+}
+div:first-line { background: green; }
+</style>
+<div>
+  <div style="text-align: left">x</div>
+  <div style="text-align: center">x</div>
+  <div style="text-align: right">x</div>
+  <div style="text-align: start">x</div>
+  <div style="text-align: center">x</div>
+  <div style="text-align: end">x</div>
+</div>
+
+<div style="direction: rtl">
+  <div style="text-align: left">x</div>
+  <div style="text-align: center">x</div>
+  <div style="text-align: right">x</div>
+  <div style="text-align: end">x</div>
+  <div style="text-align: center">x</div>
+  <div style="text-align: start">x</div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (287494 => 287495)


--- trunk/Source/WebCore/ChangeLog	2021-12-31 19:46:47 UTC (rev 287494)
+++ trunk/Source/WebCore/ChangeLog	2021-12-31 20:08:22 UTC (rev 287495)
@@ -1,3 +1,18 @@
+2021-12-31  Alan Bujtas  <[email protected]>
+
+        REGRESSION (r287028): Incorrect root inline box horizontal position when text-align offset is present
+        https://bugs.webkit.org/show_bug.cgi?id=234767
+
+        Reviewed by Antti Koivisto.
+
+        Display line has the content's visual left (rtl vs ltr) which should be used to position the root inline box.
+        We use the same offset when construcing the non-root display boxes.
+
+        Test: fast/text/root-inline-box-offset-with-text-align.html
+
+        * layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::build):
+
 2021-12-31  Wenson Hsieh  <[email protected]>
 
         Updating the file name of attachment-backed images should automatically set the `alt` attribute

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp (287494 => 287495)


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2021-12-31 19:46:47 UTC (rev 287494)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2021-12-31 20:08:22 UTC (rev 287495)
@@ -95,7 +95,9 @@
     m_lineIndex = lineIndex;
     // Every line starts with a root box, even the empty ones.
     auto rootInlineBoxRect = lineBox.logicalRectForRootInlineBox();
-    rootInlineBoxRect.moveBy(displayLine.topLeft());
+    rootInlineBoxRect.moveHorizontally(displayLine.left() + displayLine.contentLeft());
+    rootInlineBoxRect.moveVertically(displayLine.top());
+
     boxes.append({ m_lineIndex, InlineDisplay::Box::Type::RootInlineBox, root(), UBIDI_DEFAULT_LTR, rootInlineBoxRect, rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent() });
 
     auto contentNeedsBidiReordering = !lineContent.visualOrderList.isEmpty();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to