diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/html/HTMLSourceElement.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/html/HTMLSourceElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLSourceElement.cpp | 89 |
1 files changed, 14 insertions, 75 deletions
diff --git a/Source/WebCore/html/HTMLSourceElement.cpp b/Source/WebCore/html/HTMLSourceElement.cpp index 5a428b2b1..4e0b4dae6 100644 --- a/Source/WebCore/html/HTMLSourceElement.cpp +++ b/Source/WebCore/html/HTMLSourceElement.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 INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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 INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, 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,16 +24,14 @@ */ #include "config.h" +#if ENABLE(VIDEO) #include "HTMLSourceElement.h" #include "Event.h" #include "EventNames.h" #include "HTMLDocument.h" -#if ENABLE(VIDEO) #include "HTMLMediaElement.h" -#endif #include "HTMLNames.h" -#include "HTMLPictureElement.h" #include "Logging.h" namespace WebCore { @@ -42,50 +40,33 @@ using namespace HTMLNames; inline HTMLSourceElement::HTMLSourceElement(const QualifiedName& tagName, Document& document) : HTMLElement(tagName, document) - , ActiveDOMObject(&document) - , m_errorEventTimer(*this, &HTMLSourceElement::errorEventTimerFired) + , m_errorEventTimer(this, &HTMLSourceElement::errorEventTimerFired) { LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this); ASSERT(hasTagName(sourceTag)); } -Ref<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tagName, Document& document) { - Ref<HTMLSourceElement> sourceElement = adoptRef(*new HTMLSourceElement(tagName, document)); - sourceElement->suspendIfNeeded(); - return sourceElement; + return adoptRef(new HTMLSourceElement(tagName, document)); } Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode& insertionPoint) { HTMLElement::insertedInto(insertionPoint); Element* parent = parentElement(); - if (parent) { -#if ENABLE(VIDEO) - if (is<HTMLMediaElement>(*parent)) - downcast<HTMLMediaElement>(*parent).sourceWasAdded(this); - else -#endif - if (is<HTMLPictureElement>(*parent)) - downcast<HTMLPictureElement>(*parent).sourcesChanged(); - } + if (parent && parent->isMediaElement()) + toHTMLMediaElement(parentNode())->sourceWasAdded(this); return InsertionDone; } void HTMLSourceElement::removedFrom(ContainerNode& removalRoot) { Element* parent = parentElement(); - if (!parent && is<Element>(removalRoot)) - parent = &downcast<Element>(removalRoot); - if (parent) { -#if ENABLE(VIDEO) - if (is<HTMLMediaElement>(*parent)) - downcast<HTMLMediaElement>(*parent).sourceWasRemoved(this); - else -#endif - if (is<HTMLPictureElement>(*parent)) - downcast<HTMLPictureElement>(*parent).sourcesChanged(); - } + if (!parent && removalRoot.isElementNode()) + parent = &toElement(removalRoot); + if (parent && parent->isMediaElement()) + toHTMLMediaElement(parent)->sourceWasRemoved(this); HTMLElement::removedFrom(removalRoot); } @@ -129,7 +110,7 @@ void HTMLSourceElement::cancelPendingErrorEvent() m_errorEventTimer.stop(); } -void HTMLSourceElement::errorEventTimerFired() +void HTMLSourceElement::errorEventTimerFired(Timer<HTMLSourceElement>&) { LOG(Media, "HTMLSourceElement::errorEventTimerFired - %p", this); dispatchEvent(Event::create(eventNames().errorEvent, false, true)); @@ -140,48 +121,6 @@ bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute); } -const char* HTMLSourceElement::activeDOMObjectName() const -{ - return "HTMLSourceElement"; -} - -bool HTMLSourceElement::canSuspendForDocumentSuspension() const -{ - return true; -} - -void HTMLSourceElement::suspend(ReasonForSuspension why) -{ - if (why == PageCache) { - m_shouldRescheduleErrorEventOnResume = m_errorEventTimer.isActive(); - m_errorEventTimer.stop(); - } -} - -void HTMLSourceElement::resume() -{ - if (m_shouldRescheduleErrorEventOnResume) { - m_errorEventTimer.startOneShot(0); - m_shouldRescheduleErrorEventOnResume = false; - } -} - -void HTMLSourceElement::stop() -{ - cancelPendingErrorEvent(); -} - -void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) -{ - HTMLElement::parseAttribute(name, value); - if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) { - if (name == mediaAttr) - m_mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(value); - auto* parent = parentNode(); - if (is<HTMLPictureElement>(parent)) - downcast<HTMLPictureElement>(*parent).sourcesChanged(); - } -} - } +#endif |