Title: [190254] trunk
Revision
190254
Author
[email protected]
Date
2015-09-25 15:01:21 -0700 (Fri, 25 Sep 2015)

Log Message

Scrolling a overflow: scroll region makes find overlay holes stick to the edge of the region
https://bugs.webkit.org/show_bug.cgi?id=149572
<rdar://problem/13093602>

Reviewed by Simon Fraser.

Test: fast/text/mark-matches-overflow-clip.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintTextMatchMarker):
Clip the rendered marker rect to the overflow rect.

* testing/Internals.cpp:
(WebCore::Internals::dumpMarkerRectsForNode):
* testing/Internals.h:
* testing/Internals.idl:
Add a internals function to dump the rendered rects for a marker.

* fast/text/mark-matches-overflow-clip-expected.txt: Added.
* fast/text/mark-matches-overflow-clip.html: Added.
Add a test ensuring that a find match that is clipped out by overflow
ends up with a clipped rendered rect.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (190253 => 190254)


--- trunk/LayoutTests/ChangeLog	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/LayoutTests/ChangeLog	2015-09-25 22:01:21 UTC (rev 190254)
@@ -1,3 +1,16 @@
+2015-09-25  Tim Horton  <[email protected]>
+
+        Scrolling a overflow: scroll region makes find overlay holes stick to the edge of the region
+        https://bugs.webkit.org/show_bug.cgi?id=149572
+        <rdar://problem/13093602>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/mark-matches-overflow-clip-expected.txt: Added.
+        * fast/text/mark-matches-overflow-clip.html: Added.
+        Add a test ensuring that a find match that is clipped out by overflow
+        ends up with a clipped rendered rect.
+
 2015-09-25  Zalan Bujtas  <[email protected]>
 
         Mark media/media-controls-play-button-updates.html failed for all Mac platforms.

Added: trunk/LayoutTests/fast/text/mark-matches-overflow-clip-expected.txt (0 => 190254)


--- trunk/LayoutTests/fast/text/mark-matches-overflow-clip-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-overflow-clip-expected.txt	2015-09-25 22:01:21 UTC (rev 190254)
@@ -0,0 +1 @@
+marker rects: (58, 94, 15, 18)

Added: trunk/LayoutTests/fast/text/mark-matches-overflow-clip.html (0 => 190254)


--- trunk/LayoutTests/fast/text/mark-matches-overflow-clip.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-overflow-clip.html	2015-09-25 22:01:21 UTC (rev 190254)
@@ -0,0 +1,25 @@
+<style>
+p {
+    display: inline-block;
+    overflow: scroll;
+    width: 60px;
+    margin: 50px;
+}
+</style>
+<p>
+<span style="position: relative; left: -25pt;">Quo usque tandem abutere, Catilina, patientia nostra?</span>
+</p>
+<script>
+window._onload_ = function () {
+    if (!window.internals) {
+        document.write("This test requires internals + testRunner to run.");
+        return;
+    }
+
+    testRunner.dumpAsText();
+    internals.countMatchesForText("tandem", 0, "mark");
+    
+    var markedNode = document.getElementsByTagName("span")[0].firstChild;
+    document.write(internals.dumpMarkerRectsForNode(markedNode, "TextMatch", 0));
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (190253 => 190254)


--- trunk/Source/WebCore/ChangeLog	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/Source/WebCore/ChangeLog	2015-09-25 22:01:21 UTC (rev 190254)
@@ -1,3 +1,23 @@
+2015-09-25  Tim Horton  <[email protected]>
+
+        Scrolling a overflow: scroll region makes find overlay holes stick to the edge of the region
+        https://bugs.webkit.org/show_bug.cgi?id=149572
+        <rdar://problem/13093602>
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/text/mark-matches-overflow-clip.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintTextMatchMarker):
+        Clip the rendered marker rect to the overflow rect.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::dumpMarkerRectsForNode):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        Add a internals function to dump the rendered rects for a marker.
+
 2015-09-25  Alex Christensen  <[email protected]>
 
         [Win] Switch to CMake

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (190253 => 190254)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-09-25 22:01:21 UTC (rev 190254)
@@ -1142,8 +1142,13 @@
     font.adjustSelectionRectForText(run, renderedRect, sPos, ePos);
     IntRect markerRect = enclosingIntRect(renderedRect);
     markerRect = renderer().localToAbsoluteQuad(FloatQuad(markerRect)).enclosingBoundingBox();
+    markerRect.intersect(enclosingIntRect(renderer().absoluteClippedOverflowRect()));
+
+    if (markerRect.isEmpty())
+        return;
+
     marker.addRenderedRect(markerRect);
-    
+
     // Optionally highlight the text
     if (renderer().frame().editor().markedTextMatchesAreHighlighted()) {
         Color color = marker.activeMatch() ? renderer().theme().platformActiveTextSearchHighlightColor() : renderer().theme().platformInactiveTextSearchHighlightColor();

Modified: trunk/Source/WebCore/testing/Internals.cpp (190253 => 190254)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-09-25 22:01:21 UTC (rev 190254)
@@ -1045,6 +1045,27 @@
     return marker->description();
 }
 
+String Internals::dumpMarkerRectsForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+{
+    RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec);
+    if (!marker)
+        return String();
+    StringBuilder rectString;
+    rectString.append("marker rects: ");
+    for (const auto& rect : marker->renderedRects()) {
+        rectString.append("(");
+        rectString.appendNumber(rect.x().toFloat());
+        rectString.append(", ");
+        rectString.appendNumber(rect.y().toFloat());
+        rectString.append(", ");
+        rectString.appendNumber(rect.width().toFloat());
+        rectString.append(", ");
+        rectString.appendNumber(rect.height().toFloat());
+        rectString.append(") ");
+    }
+    return rectString.toString();
+}
+
 void Internals::addTextMatchMarker(const Range* range, bool isActive)
 {
     range->ownerDocument().updateLayoutIgnorePendingStylesheets();

Modified: trunk/Source/WebCore/testing/Internals.h (190253 => 190254)


--- trunk/Source/WebCore/testing/Internals.h	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/Source/WebCore/testing/Internals.h	2015-09-25 22:01:21 UTC (rev 190254)
@@ -158,6 +158,7 @@
     unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
     RefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
     String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    String dumpMarkerRectsForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
     void addTextMatchMarker(const Range*, bool isActive);
     void setMarkedTextMatchesAreHighlighted(bool, ExceptionCode&);
 

Modified: trunk/Source/WebCore/testing/Internals.idl (190253 => 190254)


--- trunk/Source/WebCore/testing/Internals.idl	2015-09-25 21:50:48 UTC (rev 190253)
+++ trunk/Source/WebCore/testing/Internals.idl	2015-09-25 22:01:21 UTC (rev 190254)
@@ -131,6 +131,7 @@
     [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType);
     [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
     [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
+    [RaisesException] DOMString dumpMarkerRectsForNode(Node node, DOMString markerType, unsigned long index);
     void addTextMatchMarker(Range range, boolean isActive);
     [RaisesException] void setMarkedTextMatchesAreHighlighted(boolean flag);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to