summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-07-31 11:52:57 +1000
committerWarwick Allison <warwick.allison@nokia.com>2009-07-31 11:52:57 +1000
commitaa9cf406d62004519ad54596e1c391f9a6439210 (patch)
treedd562b9c296981f2761b76623911be8496c7af84 /src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp
parent987aec28b950e1c9817a20a9dd71afc071cd93ea (diff)
parent56b6a5924008ab5cdbae36e9662eddba923acd5e (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp
index 4a27bb4a2..faaaf41ed 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp
@@ -35,18 +35,9 @@ ASSERT_CLASS_FITS_IN_CELL(JSImageConstructor);
const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0, 0 };
JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMObject(JSImageConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
- , m_globalObject(globalObject)
+ : DOMConstructorWithDocument(JSImageConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- ASSERT(globalObject->scriptExecutionContext());
- ASSERT(globalObject->scriptExecutionContext()->isDocument());
-
- putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, exec->lexicalGlobalObject()), None);
-}
-
-Document* JSImageConstructor::document() const
-{
- return static_cast<Document*>(m_globalObject->scriptExecutionContext());
+ putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None);
}
static JSObject* constructImage(ExecState* exec, JSObject* constructor, const ArgList& args)
@@ -64,21 +55,22 @@ static JSObject* constructImage(ExecState* exec, JSObject* constructor, const Ar
height = args.at(1).toInt32(exec);
}
- Document* document = static_cast<JSImageConstructor*>(constructor)->document();
+ JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(constructor);
+ Document* document = jsConstructor->document();
if (!document)
return throwError(exec, ReferenceError, "Image constructor associated document is unavailable");
// Calling toJS on the document causes the JS document wrapper to be
// added to the window object. This is done to ensure that JSDocument::mark
// will be called (which will cause the image element to be marked if necessary).
- toJS(exec, document);
+ toJS(exec, jsConstructor->globalObject(), document);
RefPtr<HTMLImageElement> image = new HTMLImageElement(HTMLNames::imgTag, document);
if (widthSet)
image->setWidth(width);
if (heightSet)
image->setHeight(height);
- return asObject(toJS(exec, image.release()));
+ return asObject(toJS(exec, jsConstructor->globalObject(), image.release()));
}
ConstructType JSImageConstructor::getConstructData(ConstructData& constructData)
@@ -87,11 +79,4 @@ ConstructType JSImageConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
-void JSImageConstructor::mark()
-{
- DOMObject::mark();
- if (!m_globalObject->marked())
- m_globalObject->mark();
-}
-
} // namespace WebCore