WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
105478
Implemet :lang() pseudo class support for the WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=105478
Summary
Implemet :lang() pseudo class support for the WebVTT ::cue pseudo element
Dima Gorbik
Reported
2012-12-19 16:44:19 PST
"For the purposes of the :lang() pseudo-class, WebVTT Internal Node Objects have the language described as the WebVTT Node Object's applicable language."
http://dev.w3.org/html5/webvtt/#the-'::cue'-pseudo-element
Attachments
Proposed fix 0.1
(4.67 KB, patch)
2013-02-01 20:46 PST
,
Dima Gorbik
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2012-12-19 16:47:43 PST
<
rdar://problem/12914550
>
Dima Gorbik
Comment 2
2013-02-01 20:46:41 PST
Created
attachment 186209
[details]
Proposed fix 0.1
Silvia Pfeiffer
Comment 3
2013-02-01 22:18:07 PST
You're mistaken. <lang> is an actual element in WebVTT and not a pseudo-element. It's similar to <b>, <c>, <u> etc in that way. See
http://dev.w3.org/html5/webvtt/#webvtt-cue-language-span
. Your example should not be: ::cue(:lang(ru)) { color: lime; } ::cue(:lang(en)) { color: purple; } But rather: ::cue(lang[lang="ru"]) { color: lime; } ::cue(lang[lang="en"]) { color: purple; }
Silvia Pfeiffer
Comment 4
2013-02-01 22:20:11 PST
Ha, I totally missed that there is also a :lang() pseudo-class - apologies! That's great!
Silvia Pfeiffer
Comment 5
2013-02-01 22:28:47 PST
However, I now wonder what the other part of that example means: ::cue(c[lang="ru"]) { color: red; } ::cue(c[lang="en"]) { color: green; } As I understand it, the <c> tag in WebVTT does not have a lang attribute. The lang attribute is only defined on the <lang> element. I believe it might be caused by a typo in the table in
http://dev.w3.org/html5/webvtt/#webvtt-cue-language-span
. I've just registered
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20852
.
Dima Gorbik
Comment 6
2013-02-01 22:52:42 PST
(In reply to
comment #5
)
> However, I now wonder what the other part of that example means: > > ::cue(c[lang="ru"]) { color: red; } > ::cue(c[lang="en"]) { color: green; } > > As I understand it, the <c> tag in WebVTT does not have a lang attribute. The lang attribute is only defined on the <lang> element. > > I believe it might be caused by a typo in the table in
http://dev.w3.org/html5/webvtt/#webvtt-cue-language-span
. I've just registered
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20852
.
Hm, interesting. It really looks like only webvtt lang objects have the 'lang' attribute. And I should store the language for those elements internally so that it's only accessible by using this :lang pseudo-class. But why can't we have a lang attribute for all elements? Is this something we should discuss?
Dima Gorbik
Comment 7
2013-02-01 22:55:11 PST
(In reply to
comment #5
)
> I believe it might be caused by a typo in the table in
http://dev.w3.org/html5/webvtt/#webvtt-cue-language-span
. I've just registered
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20852
.
Yes, you are right! This part was confusing as well. :)
Silvia Pfeiffer
Comment 8
2013-02-01 23:06:06 PST
(In reply to
comment #6
)
>But why can't we have a lang attribute for all elements? Is this something we should discuss?
It's not like in HTML where all elements have a @lang attribute. The intention is that a section (span? ;-) of text in a cue can be given in a different language to the default language of the file (which is somewhat specified in the @srclang attribute of <track>). It doesn't really make sense to have a bold section in a different language, or a class section - language is not bound to another element. More at
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15922
which led to the introduction of <lang> That reminds me to register a bug to actually have a default language for the file...
Silvia Pfeiffer
Comment 9
2013-02-01 23:14:14 PST
I've registered
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20853
. I'll leave the lang([lang="xx"]) bug on WebKit to you. Thanks for all this great work on getting CSS styling for WebVTT!
Dima Gorbik
Comment 10
2013-02-01 23:40:49 PST
(In reply to
comment #9
)
> I've registered
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20853
. I'll leave the lang([lang="xx"]) bug on WebKit to you. Thanks for all this great work on getting CSS styling for WebVTT!
Yeah, I will have to fix this separately, because it was introduced before in
https://bugs.webkit.org/show_bug.cgi?id=107907
. Thanks for the feedback, it's really helpful!
WebKit Review Bot
Comment 11
2013-02-04 13:02:02 PST
Comment on
attachment 186209
[details]
Proposed fix 0.1 Clearing flags on attachment: 186209 Committed
r141795
: <
http://trac.webkit.org/changeset/141795
>
WebKit Review Bot
Comment 12
2013-02-04 13:02:08 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 13
2013-02-04 13:15:08 PST
Comment on
attachment 186209
[details]
Proposed fix 0.1 View in context:
https://bugs.webkit.org/attachment.cgi?id=186209&action=review
> Source/WebCore/css/SelectorChecker.cpp:825 > + value = element->getAttribute(langAttr);
Should probably be fastGetAttribute. Are we guaranteed that there is always a lang attribute in WebVTT? Would we ever want to compute the inherited language instead? Is there a way to factor this so we don’t have to put this code into CSS? Maybe a virtual function?
Dima Gorbik
Comment 14
2013-02-04 13:37:21 PST
(In reply to
comment #13
)
> (From update of
attachment 186209
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=186209&action=review
> > > Source/WebCore/css/SelectorChecker.cpp:825 > > + value = element->getAttribute(langAttr); > > Should probably be fastGetAttribute. > > Are we guaranteed that there is always a lang attribute in WebVTT? Would we ever want to compute the inherited language instead? > > Is there a way to factor this so we don’t have to put this code into CSS? Maybe a virtual function?
According to specs lang attribute should only exist for lang webvtt objects. We should store the language internally to all other nodes, so we will not get this attribute. This is something I have to modify soon. Specs also require to precalculate on the parsing stage so we probably will never do it the same way as we do for html elements. Renaming computeInheritedLanguage() function and making it virtual is a good idea, I will do that.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug