summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-04-20 10:39:28 -0700
committerNicolas Roard <nicolasroard@google.com>2011-04-27 16:20:58 -0700
commit2d60bef786645e5b9e2da0e8374d3f06a40d0638 (patch)
tree58aadf31564fed16dd77e14ca0fed122f2c7ebfe
parent80e2925eccdb827184e288d20181bf186db9391b (diff)
downloadexternal_webkit-2d60bef786645e5b9e2da0e8374d3f06a40d0638.zip
external_webkit-2d60bef786645e5b9e2da0e8374d3f06a40d0638.tar.gz
external_webkit-2d60bef786645e5b9e2da0e8374d3f06a40d0638.tar.bz2
Fix clipping issues with layers
Fix remaining gmail/slate.com issues, embedded webview in apps, etc. bug:4303702 Change-Id: I3fb0e7b618d62d9d8baa096dad4fc4f0ad66cc1b
-rw-r--r--WebCore/platform/graphics/android/ShaderProgram.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/ShaderProgram.cpp b/WebCore/platform/graphics/android/ShaderProgram.cpp
index 74328a1..9e0a4ab 100644
--- a/WebCore/platform/graphics/android/ShaderProgram.cpp
+++ b/WebCore/platform/graphics/android/ShaderProgram.cpp
@@ -260,22 +260,17 @@ void ShaderProgram::setViewRect(const IntRect& viewRect)
TransformationMatrix translate;
translate.translate(1.0, 1.0);
- TransformationMatrix screenTranslate;
- screenTranslate.translate(-viewRect.x(), -viewRect.y());
-
TransformationMatrix scale;
scale.scale3d(m_viewRect.width() * 0.5f, m_viewRect.height() * 0.5f, 1);
m_documentToScreenMatrix = m_projectionMatrix;
m_documentToScreenMatrix.multiply(translate);
m_documentToScreenMatrix.multiply(scale);
- m_documentToScreenMatrix.multiply(screenTranslate);
m_documentToInvScreenMatrix = m_projectionMatrix;
translate.scale3d(1, -1, 1);
m_documentToInvScreenMatrix.multiply(translate);
m_documentToInvScreenMatrix.multiply(scale);
- m_documentToScreenMatrix.multiply(screenTranslate);
}
// This function transform a clip rect extracted from the current layer
@@ -337,6 +332,9 @@ void ShaderProgram::clip(const FloatRect& clip)
if (clip == m_clipRect)
return;
+ if (clip.width() == 0 && clip.height() == 0)
+ return;
+
// we should only call glScissor in this function, so that we can easily
// track the current clipping rect.
@@ -347,6 +345,20 @@ void ShaderProgram::clip(const FloatRect& clip)
if (!m_screenClip.isEmpty())
screenClip.intersect(m_screenClip);
+ screenClip.setY(screenClip.y() + m_viewRect.y());
+ if (screenClip.x() < 0) {
+ int w = screenClip.width();
+ w += screenClip.x();
+ screenClip.setX(0);
+ screenClip.setWidth(w);
+ }
+ if (screenClip.y() < 0) {
+ int h = screenClip.height();
+ h += screenClip.y();
+ screenClip.setY(0);
+ screenClip.setHeight(h);
+ }
+
glScissor(screenClip.x(), screenClip.y(), screenClip.width(), screenClip.height());
m_clipRect = clip;