haikuwebkit/LayoutTests/fast/text-indicator/text-indicator-empty-link-e...

12 lines
522 B
Plaintext
Raw Permalink Normal View History

[Cocoa] Text indicator for an image link on the front page of apple.com looks wrong https://bugs.webkit.org/show_bug.cgi?id=201724 <rdar://problem/54622894> Reviewed by Tim Horton. Source/WebCore: When computing the bounds of the range (<a>, 0) to (<a>, 1) for a text indicator snapshot where <a> is a link with a single non-breaking whitespace character, we currently use the text rect of the single space. This leads to a confusing text indicator, as the resulting snapshot is a tiny blank square in the top left corner of the link. This problem manifests when starting a drag or showing the system context menu on iOS, or force clicking or three-finger tapping to show a preview on macOS. To address this scenario, tweak the heuristic in the case where the text indicator option TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges is specified, such that we consider a range containing only text with whitespaces to be "complex"; additionally, instead of falling back to the range's bounding rect (which in this case is still tiny), fall back to the common ancestor container's bounding rect, which encompasses not only the text inside the range but also the element containing the range (in this case, the anchor element). Test: fast/text-indicator/text-indicator-empty-link.html * page/TextIndicator.cpp: (WebCore::containsOnlyWhiteSpaceText): Add a helper to determine whether a Range is comprised only of rendered text that only contains whitespace characters. (WebCore::initializeIndicator): See ChangeLog entry above for more detail. LayoutTests: Add a new layout test to exercise this scenario. * fast/text-indicator/text-indicator-empty-link-expected.txt: Added. * fast/text-indicator/text-indicator-empty-link.html: Added. Canonical link: https://commits.webkit.org/215369@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-12 19:36:00 +00:00
PASS 0 is >= boundingRect.x
PASS 0 is >= boundingRect.y
PASS boundingRect.width is >= innerWidth
PASS boundingRect.height is >= innerHeight
PASS successfullyParsed is true
TEST COMPLETE
 
To test manually, force click on macOS or begin a drag on iPadOS here. The preview highlight rect or targeted drag preview (respectively) should encompass the entire window, instead of just a tiny piece of empty text in the upper left hand corner.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".