summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/layers
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-05-30 16:20:14 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-30 16:20:14 -0700
commitdb590796ce589844c92205685ffae83c86b168f0 (patch)
treecf18d80d13667556cd2afe2f0c1fb6449226b282 /Source/WebCore/platform/graphics/android/layers
parente4d0c1973ec857d1408499010dca9f6856cecdd1 (diff)
parent45c2747dcc0151ebf5a296118c2d3c8f69ab4f68 (diff)
downloadexternal_webkit-db590796ce589844c92205685ffae83c86b168f0.zip
external_webkit-db590796ce589844c92205685ffae83c86b168f0.tar.gz
external_webkit-db590796ce589844c92205685ffae83c86b168f0.tar.bz2
Merge "Minimize tearing for fixed element in single surface mode" into jb-dev
Diffstat (limited to 'Source/WebCore/platform/graphics/android/layers')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp16
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.h2
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 5021c57..82af3bf 100644
--- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
@@ -87,8 +87,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 906b1c1..293bbbc 100644
--- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
@@ -446,7 +446,8 @@ void LayerAndroid::updateLocalTransformAndClip(const TransformationMatrix& paren
void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentMatrix,
const FloatRect& clipping, float opacity,
- float scale, bool forceCalculation)
+ float scale, bool forceCalculation,
+ bool disableFixedElemUpdate)
{
m_scale = scale;
@@ -457,7 +458,7 @@ void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentM
forceCalculation |= isPositionFixed()
|| contentIsScrollable()
|| (m_animations.size() != 0);
-
+ forceCalculation &= !(disableFixedElemUpdate && isPositionFixed());
if (forceCalculation)
updateLocalTransformAndClip(parentMatrix, clipping);
@@ -488,7 +489,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 936ced0..c56d50a 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();