| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/protocol/color_picker.h" | 5 #include "content/browser/devtools/protocol/color_picker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (!enabled_) | 105 if (!enabled_) |
| 106 return; | 106 return; |
| 107 | 107 |
| 108 if (response == READBACK_SUCCESS) { | 108 if (response == READBACK_SUCCESS) { |
| 109 frame_ = bitmap; | 109 frame_ = bitmap; |
| 110 UpdateCursor(); | 110 UpdateCursor(); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) { | 114 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) { |
| 115 last_cursor_x_ = event.x; | 115 last_cursor_x_ = event.positionInWidget().x; |
| 116 last_cursor_y_ = event.y; | 116 last_cursor_y_ = event.positionInWidget().y; |
| 117 if (frame_.drawsNothing()) | 117 if (frame_.drawsNothing()) |
| 118 return true; | 118 return true; |
| 119 | 119 |
| 120 if (event.button == blink::WebMouseEvent::Button::Left && | 120 if (event.button == blink::WebMouseEvent::Button::Left && |
| 121 (event.type() == blink::WebInputEvent::MouseDown || | 121 (event.type() == blink::WebInputEvent::MouseDown || |
| 122 event.type() == blink::WebInputEvent::MouseMove)) { | 122 event.type() == blink::WebInputEvent::MouseMove)) { |
| 123 if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() || | 123 if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() || |
| 124 last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) { | 124 last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) { |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 gfx::Point(kHotspotOffset * device_scale_factor, | 257 gfx::Point(kHotspotOffset * device_scale_factor, |
| 258 kHotspotOffset * device_scale_factor); | 258 kHotspotOffset * device_scale_factor); |
| 259 | 259 |
| 260 cursor.InitFromCursorInfo(cursor_info); | 260 cursor.InitFromCursorInfo(cursor_info); |
| 261 DCHECK(host_); | 261 DCHECK(host_); |
| 262 host_->SetCursor(cursor); | 262 host_->SetCursor(cursor); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace protocol | 265 } // namespace protocol |
| 266 } // namespace content | 266 } // namespace content |
| OLD | NEW |