summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics
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
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')
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp11
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp16
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.h12
3 files changed, 34 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 93469b0..7b479bf 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -241,7 +241,16 @@ void GraphicsLayerAndroid::updateFixedPosition()
int w = view->rightVisibleOverflow() - view->leftVisibleOverflow();
int h = view->bottomVisibleOverflow() - view->topVisibleOverflow();
- m_contentLayer->setFixedPosition(left, top, right, bottom, w, h);
+ SkLength marginLeft, marginTop, marginRight, marginBottom;
+ marginLeft = convertLength(view->style()->marginLeft());
+ marginTop = convertLength(view->style()->marginTop());
+ marginRight = convertLength(view->style()->marginRight());
+ marginBottom = convertLength(view->style()->marginBottom());
+
+ m_contentLayer->setFixedPosition(left, top, right, bottom,
+ marginLeft, marginTop,
+ marginRight, marginBottom,
+ w, h);
}
}
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);
diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h
index 247e902..b92f4ac 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/WebCore/platform/graphics/android/LayerAndroid.h
@@ -92,12 +92,20 @@ public:
SkLength top, // CSS top property
SkLength right, // CSS right property
SkLength bottom, // CSS bottom property
+ SkLength marginLeft, // CSS margin-left property
+ SkLength marginTop, // CSS margin-top property
+ SkLength marginRight, // CSS margin-right property
+ SkLength marginBottom, // CSS margin-bottom property
int width, // visible overflow width
int height) { // visible overflow height
m_fixedLeft = left;
m_fixedTop = top;
m_fixedRight = right;
m_fixedBottom = bottom;
+ m_fixedMarginLeft = marginLeft;
+ m_fixedMarginTop = marginTop;
+ m_fixedMarginRight = marginRight;
+ m_fixedMarginBottom = marginBottom;
m_fixedWidth = width;
m_fixedHeight = height;
m_isFixed = true;
@@ -173,6 +181,10 @@ private:
SkLength m_fixedTop;
SkLength m_fixedRight;
SkLength m_fixedBottom;
+ SkLength m_fixedMarginLeft;
+ SkLength m_fixedMarginTop;
+ SkLength m_fixedMarginRight;
+ SkLength m_fixedMarginBottom;
int m_fixedWidth;
int m_fixedHeight;