Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f1331f824341b2ff50f8db07d52de739de614349
      
https://github.com/WebKit/WebKit/commit/f1331f824341b2ff50f8db07d52de739de614349
  Author: Antti Koivisto <[email protected]>
  Date:   2025-04-18 (Fri, 18 Apr 2025)

  Changed paths:
    M Source/WebCore/css/CSSToStyleMap.cpp
    M Source/WebCore/platform/animation/Animation.h
    M Source/WebCore/style/MatchResultCache.cpp
    M Source/WebCore/style/MatchResultCache.h
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/PropertyCascade.h
    M Source/WebCore/style/ResolvedStyle.h
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebCore/style/StyleAdjuster.h
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilder.h
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/style/StyleResolver.h
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  Don't apply unaffected properties on inline style mutation
https://bugs.webkit.org/show_bug.cgi?id=285900
rdar://142870737

Reviewed by Simon Fraser.

We already cache match results for inline style mutations.
With this patch we also apply the cached results partially so only the changed 
properties are re-applied.

Partial applying can be used with normal priority properties that we know don't 
have any dependencies.

* Source/WebCore/css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):

The optimization relies on overwriting propertues on existing style that is not 
initialized with initial values.
Fix some cases where we failed to overwrite a property fully.

* Source/WebCore/platform/animation/Animation.h:
(WebCore::Animation::isEmpty const):

Same as above.
Animation is also empty if all properties have been filled rather than being 
explicitly set.

(WebCore::Animation::clearName):

Same as above.

* Source/WebCore/style/MatchResultCache.cpp:
(WebCore::Style::MatchResultCache::Entry::Entry):
(WebCore::Style::copyStyle):
(WebCore::Style::copy):
(WebCore::Style::MatchResultCache::isUsableAfterInlineStyleChange):

We can only use this cache entry if the same properties were affected.

(WebCore::Style::MatchResultCache::computeAndUpdateChangedProperties):

Figure out the changed properties from the previous inline style.
We only need to apply these.

(WebCore::Style::MatchResultCache::resultWithCurrentInlineStyle):
(WebCore::Style::MatchResultCache::update):

Update the style in the cache entry after computing it.

(WebCore::Style::MatchResultCache::set):
(WebCore::Style::MatchResultCache::get): Deleted.
* Source/WebCore/style/MatchResultCache.h:
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::PropertyCascade):
(WebCore::Style::PropertyCascade::addMatch):

Support providing a list of property ids to apply.

(WebCore::Style::PropertyCascade::shouldApplyAfterAnimation):
* Source/WebCore/style/PropertyCascade.h:

Make IncludedProperties a struct.

(WebCore::Style::PropertyCascade::normalPropertyTypes):
(WebCore::Style::PropertyCascade::startingStylePropertyTypes):
(WebCore::Style::PropertyCascade::IncludedProperties::isEmpty const):
(WebCore::Style::PropertyCascade::normalProperties):
(WebCore::Style::PropertyCascade::applyLowPriorityOnly const):
(WebCore::Style::PropertyCascade::startingStyleProperties): Deleted.
* Source/WebCore/style/ResolvedStyle.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::shouldTreatAutoZIndexAsZero):
(WebCore::Style::Adjuster::adjustFromBuilder):

Add an adjust function that is called from style builder for adjustments that 
are cacheable.

(WebCore::Style::Adjuster::adjust const):
* Source/WebCore/style/StyleAdjuster.h:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):
(WebCore::Style::Builder::applyAllProperties):
(WebCore::Style::Builder::applyTopPriorityProperties):
(WebCore::Style::Builder::applyHighPriorityProperties):
(WebCore::Style::Builder::adjustAfterApplying):
* Source/WebCore/style/StyleBuilder.h:
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::State::takeUserAgentAppearanceStyle):
(WebCore::Style::Resolver::initializeStateAndStyle):
(WebCore::Style::Resolver::unadjustedStyleForElement):

To rebuild a style from a cache entry we need to original style from style 
builder
before any adjustments. Split styleForElement() into two parts so TreeResolver 
can
get the unadjusted style.

(WebCore::Style::Resolver::styleForElement):
(WebCore::Style::Resolver::unadjustedStyleForCachedMatchResult):

Support applying cached matched result partially on top of an existing style.

(WebCore::Style::Resolver::styleForPseudoElement):
(WebCore::Style::Resolver::applyMatchedProperties):

Add a IncludedProperties parameter.

(WebCore::Style::Resolver::setGlobalStateAfterApplyingProperties):
(WebCore::Style::Resolver::styleForElementWithCachedMatchResult): Deleted.
* Source/WebCore/style/StyleResolver.h:
(WebCore::Style::Resolver::initializeStateAndStyle):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForStyleable):
(WebCore::Style::TreeResolver::resolveStartingStyle):
(WebCore::Style::TreeResolver::resolveAfterChangeStyleForNonAnimated):
(WebCore::Style::TreeResolver::resolveAgainInDifferentContext):
(WebCore::Style::TreeResolver::applyCascadeAfterAnimation):
(WebCore::Style::TreeResolver::generatePositionOption):

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