Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d86d00141e75e84612b84cd452cc15f54a7cecb2
      
https://github.com/WebKit/WebKit/commit/d86d00141e75e84612b84cd452cc15f54a7cecb2
  Author: Antti Koivisto <[email protected]>
  Date:   2025-02-22 (Sat, 22 Feb 2025)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/try-tactic-basic-anchor-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/try-tactic-basic-anchor.html
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/RenderView.h
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.h
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilderState.h
    M Source/WebCore/style/StyleScope.cpp
    M Source/WebCore/style/StyleScope.h
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h

  Log Message:
  -----------
  [css-anchor-position-1] Evaluate position-try-fallbacks with try-tactic
https://bugs.webkit.org/show_bug.cgi?id=288287
rdar://145359529

Reviewed by Alan Baradlay.

Implement basic avaluation support for position-try-fallbacks property.
Only <try-tactic> values flip-inline and flip-block are supported by this patch.

https://drafts.csswg.org/css-anchor-position-1/#position-try-fallbacks

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/try-tactic-basic-anchor-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/try-tactic-basic-anchor.html:
 Added.

Add a basic test. Almost all existing WPTs for <try-tactic> also use 
@position-try rules.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::interleavedLayout):

Add a simpified layout entry point for interleaving.

* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::styleWillChange):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::registerPositionTryBox):
(WebCore::RenderView::unregisterPositionTryBox):

Track boxes with position-try for invalidation.

* Source/WebCore/rendering/RenderView.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::computeInsetValue):
(WebCore::Style::AnchorPositionEvaluator::evaluate):

Flip the sides used in anchor();

(WebCore::Style::flipHorizontal):
(WebCore::Style::flipVertical):
(WebCore::Style::AnchorPositionEvaluator::resolvePositionTryFallbackProperty):

Property flip helper.

(WebCore::Style::AnchorPositionEvaluator::overflowsContainingBlock):

Helper to test for overlow.

* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):
(WebCore::Style::Builder::applyProperty):

Flip the property as needed when building position option styles.

* Source/WebCore/style/StyleBuilder.h:
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::BuilderState):
* Source/WebCore/style/StyleBuilderState.h:
(WebCore::Style::BuilderState::positionTryFallback const):
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::invalidateForLayoutDependencies):
(WebCore::Style::Scope::invalidateForPositionTryFallbacks):

Invalidation support.

* Source/WebCore/style/StyleScope.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForStyleable):

If we have position options return the next option instead of computing the 
style.

(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolveStartingStyle const):
(WebCore::Style::TreeResolver::resolveAfterChangeStyleForNonAnimated const):
(WebCore::Style::TreeResolver::resolveAgainInDifferentContext const):

Add argument and rename to use in fallback resolution.

(WebCore::Style::TreeResolver::resolveComposedTree):
(WebCore::Style::TreeResolver::resolve):

Invalidate for interleaving if we have positions options we haven't chosen yet.

(WebCore::Style::TreeResolver::resolveElement):

Generate position options from position-try-fallbacks after resolving the style.

(WebCore::Style::TreeResolver::generatePositionOptionsIfNeeded):

Go through position-try-fallbacks and generate a position option for each as 
needed.

(WebCore::Style::TreeResolver::generatePositionOption):

Spin the style builder to generate a position option.

(WebCore::Style::TreeResolver::tryChoosePositionOption):

See if the current style overflows the containing block and try the next option 
if it does.

* Source/WebCore/style/StyleTreeResolver.h:

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