[webkit-changes] [WebKit/WebKit] 901adf: [Cocoa] Unable to use system appearance features i...

Aditya Keerthi noreply at github.com
Thu Feb 27 14:35:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 901adf26e0db6b8b2cef3c2c81336eb0c0ef43c8
      https://github.com/WebKit/WebKit/commit/901adf26e0db6b8b2cef3c2c81336eb0c0ef43c8
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2025-02-27 (Thu, 27 Feb 2025)

  Changed paths:
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/dom/InlineStyleSheetOwner.cpp
    M Source/WebCore/inspector/InspectorStyleSheet.cpp

  Log Message:
  -----------
  [Cocoa] Unable to use system appearance features in stylesheets inside UA shadow roots
https://bugs.webkit.org/show_bug.cgi?id=288707
rdar://145703473

Reviewed by Tim Horton.

When constructing a `CSSParserContext` with `UASheetMode`, settings are manually
turned on to allow User-Agent style stylesheets to use features that are
experimental and/or non-web exposed. However, for `CSSParserContext`s where the
`mode` is set after construction, the same settings are not enabled.

This is problematic for things like media controls, which use a `<style>` inside a
UA shadow root, and should be able to use system appearance features.

Fix by adding a method to `CSSParserContext` which sets UA mode and applies the
necessary settings.

* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::applyUASheetBehaviorsToContext):

Share logic to enable features.

(WebCore::CSSParserContext::CSSParserContext):
(WebCore::CSSParserContext::setUASheetMode):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/dom/InlineStyleSheetOwner.cpp:
(WebCore::parserContextForElement):

This is the main fix. Contexts for styles in UA shadow roots should turn on
more settings.

* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::ensureSourceData):

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



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


More information about the webkit-changes mailing list