Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6687e347f6f9a0538b3bb2902a530161a1201195
      
https://github.com/WebKit/WebKit/commit/6687e347f6f9a0538b3bb2902a530161a1201195
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-01-02 (Thu, 02 Jan 2025)

  Changed paths:
    A 
LayoutTests/fast/element-targeting/target-container-with-visual-overflow-expected.txt
    A 
LayoutTests/fast/element-targeting/target-container-with-visual-overflow.html
    M Source/WebCore/page/ElementTargetingController.cpp
    M Source/WebCore/page/ElementTargetingController.h

  Log Message:
  -----------
  [Remote Inspection] youtube.com: targeting 'Try searching to get started' 
selects the entire app
https://bugs.webkit.org/show_bug.cgi?id=285265
rdar://133476860

Reviewed by Richard Robinson.

Make a couple small adjustments to element targeting heuristics:

1.  When computing viewport area ratio for targeted elements, expand the bounds 
of containers with
    visual overflow to include the bounds of their children. Ideally, this 
would recurse down the
    DOM tree to include all descendants, but simply taking immediate children 
into account (with
    a caching strategy to avoid repeating work) seems to work well in practice, 
without requiring us
    to compute the absolute bounds for all elements in the document when 
targeting.

2.  Don't consider viewport area ratio when performing selector-based 
targeting. This allows element
    targeting to properly reveal visually dissimilar elements that were 
previously hidden through
    element targeting, in the case where they're no longer candidates for 
targeting due to being too
    large or small relative to the viewport.

* 
LayoutTests/fast/element-targeting/target-container-with-visual-overflow-expected.txt:
 Added.
* 
LayoutTests/fast/element-targeting/target-container-with-visual-overflow.html: 
Added.

Add a layout test to exercise the fix, by verifying that a container with 
visual overflow covering
the entire viewport gets skipped when targeting.

* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::ElementTargetingController::findTargets):
(WebCore::ElementTargetingController::findAllTargets):
(WebCore::absoluteBoundsForTargetAreaRatio):
(WebCore::ElementTargetingController::extractTargets):

See above for more details.

* Source/WebCore/page/ElementTargetingController.h:

Canonical link: https://commits.webkit.org/288365@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to