diff options
author | Nicolas Roard <nicolas@android.com> | 2010-05-13 17:31:19 -0700 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-05-13 17:32:09 -0700 |
commit | 4ff1d8891d520763f17675827154340c7c740f90 (patch) | |
tree | 0b8d098a62ab2e148e1ea9541c403a6975e656ed /WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | 86644d6de5fbc08f13d386210ff951d53cdefa5b (diff) | |
download | external_webkit-4ff1d8891d520763f17675827154340c7c740f90.zip external_webkit-4ff1d8891d520763f17675827154340c7c740f90.tar.gz external_webkit-4ff1d8891d520763f17675827154340c7c740f90.tar.bz2 |
Fix a CSS position: fixed problem, where we were not using left or top if nothing was defined
Change-Id: Ib9f5b473cbda0518e332332cdc1c515652150a8c
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 7c3f5d4..2f10d33 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -282,15 +282,21 @@ void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport) SkRect layerRect = computeLayerRect(this); - if (m_fixedLeft.defined()) - x += m_fixedMarginLeft.calcFloatValue(w) + m_fixedLeft.calcFloatValue(w) - layerRect.fLeft; - else if (m_fixedRight.defined()) + // Not defined corresponds to 'auto'; + // so if right is auto, and left is auto, the w3c says we should set + // left to zero (in left-to-right layout). So basically, if right is not + // defined, we always apply auto. + if (m_fixedRight.defined()) x += w - m_fixedMarginRight.calcFloatValue(w) - m_fixedRight.calcFloatValue(w) - layerRect.width(); + else + x += m_fixedMarginLeft.calcFloatValue(w) + m_fixedLeft.calcFloatValue(w) - layerRect.fLeft; - if (m_fixedTop.defined()) - y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h) - layerRect.fTop; - else if (m_fixedBottom.defined()) + // Following the same reason as above, if bottom isn't defined, we apply + // top regardless of it being defined or not. + if (m_fixedBottom.defined()) y += h - m_fixedMarginBottom.calcFloatValue(h) - m_fixedBottom.calcFloatValue(h) - layerRect.fTop - layerRect.height(); + else + y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h) - layerRect.fTop; this->setPosition(x, y); } |