[webkit-changes] [WebKit/WebKit] 52af77: [Remote Inspection] Targeting incorrectly prefers ...

Wenson Hsieh noreply at github.com
Sun Apr 14 15:06:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 52af773ed3aebb787b7471e81634d5d68d2f7923
      https://github.com/WebKit/WebKit/commit/52af773ed3aebb787b7471e81634d5d68d2f7923
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-04-14 (Sun, 14 Apr 2024)

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

  Log Message:
  -----------
  [Remote Inspection] Targeting incorrectly prefers pseudos over targets that contain their hosts
https://bugs.webkit.org/show_bug.cgi?id=272647
rdar://126299041

Reviewed by Abrar Rahman Protyasha.

When a candidate is chosen as a target, logic in the while loop in `findTargets` filters out other
candidate elements that are redundant, due to being contained within the newly chosen target.
However, this logic doesn't currently handle pseudo elements correctly, which means that front-most
pseudo elements are surfaced as higher-priority targets, even though another container element
enclosing them has already been chosen.

Fix this by augmenting the check to omit pseudo element candidates if their host element is
contained within the newly chosen target.

* LayoutTests/fast/element-targeting/target-container-with-pseudo-elements-expected.txt: Added.
* LayoutTests/fast/element-targeting/target-container-with-pseudo-elements.html: Added.
* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::ElementTargetingController::findTargets):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list