diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-05-20 15:03:54 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-05-23 10:22:43 -0700 |
commit | 52e2557aeb8477967e97fd24f20f8f407a10fa15 (patch) | |
tree | 004ddd909e106697af3469c9849c854f798fd999 /Source/WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | 6e18829567040b5996966ce0676d8e0ab30e2904 (diff) | |
download | external_webkit-52e2557aeb8477967e97fd24f20f8f407a10fa15.zip external_webkit-52e2557aeb8477967e97fd24f20f8f407a10fa15.tar.gz external_webkit-52e2557aeb8477967e97fd24f20f8f407a10fa15.tar.bz2 |
Fix position update
We fixed two issues here.
First, when fixed left/right both undefined, the renderlayer position already
took the fix margin into consideration, so we don't need to compute that again.
Second, for compute the fix element's ViewRect, we just need the normal width,
not the overflow one.
bug:4440999
Change-Id: I664c64688a89579f0023288185772c61b01c7cc8
Diffstat (limited to 'Source/WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/android/LayerAndroid.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp index 7bef420..95ccedc 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -540,21 +540,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; |