2006-10-15 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Oliver.
Implement some functions in FrameQt / ScrollViewQt.
Added comments what needs to be done in quite some places,
marked some functions as no-ops.
* CMakeLists.txt:
* platform/qt/FrameQt.cpp:
(WebCore::FrameQt::FrameQt):
(WebCore::FrameQt::runJavaScriptConfirm):
(WebCore::FrameQt::locationbarVisible):
(WebCore::FrameQt::createFrame):
(WebCore::FrameQt::passSubframeEventToSubframe):
(WebCore::FrameQt::menubarVisible):
(WebCore::FrameQt::personalbarVisible):
(WebCore::FrameQt::statusbarVisible):
(WebCore::FrameQt::toolbarVisible):
(WebCore::FrameQt::markedTextRange):
(WebCore::FrameQt::lastEventIsMouseUp):
(WebCore::FrameQt::openURLRequest):
(WebCore::FrameQt::scheduleClose):
(WebCore::FrameQt::unfocusWindow):
(WebCore::FrameQt::focusWindow):
(WebCore::FrameQt::overrideMediaType):
(WebCore::FrameQt::runJavaScriptPrompt):
(WebCore::FrameQt::bindingRootObject):
(WebCore::FrameQt::addPluginRootObject):
(WebCore::FrameQt::registerCommandForUndo):
(WebCore::FrameQt::registerCommandForRedo):
(WebCore::FrameQt::clearUndoRedoOperations):
(WebCore::FrameQt::respondToChangedSelection):
(WebCore::FrameQt::respondToChangedContents):
(WebCore::FrameQt::shouldChangeSelection):
(WebCore::FrameQt::canGoBackOrForward):
(WebCore::FrameQt::canPaste):
(WebCore::FrameQt::canRedo):
(WebCore::FrameQt::canUndo):
* platform/qt/FrameQt.h:
* platform/qt/FrameQtClient.cpp:
(WebCore::FrameQtClientDefault::runJavaScriptAlert):
(WebCore::FrameQtClientDefault::runJavaScriptConfirm):
(WebCore::FrameQtClientDefault::runJavaScriptPrompt):
(WebCore::FrameQtClientDefault::menubarVisible):
(WebCore::FrameQtClientDefault::toolbarVisible):
(WebCore::FrameQtClientDefault::statusbarVisible):
(WebCore::FrameQtClientDefault::personalbarVisible):
(WebCore::FrameQtClientDefault::locationbarVisible):
* platform/qt/FrameQtClient.h:
* platform/qt/ImageSourceQt.cpp:
* platform/qt/RenderThemeQt.cpp:
* platform/qt/ScrollViewQt.cpp:
(WebCore::ScrollView::scrollPointRecursively):
* platform/qt/TemporaryLinkStubs.cpp:
(WebCore::CachedResource::setResponse):
(WebCore::CachedResource::setAllData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@17061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 95a35b2..9189148 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -44,6 +44,7 @@
${CMAKE_CURRENT_SOURCE_DIR}/platform/qt
${CMAKE_CURRENT_SOURCE_DIR}/WebCore+SVG
${CMAKE_CURRENT_SOURCE_DIR}/../JavaScriptCore/kjs
+ ${CMAKE_CURRENT_SOURCE_DIR}/../JavaScriptCore/bindings
${CMAKE_CURRENT_SOURCE_DIR}/../JavaScriptCore/
${CMAKE_CURRENT_SOURCE_DIR}/../
)
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 39327f6..b65e918 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,62 @@
+2006-10-15 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Oliver.
+
+ Implement some functions in FrameQt / ScrollViewQt.
+
+ Added comments what needs to be done in quite some places,
+ marked some functions as no-ops.
+
+ * CMakeLists.txt:
+ * platform/qt/FrameQt.cpp:
+ (WebCore::FrameQt::FrameQt):
+ (WebCore::FrameQt::runJavaScriptConfirm):
+ (WebCore::FrameQt::locationbarVisible):
+ (WebCore::FrameQt::createFrame):
+ (WebCore::FrameQt::passSubframeEventToSubframe):
+ (WebCore::FrameQt::menubarVisible):
+ (WebCore::FrameQt::personalbarVisible):
+ (WebCore::FrameQt::statusbarVisible):
+ (WebCore::FrameQt::toolbarVisible):
+ (WebCore::FrameQt::markedTextRange):
+ (WebCore::FrameQt::lastEventIsMouseUp):
+ (WebCore::FrameQt::openURLRequest):
+ (WebCore::FrameQt::scheduleClose):
+ (WebCore::FrameQt::unfocusWindow):
+ (WebCore::FrameQt::focusWindow):
+ (WebCore::FrameQt::overrideMediaType):
+ (WebCore::FrameQt::runJavaScriptPrompt):
+ (WebCore::FrameQt::bindingRootObject):
+ (WebCore::FrameQt::addPluginRootObject):
+ (WebCore::FrameQt::registerCommandForUndo):
+ (WebCore::FrameQt::registerCommandForRedo):
+ (WebCore::FrameQt::clearUndoRedoOperations):
+ (WebCore::FrameQt::respondToChangedSelection):
+ (WebCore::FrameQt::respondToChangedContents):
+ (WebCore::FrameQt::shouldChangeSelection):
+ (WebCore::FrameQt::canGoBackOrForward):
+ (WebCore::FrameQt::canPaste):
+ (WebCore::FrameQt::canRedo):
+ (WebCore::FrameQt::canUndo):
+ * platform/qt/FrameQt.h:
+ * platform/qt/FrameQtClient.cpp:
+ (WebCore::FrameQtClientDefault::runJavaScriptAlert):
+ (WebCore::FrameQtClientDefault::runJavaScriptConfirm):
+ (WebCore::FrameQtClientDefault::runJavaScriptPrompt):
+ (WebCore::FrameQtClientDefault::menubarVisible):
+ (WebCore::FrameQtClientDefault::toolbarVisible):
+ (WebCore::FrameQtClientDefault::statusbarVisible):
+ (WebCore::FrameQtClientDefault::personalbarVisible):
+ (WebCore::FrameQtClientDefault::locationbarVisible):
+ * platform/qt/FrameQtClient.h:
+ * platform/qt/ImageSourceQt.cpp:
+ * platform/qt/RenderThemeQt.cpp:
+ * platform/qt/ScrollViewQt.cpp:
+ (WebCore::ScrollView::scrollPointRecursively):
+ * platform/qt/TemporaryLinkStubs.cpp:
+ (WebCore::CachedResource::setResponse):
+ (WebCore::CachedResource::setAllData):
+
2006-10-14 David Harrison <harrison@apple.com>
Reviewed by Geoff.
diff --git a/WebCore/platform/qt/FrameQt.cpp b/WebCore/platform/qt/FrameQt.cpp
index 9c4cc83..75e5e62 100644
--- a/WebCore/platform/qt/FrameQt.cpp
+++ b/WebCore/platform/qt/FrameQt.cpp
@@ -57,6 +57,9 @@
#include "MouseEventWithHitTestResults.h"
#include "SelectionController.h"
#include "TypingCommand.h"
+#include "JSLock.h"
+#include "kjs_window.h"
+#include "runtime_root.h"
#include <QScrollArea>
@@ -89,6 +92,7 @@
FrameQt::FrameQt(Page* page, Element* ownerElement, FrameQtClient* client)
: Frame(page, ownerElement)
+ , m_bindingRoot(0)
{
d->m_extension = new BrowserExtensionQt(this);
Settings* settings = new Settings;
@@ -166,14 +170,12 @@
bool FrameQt::runJavaScriptConfirm(String const& message)
{
- notImplemented();
- return true;
+ return m_client->runJavaScriptConfirm(message);
}
bool FrameQt::locationbarVisible()
{
- notImplemented();
- return true;
+ return m_client->locationbarVisible();
}
void FrameQt::setTitle(const String& title)
@@ -182,7 +184,7 @@
view()->parentWidget()->setWindowTitle(title);
}
-Frame* FrameQt::createFrame(const KURL&, const String& name, Element*, const String& referrer)
+Frame* FrameQt::createFrame(const KURL& url, const String& name, Element* ownerElement, const String& referrer)
{
notImplemented();
return 0;
@@ -196,9 +198,7 @@
bool FrameQt::passSubframeEventToSubframe(MouseEventWithHitTestResults& mev, Frame*)
{
- if (mev.targetNode() == 0)
- return true;
-
+ notImplemented();
return false;
}
@@ -228,26 +228,22 @@
bool FrameQt::menubarVisible()
{
- notImplemented();
- return true;
+ return m_client->menubarVisible();
}
bool FrameQt::personalbarVisible()
{
- notImplemented();
- return true;
+ return m_client->personalbarVisible();
}
bool FrameQt::statusbarVisible()
{
- notImplemented();
- return true;
+ return m_client->statusbarVisible();
}
bool FrameQt::toolbarVisible()
{
- notImplemented();
- return true;
+ return m_client->toolbarVisible();
}
void FrameQt::createEmptyDocument()
@@ -261,7 +257,7 @@
Range* FrameQt::markedTextRange() const
{
- // notImplemented();
+ // FIXME: Handle selections.
return 0;
}
@@ -289,7 +285,7 @@
bool FrameQt::lastEventIsMouseUp() const
{
- notImplemented();
+ // no-op
return false;
}
@@ -303,28 +299,37 @@
// FIXME: Implement this as soon a KPart is created...
}
-void FrameQt::openURLRequest(const FrameLoadRequest&)
+void FrameQt::openURLRequest(const FrameLoadRequest& request)
{
- notImplemented();
+ urlSelected(request);
}
void FrameQt::scheduleClose()
{
- notImplemented();
+ // no-op
}
void FrameQt::unfocusWindow()
{
- notImplemented();
+ if (!view())
+ return;
+
+ if (!tree()->parent())
+ view()->qwidget()->clearFocus();
}
void FrameQt::focusWindow()
{
- notImplemented();
+ if (!view())
+ return;
+
+ if (!tree()->parent())
+ view()->qwidget()->setFocus();
}
String FrameQt::overrideMediaType() const
{
+ // no-op
return String();
}
@@ -336,8 +341,7 @@
bool FrameQt::runJavaScriptPrompt(const String& message, const String& defaultValue, String& result)
{
- notImplemented();
- return false;
+ return m_client->runJavaScriptPrompt(message, defaultValue, result);
}
KJS::Bindings::Instance* FrameQt::getEmbedInstanceForWidget(Widget*)
@@ -360,8 +364,24 @@
KJS::Bindings::RootObject* FrameQt::bindingRootObject()
{
- notImplemented();
- return 0;
+ ASSERT(jScriptEnabled());
+
+ if (!m_bindingRoot) {
+ KJS::JSLock lock;
+ m_bindingRoot = new KJS::Bindings::RootObject(0); // The root gets deleted by JavaScriptCore.
+
+ KJS::JSObject* win = KJS::Window::retrieveWindow(this);
+ m_bindingRoot->setRootObjectImp(win);
+ m_bindingRoot->setInterpreter(jScript()->interpreter());
+ addPluginRootObject(m_bindingRoot);
+ }
+
+ return m_bindingRoot;
+}
+
+void FrameQt::addPluginRootObject(KJS::Bindings::RootObject* root)
+{
+ m_rootObjects.append(root);
}
Widget* FrameQt::createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>&)
@@ -372,17 +392,17 @@
void FrameQt::registerCommandForUndo(PassRefPtr<EditCommand>)
{
- notImplemented();
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
}
void FrameQt::registerCommandForRedo(PassRefPtr<EditCommand>)
{
- notImplemented();
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
}
void FrameQt::clearUndoRedoOperations()
{
- // FIXME: Implement this as soon a KPart is created...
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
}
void FrameQt::issueUndoCommand()
@@ -422,17 +442,17 @@
void FrameQt::respondToChangedSelection(const Selection& oldSelection, bool closeTyping)
{
- notImplemented();
+ // TODO: If we want continous spell checking, we need to implement this.
}
void FrameQt::respondToChangedContents(const Selection& endingSelection)
{
- notImplemented();
+ // TODO: If we want accessibility, we need to implement this.
}
bool FrameQt::shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity affinity, bool stillSelecting) const
{
- notImplemented();
+ // no-op
return true;
}
@@ -445,6 +465,7 @@
bool FrameQt::canGoBackOrForward(int distance) const
{
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
notImplemented();
return false;
}
@@ -462,18 +483,21 @@
bool FrameQt::canPaste() const
{
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
notImplemented();
return false;
}
bool FrameQt::canRedo() const
{
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
notImplemented();
return false;
}
bool FrameQt::canUndo() const
{
+ // FIXME: Implement this in the FrameQtClient, to be used within WebKitPart.
notImplemented();
return false;
}
diff --git a/WebCore/platform/qt/FrameQt.h b/WebCore/platform/qt/FrameQt.h
index 744fb6a..f22c59e 100644
--- a/WebCore/platform/qt/FrameQt.h
+++ b/WebCore/platform/qt/FrameQt.h
@@ -99,6 +99,8 @@
virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
virtual KJS::Bindings::RootObject* bindingRootObject();
+ void addPluginRootObject(KJS::Bindings::RootObject*);
+
virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>& args);
virtual void registerCommandForUndo(PassRefPtr<EditCommand>);
@@ -140,10 +142,15 @@
FrameQtClient* m_client;
bool m_beginCalled : 1;
+
+ KJS::Bindings::RootObject* m_bindingRoot; // The root object used for objects
+ // bound outside the context of a plugin.
+
+ Vector<KJS::Bindings::RootObject*> m_rootObjects;
+
};
}
-#endif
-
+#endif
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/FrameQtClient.cpp b/WebCore/platform/qt/FrameQtClient.cpp
index e4941b5..ba84544 100644
--- a/WebCore/platform/qt/FrameQtClient.cpp
+++ b/WebCore/platform/qt/FrameQtClient.cpp
@@ -32,7 +32,9 @@
#include "ResourceLoader.h"
#include "ResourceLoaderInternal.h"
-#include <QMessageBox>
+#include <kstdguiitem.h>
+#include <kmessagebox.h>
+#include <kinputdialog.h>
namespace WebCore {
@@ -73,7 +75,47 @@
void FrameQtClientDefault::runJavaScriptAlert(String const& message)
{
- QMessageBox::information(m_frame->view()->qwidget(), "JavaScript", message);
+ KMessageBox::error(m_frame->view()->qwidget(), message, "JavaScript");
+}
+
+bool FrameQtClientDefault::runJavaScriptConfirm(const String& message)
+{
+ return KMessageBox::warningYesNo(m_frame->view()->qwidget(), message,
+ "JavaScript", KStdGuiItem::ok(), KStdGuiItem::cancel())
+ == KMessageBox::Yes;
+}
+
+bool FrameQtClientDefault::runJavaScriptPrompt(const String& message, const String& defaultValue, String& result)
+{
+ bool ok;
+ result = KInputDialog::getText("JavaScript", message, defaultValue, &ok, m_frame->view()->qwidget());
+
+ return ok;
+}
+
+bool FrameQtClientDefault::menubarVisible() const
+{
+ return false;
+}
+
+bool FrameQtClientDefault::toolbarVisible() const
+{
+ return false;
+}
+
+bool FrameQtClientDefault::statusbarVisible() const
+{
+ return false;
+}
+
+bool FrameQtClientDefault::personalbarVisible() const
+{
+ return false;
+}
+
+bool FrameQtClientDefault::locationbarVisible() const
+{
+ return false;
}
void FrameQtClientDefault::receivedResponse(ResourceLoader*, PlatformResponse)
diff --git a/WebCore/platform/qt/FrameQtClient.h b/WebCore/platform/qt/FrameQtClient.h
index e5bc378..2247348 100644
--- a/WebCore/platform/qt/FrameQtClient.h
+++ b/WebCore/platform/qt/FrameQtClient.h
@@ -46,7 +46,15 @@
virtual void submitForm(const String& method, const KURL&, const FormData*) = 0;
// WebKitPart / DumpRenderTree want to handle this differently.
+ virtual bool menubarVisible() const = 0;
+ virtual bool toolbarVisible() const = 0;
+ virtual bool statusbarVisible() const = 0;
+ virtual bool personalbarVisible() const = 0;
+ virtual bool locationbarVisible() const = 0;
+
virtual void runJavaScriptAlert(String const& message) = 0;
+ virtual bool runJavaScriptConfirm(const String& message) = 0;
+ virtual bool runJavaScriptPrompt(const String& message, const String& defaultValue, String& result) = 0;
};
class FrameQtClientDefault : public FrameQtClient,
@@ -63,6 +71,14 @@
virtual void submitForm(const String& method, const KURL&, const FormData*);
virtual void runJavaScriptAlert(String const& message);
+ virtual bool runJavaScriptConfirm(const String& message);
+ virtual bool runJavaScriptPrompt(const String& message, const String& defaultValue, String& result);
+
+ virtual bool menubarVisible() const;
+ virtual bool toolbarVisible() const;
+ virtual bool statusbarVisible() const;
+ virtual bool personalbarVisible() const;
+ virtual bool locationbarVisible() const;
// ResourceLoaderClient
virtual void receivedResponse(ResourceLoader*, PlatformResponse);
diff --git a/WebCore/platform/qt/ImageSourceQt.cpp b/WebCore/platform/qt/ImageSourceQt.cpp
index 527acd6..490c2a8 100644
--- a/WebCore/platform/qt/ImageSourceQt.cpp
+++ b/WebCore/platform/qt/ImageSourceQt.cpp
@@ -38,7 +38,6 @@
#include "XBMImageDecoder.h"
#include <QImage>
-#include <QDebug>
namespace WebCore {
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 72c5cbf..a2b73aa 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -34,8 +34,6 @@
#include "RenderTheme.h"
#include "GraphicsContext.h"
-#define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED: %s:%d\n", __FILE__, __LINE__); } while(0)
-
namespace WebCore {
class RenderThemeQt : public RenderTheme
diff --git a/WebCore/platform/qt/ScrollViewQt.cpp b/WebCore/platform/qt/ScrollViewQt.cpp
index 7ef67dd..a35e839 100644
--- a/WebCore/platform/qt/ScrollViewQt.cpp
+++ b/WebCore/platform/qt/ScrollViewQt.cpp
@@ -244,8 +244,11 @@
}
void ScrollView::scrollPointRecursively(int x, int y)
-{
- notImplemented();
+{
+ x = (x < 0) ? 0 : x;
+ y = (y < 0) ? 0 : y;
+
+ m_area->ensureVisible(x, y);
}
bool ScrollView::inWindow() const
diff --git a/WebCore/platform/qt/TemporaryLinkStubs.cpp b/WebCore/platform/qt/TemporaryLinkStubs.cpp
index f924183..81ec04d 100644
--- a/WebCore/platform/qt/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/qt/TemporaryLinkStubs.cpp
@@ -154,8 +154,8 @@
DeprecatedString ResponseMIMEType(PlatformResponse) { return DeprecatedString(); }
bool IsResponseURLEqualToURL(PlatformResponse , const String& URL) { return false; }
DeprecatedString ResponseURL(PlatformResponse) { return DeprecatedString(); }
-void CachedResource::setResponse(PlatformResponse) { notImplemented(); }
-void CachedResource::setAllData(PlatformData) { notImplemented(); }
+void CachedResource::setResponse(PlatformResponse) { }
+void CachedResource::setAllData(PlatformData) { }
}
bool WebCore::historyContains(DeprecatedString const&) { return false; }