Chromium Code Reviews| Index: Source/core/html/HTMLMarqueeElement.cpp |
| diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp |
| index ba207e3ae8f4c3bde6aaacebbdf269d680137b4f..3a610ba4773d9fdf71e39fbc2f388424521f2596 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 { |
| @@ -39,127 +42,43 @@ inline HTMLMarqueeElement::HTMLMarqueeElement(Document& document) |
| , ActiveDOMObject(&document) |
| { |
| ScriptWrappable::init(this); |
| + 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(); |
| + ScriptForbiddenScope::AllowUserAgentScript script; |
| + V8HTMLMarqueeElement::createdCallbackMethodImplementedInPrivateScript(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); |
| + ScriptForbiddenScope::AllowUserAgentScript script; |
| + V8HTMLMarqueeElement::attributeChangedCallbackMethodImplementedInPrivateScript(document().frame(), this); |
| } |
| -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()) { |
| + ScriptForbiddenScope::AllowUserAgentScript script; |
| + V8HTMLMarqueeElement::attachedCallbackMethodImplementedInPrivateScript(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()) { |
| + ScriptForbiddenScope::AllowUserAgentScript script; |
|
arv (Not doing code reviews)
2014/07/24 16:59:37
Could/should this be baked into the generated code
|
| + V8HTMLMarqueeElement::detachedCallbackMethodImplementedInPrivateScript(insertionPoint->document().frame(), this); |
| + } |
| } |
| } // namespace blink |