Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 23215630250e44feb5af74886f2fc5b3b2753b0b
      
https://github.com/WebKit/WebKit/commit/23215630250e44feb5af74886f2fc5b3b2753b0b
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-01-08 (Wed, 08 Jan 2025)

  Changed paths:
    M Source/WebCore/page/ElementTargetingController.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-12.html

  Log Message:
  -----------
  [Element Targeting] Out-of-flow elements that overlap with a hidden element 
are unexpectedly targeted
https://bugs.webkit.org/show_bug.cgi?id=285566
rdar://136358918

Reviewed by Megan Gardner.

Make a small adjustment to avoid double-counting targeted elements that have 
already been hidden,
for the purposes of tracking regions where targeted element visibility is 
repeatedly adjusted.
Currently, adjusting the same element multiple times causes us to immediately 
add the element's
bounding client rect to `m_repeatedAdjustmentClientRegion`, even though the 
second visibility
adjustment is already a no-op (since it was already hidden by the first 
visibility adjustment). Fix
this by updating `newAdjustmentRegion` when applying visibility adjustment only 
if the element was
not already hidden (in effect, making 
`ElementTargetingController::adjustVisibility` idempotent when
the same targeted element is passed in).

* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::ElementTargetingController::adjustVisibility):

See above for more details.

* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm:
(TestWebKitAPI::TEST(ElementTargeting, 
DoNotBeginRepeatedVisibilityAdjustmentIfTargetIsAlreadyHidden)):

Add a new API test to exercise this change, by verifying that an out-of-flow 
container that is
revealed in the area where a targeted element has been hidden twice doesn't 
immediately get hidden
as well (due to 
`ElementTargetingController::adjustVisibilityInRepeatedlyTargetedRegions`).

* Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-12.html: Added.

Canonical link: https://commits.webkit.org/288593@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