summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/bindings/v8/V8NPUtils.cpp5
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp1
-rw-r--r--WebCore/platform/graphics/android/BaseTile.cpp2
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp1
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.h5
-rw-r--r--WebCore/platform/graphics/android/MediaLayer.cpp7
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp20
-rw-r--r--WebKit/android/WebCoreSupport/WebCookieJar.cpp14
-rw-r--r--WebKit/android/nav/SelectText.cpp85
9 files changed, 58 insertions, 82 deletions
diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp
index 4fb0456..cb752be 100644
--- a/WebCore/bindings/v8/V8NPUtils.cpp
+++ b/WebCore/bindings/v8/V8NPUtils.cpp
@@ -65,8 +65,9 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
VOID_TO_NPVARIANT(*result);
else if (object->IsString()) {
v8::String::Utf8Value utf8(object);
- char* utf8Chars = reinterpret_cast<char*>(malloc(utf8.length()));
- memcpy(utf8Chars, *utf8, utf8.length());
+ int length = utf8.length() + 1;
+ char* utf8Chars = reinterpret_cast<char*>(malloc(length));
+ memcpy(utf8Chars, *utf8, length);
STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result);
} else if (object->IsObject()) {
DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext());
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index d2c41dc..584add1 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -263,6 +263,7 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect,
XLOG("drawBasePicture drawGL() viewRect: %d, %d, %d, %d",
left, top, width, height);
+ m_glWebViewState->setBackgroundColor(color);
glClearColor((float)m_color.red() / 255.0,
(float)m_color.green() / 255.0,
(float)m_color.blue() / 255.0, 1);
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp
index a69e6f9..bfd5118 100644
--- a/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/WebCore/platform/graphics/android/BaseTile.cpp
@@ -257,7 +257,7 @@ void BaseTile::paintBitmap()
SkCanvas* canvas = texture->canvas();
canvas->save();
- canvas->drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode);
+ canvas->drawColor(tiledPage->glWebViewState()->getBackgroundColor());
canvas->scale(scale, scale);
canvas->translate(-x * w, -y * h);
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index 71f3fe5..3d2f6c8 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -68,6 +68,7 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
, m_usePageA(true)
, m_globalButtonMutex(buttonMutex)
, m_baseLayerUpdate(true)
+ , m_backgroundColor(SK_ColorWHITE)
{
m_viewport.setEmpty();
m_previousViewport.setEmpty();
diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h
index 91bb2d7..d265b41 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/WebCore/platform/graphics/android/GLWebViewState.h
@@ -208,6 +208,9 @@ public:
bool drawGL(IntRect& rect, SkRect& viewport,
float scale, SkColor color = SK_ColorWHITE);
+ void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
+ SkColor getBackgroundColor() { return m_backgroundColor; }
+
private:
void inval(const IntRect& rect); // caller must hold m_baseLayerLock
@@ -247,6 +250,8 @@ private:
bool m_baseLayerUpdate;
IntRect m_invalidateRect;
+
+ SkColor m_backgroundColor;
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/MediaLayer.cpp b/WebCore/platform/graphics/android/MediaLayer.cpp
index ad4fc76..d8bbefc 100644
--- a/WebCore/platform/graphics/android/MediaLayer.cpp
+++ b/WebCore/platform/graphics/android/MediaLayer.cpp
@@ -78,8 +78,6 @@ bool MediaLayer::drawGL(SkMatrix& matrix)
// draw any video content if present
m_videoTexture->drawVideo(drawTransform());
- bool needsInval = true;
-
// draw the primary content
if (m_bufferedTexture) {
TextureInfo* textureInfo = m_bufferedTexture->consumerLock();
@@ -103,14 +101,11 @@ bool MediaLayer::drawGL(SkMatrix& matrix)
textureInfo->m_textureId,
1.0f, forceBlending);
}
-
- if (!rect.isEmpty())
- needsInval = false;
}
m_bufferedTexture->consumerRelease();
}
- return drawChildrenGL(matrix) || needsInval;
+ return drawChildrenGL(matrix);
}
ANativeWindow* MediaLayer::acquireNativeWindowForVideo()
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index a15e862..16fb782 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -55,10 +55,11 @@
// We need n textures for one TiledPage, and another n textures for the
// second page used when scaling.
// In our case, we use 300x300 textures. On the tablet, this equates to
-// at least 5 * 3 = 15 textures. We can also enable offscreen textures
+// at least 5 * 3 = 15 textures. We also enable offscreen textures to a maximum
+// of 154 textures used (i.e. ~106Mb max, accounting for the double buffer textures)
#define EXPANDED_TILE_BOUNDS_X 1
#define EXPANDED_TILE_BOUNDS_Y 4
-#define MAX_TEXTURE_ALLOCATION (5+1+EXPANDED_TILE_BOUNDS_X*2)*(3+1+EXPANDED_TILE_BOUNDS_Y*2)*2
+#define MAX_TEXTURE_ALLOCATION (5+EXPANDED_TILE_BOUNDS_X*2)*(3+EXPANDED_TILE_BOUNDS_Y*2)*2
#define TILE_WIDTH 300
#define TILE_HEIGHT 300
@@ -374,13 +375,20 @@ int TilesManager::maxTextureCount()
void TilesManager::setMaxTextureCount(int max)
{
- XLOG("setMaxTextureCount: %d", max);
- if (max > MAX_TEXTURE_ALLOCATION ||
- (m_maxTextureCount >= max && m_maxTextureCount))
+ XLOG("setMaxTextureCount: %d (current: %d, total:%d)",
+ max, m_maxTextureCount, MAX_TEXTURE_ALLOCATION);
+ if (m_maxTextureCount &&
+ (max > MAX_TEXTURE_ALLOCATION ||
+ max <= m_maxTextureCount))
return;
android::Mutex::Autolock lock(m_texturesLock);
- m_maxTextureCount = max;
+
+ if (max < MAX_TEXTURE_ALLOCATION)
+ m_maxTextureCount = max;
+ else
+ m_maxTextureCount = MAX_TEXTURE_ALLOCATION;
+
allocateTiles();
}
diff --git a/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
index 9c1d7fa..99de67e 100644
--- a/WebKit/android/WebCoreSupport/WebCookieJar.cpp
+++ b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
@@ -31,9 +31,16 @@
#include "WebRequestContext.h"
#include "WebUrlLoaderClient.h"
-
+#include <cutils/log.h>
#include <dirent.h>
+#undef ASSERT
+#define ASSERT(assertion, ...) do \
+ if (!(assertion)) { \
+ android_printLog(ANDROID_LOG_ERROR, __FILE__, __VA_ARGS__); \
+ } \
+while (0)
+
namespace android {
static WTF::Mutex instanceMutex;
@@ -193,16 +200,21 @@ public:
Task* callback = NewRunnableMethod(this, &FlushSemaphore::Callback);
ioThread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
monster, &net::CookieMonster::FlushStore, callback));
+ } else {
+ Callback();
}
}
// Block until the given number of callbacks has been made.
void Wait(int numCallbacks) {
AutoLock al(m_lock);
+ int lastCount = m_count;
while (m_count < numCallbacks) {
// TODO(husky): Maybe use TimedWait() here? But it's not obvious what
// to do if the flush fails. Might be okay just to let the OS kill us.
m_condition.Wait();
+ ASSERT(lastCount != m_count, "Wait finished without incrementing m_count %d %d", m_count, lastCount);
+ lastCount = m_count;
}
m_count -= numCallbacks;
}
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index a07fa8c..87d1791 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -141,40 +141,6 @@ void ReverseBidi(UChar* chars, int len) {
namespace android {
-/* SpaceBounds and SpaceCanvas are used to measure the left and right side
- * bearings of two consecutive glyphs to help determine if the glyphs were
- * originally laid out with a space character between the glyphs.
- */
-class SpaceBounds : public SkBounder {
-public:
- virtual bool onIRectGlyph(const SkIRect& , const SkBounder::GlyphRec& rec)
- {
- mFirstGlyph = mLastGlyph;
- mLastGlyph = rec;
- return false;
- }
-
- SkBounder::GlyphRec mFirstGlyph;
- SkBounder::GlyphRec mLastGlyph;
-};
-
-class SpaceCanvas : public ParseCanvas {
-public:
- SpaceCanvas()
- {
- setBounder(&mBounder);
- SkBitmap bitmap;
- // Configure a very large bitmap so the pair of glyphs can be anywhere
- // on the page. Skia constrains the bitmap to be 2^31-1 bytes. The
- // bitmap is never allocated, but this constraint avoids triggering
- // a failure when the configuration is checked.
- bitmap.setConfig(SkBitmap::kA1_Config, 16383, 1048576);
- setBitmapDevice(bitmap);
- }
-
- SpaceBounds mBounder;
-};
-
#define HYPHEN_MINUS 0x2D // ASCII hyphen
#define SOLIDUS 0x2F // ASCII slash
#define REVERSE_SOLIDUS 0x5C // ASCII backslash
@@ -266,8 +232,7 @@ public:
if (mLastGlyph.fGlyphID == static_cast<uint16_t>(-1))
return true;
DBG_NAV_LOGD("mLastGlyph=((%g, %g),(%g, %g), %d)"
- " rec=((%g, %g),(%g, %g), %d)"
- " mMinSpaceWidth=%g mLastUni=0x%04x '%c'",
+ " rec=((%g, %g),(%g, %g), %d) mLastUni=0x%04x '%c'",
SkFixedToScalar(mLastGlyph.fLSB.fX),
SkFixedToScalar(mLastGlyph.fLSB.fY),
SkFixedToScalar(mLastGlyph.fRSB.fX),
@@ -275,7 +240,6 @@ public:
SkFixedToScalar(rec.fLSB.fX), SkFixedToScalar(rec.fLSB.fY),
SkFixedToScalar(rec.fRSB.fX), SkFixedToScalar(rec.fRSB.fY),
rec.fGlyphID,
- SkFixedToScalar(mMinSpaceWidth),
mLastUni, mLastUni && mLastUni < 0x7f ? mLastUni : '?');
bool newBaseLine = mLastGlyph.fLSB.fY != rec.fLSB.fY;
if (newBaseLine)
@@ -284,35 +248,24 @@ public:
SkFixed gapTwo = rec.fLSB.fX - mLastGlyph.fRSB.fX;
if (gapOne < 0 && gapTwo < 0)
return false; // overlaps
- uint16_t test[2];
- test[0] = mLastGlyph.fGlyphID;
- test[1] = rec.fGlyphID;
- SpaceCanvas spaceChecker;
- spaceChecker.drawText(test, sizeof(test),
- SkFixedToScalar(mLastGlyph.fLSB.fX),
- SkFixedToScalar(mLastGlyph.fLSB.fY), mPaint);
- const SkBounder::GlyphRec& g1 = spaceChecker.mBounder.mFirstGlyph;
- const SkBounder::GlyphRec& g2 = spaceChecker.mBounder.mLastGlyph;
- DBG_NAV_LOGD("g1=(%g, %g, %g, %g) g2=(%g, %g, %g, %g)",
- SkFixedToScalar(g1.fLSB.fX), SkFixedToScalar(g1.fLSB.fY),
- SkFixedToScalar(g1.fRSB.fX), SkFixedToScalar(g1.fRSB.fY),
- SkFixedToScalar(g2.fLSB.fX), SkFixedToScalar(g2.fLSB.fY),
- SkFixedToScalar(g2.fRSB.fX), SkFixedToScalar(g2.fRSB.fY));
- gapOne = SkFixedAbs(gapOne);
- gapTwo = SkFixedAbs(gapTwo);
- SkFixed gap = gapOne < gapTwo ? gapOne : gapTwo;
- SkFixed overlap = g2.fLSB.fX - g1.fRSB.fX;
- if (overlap < 0)
- gap -= overlap;
- DBG_NAV_LOGD("gap=%g overlap=%g gapOne=%g gapTwo=%g minSpaceWidth()=%g",
- SkFixedToScalar(gap), SkFixedToScalar(overlap),
- SkFixedToScalar(gapOne), SkFixedToScalar(gapTwo),
- SkFixedToScalar(minSpaceWidth()));
- // FIXME: the -1/8 below takes care of slop beween the computed gap
- // and the actual space width -- it's a rounding error from
- // moving from fixed to float and back and could be much smaller.
- spaceChecker.setBounder(0);
- return gap >= minSpaceWidth() - SK_Fixed1 / 8;
+ const SkBounder::GlyphRec& first = mLastGlyph.fLSB.fX < rec.fLSB.fX
+ ? mLastGlyph : rec;
+ const SkBounder::GlyphRec& second = mLastGlyph.fLSB.fX < rec.fLSB.fX
+ ? rec : mLastGlyph;
+ uint16_t firstGlyph = first.fGlyphID;
+ SkScalar firstWidth = mPaint.measureText(&firstGlyph, sizeof(firstGlyph));
+ SkFixed ceilWidth = SkIntToFixed(SkScalarCeil(firstWidth));
+ SkFixed posNoSpace = first.fLSB.fX + ceilWidth;
+ SkFixed ceilSpace = SkIntToFixed(SkFixedCeil(minSpaceWidth()));
+ SkFixed posWithSpace = posNoSpace + ceilSpace;
+ SkFixed diffNoSpace = SkFixedAbs(second.fLSB.fX - posNoSpace);
+ SkFixed diffWithSpace = SkFixedAbs(second.fLSB.fX - posWithSpace);
+ DBG_NAV_LOGD("second=%g width=%g (%g) noSpace=%g (%g) withSpace=%g (%g)",
+ SkFixedToScalar(second.fLSB.fX),
+ firstWidth, SkFixedToScalar(ceilWidth),
+ SkFixedToScalar(posNoSpace), SkFixedToScalar(diffNoSpace),
+ SkFixedToScalar(posWithSpace), SkFixedToScalar(diffWithSpace));
+ return diffWithSpace < diffNoSpace;
}
SkFixed minSpaceWidth()