summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp23
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Tile.cpp14
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Tile.h2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp15
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilesManager.h3
-rw-r--r--Source/WebKit/android/jni/WebHistory.cpp2
-rw-r--r--Source/WebKit/android/nav/WebView.cpp10
8 files changed, 56 insertions, 17 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index bdd8028..1fe30de 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -369,8 +369,10 @@ int GLWebViewState::drawGL(IntRect& invScreenRect, SkRect& visibleContentRect,
nbTexturesNeeded.full += nbTexturesForImages;
nbTexturesNeeded.clipped += nbTexturesForImages;
- if (setLayersRenderingMode(nbTexturesNeeded))
+ if (setLayersRenderingMode(nbTexturesNeeded)) {
+ TilesManager::instance()->dirtyAllTiles();
returnFlags |= uirenderer::DrawGlInfo::kStatusDraw | uirenderer::DrawGlInfo::kStatusInvoke;
+ }
glBindBuffer(GL_ARRAY_BUFFER, 0);
diff --git a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp
index 827a531..6c76965 100644
--- a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp
@@ -988,8 +988,8 @@ const TextRun& TextRunWalker::getNormalizedTextRun(const TextRun& originalRun,
FloatRect Font::selectionRectForComplexText(const TextRun& run,
const FloatPoint& point, int height, int from, int to) const
{
-
- int fromX = -1, toX = -1, fromAdvance = -1, toAdvance = -1;
+ int fromX = -1;
+ int toX = -1;
TextRunWalker walker(run, 0, 0, this);
walker.setWordAndLetterSpacing(wordSpacing(), letterSpacing());
@@ -1001,6 +1001,10 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
// We want to enumerate the script runs in code point order in the following
// code. This call also resets |walker|.
walker.setBackwardsIteration(false);
+ if (!from)
+ fromX = leftEdge;
+ if (!to)
+ toX = leftEdge;
while (walker.nextScriptRun() && (fromX == -1 || toX == -1)) {
// TextRunWalker will helpfully accumulate the x offsets for different
@@ -1018,15 +1022,17 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
// position.
int glyph = walker.logClusters()[from];
fromX = base + walker.positions()[glyph].x();
- fromAdvance = walker.advances()[glyph];
- } else if (!walker.rtl())
+ if (walker.rtl())
+ fromX += truncateFixedPointToInteger(walker.advances()[glyph]);
+ } else
from -= numCodePoints;
if (toX == -1 && to < numCodePoints) {
int glyph = walker.logClusters()[to];
toX = base + walker.positions()[glyph].x();
- toAdvance = walker.advances()[glyph];
- } else if (!walker.rtl())
+ if (walker.rtl())
+ toX += truncateFixedPointToInteger(walker.advances()[glyph]);
+ } else
to -= numCodePoints;
if (!walker.rtl())
@@ -1036,10 +1042,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
// The position in question might be just after the text.
const int rightEdge = base;
if (fromX == -1 && !from)
- fromX = leftEdge;
- else if (walker.rtl())
- fromX += truncateFixedPointToInteger(fromAdvance);
-
+ fromX = rightEdge;
if (toX == -1 && !to)
toX = rightEdge;
diff --git a/Source/WebCore/platform/graphics/android/rendering/Tile.cpp b/Source/WebCore/platform/graphics/android/rendering/Tile.cpp
index 3af05f4..2e2c397 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Tile.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Tile.cpp
@@ -146,6 +146,13 @@ bool Tile::removeTexture(TileTexture* texture)
return true;
}
+void Tile::markAsDirty()
+{
+ android::AutoMutex lock(m_atomicSync);
+ m_dirtyArea.setEmpty(); // empty dirty rect prevents fast blit path
+ markAsDirtyInternal();
+}
+
void Tile::markAsDirty(const SkRegion& dirtyArea)
{
if (dirtyArea.isEmpty())
@@ -171,6 +178,13 @@ void Tile::markAsDirty(const SkRegion& dirtyArea)
if (!intersect)
return;
+ markAsDirtyInternal();
+}
+
+void Tile::markAsDirtyInternal()
+{
+ // NOTE: callers must hold lock on m_atomicSync
+
m_dirty = true;
if (m_state == UpToDate) {
// We only mark a tile as unpainted in 'markAsDirty' if its status is
diff --git a/Source/WebCore/platform/graphics/android/rendering/Tile.h b/Source/WebCore/platform/graphics/android/rendering/Tile.h
index 9697b61..4c8052c 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Tile.h
+++ b/Source/WebCore/platform/graphics/android/rendering/Tile.h
@@ -114,6 +114,7 @@ public:
SkRect& realTileRect);
bool isTileVisible(const IntRect& viewTileBounds);
+ void markAsDirty();
void markAsDirty(const SkRegion& dirtyArea);
bool isDirty();
const SkRegion& dirtyArea() { return m_dirtyArea; }
@@ -140,6 +141,7 @@ public:
virtual bool removeTexture(TileTexture* texture);
private:
+ void markAsDirtyInternal();
void validatePaint();
int m_x;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
index 6e22d25..66c4bf3 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
@@ -235,6 +235,21 @@ void TilesManager::gatherTexturesNumbers(int* nbTextures, int* nbAllocatedTextur
}
}
+void TilesManager::dirtyTexturesVector(WTF::Vector<TileTexture*>& textures)
+{
+ for (unsigned int i = 0; i < textures.size(); i++) {
+ Tile* currentOwner = static_cast<Tile*>(textures[i]->owner());
+ if (currentOwner)
+ currentOwner->markAsDirty();
+ }
+}
+
+void TilesManager::dirtyAllTiles()
+{
+ dirtyTexturesVector(m_textures);
+ dirtyTexturesVector(m_tilesTextures);
+}
+
void TilesManager::printTextures()
{
#ifdef DEBUG
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
index 295acf6..5ad508c 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
@@ -77,6 +77,8 @@ public:
TileTexture* getAvailableTexture(Tile* owner);
+ void dirtyAllTiles();
+
void printTextures();
// m_highEndGfx is written/read only on UI thread, no need for a lock.
@@ -164,6 +166,7 @@ private:
void discardTexturesVector(unsigned long long sparedDrawCount,
WTF::Vector<TileTexture*>& textures,
bool deallocateGLTextures);
+ void dirtyTexturesVector(WTF::Vector<TileTexture*>& textures);
void markAllGLTexturesZero();
bool updateContextIfChanged();
int getMaxTextureAllocation();
diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp
index f01b622..0c4652a 100644
--- a/Source/WebKit/android/jni/WebHistory.cpp
+++ b/Source/WebKit/android/jni/WebHistory.cpp
@@ -263,7 +263,7 @@ static jobject WebHistoryGetFavicon(JNIEnv* env, jobject obj, jint ptr)
return 0;
WebHistoryItem* item = reinterpret_cast<WebHistoryItem*>(ptr);
MutexLocker locker(item->m_lock);
- if (!item->m_faviconCached) {
+ if (!item->m_faviconCached && !item->m_favicon.isNull()) {
jobject favicon = GraphicsJNI::createBitmap(env,
new SkBitmap(item->m_favicon),
false, NULL);
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index a78392b..59901ff 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -698,11 +698,6 @@ class GLDrawFunctor : Functor {
if (shouldDraw)
wvInstance->updateRectsForGL();
- if (invScreenRect.isEmpty()) {
- // NOOP operation if viewport is empty
- return 0;
- }
-
WebCore::IntRect inval;
int titlebarHeight = screenRect.height() - invScreenRect.height();
@@ -711,6 +706,11 @@ class GLDrawFunctor : Functor {
info->clipRight - info->clipLeft,
info->clipBottom - info->clipTop);
+ if (invScreenRect.isEmpty() || screenClip.isEmpty()) {
+ // NOOP operation if screenRect or clip is empty
+ return 0;
+ }
+
WebCore::IntRect localInvScreenRect = invScreenRect;
if (info->isLayer) {
// When webview is on a layer, we need to use the viewport relative