Title: [142772] trunk/Source/WebCore
Revision
142772
Author
[email protected]
Date
2013-02-13 12:23:49 -0800 (Wed, 13 Feb 2013)

Log Message

Use fancy new Vector-based String constructors in the WebVTT parser
https://bugs.webkit.org/show_bug.cgi?id=109619

Reviewed by Benjamin Poulain.

No change in behavior. Added some FIXMEs for future perf optimization.

* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::constructTreeFromToken):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (142771 => 142772)


--- trunk/Source/WebCore/ChangeLog	2013-02-13 20:14:45 UTC (rev 142771)
+++ trunk/Source/WebCore/ChangeLog	2013-02-13 20:23:49 UTC (rev 142772)
@@ -1,3 +1,15 @@
+2013-02-13  Eric Seidel  <[email protected]>
+
+        Use fancy new Vector-based String constructors in the WebVTT parser
+        https://bugs.webkit.org/show_bug.cgi?id=109619
+
+        Reviewed by Benjamin Poulain.
+
+        No change in behavior. Added some FIXMEs for future perf optimization.
+
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::constructTreeFromToken):
+
 2013-02-13  Morten Stenshorne  <[email protected]>
 
         WebKit ignores column-rules wider than column-gap

Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (142771 => 142772)


--- trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-02-13 20:14:45 UTC (rev 142771)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-02-13 20:23:49 UTC (rev 142772)
@@ -373,14 +373,13 @@
 
 void WebVTTParser::constructTreeFromToken(Document* document)
 {
-    AtomicString tokenTagName(m_token.name().data(), m_token.name().size());
-    QualifiedName tagName(nullAtom, tokenTagName, xhtmlNamespaceURI);
+    QualifiedName tagName(nullAtom, AtomicString(m_token.name()), xhtmlNamespaceURI);
 
     // http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules
 
     switch (m_token.type()) {
     case WebVTTTokenTypes::Character: {
-        String content(m_token.characters().data(), m_token.characters().size());
+        String content(m_token.characters()); // FIXME: This should be 8bit if possible.
         RefPtr<Text> child = Text::create(document, content);
         m_currentNode->parserAppendChild(child);
         break;
@@ -392,12 +391,12 @@
             child = WebVTTElement::create(nodeType, document);
         if (child) {
             if (m_token.classes().size() > 0)
-                child->setAttribute(classAttr, AtomicString(m_token.classes().data(), m_token.classes().size()));
+                child->setAttribute(classAttr, AtomicString(m_token.classes()));
 
             if (child->webVTTNodeType() == WebVTTNodeTypeVoice)
-                child->setAttribute(WebVTTElement::voiceAttributeName(), AtomicString(m_token.annotation().data(), m_token.annotation().size()));
+                child->setAttribute(WebVTTElement::voiceAttributeName(), AtomicString(m_token.annotation()));
             else if (child->webVTTNodeType() == WebVTTNodeTypeLanguage) {
-                m_languageStack.append(AtomicString(m_token.annotation().data(), m_token.annotation().size()));
+                m_languageStack.append(AtomicString(m_token.annotation()));
                 child->setAttribute(WebVTTElement::langAttributeName(), m_languageStack.last());
             }
             if (!m_languageStack.isEmpty())
@@ -420,8 +419,9 @@
     case WebVTTTokenTypes::TimestampTag: {
         unsigned position = 0;
         double time = collectTimeStamp(m_token.characters().data(), &position);
+        // FIXME: This should use an 8bit string if possible.
         if (time != malformedTime)
-            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters().data(), m_token.characters().size())));
+            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters())));
         break;
     }
     default:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to