From a9fc241ad9f93bcec6abf9dd251c079ae8bbea12 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Wed, 17 Mar 2010 21:15:55 +0000 Subject: Fix click issues when using fixed elements. This CL also fix the positioning of a fixed layer when no position is defined, and also only use the screen to position only the fixed elements, not other types of positioned elements. Bug:2521087 The click issues were due to not returning the fixed element when looking for a parent stackingContext in RenderLayer::stackingContext(). This resulted in incorrect coordinates for the layers children of a fixed layer, that we then had to recompute in RenderLayer::convertToLayerCoords(), but this in turns was invaliding hit test detection... Fixed elements are now positioned relative to the screen instead of the virtual viewport (ANDROID_FIXED_ELEMENTS); but this was applying indiscriminantly to all positioned elements, absolute elements included. The CL modify RenderBox::containingBlockWidthForPositioned() and RenderBox::containingBlockHeightForPositioned() to only do this for fixed elements. Finally, fixed layers were wrongly positioned if the positions were not fully set (e.g. only setting top:0 but no left or right). The change to LayerAndroid::updateFixedLayersPositions() fixes this. Change-Id: I07a179dd631a2bc1a313e33ffcf69ef388ecb7ca --- WebCore/platform/graphics/android/LayerAndroid.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'WebCore/platform') 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); } -- cgit v1.1