Diff
Modified: trunk/LayoutTests/ChangeLog (282051 => 282052)
--- trunk/LayoutTests/ChangeLog 2021-09-05 23:47:34 UTC (rev 282051)
+++ trunk/LayoutTests/ChangeLog 2021-09-06 02:48:59 UTC (rev 282052)
@@ -1,3 +1,14 @@
+2021-09-05 Alan Bujtas <[email protected]>
+
+ In-page search results overlay broken if the result spans more than two elements
+ https://bugs.webkit.org/show_bug.cgi?id=229926
+ <rdar://82741616>
+
+ Reviewed by Tim Horton.
+
+ * fast/shrink-wrap/rect-shrink-wrap-expected.html:
+ * fast/shrink-wrap/rect-shrink-wrap.html: Add the out-of-order rect case.
+
2021-09-05 Antti Koivisto <[email protected]>
[LFC][Integration] Skip inline boxes in iterator
Modified: trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap-expected.html (282051 => 282052)
--- trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap-expected.html 2021-09-05 23:47:34 UTC (rev 282051)
+++ trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap-expected.html 2021-09-06 02:48:59 UTC (rev 282052)
@@ -212,6 +212,18 @@
<rect x="0" y="30" width="50" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
<path d="M 30 7.5 L 30 7.5 C 30 3.35786 33.3579 6.66106e-16 37.5 0 L 42.5 0 L 42.5 0 C 46.6421 2.53633e-16 50 3.35786 50 7.5 L 50 12.5 L 50 15 L 50 17.5 L 50 20 L 50 27.5 L 50 30 L 50 32.5 L 50 35 L 50 42.5 L 50 42.5 C 50 46.6421 46.6421 50 42.5 50 L 8 50 L 8 50 C 3.58172 50 5.41083e-16 46.4183 0 42 L 0 37.5 L 0 37.5 C 5.07265e-16 33.3579 3.35786 30 7.5 30 L 7.5 30 L 7.5 30 C 11.6421 30 15 26.6421 15 22.5 L 15 22.5 L 15 22.5 C 15 18.3579 18.3579 15 22.5 15 L 22.5 15 L 22.5 15 C 26.6421 15 30 11.6421 30 7.5 Z" fill="none" stroke="blue" stroke-width="3"></path>
</g>
+ <g transform="translate(580, 340)">
+ <rect x="0" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <rect x="30" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <rect x="60" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <path d="M 0 8 L 0 8 C 5.41083e-16 3.58172 3.58172 1.50582e-15 8 1.77636e-15 L 22 0 L 30 0 L 52 0 L 60 0 L 82 0 L 82 0 C 86.4183 2.70542e-16 90 3.58172 90 8 L 90 12 L 90 12 C 90 16.4183 86.4183 20 82 20 L 68 20 L 60 20 L 38 20 L 30 20 L 8 20 L 8 20 C 3.58172 20 5.41083e-16 16.4183 0 12 Z" fill="none" stroke="blue" stroke-width="3"></path>
+ </g>
+ <g transform="translate(580, 380)">
+ <rect x="0" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <rect x="30" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <rect x="60" y="0" width="30" height="20" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
+ <path d="M 0 8 L 0 8 C 5.41083e-16 3.58172 3.58172 1.50582e-15 8 1.77636e-15 L 22 0 L 30 0 L 52 0 L 60 0 L 82 0 L 82 0 C 86.4183 2.70542e-16 90 3.58172 90 8 L 90 12 L 90 12 C 90 16.4183 86.4183 20 82 20 L 68 20 L 60 20 L 38 20 L 30 20 L 8 20 L 8 20 C 3.58172 20 5.41083e-16 16.4183 0 12 Z" fill="none" stroke="blue" stroke-width="3"></path>
+ </g>
<g transform="translate(580, 300)">
<rect x="0" y="0" width="1" height="1" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
<rect x="4" y="0" width="1" height="1" fill="rgba(0, 0, 0, 0.2)" stroke="rgba(0, 0, 0, 0.5)"></rect>
Modified: trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap.html (282051 => 282052)
--- trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap.html 2021-09-05 23:47:34 UTC (rev 282051)
+++ trunk/LayoutTests/fast/shrink-wrap/rect-shrink-wrap.html 2021-09-06 02:48:59 UTC (rev 282052)
@@ -234,6 +234,18 @@
[15, 15, 35, 20],
[0, 30, 50, 20]]);
+ // Out-of-order rects:
+
+ testRects([580, 340], [
+ [60, 0, 30, 20],
+ [0, 0, 30, 20],
+ [30, 0, 30, 20]]);
+
+ testRects([580, 380], [
+ [30, 0, 30, 20],
+ [60, 0, 30, 20],
+ [0, 0, 30, 20]]);
+
// More than 20 (our shrinkwrapping limit):
testRects([580, 300], [
Modified: trunk/Source/WebCore/ChangeLog (282051 => 282052)
--- trunk/Source/WebCore/ChangeLog 2021-09-05 23:47:34 UTC (rev 282051)
+++ trunk/Source/WebCore/ChangeLog 2021-09-06 02:48:59 UTC (rev 282052)
@@ -1,5 +1,23 @@
2021-09-05 Alan Bujtas <[email protected]>
+ In-page search results overlay broken if the result spans more than two elements
+ https://bugs.webkit.org/show_bug.cgi?id=229926
+ <rdar://82741616>
+
+ Reviewed by Tim Horton.
+
+ pathsWithShrinkWrappedRects fails to form a closed path for adjoining rects when they are horizontally out-of-order.
+ e.g.
+ 1: (60,0) (30x20)
+ 2: (0,0) (30x20)
+ 3: (30,0) (30x20)
+ Let's sort the rects horizontally too (as we already do y ordering in polygonsForRect).
+
+ * platform/graphics/PathUtilities.cpp:
+ (WebCore::polygonsForRect):
+
+2021-09-05 Alan Bujtas <[email protected]>
+
Let content with newlineCharacter be measured by FontCascade::widthForSimpleText
https://bugs.webkit.org/show_bug.cgi?id=229849
<rdar://problem/82708348>
Modified: trunk/Source/WebCore/platform/graphics/PathUtilities.cpp (282051 => 282052)
--- trunk/Source/WebCore/platform/graphics/PathUtilities.cpp 2021-09-05 23:47:34 UTC (rev 282051)
+++ trunk/Source/WebCore/platform/graphics/PathUtilities.cpp 2021-09-06 02:48:59 UTC (rev 282052)
@@ -260,7 +260,13 @@
static Vector<FloatPointGraph::Polygon> polygonsForRect(const Vector<FloatRect>& rects, FloatPointGraph& graph)
{
Vector<FloatRect> sortedRects = rects;
- std::sort(sortedRects.begin(), sortedRects.end(), [](FloatRect a, FloatRect b) { return b.y() > a.y(); });
+ // FIXME: Replace it with 2 dimensional sort.
+ std::sort(sortedRects.begin(), sortedRects.end(), [](FloatRect a, FloatRect b) {
+ return a.x() < b.x();
+ });
+ std::sort(sortedRects.begin(), sortedRects.end(), [](FloatRect a, FloatRect b) {
+ return a.y() < b.y();
+ });
Vector<FloatPointGraph::Polygon> rectPolygons;
rectPolygons.reserveInitialCapacity(sortedRects.size());