Skip to content

Commit

Permalink
Unreviewed, reverting 274668@main
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=269487
rdar://123027377

breaks TestWebKitAPI.WKWebExtensionAPIMenus.MacSelectionContextMenuItems

Reverted change:

"Look Up" popover is not attached to highlighted words at the end of a line on New York Times
https://bugs.webkit.org/show_bug.cgi?id=269341
rdar://120695659
https://commits.webkit.org/274668@main

Canonical link: https://commits.webkit.org/274760@main
  • Loading branch information
martadarbinyan committed Feb 15, 2024
1 parent 19bafb5 commit 4d6afe2
Show file tree
Hide file tree
Showing 22 changed files with 176 additions and 130 deletions.
2 changes: 1 addition & 1 deletion LayoutTests/accessibility/element-line-rects-and-text.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</svg>

<!-- Paragraph with soft linebreaks after space and dash. -->
<p style="white-space: pre-wrap">abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789</p>
<p>abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789</p>
</div>

<p id="description"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,35 @@ a b
Testing first letter with narrow width...
Default behavior
'a' (location 0 length 1)
IgnoresWhiteSpaceAtEndOfRun
'a' (location 0 length 1)

Testing first letter with wide width...
Default behavior
'a' (location 0 length 1)
IgnoresWhiteSpaceAtEndOfRun
'a' (location 0 length 1)

Testing everything except last letter with narrow width...
Default behavior
'a' (location 0 length 1)
' ' (location 1 length 0)
IgnoresWhiteSpaceAtEndOfRun
'a' (location 0 length 1)

Testing everything except last letter with wide width...
Default behavior
'a ' (location 0 length 2)
IgnoresWhiteSpaceAtEndOfRun
'a ' (location 0 length 2)

Testing everything with narrow width...
Default behavior
'a' (location 0 length 1)
' ' (location 1 length 0)
'b' (location 2 length 1)
'\n' (location 3 length 0)
IgnoresWhiteSpaceAtEndOfRun
'a' (location 0 length 1)
' ' (location 1 length 0)
'b' (location 1 length 1)
Expand All @@ -28,6 +42,10 @@ Testing everything with wide width...
'a ' (location 0 length 2)
'b' (location 2 length 1)
'\n' (location 3 length 0)
IgnoresWhiteSpaceAtEndOfRun
'a ' (location 0 length 2)
'b' (location 2 length 1)
'\n' (location 3 length 0)

PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

[
[ ],
[ "IgnoresWhiteSpaceAtEndOfRun" ],
].forEach((behaviors) => {
debug(" " + (behaviors.join("|") || "Default behavior"));
for (let {text, range} of internals.statesOfTextIterator(rangeToSelect, behaviors))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Testing first line...
Default behavior
'Lorem ipsum' (location 0 length 12)
' ' (location 12 length 0)
IgnoresWhiteSpaceAtEndOfRun
'Lorem ipsum' (location 0 length 11)

Testing second line...
Default behavior
'dolor sit amet,' (location 12 length 16)
' ' (location 28 length 0)
IgnoresWhiteSpaceAtEndOfRun
'dolor sit amet,' (location 11 length 15)

Testing third line...
Default behavior
'consectetur' (location 28 length 12)
' ' (location 40 length 0)
IgnoresWhiteSpaceAtEndOfRun
'consectetur' (location 27 length 11)

Testing fourth line...
Default behavior
'adipiscing elit.' (location 40 length 16)
IgnoresWhiteSpaceAtEndOfRun
'adipiscing elit.' (location 39 length 16)

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

[
[ ],
[ "IgnoresWhiteSpaceAtEndOfRun" ],
].forEach((behaviors) => {
debug(" " + (behaviors.join("|") || "Default behavior"));
for (let {text, range} of internals.statesOfTextIterator(rangeToSelect, behaviors))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view height values 100 to 1300.
Range with view 500x100, scrollTop 500: {2249, 359}
Range with view 500x200, scrollTop 500: {2249, 809}
Range with view 500x300, scrollTop 500: {2249, 1259}
Range with view 500x400, scrollTop 500: {2249, 1709}
Range with view 500x500, scrollTop 500: {2249, 2159}
Range with view 500x600, scrollTop 500: {2249, 2609}
Range with view 500x700, scrollTop 500: {2249, 3059}
Range with view 500x800, scrollTop 500: {2249, 3489}
Range with view 500x900, scrollTop 500: {1799, 3939}
Range with view 500x1000, scrollTop 500: {1349, 4389}
Range with view 500x1100, scrollTop 500: {899, 4839}
Range with view 500x1200, scrollTop 500: {449, 5289}
Range with view 500x100, scrollTop 500: {2250, 360}
Range with view 500x200, scrollTop 500: {2250, 810}
Range with view 500x300, scrollTop 500: {2250, 1260}
Range with view 500x400, scrollTop 500: {2250, 1710}
Range with view 500x500, scrollTop 500: {2250, 2160}
Range with view 500x600, scrollTop 500: {2250, 2610}
Range with view 500x700, scrollTop 500: {2250, 3060}
Range with view 500x800, scrollTop 500: {2250, 3489}
Range with view 500x900, scrollTop 500: {1800, 3939}
Range with view 500x1000, scrollTop 500: {1350, 4389}
Range with view 500x1100, scrollTop 500: {900, 4839}
Range with view 500x1200, scrollTop 500: {450, 5289}
Range with view 500x1300, scrollTop 500: {0, 5739}

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view width values 100 to 1300.
Range with view 100x500, scrollTop 500: {224, 359}
Range with view 200x500, scrollTop 500: {874, 839}
Range with view 300x500, scrollTop 500: {1249, 1199}
Range with view 400x500, scrollTop 500: {1749, 1679}
Range with view 500x500, scrollTop 500: {2249, 2159}
Range with view 600x500, scrollTop 500: {2749, 2639}
Range with view 700x500, scrollTop 500: {2729, 3009}
Range with view 800x500, scrollTop 500: {2249, 3489}
Range with view 900x500, scrollTop 500: {1814, 3924}
Range with view 1000x500, scrollTop 500: {1479, 4259}
Range with view 1100x500, scrollTop 500: {819, 4919}
Range with view 1200x500, scrollTop 500: {449, 5289}
Range with view 100x500, scrollTop 500: {225, 360}
Range with view 200x500, scrollTop 500: {875, 840}
Range with view 300x500, scrollTop 500: {1250, 1200}
Range with view 400x500, scrollTop 500: {1750, 1680}
Range with view 500x500, scrollTop 500: {2250, 2160}
Range with view 600x500, scrollTop 500: {2750, 2640}
Range with view 700x500, scrollTop 500: {2730, 3009}
Range with view 800x500, scrollTop 500: {2250, 3489}
Range with view 900x500, scrollTop 500: {1815, 3924}
Range with view 1000x500, scrollTop 500: {1480, 4259}
Range with view 1100x500, scrollTop 500: {820, 4919}
Range with view 1200x500, scrollTop 500: {450, 5289}
Range with view 1300x500, scrollTop 500: {0, 5739}

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ z
Another line of text.

Jack and Jill went up the hill to fetch a pail of water. Jack fell down...
abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789

This tests that lineRectsAndText returns the correct values.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
This tests that visibleCharacterRange returns expected visible ranges.

Range of text-less div: {0, 0}
Range of text div with default view size: {0, 4199}
Range of text div with default view size: {0, 4200}
Range with view 0x500, scrollTop 0: {9223372036854775807, 0}
Range with view 500x0, scrollTop 0: {9223372036854775807, 0}
Range with view 1x500, scrollTop 0: {9223372036854775807, 0}
Range with view 500x1, scrollTop 0: {9223372036854775807, 0}
Range with view 80x80, scrollTop 0: {0, 19}
Range with view 500x200, scrollTop 0: {0, 719}
Range with view 80x80, scrollTop 0: {0, 20}
Range with view 500x200, scrollTop 0: {0, 720}

PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view height values 100 to 1300.
Range with view 500x100, scrollTop 500: {2249, 359}
Range with view 500x200, scrollTop 500: {2249, 809}
Range with view 500x300, scrollTop 500: {2249, 1259}
Range with view 500x400, scrollTop 500: {2249, 1709}
Range with view 500x500, scrollTop 500: {2249, 2159}
Range with view 500x600, scrollTop 500: {2249, 2609}
Range with view 500x700, scrollTop 500: {2249, 3059}
Range with view 500x800, scrollTop 500: {2249, 3489}
Range with view 500x900, scrollTop 500: {1799, 3939}
Range with view 500x1000, scrollTop 500: {1349, 4389}
Range with view 500x1100, scrollTop 500: {899, 4839}
Range with view 500x1200, scrollTop 500: {449, 5289}
Range with view 500x100, scrollTop 500: {2250, 360}
Range with view 500x200, scrollTop 500: {2250, 810}
Range with view 500x300, scrollTop 500: {2250, 1260}
Range with view 500x400, scrollTop 500: {2250, 1710}
Range with view 500x500, scrollTop 500: {2250, 2160}
Range with view 500x600, scrollTop 500: {2250, 2610}
Range with view 500x700, scrollTop 500: {2250, 3060}
Range with view 500x800, scrollTop 500: {2250, 3489}
Range with view 500x900, scrollTop 500: {2250, 3489}
Range with view 500x1000, scrollTop 500: {2250, 3489}
Range with view 500x1100, scrollTop 500: {2250, 3489}
Range with view 500x1200, scrollTop 500: {2250, 3489}
Range with view 500x1300, scrollTop 500: {0, 5739}

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view width values 100 to 1300.
Range with view 100x500, scrollTop 500: {224, 359}
Range with view 200x500, scrollTop 500: {874, 839}
Range with view 300x500, scrollTop 500: {1249, 1199}
Range with view 400x500, scrollTop 500: {1749, 1679}
Range with view 500x500, scrollTop 500: {2249, 2159}
Range with view 600x500, scrollTop 500: {2749, 2639}
Range with view 700x500, scrollTop 500: {2729, 3009}
Range with view 800x500, scrollTop 500: {2249, 3489}
Range with view 900x500, scrollTop 500: {1814, 3924}
Range with view 1000x500, scrollTop 500: {1479, 4259}
Range with view 1100x500, scrollTop 500: {819, 4919}
Range with view 1200x500, scrollTop 500: {449, 5289}
Range with view 100x500, scrollTop 500: {375, 360}
Range with view 200x500, scrollTop 500: {875, 840}
Range with view 300x500, scrollTop 500: {1250, 1200}
Range with view 400x500, scrollTop 500: {1750, 1680}
Range with view 500x500, scrollTop 500: {2250, 2160}
Range with view 600x500, scrollTop 500: {2750, 2640}
Range with view 700x500, scrollTop 500: {2730, 3009}
Range with view 800x500, scrollTop 500: {2250, 3489}
Range with view 900x500, scrollTop 500: {1815, 3924}
Range with view 1000x500, scrollTop 500: {1480, 4259}
Range with view 1100x500, scrollTop 500: {820, 4919}
Range with view 1200x500, scrollTop 500: {450, 5289}
Range with view 1300x500, scrollTop 500: {0, 5739}

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ z
Another line of text.

Jack and Jill went up the hill to fetch a pail of water. Jack fell down...
abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789-abcdefghijklmnopqrstuvwxyz0123456789

This tests that lineRectsAndText returns the correct values.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
This tests that visibleCharacterRange returns expected visible ranges.

Range of text-less div: NSRange: {0, 0}
Range of text div with default view size: NSRange: {0, 4494}
Range of text div with default view size: NSRange: {0, 4495}
Range with view 0x500, scrollTop 0: NSRange: {9223372036854775807, 0}
Range with view 500x0, scrollTop 0: NSRange: {9223372036854775807, 0}
Range with view 1x500, scrollTop 0: NSRange: {9223372036854775807, 0}
Range with view 500x1, scrollTop 0: NSRange: {9223372036854775807, 0}
Range with view 80x80, scrollTop 0: NSRange: {0, 19}
Range with view 500x200, scrollTop 0: NSRange: {0, 809}
Range with view 80x80, scrollTop 0: NSRange: {0, 20}
Range with view 500x200, scrollTop 0: NSRange: {0, 810}

PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view height values 100 to 1300.
Range with view 500x100, scrollTop 500: NSRange: {719, 359}
Range with view 500x200, scrollTop 500: NSRange: {2519, 899}
Range with view 500x300, scrollTop 500: NSRange: {2519, 1439}
Range with view 500x400, scrollTop 500: NSRange: {2519, 1889}
Range with view 500x500, scrollTop 500: NSRange: {2519, 2429}
Range with view 500x600, scrollTop 500: NSRange: {2519, 2879}
Range with view 500x700, scrollTop 500: NSRange: {2339, 3399}
Range with view 500x800, scrollTop 500: NSRange: {1799, 3939}
Range with view 500x900, scrollTop 500: NSRange: {1349, 4389}
Range with view 500x1000, scrollTop 500: NSRange: {809, 4929}
Range with view 500x1100, scrollTop 500: NSRange: {359, 5379}
Range with view 500x100, scrollTop 500: NSRange: {720, 360}
Range with view 500x200, scrollTop 500: NSRange: {2520, 900}
Range with view 500x300, scrollTop 500: NSRange: {2520, 1440}
Range with view 500x400, scrollTop 500: NSRange: {2520, 1890}
Range with view 500x500, scrollTop 500: NSRange: {2520, 2430}
Range with view 500x600, scrollTop 500: NSRange: {2520, 2880}
Range with view 500x700, scrollTop 500: NSRange: {2340, 3399}
Range with view 500x800, scrollTop 500: NSRange: {1800, 3939}
Range with view 500x900, scrollTop 500: NSRange: {1350, 4389}
Range with view 500x1000, scrollTop 500: NSRange: {810, 4929}
Range with view 500x1100, scrollTop 500: NSRange: {360, 5379}
Range with view 500x1200, scrollTop 500: NSRange: {0, 5739}
Range with view 500x1300, scrollTop 500: NSRange: {0, 5739}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing scrollTop values 0 to 2000.
Range with view 200x500, scrollTop 0: NSRange: {0, 809}
Range with view 200x500, scrollTop 100: NSRange: {179, 779}
Range with view 200x500, scrollTop 200: NSRange: {329, 809}
Range with view 200x500, scrollTop 300: NSRange: {509, 809}
Range with view 200x500, scrollTop 400: NSRange: {659, 809}
Range with view 200x500, scrollTop 500: NSRange: {839, 809}
Range with view 200x500, scrollTop 600: NSRange: {989, 809}
Range with view 200x500, scrollTop 700: NSRange: {1169, 809}
Range with view 200x500, scrollTop 800: NSRange: {1319, 809}
Range with view 200x500, scrollTop 900: NSRange: {1499, 809}
Range with view 200x500, scrollTop 1000: NSRange: {1679, 779}
Range with view 200x500, scrollTop 1100: NSRange: {1829, 809}
Range with view 200x500, scrollTop 1200: NSRange: {2009, 809}
Range with view 200x500, scrollTop 1300: NSRange: {2159, 809}
Range with view 200x500, scrollTop 1400: NSRange: {2339, 809}
Range with view 200x500, scrollTop 1500: NSRange: {2489, 809}
Range with view 200x500, scrollTop 1600: NSRange: {2669, 809}
Range with view 200x500, scrollTop 1700: NSRange: {2819, 809}
Range with view 200x500, scrollTop 1800: NSRange: {2999, 809}
Range with view 200x500, scrollTop 1900: NSRange: {3179, 779}
Range with view 200x500, scrollTop 2000: NSRange: {3329, 809}
Range with view 200x500, scrollTop 0: NSRange: {0, 810}
Range with view 200x500, scrollTop 100: NSRange: {180, 780}
Range with view 200x500, scrollTop 200: NSRange: {330, 810}
Range with view 200x500, scrollTop 300: NSRange: {510, 810}
Range with view 200x500, scrollTop 400: NSRange: {660, 810}
Range with view 200x500, scrollTop 500: NSRange: {840, 810}
Range with view 200x500, scrollTop 600: NSRange: {990, 810}
Range with view 200x500, scrollTop 700: NSRange: {1170, 810}
Range with view 200x500, scrollTop 800: NSRange: {1320, 810}
Range with view 200x500, scrollTop 900: NSRange: {1500, 810}
Range with view 200x500, scrollTop 1000: NSRange: {1680, 780}
Range with view 200x500, scrollTop 1100: NSRange: {1830, 810}
Range with view 200x500, scrollTop 1200: NSRange: {2010, 810}
Range with view 200x500, scrollTop 1300: NSRange: {2160, 810}
Range with view 200x500, scrollTop 1400: NSRange: {2340, 810}
Range with view 200x500, scrollTop 1500: NSRange: {2490, 810}
Range with view 200x500, scrollTop 1600: NSRange: {2670, 810}
Range with view 200x500, scrollTop 1700: NSRange: {2820, 810}
Range with view 200x500, scrollTop 1800: NSRange: {3000, 810}
Range with view 200x500, scrollTop 1900: NSRange: {3180, 780}
Range with view 200x500, scrollTop 2000: NSRange: {3330, 810}

PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ This tests that visibleCharacterRange returns expected visible ranges with vario


Testing view width values 100 to 1300.
Range with view 100x500, scrollTop 500: NSRange: {79, 259}
Range with view 200x500, scrollTop 500: NSRange: {839, 809}
Range with view 300x500, scrollTop 500: NSRange: {1399, 1349}
Range with view 400x500, scrollTop 500: NSRange: {1959, 1889}
Range with view 500x500, scrollTop 500: NSRange: {2519, 2429}
Range with view 600x500, scrollTop 500: NSRange: {2939, 2799}
Range with view 700x500, scrollTop 500: NSRange: {2374, 3364}
Range with view 800x500, scrollTop 500: NSRange: {1884, 3854}
Range with view 900x500, scrollTop 500: NSRange: {1319, 4419}
Range with view 1000x500, scrollTop 500: NSRange: {924, 4814}
Range with view 1100x500, scrollTop 500: NSRange: {399, 5339}
Range with view 100x500, scrollTop 500: NSRange: {80, 260}
Range with view 200x500, scrollTop 500: NSRange: {840, 810}
Range with view 300x500, scrollTop 500: NSRange: {1400, 1350}
Range with view 400x500, scrollTop 500: NSRange: {1960, 1890}
Range with view 500x500, scrollTop 500: NSRange: {2520, 2430}
Range with view 600x500, scrollTop 500: NSRange: {2940, 2799}
Range with view 700x500, scrollTop 500: NSRange: {2375, 3364}
Range with view 800x500, scrollTop 500: NSRange: {1885, 3854}
Range with view 900x500, scrollTop 500: NSRange: {1320, 4419}
Range with view 1000x500, scrollTop 500: NSRange: {925, 4814}
Range with view 1100x500, scrollTop 500: NSRange: {400, 5339}
Range with view 1200x500, scrollTop 500: NSRange: {0, 5739}
Range with view 1300x500, scrollTop 500: NSRange: {0, 5739}

Expand Down
Loading

0 comments on commit 4d6afe2

Please sign in to comment.