diff options
-rw-r--r-- | build/common.gypi | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 10 | ||||
-rw-r--r-- | webkit/api/public/WebFrame.h | 6 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 15 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/webframe_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 2 |
7 files changed, 15 insertions, 26 deletions
diff --git a/build/common.gypi b/build/common.gypi index fed9d96..be4f346 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -151,7 +151,7 @@ ['OS=="win"', { 'conditions': [ ['MSVS_VERSION=="2005"', { - 'msvs_multi_core_compile%': 0, + 'msvs_multi_core_compile%': 1, },{ 'msvs_multi_core_compile%': 1, }], diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 9fd1f1d..376b07e 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -771,7 +771,7 @@ void RenderView::OnStopFinding(bool clear_selection) { return; if (clear_selection) - view->GetFocusedFrame()->clearSelection(); + view->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); WebFrame* frame = view->GetMainFrame(); while (frame) { @@ -867,7 +867,9 @@ void RenderView::OnSelectAll() { if (!webview()) return; - webview()->GetFocusedFrame()->selectAll(); + webview()->GetFocusedFrame()->executeCommand( + WebString::fromUTF8("SelectAll")); + UserMetricsRecordAction(L"SelectAll"); } void RenderView::OnSetInitialFocus(bool reverse) { @@ -2279,7 +2281,7 @@ void RenderView::OnFind(int request_id, if (!result) { // don't leave text selected as you move to the next frame. - search_frame->clearSelection(); + search_frame->executeCommand(WebString::fromUTF8("Unselect")); // Find the next frame, but skip the invisible ones. do { @@ -2292,7 +2294,7 @@ void RenderView::OnFind(int request_id, search_frame != focused_frame); // Make sure selection doesn't affect the search operation in new frame. - search_frame->clearSelection(); + search_frame->executeCommand(WebString::fromUTF8("Unselect")); // If we have multiple frames and we have wrapped back around to the // focused frame, we need to search it once more allowing wrap within diff --git a/webkit/api/public/WebFrame.h b/webkit/api/public/WebFrame.h index be7ca8b..1201cc2 100644 --- a/webkit/api/public/WebFrame.h +++ b/webkit/api/public/WebFrame.h @@ -303,7 +303,9 @@ namespace WebKit { virtual WebRange markedRange() const = 0; - // See EditorCommand.cpp for the list of supported commands. + // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll, + // Unselect, etc. See EditorCommand.cpp for the full list of supported + // commands. virtual bool executeCommand(const WebString&) = 0; virtual bool executeCommand(const WebString&, const WebString& value) = 0; virtual bool isCommandEnabled(const WebString&) const = 0; @@ -315,8 +317,6 @@ namespace WebKit { // Selection ----------------------------------------------------------- - virtual void selectAll() = 0; - virtual void clearSelection() = 0; virtual bool hasSelection() const = 0; virtual WebRange selectionRange() const = 0; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 8dd7880..799e0e5 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -986,18 +986,6 @@ bool WebFrameImpl::isContinuousSpellCheckingEnabled() const { return frame()->editor()->isContinuousSpellCheckingEnabled(); } -void WebFrameImpl::selectAll() { - frame()->selection()->selectAll(); - - WebViewDelegate* d = GetWebViewImpl()->GetDelegate(); - if (d) - d->UserMetricsRecordAction(L"SelectAll"); -} - -void WebFrameImpl::clearSelection() { - frame()->selection()->clear(); -} - bool WebFrameImpl::hasSelection() const { // frame()->selection()->isNone() never returns true. return (frame()->selection()->start() != frame()->selection()->end()); @@ -1134,7 +1122,8 @@ bool WebFrameImpl::find(int request_id, active_match_ = new_selection.toNormalizedRange(); curr_selection_rect = active_match_->boundingBox(); SetMarkerActive(active_match_.get(), true); // Active. - clearSelection(); // WebKit draws the highlighting for all matches. + // WebKit draws the highlighting for all matches. + executeCommand(WebString::fromUTF8("Unselect")); } if (!options.findNext) { diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 3f898f9..87b2244 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -139,8 +139,6 @@ class WebFrameImpl : public WebKit::WebFrame, virtual bool isCommandEnabled(const WebKit::WebString& command) const; virtual void enableContinuousSpellChecking(bool enable); virtual bool isContinuousSpellCheckingEnabled() const; - virtual void selectAll(); - virtual void clearSelection(); virtual bool hasSelection() const; virtual WebKit::WebRange selectionRange() const; virtual WebKit::WebString selectionAsText() const; diff --git a/webkit/glue/webframe_unittest.cc b/webkit/glue/webframe_unittest.cc index fc5746e..00fe2fa 100644 --- a/webkit/glue/webframe_unittest.cc +++ b/webkit/glue/webframe_unittest.cc @@ -85,9 +85,9 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage) { // Test selection check EXPECT_FALSE(frame->hasSelection()); - frame->selectAll(); + frame->executeCommand(WebString::fromUTF8("SelectAll")); EXPECT_TRUE(frame->hasSelection()); - frame->clearSelection(); + frame->executeCommand(WebString::fromUTF8("Unselect")); EXPECT_FALSE(frame->hasSelection()); WebString selection_html = frame->selectionAsMarkup(); EXPECT_TRUE(selection_html.isEmpty()); diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 6189d64..0b66f06 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -820,7 +820,7 @@ bool WebViewImpl::KeyEventDefault(const WebKeyboardEvent& event) { if (event.modifiers == WebInputEvent::ControlKey) { switch (event.windowsKeyCode) { case 'A': - GetFocusedFrame()->selectAll(); + GetFocusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")); return true; case VKEY_INSERT: case 'C': |