forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@layer] Cascade VTT-embedded style as element-attached style
As per w3c/csswg-drafts#6735: WebVTT-embedded style has the same cascade precedence as the style attribute. Therefore, important WebVTT-embedded style should take precedence over important author layered style. This patch ensures that. Bug: 1095765 Change-Id: I352ff87294235433bcf006e233a2ca7514d4f990 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3273710 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/main@{#940808}
- Loading branch information
1 parent
c708b4b
commit 73d41c9
Showing
5 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...vtt/rendering/cues-with-video/processing-model/embedded_style_cascade_priority_layer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<title>Embedded Style: Cascade Priority</title> | ||
<link rel="match" href="embedded_style_cascade_priority-ref.html"> | ||
<link rel="help" href="https://w3c.github.io/webvtt/#obtaining-css-boxes"> | ||
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#cascade-sort"> | ||
<link rel="author" href="mailto:xiaochengh@chromium.org"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<style> | ||
/* Embedded important style should take precedence over author important style | ||
regardless of layers, so the cue color should be green. */ | ||
@layer { | ||
::cue { | ||
color: red !important; | ||
} | ||
} | ||
</style> | ||
<video width="320" height="180" autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();"> | ||
<source src="/media/white.webm" type="video/webm"> | ||
<source src="/media/white.mp4" type="video/mp4"> | ||
<track src="support/embedded_style_cascade_priority_layer.vtt" default> | ||
</video> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
...dering/cues-with-video/processing-model/support/embedded_style_cascade_priority_layer.vtt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
WEBVTT | ||
NOTE | ||
opacity: 0.5; should apply. | ||
color: green; should apply. | ||
background: green; should apply because multiple STYLE blocks are supported. | ||
STYLE | ||
::cue { | ||
opacity: 0.5; | ||
} | ||
::cue { | ||
color: green !important; | ||
} | ||
STYLE | ||
::cue { | ||
background: green; | ||
} | ||
00:00:00.000 --> 00:00:05.000 | ||
<v Voice1>This <i>is</i> a <b>test</b> subtitle | ||
|
||
00:00:00.000 --> 00:00:05.000 | ||
<v Voice2>Here <i>is</i> a <b>second</b> subtitle |