Title: [231178] trunk
Revision
231178
Author
za...@apple.com
Date
2018-04-30 16:16:42 -0700 (Mon, 30 Apr 2018)

Log Message

REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
https://bugs.webkit.org/show_bug.cgi?id=185142
<rdar://problem/39821446>

Reviewed by Simon Fraser.

Source/WebCore:

Set the overflow rect on the inline textbox when needed.

Test: fast/text/simple-line-layout-selection-with-overflow.html

* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::initializeInlineTextBox):
(WebCore::SimpleLineLayout::generateLineBoxTree):
(WebCore::SimpleLineLayout::initializeInlineBox): Deleted.

LayoutTests:

* fast/text/simple-line-layout-selection-with-overflow-expected.html: Added.
* fast/text/simple-line-layout-selection-with-overflow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231177 => 231178)


--- trunk/LayoutTests/ChangeLog	2018-04-30 22:35:42 UTC (rev 231177)
+++ trunk/LayoutTests/ChangeLog	2018-04-30 23:16:42 UTC (rev 231178)
@@ -1,3 +1,14 @@
+2018-04-30  Zalan Bujtas  <za...@apple.com>
+
+        REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
+        https://bugs.webkit.org/show_bug.cgi?id=185142
+        <rdar://problem/39821446>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/simple-line-layout-selection-with-overflow-expected.html: Added.
+        * fast/text/simple-line-layout-selection-with-overflow.html: Added.
+
 2018-04-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width

Added: trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow-expected.html (0 => 231178)


--- trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow-expected.html	2018-04-30 23:16:42 UTC (rev 231178)
@@ -0,0 +1,17 @@
+<style>
+body{
+    letter-spacing: -1px;
+    font-height: 10px;
+}
+</style>
+<div id=textWithLetterSpacing>Pass if text does not disappear after the range selection.</div>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+document.body.offsetHeight;
+
+var range = document.createRange();
+range.setStart(textWithLetterSpacing.firstChild, 0);
+range.setEnd(textWithLetterSpacing.firstChild, 5);
+window.getSelection().addRange(range);
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow.html (0 => 231178)


--- trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-selection-with-overflow.html	2018-04-30 23:16:42 UTC (rev 231178)
@@ -0,0 +1,15 @@
+<style>
+div {
+    letter-spacing: -1px;
+    font-height: 10px;
+}
+</style>
+<div id=textWithLetterSpacing>Pass if text does not disappear after the range selection.</div>
+<script>
+document.body.offsetHeight;
+
+var range = document.createRange();
+range.setStart(textWithLetterSpacing.firstChild, 0);
+range.setEnd(textWithLetterSpacing.firstChild, 5);
+window.getSelection().addRange(range);
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (231177 => 231178)


--- trunk/Source/WebCore/ChangeLog	2018-04-30 22:35:42 UTC (rev 231177)
+++ trunk/Source/WebCore/ChangeLog	2018-04-30 23:16:42 UTC (rev 231178)
@@ -1,3 +1,20 @@
+2018-04-30  Zalan Bujtas  <za...@apple.com>
+
+        REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
+        https://bugs.webkit.org/show_bug.cgi?id=185142
+        <rdar://problem/39821446>
+
+        Reviewed by Simon Fraser.
+
+        Set the overflow rect on the inline textbox when needed.
+
+        Test: fast/text/simple-line-layout-selection-with-overflow.html
+
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::initializeInlineTextBox):
+        (WebCore::SimpleLineLayout::generateLineBoxTree):
+        (WebCore::SimpleLineLayout::initializeInlineBox): Deleted.
+
 2018-04-30  JF Bastien  <jfbast...@apple.com>
 
         Use some C++17 features

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (231177 => 231178)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2018-04-30 22:35:42 UTC (rev 231177)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2018-04-30 23:16:42 UTC (rev 231178)
@@ -292,22 +292,25 @@
     return true;
 }
 
-static void initializeInlineBox(InlineBox& inlineBox, const RunResolver::Run& run)
+static void initializeInlineTextBox(RenderBlockFlow& flow, InlineTextBox& inlineTextBox, const RunResolver::Run& run)
 {
-    inlineBox.setLogicalLeft(run.logicalLeft());
-    inlineBox.setLogicalTop(run.rect().y());
-    inlineBox.setLogicalWidth(run.logicalRight() - run.logicalLeft());
+    inlineTextBox.setLogicalLeft(run.logicalLeft());
+    inlineTextBox.setLogicalTop(run.rect().y());
+    inlineTextBox.setLogicalWidth(run.logicalRight() - run.logicalLeft());
+    auto overflowRect = computeOverflow(const_cast<RenderBlockFlow&>(flow), run.rect());
+    if (overflowRect != run.rect())
+        inlineTextBox.setLogicalOverflowRect(LayoutRect(overflowRect));
 
-    inlineBox.setHasHyphen(run.hasHyphen());
-    inlineBox.setExpansionWithoutGrowing(run.expansion());
+    inlineTextBox.setHasHyphen(run.hasHyphen());
+    inlineTextBox.setExpansionWithoutGrowing(run.expansion());
 
     auto expansionBehavior = run.expansionBehavior();
-    inlineBox.setCanHaveLeadingExpansion(expansionBehavior & AllowLeadingExpansion);
-    inlineBox.setCanHaveTrailingExpansion(expansionBehavior & AllowTrailingExpansion);
+    inlineTextBox.setCanHaveLeadingExpansion(expansionBehavior & AllowLeadingExpansion);
+    inlineTextBox.setCanHaveTrailingExpansion(expansionBehavior & AllowTrailingExpansion);
     if (expansionBehavior & ForceTrailingExpansion)
-        inlineBox.setForceTrailingExpansion();
+        inlineTextBox.setForceTrailingExpansion();
     if (expansionBehavior & ForceLeadingExpansion)
-        inlineBox.setForceLeadingExpansion();
+        inlineTextBox.setForceLeadingExpansion();
 }
 
 void generateLineBoxTree(RenderBlockFlow& flow, const Layout& layout)
@@ -348,7 +351,7 @@
         // Set the geometry for the inlineboxes.
         for (auto* inlineBox = rootLineBox.firstChild(); inlineBox && it != range.end(); inlineBox = inlineBox->nextOnLine(), ++it) {
             auto run = *it;
-            initializeInlineBox(*inlineBox, run);
+            initializeInlineTextBox(flow, downcast<InlineTextBox>(*inlineBox), run);
             lineWidth += inlineBox->logicalWidth();
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to