Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index 0e237a312732e9703f3ec37cd79533f472cd31d7..8e4586d63df5c3d69253727be0e4408c9e89eee1 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -127,7 +127,8 @@ const char* CustomButton::GetClassName() const {
bool CustomButton::OnMousePressed(const ui::MouseEvent& event) {
if (state_ != STATE_DISABLED) {
- if (ShouldEnterPushedState(event) && HitTestPoint(event.location()))
+ if (ShouldEnterPushedState(event) &&
+ HitTestPoint(gfx::ToFlooredPoint(event.location())))
SetState(STATE_PRESSED);
if (request_focus_on_press_)
RequestFocus();
@@ -137,7 +138,7 @@ bool CustomButton::OnMousePressed(const ui::MouseEvent& event) {
bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) {
if (state_ != STATE_DISABLED) {
- if (HitTestPoint(event.location()))
+ if (HitTestPoint(gfx::ToFlooredPoint(event.location())))
SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED);
else
SetState(STATE_NORMAL);
@@ -149,7 +150,7 @@ void CustomButton::OnMouseReleased(const ui::MouseEvent& event) {
if (state_ == STATE_DISABLED)
return;
- if (!HitTestPoint(event.location())) {
+ if (!HitTestPoint(gfx::ToFlooredPoint(event.location()))) {
SetState(STATE_NORMAL);
return;
}
@@ -181,7 +182,9 @@ void CustomButton::OnMouseExited(const ui::MouseEvent& event) {
void CustomButton::OnMouseMoved(const ui::MouseEvent& event) {
if (state_ != STATE_DISABLED)
- SetState(HitTestPoint(event.location()) ? STATE_HOVERED : STATE_NORMAL);
+ SetState(HitTestPoint(gfx::ToFlooredPoint(event.location()))
+ ? STATE_HOVERED
+ : STATE_NORMAL);
}
bool CustomButton::OnKeyPressed(const ui::KeyEvent& event) {

Powered by Google App Engine
This is Rietveld 408576698