Title: [248345] branches/safari-608.1-branch
Revision
248345
Author
[email protected]
Date
2019-08-06 23:52:19 -0700 (Tue, 06 Aug 2019)

Log Message

Cherry-pick r247730. rdar://problem/54017873

    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.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608.1-branch/LayoutTests/ChangeLog (248344 => 248345)


--- branches/safari-608.1-branch/LayoutTests/ChangeLog	2019-08-07 06:52:16 UTC (rev 248344)
+++ branches/safari-608.1-branch/LayoutTests/ChangeLog	2019-08-07 06:52:19 UTC (rev 248345)
@@ -1,5 +1,47 @@
 2019-08-06  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r247730. rdar://problem/54017873
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-23  Tim Horton  <[email protected]>
+
+            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-08-06  Kocsen Chung  <[email protected]>
+
         Cherry-pick r247720. rdar://problem/54017869
 
     WebKit should strip away system font names from the pasted content

Added: branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt (0 => 248345)


--- branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt	                        (rev 0)
+++ branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child-expected.txt	2019-08-07 06:52:19 UTC (rev 248345)
@@ -0,0 +1,3 @@
+
+elementWithTinyChild: -2 -1 36 34
+

Added: branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html (0 => 248345)


--- branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html	                        (rev 0)
+++ branches/safari-608.1-branch/LayoutTests/fast/text-indicator/text-indicator-with-tiny-child.html	2019-08-07 06:52:19 UTC (rev 248345)
@@ -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: branches/safari-608.1-branch/Source/WebCore/ChangeLog (248344 => 248345)


--- branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-08-07 06:52:16 UTC (rev 248344)
+++ branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-08-07 06:52:19 UTC (rev 248345)
@@ -1,5 +1,55 @@
 2019-08-06  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r247730. rdar://problem/54017873
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-23  Tim Horton  <[email protected]>
+
+            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-08-06  Kocsen Chung  <[email protected]>
+
         Cherry-pick r247720. rdar://problem/54017869
 
     WebKit should strip away system font names from the pasted content

Modified: branches/safari-608.1-branch/Source/WebCore/dom/Range.cpp (248344 => 248345)


--- branches/safari-608.1-branch/Source/WebCore/dom/Range.cpp	2019-08-07 06:52:16 UTC (rev 248344)
+++ branches/safari-608.1-branch/Source/WebCore/dom/Range.cpp	2019-08-07 06:52:19 UTC (rev 248345)
@@ -1853,6 +1853,12 @@
         }
     }
 
+    if (rectOptions.contains(BoundingRectBehavior::IgnoreTinyRects)) {
+        rects.removeAllMatching([&] (const FloatRect& rect) -> bool {
+            return rect.area() <= 1;
+        });
+    }
+
     return rects;
 }
 

Modified: branches/safari-608.1-branch/Source/WebCore/dom/Range.h (248344 => 248345)


--- branches/safari-608.1-branch/Source/WebCore/dom/Range.h	2019-08-07 06:52:16 UTC (rev 248344)
+++ branches/safari-608.1-branch/Source/WebCore/dom/Range.h	2019-08-07 06:52:19 UTC (rev 248345)
@@ -119,6 +119,7 @@
     enum class BoundingRectBehavior : uint8_t {
         RespectClipping = 1 << 0,
         UseVisibleBounds = 1 << 1,
+        IgnoreTinyRects = 1 << 2,
     };
 
     // Not transform-friendly

Modified: branches/safari-608.1-branch/Source/WebCore/page/TextIndicator.cpp (248344 => 248345)


--- branches/safari-608.1-branch/Source/WebCore/page/TextIndicator.cpp	2019-08-07 06:52:16 UTC (rev 248344)
+++ branches/safari-608.1-branch/Source/WebCore/page/TextIndicator.cpp	2019-08-07 06:52:19 UTC (rev 248345)
@@ -226,7 +226,8 @@
 {
     return range.absoluteBoundingRect({
         Range::BoundingRectBehavior::RespectClipping,
-        Range::BoundingRectBehavior::UseVisibleBounds
+        Range::BoundingRectBehavior::UseVisibleBounds,
+        Range::BoundingRectBehavior::IgnoreTinyRects,
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to