OLD | NEW |
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 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 InvalidateArea(INVALIDATE_ALL); | 1218 InvalidateArea(INVALIDATE_ALL); |
1219 | 1219 |
1220 return; | 1220 return; |
1221 } | 1221 } |
1222 | 1222 |
1223 void WebFrameImpl::CancelPendingScopingEffort() { | 1223 void WebFrameImpl::CancelPendingScopingEffort() { |
1224 scope_matches_factory_.RevokeAll(); | 1224 scope_matches_factory_.RevokeAll(); |
1225 active_tickmark_ = WidgetClientWin::kNoTickmark; | 1225 active_tickmark_ = WidgetClientWin::kNoTickmark; |
1226 } | 1226 } |
1227 | 1227 |
1228 void WebFrameImpl::StopFinding() { | 1228 void WebFrameImpl::SetFindEndstateFocusAndSelection() { |
| 1229 WebFrameImpl* main_frame_impl = |
| 1230 static_cast<WebFrameImpl*>(GetView()->GetMainFrame()); |
| 1231 |
| 1232 if (this == main_frame_impl->active_tickmark_frame() && |
| 1233 active_tickmark_ != WidgetClientWin::kNoTickmark) { |
| 1234 RefPtr<Range> range = tickmarks_[active_tickmark_]; |
| 1235 |
| 1236 // Set the selection to what the active match is. |
| 1237 frame()->selectionController()->setSelectedRange( |
| 1238 range.get(), WebCore::DOWNSTREAM, false); |
| 1239 |
| 1240 // We will be setting focus ourselves, so we want the view to forget its |
| 1241 // stored focus node so that it won't change it after we are done. |
| 1242 static_cast<WebViewImpl*>(GetView())->ReleaseFocusReferences(); |
| 1243 |
| 1244 // Try to find the first focusable node up the chain, which will, for |
| 1245 // example, focus links if we have found text within the link. |
| 1246 Node* node = range->startNode(); |
| 1247 while (!node->isFocusable() && node != frame()->document()) |
| 1248 node = node->parent(); |
| 1249 |
| 1250 if (node != frame()->document()) { |
| 1251 // Found a focusable parent node. Set focus to it. |
| 1252 frame()->document()->setFocusedNode(node); |
| 1253 } else { |
| 1254 // Iterate over all the nodes in the range until we find a focusable node. |
| 1255 // This, for example, sets focus to the first link if you search for |
| 1256 // text and text that is within one or more links. |
| 1257 node = range->startNode(); |
| 1258 while (node != NULL && node != range->pastEndNode()) { |
| 1259 if (node->isFocusable()) { |
| 1260 frame()->document()->setFocusedNode(node); |
| 1261 break; |
| 1262 } |
| 1263 node = node->traverseNextNode(); |
| 1264 } |
| 1265 } |
| 1266 } |
| 1267 } |
| 1268 |
| 1269 void WebFrameImpl::StopFinding(bool clear_selection) { |
| 1270 if (!clear_selection) |
| 1271 SetFindEndstateFocusAndSelection(); |
1229 CancelPendingScopingEffort(); | 1272 CancelPendingScopingEffort(); |
1230 | 1273 |
1231 // Let the frame know that we don't want tickmarks or highlighting anymore. | 1274 // Let the frame know that we don't want tickmarks or highlighting anymore. |
1232 tickmarks_.clear(); | 1275 tickmarks_.clear(); |
1233 InvalidateArea(INVALIDATE_ALL); | 1276 InvalidateArea(INVALIDATE_ALL); |
1234 } | 1277 } |
1235 | 1278 |
1236 void WebFrameImpl::SelectAll() { | 1279 void WebFrameImpl::SelectAll() { |
1237 frame()->selectionController()->selectAll(); | 1280 frame()->selectionController()->selectAll(); |
1238 | 1281 |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 } | 1851 } |
1809 | 1852 |
1810 bool WebFrameImpl::IsReloadAllowingStaleData() const { | 1853 bool WebFrameImpl::IsReloadAllowingStaleData() const { |
1811 FrameLoader* loader = frame() ? frame()->loader() : NULL; | 1854 FrameLoader* loader = frame() ? frame()->loader() : NULL; |
1812 if (loader) { | 1855 if (loader) { |
1813 return WebCore::FrameLoadTypeReloadAllowingStaleData == | 1856 return WebCore::FrameLoadTypeReloadAllowingStaleData == |
1814 loader->policyLoadType(); | 1857 loader->policyLoadType(); |
1815 } | 1858 } |
1816 return false; | 1859 return false; |
1817 } | 1860 } |
OLD | NEW |