OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if defined(ENABLE_PEPPER) | 5 #if defined(ENABLE_PEPPER) |
6 #define PEPPER_APIS_ENABLED | 6 #define PEPPER_APIS_ENABLED |
7 #endif | 7 #endif |
8 | 8 |
9 #include "chrome/renderer/render_view.h" | 9 #include "chrome/renderer/render_view.h" |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "webkit/api/public/WebAccessibilityCache.h" | 67 #include "webkit/api/public/WebAccessibilityCache.h" |
68 #include "webkit/api/public/WebAccessibilityObject.h" | 68 #include "webkit/api/public/WebAccessibilityObject.h" |
69 #include "webkit/api/public/WebDataSource.h" | 69 #include "webkit/api/public/WebDataSource.h" |
70 #include "webkit/api/public/WebDevToolsAgent.h" | 70 #include "webkit/api/public/WebDevToolsAgent.h" |
71 #include "webkit/api/public/WebDragData.h" | 71 #include "webkit/api/public/WebDragData.h" |
72 #include "webkit/api/public/WebForm.h" | 72 #include "webkit/api/public/WebForm.h" |
73 #include "webkit/api/public/WebFrame.h" | 73 #include "webkit/api/public/WebFrame.h" |
74 #include "webkit/api/public/WebHistoryItem.h" | 74 #include "webkit/api/public/WebHistoryItem.h" |
75 #include "webkit/api/public/WebNode.h" | 75 #include "webkit/api/public/WebNode.h" |
76 #include "webkit/api/public/WebPoint.h" | 76 #include "webkit/api/public/WebPoint.h" |
| 77 #include "webkit/api/public/WebRange.h" |
77 #include "webkit/api/public/WebRect.h" | 78 #include "webkit/api/public/WebRect.h" |
78 #include "webkit/api/public/WebScriptSource.h" | 79 #include "webkit/api/public/WebScriptSource.h" |
79 #include "webkit/api/public/WebSearchableFormData.h" | 80 #include "webkit/api/public/WebSearchableFormData.h" |
80 #include "webkit/api/public/WebSecurityOrigin.h" | 81 #include "webkit/api/public/WebSecurityOrigin.h" |
81 #include "webkit/api/public/WebSize.h" | 82 #include "webkit/api/public/WebSize.h" |
82 #include "webkit/api/public/WebString.h" | 83 #include "webkit/api/public/WebString.h" |
83 #include "webkit/api/public/WebURL.h" | 84 #include "webkit/api/public/WebURL.h" |
84 #include "webkit/api/public/WebURLError.h" | 85 #include "webkit/api/public/WebURLError.h" |
85 #include "webkit/api/public/WebURLRequest.h" | 86 #include "webkit/api/public/WebURLRequest.h" |
86 #include "webkit/api/public/WebURLResponse.h" | 87 #include "webkit/api/public/WebURLResponse.h" |
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 | 2774 |
2774 bool multi_frame = (frame_after_main != main_frame); | 2775 bool multi_frame = (frame_after_main != main_frame); |
2775 | 2776 |
2776 // If we have multiple frames, we don't want to wrap the search within the | 2777 // If we have multiple frames, we don't want to wrap the search within the |
2777 // frame, so we check here if we only have main_frame in the chain. | 2778 // frame, so we check here if we only have main_frame in the chain. |
2778 bool wrap_within_frame = !multi_frame; | 2779 bool wrap_within_frame = !multi_frame; |
2779 | 2780 |
2780 WebRect selection_rect; | 2781 WebRect selection_rect; |
2781 bool result = false; | 2782 bool result = false; |
2782 | 2783 |
| 2784 // If something is selected when we start searching it means we cannot just |
| 2785 // increment the current match ordinal; we need to re-generate it. |
| 2786 WebRange current_selection = focused_frame->selectionRange(); |
| 2787 |
2783 do { | 2788 do { |
2784 result = search_frame->find( | 2789 result = search_frame->find( |
2785 request_id, search_text, options, wrap_within_frame, &selection_rect); | 2790 request_id, search_text, options, wrap_within_frame, &selection_rect); |
2786 | 2791 |
2787 if (!result) { | 2792 if (!result) { |
2788 // don't leave text selected as you move to the next frame. | 2793 // don't leave text selected as you move to the next frame. |
2789 search_frame->executeCommand(WebString::fromUTF8("Unselect")); | 2794 search_frame->executeCommand(WebString::fromUTF8("Unselect")); |
2790 | 2795 |
2791 // Find the next frame, but skip the invisible ones. | 2796 // Find the next frame, but skip the invisible ones. |
2792 do { | 2797 do { |
(...skipping 16 matching lines...) Expand all Loading... |
2809 if (multi_frame && search_frame == focused_frame) { | 2814 if (multi_frame && search_frame == focused_frame) { |
2810 result = search_frame->find( | 2815 result = search_frame->find( |
2811 request_id, search_text, options, true, // Force wrapping. | 2816 request_id, search_text, options, true, // Force wrapping. |
2812 &selection_rect); | 2817 &selection_rect); |
2813 } | 2818 } |
2814 } | 2819 } |
2815 | 2820 |
2816 webview()->setFocusedFrame(search_frame); | 2821 webview()->setFocusedFrame(search_frame); |
2817 } while (!result && search_frame != focused_frame); | 2822 } while (!result && search_frame != focused_frame); |
2818 | 2823 |
2819 if (options.findNext) { | 2824 if (options.findNext && current_selection.isNull()) { |
2820 // Force the main_frame to report the actual count. | 2825 // Force the main_frame to report the actual count. |
2821 main_frame->increaseMatchCount(0, request_id); | 2826 main_frame->increaseMatchCount(0, request_id); |
2822 } else { | 2827 } else { |
2823 // If nothing is found, set result to "0 of 0", otherwise, set it to | 2828 // If nothing is found, set result to "0 of 0", otherwise, set it to |
2824 // "-1 of 1" to indicate that we found at least one item, but we don't know | 2829 // "-1 of 1" to indicate that we found at least one item, but we don't know |
2825 // yet what is active. | 2830 // yet what is active. |
2826 int ordinal = result ? -1 : 0; // -1 here means, we might know more later. | 2831 int ordinal = result ? -1 : 0; // -1 here means, we might know more later. |
2827 int match_count = result ? 1 : 0; // 1 here means possibly more coming. | 2832 int match_count = result ? 1 : 0; // 1 here means possibly more coming. |
2828 | 2833 |
2829 // If we find no matches then this will be our last status update. | 2834 // If we find no matches then this will be our last status update. |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3763 new PluginMsg_SignalModalDialogEvent(host_window_)); | 3768 new PluginMsg_SignalModalDialogEvent(host_window_)); |
3764 | 3769 |
3765 message->EnableMessagePumping(); // Runs a nested message loop. | 3770 message->EnableMessagePumping(); // Runs a nested message loop. |
3766 bool rv = Send(message); | 3771 bool rv = Send(message); |
3767 | 3772 |
3768 PluginChannelHost::Broadcast( | 3773 PluginChannelHost::Broadcast( |
3769 new PluginMsg_ResetModalDialogEvent(host_window_)); | 3774 new PluginMsg_ResetModalDialogEvent(host_window_)); |
3770 | 3775 |
3771 return rv; | 3776 return rv; |
3772 } | 3777 } |
OLD | NEW |