Diff
Modified: trunk/LayoutTests/ChangeLog (142042 => 142043)
--- trunk/LayoutTests/ChangeLog 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/LayoutTests/ChangeLog 2013-02-06 23:33:15 UTC (rev 142043)
@@ -1,3 +1,14 @@
+2013-02-06 Dima Gorbik <dgor...@apple.com>
+
+ Store the language internally instead of using lang attribute for WebVTT nodes
+ https://bugs.webkit.org/show_bug.cgi?id=108858
+
+ Reviewed by Eric Carlson.
+
+ * media/track/captions-webvtt/styling-lang.vtt:
+ * media/track/track-css-matching-lang-expected.txt:
+ * media/track/track-css-matching-lang.html:
+
2013-02-06 Levi Weintraub <le...@chromium.org>
Negative text indents can break RenderBlock's inline maximum preferred width calculation
Modified: trunk/LayoutTests/media/track/captions-webvtt/styling-lang.vtt (142042 => 142043)
--- trunk/LayoutTests/media/track/captions-webvtt/styling-lang.vtt 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling-lang.vtt 2013-02-06 23:33:15 UTC (rev 142043)
@@ -2,8 +2,4 @@
1
00:00.000 --> 00:00.500
-<lang en><c>English<lang ru><c> Русский<lang en><c> English again</c></lang></c></lang></c></lang>
-
-2
-00:00.500 --> 00:01.000
-<lang en><i>English<lang ru><b> Русский<lang en><u> English again</u></lang></b></lang></i></lang>
+<lang en><b>English<lang ru><c> Русский<lang en><i> English again</i></lang></c></lang></b></lang>
Modified: trunk/LayoutTests/media/track/track-css-matching-lang-expected.txt (142042 => 142043)
--- trunk/LayoutTests/media/track/track-css-matching-lang-expected.txt 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/LayoutTests/media/track/track-css-matching-lang-expected.txt 2013-02-06 23:33:15 UTC (rev 142043)
@@ -1,12 +1,6 @@
-Test that cues are being matched properly by the lang attribute.
+Test that cues are being matched properly by the lang attribute and :lang() pseudo class.
EVENT(canplaythrough)
EVENT(seeked)
-EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
-EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
-EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
-
-RUN(video.currentTime = 0.6)
-EVENT(seeked)
EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 0, 128)') OK
EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 0, 128)') OK
Modified: trunk/LayoutTests/media/track/track-css-matching-lang.html (142042 => 142043)
--- trunk/LayoutTests/media/track/track-css-matching-lang.html 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/LayoutTests/media/track/track-css-matching-lang.html 2013-02-06 23:33:15 UTC (rev 142043)
@@ -9,19 +9,17 @@
<style>
::cue(:lang(ru)) { color: lime; }
- ::cue(:lang(en)) { color: purple; }
- ::cue(c[lang="ru"]) { color: red; }
- ::cue(c[lang="en"]) { color: green; }
+ ::cue(lang[lang="en"]) { color: purple; }
+ ::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for 'c'. */
</style>
<script>
var cueNode;
var seekedCount = 0;
- var seekTimes = [0.1, 0.6];
+ var seekTimes = [0.1];
- var info = [["rgb(0, 128, 0)", "rgb(255, 0, 0)", "rgb(0, 128, 0)"],
- ["rgb(128, 0, 128)", "rgb(0, 255, 0)", "rgb(128, 0, 128)"]];
+ var info = [["rgb(128, 0, 128)", "rgb(0, 255, 0)", "rgb(128, 0, 128)"]];
function seeked()
{
@@ -45,7 +43,7 @@
function loaded()
{
- consoleWrite("Test that cues are being matched properly by the lang attribute.");
+ consoleWrite("Test that cues are being matched properly by the lang attribute and :lang() pseudo class.");
findMediaElement();
video.src = "" '../content/test');
video.id = "testvideo";
Modified: trunk/Source/WebCore/ChangeLog (142042 => 142043)
--- trunk/Source/WebCore/ChangeLog 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/Source/WebCore/ChangeLog 2013-02-06 23:33:15 UTC (rev 142043)
@@ -1,3 +1,28 @@
+2013-02-06 Dima Gorbik <dgor...@apple.com>
+
+ Store the language internally instead of using lang attribute for WebVTT nodes
+ https://bugs.webkit.org/show_bug.cgi?id=108858
+
+ Reviewed by Eric Carlson.
+
+ Only language webvtt elements should have a lang attribute so we have to store
+ the language internally in the element. Refactored the code to make
+ computeInheritedLanguage virtual.
+
+ Existing tests were modified to cover this case.
+
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOne):
+ * html/track/WebVTTElement.cpp:
+ (WebCore::WebVTTElement::WebVTTElement):
+ (WebCore::WebVTTElement::cloneElementWithoutAttributesAndChildren):
+ (WebCore::WebVTTElement::createEquivalentHTMLElement): clone the internal language property.
+ * html/track/WebVTTElement.h:
+ (WebCore::WebVTTElement::language):
+ (WebCore::WebVTTElement::setLanguage):
+ * html/track/WebVTTParser.cpp: only set the lang attribute for language objects.
+ (WebCore::WebVTTParser::constructTreeFromToken):
+
2013-02-06 Levi Weintraub <le...@chromium.org>
Negative text indents can break RenderBlock's inline maximum preferred width calculation
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (142042 => 142043)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2013-02-06 23:33:15 UTC (rev 142043)
@@ -822,7 +822,7 @@
AtomicString value;
#if ENABLE(VIDEO_TRACK)
if (element->isWebVTTElement())
- value = element->getAttribute(langAttr);
+ value = toWebVTTElement(element)->language();
else
#endif
value = element->computeInheritedLanguage();
Modified: trunk/Source/WebCore/html/track/WebVTTElement.cpp (142042 => 142043)
--- trunk/Source/WebCore/html/track/WebVTTElement.cpp 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/Source/WebCore/html/track/WebVTTElement.cpp 2013-02-06 23:33:15 UTC (rev 142043)
@@ -81,7 +81,9 @@
PassRefPtr<Element> WebVTTElement::cloneElementWithoutAttributesAndChildren()
{
- return create(static_cast<WebVTTNodeType>(m_webVTTNodeType), document());
+ RefPtr<WebVTTElement> clone = create(static_cast<WebVTTNodeType>(m_webVTTNodeType), document());
+ clone->setLanguage(m_language);
+ return clone;
}
PassRefPtr<HTMLElement> WebVTTElement::createEquivalentHTMLElement(Document* document)
@@ -93,6 +95,7 @@
case WebVTTNodeTypeVoice:
htmlElement = HTMLElement::create(HTMLNames::spanTag, document);
htmlElement.get()->setAttribute(HTMLNames::titleAttr, getAttribute(voiceAttributeName()));
+ htmlElement.get()->setAttribute(HTMLNames::langAttr, getAttribute(langAttributeName()));
break;
case WebVTTNodeTypeItalic:
htmlElement = HTMLElement::create(HTMLNames::iTag, document);
@@ -113,7 +116,6 @@
ASSERT_NOT_REACHED();
}
- htmlElement.get()->setAttribute(HTMLNames::langAttr, getAttribute(langAttributeName()));
htmlElement.get()->setAttribute(HTMLNames::classAttr, getAttribute(HTMLNames::classAttr));
return htmlElement;
}
Modified: trunk/Source/WebCore/html/track/WebVTTElement.h (142042 => 142043)
--- trunk/Source/WebCore/html/track/WebVTTElement.h 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/Source/WebCore/html/track/WebVTTElement.h 2013-02-06 23:33:15 UTC (rev 142043)
@@ -56,6 +56,8 @@
void setIsPastNode(bool value) { m_isPastNode = value; }
virtual bool isWebVTTElement() const OVERRIDE { return true; }
+ AtomicString language() const { return m_language; }
+ void setLanguage(AtomicString value) { m_language = value; }
static const QualifiedName& voiceAttributeName()
{
@@ -76,6 +78,7 @@
unsigned m_isPastNode : 1;
unsigned m_webVTTNodeType : 4;
+ AtomicString m_language;
};
inline WebVTTElement* toWebVTTElement(Node* node)
Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (142042 => 142043)
--- trunk/Source/WebCore/html/track/WebVTTParser.cpp 2013-02-06 23:08:59 UTC (rev 142042)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp 2013-02-06 23:33:15 UTC (rev 142043)
@@ -396,12 +396,12 @@
if (child->webVTTNodeType() == WebVTTNodeTypeVoice)
child->setAttribute(WebVTTElement::voiceAttributeName(), AtomicString(m_token.annotation().data(), m_token.annotation().size()));
- else if (child->webVTTNodeType() == WebVTTNodeTypeLanguage)
+ else if (child->webVTTNodeType() == WebVTTNodeTypeLanguage) {
m_languageStack.append(AtomicString(m_token.annotation().data(), m_token.annotation().size()));
-
+ child->setAttribute(WebVTTElement::langAttributeName(), m_languageStack.last());
+ }
if (!m_languageStack.isEmpty())
- child->setAttribute(WebVTTElement::langAttributeName(), m_languageStack.last());
-
+ child->setLanguage(m_languageStack.last());
m_currentNode->parserAppendChild(child);
m_currentNode = child;
}