summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-08-18 11:47:41 -0700
committerNicolas Roard <nicolasroard@google.com>2011-08-18 15:20:34 -0700
commitf1ab740d0427ebb5c42b8b72fa3102b037a109f0 (patch)
treee131a6c4104445f3a6c6b1cfd6e79223dc381b1a /Source
parent11f051d74612aaf0dad2d78baf9e767ef16be62a (diff)
downloadexternal_webkit-f1ab740d0427ebb5c42b8b72fa3102b037a109f0.zip
external_webkit-f1ab740d0427ebb5c42b8b72fa3102b037a109f0.tar.gz
external_webkit-f1ab740d0427ebb5c42b8b72fa3102b037a109f0.tar.bz2
Fix repaint when we toggle the inverted mode
- add a boolean return in WebView::nativeSetProperty() - add an inverted flag in BaseTileTexture Note that we invert the textures rather than the final screen. bug:5167645 java counterpart: https://android-git.corp.google.com/g/#/c/129133/ Change-Id: I249e429dbabb347b1c5c0828ef4fad17ece6e4b3
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.h2
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp18
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.h13
-rw-r--r--Source/WebKit/android/nav/WebView.cpp7
6 files changed, 38 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
index 7e6a57d..7c6fb7a 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
@@ -255,6 +255,7 @@ void BaseTileTexture::setOwnTextureTileInfoFromQueue(const TextureTileInfo* info
m_ownTextureTileInfo.m_scale = info->m_scale;
m_ownTextureTileInfo.m_painter = info->m_painter;
m_ownTextureTileInfo.m_picture = info->m_picture;
+ m_ownTextureTileInfo.m_inverted = TilesManager::instance()->invertedScreen();
}
bool BaseTileTexture::readyFor(BaseTile* baseTile)
@@ -264,7 +265,8 @@ bool BaseTileTexture::readyFor(BaseTile* baseTile)
(info->m_x == baseTile->x()) &&
(info->m_y == baseTile->y()) &&
(info->m_scale == baseTile->scale()) &&
- (info->m_painter == baseTile->painter()))
+ (info->m_painter == baseTile->painter()) &&
+ (info->m_inverted == TilesManager::instance()->invertedScreen()))
return true;
XLOG("readyFor return false for tile x, y (%d %d) texId %d ,"
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.h b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
index b21659f..bc66195 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.h
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
@@ -48,6 +48,7 @@ public:
, m_texture(0)
, m_painter(0)
, m_picture(0)
+ , m_inverted(false)
{
}
int m_x;
@@ -57,6 +58,7 @@ public:
TextureInfo* m_texture;
TilePainter* m_painter;
unsigned int m_picture;
+ bool m_inverted;
};
// While in the queue, the BaseTile can be re-used, the updated bitmap
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index b7da291..4bc83ef 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -565,11 +565,21 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
SkSafeRef(compositedRoot);
SkSafeUnref(m_previouslyUsedRoot);
m_previouslyUsedRoot = compositedRoot;
+
+ ret |= TilesManager::instance()->invertedScreenSwitch();
+
if (ret) {
- if (m_frameworkInval.isEmpty()) {
- // ret==true && empty inval region means we've inval'd everything,
- // but don't have new content. Keep redrawing full view (0,0,0,0)
- // until tile generation catches up and we swap pages.
+ // ret==true && empty inval region means we've inval'd everything,
+ // but don't have new content. Keep redrawing full view (0,0,0,0)
+ // until tile generation catches up and we swap pages.
+ bool fullScreenInval = m_frameworkInval.isEmpty();
+
+ if (TilesManager::instance()->invertedScreenSwitch()) {
+ fullScreenInval = true;
+ TilesManager::instance()->setInvertedScreenSwitch(false);
+ }
+
+ if (fullScreenInval) {
invalRect->setX(0);
invalRect->setY(0);
invalRect->setWidth(0);
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index 3c160a2..bbed2fb 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -105,6 +105,7 @@ TilesManager::TilesManager()
, m_generatorReady(false)
, m_showVisualIndicator(false)
, m_invertedScreen(false)
+ , m_invertedScreenSwitch(false)
, m_drawRegistrationCount(0)
{
XLOG("TilesManager ctor");
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h
index e9f1571..c7a2381 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/TilesManager.h
@@ -150,11 +150,23 @@ public:
return m_invertedScreen;
}
+ bool invertedScreenSwitch()
+ {
+ return m_invertedScreenSwitch;
+ }
+
void setInvertedScreen(bool invert)
{
+ if (m_invertedScreen != invert)
+ m_invertedScreenSwitch = true;
m_invertedScreen = invert;
}
+ void setInvertedScreenSwitch(bool invertedSwitch)
+ {
+ m_invertedScreenSwitch = invertedSwitch;
+ }
+
void setInvertedScreenContrast(float contrast)
{
m_shader.setContrast(contrast);
@@ -187,6 +199,7 @@ private:
bool m_showVisualIndicator;
bool m_invertedScreen;
+ bool m_invertedScreenSwitch;
sp<TexturesGenerator> m_pixmapsGenerationThread;
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index c1cb95c..a9ae4a4 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -2517,7 +2517,7 @@ static void dumpToFile(const char text[], void* file) {
}
#endif
-static void nativeSetProperty(JNIEnv *env, jobject obj, jstring jkey, jstring jvalue)
+static bool nativeSetProperty(JNIEnv *env, jobject obj, jstring jkey, jstring jvalue)
{
WTF::String key = jstringToWtfString(env, jkey);
WTF::String value = jstringToWtfString(env, jvalue);
@@ -2526,11 +2526,14 @@ static void nativeSetProperty(JNIEnv *env, jobject obj, jstring jkey, jstring jv
TilesManager::instance()->setInvertedScreen(true);
else
TilesManager::instance()->setInvertedScreen(false);
+ return true;
}
if (key == "inverted_contrast") {
float contrast = value.toFloat();
TilesManager::instance()->setInvertedScreenContrast(contrast);
+ return true;
}
+ return false;
}
static jstring nativeGetProperty(JNIEnv *env, jobject obj, jstring key)
@@ -2833,7 +2836,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeUseHardwareAccelSkia },
{ "nativeGetBackgroundColor", "()I",
(void*) nativeGetBackgroundColor },
- { "nativeSetProperty", "(Ljava/lang/String;Ljava/lang/String;)V",
+ { "nativeSetProperty", "(Ljava/lang/String;Ljava/lang/String;)Z",
(void*) nativeSetProperty },
{ "nativeGetProperty", "(Ljava/lang/String;)Ljava/lang/String;",
(void*) nativeGetProperty },