| 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(); | 194 gfx::Rect invalid_rect = gfx::Intersection(GetLocalBounds(), xrect); |
| 195 invalid_rect.Intersect(xrect); | |
| 196 if (!invalid_rect.IsEmpty()) | 195 if (!invalid_rect.IsEmpty()) |
| 197 widget_->SchedulePaintInRect(invalid_rect); | 196 widget_->SchedulePaintInRect(invalid_rect); |
| 198 } | 197 } |
| 199 } | 198 } |
| 200 | 199 |
| 201 bool RootView::OnMousePressed(const ui::MouseEvent& event) { | 200 bool RootView::OnMousePressed(const ui::MouseEvent& event) { |
| 202 UpdateCursor(event); | 201 UpdateCursor(event); |
| 203 SetMouseLocationAndFlags(event); | 202 SetMouseLocationAndFlags(event); |
| 204 | 203 |
| 205 // If mouse_pressed_handler_ is non null, we are currently processing | 204 // If mouse_pressed_handler_ is non null, we are currently processing |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 613 } |
| 615 | 614 |
| 616 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { | 615 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { |
| 617 last_mouse_event_flags_ = event.flags(); | 616 last_mouse_event_flags_ = event.flags(); |
| 618 last_mouse_event_x_ = event.x(); | 617 last_mouse_event_x_ = event.x(); |
| 619 last_mouse_event_y_ = event.y(); | 618 last_mouse_event_y_ = event.y(); |
| 620 } | 619 } |
| 621 | 620 |
| 622 } // namespace internal | 621 } // namespace internal |
| 623 } // namespace views | 622 } // namespace views |
| OLD | NEW |