From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/html/track/WebVTTElement.cpp | 59 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'Source/WebCore/html/track/WebVTTElement.cpp') 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 cTag(nullAtom, "c", nullAtom); + static NeverDestroyed vTag(nullAtom, "v", nullAtom); + static NeverDestroyed langTag(nullAtom, "lang", nullAtom); + static NeverDestroyed bTag(nullAtom, "b", nullAtom); + static NeverDestroyed uTag(nullAtom, "u", nullAtom); + static NeverDestroyed iTag(nullAtom, "i", nullAtom); + static NeverDestroyed rubyTag(nullAtom, "ruby", nullAtom); + static NeverDestroyed rtTag(nullAtom, "rt", nullAtom); switch (nodeType) { case WebVTTNodeTypeClass: return cTag; @@ -75,19 +76,19 @@ WebVTTElement::WebVTTElement(WebVTTNodeType nodeType, Document& document) { } -PassRefPtr WebVTTElement::create(WebVTTNodeType nodeType, Document& document) +Ref WebVTTElement::create(WebVTTNodeType nodeType, Document& document) { - return adoptRef(new WebVTTElement(nodeType, document)); + return adoptRef(*new WebVTTElement(nodeType, document)); } -PassRefPtr WebVTTElement::cloneElementWithoutAttributesAndChildren() +Ref WebVTTElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) { - RefPtr clone = create(static_cast(m_webVTTNodeType), document()); + Ref clone = create(static_cast(m_webVTTNodeType), targetDocument); clone->setLanguage(m_language); - return clone; + return WTFMove(clone); } -PassRefPtr WebVTTElement::createEquivalentHTMLElement(Document& document) +Ref WebVTTElement::createEquivalentHTMLElement(Document& document) { RefPtr htmlElement; @@ -95,31 +96,31 @@ PassRefPtr 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 -- cgit v1.2.1