summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/LayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2010-03-18 16:35:27 +0000
committerNicolas Roard <nicolas@android.com>2010-03-18 16:35:33 +0000
commit7837e47a7dd5a9e6c0767f9241ad41b4974d6928 (patch)
treebf426bd85ffe8266eb0c64bb180008e5ff7f79a5 /WebCore/platform/graphics/android/LayerAndroid.cpp
parente0fca347261f7ab360fe07334de774af17209646 (diff)
downloadexternal_webkit-7837e47a7dd5a9e6c0767f9241ad41b4974d6928.zip
external_webkit-7837e47a7dd5a9e6c0767f9241ad41b4974d6928.tar.gz
external_webkit-7837e47a7dd5a9e6c0767f9241ad41b4974d6928.tar.bz2
Implement margin for fixed elements.
Last missing piece to fix Bug:2252505 Billmonk.com uses a centered fixed element with negative margins, and we were not accounting for those... Accounting for the margins move the fixed layer at the same place than webkit think it is, and therefore clicks do work. Change-Id: I6a736d06273df7d2bbc597c17ce042aa8b75b4e2
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 3b1743d..bfb086c 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -79,6 +79,10 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer),
m_fixedTop = layer.m_fixedTop;
m_fixedRight = layer.m_fixedRight;
m_fixedBottom = layer.m_fixedBottom;
+ m_fixedMarginLeft = layer.m_fixedMarginLeft;
+ m_fixedMarginTop = layer.m_fixedMarginTop;
+ m_fixedMarginRight = layer.m_fixedMarginRight;
+ m_fixedMarginBottom = layer.m_fixedMarginBottom;
m_fixedWidth = layer.m_fixedWidth;
m_fixedHeight = layer.m_fixedHeight;
@@ -256,14 +260,14 @@ void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport)
float y = dy;
if (m_fixedLeft.defined())
- x += m_fixedLeft.calcFloatValue(w);
+ x += m_fixedMarginLeft.calcFloatValue(w) + m_fixedLeft.calcFloatValue(w);
else if (m_fixedRight.defined())
- x += w - m_fixedRight.calcFloatValue(w) - m_fixedWidth;
+ x += w - m_fixedMarginRight.calcFloatValue(w) - m_fixedRight.calcFloatValue(w) - m_fixedWidth;
if (m_fixedTop.defined())
- y += m_fixedTop.calcFloatValue(h);
+ y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h);
else if (m_fixedBottom.defined())
- y += h - m_fixedBottom.calcFloatValue(h) - m_fixedHeight;
+ y += h - m_fixedMarginBottom.calcFloatValue(h) - m_fixedBottom.calcFloatValue(h) - m_fixedHeight;
this->setPosition(x, y);
}
@@ -492,6 +496,10 @@ void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const
writeLength(file, indentLevel + 1, "fixedTop", m_fixedTop);
writeLength(file, indentLevel + 1, "fixedRight", m_fixedRight);
writeLength(file, indentLevel + 1, "fixedBottom", m_fixedBottom);
+ writeLength(file, indentLevel + 1, "fixedMarginLeft", m_fixedMarginLeft);
+ writeLength(file, indentLevel + 1, "fixedMarginTop", m_fixedMarginTop);
+ writeLength(file, indentLevel + 1, "fixedMarginRight", m_fixedMarginRight);
+ writeLength(file, indentLevel + 1, "fixedMarginBottom", m_fixedMarginBottom);
writeIntVal(file, indentLevel + 1, "fixedWidth", m_fixedWidth);
writeIntVal(file, indentLevel + 1, "fixedHeight", m_fixedHeight);