Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5ea07f2accfcf85ccbb434b849f83641a33a3212
      
https://github.com/WebKit/WebKit/commit/5ea07f2accfcf85ccbb434b849f83641a33a3212
  Author: Antti Koivisto <[email protected]>
  Date:   2026-04-05 (Sun, 05 Apr 2026)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilderState.h
    A Source/WebCore/style/StyleSubstitutionContext.h
    M Source/WebCore/style/StyleSubstitutionResolver.cpp

  Log Message:
  -----------
  [css-values-5] Make cycle detection match spec language
https://bugs.webkit.org/show_bug.cgi?id=311514
rdar://174105259

Reviewed by Sam Weinig.

Implement cycle detection using "substition contexts" and "guards" matchig the 
spec text.
Unifies the cycle detection between custom properties, attr and any future 
guarded functions.

https://drafts.csswg.org/css-values-5/#substitution-context

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyCustomPropertyImpl):
* Source/WebCore/style/StyleBuilderState.h:
(WebCore::Style::BuilderState::guardSubstitutionContext):

Replace various maps with GuardedSubstitutionContexts type.

* Source/WebCore/style/StyleSubstitutionContext.h: Added.
(WebCore::Style::add):
(WebCore::Style::GuardedSubstitutionContexts::Guard::Guard):
(WebCore::Style::GuardedSubstitutionContexts::Guard::~Guard):

RAII helper for guarding a substitution context. Detects cycles and marks all 
participating contexts as cyclic.

(WebCore::Style::GuardedSubstitutionContexts::Guard::isCyclicContext const):
(WebCore::Style::GuardedSubstitutionContexts::guard):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteAttrFunction):
* Source/WebCore/style/StyleSubstitutionResolver.h:

Canonical link: https://commits.webkit.org/310610@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to