Title: [247730] trunk
Revision
247730
Author
timothy_hor...@apple.com
Date
2019-07-23 12:06:30 -0700 (Tue, 23 Jul 2019)

Log Message

Long press hint of AirPods buy buttons are tall and narrow during animation
https://bugs.webkit.org/show_bug.cgi?id=200036
<rdar://problem/53145697>

Reviewed by Wenson Hsieh.

Source/WebCore:

New test: fast/text-indicator/text-indicator-with-tiny-child.html

* dom/Range.cpp:
(WebCore::Range::borderAndTextRects const):
* dom/Range.h:
Add a BoundingRectBehavior that ignores 1x1 and smaller rects.

* page/TextIndicator.cpp:
(WebCore::absoluteBoundingRectForRange):
Enable IgnoreTinyRects.

LayoutTests:

* fast/text-indicator/text-indicator-with-tiny-child-expected.txt: Added.
* fast/text-indicator/text-indicator-with-tiny-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247729 => 247730)


--- trunk/LayoutTests/ChangeLog	2019-07-23 19:01:14 UTC (rev 247729)
+++ trunk/LayoutTests/ChangeLog	2019-07-23 19:06:30 UTC (rev 247730)
@@ -1,3 +1,14 @@
+2019-07-23  Tim Horton  <timothy_hor...@apple.com>
+
+        Long press hint of AirPods buy buttons are tall and narrow during animation
+        https://bugs.webkit.org/show_bug.cgi?id=200036
+        <rdar://problem/53145697>
+
+        Reviewed by Wenson Hsieh.
+
+        * fast/text-indicator/text-indicator-with-tiny-child-expected.txt: Added.
+        * fast/text-indicator/text-indicator-with-tiny-child.html: Added.
+
 2019-07-23  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts

Added: trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt (0 => 247730)


--- trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt	2019-07-23 19:06:30 UTC (rev 247730)
@@ -0,0 +1,3 @@
+
+elementWithTinyChild: -2 -1 36 34
+

Added: trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html (0 => 247730)


--- trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html	2019-07-23 19:06:30 UTC (rev 247730)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+* { box-sizing: border-box; }
+body { margin: 0; }
+span { position: absolute; top: 0; left: 0;; }
+.tiny { position: absolute; top: 500px; left: 500px; width: 1px; height: 1px; background-color: blue; }
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function output(s)
+{
+    window.log.innerText += s + "\n";
+}
+
+function runTest()
+{
+    if (!window.internals) {
+        output("This test cannot be run outside of WebKitTestRunner.");
+        return;
+    }
+
+    function dumpIndicatorBoundsForElement(el)
+    {
+        var indicatorOptions = {"useBoundingRectAndPaintAllContentForComplexRanges": true};
+        var range = internals.rangeFromLocationAndLength(el, 0, 1);
+        var indicator = window.internals.textIndicatorForRange(range, indicatorOptions);
+        var rect = indicator.textBoundingRectInRootViewCoordinates;
+        output(`${el.id}: ${rect.x} ${rect.y} ${rect.width} ${rect.height}`);
+    }
+
+    dumpIndicatorBoundsForElement(document.getElementById("elementWithTinyChild"));
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<span id="elementWithTinyChild"><img src="" width="32px" height="32px"><div class="tiny"></div></span>
+<pre id="log"></pre>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (247729 => 247730)


--- trunk/Source/WebCore/ChangeLog	2019-07-23 19:01:14 UTC (rev 247729)
+++ trunk/Source/WebCore/ChangeLog	2019-07-23 19:06:30 UTC (rev 247730)
@@ -1,3 +1,22 @@
+2019-07-23  Tim Horton  <timothy_hor...@apple.com>
+
+        Long press hint of AirPods buy buttons are tall and narrow during animation
+        https://bugs.webkit.org/show_bug.cgi?id=200036
+        <rdar://problem/53145697>
+
+        Reviewed by Wenson Hsieh.
+
+        New test: fast/text-indicator/text-indicator-with-tiny-child.html
+
+        * dom/Range.cpp:
+        (WebCore::Range::borderAndTextRects const):
+        * dom/Range.h:
+        Add a BoundingRectBehavior that ignores 1x1 and smaller rects.
+
+        * page/TextIndicator.cpp:
+        (WebCore::absoluteBoundingRectForRange):
+        Enable IgnoreTinyRects.
+
 2019-07-23  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts

Modified: trunk/Source/WebCore/dom/Range.cpp (247729 => 247730)


--- trunk/Source/WebCore/dom/Range.cpp	2019-07-23 19:01:14 UTC (rev 247729)
+++ trunk/Source/WebCore/dom/Range.cpp	2019-07-23 19:06:30 UTC (rev 247730)
@@ -1853,6 +1853,12 @@
         }
     }
 
+    if (rectOptions.contains(BoundingRectBehavior::IgnoreTinyRects)) {
+        rects.removeAllMatching([&] (const FloatRect& rect) -> bool {
+            return rect.area() <= 1;
+        });
+    }
+
     return rects;
 }
 

Modified: trunk/Source/WebCore/dom/Range.h (247729 => 247730)


--- trunk/Source/WebCore/dom/Range.h	2019-07-23 19:01:14 UTC (rev 247729)
+++ trunk/Source/WebCore/dom/Range.h	2019-07-23 19:06:30 UTC (rev 247730)
@@ -119,6 +119,7 @@
     enum class BoundingRectBehavior : uint8_t {
         RespectClipping = 1 << 0,
         UseVisibleBounds = 1 << 1,
+        IgnoreTinyRects = 1 << 2,
     };
 
     // Not transform-friendly

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (247729 => 247730)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2019-07-23 19:01:14 UTC (rev 247729)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2019-07-23 19:06:30 UTC (rev 247730)
@@ -226,7 +226,8 @@
 {
     return range.absoluteBoundingRect({
         Range::BoundingRectBehavior::RespectClipping,
-        Range::BoundingRectBehavior::UseVisibleBounds
+        Range::BoundingRectBehavior::UseVisibleBounds,
+        Range::BoundingRectBehavior::IgnoreTinyRects,
     });
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to