diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-01-25 11:17:58 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-01-25 15:34:04 -0800 |
commit | 71895be64040f1060c51740c999a3747372d3c35 (patch) | |
tree | a623c3fbb121648ad57820862946ed8598dd9cf3 /WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | 910f5a48958d69024b9a6f390181b8b3643fc41b (diff) | |
download | external_webkit-71895be64040f1060c51740c999a3747372d3c35.zip external_webkit-71895be64040f1060c51740c999a3747372d3c35.tar.gz external_webkit-71895be64040f1060c51740c999a3747372d3c35.tar.bz2 |
Auto fixed element positioning fix
Webkit is using the transformation to compute the fixed element position.
In order to simulate that, we need the Render Layer's position info.
bug:3368857
Change-Id: If15c43f76bd528b2e67ac5035c8ba4a0c803e812
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 6426716..2f55292 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -101,7 +101,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_isFixed = layer.m_isFixed; m_contentsImage = layer.m_contentsImage; m_contentsImage->safeRef(); - + m_renderLayerPos = layer.m_renderLayerPos; m_transform = layer.m_transform; m_backgroundColor = layer.m_backgroundColor; @@ -462,17 +462,20 @@ void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport) float x = dx; float y = dy; - // Not defined corresponds to 'auto'; - // If both left and right are auto, the w3c says we should set left - // to zero (in left-to-right layout). So we use left if it's defined - // or if right isn't defined. + // 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. + 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()) 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; - // Following the same reason as above, if bottom isn't defined, we apply - // top regardless of it being defined or not. if (m_fixedTop.defined() || !m_fixedBottom.defined()) y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h) - m_fixedRect.fTop; else |