OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "platform/geometry/LayoutSize.h" | 35 #include "platform/geometry/LayoutSize.h" |
36 #include "wtf/Allocator.h" | 36 #include "wtf/Allocator.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class PaintLayer; | 40 class PaintLayer; |
41 class LayoutBoxModelObject; | 41 class LayoutBoxModelObject; |
42 class TransformationMatrix; | 42 class TransformationMatrix; |
43 class TransformState; | 43 class TransformState; |
44 | 44 |
45 // Can be used while walking the layout tree to cache data about offsets and tra
nsforms. | 45 // Can be used while walking the layout tree to cache data about offsets and |
| 46 // transforms. |
46 class CORE_EXPORT LayoutGeometryMap { | 47 class CORE_EXPORT LayoutGeometryMap { |
47 DISALLOW_NEW(); | 48 DISALLOW_NEW(); |
48 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); | 49 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); |
49 | 50 |
50 public: | 51 public: |
51 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); | 52 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); |
52 ~LayoutGeometryMap(); | 53 ~LayoutGeometryMap(); |
53 | 54 |
54 MapCoordinatesFlags getMapCoordinatesFlags() const { | 55 MapCoordinatesFlags getMapCoordinatesFlags() const { |
55 return m_mapCoordinatesFlags; | 56 return m_mapCoordinatesFlags; |
56 } | 57 } |
57 | 58 |
58 FloatRect absoluteRect(const FloatRect& rect) const { | 59 FloatRect absoluteRect(const FloatRect& rect) const { |
59 return mapToAncestor(rect, 0).boundingBox(); | 60 return mapToAncestor(rect, 0).boundingBox(); |
60 } | 61 } |
61 | 62 |
62 // Map to an ancestor. Will assert that the ancestor has been pushed onto this
map. | 63 // Map to an ancestor. Will assert that the ancestor has been pushed onto this |
63 // A null ancestor maps through the LayoutView (including its scale transform,
if any). | 64 // map. A null ancestor maps through the LayoutView (including its scale |
64 // If the ancestor is the LayoutView, the scroll offset is applied, but not th
e scale. | 65 // transform, if any). If the ancestor is the LayoutView, the scroll offset is |
| 66 // applied, but not the scale. |
65 FloatQuad mapToAncestor(const FloatRect&, const LayoutBoxModelObject*) const; | 67 FloatQuad mapToAncestor(const FloatRect&, const LayoutBoxModelObject*) const; |
66 | 68 |
67 // Called by code walking the layout or layer trees. | 69 // Called by code walking the layout or layer trees. |
68 void pushMappingsToAncestor(const PaintLayer*, | 70 void pushMappingsToAncestor(const PaintLayer*, |
69 const PaintLayer* ancestorLayer); | 71 const PaintLayer* ancestorLayer); |
70 void popMappingsToAncestor(const PaintLayer*); | 72 void popMappingsToAncestor(const PaintLayer*); |
71 void pushMappingsToAncestor(const LayoutObject*, | 73 void pushMappingsToAncestor(const LayoutObject*, |
72 const LayoutBoxModelObject* ancestorLayoutObject); | 74 const LayoutBoxModelObject* ancestorLayoutObject); |
73 | 75 |
74 // The following methods should only be called by layoutObjects inside a call
to pushMappingsToAncestor(). | 76 // The following methods should only be called by layoutObjects inside a call |
| 77 // to pushMappingsToAncestor(). |
75 | 78 |
76 // Push geometry info between this layoutObject and some ancestor. The ancesto
r must be its container() or some | 79 // Push geometry info between this layoutObject and some ancestor. The |
77 // stacking context between the layoutObject and its container. | 80 // ancestor must be its container() or some stacking context between the |
| 81 // layoutObject and its container. |
78 void push(const LayoutObject*, | 82 void push(const LayoutObject*, |
79 const LayoutSize&, | 83 const LayoutSize&, |
80 GeometryInfoFlags = 0, | 84 GeometryInfoFlags = 0, |
81 LayoutSize offsetForFixedPosition = LayoutSize()); | 85 LayoutSize offsetForFixedPosition = LayoutSize()); |
82 void push(const LayoutObject*, | 86 void push(const LayoutObject*, |
83 const TransformationMatrix&, | 87 const TransformationMatrix&, |
84 GeometryInfoFlags = 0, | 88 GeometryInfoFlags = 0, |
85 LayoutSize offsetForFixedPosition = LayoutSize()); | 89 LayoutSize offsetForFixedPosition = LayoutSize()); |
86 | 90 |
87 private: | 91 private: |
(...skipping 23 matching lines...) Expand all Loading... |
111 int m_transformedStepsCount; | 115 int m_transformedStepsCount; |
112 int m_fixedStepsCount; | 116 int m_fixedStepsCount; |
113 LayoutGeometryMapSteps m_mapping; | 117 LayoutGeometryMapSteps m_mapping; |
114 LayoutSize m_accumulatedOffset; | 118 LayoutSize m_accumulatedOffset; |
115 MapCoordinatesFlags m_mapCoordinatesFlags; | 119 MapCoordinatesFlags m_mapCoordinatesFlags; |
116 }; | 120 }; |
117 | 121 |
118 } // namespace blink | 122 } // namespace blink |
119 | 123 |
120 #endif // LayoutGeometryMap_h | 124 #endif // LayoutGeometryMap_h |
OLD | NEW |