[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hausmann at webkit.org
hausmann at webkit.org
Wed Dec 22 13:21:18 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e00be8a3223b506b3ab19bf8ea4193a235f6b788
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Sep 12 18:21:59 2010 +0000
[Qt] Partial implementation of Qt bridge using V8 and QtScript.
Reviewed by Andreas Kling.
* Api/qwebelement.cpp:
(QWebElement::evaluateJavaScript): Stub it out for now,
to compile, until we have a conversion path between v8::Object
and QScriptValue.
* Api/qwebframe.cpp:
(QWebFrame::addToJavaScriptWindowObject): Implemented using
few lines of QtScript code.
(QWebFrame::evaluateJavaScript): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp
index 4a8beea..261631c 100644
--- a/WebKit/qt/Api/qwebelement.cpp
+++ b/WebKit/qt/Api/qwebelement.cpp
@@ -41,7 +41,7 @@
#elif USE(V8)
#include "V8DOMWindow.h"
#include "V8Binding.h"
-#include "qt_instancev8.h"
+#include "NotImplemented.h"
#endif
#include "NodeList.h"
#include "RenderImage.h"
@@ -786,24 +786,8 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource)
int distance = 0;
return JSC::Bindings::convertValueToQVariant(state, result, QMetaType::Void, &distance);
#elif USE(V8)
- // Create scope handler
- v8::HandleScope hs;
- // Get proxy from scriptcontroller
- V8Proxy* proxy = scriptController->proxy();
- // Ask the context from proxy
- v8::Handle<v8::Context> context = proxy->context();
- if (context.IsEmpty())
- return QVariant();
-
- // Create scope for the context
- v8::Context::Scope scope(context);
- v8::Local<v8::Value> object = proxy->evaluate(ScriptSourceCode(scriptSource), static_cast<Node*>(m_element));
-
- if (object.IsEmpty())
- return QVariant();
- String result = v8ValueToWebCoreString(object);
- int distance = 0;
- return V8::Bindings::convertValueToQVariant(object, QMetaType::Void, &distance);
+ notImplemented();
+ return QVariant();
#endif
}
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index bc8afdf..4ec6852 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -82,9 +82,6 @@
#if USE(JSC)
#include "qt_instance.h"
#include "qt_runtime.h"
-#elif USE(V8)
-#include "qt_instancev8.h"
-#include "qt_runtimev8.h"
#endif
#include "qwebelement.h"
#include "qwebframe_p.h"
@@ -520,22 +517,11 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object
JSC::PutPropertySlot slot;
window->put(exec, JSC::Identifier(exec, reinterpret_cast_ptr<const UChar*>(name.constData()), name.length()), runtimeObject, slot);
#elif USE(V8)
- // Publish QObject in v8 isolated context
- v8::HandleScope handlescope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(d->frame);
- if (v8Context.IsEmpty())
+ QScriptEngine* engine = d->frame->script()->qtScriptEngine();
+ if (!engine)
return;
- v8::Context::Scope conxtextscope(v8Context);
- v8::Handle<v8::Value> windowValue = v8Context->Global()->Get(v8::String::New("window"));
- v8::Handle<v8::Object> dest =
- (windowValue.IsEmpty() || !windowValue->IsObject()) ? v8Context->Global() : windowValue->ToObject();
- dest->Set(v8::String::New(
- name.toLatin1().constData()),
- V8::Bindings::QtInstance::getQtInstance(
- object,
- v8Context,
- name, // have to pass name for v8::FunctionTemplate
- ownership)->getV8Object());
+ QScriptValue v = engine->newQObject(object, ownership);
+ engine->globalObject().property("window").setProperty(name, v);
#endif
}
@@ -1433,21 +1419,16 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)
ScriptController *proxy = d->frame->script();
QVariant rc;
if (proxy) {
- int distance = 0;
#if USE(JSC)
+ int distance = 0;
JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance);
#elif USE(V8)
- v8::HandleScope handlescope;
- // Get context from the frame
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(d->frame);
- if (v8Context.IsEmpty())
+ QScriptEngine* engine = d->frame->script()->qtScriptEngine();
+ if (!engine)
return rc;
- // Get root object for the context
- v8::Context::Scope conxtextscope(v8Context);
- v8::Handle<v8::Value> v = v8::Script::Compile(v8::String::New(scriptSource.toLatin1().constData()))->Run();
- rc = V8::Bindings::convertValueToQVariant(v, QMetaType::Void, &distance);
+ rc = engine->evaluate(scriptSource).toVariant();
#endif
}
return rc;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 315df18..9914d6c 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -2,6 +2,21 @@
Reviewed by Andreas Kling.
+ [Qt] Partial implementation of Qt bridge using V8 and QtScript.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::evaluateJavaScript): Stub it out for now,
+ to compile, until we have a conversion path between v8::Object
+ and QScriptValue.
+ * Api/qwebframe.cpp:
+ (QWebFrame::addToJavaScriptWindowObject): Implemented using
+ few lines of QtScript code.
+ (QWebFrame::evaluateJavaScript): Ditto.
+
+2010-09-12 Simon Hausmann <simon.hausmann at nokia.com>
+
+ Reviewed by Andreas Kling.
+
Fix the build with V8.
This is a temporary kludge until the scriptworld stuff is properly
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list