Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/root_view.h" | 5 #include "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" |
| 11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
| 12 #include "ui/base/dragdrop/drag_drop_types.h" | 12 #include "ui/base/dragdrop/drag_drop_types.h" |
| 13 #include "ui/base/keycodes/keyboard_codes.h" | 13 #include "ui/base/keycodes/keyboard_codes.h" |
| 14 #include "ui/gfx/canvas_skia.h" | 14 #include "ui/gfx/canvas_skia.h" |
| 15 #include "ui/gfx/transform.h" | |
| 15 #include "views/focus/view_storage.h" | 16 #include "views/focus/view_storage.h" |
| 16 #include "views/layout/fill_layout.h" | 17 #include "views/layout/fill_layout.h" |
| 17 #include "views/touchui/gesture_manager.h" | 18 #include "views/touchui/gesture_manager.h" |
| 18 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 namespace internal { | 22 namespace internal { |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 const char RootView::kViewClassName[] = "views/RootView"; | 25 const char RootView::kViewClassName[] = "views/RootView"; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 } | 149 } |
| 149 | 150 |
| 150 bool RootView::IsVisibleInRootView() const { | 151 bool RootView::IsVisibleInRootView() const { |
| 151 return IsVisible(); | 152 return IsVisible(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 std::string RootView::GetClassName() const { | 155 std::string RootView::GetClassName() const { |
| 155 return kViewClassName; | 156 return kViewClassName; |
| 156 } | 157 } |
| 157 | 158 |
| 159 void RootView::ScheduleComposite() { | |
| 160 widget_->SchedulePaintInRect(widget_->GetClientAreaScreenBounds()); | |
|
sky
2011/08/17 16:39:42
Why is this asking to paint in terms of screen coo
| |
| 161 } | |
| 162 | |
| 158 void RootView::SchedulePaintInRect(const gfx::Rect& rect) { | 163 void RootView::SchedulePaintInRect(const gfx::Rect& rect) { |
| 159 MarkLayerDirty(); | 164 MarkLayerDirty(); |
| 160 SchedulePaintInternal(rect); | 165 SchedulePaintInternal(rect); |
| 161 } | 166 } |
| 162 | 167 |
| 163 void RootView::SchedulePaintInternal(const gfx::Rect& rect) { | 168 void RootView::SchedulePaintInternal(const gfx::Rect& rect) { |
| 164 gfx::Rect xrect = ConvertRectToParent(rect); | 169 gfx::Rect xrect = ConvertRectToParent(rect); |
| 165 gfx::Rect invalid_rect = GetLocalBounds().Intersect(xrect); | 170 gfx::Rect invalid_rect = GetLocalBounds().Intersect(xrect); |
| 166 if (!invalid_rect.IsEmpty()) | 171 if (!invalid_rect.IsEmpty()) { |
|
sky
2011/08/17 16:39:42
no {}
| |
| 167 widget_->SchedulePaintInRect(invalid_rect); | 172 widget_->SchedulePaintInRect(invalid_rect); |
| 173 } | |
| 168 } | 174 } |
| 169 | 175 |
| 170 bool RootView::OnMousePressed(const MouseEvent& event) { | 176 bool RootView::OnMousePressed(const MouseEvent& event) { |
| 171 MouseEvent e(event, this); | 177 MouseEvent e(event, this); |
| 172 if (capture_view_) { | 178 if (capture_view_) { |
| 173 MouseEvent ce(e, this, capture_view_); | 179 MouseEvent ce(e, this, capture_view_); |
| 174 return capture_view_->OnMousePressed(ce); | 180 return capture_view_->OnMousePressed(ce); |
| 175 } | 181 } |
| 176 | 182 |
| 177 UpdateCursor(e); | 183 UpdateCursor(e); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 | 506 |
| 501 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 507 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
| 502 last_mouse_event_flags_ = event.flags(); | 508 last_mouse_event_flags_ = event.flags(); |
| 503 last_mouse_event_x_ = event.x(); | 509 last_mouse_event_x_ = event.x(); |
| 504 last_mouse_event_y_ = event.y(); | 510 last_mouse_event_y_ = event.y(); |
| 505 } | 511 } |
| 506 | 512 |
| 507 } // namespace internal | 513 } // namespace internal |
| 508 } // namespace views | 514 } // namespace views |
| 509 | 515 |
| OLD | NEW |