[webkit-changes] [WebKit/WebKit] 75cef4: [WebVTT] Apply ::cue pseudo to the correct WebVTT ...

Jer Noble noreply at github.com
Thu Aug 15 16:59:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75cef4fa5fd2155fef875e02a8cee615b78e6af6
      https://github.com/WebKit/WebKit/commit/75cef4fa5fd2155fef875e02a8cee615b78e6af6
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2024-08-15 (Thu, 15 Aug 2024)

  Changed paths:
    M LayoutTests/http/tests/media/hls/hls-webvtt-style-expected.txt
    M LayoutTests/http/tests/media/hls/hls-webvtt-style.html
    M LayoutTests/http/tests/media/track/track-webvtt-vertical-multi-line-expected.txt
    M LayoutTests/http/tests/media/track/track-webvtt-vertical-multi-line.html
    M LayoutTests/media/track/track-cue-vertical-style.html
    M LayoutTests/media/track/track-in-band-layout.html
    M LayoutTests/media/track/track-user-stylesheet-override.html
    M LayoutTests/media/track/track-webvtt-no-snap-to-lines-overlap-expected.html
    M LayoutTests/media/track/track-webvtt-snap-to-lines-left-right-expected.html
    M Source/WebCore/Modules/modern-media-controls/controls/text-tracks.css
    M Source/WebCore/css/CSSPseudoSelectors.json
    M Source/WebCore/html/track/VTTCue.cpp
    M Source/WebCore/style/PropertyAllowlist.cpp
    M Source/WebCore/style/PropertyAllowlist.h
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/RuleData.cpp
    M Source/WebCore/style/RuleSet.cpp

  Log Message:
  -----------
  [WebVTT] Apply ::cue pseudo to the correct WebVTT object (root)
https://bugs.webkit.org/show_bug.cgi?id=276089
rdar://130913431

Reviewed by Tim Nguyen.

Previously, we applied the ::cue pseudo to the m_cueHighlightBox WebVTT object, in order to
implement the portion of the WebVTT spec where ::cue { background: foo; } applies to the "cue
background box" rather than the "list of WebVTT node objects". However, this causes other problems,
as it means style in the page cannot override styles applied to the root (i.e., display tree)
WebVTT object.

In order to implement this "exception to CSS styling" for `background:` property, when an incoming
style rule targetting the ident `::cue` selector is added, clone that rule and replace the selector
with a new selector for `[useragentpart="cue-background"]`, with a separate list of "allowed
properties" containing only `background:`.

Then change all the default styles to be in terms of `::cue` and `[useragentpart="cue"]`.

* Source/WebCore/Modules/modern-media-controls/controls/text-tracks.css:
([useragentpart="cue"]):
([useragentpart="cue"] .hidden):
([useragentpart="cue"] ruby):
([useragentpart="cue"] ruby > rt):
(::cue):
(::cue(rt)):
(::cue(i)):
(::cue(b)):
(::cue(u)):
(::-webkit-media-text-track-display): Deleted.
([useragentpart="-webkit-media-text-track-display"] b): Deleted.
([useragentpart="-webkit-media-text-track-display"] u): Deleted.
([useragentpart="-webkit-media-text-track-display"] i): Deleted.
([useragentpart="-webkit-media-text-track-display"] .hidden): Deleted.
([useragentpart="-webkit-media-text-track-display"] ruby): Deleted.
([useragentpart="-webkit-media-text-track-display"] ruby > rt): Deleted.
([useragentpart="-webkit-media-text-track-display"] ruby > :not(ruby)): Deleted.
* Source/WebCore/css/CSSPseudoSelectors.json:
* Source/WebCore/html/track/VTTCue.cpp:
(WebCore::VTTCue::obtainCSSBoxes):
* Source/WebCore/style/PropertyAllowlist.cpp:
(WebCore::Style::isValidCueStyleProperty):
(WebCore::Style::isValidCueSelectorStyleProperty):
(WebCore::Style::isValidCueBackgroundStyleProperty):
* Source/WebCore/style/PropertyAllowlist.h:
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch):
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::determinePropertyAllowlist):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):

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