| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef RenderGeometryMap_h | 26 #ifndef RenderGeometryMap_h |
| 27 #define RenderGeometryMap_h | 27 #define RenderGeometryMap_h |
| 28 | 28 |
| 29 #include "core/layout/LayoutObject.h" |
| 29 #include "core/rendering/RenderGeometryMapStep.h" | 30 #include "core/rendering/RenderGeometryMapStep.h" |
| 30 #include "core/rendering/RenderObject.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 LayoutLayerModelObject; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 LayoutLayerModelObject*)
const; |
| 62 FloatQuad mapToContainer(const FloatRect&, const LayoutLayerModelObject*) co
nst; | 62 FloatQuad mapToContainer(const FloatRect&, const LayoutLayerModelObject*) co
nst; |
| 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 RenderObject*, const LayoutLayerModelObjec
t* ancestorRenderer); | 67 void pushMappingsToAncestor(const LayoutObject*, const LayoutLayerModelObjec
t* ancestorRenderer); |
| 68 void popMappingsToAncestor(const LayoutLayerModelObject*); | 68 void popMappingsToAncestor(const LayoutLayerModelObject*); |
| 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 RenderObject*, 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 RenderObject*, 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 LayoutLayerModelObject* container
= 0) const; |
| 79 | 79 |
| 80 void stepInserted(const RenderGeometryMapStep&); | 80 void stepInserted(const RenderGeometryMapStep&); |
| 81 void stepRemoved(const RenderGeometryMapStep&); | 81 void stepRemoved(const RenderGeometryMapStep&); |
| 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; |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 #if ENABLE(ASSERT) | 91 #if ENABLE(ASSERT) |
| 92 bool isTopmostRenderView(const RenderObject* renderer) const; | 92 bool isTopmostRenderView(const LayoutObject* renderer) const; |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 typedef Vector<RenderGeometryMapStep, 32> RenderGeometryMapSteps; | 95 typedef Vector<RenderGeometryMapStep, 32> RenderGeometryMapSteps; |
| 96 | 96 |
| 97 size_t m_insertionPosition; | 97 size_t m_insertionPosition; |
| 98 int m_nonUniformStepsCount; | 98 int m_nonUniformStepsCount; |
| 99 int m_transformedStepsCount; | 99 int m_transformedStepsCount; |
| 100 int m_fixedStepsCount; | 100 int m_fixedStepsCount; |
| 101 RenderGeometryMapSteps m_mapping; | 101 RenderGeometryMapSteps 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 // RenderGeometryMap_h | 108 #endif // RenderGeometryMap_h |
| OLD | NEW |