diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-14 17:50:22 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-14 17:50:22 +0000 |
commit | a100d76bbc0afe58ef7761a1eaf06cb1489cc1b1 (patch) | |
tree | 4b186f6c37ce0adc97516efce9ec31cea47e732c /webkit | |
parent | 8a9f6525ba1fb42d4b8754bd93c25f5d9e559849 (diff) | |
download | chromium_src-a100d76bbc0afe58ef7761a1eaf06cb1489cc1b1.zip chromium_src-a100d76bbc0afe58ef7761a1eaf06cb1489cc1b1.tar.gz chromium_src-a100d76bbc0afe58ef7761a1eaf06cb1489cc1b1.tar.bz2 |
Remove WebFrame::selectAll and WebFrame::clearSelection in favor of having
consumers use executeCommand.
Patch by Marshall Greenblatt
R=darin
BUG=19270
TEST=covered by unit tests
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-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 |
5 files changed, 8 insertions, 21 deletions
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': |