OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/root_view.h" | 5 #include "ui/views/widget/root_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 std::string RootView::GetClassName() const { | 185 std::string RootView::GetClassName() const { |
186 return kViewClassName; | 186 return kViewClassName; |
187 } | 187 } |
188 | 188 |
189 void RootView::SchedulePaintInRect(const gfx::Rect& rect) { | 189 void RootView::SchedulePaintInRect(const gfx::Rect& rect) { |
190 if (layer()) { | 190 if (layer()) { |
191 layer()->SchedulePaint(rect); | 191 layer()->SchedulePaint(rect); |
192 } else { | 192 } else { |
193 gfx::Rect xrect = ConvertRectToParent(rect); | 193 gfx::Rect xrect = ConvertRectToParent(rect); |
194 gfx::Rect invalid_rect = GetLocalBounds().Intersect(xrect); | 194 gfx::Rect invalid_rect = GetLocalBounds(); |
| 195 invalid_rect.Intersect(xrect); |
195 if (!invalid_rect.IsEmpty()) | 196 if (!invalid_rect.IsEmpty()) |
196 widget_->SchedulePaintInRect(invalid_rect); | 197 widget_->SchedulePaintInRect(invalid_rect); |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 bool RootView::OnMousePressed(const ui::MouseEvent& event) { | 201 bool RootView::OnMousePressed(const ui::MouseEvent& event) { |
201 UpdateCursor(event); | 202 UpdateCursor(event); |
202 SetMouseLocationAndFlags(event); | 203 SetMouseLocationAndFlags(event); |
203 | 204 |
204 // If mouse_pressed_handler_ is non null, we are currently processing | 205 // If mouse_pressed_handler_ is non null, we are currently processing |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 } | 614 } |
614 | 615 |
615 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { | 616 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { |
616 last_mouse_event_flags_ = event.flags(); | 617 last_mouse_event_flags_ = event.flags(); |
617 last_mouse_event_x_ = event.x(); | 618 last_mouse_event_x_ = event.x(); |
618 last_mouse_event_y_ = event.y(); | 619 last_mouse_event_y_ = event.y(); |
619 } | 620 } |
620 | 621 |
621 } // namespace internal | 622 } // namespace internal |
622 } // namespace views | 623 } // namespace views |
OLD | NEW |