Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b710a47a6e5332cbbdecacd2df9aa69355e5f95b
      
https://github.com/WebKit/WebKit/commit/b710a47a6e5332cbbdecacd2df9aa69355e5f95b
  Author: Nipun Shukla <[email protected]>
  Date:   2025-10-02 (Thu, 02 Oct 2025)

  Changed paths:
    A 
LayoutTests/fast/css/css-anchor-position/anchor-position-does-not-leak-expected.txt
    A 
LayoutTests/fast/css/css-anchor-position/anchor-position-does-not-leak.html
    M LayoutTests/fast/css/css-anchor-position/anchor-size-page-zoom.html
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.h
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  [World Leaks] - Investigate leaks in 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/
https://bugs.webkit.org/show_bug.cgi?id=298733
rdar://160328982

Reviewed by Ryan Reno and Antti Koivisto.

This leak was found to be caused by 
WebCore::Style::Scope::m_anchorPositionedToAnchorMap,
which contains AnchorPositionedToAnchorEntry as its value. 
AnchorPositionedToAnchorEntry
is a struct which holds AnchorPositionedKey as a member, which itself holds
RefPtr<const Element>. Because Element holds a strong reference to Document, 
which holds
a strong reference to Style::Scope through Document::m_styleScope, we have a 
reference cycle.
This change breaks the cycle by changing the definition of 
AnchorPositionedToAnchorEntry so
that it no longer holds AnchorPositionedKey. This change should fix leaks in 
approximately
270 tests in 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/.

Test: fast/css/css-anchor-position/anchor-position-does-not-leak.html
* 
LayoutTests/fast/css/css-anchor-position/anchor-position-does-not-leak-expected.txt:
 Added.
* LayoutTests/fast/css/css-anchor-position/anchor-position-does-not-leak.html: 
Added.
* LayoutTests/fast/css/css-anchor-position/anchor-size-page-zoom.html:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::AnchorPositionEvaluator::updateAnchorPositioningStatesAfterInterleavedLayout):
* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolve):

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