diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-25 13:35:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-25 13:35:59 +0200 |
commit | 79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4 (patch) | |
tree | 0287b1a69d84492c901e8bc820e635e7133809a0 /Source/WebCore/rendering/RenderGeometryMap.cpp | |
parent | 682ab87480e7757346802ce7f54cfdbdfeb2339e (diff) | |
download | qtwebkit-79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4.tar.gz |
Imported WebKit commit c4b613825abd39ac739a47d7b4410468fcef66dc (http://svn.webkit.org/repository/webkit/trunk@121147)
New snapshot that includes Win32 debug build fix (use SVGAllInOne)
Diffstat (limited to 'Source/WebCore/rendering/RenderGeometryMap.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderGeometryMap.cpp | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/Source/WebCore/rendering/RenderGeometryMap.cpp b/Source/WebCore/rendering/RenderGeometryMap.cpp index 77e04855d..af19ba4e2 100644 --- a/Source/WebCore/rendering/RenderGeometryMap.cpp +++ b/Source/WebCore/rendering/RenderGeometryMap.cpp @@ -26,12 +26,13 @@ #include "config.h" #include "RenderGeometryMap.h" +#include "RenderLayer.h" #include "RenderView.h" #include "TransformState.h" +#include <wtf/TemporaryChange.h> namespace WebCore { - // Stores data about how to map from one renderer to its container. class RenderGeometryMapStep { WTF_MAKE_NONCOPYABLE(RenderGeometryMapStep); @@ -170,18 +171,33 @@ void RenderGeometryMap::mapToAbsolute(TransformState& transformState) const transformState.flatten(); } -void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, const RenderBoxModelObject* ancestor) +void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, const RenderBoxModelObject* ancestorRenderer) { - const RenderObject* currRenderer = renderer; - // We need to push mappings in reverse order here, so do insertions rather than appends. - m_insertionPosition = m_mapping.size(); - + TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size()); do { - currRenderer = currRenderer->pushMappingToContainer(ancestor, *this); - } while (currRenderer && currRenderer != ancestor); - - m_insertionPosition = notFound; + renderer = renderer->pushMappingToContainer(ancestorRenderer, *this); + } while (renderer && renderer != ancestorRenderer); +} + +void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const RenderLayer* ancestorLayer) +{ + const RenderObject* renderer = layer->renderer(); + + // The simple case can be handled fast in the layer tree. + bool canConvertInLayerTree = ancestorLayer && renderer->style()->position() != FixedPosition && !renderer->style()->isFlippedBlocksWritingMode(); + for (const RenderLayer* current = layer; current != ancestorLayer && canConvertInLayerTree; current = current->parent()) + canConvertInLayerTree = current->canUseConvertToLayerCoords(); + + if (canConvertInLayerTree) { + TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size()); + LayoutPoint layerOffset; + layer->convertToLayerCoords(ancestorLayer, layerOffset); + push(renderer, toLayoutSize(layerOffset), /*accumulatingTransform*/ true, /*isNonUniform*/ false, /*isFixedPosition*/ false, /*hasTransform*/ false); + return; + } + const RenderBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer->renderer() : 0; + pushMappingsToAncestor(renderer, ancestorRenderer); } void RenderGeometryMap::push(const RenderObject* renderer, const LayoutSize& offsetFromContainer, bool accumulatingTransform, bool isNonUniform, bool isFixedPosition, bool hasTransform) @@ -220,16 +236,22 @@ void RenderGeometryMap::pushView(const RenderView* view, const LayoutSize& scrol m_mapping.insert(m_insertionPosition, step.release()); } -void RenderGeometryMap::popMappingsToAncestor(const RenderBoxModelObject* ancestor) +void RenderGeometryMap::popMappingsToAncestor(const RenderBoxModelObject* ancestorRenderer) { ASSERT(m_mapping.size()); - while (m_mapping.size() && m_mapping.last()->m_renderer != ancestor) { + while (m_mapping.size() && m_mapping.last()->m_renderer != ancestorRenderer) { stepRemoved(*m_mapping.last().get()); m_mapping.removeLast(); } } +void RenderGeometryMap::popMappingsToAncestor(const RenderLayer* ancestorLayer) +{ + const RenderBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer->renderer() : 0; + popMappingsToAncestor(ancestorRenderer); +} + void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) { // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s |