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 19 matching lines...) Expand all Loading... |
30 #include "core/layout/LayoutObject.h" | 30 #include "core/layout/LayoutObject.h" |
31 #include "platform/geometry/FloatPoint.h" | 31 #include "platform/geometry/FloatPoint.h" |
32 #include "platform/geometry/FloatQuad.h" | 32 #include "platform/geometry/FloatQuad.h" |
33 #include "platform/geometry/IntSize.h" | 33 #include "platform/geometry/IntSize.h" |
34 #include "platform/geometry/LayoutSize.h" | 34 #include "platform/geometry/LayoutSize.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class Layer; | 39 class Layer; |
40 class LayoutLayerModelObject; | 40 class LayoutBoxModelObject; |
41 class TransformationMatrix; | 41 class TransformationMatrix; |
42 class TransformState; | 42 class TransformState; |
43 | 43 |
44 // Can be used while walking the Renderer tree to cache data about offsets and t
ransforms. | 44 // Can be used while walking the Renderer tree to cache data about offsets and t
ransforms. |
45 class LayoutGeometryMap { | 45 class LayoutGeometryMap { |
46 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); | 46 WTF_MAKE_NONCOPYABLE(LayoutGeometryMap); |
47 public: | 47 public: |
48 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); | 48 LayoutGeometryMap(MapCoordinatesFlags = UseTransforms); |
49 ~LayoutGeometryMap(); | 49 ~LayoutGeometryMap(); |
50 | 50 |
51 MapCoordinatesFlags mapCoordinatesFlags() const { return m_mapCoordinatesFla
gs; } | 51 MapCoordinatesFlags mapCoordinatesFlags() const { return m_mapCoordinatesFla
gs; } |
52 | 52 |
53 FloatRect absoluteRect(const FloatRect& rect) const | 53 FloatRect absoluteRect(const FloatRect& rect) const |
54 { | 54 { |
55 return mapToContainer(rect, 0).boundingBox(); | 55 return mapToContainer(rect, 0).boundingBox(); |
56 } | 56 } |
57 | 57 |
58 // Map to a container. Will assert that the container has been pushed onto t
his map. | 58 // Map to a container. Will assert that the container has been pushed onto t
his map. |
59 // A null container maps through the RenderView (including its scale transfo
rm, if any). | 59 // A null container maps through the RenderView (including its scale transfo
rm, if any). |
60 // If the container is the RenderView, the scroll offset is applied, but not
the scale. | 60 // If the container is the RenderView, the scroll offset is applied, but not
the scale. |
61 FloatPoint mapToContainer(const FloatPoint&, const LayoutLayerModelObject*)
const; | 61 FloatPoint mapToContainer(const FloatPoint&, const LayoutBoxModelObject*) co
nst; |
62 FloatQuad mapToContainer(const FloatRect&, const LayoutLayerModelObject*) co
nst; | 62 FloatQuad mapToContainer(const FloatRect&, const LayoutBoxModelObject*) cons
t; |
63 | 63 |
64 // Called by code walking the renderer or layer trees. | 64 // Called by code walking the renderer or layer trees. |
65 void pushMappingsToAncestor(const Layer*, const Layer* ancestorLayer); | 65 void pushMappingsToAncestor(const Layer*, const Layer* ancestorLayer); |
66 void popMappingsToAncestor(const Layer*); | 66 void popMappingsToAncestor(const Layer*); |
67 void pushMappingsToAncestor(const LayoutObject*, const LayoutLayerModelObjec
t* ancestorRenderer); | 67 void pushMappingsToAncestor(const LayoutObject*, const LayoutBoxModelObject*
ancestorRenderer); |
68 void popMappingsToAncestor(const LayoutLayerModelObject*); | 68 void popMappingsToAncestor(const LayoutBoxModelObject*); |
69 | 69 |
70 // The following methods should only be called by renderers inside a call to
pushMappingsToAncestor(). | 70 // The following methods should only be called by renderers inside a call to
pushMappingsToAncestor(). |
71 | 71 |
72 // Push geometry info between this renderer and some ancestor. The ancestor
must be its container() or some | 72 // Push geometry info between this renderer and some ancestor. The ancestor
must be its container() or some |
73 // stacking context between the renderer and its container. | 73 // stacking context between the renderer and its container. |
74 void push(const LayoutObject*, const LayoutSize&, bool accumulatingTransform
= false, bool isNonUniform = false, bool isFixedPosition = false, bool hasTrans
form = false, LayoutSize offsetForFixedPosition = LayoutSize()); | 74 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 TransformationMatrix&, bool accumulatin
gTransform = false, bool isNonUniform = false, bool isFixedPosition = false, boo
l hasTransform = false, LayoutSize offsetForFixedPosition = LayoutSize()); | 75 void push(const LayoutObject*, const TransformationMatrix&, bool accumulatin
gTransform = false, bool isNonUniform = false, bool isFixedPosition = false, boo
l hasTransform = false, LayoutSize offsetForFixedPosition = LayoutSize()); |
76 | 76 |
77 private: | 77 private: |
78 void mapToContainer(TransformState&, const LayoutLayerModelObject* container
= 0) const; | 78 void mapToContainer(TransformState&, const LayoutBoxModelObject* container =
0) const; |
79 | 79 |
80 void stepInserted(const LayoutGeometryMapStep&); | 80 void stepInserted(const LayoutGeometryMapStep&); |
81 void stepRemoved(const LayoutGeometryMapStep&); | 81 void stepRemoved(const LayoutGeometryMapStep&); |
82 | 82 |
83 bool hasNonUniformStep() const { return m_nonUniformStepsCount; } | 83 bool hasNonUniformStep() const { return m_nonUniformStepsCount; } |
84 bool hasTransformStep() const { return m_transformedStepsCount; } | 84 bool hasTransformStep() const { return m_transformedStepsCount; } |
85 bool hasFixedPositionStep() const { return m_fixedStepsCount; } | 85 bool hasFixedPositionStep() const { return m_fixedStepsCount; } |
86 | 86 |
87 #ifndef NDEBUG | 87 #ifndef NDEBUG |
88 void dumpSteps() const; | 88 void dumpSteps() const; |
(...skipping 10 matching lines...) Expand all Loading... |
99 int m_transformedStepsCount; | 99 int m_transformedStepsCount; |
100 int m_fixedStepsCount; | 100 int m_fixedStepsCount; |
101 LayoutGeometryMapSteps m_mapping; | 101 LayoutGeometryMapSteps m_mapping; |
102 LayoutSize m_accumulatedOffset; | 102 LayoutSize m_accumulatedOffset; |
103 MapCoordinatesFlags m_mapCoordinatesFlags; | 103 MapCoordinatesFlags m_mapCoordinatesFlags; |
104 }; | 104 }; |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
107 | 107 |
108 #endif // LayoutGeometryMap_h | 108 #endif // LayoutGeometryMap_h |
OLD | NEW |