Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-cascade] Cascade layers vs. VTT STYLE blocks #6735

Closed
xiaochengh opened this issue Oct 15, 2021 · 6 comments
Closed

[css-cascade] Cascade layers vs. VTT STYLE blocks #6735

xiaochengh opened this issue Oct 15, 2021 · 6 comments
Labels
Closed Rejected as OutOfScope Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-cascade-5

Comments

@xiaochengh
Copy link
Contributor

(Not sure if I should file it here or webvtt...)

WebVTT files can embed stylesheets in STYLE blocks to style video captions.

Regarding the relation with cascade layers, there are some issues to be resolved:

  1. What's the cascade precedence of STYLE blocks with layers taken into consideration?
  2. Can we define layers within STYLE blocks?

My understanding is that STYLE blocks are similar to the style attribute in the sense that they only apply to one specific element. So defining layers in STYLE blocks doesn't make sense in the same way as it doesn't make sense in the style attribute. And for the same reason the cascade precedence should be the same as the style attribute.

So my proposal is:

  1. STYLE blocks do not belong to any layer. They are cascaded with the same precedence as the style attribute (i.e., author origin & same tree scope as the <track> element), and the source order precedes the style attribute[1]
  2. @layer rules and layered @import rules in STYLE blocks should be invalid and ignored.

[1] The current WebVTT spec is pretty vague about the cascade precedence, just saying STYLE blocks are after all other stylesheets in the document in terms of the order of appearance. I think this should be refined, though, but it's probably a different issue.

@fantasai
Copy link
Collaborator

I think this is really a question for the WebVTT spec, but if they meant for STYLE blocks to have the highest possible precedence (over all other rules in the author style sheet) then yes, they should be mapped to the style attr category in the cascade.

Note the wording there was careful to avoid constraining styles to attributes specifically, and talks about “declarations that are attached directly to an element (such as the contents of a style attribute)”, so it's not unreasonable to interpret them that way.

Either way, I think WebVTT needs to do the clarifying here.

@mirisuzanne
Copy link
Contributor

I renamed that section to "Element Attached Styles" in 9812597

@xiaochengh
Copy link
Contributor Author

Alright, I'll cross-post to webvtt.

@xiaochengh
Copy link
Contributor Author

Regarding the term "Element Attached Styles": Can we somehow clarify that presentational hints are not included here? Because presentational hints are also put directly on the element, but have the lowest priority. This made me confused before.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Nov 11, 2021
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Nov 11, 2021
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Nov 11, 2021
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}
pull bot pushed a commit to ZSX-JOJO/chromium that referenced this issue Nov 11, 2021
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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 15, 2021
…lement-attached style, a=testonly

Automatic update from web-platform-tests
[@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}

--

wpt-commits: 20d6038632233d23b144c8f1e1cc02c35665efbf
wpt-pr: 31591
@fantasai
Copy link
Collaborator

@xiaochengh Added a cross-reference in b2110e6 ; let us know if that satisfies the concern?

jamienicol pushed a commit to jamienicol/gecko that referenced this issue Nov 16, 2021
…lement-attached style, a=testonly

Automatic update from web-platform-tests
[@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}

--

wpt-commits: 20d6038632233d23b144c8f1e1cc02c35665efbf
wpt-pr: 31591
@xiaochengh
Copy link
Contributor Author

b2110e6 LGTM, thanks!

@mirisuzanne mirisuzanne added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Nov 16, 2021
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this issue Nov 18, 2021
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}
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
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}
NOKEYCHECK=True
GitOrigin-RevId: 73d41c9e83bdeab9a732f7deeba1eb5c1d734023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Rejected as OutOfScope Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-cascade-5
Projects
None yet
Development

No branches or pull requests

3 participants