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/view.h" | 5 #include "views/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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 id_(0), | 99 id_(0), |
100 group_(-1), | 100 group_(-1), |
101 parent_(NULL), | 101 parent_(NULL), |
102 is_visible_(true), | 102 is_visible_(true), |
103 enabled_(true), | 103 enabled_(true), |
104 registered_for_visible_bounds_notification_(false), | 104 registered_for_visible_bounds_notification_(false), |
105 clip_x_(0.0), | 105 clip_x_(0.0), |
106 clip_y_(0.0), | 106 clip_y_(0.0), |
107 needs_layout_(true), | 107 needs_layout_(true), |
108 flip_canvas_on_paint_for_rtl_ui_(false), | 108 flip_canvas_on_paint_for_rtl_ui_(false), |
109 #if !defined(COMPOSITOR_2) | |
110 texture_id_(0), // TODO(sadrul): 0 can be a valid texture id. | |
111 #endif | |
112 texture_needs_updating_(true), | 109 texture_needs_updating_(true), |
113 paint_to_texture_(false), | 110 paint_to_texture_(false), |
114 accelerator_registration_delayed_(false), | 111 accelerator_registration_delayed_(false), |
115 accelerator_focus_manager_(NULL), | 112 accelerator_focus_manager_(NULL), |
116 registered_accelerator_count_(0), | 113 registered_accelerator_count_(0), |
117 next_focusable_view_(NULL), | 114 next_focusable_view_(NULL), |
118 previous_focusable_view_(NULL), | 115 previous_focusable_view_(NULL), |
119 focusable_(false), | 116 focusable_(false), |
120 accessibility_focusable_(false), | 117 accessibility_focusable_(false), |
121 context_menu_controller_(NULL), | 118 context_menu_controller_(NULL), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 for (View* p = this; p; p = p->parent()) | 167 for (View* p = this; p; p = p->parent()) |
171 p->ViewHierarchyChangedImpl(false, true, this, view); | 168 p->ViewHierarchyChangedImpl(false, true, this, view); |
172 | 169 |
173 view->PropagateAddNotifications(this, view); | 170 view->PropagateAddNotifications(this, view); |
174 UpdateTooltip(); | 171 UpdateTooltip(); |
175 if (GetWidget()) | 172 if (GetWidget()) |
176 RegisterChildrenForVisibleBoundsNotification(view); | 173 RegisterChildrenForVisibleBoundsNotification(view); |
177 | 174 |
178 if (layout_manager_.get()) | 175 if (layout_manager_.get()) |
179 layout_manager_->ViewAdded(this, view); | 176 layout_manager_->ViewAdded(this, view); |
180 #if defined(COMPOSITOR_2) | 177 |
181 view->MarkTextureDirty(); | 178 view->MarkTextureDirty(); |
182 #endif | |
183 } | 179 } |
184 | 180 |
185 void View::RemoveChildView(View* view) { | 181 void View::RemoveChildView(View* view) { |
186 DoRemoveChildView(view, true, true, false); | 182 DoRemoveChildView(view, true, true, false); |
187 } | 183 } |
188 | 184 |
189 void View::RemoveAllChildViews(bool delete_children) { | 185 void View::RemoveAllChildViews(bool delete_children) { |
190 while (!children_.empty()) | 186 while (!children_.empty()) |
191 DoRemoveChildView(children_.front(), false, false, delete_children); | 187 DoRemoveChildView(children_.front(), false, false, delete_children); |
192 UpdateTooltip(); | 188 UpdateTooltip(); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 if (transform_.get()) | 391 if (transform_.get()) |
396 return *transform_.get(); | 392 return *transform_.get(); |
397 return *no_op; | 393 return *no_op; |
398 } | 394 } |
399 | 395 |
400 void View::SetTransform(const ui::Transform& transform) { | 396 void View::SetTransform(const ui::Transform& transform) { |
401 if (!transform.HasChange()) { | 397 if (!transform.HasChange()) { |
402 if (!transform_.get()) | 398 if (!transform_.get()) |
403 return; | 399 return; |
404 transform_.reset(NULL); | 400 transform_.reset(NULL); |
405 #if !defined(COMPOSITOR_2) | 401 |
406 canvas_.reset(); | |
407 #else | |
408 if (!paint_to_texture_) | 402 if (!paint_to_texture_) |
409 texture_.reset(); | 403 texture_.reset(); |
410 #endif | 404 |
411 SchedulePaint(); | 405 SchedulePaint(); |
412 } else { | 406 } else { |
413 transform_.reset(new ui::Transform(transform)); | 407 transform_.reset(new ui::Transform(transform)); |
414 #if defined(COMPOSITOR_2) | |
415 if (!texture_.get()) { | 408 if (!texture_.get()) { |
416 // We don't yet have a texture. SchedulePaint so one is created. | 409 // We don't yet have a texture. SchedulePaint so one is created. |
417 SchedulePaint(); | 410 SchedulePaint(); |
418 } else { | 411 } else { |
419 // We have a texture. When the transform changes and the texture is up to | 412 // We have a texture. When the transform changes and the texture is up to |
420 // date we don't want to SchedulePaint as it'll trigger painting to the | 413 // date we don't want to SchedulePaint as it'll trigger painting to the |
421 // texture. Instead we tell the Widget to paint, which makes the | 414 // texture. Instead we tell the Widget to paint, which makes the |
422 // compositor draw using the existing texture. | 415 // compositor draw using the existing texture. |
423 // We schedule paint the complete bounds as compositor generally don't | 416 // We schedule paint the complete bounds as compositor generally don't |
424 // support partial painting. | 417 // support partial painting. |
425 Widget* widget = GetWidget(); | 418 Widget* widget = GetWidget(); |
426 if (widget) | 419 if (widget) |
427 widget->SchedulePaintInRect(widget->GetRootView()->bounds()); | 420 widget->SchedulePaintInRect(widget->GetRootView()->bounds()); |
428 } | 421 } |
429 #endif | |
430 } | 422 } |
431 } | 423 } |
432 | 424 |
433 void View::SetPaintToTexture(bool value) { | 425 void View::SetPaintToTexture(bool value) { |
434 #if defined(COMPOSITOR_2) | |
435 if (value == paint_to_texture_) | 426 if (value == paint_to_texture_) |
436 return; | 427 return; |
437 | 428 |
438 paint_to_texture_ = value; | 429 paint_to_texture_ = value; |
439 if (!ShouldPaintToTexture()) | 430 if (!ShouldPaintToTexture()) |
440 texture_.reset(); | 431 texture_.reset(); |
441 #endif | |
442 } | 432 } |
443 | 433 |
444 // RTL positioning ------------------------------------------------------------- | 434 // RTL positioning ------------------------------------------------------------- |
445 | 435 |
446 gfx::Rect View::GetMirroredBounds() const { | 436 gfx::Rect View::GetMirroredBounds() const { |
447 gfx::Rect bounds(bounds_); | 437 gfx::Rect bounds(bounds_); |
448 bounds.set_x(GetMirroredX()); | 438 bounds.set_x(GetMirroredX()); |
449 return bounds; | 439 return bounds; |
450 } | 440 } |
451 | 441 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // Painting -------------------------------------------------------------------- | 613 // Painting -------------------------------------------------------------------- |
624 | 614 |
625 void View::SchedulePaint() { | 615 void View::SchedulePaint() { |
626 SchedulePaintInRect(GetLocalBounds()); | 616 SchedulePaintInRect(GetLocalBounds()); |
627 } | 617 } |
628 | 618 |
629 void View::SchedulePaintInRect(const gfx::Rect& rect) { | 619 void View::SchedulePaintInRect(const gfx::Rect& rect) { |
630 if (!IsVisible()) | 620 if (!IsVisible()) |
631 return; | 621 return; |
632 | 622 |
633 #if defined(COMPOSITOR_2) | |
634 MarkTextureDirty(); | 623 MarkTextureDirty(); |
635 SchedulePaintInternal(rect); | 624 SchedulePaintInternal(rect); |
636 #else | |
637 if (parent_) { | |
638 // Translate the requested paint rect to the parent's coordinate system | |
639 // then pass this notification up to the parent. | |
640 gfx::Rect paint_rect = ConvertRectToParent(rect); | |
641 paint_rect.Offset(GetMirroredPosition()); | |
642 parent_->SchedulePaintInRect(paint_rect); | |
643 } | |
644 #endif | |
645 } | 625 } |
646 | 626 |
647 void View::Paint(gfx::Canvas* canvas) { | 627 void View::Paint(gfx::Canvas* canvas) { |
648 if (!IsVisible()) | 628 if (!IsVisible()) |
649 return; | 629 return; |
650 | 630 |
651 ScopedCanvas scoped_canvas(NULL); | 631 ScopedCanvas scoped_canvas(NULL); |
652 scoped_ptr<gfx::Canvas> texture_canvas; | 632 scoped_ptr<gfx::Canvas> texture_canvas; |
653 gfx::Rect texture_rect; | 633 gfx::Rect texture_rect; |
654 | 634 |
655 #if !defined(COMPOSITOR_2) | |
656 if (use_acceleration_when_possible && | |
657 transform_.get() && transform_->HasChange()) { | |
658 // This view has a transformation. So this maintains its own canvas. | |
659 if (!canvas_.get()) | |
660 canvas_.reset(gfx::Canvas::CreateCanvas(width(), height(), false)); | |
661 #else | |
662 if (ShouldPaintToTexture()) { | 635 if (ShouldPaintToTexture()) { |
663 gfx::Rect dirty_rect; | 636 gfx::Rect dirty_rect; |
664 if (!texture_clip_rect_.IsEmpty()) { | 637 if (!texture_clip_rect_.IsEmpty()) { |
665 dirty_rect = texture_clip_rect_; | 638 dirty_rect = texture_clip_rect_; |
666 } else { | 639 } else { |
667 // TODO: clip against dirty rect of canvas (if canvas is non-null). | 640 // TODO: clip against dirty rect of canvas (if canvas is non-null). |
668 dirty_rect = gfx::Rect(0, 0, width(), height()); | 641 dirty_rect = gfx::Rect(0, 0, width(), height()); |
669 } | 642 } |
670 if (dirty_rect.IsEmpty()) | 643 if (dirty_rect.IsEmpty()) |
671 return; | 644 return; |
(...skipping 10 matching lines...) Expand all Loading... |
682 return; | 655 return; |
683 } | 656 } |
684 | 657 |
685 texture_canvas.reset(gfx::Canvas::CreateCanvas(dirty_rect.width(), | 658 texture_canvas.reset(gfx::Canvas::CreateCanvas(dirty_rect.width(), |
686 dirty_rect.height(), false)); | 659 dirty_rect.height(), false)); |
687 texture_canvas->AsCanvasSkia()->drawColor( | 660 texture_canvas->AsCanvasSkia()->drawColor( |
688 SK_ColorBLACK, SkXfermode::kClear_Mode); | 661 SK_ColorBLACK, SkXfermode::kClear_Mode); |
689 texture_canvas->TranslateInt(-dirty_rect.x(), -dirty_rect.y()); | 662 texture_canvas->TranslateInt(-dirty_rect.x(), -dirty_rect.y()); |
690 canvas = texture_canvas.get(); | 663 canvas = texture_canvas.get(); |
691 texture_rect = dirty_rect; | 664 texture_rect = dirty_rect; |
692 #endif | |
693 } else { | 665 } else { |
694 // We're going to modify the canvas, save its state first. | 666 // We're going to modify the canvas, save its state first. |
695 scoped_canvas.SetCanvas(canvas); | 667 scoped_canvas.SetCanvas(canvas); |
696 | 668 |
697 // Paint this View and its children, setting the clip rect to the bounds | 669 // Paint this View and its children, setting the clip rect to the bounds |
698 // of this View and translating the origin to the local bounds' top left | 670 // of this View and translating the origin to the local bounds' top left |
699 // point. | 671 // point. |
700 // | 672 // |
701 // Note that the X (or left) position we pass to ClipRectInt takes into | 673 // Note that the X (or left) position we pass to ClipRectInt takes into |
702 // consideration whether or not the view uses a right-to-left layout so that | 674 // consideration whether or not the view uses a right-to-left layout so that |
(...skipping 22 matching lines...) Expand all Loading... |
725 if (FlipCanvasOnPaintForRTLUI()) { | 697 if (FlipCanvasOnPaintForRTLUI()) { |
726 canvas->TranslateInt(width(), 0); | 698 canvas->TranslateInt(width(), 0); |
727 canvas->ScaleInt(-1, 1); | 699 canvas->ScaleInt(-1, 1); |
728 } | 700 } |
729 | 701 |
730 OnPaint(canvas); | 702 OnPaint(canvas); |
731 } | 703 } |
732 | 704 |
733 PaintChildren(canvas); | 705 PaintChildren(canvas); |
734 | 706 |
735 #if !defined(COMPOSITOR_2) | |
736 if (canvas == canvas_.get()) { | |
737 texture_id_ = canvas->GetTextureID(); | |
738 | |
739 // TODO(sadrul): Make sure the Widget's compositor tree updates itself? | |
740 } | |
741 #else | |
742 if (texture_canvas.get()) { | 707 if (texture_canvas.get()) { |
743 texture_->SetBitmap( | 708 texture_->SetBitmap( |
744 texture_canvas->AsCanvasSkia()->getDevice()->accessBitmap(false), | 709 texture_canvas->AsCanvasSkia()->getDevice()->accessBitmap(false), |
745 texture_rect.origin(), | 710 texture_rect.origin(), |
746 size()); | 711 size()); |
747 texture_needs_updating_ = false; | 712 texture_needs_updating_ = false; |
748 } | 713 } |
749 #endif | |
750 } | 714 } |
751 | 715 |
752 ThemeProvider* View::GetThemeProvider() const { | 716 ThemeProvider* View::GetThemeProvider() const { |
753 const Widget* widget = GetWidget(); | 717 const Widget* widget = GetWidget(); |
754 return widget ? widget->GetThemeProvider() : NULL; | 718 return widget ? widget->GetThemeProvider() : NULL; |
755 } | 719 } |
756 | 720 |
757 // Accelerated Painting -------------------------------------------------------- | 721 // Accelerated Painting -------------------------------------------------------- |
758 | 722 |
759 // static | 723 // static |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 border_->Paint(*this, canvas); | 1112 border_->Paint(*this, canvas); |
1149 } | 1113 } |
1150 | 1114 |
1151 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { | 1115 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { |
1152 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) | 1116 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) |
1153 canvas->DrawFocusRect(0, 0, width(), height()); | 1117 canvas->DrawFocusRect(0, 0, width(), height()); |
1154 } | 1118 } |
1155 | 1119 |
1156 // Accelerated Painting -------------------------------------------------------- | 1120 // Accelerated Painting -------------------------------------------------------- |
1157 | 1121 |
1158 #if !defined(COMPOSITOR_2) | |
1159 void View::PaintComposite(ui::Compositor* compositor) { | |
1160 compositor->SaveTransform(); | |
1161 | |
1162 // TODO(sad): Push a transform matrix for the offset and bounds of the view? | |
1163 if (texture_id_) | |
1164 compositor->DrawTextureWithTransform(texture_id_, GetTransform()); | |
1165 | |
1166 for (int i = 0, count = child_count(); i < count; ++i) { | |
1167 View* child = GetChildViewAt(i); | |
1168 child->PaintComposite(compositor); | |
1169 } | |
1170 | |
1171 compositor->RestoreTransform(); | |
1172 } | |
1173 #else | |
1174 void View::PaintComposite() { | 1122 void View::PaintComposite() { |
1175 if (!IsVisible()) | 1123 if (!IsVisible()) |
1176 return; | 1124 return; |
1177 | 1125 |
1178 if (texture_.get()) { | 1126 if (texture_.get()) { |
1179 OnWillCompositeTexture(); | 1127 OnWillCompositeTexture(); |
1180 ui::Transform transform; | 1128 ui::Transform transform; |
1181 GetTransformRelativeTo(NULL, &transform); | 1129 GetTransformRelativeTo(NULL, &transform); |
1182 texture_->Draw(transform); | 1130 texture_->Draw(transform); |
1183 } | 1131 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 child_dirty_rect.Offset(-child_view->x(), -child_view->y()); | 1171 child_dirty_rect.Offset(-child_view->x(), -child_view->y()); |
1224 GetChildViewAt(i)->PaintToTexture(child_dirty_rect); | 1172 GetChildViewAt(i)->PaintToTexture(child_dirty_rect); |
1225 } | 1173 } |
1226 } | 1174 } |
1227 } | 1175 } |
1228 } | 1176 } |
1229 | 1177 |
1230 void View::OnWillCompositeTexture() { | 1178 void View::OnWillCompositeTexture() { |
1231 } | 1179 } |
1232 | 1180 |
1233 #endif | |
1234 | |
1235 bool View::ShouldPaintToTexture() const { | 1181 bool View::ShouldPaintToTexture() const { |
1236 return use_acceleration_when_possible && | 1182 return use_acceleration_when_possible && |
1237 (paint_to_texture_ || (transform_.get() && transform_->HasChange())) && | 1183 (paint_to_texture_ || (transform_.get() && transform_->HasChange())) && |
1238 GetCompositor(); | 1184 GetCompositor(); |
1239 } | 1185 } |
1240 | 1186 |
1241 const ui::Compositor* View::GetCompositor() const { | 1187 const ui::Compositor* View::GetCompositor() const { |
1242 return parent_ ? parent_->GetCompositor() : NULL; | 1188 return parent_ ? parent_->GetCompositor() : NULL; |
1243 } | 1189 } |
1244 | 1190 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 | 1386 |
1441 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { | 1387 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { |
1442 if (is_visible) | 1388 if (is_visible) |
1443 RegisterPendingAccelerators(); | 1389 RegisterPendingAccelerators(); |
1444 else | 1390 else |
1445 UnregisterAccelerators(true); | 1391 UnregisterAccelerators(true); |
1446 VisibilityChanged(starting_from, is_visible); | 1392 VisibilityChanged(starting_from, is_visible); |
1447 } | 1393 } |
1448 | 1394 |
1449 void View::BoundsChanged(const gfx::Rect& previous_bounds) { | 1395 void View::BoundsChanged(const gfx::Rect& previous_bounds) { |
1450 #if !defined(COMPOSITOR_2) | |
1451 if (canvas_.get()) | |
1452 canvas_.reset(gfx::Canvas::CreateCanvas(width(), height(), false)); | |
1453 #endif | |
1454 | |
1455 if (IsVisible()) { | 1396 if (IsVisible()) { |
1456 if (parent_) { | 1397 if (parent_) { |
1457 // Paint the old bounds. | 1398 // Paint the old bounds. |
1458 if (base::i18n::IsRTL()) { | 1399 if (base::i18n::IsRTL()) { |
1459 gfx::Rect paint_rect = previous_bounds; | 1400 gfx::Rect paint_rect = previous_bounds; |
1460 paint_rect.set_x(parent()->GetMirroredXForRect(paint_rect)); | 1401 paint_rect.set_x(parent()->GetMirroredXForRect(paint_rect)); |
1461 parent_->SchedulePaintInRect(paint_rect); | 1402 parent_->SchedulePaintInRect(paint_rect); |
1462 } else { | 1403 } else { |
1463 parent_->SchedulePaintInRect(previous_bounds); | 1404 parent_->SchedulePaintInRect(previous_bounds); |
1464 } | 1405 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 bool View::ConvertPointFromAncestor(const View* ancestor, | 1550 bool View::ConvertPointFromAncestor(const View* ancestor, |
1610 gfx::Point* point) const { | 1551 gfx::Point* point) const { |
1611 ui::Transform trans; | 1552 ui::Transform trans; |
1612 bool result = GetTransformRelativeTo(ancestor, &trans); | 1553 bool result = GetTransformRelativeTo(ancestor, &trans); |
1613 trans.TransformPointReverse(point); | 1554 trans.TransformPointReverse(point); |
1614 return result; | 1555 return result; |
1615 } | 1556 } |
1616 | 1557 |
1617 // Accelerated painting -------------------------------------------------------- | 1558 // Accelerated painting -------------------------------------------------------- |
1618 | 1559 |
1619 #if defined(COMPOSITOR_2) | |
1620 void View::MarkTextureDirty() { | 1560 void View::MarkTextureDirty() { |
1621 View* owner = this; | 1561 View* owner = this; |
1622 while (!((owner->transform_.get() && owner->transform_->HasChange()) || | 1562 while (!((owner->transform_.get() && owner->transform_->HasChange()) || |
1623 owner->paint_to_texture_) && owner->parent()) | 1563 owner->paint_to_texture_) && owner->parent()) |
1624 owner = owner->parent(); | 1564 owner = owner->parent(); |
1625 owner->texture_needs_updating_ = true; | 1565 owner->texture_needs_updating_ = true; |
1626 } | 1566 } |
1627 #endif | |
1628 | 1567 |
1629 void View::ResetTexture() { | 1568 void View::ResetTexture() { |
1630 #if defined(COMPOSITOR_2) | |
1631 texture_.reset(); | 1569 texture_.reset(); |
1632 for (int i = child_count() - 1; i >= 0; --i) | 1570 for (int i = child_count() - 1; i >= 0; --i) |
1633 GetChildViewAt(i)->ResetTexture(); | 1571 GetChildViewAt(i)->ResetTexture(); |
1634 #endif | |
1635 } | 1572 } |
1636 | 1573 |
1637 // Input ----------------------------------------------------------------------- | 1574 // Input ----------------------------------------------------------------------- |
1638 | 1575 |
1639 bool View::ProcessMousePressed(const MouseEvent& event, DragInfo* drag_info) { | 1576 bool View::ProcessMousePressed(const MouseEvent& event, DragInfo* drag_info) { |
1640 const bool enabled = IsEnabled(); | 1577 const bool enabled = IsEnabled(); |
1641 int drag_operations = | 1578 int drag_operations = |
1642 (enabled && event.IsOnlyLeftMouseButton() && HitTest(event.location())) ? | 1579 (enabled && event.IsOnlyLeftMouseButton() && HitTest(event.location())) ? |
1643 GetDragOperations(event.location()) : 0; | 1580 GetDragOperations(event.location()) : 0; |
1644 ContextMenuController* context_menu_controller = event.IsRightMouseButton() ? | 1581 ContextMenuController* context_menu_controller = event.IsRightMouseButton() ? |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 | 1806 |
1870 // Information about current node. | 1807 // Information about current node. |
1871 snprintf(p, kMaxPointerStringLength, "%p", this); | 1808 snprintf(p, kMaxPointerStringLength, "%p", this); |
1872 result.append(" N"); | 1809 result.append(" N"); |
1873 result.append(p+2); | 1810 result.append(p+2); |
1874 result.append(" [label=\""); | 1811 result.append(" [label=\""); |
1875 result.append(GetClassName().substr(baseNameIndex).c_str()); | 1812 result.append(GetClassName().substr(baseNameIndex).c_str()); |
1876 result.append("\""); | 1813 result.append("\""); |
1877 if (!parent()) | 1814 if (!parent()) |
1878 result.append(", shape=box"); | 1815 result.append(", shape=box"); |
1879 #if defined(COMPOSITOR_2) | |
1880 if (texture_.get()) | 1816 if (texture_.get()) |
1881 #else | |
1882 if (canvas_.get()) | |
1883 #endif | |
1884 result.append(", color=green"); | 1817 result.append(", color=green"); |
1885 result.append("]\n"); | 1818 result.append("]\n"); |
1886 | 1819 |
1887 // Link to parent. | 1820 // Link to parent. |
1888 if (parent()) { | 1821 if (parent()) { |
1889 char pp[kMaxPointerStringLength]; | 1822 char pp[kMaxPointerStringLength]; |
1890 | 1823 |
1891 snprintf(pp, kMaxPointerStringLength, "%p", parent()); | 1824 snprintf(pp, kMaxPointerStringLength, "%p", parent()); |
1892 result.append(" N"); | 1825 result.append(" N"); |
1893 result.append(pp+2); | 1826 result.append(pp+2); |
1894 result.append(" -> N"); | 1827 result.append(" -> N"); |
1895 result.append(p+2); | 1828 result.append(p+2); |
1896 result.append("\n"); | 1829 result.append("\n"); |
1897 } | 1830 } |
1898 | 1831 |
1899 // Children. | 1832 // Children. |
1900 for (int i = 0, count = child_count(); i < count; ++i) | 1833 for (int i = 0, count = child_count(); i < count; ++i) |
1901 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 1834 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
1902 | 1835 |
1903 if (first) | 1836 if (first) |
1904 result.append("}\n"); | 1837 result.append("}\n"); |
1905 | 1838 |
1906 return result; | 1839 return result; |
1907 } | 1840 } |
1908 #endif | 1841 #endif |
1909 | 1842 |
1910 } // namespace views | 1843 } // namespace views |
OLD | NEW |