Changeset 142772 in webkit


Ignore:
Timestamp:
Feb 13, 2013 12:23:49 PM (11 years ago)
Author:
eric@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142770 r142772  
     12013-02-13  Eric Seidel  <eric@webkit.org>
     2
     3        Use fancy new Vector-based String constructors in the WebVTT parser
     4        https://bugs.webkit.org/show_bug.cgi?id=109619
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        No change in behavior. Added some FIXMEs for future perf optimization.
     9
     10        * html/track/WebVTTParser.cpp:
     11        (WebCore::WebVTTParser::constructTreeFromToken):
     12
    1132013-02-13  Morten Stenshorne  <mstensho@opera.com>
    214
  • trunk/Source/WebCore/html/track/WebVTTParser.cpp

    r142043 r142772  
    374374void WebVTTParser::constructTreeFromToken(Document* document)
    375375{
    376     AtomicString tokenTagName(m_token.name().data(), m_token.name().size());
    377     QualifiedName tagName(nullAtom, tokenTagName, xhtmlNamespaceURI);
     376    QualifiedName tagName(nullAtom, AtomicString(m_token.name()), xhtmlNamespaceURI);
    378377
    379378    // http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules
     
    381380    switch (m_token.type()) {
    382381    case WebVTTTokenTypes::Character: {
    383         String content(m_token.characters().data(), m_token.characters().size());
     382        String content(m_token.characters()); // FIXME: This should be 8bit if possible.
    384383        RefPtr<Text> child = Text::create(document, content);
    385384        m_currentNode->parserAppendChild(child);
     
    393392        if (child) {
    394393            if (m_token.classes().size() > 0)
    395                 child->setAttribute(classAttr, AtomicString(m_token.classes().data(), m_token.classes().size()));
     394                child->setAttribute(classAttr, AtomicString(m_token.classes()));
    396395
    397396            if (child->webVTTNodeType() == WebVTTNodeTypeVoice)
    398                 child->setAttribute(WebVTTElement::voiceAttributeName(), AtomicString(m_token.annotation().data(), m_token.annotation().size()));
     397                child->setAttribute(WebVTTElement::voiceAttributeName(), AtomicString(m_token.annotation()));
    399398            else if (child->webVTTNodeType() == WebVTTNodeTypeLanguage) {
    400                 m_languageStack.append(AtomicString(m_token.annotation().data(), m_token.annotation().size()));
     399                m_languageStack.append(AtomicString(m_token.annotation()));
    401400                child->setAttribute(WebVTTElement::langAttributeName(), m_languageStack.last());
    402401            }
     
    421420        unsigned position = 0;
    422421        double time = collectTimeStamp(m_token.characters().data(), &position);
     422        // FIXME: This should use an 8bit string if possible.
    423423        if (time != malformedTime)
    424             m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters().data(), m_token.characters().size())));
     424            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters())));
    425425        break;
    426426    }
Note: See TracChangeset for help on using the changeset viewer.