Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (109777 => 109778)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-05 19:50:05 UTC (rev 109778)
@@ -1,3 +1,26 @@
+2012-03-05 Charlie Reis <cr...@chromium.org>
+
+ [chromium] Pass WebNavigationPolicy to WebViewClient::createView
+ https://bugs.webkit.org/show_bug.cgi?id=80057
+
+ Reviewed by Darin Fisher.
+
+ * public/WebViewClient.h:
+ (WebViewClient):
+ (WebKit::WebViewClient::createView):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::ChromeClientImpl):
+ (WebKit::ChromeClientImpl::createWindow):
+ (WebKit::ChromeClientImpl::getNavigationPolicy):
+ (WebKit):
+ (WebKit::ChromeClientImpl::show):
+ (WebKit::ChromeClientImpl::setNewWindowNavigationPolicy):
+ * src/ChromeClientImpl.h:
+ (ChromeClientImpl):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::dispatchCreatePage):
+ (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForNewWindowAction):
+
2012-03-05 James Robinson <jam...@chromium.org>
[chromium] Initialize CCOverdrawCounts struct to zero
Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (109777 => 109778)
--- trunk/Source/WebKit/chromium/public/WebViewClient.h 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h 2012-03-05 19:50:05 UTC (rev 109778)
@@ -93,10 +93,13 @@
// WebStorage specification.
// The request parameter is only for the client to check if the request
// could be fulfilled. The client should not load the request.
+ // The policy parameter indicates how the new view will be displayed in
+ // WebWidgetClient::show.
virtual WebView* createView(WebFrame* creator,
const WebURLRequest& request,
const WebWindowFeatures& features,
- const WebString& name) {
+ const WebString& name,
+ WebNavigationPolicy policy) {
return 0;
}
Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (109777 => 109778)
--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp 2012-03-05 19:50:05 UTC (rev 109778)
@@ -136,6 +136,7 @@
, m_scrollbarsVisible(true)
, m_menubarVisible(true)
, m_resizable(true)
+ , m_nextNewWindowNavigationPolicy(WebNavigationPolicyIgnore)
{
}
@@ -238,13 +239,23 @@
if (!m_webView->client())
return 0;
+ // FrameLoaderClientImpl may have given us a policy to use for the next new
+ // window navigation. If not, determine the policy using the same logic as
+ // show().
+ WebNavigationPolicy policy;
+ if (m_nextNewWindowNavigationPolicy != WebNavigationPolicyIgnore) {
+ policy = m_nextNewWindowNavigationPolicy;
+ m_nextNewWindowNavigationPolicy = WebNavigationPolicyIgnore;
+ } else
+ policy = getNavigationPolicy();
+
WrappedResourceRequest request;
if (!r.resourceRequest().isEmpty())
request.bind(r.resourceRequest());
else if (!action.resourceRequest().isEmpty())
request.bind(action.resourceRequest());
WebViewImpl* newView = static_cast<WebViewImpl*>(
- m_webView->client()->createView(WebFrameImpl::fromFrame(frame), request, features, r.frameName()));
+ m_webView->client()->createView(WebFrameImpl::fromFrame(frame), request, features, r.frameName(), policy));
if (!newView)
return 0;
@@ -287,11 +298,8 @@
return policy == WebNavigationPolicyNewBackgroundTab;
}
-void ChromeClientImpl::show()
+WebNavigationPolicy ChromeClientImpl::getNavigationPolicy()
{
- if (!m_webView->client())
- return;
-
// If our default configuration was modified by a script or wasn't
// created by a user gesture, then show as a popup. Else, let this
// new window be opened as a toplevel window.
@@ -306,8 +314,15 @@
policy = WebNavigationPolicyNewPopup;
if (currentEventShouldCauseBackgroundTab(WebViewImpl::currentInputEvent()))
policy = WebNavigationPolicyNewBackgroundTab;
+ return policy;
+}
+
+void ChromeClientImpl::show()
+{
+ if (!m_webView->client())
+ return;
- m_webView->client()->show(policy);
+ m_webView->client()->show(getNavigationPolicy());
}
bool ChromeClientImpl::canRunModal()
@@ -802,6 +817,11 @@
setCursor(cursor);
}
+void ChromeClientImpl::setNewWindowNavigationPolicy(WebNavigationPolicy policy)
+{
+ m_nextNewWindowNavigationPolicy = policy;
+}
+
void ChromeClientImpl::formStateDidChange(const Node* node)
{
// The current history item is not updated yet. That happens lazily when
Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.h (109777 => 109778)
--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.h 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.h 2012-03-05 19:50:05 UTC (rev 109778)
@@ -35,6 +35,7 @@
#include "ChromeClientChromium.h"
#include "PopupMenu.h"
#include "SearchPopupMenu.h"
+#include "WebNavigationPolicy.h"
namespace WebCore {
class AccessibilityObject;
@@ -189,6 +190,7 @@
// ChromeClientImpl:
void setCursorForPlugin(const WebCursorInfo&);
+ void setNewWindowNavigationPolicy(WebNavigationPolicy);
virtual bool selectItemWritingDirectionIsNatural();
virtual bool selectItemAlignmentFollowsMenuWritingDirection();
@@ -209,6 +211,7 @@
#endif
private:
+ WebNavigationPolicy getNavigationPolicy();
void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
void setCursor(const WebCursorInfo&);
@@ -218,6 +221,9 @@
bool m_scrollbarsVisible;
bool m_menubarVisible;
bool m_resizable;
+
+ // The policy for how the next webview to be created will be shown.
+ WebNavigationPolicy m_nextNewWindowNavigationPolicy;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (109777 => 109778)
--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp 2012-03-05 19:50:05 UTC (rev 109778)
@@ -873,21 +873,27 @@
Frame* FrameLoaderClientImpl::dispatchCreatePage(const NavigationAction& action)
{
- struct WindowFeatures features;
- Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow(
- m_webFrame->frame(), FrameLoadRequest(m_webFrame->frame()->document()->securityOrigin()),
- features, action);
-
// Make sure that we have a valid disposition. This should have been set in
// the preceeding call to dispatchDecidePolicyForNewWindowAction.
ASSERT(m_nextNavigationPolicy != WebNavigationPolicyIgnore);
WebNavigationPolicy policy = m_nextNavigationPolicy;
m_nextNavigationPolicy = WebNavigationPolicyIgnore;
+ // Store the disposition on the opener ChromeClientImpl so that we can pass
+ // it to WebViewClient::createView.
+ ChromeClientImpl* chromeClient = static_cast<ChromeClientImpl*>(m_webFrame->frame()->page()->chrome()->client());
+ chromeClient->setNewWindowNavigationPolicy(policy);
+
+ struct WindowFeatures features;
+ Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow(
+ m_webFrame->frame(), FrameLoadRequest(m_webFrame->frame()->document()->securityOrigin()),
+ features, action);
+
// createWindow can return null (e.g., popup blocker denies the window).
if (!newPage)
return 0;
+ // Also give the disposition to the new window.
WebViewImpl::fromPage(newPage)->setInitialNavigationPolicy(policy);
return newPage->mainFrame();
}
@@ -949,6 +955,11 @@
// creating or showing the new window that would allow us to avoid having
// to keep this state.
m_nextNavigationPolicy = navigationPolicy;
+
+ // Store the disposition on the opener ChromeClientImpl so that we can pass
+ // it to WebViewClient::createView.
+ ChromeClientImpl* chromeClient = static_cast<ChromeClientImpl*>(m_webFrame->frame()->page()->chrome()->client());
+ chromeClient->setNewWindowNavigationPolicy(navigationPolicy);
}
(m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction);
}
Modified: trunk/Tools/ChangeLog (109777 => 109778)
--- trunk/Tools/ChangeLog 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Tools/ChangeLog 2012-03-05 19:50:05 UTC (rev 109778)
@@ -1,3 +1,15 @@
+2012-03-05 Charlie Reis <cr...@chromium.org>
+
+ [chromium] Pass WebNavigationPolicy to WebViewClient::createView
+ https://bugs.webkit.org/show_bug.cgi?id=80057
+
+ Reviewed by Darin Fisher.
+
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::createView):
+ * DumpRenderTree/chromium/WebViewHost.h:
+ (WebViewHost):
+
2012-03-05 Martin Robinson <mrobin...@igalia.com>
[soup] Crash while loading http://www.jusco.cn
Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (109777 => 109778)
--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-03-05 19:50:05 UTC (rev 109778)
@@ -242,7 +242,7 @@
// WebViewClient -------------------------------------------------------------
-WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&)
+WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
{
if (!layoutTestController()->canOpenWindows())
return 0;
Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (109777 => 109778)
--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h 2012-03-05 19:47:25 UTC (rev 109777)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h 2012-03-05 19:50:05 UTC (rev 109778)
@@ -126,7 +126,7 @@
virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&);
// WebKit::WebViewClient
- virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&);
+ virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&, WebKit::WebNavigationPolicy);
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType);
virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&);
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota);