Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd1c5258d78a050aee737c0a5e7cf93d7c0ec3ee
      
https://github.com/WebKit/WebKit/commit/bd1c5258d78a050aee737c0a5e7cf93d7c0ec3ee
  Author: Kiet Ho <[email protected]>
  Date:   2025-10-01 (Wed, 01 Oct 2025)

  Changed paths:
    M Source/WebCore/rendering/style/PositionTryFallback.cpp
    M Source/WebCore/rendering/style/PositionTryFallback.h
    M Source/WebCore/style/StyleExtractorConverter.h
    M Source/WebCore/style/StyleExtractorSerializer.h
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h

  Log Message:
  -----------
  [css-anchor-position-1] Rework re-generating position option when applying it 
changes scroll container size
rdar://161599518
https://bugs.webkit.org/show_bug.cgi?id=299825

Reviewed by Antti Koivisto.

300465@main implements re-generating position option style when applying it 
changes
the scroll container size. It does this by simply deleting the entire 
PositionOption
object. TreeResolver::generatePositionOptionsIfNeeded will then re-generate the
PositionOption, and because we save the last successful (also the last tried)
position option at style resolution time, 
TreeResolver::sortPositionOptionsIfNeeded
will adjust the re-generated PositionOption to continue trying from the position
option that caused re-generation.

However, the spec dictates that the last successful position option is 
remembered
when ResizeObserver events are delivered. To prepare for this behavior, this
patch re-work 300465@main to not rely on last successful position option
being remembered at style resolution time.

* Source/WebCore/rendering/style/PositionTryFallback.cpp:
(WebCore::Style::operator==):
(WebCore::Style::operator<<):
    - Explicitly ref-count PositionTryFallback::positionAreaProperties before 
using
      it, since it's now non-const

* Source/WebCore/rendering/style/PositionTryFallback.h:
    - Make PositionTryFallback::positionAreaProperties non-const so 
PositionTryFallback
      can be copied around.

* Source/WebCore/style/StyleExtractorConverter.h:
(WebCore::Style::ExtractorConverter::convertPositionTryFallbacks):
* Source/WebCore/style/StyleExtractorSerializer.h:
(WebCore::Style::ExtractorSerializer::serializePositionTryFallbacks):
    - Explicitly ref-count PositionTryFallback::positionAreaProperties before 
using it.

* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForStyleable):
    - Pass resolutionContext to TreeResolver::tryChoosePositionOption

(WebCore::Style::TreeResolver::resolvePseudoElement):
    - Pass resolutionContext to TreeResolver::tryChoosePositionOption

(WebCore::Style::TreeResolver::generatePositionOptionsIfNeeded):
    - Save the original resolved style in PositionOptions.
    - For each generated PositionOption, save the used option.

(WebCore::Style::TreeResolver::tryChoosePositionOption):
    - When the scroll container size changes, re-generate a new style on the fly
      to replace the existing style.
    - Add a ResolutionContext argument. TreeResolver::generatePositionOption 
requires
      the ResolutionContext to generate a style.

* Source/WebCore/style/StyleTreeResolver.h:
    - PositionOption: additionally store (1) the option used to generate the 
style,
      and (2) the scroll container size when the PositionOption is generated.
    - PositionOptions: (1) store the original ResolvedStyle, so it can be used 
for
      style re-generation (2) remove the saved scroll container size - this 
size is
      now tracked for each PositionOption.

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