Index: Source/core/html/HTMLMarqueeElement.cpp |
diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp |
index 3b6d0e467808dba23592e2512e1df30f524b6dbd..793e037c3e85d81e19b910e964286697c65d0354 100644 |
--- a/Source/core/html/HTMLMarqueeElement.cpp |
+++ b/Source/core/html/HTMLMarqueeElement.cpp |
@@ -23,142 +23,48 @@ |
#include "config.h" |
#include "core/html/HTMLMarqueeElement.h" |
-#include "bindings/core/v8/ExceptionState.h" |
-#include "core/CSSPropertyNames.h" |
-#include "core/CSSValueKeywords.h" |
+#include "bindings/core/v8/PrivateScriptRunner.h" |
+#include "bindings/core/v8/V8HTMLMarqueeElement.h" |
#include "core/HTMLNames.h" |
-#include "core/dom/ExceptionCode.h" |
-#include "core/rendering/RenderMarquee.h" |
+#include "core/dom/Document.h" |
namespace blink { |
-using namespace HTMLNames; |
- |
inline HTMLMarqueeElement::HTMLMarqueeElement(Document& document) |
- : HTMLElement(marqueeTag, document) |
- , ActiveDOMObject(&document) |
+ : HTMLElement(HTMLNames::marqueeTag, 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 |
-{ |
- 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); |
-} |
- |
-bool HTMLMarqueeElement::isPresentationAttribute(const QualifiedName& name) const |
-{ |
- 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() |
+void HTMLMarqueeElement::attributeWillChange(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue) |
{ |
- if (RenderMarquee* marqueeRenderer = renderMarquee()) |
- marqueeRenderer->updateMarqueePosition(); |
+ HTMLElement::attributeWillChange(name, oldValue, newValue); |
+ V8HTMLMarqueeElement::PrivateScript::attributeChangedCallbackMethod(document().frame(), this, name.toString(), oldValue, newValue); |
} |
-RenderMarquee* HTMLMarqueeElement::renderMarquee() const |
+Node::InsertionNotificationRequest HTMLMarqueeElement::insertedInto(ContainerNode* insertionPoint) |
{ |
- 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 |