[webkit-changes] [WebKit/WebKit] 5daa77: [CSS-anchor-position-1] Fine-grained invalidation

Antti Koivisto noreply at github.com
Wed Feb 12 12:25:48 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5daa772e687cbea74995e542e6412ffb7bddb1f3
      https://github.com/WebKit/WebKit/commit/5daa772e687cbea74995e542e6412ffb7bddb1f3
  Author: Antti Koivisto <antti at apple.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.h
    M Source/WebCore/style/StyleScope.cpp
    M Source/WebCore/style/StyleScope.h
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  [CSS-anchor-position-1] Fine-grained invalidation
https://bugs.webkit.org/show_bug.cgi?id=287552
rdar://144681624

Reviewed by Alan Baradlay.

Track when anchors move and invalidate anchored element style only when needed.
Before this we just invalidated all anchored elements unconditionally.

* LayoutTests/TestExpectations:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::invalidateForAnchorRectChange):

Add a style invalidation function for this.

* Source/WebCore/dom/Element.h:
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::layout):
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::AnchorPositionEvaluator::updateSnapshottedScrollOffsets):

Take care to also clear the offsets if they are not being applied.

(WebCore::Style::AnchorPositionEvaluator::makeAnchorPositionedForAnchorMap):

Make a reverse map.

* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::invalidateForLayoutDependencies):
(WebCore::Style::Scope::invalidateForContainerDependencies):
(WebCore::Style::Scope::invalidateForAnchorDependencies):

Track the positions of anchors, invalidate if they have moved.

(WebCore::Style::Scope::resetAnchorPositioningStateBeforeStyleResolution):

Reset the transient state only.

(WebCore::Style::Scope::updateAchorPositioningStateAfterStyleResolution):

Update the snapshotted offsets.
Get rid of items that are not anchored anymore.

(WebCore::Style::Scope::updateQueryContainerState): Deleted.
(WebCore::Style::Scope::clearAnchorPositioningState): Deleted.
* Source/WebCore/style/StyleScope.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::~TreeResolver):

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