| Index: Source/core/html/HTMLMarqueeElement.cpp
|
| diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp
|
| index 3b6d0e467808dba23592e2512e1df30f524b6dbd..644b417c64d25e12a699d6b48de1f1defdb4a838 100644
|
| --- a/Source/core/html/HTMLMarqueeElement.cpp
|
| +++ b/Source/core/html/HTMLMarqueeElement.cpp
|
| @@ -24,11 +24,14 @@
|
| #include "core/html/HTMLMarqueeElement.h"
|
|
|
| #include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/PrivateScriptRunner.h"
|
| +#include "bindings/core/v8/V8HTMLMarqueeElement.h"
|
| #include "core/CSSPropertyNames.h"
|
| #include "core/CSSValueKeywords.h"
|
| #include "core/HTMLNames.h"
|
| +#include "core/dom/ActiveDOMObject.h"
|
| +#include "core/dom/Document.h"
|
| #include "core/dom/ExceptionCode.h"
|
| -#include "core/rendering/RenderMarquee.h"
|
|
|
| namespace blink {
|
|
|
| @@ -38,127 +41,39 @@ inline HTMLMarqueeElement::HTMLMarqueeElement(Document& document)
|
| : HTMLElement(marqueeTag, document)
|
| , ActiveDOMObject(&document)
|
| {
|
| + v8::Handle<v8::Value> classObject = PrivateScriptRunner::installClassIfNeeded(document.frame(), "HTMLMarqueeElement");
|
| + RELEASE_ASSERT(!classObject.IsEmpty());
|
| }
|
|
|
| PassRefPtrWillBeRawPtr<HTMLMarqueeElement> HTMLMarqueeElement::create(Document& document)
|
| {
|
| RefPtrWillBeRawPtr<HTMLMarqueeElement> marqueeElement(adoptRefWillBeNoop(new HTMLMarqueeElement(document)));
|
| marqueeElement->suspendIfNeeded();
|
| + V8HTMLMarqueeElement::PrivateScript::createdCallbackMethod(document.frame(), marqueeElement.get());
|
| return marqueeElement.release();
|
| }
|
|
|
| -int HTMLMarqueeElement::minimumDelay() const
|
| +void HTMLMarqueeElement::attributeWillChange(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
|
| {
|
| - if (fastGetAttribute(truespeedAttr).isEmpty()) {
|
| - // WinIE uses 60ms as the minimum delay by default.
|
| - return 60;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -void HTMLMarqueeElement::didMoveToNewDocument(Document& oldDocument)
|
| -{
|
| - ActiveDOMObject::didMoveToNewExecutionContext(&document());
|
| - HTMLElement::didMoveToNewDocument(oldDocument);
|
| + HTMLElement::attributeWillChange(name, oldValue, newValue);
|
| + V8HTMLMarqueeElement::PrivateScript::attributeChangedCallbackMethod(document().frame(), this, name.toString(), oldValue, newValue);
|
| }
|
|
|
| -bool HTMLMarqueeElement::isPresentationAttribute(const QualifiedName& name) const
|
| +Node::InsertionNotificationRequest HTMLMarqueeElement::insertedInto(ContainerNode* insertionPoint)
|
| {
|
| - if (name == widthAttr || name == heightAttr || name == bgcolorAttr || name == vspaceAttr || name == hspaceAttr || name == scrollamountAttr || name == scrolldelayAttr || name == loopAttr || name == behaviorAttr || name == directionAttr)
|
| - return true;
|
| - return HTMLElement::isPresentationAttribute(name);
|
| -}
|
| -
|
| -void HTMLMarqueeElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
|
| -{
|
| - if (name == widthAttr) {
|
| - if (!value.isEmpty())
|
| - addHTMLLengthToStyle(style, CSSPropertyWidth, value);
|
| - } else if (name == heightAttr) {
|
| - if (!value.isEmpty())
|
| - addHTMLLengthToStyle(style, CSSPropertyHeight, value);
|
| - } else if (name == bgcolorAttr) {
|
| - if (!value.isEmpty())
|
| - addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
|
| - } else if (name == vspaceAttr) {
|
| - if (!value.isEmpty()) {
|
| - addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
|
| - addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value);
|
| - }
|
| - } else if (name == hspaceAttr) {
|
| - if (!value.isEmpty()) {
|
| - addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value);
|
| - addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
|
| - }
|
| - } else if (name == scrollamountAttr) {
|
| - if (!value.isEmpty())
|
| - addHTMLLengthToStyle(style, CSSPropertyInternalMarqueeIncrement, value);
|
| - } else if (name == scrolldelayAttr) {
|
| - if (!value.isEmpty())
|
| - addHTMLLengthToStyle(style, CSSPropertyInternalMarqueeSpeed, value);
|
| - } else if (name == loopAttr) {
|
| - if (!value.isEmpty()) {
|
| - if (value == "-1" || equalIgnoringCase(value, "infinite"))
|
| - addPropertyToPresentationAttributeStyle(style, CSSPropertyInternalMarqueeRepetition, CSSValueInfinite);
|
| - else
|
| - addHTMLLengthToStyle(style, CSSPropertyInternalMarqueeRepetition, value);
|
| - }
|
| - } else if (name == behaviorAttr) {
|
| - if (!value.isEmpty())
|
| - addPropertyToPresentationAttributeStyle(style, CSSPropertyInternalMarqueeStyle, value);
|
| - } else if (name == directionAttr) {
|
| - if (!value.isEmpty())
|
| - addPropertyToPresentationAttributeStyle(style, CSSPropertyInternalMarqueeDirection, value);
|
| - } else
|
| - HTMLElement::collectStyleForPresentationAttribute(name, value, style);
|
| -}
|
| -
|
| -void HTMLMarqueeElement::start()
|
| -{
|
| - if (RenderMarquee* marqueeRenderer = renderMarquee())
|
| - marqueeRenderer->start();
|
| -}
|
| -
|
| -void HTMLMarqueeElement::stop()
|
| -{
|
| - if (RenderMarquee* marqueeRenderer = renderMarquee())
|
| - marqueeRenderer->stop();
|
| -}
|
| -
|
| -void HTMLMarqueeElement::suspend()
|
| -{
|
| - if (RenderMarquee* marqueeRenderer = renderMarquee())
|
| - marqueeRenderer->suspend();
|
| -}
|
| -
|
| -void HTMLMarqueeElement::resume()
|
| -{
|
| - if (RenderMarquee* marqueeRenderer = renderMarquee())
|
| - marqueeRenderer->updateMarqueePosition();
|
| -}
|
| -
|
| -RenderMarquee* HTMLMarqueeElement::renderMarquee() const
|
| -{
|
| - if (renderer() && renderer()->isMarquee())
|
| - return toRenderMarquee(renderer());
|
| - return 0;
|
| -}
|
| -
|
| -RenderObject* HTMLMarqueeElement::createRenderer(RenderStyle*)
|
| -{
|
| - return new RenderMarquee(this);
|
| + HTMLElement::insertedInto(insertionPoint);
|
| + if (inDocument()) {
|
| + V8HTMLMarqueeElement::PrivateScript::attachedCallbackMethod(document().frame(), this);
|
| + }
|
| + return InsertionDone;
|
| }
|
|
|
| -void HTMLMarqueeElement::timerFired(Timer<HTMLMarqueeElement>*)
|
| +void HTMLMarqueeElement::removedFrom(ContainerNode* insertionPoint)
|
| {
|
| - if (!renderer())
|
| - return;
|
| -
|
| - document().updateLayout();
|
| -
|
| - // The updateLayout() could have destroyed renderer(), so this re-check is very important.
|
| - if (renderer())
|
| - toRenderMarquee(renderer())->timerFired();
|
| + HTMLElement::removedFrom(insertionPoint);
|
| + if (insertionPoint->inDocument()) {
|
| + V8HTMLMarqueeElement::PrivateScript::detachedCallbackMethod(insertionPoint->document().frame(), this);
|
| + }
|
| }
|
|
|
| } // namespace blink
|
|
|