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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DISALLOW_NEW(); | 48 DISALLOW_NEW(); |
49 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); | 49 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); |
50 public: | 50 public: |
51 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); | 51 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); |
52 ~LayoutGeometryMap(); | 52 ~LayoutGeometryMap(); |
53 | 53 |
54 MapCoordinatesFlags mapCoordinatesFlags() const { return m_mapCoordinatesFla
gs; } | 54 MapCoordinatesFlags mapCoordinatesFlags() const { return m_mapCoordinatesFla
gs; } |
55 | 55 |
56 FloatRect absoluteRect(const FloatRect& rect) const | 56 FloatRect absoluteRect(const FloatRect& rect) const |
57 { | 57 { |
58 return mapToContainer(rect, 0).boundingBox(); | 58 return mapToAncestor(rect, 0).boundingBox(); |
59 } | 59 } |
60 | 60 |
61 // Map to a container. Will assert that the container has been pushed onto t
his map. | 61 // Map to an ancestor. Will assert that the ancestor has been pushed onto th
is map. |
62 // A null container maps through the LayoutView (including its scale transfo
rm, if any). | 62 // A null ancestor maps through the LayoutView (including its scale transfor
m, if any). |
63 // If the container is the LayoutView, the scroll offset is applied, but not
the scale. | 63 // If the ancestor is the LayoutView, the scroll offset is applied, but not
the scale. |
64 FloatQuad mapToContainer(const FloatRect&, const LayoutBoxModelObject*) cons
t; | 64 FloatQuad mapToAncestor(const FloatRect&, const LayoutBoxModelObject*) const
; |
65 | 65 |
66 // Called by code walking the layout or layer trees. | 66 // Called by code walking the layout or layer trees. |
67 void pushMappingsToAncestor(const PaintLayer*, const PaintLayer* ancestorLay
er); | 67 void pushMappingsToAncestor(const PaintLayer*, const PaintLayer* ancestorLay
er); |
68 void popMappingsToAncestor(const PaintLayer*); | 68 void popMappingsToAncestor(const PaintLayer*); |
69 void pushMappingsToAncestor(const LayoutObject*, const LayoutBoxModelObject*
ancestorLayoutObject); | 69 void pushMappingsToAncestor(const LayoutObject*, const LayoutBoxModelObject*
ancestorLayoutObject); |
70 | 70 |
71 // The following methods should only be called by layoutObjects inside a cal
l to pushMappingsToAncestor(). | 71 // The following methods should only be called by layoutObjects inside a cal
l to pushMappingsToAncestor(). |
72 | 72 |
73 // Push geometry info between this layoutObject and some ancestor. The ances
tor must be its container() or some | 73 // Push geometry info between this layoutObject and some ancestor. The ances
tor must be its container() or some |
74 // stacking context between the layoutObject and its container. | 74 // stacking context between the layoutObject and its container. |
75 void push(const LayoutObject*, const LayoutSize&, bool accumulatingTransform
= false, bool isNonUniform = false, bool isFixedPosition = false, bool hasTrans
form = false, LayoutSize offsetForFixedPosition = LayoutSize()); | 75 void push(const LayoutObject*, const LayoutSize&, bool accumulatingTransform
= false, bool isNonUniform = false, bool isFixedPosition = false, bool hasTrans
form = false, LayoutSize offsetForFixedPosition = LayoutSize()); |
76 void push(const LayoutObject*, const TransformationMatrix&, bool accumulatin
gTransform = false, bool isNonUniform = false, bool isFixedPosition = false, boo
l hasTransform = false, LayoutSize offsetForFixedPosition = LayoutSize()); | 76 void push(const LayoutObject*, const TransformationMatrix&, bool accumulatin
gTransform = false, bool isNonUniform = false, bool isFixedPosition = false, boo
l hasTransform = false, LayoutSize offsetForFixedPosition = LayoutSize()); |
77 | 77 |
78 private: | 78 private: |
79 void popMappingsToAncestor(const LayoutBoxModelObject*); | 79 void popMappingsToAncestor(const LayoutBoxModelObject*); |
80 void mapToContainer(TransformState&, const LayoutBoxModelObject* container =
nullptr) const; | 80 void mapToAncestor(TransformState&, const LayoutBoxModelObject* ancestor = n
ullptr) const; |
81 | 81 |
82 void stepInserted(const LayoutGeometryMapStep&); | 82 void stepInserted(const LayoutGeometryMapStep&); |
83 void stepRemoved(const LayoutGeometryMapStep&); | 83 void stepRemoved(const LayoutGeometryMapStep&); |
84 | 84 |
85 bool hasNonUniformStep() const { return m_nonUniformStepsCount; } | 85 bool hasNonUniformStep() const { return m_nonUniformStepsCount; } |
86 bool hasTransformStep() const { return m_transformedStepsCount; } | 86 bool hasTransformStep() const { return m_transformedStepsCount; } |
87 bool hasFixedPositionStep() const { return m_fixedStepsCount; } | 87 bool hasFixedPositionStep() const { return m_fixedStepsCount; } |
88 | 88 |
89 #ifndef NDEBUG | 89 #ifndef NDEBUG |
90 void dumpSteps() const; | 90 void dumpSteps() const; |
(...skipping 10 matching lines...) Expand all Loading... |
101 int m_transformedStepsCount; | 101 int m_transformedStepsCount; |
102 int m_fixedStepsCount; | 102 int m_fixedStepsCount; |
103 LayoutGeometryMapSteps m_mapping; | 103 LayoutGeometryMapSteps m_mapping; |
104 LayoutSize m_accumulatedOffset; | 104 LayoutSize m_accumulatedOffset; |
105 MapCoordinatesFlags m_mapCoordinatesFlags; | 105 MapCoordinatesFlags m_mapCoordinatesFlags; |
106 }; | 106 }; |
107 | 107 |
108 } // namespace blink | 108 } // namespace blink |
109 | 109 |
110 #endif // LayoutGeometryMap_h | 110 #endif // LayoutGeometryMap_h |
OLD | NEW |