| 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" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
| 14 #include "ui/base/accessibility/accessibility_types.h" | 14 #include "ui/base/accessibility/accessibility_types.h" |
| 15 #include "ui/base/dragdrop/drag_drop_types.h" | 15 #include "ui/base/dragdrop/drag_drop_types.h" |
| 16 #include "ui/gfx/canvas_skia.h" | 16 #include "ui/gfx/canvas_skia.h" |
| 17 #include "ui/gfx/compositor/compositor.h" | 17 #include "ui/gfx/compositor/compositor.h" |
| 18 #include "ui/gfx/compositor/layer.h" | 18 #include "ui/gfx/compositor/layer.h" |
| 19 #include "ui/gfx/path.h" | 19 #include "ui/gfx/path.h" |
| 20 #include "ui/gfx/point3.h" |
| 20 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 21 #include "views/background.h" | 22 #include "views/background.h" |
| 22 #include "views/context_menu_controller.h" | 23 #include "views/context_menu_controller.h" |
| 23 #include "views/drag_controller.h" | 24 #include "views/drag_controller.h" |
| 24 #include "views/layer_property_setter.h" | 25 #include "views/layer_property_setter.h" |
| 25 #include "views/layout/layout_manager.h" | 26 #include "views/layout/layout_manager.h" |
| 26 #include "views/views_delegate.h" | 27 #include "views/views_delegate.h" |
| 27 #include "views/widget/native_widget_private.h" | 28 #include "views/widget/native_widget_private.h" |
| 28 #include "views/widget/root_view.h" | 29 #include "views/widget/root_view.h" |
| 29 #include "views/widget/tooltip_manager.h" | 30 #include "views/widget/tooltip_manager.h" |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 ConvertPointFromWidget(dst, point); | 1617 ConvertPointFromWidget(dst, point); |
| 1617 } | 1618 } |
| 1618 } | 1619 } |
| 1619 } | 1620 } |
| 1620 | 1621 |
| 1621 bool View::ConvertPointForAncestor(const View* ancestor, | 1622 bool View::ConvertPointForAncestor(const View* ancestor, |
| 1622 gfx::Point* point) const { | 1623 gfx::Point* point) const { |
| 1623 ui::Transform trans; | 1624 ui::Transform trans; |
| 1624 // TODO(sad): Have some way of caching the transformation results. | 1625 // TODO(sad): Have some way of caching the transformation results. |
| 1625 bool result = GetTransformRelativeTo(ancestor, &trans); | 1626 bool result = GetTransformRelativeTo(ancestor, &trans); |
| 1626 trans.TransformPoint(point); | 1627 gfx::Point3f p(*point); |
| 1628 trans.TransformPoint(p); |
| 1629 *point = p.AsPoint(); |
| 1627 return result; | 1630 return result; |
| 1628 } | 1631 } |
| 1629 | 1632 |
| 1630 bool View::ConvertPointFromAncestor(const View* ancestor, | 1633 bool View::ConvertPointFromAncestor(const View* ancestor, |
| 1631 gfx::Point* point) const { | 1634 gfx::Point* point) const { |
| 1632 ui::Transform trans; | 1635 ui::Transform trans; |
| 1633 bool result = GetTransformRelativeTo(ancestor, &trans); | 1636 bool result = GetTransformRelativeTo(ancestor, &trans); |
| 1634 trans.TransformPointReverse(point); | 1637 gfx::Point3f p(*point); |
| 1638 trans.TransformPointReverse(p); |
| 1639 *point = p.AsPoint(); |
| 1635 return result; | 1640 return result; |
| 1636 } | 1641 } |
| 1637 | 1642 |
| 1638 // Accelerated painting -------------------------------------------------------- | 1643 // Accelerated painting -------------------------------------------------------- |
| 1639 | 1644 |
| 1640 bool View::ShouldPaintToLayer() const { | 1645 bool View::ShouldPaintToLayer() const { |
| 1641 return use_acceleration_when_possible && | 1646 return use_acceleration_when_possible && |
| 1642 (paint_to_layer_ || (transform_.get() && transform_->HasChange())); | 1647 (paint_to_layer_ || (transform_.get() && transform_->HasChange())); |
| 1643 } | 1648 } |
| 1644 | 1649 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 2022 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
| 2018 | 2023 |
| 2019 if (first) | 2024 if (first) |
| 2020 result.append("}\n"); | 2025 result.append("}\n"); |
| 2021 | 2026 |
| 2022 return result; | 2027 return result; |
| 2023 } | 2028 } |
| 2024 #endif | 2029 #endif |
| 2025 | 2030 |
| 2026 } // namespace views | 2031 } // namespace views |
| OLD | NEW |