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

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

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 2ac899a5fb9cfe2164977a1d756bf43b6e53f246..c36ffd128191b50e8e50d36fa86ed1d902cf8959 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -73,7 +73,7 @@ bool CustomButton::IsMouseHovered() const {
gfx::Point cursor_pos(gfx::Screen::GetCursorScreenPoint());
ConvertPointToView(NULL, this, &cursor_pos);
- return HitTest(cursor_pos);
+ return HitTest(gfx::Rect(cursor_pos, gfx::Size(0, 0)));
}
void CustomButton::SetHotTracked(bool is_hot_tracked) {
@@ -109,7 +109,8 @@ std::string CustomButton::GetClassName() const {
bool CustomButton::OnMousePressed(const MouseEvent& event) {
if (state_ != BS_DISABLED) {
- if (ShouldEnterPushedState(event) && HitTest(event.location()))
+ if (ShouldEnterPushedState(event) &&
+ HitTest(gfx::Rect(event.location(), gfx::Size(0, 0))))
SetState(BS_PUSHED);
if (request_focus_on_press_)
RequestFocus();
@@ -119,7 +120,7 @@ bool CustomButton::OnMousePressed(const MouseEvent& event) {
bool CustomButton::OnMouseDragged(const MouseEvent& event) {
if (state_ != BS_DISABLED) {
- if (HitTest(event.location()))
+ if (HitTest(gfx::Rect(event.location(), gfx::Size(0, 0))))
SetState(ShouldEnterPushedState(event) ? BS_PUSHED : BS_HOT);
else
SetState(BS_NORMAL);
@@ -131,7 +132,7 @@ void CustomButton::OnMouseReleased(const MouseEvent& event) {
if (state_ == BS_DISABLED)
return;
- if (!HitTest(event.location())) {
+ if (!HitTest(gfx::Rect(event.location(), gfx::Size(0, 0)))) {
SetState(BS_NORMAL);
return;
}
@@ -163,7 +164,8 @@ void CustomButton::OnMouseExited(const MouseEvent& event) {
void CustomButton::OnMouseMoved(const MouseEvent& event) {
if (state_ != BS_DISABLED)
- SetState(HitTest(event.location()) ? BS_HOT : BS_NORMAL);
+ SetState(HitTest(gfx::Rect(event.location(), gfx::Size(0, 0))) ?
+ BS_HOT : BS_NORMAL);
}
bool CustomButton::OnKeyPressed(const KeyEvent& event) {

Powered by Google App Engine
This is Rietveld 408576698