diff options
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 16 | ||||
-rw-r--r-- | WebCore/rendering/RenderBox.cpp | 4 | ||||
-rw-r--r-- | WebCore/rendering/RenderLayer.cpp | 25 | ||||
-rw-r--r-- | WebCore/rendering/RenderLayerCompositor.cpp | 2 |
4 files changed, 20 insertions, 27 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index c17a034..3b1743d 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -245,25 +245,25 @@ const LayerAndroid* LayerAndroid::find(int x, int y) const /////////////////////////////////////////////////////////////////////////////// -void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport) { - +void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport) +{ if (m_isFixed) { - float x = 0; - float y = 0; float w = viewport.width(); float h = viewport.height(); float dx = viewport.fLeft; float dy = viewport.fTop; + float x = dx; + float y = dy; if (m_fixedLeft.defined()) - x = dx + m_fixedLeft.calcFloatValue(w); + x += m_fixedLeft.calcFloatValue(w); else if (m_fixedRight.defined()) - x = dx + w - m_fixedRight.calcFloatValue(w) - m_fixedWidth; + x += w - m_fixedRight.calcFloatValue(w) - m_fixedWidth; if (m_fixedTop.defined()) - y = dy + m_fixedTop.calcFloatValue(h); + y += m_fixedTop.calcFloatValue(h); else if (m_fixedBottom.defined()) - y = dy + h - m_fixedBottom.calcFloatValue(h) - m_fixedHeight; + y += h - m_fixedBottom.calcFloatValue(h) - m_fixedHeight; this->setPosition(x, y); } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 722b772..91f72ed 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -1791,7 +1791,7 @@ void RenderBox::calcVerticalMargins() int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const { #ifdef ANDROID_FIXED_ELEMENTS - if (containingBlock->isRenderView()) { + if (style()->position() == FixedPosition && containingBlock->isRenderView()) { const RenderView* view = toRenderView(containingBlock); return PlatformBridge::screenWidth(view->frameView()); } @@ -1827,7 +1827,7 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const { #ifdef ANDROID_FIXED_ELEMENTS - if (containingBlock->isRenderView()) { + if (style()->position() == FixedPosition && containingBlock->isRenderView()) { const RenderView* view = toRenderView(containingBlock); return PlatformBridge::screenHeight(view->frameView()); } diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index db079c7..6dbb413 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -648,7 +648,16 @@ FloatPoint RenderLayer::perspectiveOrigin() const RenderLayer* RenderLayer::stackingContext() const { RenderLayer* layer = parent(); +#if ENABLE(COMPOSITED_FIXED_ELEMENTS) + // When using composited fixed elements, they are turned into a stacking + // context and we thus need to return them. + // We can simplify the while loop by using isStackingContext(); with + // composited fixed elements turned on, this will return true for them, + // and is otherwise equivalent to the replaced statements. + while (layer && !layer->renderer()->isRoot() && !layer->isStackingContext()) +#else while (layer && !layer->renderer()->isRenderView() && !layer->renderer()->isRoot() && layer->renderer()->style()->hasAutoZIndex()) +#endif layer = layer->parent(); return layer; } @@ -1039,22 +1048,6 @@ RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, int& xPos, i } } -#if ENABLE(COMPOSITED_FIXED_ELEMENTS) - // If fixed layers are composited, we need to look up for a parent layer - // that would be fixed, and compute the correct offset relative to it. - int intermediateX = 0; - int intermediateY = 0; - const RenderLayer* currLayer = this; - while ((currLayer = currLayer->parent())) { - if (currLayer->isComposited() && currLayer->isFixed()) { - xPos = x() + intermediateX; - yPos = y() + intermediateY; - return; - } - intermediateX += currLayer->x(); - intermediateY += currLayer->y(); - } -#endif RenderLayer* parentLayer; if (position == AbsolutePosition || position == FixedPosition) { diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index 2768461..b50148f 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -506,7 +506,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O #if ENABLE(COMPOSITED_FIXED_ELEMENTS) // If we are a fixed layer, signal it to our siblings if (layer->isFixed()) - compositingState.m_fixedSibling = true; + compositingState.m_fixedSibling = true; if (!willBeComposited && compositingState.m_fixedSibling) layer->setMustOverlapCompositedLayers(true); |