summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 03:33:29 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 03:33:29 +0000
commit4198875dbfac06ef6b4d3578bb856344c1ac02cd (patch)
treeec54ac6732cb2dd917d21ef570eb293ac6b6b6b2
parentd2ce5dad5aa1e7a4518c60b362516873c49a61b4 (diff)
downloadchromium_src-4198875dbfac06ef6b4d3578bb856344c1ac02cd.zip
chromium_src-4198875dbfac06ef6b4d3578bb856344c1ac02cd.tar.gz
chromium_src-4198875dbfac06ef6b4d3578bb856344c1ac02cd.tar.bz2
Views Omnibox: tolerate minor click-to-select-all dragging.
Add protected Textfield::last_click_location() helper. Use this in assessing when to cancel Omnibox select-all. BUG=341100 TEST=Minor mouse dragging won't stop the Omnibox from selecting-all on a focusing click. R=pkasting@chromium.org Review URL: https://codereview.chromium.org/149123006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249253 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.cc3
-rw-r--r--ui/views/controls/textfield/textfield.h6
2 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index dc8c957..90c9290 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -239,7 +239,8 @@ bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
}
bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) {
- select_all_on_mouse_release_ = false;
+ if (ExceededDragThreshold(event.location() - last_click_location()))
+ select_all_on_mouse_release_ = false;
return views::Textfield::OnMouseDragged(event);
}
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index ba9d53b..57a044f 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -280,8 +280,10 @@ class VIEWS_EXPORT Textfield : public View,
virtual void OnCandidateWindowHidden() OVERRIDE;
protected:
- // Returns the TextfieldModel's text/cursor/selection rendering model.
- gfx::RenderText* GetRenderText() const;
+ // Returns the TextfieldModel's text/cursor/selection rendering model.
+ gfx::RenderText* GetRenderText() const;
+
+ gfx::Point last_click_location() const { return last_click_location_; }
// Get the text from the selection clipboard.
virtual base::string16 GetSelectionClipboardText() const;