diff options
author | Nicolas Roard <nicolas@android.com> | 2010-02-25 14:41:12 +0000 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-02-25 15:38:20 +0000 |
commit | 770495626b08b5d06162c31be5eed944aea127cb (patch) | |
tree | 2740b5526e9235622c1e840b3bc9685f48de56d6 /WebCore | |
parent | 018ebadd40c8decb6e77414ecb31bc6e597b7d53 (diff) | |
download | external_webkit-770495626b08b5d06162c31be5eed944aea127cb.zip external_webkit-770495626b08b5d06162c31be5eed944aea127cb.tar.gz external_webkit-770495626b08b5d06162c31be5eed944aea127cb.tar.bz2 |
Fix the gap when using the IME (Bug:2453748)
The problem was that layers may have a different size than their corresponding element,
but we used the layer's size instead of the element's to compute the fixed position.
The fix asks for the element visible overflow size (needed, some children may be outside the bounds of the element itself).
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | 8 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 17 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.h | 12 |
3 files changed, 26 insertions, 11 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index be275a8..a72d31b 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -230,7 +230,13 @@ void GraphicsLayerAndroid::updateFixedPosition() top = convertLength(view->style()->top()); right = convertLength(view->style()->right()); bottom = convertLength(view->style()->bottom()); - m_contentLayer->setFixedPosition(left, top, right, bottom); + // We need to pass the size of the element to compute the final fixed + // position -- we can't use the layer's size as it could possibly differs. + // We also have to use the visible overflow and not just the size, + // as some child elements could be overflowing. + int w = view->rightVisibleOverflow() - view->leftVisibleOverflow(); + int h = view->bottomVisibleOverflow() - view->topVisibleOverflow(); + m_contentLayer->setFixedPosition(left, top, right, bottom, w, h); } } } diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 59533be..c21c9b3 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -85,6 +85,8 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_fixedTop = layer.m_fixedTop; m_fixedRight = layer.m_fixedRight; m_fixedBottom = layer.m_fixedBottom; + m_fixedWidth = layer.m_fixedWidth; + m_fixedHeight = layer.m_fixedHeight; m_recordingPicture = layer.m_recordingPicture; SkSafeRef(m_recordingPicture); @@ -282,12 +284,12 @@ void LayerAndroid::updatePositions(const SkRect& viewport) { if (m_fixedLeft.defined()) x = dx + m_fixedLeft.calcFloatValue(w); else if (m_fixedRight.defined()) - x = dx + w - m_fixedRight.calcFloatValue(w) - getSize().width(); + x = dx + w - m_fixedRight.calcFloatValue(w) - m_fixedWidth; if (m_fixedTop.defined()) y = dy + m_fixedTop.calcFloatValue(h); else if (m_fixedBottom.defined()) - y = dy + h - m_fixedBottom.calcFloatValue(h) - getSize().height(); + y = dy + h - m_fixedBottom.calcFloatValue(h) - m_fixedHeight; this->setPosition(x, y); matrix.reset(); @@ -306,13 +308,8 @@ void LayerAndroid::updatePositions(const SkRect& viewport) { // now apply it to our children int count = this->countChildren(); - if (count > 0) { - SkRect tmp = viewport; - // adjust the viewport by our (the parent) position - tmp.offset(-this->getPosition()); - for (int i = 0; i < count; i++) { - this->getChild(i)->updatePositions(tmp); - } + for (int i = 0; i < count; i++) { + this->getChild(i)->updatePositions(viewport); } } @@ -487,6 +484,8 @@ 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); + writeIntVal(file, indentLevel + 1, "fixedWidth", m_fixedWidth); + writeIntVal(file, indentLevel + 1, "fixedHeight", m_fixedHeight); if (countChildren()) { writeln(file, indentLevel + 1, "children = ["); diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 23c785f..83d728f 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -88,11 +88,18 @@ public: rect.offset(m_translation.fX, m_translation.fY); return rect; } - void setFixedPosition(SkLength left, SkLength top, SkLength right, SkLength bottom) { + void setFixedPosition(SkLength left, // CSS left property + SkLength top, // CSS top property + SkLength right, // CSS right property + SkLength bottom, // CSS 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_fixedWidth = width; + m_fixedHeight = height; m_isFixed = true; } @@ -160,6 +167,9 @@ private: SkLength m_fixedTop; SkLength m_fixedRight; SkLength m_fixedBottom; + int m_fixedWidth; + int m_fixedHeight; + SkPoint m_translation; SkPoint m_scale; SkScalar m_angleTransform; |