Diff
Modified: trunk/Source/WebCore/ChangeLog (284692 => 284693)
--- trunk/Source/WebCore/ChangeLog 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/ChangeLog 2021-10-22 16:56:35 UTC (rev 284693)
@@ -1,3 +1,110 @@
+2021-10-22 Antti Koivisto <an...@apple.com>
+
+ Factor style resolver context arguments into a struct
+ https://bugs.webkit.org/show_bug.cgi?id=232137
+
+ Reviewed by Antoine Quint.
+
+ Add Style::ResolutionContext struct and use it to consistently pass around all context argument needed
+ for resolving style instead of just passing around individual arguments as separate function parameter.
+
+ An immediately benefit is that we can remove the stateful setOverrideDocumentElementStyle hack.
+ This also makes the style system more flexible and extensible for future work.
+
+ Most of the patch is mechanically replacing a parent style argument in various places with a context
+ struct argument.
+
+ * animation/AnimationEffect.h:
+ * animation/CSSAnimation.cpp:
+ (WebCore::CSSAnimation::create):
+ * animation/CSSAnimation.h:
+ * animation/CSSTransition.cpp:
+ (WebCore::CSSTransition::create):
+ (WebCore::CSSTransition::resolve):
+ * animation/CSSTransition.h:
+ * animation/DeclarativeAnimation.cpp:
+ (WebCore::DeclarativeAnimation::initialize):
+ * animation/DeclarativeAnimation.h:
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::updateBlendingKeyframes):
+ (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes):
+ (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
+ (WebCore::KeyframeEffect::apply):
+ (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
+ * animation/KeyframeEffect.h:
+ * animation/KeyframeEffectStack.cpp:
+ (WebCore::KeyframeEffectStack::applyKeyframeEffects):
+ * animation/KeyframeEffectStack.h:
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::resolve):
+ (WebCore::WebAnimation::commitStyles):
+ * animation/WebAnimation.h:
+ * css/MediaQueryMatcher.cpp:
+ (WebCore::MediaQueryMatcher::documentElementUserAgentStyle const):
+ * css/StyleMedia.cpp:
+ (WebCore::StyleMedia::matchMedium const):
+ * dom/Document.cpp:
+ (WebCore::Document::styleForElementIgnoringPendingStylesheets):
+ * dom/Element.cpp:
+ (WebCore::Element::resolveStyle):
+ (WebCore::Element::resolveCustomStyle):
+ * dom/Element.h:
+ * html/HTMLTitleElement.cpp:
+ (WebCore::HTMLTitleElement::computedTextWithDirection):
+ * html/shadow/DateTimeFieldElement.cpp:
+ (WebCore::DateTimeFieldElement::resolveCustomStyle):
+ * html/shadow/DateTimeFieldElement.h:
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::resolveCustomStyle):
+ (WebCore::SliderContainerElement::resolveCustomStyle):
+ * html/shadow/SliderThumbElement.h:
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerContainer::resolveCustomStyle):
+ (WebCore::TextControlInnerElement::resolveCustomStyle):
+ (WebCore::TextControlInnerTextElement::resolveCustomStyle):
+ (WebCore::TextControlPlaceholderElement::resolveCustomStyle):
+ (WebCore::SearchFieldResultsButtonElement::resolveCustomStyle):
+ (WebCore::SearchFieldCancelButtonElement::resolveCustomStyle):
+ * html/shadow/TextControlInnerElements.h:
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::computeFirstLineStyle const):
+ (WebCore::RenderElement::getUncachedPseudoStyle const):
+ * rendering/style/KeyframeList.cpp:
+ (WebCore::KeyframeList::fillImplicitKeyframes):
+ * style/StyleResolver.cpp:
+ (WebCore::Style::Resolver::Resolver):
+ (WebCore::Style::Resolver::styleForElement):
+ (WebCore::Style::Resolver::styleForKeyframe):
+ (WebCore::Style::Resolver::keyframeStylesForAnimation):
+ (WebCore::Style::Resolver::pseudoStyleForElement):
+ * style/StyleResolver.h:
+ (WebCore::Style::Resolver::overrideDocumentElementStyle const): Deleted.
+ (WebCore::Style::Resolver::setOverrideDocumentElementStyle): Deleted.
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::Scope::Scope):
+ (WebCore::Style::TreeResolver::Scope::~Scope):
+ (WebCore::Style::TreeResolver::styleForStyleable):
+ (WebCore::Style::TreeResolver::resolveElement):
+ (WebCore::Style::TreeResolver::resolvePseudoStyle):
+ (WebCore::Style::TreeResolver::makeResolveContext):
+ (WebCore::Style::TreeResolver::makeResolveContextForPseudoElement):
+ (WebCore::Style::TreeResolver::parentBoxStyleForPseudoElement const):
+ (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
+ (WebCore::Style::TreeResolver::parentBoxStyleForPseudo const): Deleted.
+ * style/StyleTreeResolver.h:
+ * style/Styleable.cpp:
+ (WebCore::Styleable::updateCSSAnimations const):
+ (WebCore::updateCSSTransitionsForStyleableAndProperty):
+ * style/Styleable.h:
+ (WebCore::Styleable::applyKeyframeEffects const):
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::resolveCustomStyle):
+ * svg/SVGElement.h:
+ * svg/SVGElementRareData.h:
+ (WebCore::SVGElementRareData::overrideComputedStyle):
+ * testing/Internals.cpp:
+ (WebCore::Internals::highlightPseudoElementColor):
+
2021-10-22 Sihui Liu <sihui_...@apple.com>
Followup to r284652: ensure file handle is closed in web process
Modified: trunk/Source/WebCore/animation/AnimationEffect.h (284692 => 284693)
--- trunk/Source/WebCore/animation/AnimationEffect.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/AnimationEffect.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -47,6 +47,10 @@
namespace WebCore {
+namespace Style {
+struct ResolutionContext;
+}
+
class AnimationEffect : public RefCounted<AnimationEffect>, public CanMakeWeakPtr<AnimationEffect> {
public:
virtual ~AnimationEffect();
@@ -61,7 +65,7 @@
ExceptionOr<void> bindingsUpdateTiming(std::optional<OptionalEffectTiming>);
ExceptionOr<void> updateTiming(std::optional<OptionalEffectTiming>);
- virtual void apply(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> = std::nullopt) = 0;
+ virtual void apply(RenderStyle& targetStyle, const Style::ResolutionContext&, std::optional<Seconds> = std::nullopt) = 0;
virtual void invalidate() = 0;
virtual void animationDidTick() = 0;
virtual void animationDidPlay() = 0;
Modified: trunk/Source/WebCore/animation/CSSAnimation.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/CSSAnimation.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/CSSAnimation.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -36,10 +36,10 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(CSSAnimation);
-Ref<CSSAnimation> CSSAnimation::create(const Styleable& owningElement, const Animation& backingAnimation, const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle)
+Ref<CSSAnimation> CSSAnimation::create(const Styleable& owningElement, const Animation& backingAnimation, const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext& resolutionContext)
{
auto result = adoptRef(*new CSSAnimation(owningElement, backingAnimation));
- result->initialize(oldStyle, newStyle, parentElementStyle);
+ result->initialize(oldStyle, newStyle, resolutionContext);
InspectorInstrumentation::didCreateWebAnimation(result.get());
Modified: trunk/Source/WebCore/animation/CSSAnimation.h (284692 => 284693)
--- trunk/Source/WebCore/animation/CSSAnimation.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/CSSAnimation.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -38,7 +38,7 @@
class CSSAnimation final : public DeclarativeAnimation {
WTF_MAKE_ISO_ALLOCATED(CSSAnimation);
public:
- static Ref<CSSAnimation> create(const Styleable&, const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle);
+ static Ref<CSSAnimation> create(const Styleable&, const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);
~CSSAnimation() = default;
bool isCSSAnimation() const override { return true; }
Modified: trunk/Source/WebCore/animation/CSSTransition.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/CSSTransition.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/CSSTransition.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -41,7 +41,7 @@
{
ASSERT(oldStyle);
auto result = adoptRef(*new CSSTransition(owningElement, property, generationTime, backingAnimation, *oldStyle, newStyle, reversingAdjustedStartStyle, reversingShorteningFactor));
- result->initialize(oldStyle, newStyle, nullptr);
+ result->initialize(oldStyle, newStyle, { nullptr });
result->setTimingProperties(delay, duration);
InspectorInstrumentation::didCreateWebAnimation(result.get());
@@ -61,9 +61,9 @@
{
}
-void CSSTransition::resolve(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> startTime)
+void CSSTransition::resolve(RenderStyle& targetStyle, const Style::ResolutionContext& resolutionContext, std::optional<Seconds> startTime)
{
- DeclarativeAnimation::resolve(targetStyle, parentElementStyle, startTime);
+ DeclarativeAnimation::resolve(targetStyle, resolutionContext, startTime);
m_currentStyle = RenderStyle::clonePtr(targetStyle);
}
Modified: trunk/Source/WebCore/animation/CSSTransition.h (284692 => 284693)
--- trunk/Source/WebCore/animation/CSSTransition.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/CSSTransition.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -58,7 +58,7 @@
CSSTransition(const Styleable&, CSSPropertyID, MonotonicTime generationTime, const Animation&, const RenderStyle& oldStyle, const RenderStyle& targetStyle, const RenderStyle& reversingAdjustedStartStyle, double);
void setTimingProperties(Seconds delay, Seconds duration);
Ref<AnimationEventBase> createEvent(const AtomString& eventType, double elapsedTime, const String& pseudoId, std::optional<Seconds> timelineTime) final;
- void resolve(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds>) final;
+ void resolve(RenderStyle& targetStyle, const Style::ResolutionContext&, std::optional<Seconds>) final;
CSSPropertyID m_property;
MonotonicTime m_generationTime;
Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -105,7 +105,7 @@
syncPropertiesWithBackingAnimation();
}
-void DeclarativeAnimation::initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle)
+void DeclarativeAnimation::initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext& resolutionContext)
{
// We need to suspend invalidation of the animation's keyframe effect during its creation
// as it would otherwise trigger invalidation of the document's style and this would be
@@ -116,7 +116,7 @@
setEffect(KeyframeEffect::create(*m_owningElement, m_owningPseudoId));
setTimeline(&m_owningElement->document().timeline());
- downcast<KeyframeEffect>(effect())->computeDeclarativeAnimationBlendingKeyframes(oldStyle, newStyle, parentElementStyle);
+ downcast<KeyframeEffect>(effect())->computeDeclarativeAnimationBlendingKeyframes(oldStyle, newStyle, resolutionContext);
syncPropertiesWithBackingAnimation();
if (backingAnimation().playState() == AnimationPlayState::Playing)
play();
Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.h (284692 => 284693)
--- trunk/Source/WebCore/animation/DeclarativeAnimation.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -75,7 +75,7 @@
protected:
DeclarativeAnimation(const Styleable&, const Animation&);
- virtual void initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle);
+ virtual void initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);
virtual void syncPropertiesWithBackingAnimation();
// elapsedTime is the animation's current time at the time the event is added and is exposed through the DOM API, timelineTime is the animations'
// timeline current time and is not exposed through the DOM API but used by the DocumentTimeline for sorting events before dispatch.
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -812,7 +812,7 @@
return { };
}
-void KeyframeEffect::updateBlendingKeyframes(RenderStyle& elementStyle, const RenderStyle* parentElementStyle)
+void KeyframeEffect::updateBlendingKeyframes(RenderStyle& elementStyle, const Style::ResolutionContext& resolutionContext)
{
if (!m_blendingKeyframes.isEmpty() || !m_target)
return;
@@ -829,7 +829,7 @@
keyframeList.addProperty(styleProperties->propertyAt(i).id());
auto keyframeRule = StyleRuleKeyframe::create(WTFMove(styleProperties));
- keyframeValue.setStyle(styleResolver.styleForKeyframe(*m_target, &elementStyle, parentElementStyle, keyframeRule.ptr(), keyframeValue));
+ keyframeValue.setStyle(styleResolver.styleForKeyframe(*m_target, &elementStyle, resolutionContext, keyframeRule.ptr(), keyframeValue));
keyframeList.insert(WTFMove(keyframeValue));
}
@@ -1003,16 +1003,16 @@
});
}
-void KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle)
+void KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext& resolutionContext)
{
ASSERT(is<DeclarativeAnimation>(animation()));
if (is<CSSAnimation>(animation()))
- computeCSSAnimationBlendingKeyframes(newStyle, parentElementStyle);
+ computeCSSAnimationBlendingKeyframes(newStyle, resolutionContext);
else if (is<CSSTransition>(animation()))
computeCSSTransitionBlendingKeyframes(oldStyle, newStyle);
}
-void KeyframeEffect::computeCSSAnimationBlendingKeyframes(const RenderStyle& unanimatedStyle, const RenderStyle* parentElementStyle)
+void KeyframeEffect::computeCSSAnimationBlendingKeyframes(const RenderStyle& unanimatedStyle, const Style::ResolutionContext& resolutionContext)
{
ASSERT(is<CSSAnimation>(animation()));
ASSERT(document());
@@ -1022,7 +1022,7 @@
KeyframeList keyframeList(backingAnimation.name().string);
if (auto* styleScope = Style::Scope::forOrdinal(*m_target, backingAnimation.nameStyleScopeOrdinal()))
- styleScope->resolver().keyframeStylesForAnimation(*m_target, &unanimatedStyle, parentElementStyle, keyframeList);
+ styleScope->resolver().keyframeStylesForAnimation(*m_target, &unanimatedStyle, resolutionContext, keyframeList);
// Ensure resource loads for all the frames.
for (auto& keyframe : keyframeList.keyframes()) {
@@ -1266,12 +1266,12 @@
m_inTargetEffectStack = newTargetStyleable->ensureKeyframeEffectStack().addEffect(*this);
}
-void KeyframeEffect::apply(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> startTime)
+void KeyframeEffect::apply(RenderStyle& targetStyle, const Style::ResolutionContext& resolutionContext, std::optional<Seconds> startTime)
{
if (!m_target)
return;
- updateBlendingKeyframes(targetStyle, parentElementStyle);
+ updateBlendingKeyframes(targetStyle, resolutionContext);
auto computedTiming = getComputedTiming(startTime);
if (!startTime) {
@@ -1433,7 +1433,7 @@
// The effect value of a single property referenced by a keyframe effect as one of its target properties,
// for a given iteration progress, current iteration and underlying value is calculated as follows.
- updateBlendingKeyframes(targetStyle, nullptr);
+ updateBlendingKeyframes(targetStyle, { nullptr });
if (m_blendingKeyframes.isEmpty())
return;
Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (284692 => 284693)
--- trunk/Source/WebCore/animation/KeyframeEffect.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -123,7 +123,7 @@
void setComposite(CompositeOperation compositeOperation) { m_compositeOperation = compositeOperation; }
void getAnimatedStyle(std::unique_ptr<RenderStyle>& animatedStyle);
- void apply(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> = std::nullopt) override;
+ void apply(RenderStyle& targetStyle, const Style::ResolutionContext&, std::optional<Seconds> = std::nullopt) override;
void invalidate() override;
void animationDidTick() final;
void animationDidPlay() final;
@@ -154,7 +154,7 @@
#endif
bool colorFilterFunctionListsMatch() const override { return m_colorFilterFunctionListsMatch; }
- void computeDeclarativeAnimationBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle);
+ void computeDeclarativeAnimationBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);
const KeyframeList& blendingKeyframes() const { return m_blendingKeyframes; }
const HashSet<CSSPropertyID>& animatedProperties();
bool animatesProperty(CSSPropertyID) const;
@@ -198,8 +198,8 @@
void computeStackingContextImpact();
void computeSomeKeyframesUseStepsTimingFunction();
void clearBlendingKeyframes();
- void updateBlendingKeyframes(RenderStyle& elementStyle, const RenderStyle* parentElementStyle);
- void computeCSSAnimationBlendingKeyframes(const RenderStyle& unanimatedStyle, const RenderStyle* parentElementStyle);
+ void updateBlendingKeyframes(RenderStyle& elementStyle, const Style::ResolutionContext&);
+ void computeCSSAnimationBlendingKeyframes(const RenderStyle& unanimatedStyle, const Style::ResolutionContext&);
void computeCSSTransitionBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle);
void computeAcceleratedPropertiesState();
void setBlendingKeyframes(KeyframeList&);
Modified: trunk/Source/WebCore/animation/KeyframeEffectStack.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/KeyframeEffectStack.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/KeyframeEffectStack.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -121,7 +121,7 @@
m_isSorted = false;
}
-OptionSet<AnimationImpact> KeyframeEffectStack::applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const RenderStyle* parentElementStyle)
+OptionSet<AnimationImpact> KeyframeEffectStack::applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const Style::ResolutionContext& resolutionContext)
{
OptionSet<AnimationImpact> impact;
@@ -134,7 +134,7 @@
for (const auto& effect : sortedEffects()) {
ASSERT(effect->animation());
- effect->animation()->resolve(targetStyle, parentElementStyle);
+ effect->animation()->resolve(targetStyle, resolutionContext);
if (effect->isRunningAccelerated() || effect->isAboutToRunAccelerated())
impact.add(AnimationImpact::RequiresRecomposite);
Modified: trunk/Source/WebCore/animation/KeyframeEffectStack.h (284692 => 284693)
--- trunk/Source/WebCore/animation/KeyframeEffectStack.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/KeyframeEffectStack.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -36,6 +36,10 @@
class KeyframeEffect;
class RenderStyle;
+namespace Style {
+struct ResolutionContext;
+}
+
class KeyframeEffectStack {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -50,7 +54,7 @@
void setCSSAnimationList(RefPtr<const AnimationList>&&);
bool isCurrentlyAffectingProperty(CSSPropertyID) const;
bool requiresPseudoElement() const;
- OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const RenderStyle* parentElementStyle);
+ OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const Style::ResolutionContext&);
bool hasEffectWithImplicitKeyframes() const;
void stopAcceleratingTransformRelatedProperties(UseAcceleratedAction);
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (284692 => 284693)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -1227,7 +1227,7 @@
m_effect->animationDidTick();
}
-void WebAnimation::resolve(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> startTime)
+void WebAnimation::resolve(RenderStyle& targetStyle, const Style::ResolutionContext& resolutionContext, std::optional<Seconds> startTime)
{
if (!m_shouldSkipUpdatingFinishedStateWhenResolving)
updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
@@ -1234,7 +1234,7 @@
m_shouldSkipUpdatingFinishedStateWhenResolving = false;
if (m_effect)
- m_effect->apply(targetStyle, parentElementStyle, startTime);
+ m_effect->apply(targetStyle, resolutionContext, startTime);
}
void WebAnimation::setSuspended(bool isSuspended)
@@ -1426,12 +1426,12 @@
if (effectInStack->animation() != this && !compareAnimationsByCompositeOrder(*effectInStack->animation(), *this))
break;
if (effectInStack->animatedProperties().contains(property))
- effectInStack->animation()->resolve(*animatedStyle, nullptr);
+ effectInStack->animation()->resolve(*animatedStyle, { nullptr });
if (effectInStack->animation() == this)
break;
}
if (m_replaceState == ReplaceState::Removed)
- effect->animation()->resolve(*animatedStyle, nullptr);
+ effect->animation()->resolve(*animatedStyle, { nullptr });
if (auto cssValue = computedStyleExtractor.valueForPropertyInStyle(*animatedStyle, property, renderer))
inlineStyle->setPropertyInternal(property, cssValue->cssText(), false);
}
Modified: trunk/Source/WebCore/animation/WebAnimation.h (284692 => 284693)
--- trunk/Source/WebCore/animation/WebAnimation.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -48,6 +48,10 @@
template<typename IDLType> class DOMPromiseProxyWithResolveCallback;
+namespace Style {
+struct ResolutionContext;
+}
+
class WebAnimation : public RefCounted<WebAnimation>, public EventTargetWithInlineData, public ActiveDOMObject {
WTF_MAKE_ISO_ALLOCATED(WebAnimation);
public:
@@ -119,7 +123,7 @@
bool needsTick() const;
virtual void tick();
WEBCORE_EXPORT Seconds timeToNextTick() const;
- virtual void resolve(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> = std::nullopt);
+ virtual void resolve(RenderStyle& targetStyle, const Style::ResolutionContext&, std::optional<Seconds> = std::nullopt);
void effectTargetDidChange(const std::optional<const Styleable>& previousTarget, const std::optional<const Styleable>& newTarget);
void acceleratedStateDidChange();
void willChangeRenderer();
Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (284692 => 284693)
--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -72,7 +72,7 @@
if (!documentElement)
return nullptr;
- return m_document->styleScope().resolver().styleForElement(*documentElement, m_document->renderStyle(), nullptr, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
+ return m_document->styleScope().resolver().styleForElement(*documentElement, { m_document->renderStyle() }, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
}
bool MediaQueryMatcher::evaluate(const MediaQuerySet& media)
Modified: trunk/Source/WebCore/css/StyleMedia.cpp (284692 => 284693)
--- trunk/Source/WebCore/css/StyleMedia.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/css/StyleMedia.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -66,7 +66,7 @@
if (!documentElement)
return false;
- auto rootStyle = document->styleScope().resolver().styleForElement(*documentElement, document->renderStyle(), nullptr, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
+ auto rootStyle = document->styleScope().resolver().styleForElement(*documentElement, { document->renderStyle() }, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
auto media = MediaQuerySet::create(query, MediaQueryParserContext(*document));
Modified: trunk/Source/WebCore/dom/Document.cpp (284692 => 284693)
--- trunk/Source/WebCore/dom/Document.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/dom/Document.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -2262,9 +2262,9 @@
auto& resolver = element.styleResolver();
if (pseudoElementSpecifier != PseudoId::None)
- return resolver.pseudoStyleForElement(element, { pseudoElementSpecifier }, *parentStyle);
+ return resolver.pseudoStyleForElement(element, { pseudoElementSpecifier }, { parentStyle });
- auto elementStyle = resolver.styleForElement(element, parentStyle);
+ auto elementStyle = resolver.styleForElement(element, { parentStyle });
if (elementStyle.relations) {
Style::Update emptyUpdate(*this);
Style::commitRelations(WTFMove(elementStyle.relations), emptyUpdate);
Modified: trunk/Source/WebCore/dom/Element.cpp (284692 => 284693)
--- trunk/Source/WebCore/dom/Element.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -1974,9 +1974,9 @@
return document().styleScope().resolver();
}
-Style::ElementStyle Element::resolveStyle(const RenderStyle* parentStyle)
+Style::ElementStyle Element::resolveStyle(const Style::ResolutionContext& resolutionContext)
{
- return styleResolver().styleForElement(*this, parentStyle);
+ return styleResolver().styleForElement(*this, resolutionContext);
}
static void invalidateForSiblingCombinators(Element* sibling)
@@ -4409,7 +4409,7 @@
ASSERT(hasCustomStyleResolveCallbacks());
}
-std::optional<Style::ElementStyle> Element::resolveCustomStyle(const RenderStyle&, const RenderStyle*)
+std::optional<Style::ElementStyle> Element::resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle*)
{
ASSERT(hasCustomStyleResolveCallbacks());
return std::nullopt;
Modified: trunk/Source/WebCore/dom/Element.h (284692 => 284693)
--- trunk/Source/WebCore/dom/Element.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/dom/Element.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -94,6 +94,7 @@
class Resolver;
enum class Change : uint8_t;
struct ElementStyle;
+struct ResolutionContext;
}
class Element : public ContainerNode {
@@ -571,7 +572,7 @@
virtual void didAttachRenderers();
virtual void willDetachRenderers();
virtual void didDetachRenderers();
- virtual std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle);
+ virtual std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle);
LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override;
@@ -593,7 +594,7 @@
#endif
Style::Resolver& styleResolver();
- Style::ElementStyle resolveStyle(const RenderStyle* parentStyle);
+ Style::ElementStyle resolveStyle(const Style::ResolutionContext&);
// Invalidates the style of a single element. Style is resolved lazily.
// Descendant elements are resolved as needed, for example if an inherited property changes.
Modified: trunk/Source/WebCore/html/HTMLTitleElement.cpp (284692 => 284693)
--- trunk/Source/WebCore/html/HTMLTitleElement.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/HTMLTitleElement.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -84,7 +84,7 @@
if (auto* computedStyle = this->computedStyle())
direction = computedStyle->direction();
else
- direction = styleResolver().styleForElement(*this, parentElement() ? parentElement()->renderStyle() : nullptr).renderStyle->direction();
+ direction = styleResolver().styleForElement(*this, { parentElement() ? parentElement()->renderStyle() : nullptr }).renderStyle->direction();
return { text(), direction };
}
Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -63,9 +63,9 @@
setPseudo(pseudo);
}
-std::optional<Style::ElementStyle> DateTimeFieldElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
+std::optional<Style::ElementStyle> DateTimeFieldElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle* shadowHostStyle)
{
- auto elementStyle = resolveStyle(&parentStyle);
+ auto elementStyle = resolveStyle(resolutionContext);
if (!elementStyle.renderStyle)
return std::nullopt;
Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -85,7 +85,7 @@
virtual void handleBlurEvent(Event&);
private:
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle*) final;
bool supportsFocus() const override;
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -586,7 +586,7 @@
return downcast<HTMLInputElement>(shadowHost());
}
-std::optional<Style::ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
+std::optional<Style::ElementStyle> SliderThumbElement::resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* hostStyle)
{
// This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
@@ -637,7 +637,7 @@
return createRenderer<RenderSliderContainer>(*this, WTFMove(style));
}
-std::optional<Style::ElementStyle> SliderContainerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
+std::optional<Style::ElementStyle> SliderContainerElement::resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* hostStyle)
{
// This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -75,7 +75,7 @@
#endif
void willDetachRenderers() final;
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle*) final;
const AtomString& shadowPseudoId() const final;
void startDragging();
@@ -134,7 +134,7 @@
private:
SliderContainerElement(Document&);
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle*) final;
const AtomString& shadowPseudoId() const final;
bool isSliderContainerElement() const final { return true; }
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -82,9 +82,9 @@
return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element)->hasAutoFillStrongPasswordButton();
}
-std::optional<Style::ElementStyle> TextControlInnerContainer::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
+std::optional<Style::ElementStyle> TextControlInnerContainer::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle*)
{
- auto elementStyle = resolveStyle(&parentStyle);
+ auto elementStyle = resolveStyle(resolutionContext);
if (isStrongPasswordTextField(shadowHost())) {
elementStyle.renderStyle->setFlexWrap(FlexWrap::Wrap);
elementStyle.renderStyle->setOverflowX(Overflow::Hidden);
@@ -104,7 +104,7 @@
return adoptRef(*new TextControlInnerElement(document));
}
-std::optional<Style::ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
+std::optional<Style::ElementStyle> TextControlInnerElement::resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle)
{
auto newStyle = RenderStyle::createPtr();
newStyle->inheritFrom(*shadowHostStyle);
@@ -188,7 +188,7 @@
return downcast<RenderTextControlInnerBlock>(HTMLDivElement::renderer());
}
-std::optional<Style::ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
+std::optional<Style::ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle)
{
auto style = downcast<HTMLTextFormControlElement>(*shadowHost()).createInnerTextStyle(*shadowHostStyle);
return { makeUnique<RenderStyle>(WTFMove(style)) };
@@ -209,9 +209,9 @@
return element;
}
-std::optional<Style::ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
+std::optional<Style::ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle* shadowHostStyle)
{
- auto style = resolveStyle(&parentStyle);
+ auto style = resolveStyle(resolutionContext);
auto& controlElement = downcast<HTMLTextFormControlElement>(*containingShadowRoot()->host());
style.renderStyle->setDisplay(controlElement.isPlaceholderVisible() ? DisplayType::Block : DisplayType::None);
@@ -239,7 +239,7 @@
return adoptRef(*new SearchFieldResultsButtonElement(document));
}
-std::optional<Style::ElementStyle> SearchFieldResultsButtonElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
+std::optional<Style::ElementStyle> SearchFieldResultsButtonElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle* shadowHostStyle)
{
RefPtr input = downcast<HTMLInputElement>(shadowHost());
if (input && input->maxResults() >= 0)
@@ -247,7 +247,7 @@
if (shadowHostStyle && shadowHostStyle->effectiveAppearance() != SearchFieldPart) {
SetForScope<bool> canAdjustStyleForAppearance(m_canAdjustStyleForAppearance, false);
- return resolveStyle(&parentStyle);
+ return resolveStyle(resolutionContext);
}
return std::nullopt;
@@ -306,9 +306,9 @@
return element;
}
-std::optional<Style::ElementStyle> SearchFieldCancelButtonElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
+std::optional<Style::ElementStyle> SearchFieldCancelButtonElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle*)
{
- auto elementStyle = resolveStyle(&parentStyle);
+ auto elementStyle = resolveStyle(resolutionContext);
auto& inputElement = downcast<HTMLInputElement>(*shadowHost());
elementStyle.renderStyle->setVisibility(elementStyle.renderStyle->visibility() == Visibility::Hidden || inputElement.value().isEmpty() ? Visibility::Hidden : Visibility::Visible);
return elementStyle;
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.h (284692 => 284693)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -40,7 +40,7 @@
private:
TextControlInnerContainer(Document&);
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
};
class TextControlInnerElement final : public HTMLDivElement {
@@ -50,7 +50,7 @@
private:
TextControlInnerElement(Document&);
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
bool isMouseFocusable() const override { return false; }
};
@@ -75,7 +75,7 @@
TextControlInnerTextElement(Document&);
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
bool isMouseFocusable() const override { return false; }
bool isTextControlInnerTextElement() const override { return true; }
};
@@ -88,7 +88,7 @@
private:
TextControlPlaceholderElement(Document&);
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
};
class SearchFieldResultsButtonElement final : public HTMLDivElement {
@@ -106,7 +106,7 @@
private:
SearchFieldResultsButtonElement(Document&);
bool isMouseFocusable() const override { return false; }
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
bool isSearchFieldResultsButtonElement() const override { return true; }
bool m_canAdjustStyleForAppearance { true };
@@ -125,7 +125,7 @@
private:
SearchFieldCancelButtonElement(Document&);
bool isMouseFocusable() const override { return false; }
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (284692 => 284693)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -255,7 +255,7 @@
if (!composedTreeParentElement)
return nullptr;
- auto style = composedTreeParentElement->styleResolver().styleForElement(*composedTreeParentElement, &parentStyle).renderStyle;
+ auto style = composedTreeParentElement->styleResolver().styleForElement(*composedTreeParentElement, { &parentStyle }).renderStyle;
ASSERT(style->display() == DisplayType::Contents);
// We act as if there was an unstyled <span> around the text node. Only styling happens via inheritance.
@@ -264,7 +264,7 @@
return firstLineStyle;
}
- return rendererForFirstLineStyle.element()->styleResolver().styleForElement(*element(), &parentStyle).renderStyle;
+ return rendererForFirstLineStyle.element()->styleResolver().styleForElement(*element(), { &parentStyle }).renderStyle;
}
const RenderStyle& RenderElement::firstLineStyle() const
@@ -1531,7 +1531,7 @@
auto& styleResolver = element()->styleResolver();
- std::unique_ptr<RenderStyle> style = styleResolver.pseudoStyleForElement(*element(), pseudoElementRequest, *parentStyle);
+ std::unique_ptr<RenderStyle> style = styleResolver.pseudoStyleForElement(*element(), pseudoElementRequest, { parentStyle });
if (style)
Style::loadPendingResources(*style, document(), element());
Modified: trunk/Source/WebCore/rendering/style/KeyframeList.cpp (284692 => 284693)
--- trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -119,7 +119,7 @@
auto initialSize = size();
if (initialSize > 0 && m_keyframes[0].key()) {
KeyframeValue keyframeValue(0, nullptr);
- keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, parentElementStyle, &zeroPercentKeyframe(), keyframeValue));
+ keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, &zeroPercentKeyframe(), keyframeValue));
insert(WTFMove(keyframeValue));
}
@@ -126,7 +126,7 @@
// If the 100% keyframe is missing, create it (but only if there is at least one other keyframe).
if (initialSize > 0 && (m_keyframes[size() - 1].key() != 1)) {
KeyframeValue keyframeValue(1, nullptr);
- keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, parentElementStyle, &hundredPercentKeyframe(), keyframeValue));
+ keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, &hundredPercentKeyframe(), keyframeValue));
insert(WTFMove(keyframeValue));
}
}
Modified: trunk/Source/WebCore/style/StyleResolver.cpp (284692 => 284693)
--- trunk/Source/WebCore/style/StyleResolver.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/StyleResolver.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -159,7 +159,7 @@
m_mediaQueryEvaluator = MediaQueryEvaluator { };
if (auto* documentElement = m_document.documentElement()) {
- m_rootDefaultStyle = styleForElement(*documentElement, m_document.renderStyle(), nullptr, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
+ m_rootDefaultStyle = styleForElement(*documentElement, { m_document.renderStyle() }, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
// Turn off assertion against font lookups during style resolver initialization. We may need root style font for media queries.
m_document.fontSelector().incrementIsComputingRootStyleFont();
m_rootDefaultStyle->fontCascade().update(&m_document.fontSelector());
@@ -218,9 +218,9 @@
};
}
-ElementStyle Resolver::styleForElement(const Element& element, const RenderStyle* parentStyle, const RenderStyle* parentBoxStyle, RuleMatchingBehavior matchingBehavior, const SelectorFilter* selectorFilter)
+ElementStyle Resolver::styleForElement(const Element& element, const ResolutionContext& context, RuleMatchingBehavior matchingBehavior)
{
- auto state = State(element, parentStyle, m_overrideDocumentElementStyle);
+ auto state = State(element, context.parentStyle, context.documentElementStyle);
if (state.parentStyle()) {
state.setStyle(RenderStyle::createPtr());
@@ -245,7 +245,7 @@
UserAgentStyle::ensureDefaultStyleSheetsForElement(element);
- ElementRuleCollector collector(element, m_ruleSets, selectorFilter);
+ ElementRuleCollector collector(element, m_ruleSets, context.selectorFilter);
collector.setMedium(&m_mediaQueryEvaluator);
if (matchingBehavior == RuleMatchingBehavior::MatchOnlyUserAgentRules)
@@ -264,7 +264,7 @@
applyMatchedProperties(state, collector.matchResult());
- Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, &element);
+ Adjuster adjuster(document(), *state.parentStyle(), context.parentBoxStyle, &element);
adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
if (state.style()->hasViewportUnits())
@@ -273,15 +273,15 @@
return { state.takeStyle(), WTFMove(elementStyleRelations) };
}
-std::unique_ptr<RenderStyle> Resolver::styleForKeyframe(const Element& element, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle, const StyleRuleKeyframe* keyframe, KeyframeValue& keyframeValue)
+std::unique_ptr<RenderStyle> Resolver::styleForKeyframe(const Element& element, const RenderStyle* elementStyle, const ResolutionContext& context, const StyleRuleKeyframe* keyframe, KeyframeValue& keyframeValue)
{
MatchResult result;
result.authorDeclarations.append({ &keyframe->properties(), SelectorChecker::MatchAll, propertyAllowlistForPseudoId(elementStyle->styleType()) });
- auto state = State(element, nullptr, m_overrideDocumentElementStyle);
+ auto state = State(element, nullptr, context.documentElementStyle);
state.setStyle(RenderStyle::clonePtr(*elementStyle));
- state.setParentStyle(RenderStyle::clonePtr(parentElementStyle ? *parentElementStyle : *elementStyle));
+ state.setParentStyle(RenderStyle::clonePtr(context.parentStyle ? *context.parentStyle : *elementStyle));
Builder builder(*state.style(), builderContext(state), result, { CascadeLevel::Author });
builder.applyAllProperties();
@@ -307,7 +307,7 @@
return m_keyframesRuleMap.find(AtomString(name).impl()) != m_keyframesRuleMap.end();
}
-void Resolver::keyframeStylesForAnimation(const Element& element, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle, KeyframeList& list)
+void Resolver::keyframeStylesForAnimation(const Element& element, const RenderStyle* elementStyle, const ResolutionContext& context, KeyframeList& list)
{
list.clear();
@@ -369,7 +369,7 @@
// Add this keyframe style to all the indicated key times
for (auto key : keyframe->keys()) {
KeyframeValue keyframeValue(0, nullptr);
- keyframeValue.setStyle(styleForKeyframe(element, elementStyle, parentElementStyle, keyframe.ptr(), keyframeValue));
+ keyframeValue.setStyle(styleForKeyframe(element, elementStyle, context, keyframe.ptr(), keyframeValue));
keyframeValue.setKey(key);
if (auto timingFunctionCSSValue = keyframe->properties().getPropertyCSSValue(CSSPropertyAnimationTimingFunction))
keyframeValue.setTimingFunction(TimingFunction::createFromCSSValue(*timingFunctionCSSValue.get()));
@@ -377,12 +377,12 @@
}
}
- list.fillImplicitKeyframes(element, *this, elementStyle, parentElementStyle);
+ list.fillImplicitKeyframes(element, *this, elementStyle, context.parentStyle);
}
-std::unique_ptr<RenderStyle> Resolver::pseudoStyleForElement(const Element& element, const PseudoElementRequest& pseudoElementRequest, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const SelectorFilter* selectorFilter)
+std::unique_ptr<RenderStyle> Resolver::pseudoStyleForElement(const Element& element, const PseudoElementRequest& pseudoElementRequest, const ResolutionContext& context)
{
- auto state = State(element, &parentStyle, m_overrideDocumentElementStyle);
+ auto state = State(element, context.parentStyle, context.documentElementStyle);
if (state.parentStyle()) {
state.setStyle(RenderStyle::createPtr());
@@ -392,7 +392,7 @@
state.setParentStyle(RenderStyle::clonePtr(*state.style()));
}
- ElementRuleCollector collector(element, m_ruleSets, selectorFilter);
+ ElementRuleCollector collector(element, m_ruleSets, context.selectorFilter);
collector.setPseudoElementRequest(pseudoElementRequest);
collector.setMedium(&m_mediaQueryEvaluator);
collector.matchUARules();
@@ -411,7 +411,7 @@
applyMatchedProperties(state, collector.matchResult());
- Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, nullptr);
+ Adjuster adjuster(document(), *state.parentStyle(), context.parentBoxStyle, nullptr);
adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
if (state.style()->hasViewportUnits())
Modified: trunk/Source/WebCore/style/StyleResolver.h (284692 => 284693)
--- trunk/Source/WebCore/style/StyleResolver.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/StyleResolver.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -80,6 +80,14 @@
std::unique_ptr<Relations> relations;
};
+struct ResolutionContext {
+ const RenderStyle* parentStyle;
+ const RenderStyle* parentBoxStyle { nullptr };
+ // This needs to be provided during style resolution when up-to-date document element style is not available via DOM.
+ const RenderStyle* documentElementStyle { nullptr };
+ const SelectorFilter* selectorFilter { nullptr };
+};
+
class Resolver : public RefCounted<Resolver> {
WTF_MAKE_ISO_ALLOCATED(Resolver);
public:
@@ -86,11 +94,11 @@
static Ref<Resolver> create(Document&);
~Resolver();
- ElementStyle styleForElement(const Element&, const RenderStyle* parentStyle, const RenderStyle* parentBoxStyle = nullptr, RuleMatchingBehavior = RuleMatchingBehavior::MatchAllRules, const SelectorFilter* = nullptr);
+ ElementStyle styleForElement(const Element&, const ResolutionContext&, RuleMatchingBehavior = RuleMatchingBehavior::MatchAllRules);
- void keyframeStylesForAnimation(const Element&, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle, KeyframeList&);
+ void keyframeStylesForAnimation(const Element&, const RenderStyle* elementStyle, const ResolutionContext&, KeyframeList&);
- WEBCORE_EXPORT std::unique_ptr<RenderStyle> pseudoStyleForElement(const Element&, const PseudoElementRequest&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle = nullptr, const SelectorFilter* = nullptr);
+ WEBCORE_EXPORT std::unique_ptr<RenderStyle> pseudoStyleForElement(const Element&, const PseudoElementRequest&, const ResolutionContext&);
std::unique_ptr<RenderStyle> styleForPage(int pageIndex);
std::unique_ptr<RenderStyle> defaultStyleForElement(const Element*);
@@ -106,12 +114,9 @@
const MediaQueryEvaluator& mediaQueryEvaluator() const { return m_mediaQueryEvaluator; }
- const RenderStyle* overrideDocumentElementStyle() const { return m_overrideDocumentElementStyle; }
- void setOverrideDocumentElementStyle(const RenderStyle* style) { m_overrideDocumentElementStyle = style; }
-
void addCurrentSVGFontFaceRules();
- std::unique_ptr<RenderStyle> styleForKeyframe(const Element&, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle, const StyleRuleKeyframe*, KeyframeValue&);
+ std::unique_ptr<RenderStyle> styleForKeyframe(const Element&, const RenderStyle* elementStyle, const ResolutionContext&, const StyleRuleKeyframe*, KeyframeValue&);
bool isAnimationNameValid(const String&);
// These methods will give back the set of rules that matched for a given element (or a pseudo-element).
@@ -164,8 +169,6 @@
Document& m_document;
- const RenderStyle* m_overrideDocumentElementStyle { nullptr };
-
InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
MatchedDeclarationsCache m_matchedDeclarationsCache;
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (284692 => 284693)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -88,7 +88,6 @@
, shadowRoot(&shadowRoot)
, enclosingScope(&enclosingScope)
{
- resolver->setOverrideDocumentElementStyle(enclosingScope.resolver->overrideDocumentElementStyle());
}
TreeResolver::Scope::~Scope()
@@ -95,8 +94,6 @@
{
if (!shadowRoot)
resolver->document().setIsResolvingTreeStyle(false);
-
- resolver->setOverrideDocumentElementStyle(nullptr);
}
TreeResolver::Parent::Parent(Document& document)
@@ -129,13 +126,13 @@
return m_scopeStack.removeLast();
}
-std::unique_ptr<RenderStyle> TreeResolver::styleForStyleable(const Styleable& styleable, const RenderStyle& inheritedStyle)
+std::unique_ptr<RenderStyle> TreeResolver::styleForStyleable(const Styleable& styleable, const ResolutionContext& resolutionContext)
{
auto& element = styleable.element;
if (element.hasCustomStyleResolveCallbacks()) {
RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;
- if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
+ if (auto customStyle = element.resolveCustomStyle(resolutionContext, shadowHostStyle)) {
if (customStyle->relations)
commitRelations(WTFMove(customStyle->relations), *m_update);
@@ -146,7 +143,7 @@
if (auto style = scope().sharingResolver.resolve(styleable, *m_update))
return style;
- auto elementStyle = scope().resolver->styleForElement(element, &inheritedStyle, parentBoxStyle(), RuleMatchingBehavior::MatchAllRules, &scope().selectorFilter);
+ auto elementStyle = scope().resolver->styleForElement(element, resolutionContext);
if (elementStyle.relations)
commitRelations(WTFMove(elementStyle.relations), *m_update);
@@ -210,8 +207,10 @@
if (!element.rendererIsEverNeeded() && !element.hasDisplayContents())
return { };
+ auto resolutionContext = makeResolutionContext();
+
Styleable styleable { element, PseudoId::None };
- auto newStyle = styleForStyleable(styleable, parent().style);
+ auto newStyle = styleForStyleable(styleable, resolutionContext);
if (!affectsRenderedSubtree(element, *newStyle))
return { };
@@ -223,12 +222,11 @@
m_document.setHasNodesWithNonFinalStyle();
}
- auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change, parent().style, parentBoxStyle());
+ auto update = createAnimatedElementUpdate(WTFMove(newStyle), styleable, parent().change, resolutionContext);
auto descendantsToResolve = computeDescendantsToResolve(update.change, element.styleValidity(), parent().descendantsToResolve);
if (&element == m_document.documentElement()) {
m_documentElementStyle = RenderStyle::clonePtr(*update.style);
- scope().resolver->setOverrideDocumentElementStyle(m_documentElementStyle.get());
if (!existingStyle || existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
// "rem" units are relative to the document element's font size so we need to recompute everything.
@@ -286,10 +284,9 @@
if (!elementUpdate.style->hasPseudoStyle(pseudoId))
return { };
- auto& parentStyle = *elementUpdate.style;
- auto* parentBoxStyle = parentBoxStyleForPseudo(elementUpdate);
+ auto resolutionContext = makeResolutionContextForPseudoElement(elementUpdate);
- auto pseudoStyle = scope().resolver->pseudoStyleForElement(element, { pseudoId }, parentStyle, parentBoxStyle, &scope().selectorFilter);
+ auto pseudoStyle = scope().resolver->pseudoStyleForElement(element, { pseudoId }, resolutionContext);
if (!pseudoStyle)
return { };
@@ -297,9 +294,29 @@
if (!pseudoElementRendererIsNeeded(pseudoStyle.get()) && !hasAnimations)
return { };
- return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change, parentStyle, parentBoxStyle);
+ return createAnimatedElementUpdate(WTFMove(pseudoStyle), { element, pseudoId }, elementUpdate.change, resolutionContext);
}
+ResolutionContext TreeResolver::makeResolutionContext()
+{
+ return {
+ &parent().style,
+ parentBoxStyle(),
+ m_documentElementStyle.get(),
+ &scope().selectorFilter
+ };
+}
+
+ResolutionContext TreeResolver::makeResolutionContextForPseudoElement(const ElementUpdate& elementUpdate)
+{
+ return {
+ elementUpdate.style.get(),
+ parentBoxStyleForPseudoElement(elementUpdate),
+ m_documentElementStyle.get(),
+ &scope().selectorFilter
+ };
+}
+
const RenderStyle* TreeResolver::parentBoxStyle() const
{
// 'display: contents' doesn't generate boxes.
@@ -314,7 +331,7 @@
return nullptr;
}
-const RenderStyle* TreeResolver::parentBoxStyleForPseudo(const ElementUpdate& elementUpdate) const
+const RenderStyle* TreeResolver::parentBoxStyleForPseudoElement(const ElementUpdate& elementUpdate) const
{
switch (elementUpdate.style->display()) {
case DisplayType::None:
@@ -326,7 +343,7 @@
}
}
-ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle)
+ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, const Styleable& styleable, Change parentChange, const ResolutionContext& resolutionContext)
{
auto& element = styleable.element;
auto& document = element.document();
@@ -345,7 +362,7 @@
// to use CSS Animations as defined in the previous style change event. As such, we update CSS Animations after CSS Transitions
// such that when CSS Transitions are updated the CSS Animations data is the same as during the previous style change event.
if ((oldStyle && oldStyle->hasAnimations()) || newStyle->hasAnimations())
- styleable.updateCSSAnimations(oldStyle, *newStyle, &parentStyle);
+ styleable.updateCSSAnimations(oldStyle, *newStyle, resolutionContext);
}
// Now we can update all Web animations, which will include CSS Animations as well
@@ -356,10 +373,10 @@
styleable.setLastStyleChangeEventStyle(RenderStyle::clonePtr(*newStyle));
// Apply all keyframe effects to the new style.
auto animatedStyle = RenderStyle::clonePtr(*newStyle);
- animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, &parentStyle);
+ animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle, resolutionContext);
newStyle = WTFMove(animatedStyle);
- Adjuster adjuster(document, parentStyle, parentBoxStyle, styleable.pseudoId == PseudoId::None ? &element : nullptr);
+ Adjuster adjuster(document, *resolutionContext.parentStyle, resolutionContext.parentBoxStyle, styleable.pseudoId == PseudoId::None ? &element : nullptr);
adjuster.adjustAnimatedStyle(*newStyle, animationImpact);
} else
styleable.setLastStyleChangeEventStyle(nullptr);
Modified: trunk/Source/WebCore/style/StyleTreeResolver.h (284692 => 284693)
--- trunk/Source/WebCore/style/StyleTreeResolver.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/StyleTreeResolver.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -45,6 +45,7 @@
namespace Style {
class Resolver;
+struct ResolutionContext;
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(TreeResolverScope);
class TreeResolver {
@@ -55,13 +56,13 @@
std::unique_ptr<Update> resolve();
private:
- std::unique_ptr<RenderStyle> styleForStyleable(const Styleable&, const RenderStyle& inheritedStyle);
+ std::unique_ptr<RenderStyle> styleForStyleable(const Styleable&, const ResolutionContext&);
void resolveComposedTree();
ElementUpdates resolveElement(Element&);
- static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle);
+ static ElementUpdate createAnimatedElementUpdate(std::unique_ptr<RenderStyle>, const Styleable&, Change, const ResolutionContext&);
std::optional<ElementUpdate> resolvePseudoStyle(Element&, const ElementUpdate&, PseudoId);
struct Scope : RefCounted<Scope> {
@@ -99,8 +100,10 @@
void popParent();
void popParentsToDepth(unsigned depth);
+ ResolutionContext makeResolutionContext();
+ ResolutionContext makeResolutionContextForPseudoElement(const ElementUpdate&);
const RenderStyle* parentBoxStyle() const;
- const RenderStyle* parentBoxStyleForPseudo(const ElementUpdate&) const;
+ const RenderStyle* parentBoxStyleForPseudoElement(const ElementUpdate&) const;
Document& m_document;
std::unique_ptr<RenderStyle> m_documentElementStyle;
Modified: trunk/Source/WebCore/style/Styleable.cpp (284692 => 284693)
--- trunk/Source/WebCore/style/Styleable.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/Styleable.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -211,7 +211,7 @@
return false;
}
-void Styleable::updateCSSAnimations(const RenderStyle* currentStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle) const
+void Styleable::updateCSSAnimations(const RenderStyle* currentStyle, const RenderStyle& newStyle, const Style::ResolutionContext& resolutionContext) const
{
auto& keyframeEffectStack = ensureKeyframeEffectStack();
@@ -261,7 +261,7 @@
}
if (!foundMatchingAnimation)
- newAnimations.add(CSSAnimation::create(*this, currentAnimation, currentStyle, newStyle, parentElementStyle));
+ newAnimations.add(CSSAnimation::create(*this, currentAnimation, currentStyle, newStyle, resolutionContext));
}
}
@@ -388,7 +388,7 @@
// If a transition has not yet started or started when animations were last updated, use the timeline time at its creation
// as its start time to ensure that it will produce a style with progress > 0.
bool shouldUseTimelineTimeAtCreation = is<CSSTransition>(animation) && (!animation->startTime() || *animation->startTime() == styleable.element.document().timeline().currentTime());
- animation->resolve(animatedStyle, nullptr, shouldUseTimelineTimeAtCreation ? downcast<CSSTransition>(*animation).timelineTimeAtCreation() : std::nullopt);
+ animation->resolve(animatedStyle, { nullptr }, shouldUseTimelineTimeAtCreation ? downcast<CSSTransition>(*animation).timelineTimeAtCreation() : std::nullopt);
return animatedStyle;
}
@@ -408,7 +408,7 @@
auto afterChangeStyle = [&]() -> const RenderStyle {
if (is<CSSAnimation>(animation) && animation->isRelevant()) {
auto animatedStyle = RenderStyle::clone(newStyle);
- animation->resolve(animatedStyle, nullptr);
+ animation->resolve(animatedStyle, { nullptr });
return animatedStyle;
}
Modified: trunk/Source/WebCore/style/Styleable.h (284692 => 284693)
--- trunk/Source/WebCore/style/Styleable.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/style/Styleable.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -85,9 +85,9 @@
return element.hasKeyframeEffects(pseudoId);
}
- OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const RenderStyle* parentElementStyle) const
+ OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle, const Style::ResolutionContext& resolutionContext) const
{
- return element.ensureKeyframeEffectStack(pseudoId).applyKeyframeEffects(targetStyle, previousLastStyleChangeEventStyle, parentElementStyle);
+ return element.ensureKeyframeEffectStack(pseudoId).applyKeyframeEffects(targetStyle, previousLastStyleChangeEventStyle, resolutionContext);
}
const AnimationCollection* animations() const
@@ -155,7 +155,7 @@
void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&) const;
- void updateCSSAnimations(const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle) const;
+ void updateCSSAnimations(const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const Style::ResolutionContext&) const;
void updateCSSTransitions(const RenderStyle& currentStyle, const RenderStyle& newStyle) const;
};
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (284692 => 284693)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -638,16 +638,19 @@
propertyAnimatorFactory().animatorWillBeDeleted(attributeName);
}
-std::optional<Style::ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
+std::optional<Style::ElementStyle> SVGElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle*)
{
// If the element is in a <use> tree we get the style from the definition tree.
if (RefPtr styleElement = this->correspondingElement()) {
- auto style = styleElement->resolveStyle(&parentStyle);
+ auto styleElementResolutionContext = resolutionContext;
+ // Can't use the selector filter since we are going to another part of the tree.
+ styleElementResolutionContext.selectorFilter = nullptr;
+ auto style = styleElement->resolveStyle(styleElementResolutionContext);
Style::Adjuster::adjustSVGElementStyle(*style.renderStyle, *this);
return style;
}
- return resolveStyle(&parentStyle);
+ return resolveStyle(resolutionContext);
}
MutableStyleProperties* SVGElement::animatedSMILStyleProperties() const
Modified: trunk/Source/WebCore/svg/SVGElement.h (284692 => 284693)
--- trunk/Source/WebCore/svg/SVGElement.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/svg/SVGElement.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -105,7 +105,7 @@
void setCorrespondingElement(SVGElement*);
- std::optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+ std::optional<Style::ElementStyle> resolveCustomStyle(const Style::ResolutionContext&, const RenderStyle* shadowHostStyle) override;
static QualifiedName animatableAttributeForName(const AtomString&);
#ifndef NDEBUG
Modified: trunk/Source/WebCore/svg/SVGElementRareData.h (284692 => 284693)
--- trunk/Source/WebCore/svg/SVGElementRareData.h 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/svg/SVGElementRareData.h 2021-10-22 16:56:35 UTC (rev 284693)
@@ -77,7 +77,7 @@
return nullptr;
if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) {
// The style computed here contains no CSS Animations/Transitions or SMIL induced rules - this is needed to compute the "base value" for the SMIL animation sandwhich model.
- m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, nullptr, RuleMatchingBehavior::MatchAllRulesExcludingSMIL).renderStyle;
+ m_overrideComputedStyle = element.styleResolver().styleForElement(element, { parentStyle }, RuleMatchingBehavior::MatchAllRulesExcludingSMIL).renderStyle;
m_needsOverrideComputedStyleUpdate = false;
}
ASSERT(m_overrideComputedStyle);
Modified: trunk/Source/WebCore/testing/Internals.cpp (284692 => 284693)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-10-22 16:52:26 UTC (rev 284692)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-10-22 16:56:35 UTC (rev 284693)
@@ -6018,7 +6018,7 @@
if (!parentStyle)
return { };
- auto style = styleResolver.pseudoStyleForElement(element, { PseudoId::Highlight, highlightName }, *parentStyle);
+ auto style = styleResolver.pseudoStyleForElement(element, { PseudoId::Highlight, highlightName }, { parentStyle });
if (!style)
return { };