summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 02:19:56 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 02:19:56 +0000
commit279c4199ba7327239de927765e74c64a1b8779af (patch)
treec5699e4c6fadccb8555539132473feaf7ba21cfc
parentfc76de1cddd3c1b47fb2e9280c87dafce3010f41 (diff)
downloadchromium_src-279c4199ba7327239de927765e74c64a1b8779af.zip
chromium_src-279c4199ba7327239de927765e74c64a1b8779af.tar.gz
chromium_src-279c4199ba7327239de927765e74c64a1b8779af.tar.bz2
Get popup windows working.
There are still a little funky about redrawing once when they loose focus sadly. Review URL: http://codereview.chromium.org/10720 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5438 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/SConscript.port1
-rw-r--r--webkit/port/platform/chromium/ScreenLinux.cpp70
-rw-r--r--webkit/tools/test_shell/test_shell.h16
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc19
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_gtk.cc35
5 files changed, 52 insertions, 89 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port
index 8260d3d..681461c 100644
--- a/webkit/SConscript.port
+++ b/webkit/SConscript.port
@@ -128,7 +128,6 @@ if env['PLATFORM'] == 'posix':
# Linux specific implementations
input_files.extend([
'$PORT_DIR/platform/chromium/IconLinux.cpp',
- '$PORT_DIR/platform/chromium/ScreenLinux.cpp',
'$PORT_DIR/platform/chromium/ScrollbarThemeChromiumLinux.cpp',
'$PORT_DIR/platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp',
'$PORT_DIR/platform/graphics/skia/GdkSkia.cc',
diff --git a/webkit/port/platform/chromium/ScreenLinux.cpp b/webkit/port/platform/chromium/ScreenLinux.cpp
deleted file mode 100644
index 6da267b..0000000
--- a/webkit/port/platform/chromium/ScreenLinux.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Screen.h"
-
-#include "IntRect.h"
-#include "FloatRect.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "NotImplemented.h"
-#include "Page.h"
-
-#include "webkit/glue/webkit_glue.h"
-
-namespace WebCore {
-
-int screenDepth(Widget* widget)
-{
- notImplemented();
- return -1;
-}
-
-int screenDepthPerComponent(Widget* widget)
-{
- notImplemented();
- return -1;
-}
-
-bool screenIsMonochrome(Widget* widget)
-{
- notImplemented();
- return true;
-}
-
-FloatRect screenRect(Widget* widget)
-{
- notImplemented();
- return FloatRect();
-}
-
-FloatRect screenAvailableRect(Widget* widget)
-{
- notImplemented();
- return FloatRect();
-}
-
-} // namespace WebCore
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index 33d9d1f..dac7f6e 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_
@@ -70,12 +70,12 @@ public:
virtual ~TestShell();
// Initialization and clean up of logging.
- static void InitLogging(bool suppress_error_dialogs,
+ static void InitLogging(bool suppress_error_dialogs,
bool running_layout_tests);
static void CleanupLogging();
- // Initialization and clean up of a static member variable.
- static void InitializeTestShell(bool interactive);
+ // Initialization and clean up of a static member variable.
+ static void InitializeTestShell(bool interactive);
static void ShutdownTestShell();
static bool interactive() { return interactive_; }
@@ -164,7 +164,7 @@ public:
// If shell is non-null, then *shell is assigned upon successful return
static bool CreateNewWindow(const std::wstring& startingURL,
TestShell** shell = NULL);
-
+
static void DestroyWindow(gfx::WindowHandle windowHandle);
// Remove the given window from window_list_, return true if it was in the
@@ -181,13 +181,13 @@ public:
static ATOM RegisterWindowClass();
#endif
- // Called by the WebView delegate WindowObjectCleared() method, this
+ // Called by the WebView delegate WindowObjectCleared() method, this
// binds the layout_test_controller_ and other C++ controller classes to
// window JavaScript objects so they can be accessed by layout tests.
virtual void BindJSObjectsToWindow(WebFrame* frame);
// Runs a layout test. Loads a single file into the first available
- // window, then dumps the requested text representation to stdout.
+ // window, then dumps the requested text representation to stdout.
// Returns false if the test cannot be run because no windows are open.
static bool RunFileTest(const char* filename, const TestParams& params);
@@ -287,7 +287,7 @@ private:
scoped_ptr<LayoutTestController> layout_test_controller_;
scoped_ptr<EventSendingController> event_sending_controller_;
-
+
scoped_ptr<TextInputController> text_input_controller_;
scoped_ptr<TestNavigationController> navigation_controller_;
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index b637f98..fbbc7ff 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -191,8 +191,23 @@ void TestShell::DestroyWindow(gfx::WindowHandle windowHandle) {
}
WebWidget* TestShell::CreatePopupWidget(WebView* webview) {
- NOTIMPLEMENTED();
- return NULL;
+ GtkWidget* popupwindow = gtk_window_new(GTK_WINDOW_POPUP);
+ GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
+ WebWidgetHost* host = WebWidgetHost::Create(vbox, delegate_);
+ gtk_container_add(GTK_CONTAINER(popupwindow), vbox);
+ m_popupHost = host;
+
+ return host->webwidget();
+}
+
+void TestShell::ClosePopup() {
+ DCHECK(m_popupHost);
+ GtkWidget* drawing_area = m_popupHost->window_handle();
+ GtkWidget* window =
+ gtk_widget_get_parent(gtk_widget_get_parent(drawing_area));
+ gtk_widget_destroy(window);
+ m_popupHost->WindowDestroyed();
+ m_popupHost = NULL;
}
void TestShell::ResizeSubViews() {
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index e96bcee1..5e1b80e 100644
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -50,13 +50,23 @@ void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) {
gtk_widget_destroy(dialog);
}
-void TestWebViewDelegate::Show(WebWidget* webview,
+void TestWebViewDelegate::Show(WebWidget* webwidget,
WindowOpenDisposition disposition) {
- NOTIMPLEMENTED();
+ WebWidgetHost* host = GetHostForWidget(webwidget);
+ GtkWidget* drawing_area = host->window_handle();
+ GtkWidget* window =
+ gtk_widget_get_parent(gtk_widget_get_parent(drawing_area));
+ gtk_widget_show_all(window);
}
void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
- NOTIMPLEMENTED();
+ if (webwidget == shell_->popup()) {
+ shell_->ClosePopup();
+ } else {
+ // In the Windows code, this closes the main window. However, it's not
+ // clear when this would ever be needed by WebKit.
+ NOTIMPLEMENTED();
+ }
}
void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
@@ -79,18 +89,27 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
DCHECK(out_rect);
- //if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
- NOTIMPLEMENTED();
- //}
+ WebWidgetHost* host = GetHostForWidget(webwidget);
+ GtkWidget* drawing_area = host->window_handle();
+ GtkWidget* window =
+ gtk_widget_get_parent(gtk_widget_get_parent(drawing_area));
+ gint x, y, w, h;
+ gtk_window_get_position(GTK_WINDOW(window), &x, &y);
+ gtk_window_get_size(GTK_WINDOW(window), &w, &h);
+ out_rect->SetRect(x, y, w, h);
}
void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget,
const gfx::Rect& rect) {
- // TODO(port): window movement
if (webwidget == shell_->webView()) {
// ignored
} else if (webwidget == shell_->popup()) {
- NOTIMPLEMENTED();
+ WebWidgetHost* host = GetHostForWidget(webwidget);
+ GtkWidget* drawing_area = host->window_handle();
+ GtkWidget* window =
+ gtk_widget_get_parent(gtk_widget_get_parent(drawing_area));
+ gtk_window_resize(GTK_WINDOW(window), rect.width(), rect.height());
+ gtk_window_move(GTK_WINDOW(window), rect.x(), -rect.y());
}
}