diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-05-30 10:19:21 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-05-30 15:21:34 -0700 |
commit | 45c2747dcc0151ebf5a296118c2d3c8f69ab4f68 (patch) | |
tree | cc9992fe8397395e6338334f6f23a00490183c3e /Source/WebCore/platform/graphics/android/layers | |
parent | 86ba073431c8ddf2e9d1f2d5d4f89157dd32ec33 (diff) | |
download | external_webkit-45c2747dcc0151ebf5a296118c2d3c8f69ab4f68.zip external_webkit-45c2747dcc0151ebf5a296118c2d3c8f69ab4f68.tar.gz external_webkit-45c2747dcc0151ebf5a296118c2d3c8f69ab4f68.tar.bz2 |
Minimize tearing for fixed element in single surface mode
bug:5683630
Change-Id: I43f738f2649a79b4ad7865ed27375c07195fa9b9
Diffstat (limited to 'Source/WebCore/platform/graphics/android/layers')
3 files changed, 21 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp index f03a140..511261e 100644 --- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp @@ -86,8 +86,20 @@ void BaseLayerAndroid::updatePositionsRecursive(const SkRect& visibleContentRect FloatRect clip(0, 0, getWidth(), getHeight()); bool forcePositionCalculation = !m_positionsCalculated; - float scale = state() ? state()->scale() : 1.0f; - updateGLPositionsAndScale(ident, clip, 1, scale, forcePositionCalculation); + float scale = 1.0f; + // To minimize tearing in single surface mode, don't update the fixed element + // when scrolling. The fixed element will move incorrectly when scrolling, + // but its position will be corrected after scrolling. + bool disableFixedElemUpdate = false; + GLWebViewState* webViewState = state(); + if (webViewState) { + scale = webViewState->scale(); + disableFixedElemUpdate = webViewState->isScrolling() + && webViewState->isSingleSurfaceRenderingMode(); + } + updateGLPositionsAndScale(ident, clip, 1, scale, forcePositionCalculation, + disableFixedElemUpdate); + m_positionsCalculated = true; } diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp index 18f65c7..bca1614 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp @@ -461,13 +461,14 @@ void LayerAndroid::updateLocalGLPositionsAndScale(const TransformationMatrix& pa void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentMatrix, const FloatRect& clipping, float opacity, - float scale, bool forceCalculation) + float scale, bool forceCalculation, + bool disableFixedElemUpdate) { // constantly recalculate the draw transform of layers that may require it (and their children) forceCalculation |= isPositionFixed() || contentIsScrollable() || (m_animations.size() != 0); - + forceCalculation &= !(disableFixedElemUpdate && isPositionFixed()); if (forceCalculation) updateLocalGLPositionsAndScale(parentMatrix, clipping, opacity, scale); @@ -498,7 +499,9 @@ void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentM childMatrix.translate(-getSize().width() * 0.5f, -getSize().height() * 0.5f); } for (int i = 0; i < countChildren(); i++) - this->getChild(i)->updateGLPositionsAndScale(childMatrix, drawClip(), opacity, scale, forceCalculation); + this->getChild(i)->updateGLPositionsAndScale(childMatrix, drawClip(), + opacity, scale, forceCalculation, + disableFixedElemUpdate); } bool LayerAndroid::visible() { diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h index cd26356..fbd0aa5 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h @@ -156,7 +156,7 @@ public: void updateGLPositionsAndScale(const TransformationMatrix& parentMatrix, const FloatRect& clip, float opacity, float scale, - bool forceCalculations); + bool forceCalculations, bool disableFixedElemUpdate); void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } float drawOpacity() { return m_drawOpacity; } bool visible(); |