diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:18:18 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:18:18 +0000 |
commit | f99d9b3f94ac14e7ce6c7ab6513d2de11038f019 (patch) | |
tree | 5f697baa4f0679984fb4f4281250e50bcdaadccc /webkit/glue/chrome_client_impl.h | |
parent | 33a744250e71d9368451da50455347cf56903f62 (diff) | |
download | chromium_src-f99d9b3f94ac14e7ce6c7ab6513d2de11038f019.zip chromium_src-f99d9b3f94ac14e7ce6c7ab6513d2de11038f019.tar.gz chromium_src-f99d9b3f94ac14e7ce6c7ab6513d2de11038f019.tar.bz2 |
Defer window.close(), window.resizeTo(), and window.moveTo()
actions by posting a task back to the message loop before
notifying the RenderWidgetHost to perform these operations.
Otherwise, the JS code races with the browser to use the
modified window.
BUG=http://crbug.com/6377
BUG=http://crbug.com/6192
Also, because window resizing is asynchronous between the renderer
and browser, added a renderer-side cache of "pending window rect"
to ChromeClientImpl. Before the change, calling setWindowRect() would
schedule a call to the RenderViewHost to do the work, but a subsequent
call to windowRect() would return the current size, as through the
call to setWindowRect() had never happened. We cache a pending size
and then schedule a task on the message loop to clear the cached size.
This allows javascript which writes and reads the WindowRect sizes to
work, and once we come out of JS and return to the message loop, we'll
go back to asking the RenderViewHost for the true values.
This pending_window_size is my only concern about this patch. It does
pass all layout tests, and the ChromeClientImpl code is executed in the
test_shell.exe code path.
BUG=http://crbug.com/835
TEST=LayoutTests have tests which cover all of these actions. The
problem is that we run layout tests using the test_shell, not Chrome.
Review URL: http://codereview.chromium.org/101019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/chrome_client_impl.h')
-rw-r--r-- | webkit/glue/chrome_client_impl.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h index e372f7c..194dd62 100644 --- a/webkit/glue/chrome_client_impl.h +++ b/webkit/glue/chrome_client_impl.h @@ -6,6 +6,7 @@ #define WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_ #include "base/compiler_specific.h" +#include "base/task.h" MSVC_PUSH_WARNING_LEVEL(0); #include "ChromeClientChromium.h" @@ -135,6 +136,9 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium { virtual WebCore::HTMLParserQuirks* createHTMLParserQuirks() { return 0; } private: + void ClearPendingWindowRect(); + void SetPendingWindowRect(const WebCore::FloatRect& r); + WebViewImpl* webview_; // weak pointer bool toolbars_visible_; bool statusbar_visible_; @@ -143,6 +147,12 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium { bool resizable_; // Set to true if the next SetCursor is to be ignored. bool ignore_next_set_cursor_; + // While we are waiting for the browser to update window sizes, + // we track the pending size temporarily. + bool has_pending_window_rect_; + WebCore::FloatRect pending_window_rect_; + + ScopedRunnableMethodFactory<ChromeClientImpl> task_factory_; }; #endif // WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_ |