Title: [288409] trunk
Revision
288409
Author
[email protected]
Date
2022-01-22 14:57:14 -0800 (Sat, 22 Jan 2022)

Log Message

REGRESSION (r288069): Bits of selection left after deselecting on bugzilla page
https://bugs.webkit.org/show_bug.cgi?id=235466
<rdar://87902230>

Reviewed by Darin Adler.

Source/WebCore:

Undo the incorrect dynamicDowncast change.

This code reads (perhaps confusingly at first sight):
  return is<RenderView>(containingBlock) ? nullptr : containingBlock;

while the dynamicDowncast is meant to shorten code like this:
  return is<RenderView>(containingBlock) ? containingBlock : nullptr;

Test: fast/text/incorrect-deselection-across-multiple-elements.html

* rendering/SelectionRangeData.cpp:
(WebCore::containingBlockBelowView):

LayoutTests:

* fast/text/incorrect-deselection-across-multiple-elements-expected.txt: Added.
* fast/text/incorrect-deselection-across-multiple-elements.html: Added. Use indexOf because
while the repaint rect area is always the same, the rects order may vary.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288408 => 288409)


--- trunk/LayoutTests/ChangeLog	2022-01-22 22:20:52 UTC (rev 288408)
+++ trunk/LayoutTests/ChangeLog	2022-01-22 22:57:14 UTC (rev 288409)
@@ -1,3 +1,15 @@
+2022-01-22  Alan Bujtas  <[email protected]>
+
+        REGRESSION (r288069): Bits of selection left after deselecting on bugzilla page
+        https://bugs.webkit.org/show_bug.cgi?id=235466
+        <rdar://87902230>
+
+        Reviewed by Darin Adler.
+
+        * fast/text/incorrect-deselection-across-multiple-elements-expected.txt: Added.
+        * fast/text/incorrect-deselection-across-multiple-elements.html: Added. Use indexOf because
+        while the repaint rect area is always the same, the rects order may vary.
+
 2022-01-22  Oriol Brufau  <[email protected]>
 
         [CSS Cascade Layers] Enable CSSImportRule.layerName for WebKitGTK

Added: trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements-expected.txt (0 => 288409)


--- trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements-expected.txt	2022-01-22 22:57:14 UTC (rev 288409)
@@ -0,0 +1,3 @@
+PASS if deselecting this
+clears the selection visually.
+PASS

Added: trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements.html (0 => 288409)


--- trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/incorrect-deselection-across-multiple-elements.html	2022-01-22 22:57:14 UTC (rev 288409)
@@ -0,0 +1,30 @@
+<style>
+body {
+  font-family: Ahem;
+  font-size: 20px;
+}
+div { 
+  padding-bottom: 50px;
+}
+</style>
+<div>PASS if deselecting this</div>
+<div id=second>clears the selection visually.</div>
+<pre id=result></pre>
+<script>
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.waitUntilDone();
+}
+window.getSelection().selectAllChildren(document.body);
+setTimeout(function() {
+  if (window.internals)
+    internals.startTrackingRepaints();
+  window.getSelection().selectAllChildren(second);
+  if (window.internals) {
+    result.innerText = internals.repaintRectsAsText().indexOf("784 70") == -1 ? "FAIL" : "PASS";
+    internals.stopTrackingRepaints();
+  }
+  if (window.testRunner)
+    testRunner.notifyDone();
+}, 0);
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (288408 => 288409)


--- trunk/Source/WebCore/ChangeLog	2022-01-22 22:20:52 UTC (rev 288408)
+++ trunk/Source/WebCore/ChangeLog	2022-01-22 22:57:14 UTC (rev 288409)
@@ -1,5 +1,26 @@
 2022-01-22  Alan Bujtas  <[email protected]>
 
+        REGRESSION (r288069): Bits of selection left after deselecting on bugzilla page
+        https://bugs.webkit.org/show_bug.cgi?id=235466
+        <rdar://87902230>
+
+        Reviewed by Darin Adler.
+
+        Undo the incorrect dynamicDowncast change.
+
+        This code reads (perhaps confusingly at first sight):
+          return is<RenderView>(containingBlock) ? nullptr : containingBlock;
+
+        while the dynamicDowncast is meant to shorten code like this:
+          return is<RenderView>(containingBlock) ? containingBlock : nullptr;
+
+        Test: fast/text/incorrect-deselection-across-multiple-elements.html
+
+        * rendering/SelectionRangeData.cpp:
+        (WebCore::containingBlockBelowView):
+
+2022-01-22  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Use content direction for the first "unicode-paragraph" when "unicode-bidi: plaintext" is present
         https://bugs.webkit.org/show_bug.cgi?id=235452
 

Modified: trunk/Source/WebCore/rendering/SelectionRangeData.cpp (288408 => 288409)


--- trunk/Source/WebCore/rendering/SelectionRangeData.cpp	2022-01-22 22:20:52 UTC (rev 288408)
+++ trunk/Source/WebCore/rendering/SelectionRangeData.cpp	2022-01-22 22:57:14 UTC (rev 288409)
@@ -74,7 +74,8 @@
 
 static RenderBlock* containingBlockBelowView(const RenderObject& renderer)
 {
-    return dynamicDowncast<RenderView>(renderer.containingBlock());
+    auto* containingBlock = renderer.containingBlock();
+    return is<RenderView>(containingBlock) ? nullptr : containingBlock;
 }
 
 static SelectionContext collectSelectionData(const RenderRange& selection, bool repaintDifference)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to