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/native_widget_view.h" | 5 #include "views/widget/native_widget_view.h" |
6 | 6 |
7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
8 #if defined(OS_LINUX) | 8 #if defined(OS_LINUX) |
9 #include "views/window/hit_test.h" | 9 #include "views/window/hit_test.h" |
10 #endif | 10 #endif |
(...skipping 26 matching lines...) Expand all Loading... |
37 delete native_widget_; | 37 delete native_widget_; |
38 } | 38 } |
39 | 39 |
40 Widget* NativeWidgetView::GetAssociatedWidget() { | 40 Widget* NativeWidgetView::GetAssociatedWidget() { |
41 return native_widget_->delegate()->AsWidget(); | 41 return native_widget_->delegate()->AsWidget(); |
42 } | 42 } |
43 | 43 |
44 //////////////////////////////////////////////////////////////////////////////// | 44 //////////////////////////////////////////////////////////////////////////////// |
45 // NativeWidgetView, View overrides: | 45 // NativeWidgetView, View overrides: |
46 | 46 |
47 void NativeWidgetView::SchedulePaintInternal(const gfx::Rect& r) { | 47 void NativeWidgetView::CalculateOffsetToAncestorWithLayer( |
48 View::SchedulePaintInternal(r); | 48 gfx::Point* offset, |
49 } | 49 ui::Layer** layer_parent) { |
50 | 50 View::CalculateOffsetToAncestorWithLayer(offset, layer_parent); |
51 void NativeWidgetView::MarkLayerDirty() { | |
52 View::MarkLayerDirty(); | |
53 } | |
54 | |
55 void NativeWidgetView::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, | |
56 View** ancestor) { | |
57 View::CalculateOffsetToAncestorWithLayer(offset, ancestor); | |
58 } | 51 } |
59 | 52 |
60 void NativeWidgetView::ViewHierarchyChanged(bool is_add, | 53 void NativeWidgetView::ViewHierarchyChanged(bool is_add, |
61 View* parent, | 54 View* parent, |
62 View* child) { | 55 View* child) { |
63 if (is_add && child == this && !sent_create_) { | 56 if (is_add && child == this && !sent_create_) { |
64 sent_create_ = true; | 57 sent_create_ = true; |
65 delegate()->OnNativeWidgetCreated(); | 58 delegate()->OnNativeWidgetCreated(); |
66 } | 59 } |
67 } | 60 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 183 } |
191 | 184 |
192 void NativeWidgetView::UpdateLayerBounds(const gfx::Point& offset) { | 185 void NativeWidgetView::UpdateLayerBounds(const gfx::Point& offset) { |
193 View::UpdateLayerBounds(offset); | 186 View::UpdateLayerBounds(offset); |
194 if (!layer()) { | 187 if (!layer()) { |
195 gfx::Point new_offset(offset.x() + x(), offset.y() + y()); | 188 gfx::Point new_offset(offset.x() + x(), offset.y() + y()); |
196 GetAssociatedWidget()->GetRootView()->UpdateLayerBounds(new_offset); | 189 GetAssociatedWidget()->GetRootView()->UpdateLayerBounds(new_offset); |
197 } | 190 } |
198 } | 191 } |
199 | 192 |
200 void NativeWidgetView::PaintToLayer(const gfx::Rect& dirty_rect) { | |
201 View::PaintToLayer(dirty_rect); | |
202 | |
203 View* root = GetAssociatedWidget()->GetRootView(); | |
204 gfx::Rect root_dirty_rect = dirty_rect; | |
205 root->GetTransform().TransformRectReverse(&root_dirty_rect); | |
206 root_dirty_rect = | |
207 gfx::Rect(gfx::Point(), root->size()).Intersect(root_dirty_rect); | |
208 | |
209 if (!root_dirty_rect.IsEmpty()) | |
210 root->PaintToLayer(root_dirty_rect); | |
211 } | |
212 | |
213 void NativeWidgetView::PaintComposite() { | |
214 View::PaintComposite(); | |
215 GetAssociatedWidget()->GetRootView()->PaintComposite(); | |
216 } | |
217 | |
218 } // namespace internal | 193 } // namespace internal |
219 } // namespace views | 194 } // namespace views |
OLD | NEW |