summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorcmp@google.com <cmp@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:02:46 +0000
committercmp@google.com <cmp@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:02:46 +0000
commit37de84b2a77ff359418fea563d0a48c8d38b0214 (patch)
tree10ba5f4df6bf6b2ccc3c413552f4bd0ea2c83484 /webkit/glue
parent54c3eb08205bc1331913ae63154a374ef0cdb751 (diff)
downloadchromium_src-37de84b2a77ff359418fea563d0a48c8d38b0214.zip
chromium_src-37de84b2a77ff359418fea563d0a48c8d38b0214.tar.gz
chromium_src-37de84b2a77ff359418fea563d0a48c8d38b0214.tar.bz2
Middle clicks on all fragment links open in new tab.
Middle clicking on an anchor tag that points to an in-doc fragment should result in a new background tab being opened. Before this change, we were overriding this behavior to cause a middle click to behave like a left click. This patch allows middle clicks to function similar to the behavior seen in Firefox and Safari. No change in behavior should be seen by users for left clicks on anchor tags that refer to in-doc fragments. While testing, I see at times issues due to scrolling within the tab to the correct fragment identifier or start of the page. This has already been identified in issues such as 9319, so I'm ignoring that for now. BUG=2913 TEST=Load Wikipedia, visit a page with many subheadings, left click on a subheading, verify the current page scrolls to the correct heading. Click back, verify you are taken back to your original position. Middle click on the same subheading, verify a new tab is loaded in the background that is scrolled to the correct heading. Review URL: http://codereview.chromium.org/155522 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc37
1 files changed, 15 insertions, 22 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index f646fc5..c5d4901 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -925,10 +925,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
WindowOpenDisposition disposition = CURRENT_TAB;
ActionSpecifiesDisposition(action, &disposition);
- // Give the delegate a chance to change the disposition. When we do not
- // have a provisional data source here, it means that we are scrolling to
- // an anchor in the page. We don't need to ask the WebViewDelegate about
- // such navigations.
+ // Give the delegate a chance to change the disposition.
const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (ds) {
GURL url = ds->request().url();
@@ -944,28 +941,24 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
disposition = d->DispositionForNavigationAction(
wv, webframe_, ds->request(), webnav_type, disposition, is_redirect);
}
+ }
+ if (disposition == CURRENT_TAB) {
+ policy_action = PolicyUse;
+ } else if (disposition == SAVE_TO_DISK) {
+ policy_action = PolicyDownload;
+ } else {
if (disposition != IGNORE_ACTION) {
- if (disposition == CURRENT_TAB) {
- policy_action = PolicyUse;
- } else if (disposition == SAVE_TO_DISK) {
- policy_action = PolicyDownload;
- } else {
- GURL referrer = webkit_glue::StringToGURL(
- request.httpHeaderField("Referer"));
-
- d->OpenURL(webframe_->GetWebViewImpl(),
- webkit_glue::KURLToGURL(request.url()),
- referrer,
- disposition);
- policy_action = PolicyIgnore;
- }
- } else {
- policy_action = PolicyIgnore;
+ GURL referrer = webkit_glue::StringToGURL(
+ request.httpHeaderField("Referer"));
+
+ d->OpenURL(webframe_->GetWebViewImpl(),
+ webkit_glue::KURLToGURL(request.url()),
+ referrer,
+ disposition);
}
+ policy_action = PolicyIgnore;
}
- } else {
- policy_action = PolicyIgnore;
}
(webframe_->frame()->loader()->*function)(policy_action);