Commit 0ce9774c authored by darin@chromium.org's avatar darin@chromium.org

2010-01-26 Darin Fisher <darin@chromium.org>

        Reviewed by David Levin.

        Add methods to support running a nested modal loop outside of WebKit.
        https://bugs.webkit.org/show_bug.cgi?id=34199

        * public/WebView.h:
        * src/WebViewImpl.cpp:
        (WebKit::WebView::willEnterModalLoop): Create PageGroupLoadDeferrer
        (WebKit::WebView::didExitModalLoop): Destroy PageGroupLoadDeferrer



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a54ce78b
2010-01-26 Darin Fisher <darin@chromium.org>
Reviewed by David Levin.
Add methods to support running a nested modal loop outside of WebKit.
https://bugs.webkit.org/show_bug.cgi?id=34199
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebView::willEnterModalLoop): Create PageGroupLoadDeferrer
(WebKit::WebView::didExitModalLoop): Destroy PageGroupLoadDeferrer
2010-01-27 Darin Fisher <darin@chromium.org>
Reviewed by Dimitri Glazkov.
......
......@@ -252,6 +252,7 @@ public:
// Custom colors -------------------------------------------------------
virtual void setScrollbarColors(unsigned inactiveColor,
unsigned activeColor,
unsigned trackColor) = 0;
......@@ -261,6 +262,14 @@ public:
unsigned inactiveBackgroundColor,
unsigned inactiveForegroundColor) = 0;
// Modal dialog support ------------------------------------------------
// Call these methods before and after running a nested, modal event loop
// to suspend script callbacks and resource loads.
WEBKIT_API static void willEnterModalLoop();
WEBKIT_API static void didExitModalLoop();
protected:
~WebView() {}
};
......
......@@ -66,6 +66,7 @@
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PageGroup.h"
#include "PageGroupLoadDeferrer.h"
#include "Pasteboard.h"
#include "PlatformContextSkia.h"
#include "PlatformKeyboardEvent.h"
......@@ -130,6 +131,10 @@ static const double maxTextSizeMultiplier = 3.0;
// one page group.
const char* pageGroupName = "default";
// Used to defer all page activity in cases where the embedder wishes to run
// a nested event loop.
static PageGroupLoadDeferrer* pageGroupLoadDeferrer;
// Ensure that the WebDragOperation enum values stay in sync with the original
// DragOperation constants.
#define COMPILE_ASSERT_MATCHING_ENUM(coreName) \
......@@ -175,6 +180,28 @@ void WebView::resetVisitedLinkState()
Page::allVisitedStateChanged(PageGroup::pageGroup(pageGroupName));
}
void WebView::willEnterModalLoop()
{
// It is not valid to nest more than once.
ASSERT(!pageGroupLoadDeferrer);
PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName);
ASSERT(pageGroup);
ASSERT(!pageGroup->pages().isEmpty());
// Pick any page in the page group since we are deferring all pages.
pageGroupLoadDeferrer = new PageGroupLoadDeferrer(*pageGroup->pages().begin(), true);
}
void WebView::didExitModalLoop()
{
// The embedder must have called willEnterNestedEventLoop.
ASSERT(pageGroupLoadDeferrer);
delete pageGroupLoadDeferrer;
pageGroupLoadDeferrer = 0;
}
void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient)
{
// NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment