diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/track/WebVTTElement.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/track/WebVTTElement.cpp')
-rw-r--r-- | Source/WebCore/html/track/WebVTTElement.cpp | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/Source/WebCore/html/track/WebVTTElement.cpp b/Source/WebCore/html/track/WebVTTElement.cpp index 6a76d6078..f43403269 100644 --- a/Source/WebCore/html/track/WebVTTElement.cpp +++ b/Source/WebCore/html/track/WebVTTElement.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,26 +24,27 @@ */ #include "config.h" +#include "WebVTTElement.h" #if ENABLE(VIDEO_TRACK) -#include "WebVTTElement.h" - -#include "HTMLElementFactory.h" +#include "HTMLSpanElement.h" +#include "RubyElement.h" +#include "RubyTextElement.h" #include "TextTrack.h" namespace WebCore { static const QualifiedName& nodeTypeToTagName(WebVTTNodeType nodeType) { - DEFINE_STATIC_LOCAL(QualifiedName, cTag, (nullAtom, "c", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, vTag, (nullAtom, "v", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, langTag, (nullAtom, "lang", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, bTag, (nullAtom, "b", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, uTag, (nullAtom, "u", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, iTag, (nullAtom, "i", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, rubyTag, (nullAtom, "ruby", nullAtom)); - DEFINE_STATIC_LOCAL(QualifiedName, rtTag, (nullAtom, "rt", nullAtom)); + static NeverDestroyed<QualifiedName> cTag(nullAtom, "c", nullAtom); + static NeverDestroyed<QualifiedName> vTag(nullAtom, "v", nullAtom); + static NeverDestroyed<QualifiedName> langTag(nullAtom, "lang", nullAtom); + static NeverDestroyed<QualifiedName> bTag(nullAtom, "b", nullAtom); + static NeverDestroyed<QualifiedName> uTag(nullAtom, "u", nullAtom); + static NeverDestroyed<QualifiedName> iTag(nullAtom, "i", nullAtom); + static NeverDestroyed<QualifiedName> rubyTag(nullAtom, "ruby", nullAtom); + static NeverDestroyed<QualifiedName> rtTag(nullAtom, "rt", nullAtom); switch (nodeType) { case WebVTTNodeTypeClass: return cTag; @@ -75,19 +76,19 @@ WebVTTElement::WebVTTElement(WebVTTNodeType nodeType, Document& document) { } -PassRefPtr<WebVTTElement> WebVTTElement::create(WebVTTNodeType nodeType, Document& document) +Ref<WebVTTElement> WebVTTElement::create(WebVTTNodeType nodeType, Document& document) { - return adoptRef(new WebVTTElement(nodeType, document)); + return adoptRef(*new WebVTTElement(nodeType, document)); } -PassRefPtr<Element> WebVTTElement::cloneElementWithoutAttributesAndChildren() +Ref<Element> WebVTTElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) { - RefPtr<WebVTTElement> clone = create(static_cast<WebVTTNodeType>(m_webVTTNodeType), document()); + Ref<WebVTTElement> clone = create(static_cast<WebVTTNodeType>(m_webVTTNodeType), targetDocument); clone->setLanguage(m_language); - return clone; + return WTFMove(clone); } -PassRefPtr<HTMLElement> WebVTTElement::createEquivalentHTMLElement(Document& document) +Ref<HTMLElement> WebVTTElement::createEquivalentHTMLElement(Document& document) { RefPtr<HTMLElement> htmlElement; @@ -95,31 +96,31 @@ PassRefPtr<HTMLElement> WebVTTElement::createEquivalentHTMLElement(Document& doc case WebVTTNodeTypeClass: case WebVTTNodeTypeLanguage: case WebVTTNodeTypeVoice: - htmlElement = HTMLElementFactory::createElement(HTMLNames::spanTag, document); - htmlElement->setAttribute(HTMLNames::titleAttr, getAttribute(voiceAttributeName())); - htmlElement->setAttribute(HTMLNames::langAttr, getAttribute(langAttributeName())); + htmlElement = HTMLSpanElement::create(document); + htmlElement->setAttributeWithoutSynchronization(HTMLNames::titleAttr, attributeWithoutSynchronization(voiceAttributeName())); + htmlElement->setAttributeWithoutSynchronization(HTMLNames::langAttr, attributeWithoutSynchronization(langAttributeName())); break; case WebVTTNodeTypeItalic: - htmlElement = HTMLElementFactory::createElement(HTMLNames::iTag, document); + htmlElement = HTMLElement::create(HTMLNames::iTag, document); break; case WebVTTNodeTypeBold: - htmlElement = HTMLElementFactory::createElement(HTMLNames::bTag, document); + htmlElement = HTMLElement::create(HTMLNames::bTag, document); break; case WebVTTNodeTypeUnderline: - htmlElement = HTMLElementFactory::createElement(HTMLNames::uTag, document); + htmlElement = HTMLElement::create(HTMLNames::uTag, document); break; case WebVTTNodeTypeRuby: - htmlElement = HTMLElementFactory::createElement(HTMLNames::rubyTag, document); + htmlElement = RubyElement::create(document); break; case WebVTTNodeTypeRubyText: - htmlElement = HTMLElementFactory::createElement(HTMLNames::rtTag, document); + htmlElement = RubyTextElement::create(document); break; } ASSERT(htmlElement); if (htmlElement) - htmlElement->setAttribute(HTMLNames::classAttr, fastGetAttribute(HTMLNames::classAttr)); - return htmlElement.release(); + htmlElement->setAttributeWithoutSynchronization(HTMLNames::classAttr, attributeWithoutSynchronization(HTMLNames::classAttr)); + return htmlElement.releaseNonNull(); } } // namespace WebCore |