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