summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-05-23 12:55:51 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-05-23 12:55:51 -0700
commit712ed50fe05a3a450c7cba5c2904621e02213631 (patch)
tree8d5d1620821330feabf78680614308a74fa13414
parentb245689d67e467ee565d2594b3df73417ad1eb08 (diff)
parentf69d55a820e0b7b57af6a843880f5338a220b27c (diff)
downloadexternal_webkit-712ed50fe05a3a450c7cba5c2904621e02213631.zip
external_webkit-712ed50fe05a3a450c7cba5c2904621e02213631.tar.gz
external_webkit-712ed50fe05a3a450c7cba5c2904621e02213631.tar.bz2
am f69d55a8: am 635861a9: DO NOT MERGE:Fix position update
* commit 'f69d55a820e0b7b57af6a843880f5338a220b27c': DO NOT MERGE:Fix position update
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp17
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp16
2 files changed, 15 insertions, 18 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 4198608..ea95d6a 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -245,15 +245,14 @@ void GraphicsLayerAndroid::updateFixedPosition()
marginRight = convertLength(view->style()->marginRight());
marginBottom = convertLength(view->style()->marginBottom());
- // The layer can be bigger than the element we want to draw;
- // not only that, the layout rect of the element might also be
- // different from the visible rect of that element (i.e. the element
- // has a CSS shadow property -- the shadow is "outside" the element).
- // We thus need to:
- // 1/ get the size of the element (w,h), using the layoutOverflow rect
- // 2/ pass the current offset of the painting relative to the layer
- int w = view->rightLayoutOverflow() - view->leftLayoutOverflow();
- int h = view->bottomLayoutOverflow() - view->topLayoutOverflow();
+ // In order to compute the fixed element's position, we need the width
+ // and height of the element when bottom or right is defined.
+ // And here we should use the non-overflowed value, that means, the
+ // overflowed content (e.g. outset shadow) will not be counted into the
+ // width and height.
+ int w = view->width();
+ int h = view->height();
+
int paintingOffsetX = - offsetFromRenderer().width();
int paintingOffsetY = - offsetFromRenderer().height();
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index bf60d3b..4e3f55d 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -547,21 +547,19 @@ void LayerAndroid::updateFixedLayersPositions(SkRect viewport, LayerAndroid* par
float x = dx;
float y = dy;
- // It turns out that when it is 'auto', the webkit computation will
- // take one more factor into account, that is the original render
- // layer's X,Y, such that it will align well with the parent's layer.
+ // It turns out that when it is 'auto', we should use the webkit value
+ // from the original render layer's X,Y, that will take care of alignment
+ // with the parent's layer and fix Margin etc.
if (!(m_fixedLeft.defined() || m_fixedRight.defined()))
x += m_renderLayerPos.x();
-
- if (!(m_fixedTop.defined() || m_fixedBottom.defined()))
- y += m_renderLayerPos.y();
-
- if (m_fixedLeft.defined() || !m_fixedRight.defined())
+ else if (m_fixedLeft.defined() || !m_fixedRight.defined())
x += m_fixedMarginLeft.calcFloatValue(w) + m_fixedLeft.calcFloatValue(w) - m_fixedRect.fLeft;
else
x += w - m_fixedMarginRight.calcFloatValue(w) - m_fixedRight.calcFloatValue(w) - m_fixedRect.fRight;
- if (m_fixedTop.defined() || !m_fixedBottom.defined())
+ if (!(m_fixedTop.defined() || m_fixedBottom.defined()))
+ y += m_renderLayerPos.y();
+ else if (m_fixedTop.defined() || !m_fixedBottom.defined())
y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h) - m_fixedRect.fTop;
else
y += h - m_fixedMarginBottom.calcFloatValue(h) - m_fixedBottom.calcFloatValue(h) - m_fixedRect.fBottom;