From c00045b0c9b34febc815ba7c727a253a4e04be62 Mon Sep 17 00:00:00 2001 From: alwu Date: Tue, 9 Jul 2019 01:42:45 +0000 Subject: [PATCH] style: set CSS properties directly on '::cue'. According to the spec [1], we have to set those CSS properties on the root node, and then this root node would have a child node, background box [2], which would contain all other child nodes. In our case, the background box is `cueDiv` [3]. In theory, all those properties set on the root node should be inherited by the background box. However, when the background box is a pseudo element `::cue`, they won't be directly inherit from the the background box's parent, inherited styles would acutally come from video instead. Therefore, we have to directly set these properties on the pseudo element and mark them as `!important` to avoid being overrided by user style script. [1] https://www.w3.org/TR/webvtt1/#ref-for-list-of-webvtt-node-objects-9 [2] https://www.w3.org/TR/webvtt1/#webvtt-cue-background-box [3] https://searchfox.org/mozilla-central/rev/11712bd3ce7454923e5931fa92eaf9c01ef35a0a/dom/media/webvtt/vtt.jsm#533-534 Differential Revision: https://phabricator.services.mozilla.com/D35694 --- components/style/properties/longhands/inherited_box.mako.rs | 1 + components/style/properties/longhands/inherited_text.mako.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/components/style/properties/longhands/inherited_box.mako.rs b/components/style/properties/longhands/inherited_box.mako.rs index 94ed265defa..f14c485b801 100644 --- a/components/style/properties/longhands/inherited_box.mako.rs +++ b/components/style/properties/longhands/inherited_box.mako.rs @@ -29,6 +29,7 @@ ${helpers.single_keyword( servo_pref="layout.writing-mode.enabled", animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode", + flags="APPLIES_TO_CUE", servo_restyle_damage="rebuild_and_reflow", )} diff --git a/components/style/properties/longhands/inherited_text.mako.rs b/components/style/properties/longhands/inherited_text.mako.rs index c81e8392f94..63596b7e653 100644 --- a/components/style/properties/longhands/inherited_text.mako.rs +++ b/components/style/properties/longhands/inherited_text.mako.rs @@ -78,6 +78,7 @@ ${helpers.predefined_type( "computed::OverflowWrap::Normal", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", + flags="APPLIES_TO_CUE", alias="word-wrap", needs_context=False, servo_restyle_damage="rebuild_and_reflow",