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
This commit is contained in:
alwu 2019-07-09 01:42:45 +00:00 committed by Emilio Cobos Álvarez
parent dcce668d3a
commit c00045b0c9
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
2 changed files with 2 additions and 0 deletions

View file

@ -29,6 +29,7 @@ ${helpers.single_keyword(
servo_pref="layout.writing-mode.enabled", servo_pref="layout.writing-mode.enabled",
animation_value_type="none", animation_value_type="none",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode", spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
flags="APPLIES_TO_CUE",
servo_restyle_damage="rebuild_and_reflow", servo_restyle_damage="rebuild_and_reflow",
)} )}

View file

@ -78,6 +78,7 @@ ${helpers.predefined_type(
"computed::OverflowWrap::Normal", "computed::OverflowWrap::Normal",
animation_value_type="discrete", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
flags="APPLIES_TO_CUE",
alias="word-wrap", alias="word-wrap",
needs_context=False, needs_context=False,
servo_restyle_damage="rebuild_and_reflow", servo_restyle_damage="rebuild_and_reflow",