| 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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 ConvertPointFromWidget(dst, point); | 1709 ConvertPointFromWidget(dst, point); |
| 1709 } | 1710 } |
| 1710 } | 1711 } |
| 1711 } | 1712 } |
| 1712 | 1713 |
| 1713 bool View::ConvertPointForAncestor(const View* ancestor, | 1714 bool View::ConvertPointForAncestor(const View* ancestor, |
| 1714 gfx::Point* point) const { | 1715 gfx::Point* point) const { |
| 1715 ui::Transform trans; | 1716 ui::Transform trans; |
| 1716 // TODO(sad): Have some way of caching the transformation results. | 1717 // TODO(sad): Have some way of caching the transformation results. |
| 1717 bool result = GetTransformRelativeTo(ancestor, &trans); | 1718 bool result = GetTransformRelativeTo(ancestor, &trans); |
| 1718 trans.TransformPoint(point); | 1719 gfx::Point3f p(*point); |
| 1720 trans.TransformPoint(p); |
| 1721 *point = p.AsPoint(); |
| 1719 return result; | 1722 return result; |
| 1720 } | 1723 } |
| 1721 | 1724 |
| 1722 bool View::ConvertPointFromAncestor(const View* ancestor, | 1725 bool View::ConvertPointFromAncestor(const View* ancestor, |
| 1723 gfx::Point* point) const { | 1726 gfx::Point* point) const { |
| 1724 ui::Transform trans; | 1727 ui::Transform trans; |
| 1725 bool result = GetTransformRelativeTo(ancestor, &trans); | 1728 bool result = GetTransformRelativeTo(ancestor, &trans); |
| 1726 trans.TransformPointReverse(point); | 1729 gfx::Point3f p(*point); |
| 1730 trans.TransformPointReverse(p); |
| 1731 *point = p.AsPoint(); |
| 1727 return result; | 1732 return result; |
| 1728 } | 1733 } |
| 1729 | 1734 |
| 1730 // Accelerated painting -------------------------------------------------------- | 1735 // Accelerated painting -------------------------------------------------------- |
| 1731 | 1736 |
| 1732 bool View::ShouldPaintToLayer() const { | 1737 bool View::ShouldPaintToLayer() const { |
| 1733 return use_acceleration_when_possible && | 1738 return use_acceleration_when_possible && |
| 1734 layer_helper_.get() && layer_helper_->ShouldPaintToLayer(); | 1739 layer_helper_.get() && layer_helper_->ShouldPaintToLayer(); |
| 1735 } | 1740 } |
| 1736 | 1741 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 2054 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
| 2050 | 2055 |
| 2051 if (first) | 2056 if (first) |
| 2052 result.append("}\n"); | 2057 result.append("}\n"); |
| 2053 | 2058 |
| 2054 return result; | 2059 return result; |
| 2055 } | 2060 } |
| 2056 #endif | 2061 #endif |
| 2057 | 2062 |
| 2058 } // namespace views | 2063 } // namespace views |
| OLD | NEW |