Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 151195: Simplifying renderer focus management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/glue/webframeloaderclient_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 static_cast<WebFrameImpl*>(GetView()->GetMainFrame()); 1256 static_cast<WebFrameImpl*>(GetView()->GetMainFrame());
1257 1257
1258 if (this == main_frame_impl->active_match_frame() && 1258 if (this == main_frame_impl->active_match_frame() &&
1259 active_match_.get()) { 1259 active_match_.get()) {
1260 // If the user has set the selection since the match was found, we 1260 // If the user has set the selection since the match was found, we
1261 // don't focus anything. 1261 // don't focus anything.
1262 VisibleSelection selection(frame()->selection()->selection()); 1262 VisibleSelection selection(frame()->selection()->selection());
1263 if (!selection.isNone()) 1263 if (!selection.isNone())
1264 return; 1264 return;
1265 1265
1266 // We will be setting focus ourselves, so we want the view to forget its
1267 // stored focus node so that it won't change it after we are done.
1268 static_cast<WebViewImpl*>(GetView())->ReleaseFocusReferences();
1269
1270 // Try to find the first focusable node up the chain, which will, for 1266 // Try to find the first focusable node up the chain, which will, for
1271 // example, focus links if we have found text within the link. 1267 // example, focus links if we have found text within the link.
1272 Node* node = active_match_->firstNode(); 1268 Node* node = active_match_->firstNode();
1273 while (node && !node->isFocusable() && node != frame()->document()) 1269 while (node && !node->isFocusable() && node != frame()->document())
1274 node = node->parent(); 1270 node = node->parent();
1275 1271
1276 if (node && node != frame()->document()) { 1272 if (node && node != frame()->document()) {
1277 // Found a focusable parent node. Set focus to it. 1273 // Found a focusable parent node. Set focus to it.
1278 frame()->document()->setFocusedNode(node); 1274 frame()->document()->setFocusedNode(node);
1279 } else { 1275 } else {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 1816
1821 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); 1817 SecurityOrigin* security_origin = frame_->document()->securityOrigin();
1822 1818
1823 if (!frame_->loader()->isScheduledLocationChangePending()) { 1819 if (!frame_->loader()->isScheduledLocationChangePending()) {
1824 frame_->loader()->stopAllLoaders(); 1820 frame_->loader()->stopAllLoaders();
1825 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); 1821 frame_->loader()->begin(frame_->loader()->url(), true, security_origin);
1826 frame_->loader()->write(script_result); 1822 frame_->loader()->write(script_result);
1827 frame_->loader()->end(); 1823 frame_->loader()->end();
1828 } 1824 }
1829 } 1825 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/glue/webframeloaderclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698