diff options
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | 3 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 17 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.h | 6 |
3 files changed, 18 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index d370f33..ab0e0ea 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -257,10 +257,11 @@ void GraphicsLayerAndroid::updateFixedPosition() SkRect viewRect; viewRect.set(paintingOffsetX, paintingOffsetY, paintingOffsetX + w, paintingOffsetY + h); - + IntPoint renderLayerPos(renderLayer->x(), renderLayer->y()); m_contentLayer->setFixedPosition(left, top, right, bottom, marginLeft, marginTop, marginRight, marginBottom, + renderLayerPos, viewRect); } } 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 diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 72eba0f..bb91755 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -138,6 +138,7 @@ public: SkLength marginTop, // CSS margin-top property SkLength marginRight, // CSS margin-right property SkLength marginBottom, // CSS margin-bottom property + const IntPoint& renderLayerPos, // For undefined fixed position SkRect viewRect) { // view rect, can be smaller than the layer's m_fixedLeft = left; m_fixedTop = top; @@ -149,6 +150,7 @@ public: m_fixedMarginBottom = marginBottom; m_fixedRect = viewRect; m_isFixed = true; + m_renderLayerPos = renderLayerPos; setInheritFromRootTransform(true); } @@ -259,6 +261,10 @@ private: SkLength m_fixedMarginBottom; SkRect m_fixedRect; + // When fixed element is undefined or auto, the render layer's position + // is needed for offset computation + IntPoint m_renderLayerPos; + TransformationMatrix m_transform; SkColor m_backgroundColor; |