| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/rendering/RenderGeometryMapStep.h" | 29 #include "core/rendering/RenderGeometryMapStep.h" |
| 30 #include "core/rendering/RenderObject.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 RenderLayer; | 39 class Layer; |
| 40 class RenderLayerModelObject; | 40 class LayoutLayerModelObject; |
| 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 RenderGeometryMap { | 45 class RenderGeometryMap { |
| 46 WTF_MAKE_NONCOPYABLE(RenderGeometryMap); | 46 WTF_MAKE_NONCOPYABLE(RenderGeometryMap); |
| 47 public: | 47 public: |
| 48 RenderGeometryMap(MapCoordinatesFlags = UseTransforms); | 48 RenderGeometryMap(MapCoordinatesFlags = UseTransforms); |
| 49 ~RenderGeometryMap(); | 49 ~RenderGeometryMap(); |
| 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 RenderLayerModelObject*)
const; | 61 FloatPoint mapToContainer(const FloatPoint&, const LayoutLayerModelObject*)
const; |
| 62 FloatQuad mapToContainer(const FloatRect&, const RenderLayerModelObject*) 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 RenderLayer*, const RenderLayer* ancestorL
ayer); | 65 void pushMappingsToAncestor(const Layer*, const Layer* ancestorLayer); |
| 66 void popMappingsToAncestor(const RenderLayer*); | 66 void popMappingsToAncestor(const Layer*); |
| 67 void pushMappingsToAncestor(const RenderObject*, const RenderLayerModelObjec
t* ancestorRenderer); | 67 void pushMappingsToAncestor(const RenderObject*, const LayoutLayerModelObjec
t* ancestorRenderer); |
| 68 void popMappingsToAncestor(const RenderLayerModelObject*); | 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 RenderObject*, 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 RenderObject*, 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 RenderLayerModelObject* 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; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 |