summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/Android.mk1
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.h1
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.cpp24
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.h9
-rw-r--r--Source/WebCore/platform/graphics/android/FontAndroid.cpp24
-rw-r--r--Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/FontDataAndroid.cpp11
-rw-r--r--Source/WebCore/platform/graphics/android/FontPlatformData.h11
-rw-r--r--Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp22
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/ImageTexture.cpp19
-rw-r--r--Source/WebCore/platform/graphics/android/ImageTexture.h8
-rw-r--r--Source/WebCore/platform/graphics/android/ImagesManager.cpp108
-rw-r--r--Source/WebCore/platform/graphics/android/ImagesManager.h58
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp25
-rw-r--r--Source/WebCore/platform/graphics/android/MediaTexture.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp46
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.h7
-rw-r--r--Source/WebCore/platform/graphics/android/TransferQueue.cpp7
-rw-r--r--Source/WebCore/platform/graphics/android/android_graphics.cpp6
-rw-r--r--Source/WebCore/rendering/RenderBlock.cpp45
-rw-r--r--Source/WebCore/rendering/RenderBlock.h1
-rw-r--r--Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp9
-rw-r--r--Source/WebKit/android/jni/ViewStateSerializer.cpp3
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp30
-rw-r--r--Source/WebKit/android/nav/WebView.cpp49
29 files changed, 325 insertions, 222 deletions
diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk
index 7d08cc7..a516f48 100644
--- a/Source/WebCore/Android.mk
+++ b/Source/WebCore/Android.mk
@@ -656,6 +656,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/android/ImageAndroid.cpp \
platform/graphics/android/ImageBufferAndroid.cpp \
platform/graphics/android/ImageSourceAndroid.cpp \
+ platform/graphics/android/ImagesManager.cpp \
platform/graphics/android/ImageTexture.cpp \
platform/graphics/android/Layer.cpp \
platform/graphics/android/LayerAndroid.cpp \
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index b38c590..350001a 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -535,6 +535,14 @@ void BaseTile::backTextureTransfer() {
}
}
+void BaseTile::backTextureTransferFail() {
+ // transfer failed for some reason, mark dirty so it will (repaint and) be
+ // retransferred.
+ android::AutoMutex lock(m_atomicSync);
+ m_state = Unpainted;
+ // whether validatePaint is called before or after, it won't do anything
+}
+
void BaseTile::validatePaint() {
// ONLY CALL while m_atomicSync is locked (at the end of paintBitmap())
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h
index 27fffc6..cabf5f1 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.h
+++ b/Source/WebCore/platform/graphics/android/BaseTile.h
@@ -129,6 +129,7 @@ public:
void discardTextures();
bool swapTexturesIfNeeded();
void backTextureTransfer();
+ void backTextureTransferFail();
void setGLWebViewState(GLWebViewState* state) { m_glWebViewState = state; }
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
index cedad99..5b7acdb 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
@@ -56,8 +56,6 @@ BaseTileTexture::BaseTileTexture(uint32_t w, uint32_t h)
: DoubleBufferedTexture(eglGetCurrentContext(),
TilesManager::instance()->getSharedTextureMode())
, m_owner(0)
- , m_delayedReleaseOwner(0)
- , m_delayedRelease(false)
, m_busy(false)
{
m_size.set(w, h);
@@ -137,13 +135,6 @@ void BaseTileTexture::setNotBusy()
{
android::Mutex::Autolock lock(m_busyLock);
m_busy = false;
- if (m_delayedRelease) {
- if (m_owner == m_delayedReleaseOwner)
- m_owner = 0;
-
- m_delayedRelease = false;
- m_delayedReleaseOwner = 0;
- }
m_busyCond.signal();
}
@@ -170,13 +161,8 @@ void BaseTileTexture::producerUpdate(TextureInfo* textureInfo, const SkBitmap& b
bool BaseTileTexture::acquire(TextureOwner* owner, bool force)
{
- if (m_owner == owner) {
- if (m_delayedRelease) {
- m_delayedRelease = false;
- m_delayedReleaseOwner = 0;
- }
+ if (m_owner == owner)
return true;
- }
return setOwner(owner, force);
}
@@ -219,17 +205,13 @@ bool BaseTileTexture::release(TextureOwner* owner)
if (m_owner != owner)
return false;
- if (!m_busy) {
- m_owner = 0;
- } else {
- m_delayedRelease = true;
- m_delayedReleaseOwner = owner;
- }
+ m_owner = 0;
return true;
}
void BaseTileTexture::releaseAndRemoveFromTile()
{
+ // NOTE: only call on UI thread, so m_owner won't be changing
if (m_owner) {
// clear both Tile->Texture and Texture->Tile links
m_owner->removeTexture(this);
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.h b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
index 6a9ce43..cd8e78b 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.h
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
@@ -91,7 +91,6 @@ public:
// private member accessor functions
TextureOwner* owner() { return m_owner; } // only used by the consumer thread
- TextureOwner* delayedReleaseOwner() { return m_delayedReleaseOwner; }
bool busy();
void setNotBusy();
@@ -120,13 +119,9 @@ private:
SkSize m_size;
SkBitmap::Config m_config;
- TextureOwner* m_owner;
- // When trying to release a texture, we may delay this if the texture is
- // currently used (busy being painted). We use the following two variables
- // to do so in setNotBusy()
- TextureOwner* m_delayedReleaseOwner;
- bool m_delayedRelease;
+ // BaseTile owning the texture, only modified by UI thread
+ TextureOwner* m_owner;
// This values signals that the texture is currently in use by the consumer.
// This allows us to prevent the owner of the texture from changing while the
diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
index fd6d41b..6b4296b 100644
--- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
@@ -183,10 +183,8 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
SkScalar y = SkFloatToScalar(point.y());
const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
const GlyphBufferAdvance* adv = glyphBuffer.advances(from);
- SkAutoSTMalloc<32, SkPoint> storage(numGlyphs), storage2(numGlyphs), storage3(numGlyphs);
+ SkAutoSTMalloc<32, SkPoint> storage(numGlyphs);
SkPoint* pos = storage.get();
- SkPoint* vPosBegin = storage2.get();
- SkPoint* vPosEnd = storage3.get();
SkCanvas* canvas = gc->platformContext()->mCanvas;
@@ -223,28 +221,12 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
localCount * sizeof(uint16_t),
&pos[localIndex], paint);
} else {
- bool isVertical = font->platformData().orientation() == Vertical;
for (int i = 0; i < numGlyphs; i++) {
pos[i].set(x, y);
+ x += SkFloatToScalar(adv[i].width());
y += SkFloatToScalar(adv[i].height());
- if (isVertical) {
- SkScalar myWidth = SkFloatToScalar(adv[i].width());
- vPosBegin[i].set(x + myWidth, y);
- vPosEnd[i].set(x + myWidth, y - myWidth);
- x += myWidth;
-
- SkPath path;
- path.reset();
- path.moveTo(vPosBegin[i]);
- path.lineTo(vPosEnd[i]);
- canvas->drawTextOnPath(glyphs + i, 2, path, 0, paint);
- }
- else {
- x += SkFloatToScalar(adv[i].width());
- }
}
- if (!isVertical)
- canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint);
+ canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint);
}
}
diff --git a/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp b/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
index 4fc3b4e..20ffd17 100644
--- a/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
@@ -177,9 +177,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
result = new FontPlatformData(tf, fontDescription.computedSize(),
(style & SkTypeface::kBold) && !tf->isBold(),
- (style & SkTypeface::kItalic) && !tf->isItalic(),
- fontDescription.orientation(),
- fontDescription.textOrientation());
+ (style & SkTypeface::kItalic) && !tf->isItalic());
}
tf->unref();
diff --git a/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
index 4279ce8..72fac68 100644
--- a/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
@@ -45,8 +45,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
// the unref is enough to release the font data...
}
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic,
- FontOrientation fontOrientation, TextOrientation textOrientation, FontWidthVariant, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode)
{
// turn bold/italic into fakeBold/fakeItalic
if (m_typeface != NULL) {
@@ -55,7 +54,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
if (m_typeface->isItalic() == italic)
italic = false;
}
- return FontPlatformData(m_typeface, size, bold, italic, fontOrientation, textOrientation);
+ return FontPlatformData(m_typeface, size, bold, italic);
}
FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
diff --git a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
index c6dd174..1f19b6d 100644
--- a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
@@ -32,7 +32,6 @@
#include "SimpleFontData.h"
#include "FloatRect.h"
#include "FontDescription.h"
-#include "SkFontHost.h"
#include "SkPaint.h"
#include "SkTypeface.h"
#include "SkTime.h"
@@ -58,16 +57,6 @@ void SimpleFontData::platformInit()
m_fontMetrics.setXHeight(SkScalarToFloat(-skiaFontMetrics.fAscent) * 0.56f); // hack I stole from the window's port
m_fontMetrics.setLineSpacing(a + d);
m_fontMetrics.setLineGap(SkScalarToFloat(skiaFontMetrics.fLeading));
-
- if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
- static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
- static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G');
- const SkFontID fontID = m_platformData.uniqueID();
- size_t vheaSize = SkFontHost::GetTableSize(fontID, vheaTag);
- size_t vorgSize = SkFontHost::GetTableSize(fontID, vorgTag);
- if ((vheaSize > 0) || (vorgSize > 0))
- m_hasVerticalGlyphs = true;
- }
}
void SimpleFontData::platformCharWidthInit()
diff --git a/Source/WebCore/platform/graphics/android/FontPlatformData.h b/Source/WebCore/platform/graphics/android/FontPlatformData.h
index 5c3313e..56ce6e9 100644
--- a/Source/WebCore/platform/graphics/android/FontPlatformData.h
+++ b/Source/WebCore/platform/graphics/android/FontPlatformData.h
@@ -31,7 +31,6 @@
#define FontPlatformData_h
#include "FontOrientation.h"
-#include "TextOrientation.h"
#include <wtf/text/StringImpl.h>
#ifndef NDEBUG
@@ -53,8 +52,7 @@ public:
FontPlatformData();
FontPlatformData(const FontPlatformData&);
- FontPlatformData(SkTypeface*, float textSize, bool fakeBold, bool fakeItalic,
- FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight);
+ FontPlatformData(SkTypeface*, float textSize, bool fakeBold, bool fakeItalic);
FontPlatformData(const FontPlatformData& src, float textSize);
FontPlatformData(float size, bool syntheticBold, bool syntheticOblique);
FontPlatformData(const FontPlatformData& src, SkTypeface* typeface);
@@ -67,8 +65,9 @@ public:
return mTypeface == hashTableDeletedFontValue();
}
- FontOrientation orientation() const { return mOrientation; }
- void setOrientation(FontOrientation orientation) { mOrientation = orientation; }
+ FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
+ void setOrientation(FontOrientation) { } // FIXME: Implement.
+
FontPlatformData& operator=(const FontPlatformData&);
bool operator==(const FontPlatformData& a) const;
@@ -115,8 +114,6 @@ private:
float mTextSize;
bool mFakeBold;
bool mFakeItalic;
- FontOrientation mOrientation;
- TextOrientation mTextOrientation;
mutable RefPtr<RefCountedHarfbuzzFace> m_harfbuzzFace;
static SkTypeface* hashTableDeletedFontValue() {
diff --git a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
index 1185fa7..8e77b5b 100644
--- a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
@@ -92,17 +92,13 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
- mOrientation = src.mOrientation;
- mTextOrientation = src.mTextOrientation;
inc_count();
trace(2);
}
-FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic,
- FontOrientation orientation, TextOrientation textOrientation)
- : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic),
- mOrientation(orientation), mTextOrientation(textOrientation)
+FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic)
+ : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -114,7 +110,7 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold
FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
: mTypeface(src.mTypeface), mTextSize(textSize), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic),
- m_harfbuzzFace(src.m_harfbuzzFace), mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation)
+ m_harfbuzzFace(src.m_harfbuzzFace)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -133,8 +129,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
FontPlatformData::FontPlatformData(const FontPlatformData& src, SkTypeface* tf)
: mTypeface(tf), mTextSize(src.mTextSize), mFakeBold(src.mFakeBold),
- mFakeItalic(src.mFakeItalic), mOrientation(src.mOrientation),
- mTextOrientation(src.mTextOrientation)
+ mFakeItalic(src.mFakeItalic)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -170,8 +165,6 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
- mOrientation = src.mOrientation;
- mTextOrientation = src.mTextOrientation;
return *this;
}
@@ -211,9 +204,7 @@ bool FontPlatformData::operator==(const FontPlatformData& a) const
return mTypeface == a.mTypeface &&
mTextSize == a.mTextSize &&
mFakeBold == a.mFakeBold &&
- mFakeItalic == a.mFakeItalic &&
- mOrientation == a.mOrientation &&
- mTextOrientation == a.mTextOrientation;
+ mFakeItalic == a.mFakeItalic;
}
unsigned FontPlatformData::hash() const
@@ -228,8 +219,7 @@ unsigned FontPlatformData::hash() const
uint32_t sizeAsInt = *reinterpret_cast<const uint32_t*>(&mTextSize);
- h ^= 0x01010101 * ((static_cast<int>(mTextOrientation) << 3) | (static_cast<int>(mOrientation) << 2) |
- ((int)mFakeBold << 1) | (int)mFakeItalic);
+ h ^= 0x01010101 * (((int)mFakeBold << 1) | (int)mFakeItalic);
h ^= sizeAsInt;
return h;
}
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 113ccde..fb16c52 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -528,7 +528,7 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
SkSafeUnref(baseLayer);
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->showTrackTextures();
- TilesManager::instance()->showImages();
+ ImagesManager::instance()->showImages();
#endif
return ret;
}
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index eadac6b..89f96d8 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -24,6 +24,7 @@
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "Image.h"
+#include "ImagesManager.h"
#include "Layer.h"
#include "Length.h"
#include "MediaLayer.h"
diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/ImageTexture.cpp
index 7e71740..814373c 100644
--- a/Source/WebCore/platform/graphics/android/ImageTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/ImageTexture.cpp
@@ -29,12 +29,15 @@
#include "SkDevice.h"
#include "TilesManager.h"
-#ifdef DEBUG
-
#include <cutils/log.h>
#include <wtf/CurrentTime.h>
#include <wtf/text/CString.h>
+#undef XLOGC
+#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "ImageTexture", __VA_ARGS__)
+
+#ifdef DEBUG
+
#undef XLOG
#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "ImageTexture", __VA_ARGS__)
@@ -84,7 +87,7 @@ ImageTexture::~ImageTexture()
delete m_image;
}
-void ImageTexture::prepare()
+void ImageTexture::prepareGL()
{
if (m_textureId)
return;
@@ -93,7 +96,7 @@ void ImageTexture::prepare()
GLUtils::createTextureWithBitmap(m_textureId, *m_image);
}
-void ImageTexture::draw(LayerAndroid* layer)
+void ImageTexture::drawGL(LayerAndroid* layer)
{
if (!layer)
return;
@@ -112,6 +115,11 @@ void ImageTexture::draw(LayerAndroid* layer)
layer->drawOpacity(), true);
}
+void ImageTexture::drawCanvas(SkCanvas* canvas, SkRect& rect)
+{
+ canvas->drawBitmapRect(*m_image, 0, rect);
+}
+
void ImageTexture::release()
{
if (m_refCount >= 1)
@@ -122,7 +130,8 @@ void ImageTexture::release()
void ImageTexture::deleteTexture()
{
- glDeleteTextures(1, &m_textureId);
+ if (m_textureId)
+ glDeleteTextures(1, &m_textureId);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.h b/Source/WebCore/platform/graphics/android/ImageTexture.h
index c2ea77c..18ff7ef 100644
--- a/Source/WebCore/platform/graphics/android/ImageTexture.h
+++ b/Source/WebCore/platform/graphics/android/ImageTexture.h
@@ -63,9 +63,9 @@ public:
ImageTexture(SkBitmapRef* img);
virtual ~ImageTexture();
- void prepare();
- void draw(LayerAndroid* painter);
- void deleteTexture();
+ void prepareGL();
+ void drawGL(LayerAndroid* painter);
+ void drawCanvas(SkCanvas*, SkRect&);
void retain() { m_refCount++; }
void release();
unsigned int refCount() { return m_refCount; }
@@ -74,6 +74,8 @@ public:
private:
+ void deleteTexture();
+
SkBitmapRef* m_imageRef;
SkBitmap* m_image;
GLuint m_textureId;
diff --git a/Source/WebCore/platform/graphics/android/ImagesManager.cpp b/Source/WebCore/platform/graphics/android/ImagesManager.cpp
new file mode 100644
index 0000000..3518832
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/ImagesManager.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2011, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ImagesManager.h"
+
+#include "ImageTexture.h"
+
+#include <cutils/log.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/text/CString.h>
+
+#undef XLOGC
+#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "ImagesManager", __VA_ARGS__)
+
+#ifdef DEBUG
+
+#undef XLOG
+#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "ImagesManager", __VA_ARGS__)
+
+#else
+
+#undef XLOG
+#define XLOG(...)
+
+#endif // DEBUG
+
+namespace WebCore {
+
+ImagesManager* ImagesManager::instance()
+{
+ if (!gInstance)
+ gInstance = new ImagesManager();
+
+ return gInstance;
+}
+
+ImagesManager* ImagesManager::gInstance = 0;
+
+void ImagesManager::addImage(SkBitmapRef* imgRef)
+{
+ if (!imgRef)
+ return;
+
+ android::Mutex::Autolock lock(m_imagesLock);
+ if (!m_images.contains(imgRef))
+ m_images.set(imgRef, new ImageTexture(imgRef));
+}
+
+void ImagesManager::removeImage(SkBitmapRef* imgRef)
+{
+ android::Mutex::Autolock lock(m_imagesLock);
+ if (!m_images.contains(imgRef))
+ return;
+
+ ImageTexture* image = m_images.get(imgRef);
+ image->release();
+
+ if (!image->refCount()) {
+ m_images.remove(imgRef);
+ delete image;
+ }
+}
+
+void ImagesManager::showImages()
+{
+ XLOGC("We have %d images", m_images.size());
+ HashMap<SkBitmapRef*, ImageTexture*>::iterator end = m_images.end();
+ int i = 0;
+ for (HashMap<SkBitmapRef*, ImageTexture*>::iterator it = m_images.begin(); it != end; ++it) {
+ XLOGC("Image %x (%d/%d) has %d references", it->first, i,
+ m_images.size(), it->second->refCount());
+ i++;
+ }
+}
+
+ImageTexture* ImagesManager::getTextureForImage(SkBitmapRef* img, bool retain)
+{
+ android::Mutex::Autolock lock(m_imagesLock);
+ ImageTexture* image = m_images.get(img);
+ if (retain && image)
+ image->retain();
+ return image;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/ImagesManager.h b/Source/WebCore/platform/graphics/android/ImagesManager.h
new file mode 100644
index 0000000..1b5d322
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/ImagesManager.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2011, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImagesManager_h
+#define ImagesManager_h
+
+#include "HashMap.h"
+#include "SkBitmap.h"
+#include "SkBitmapRef.h"
+#include "SkRefCnt.h"
+
+namespace WebCore {
+
+class ImageTexture;
+
+class ImagesManager {
+public:
+ static ImagesManager* instance();
+
+ void addImage(SkBitmapRef* img);
+ void removeImage(SkBitmapRef* img);
+ ImageTexture* getTextureForImage(SkBitmapRef* img, bool retain = true);
+ void showImages();
+
+private:
+ ImagesManager() {}
+
+ static ImagesManager* gInstance;
+
+ android::Mutex m_imagesLock;
+ HashMap<SkBitmapRef*, ImageTexture*> m_images;
+};
+
+} // namespace WebCore
+
+#endif // ImagesManager
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index 91c44c6..4162e0b 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -7,6 +7,7 @@
#include "ClassTracker.h"
#include "DrawExtra.h"
#include "GLUtils.h"
+#include "ImagesManager.h"
#include "MediaLayer.h"
#include "PaintedSurface.h"
#include "ParseCanvas.h"
@@ -16,6 +17,7 @@
#include "SkPaint.h"
#include "SkPicture.h"
#include "TilesManager.h"
+
#include <wtf/CurrentTime.h>
#include <math.h>
@@ -102,7 +104,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : Layer(layer),
m_isFixed = layer.m_isFixed;
m_imageRef = layer.m_imageRef;
if (m_imageRef)
- TilesManager::instance()->addImage(m_imageRef);
+ ImagesManager::instance()->addImage(m_imageRef);
m_renderLayerPos = layer.m_renderLayerPos;
m_transform = layer.m_transform;
m_backfaceVisibility = layer.m_backfaceVisibility;
@@ -177,7 +179,7 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : Layer(),
LayerAndroid::~LayerAndroid()
{
if (m_imageTexture)
- TilesManager::instance()->removeImage(m_imageTexture->imageRef());
+ ImagesManager::instance()->removeImage(m_imageTexture->imageRef());
delete m_extra;
SkSafeUnref(m_recordingPicture);
m_animations.clear();
@@ -667,7 +669,7 @@ void LayerAndroid::setContentsImage(SkBitmapRef* img)
if (!img)
return;
- TilesManager::instance()->addImage(img);
+ ImagesManager::instance()->addImage(img);
}
bool LayerAndroid::needsTexture()
@@ -814,7 +816,7 @@ void LayerAndroid::createTexture()
if (m_imageRef) {
if (!m_imageTexture) {
- m_imageTexture = TilesManager::instance()->getTextureForImage(m_imageRef);
+ m_imageTexture = ImagesManager::instance()->getTextureForImage(m_imageRef);
m_dirtyRegion.setEmpty();
}
if (m_texture) {
@@ -876,7 +878,7 @@ void LayerAndroid::prepare(GLWebViewState* glWebViewState)
m_texture->prepare(glWebViewState);
if (m_imageTexture)
- m_imageTexture->prepare();
+ m_imageTexture->prepareGL();
}
bool LayerAndroid::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix)
@@ -891,7 +893,7 @@ bool LayerAndroid::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix)
askScreenUpdate |= m_texture->draw();
if (m_imageTexture)
- m_imageTexture->draw(this);
+ m_imageTexture->drawGL(this);
// When the layer is dirty, the UI thread should be notified to redraw.
askScreenUpdate |= drawChildrenGL(glWebViewState, matrix);
@@ -977,6 +979,17 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity)
if (canvasOpacity < 255)
canvas->setDrawFilter(new OpacityDrawFilter(canvasOpacity));
+ if (m_imageRef) {
+ if (!m_imageTexture) {
+ m_imageTexture = ImagesManager::instance()->getTextureForImage(m_imageRef);
+ m_dirtyRegion.setEmpty();
+ }
+ if (m_imageTexture) {
+ SkRect dest;
+ dest.set(0, 0, getSize().width(), getSize().height());
+ m_imageTexture->drawCanvas(canvas, dest);
+ }
+ }
contentDraw(canvas);
}
diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
index 98dca22..3b215ee 100644
--- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
@@ -70,7 +70,8 @@ MediaTexture::MediaTexture(jobject webViewRef) : android::LightRefBase<MediaText
MediaTexture::~MediaTexture()
{
- deleteTexture(m_contentTexture);
+ if (m_contentTexture)
+ deleteTexture(m_contentTexture, true);
for (unsigned int i = 0; i < m_videoTextures.size(); i++) {
deleteTexture(m_videoTextures[i], true);
}
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index 2d0cc7f..74cc764 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -429,52 +429,6 @@ void TilesManager::unregisterGLWebViewState(GLWebViewState* state)
transferQueue()->discardQueue();
}
-void TilesManager::addImage(SkBitmapRef* imgRef)
-{
- if (!imgRef)
- return;
-
- android::Mutex::Autolock lock(m_imagesLock);
- if (!m_images.contains(imgRef))
- m_images.set(imgRef, new ImageTexture(imgRef));
-}
-
-void TilesManager::removeImage(SkBitmapRef* imgRef)
-{
- android::Mutex::Autolock lock(m_imagesLock);
- if (!m_images.contains(imgRef))
- return;
-
- ImageTexture* image = m_images.get(imgRef);
- image->release();
-
- if (!image->refCount()) {
- m_images.remove(imgRef);
- delete image;
- }
-}
-
-void TilesManager::showImages()
-{
- XLOGC("We have %d images", m_images.size());
- HashMap<SkBitmapRef*, ImageTexture*>::iterator end = m_images.end();
- int i = 0;
- for (HashMap<SkBitmapRef*, ImageTexture*>::iterator it = m_images.begin(); it != end; ++it) {
- XLOGC("Image %x (%d/%d) has %d references", it->first, i,
- m_images.size(), it->second->refCount());
- i++;
- }
-}
-
-ImageTexture* TilesManager::getTextureForImage(SkBitmapRef* img, bool retain)
-{
- android::Mutex::Autolock lock(m_imagesLock);
- ImageTexture* image = m_images.get(img);
- if (retain && image)
- image->retain();
- return image;
-}
-
TilesManager* TilesManager::instance()
{
if (!gInstance) {
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h
index b7d6aa6..4daecff 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/TilesManager.h
@@ -179,10 +179,6 @@ public:
{
return m_drawGLCount;
}
- void addImage(SkBitmapRef* img);
- void removeImage(SkBitmapRef* img);
- ImageTexture* getTextureForImage(SkBitmapRef* img, bool retain = true);
- void showImages();
private:
TilesManager();
@@ -215,7 +211,6 @@ private:
android::Mutex m_texturesLock;
android::Mutex m_generatorLock;
- android::Mutex m_imagesLock;
android::Condition m_generatorReadyCond;
static TilesManager* gInstance;
@@ -228,8 +223,6 @@ private:
TilesProfiler m_profiler;
TilesTracker m_tilesTracker;
unsigned long long m_drawGLCount;
-
- HashMap<SkBitmapRef*, ImageTexture*> m_images;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
index a9d6b9a..3fc1b93 100644
--- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
@@ -361,11 +361,8 @@ void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo,
// failed placing bitmap in queue, discard tile's texture so it will be
// re-enqueued (and repainted)
BaseTile* tile = renderInfo->baseTile;
- if (tile) {
- BaseTileTexture* texture = tile->backTexture();
- if (texture)
- texture->releaseAndRemoveFromTile();
- }
+ if (tile)
+ tile->backTextureTransferFail();
}
}
diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp
index e50cfec..e255d29 100644
--- a/Source/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp
@@ -132,19 +132,19 @@ void CursorRing::setIsButton(const CachedNode* node)
bool CursorRing::setup()
{
- m_node->localCursorRings(m_frame, &m_rings);
+ m_node->cursorRings(m_frame, &m_rings);
if (!m_rings.size()) {
DBG_NAV_LOG("!rings.size()");
m_viewImpl->m_hasCursorBounds = false;
return false;
}
setIsButton(m_node);
- m_bounds = m_node->localBounds(m_frame);
+ m_bounds = m_node->bounds(m_frame);
m_viewImpl->updateCursorBounds(m_root, m_frame, m_node);
bool useHitBounds = m_node->useHitBounds();
if (useHitBounds)
- m_bounds = m_node->localHitBounds(m_frame);
+ m_bounds = m_node->hitBounds(m_frame);
if (useHitBounds || m_node->useBounds()) {
m_rings.clear();
m_rings.append(m_bounds);
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 792b809..8fa021f 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -226,6 +226,9 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt
if (cb->isRenderBlock())
toRenderBlock(cb)->removePositionedObjects(this);
}
+
+ if (containsFloats() && !isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition))
+ markAllDescendantsWithFloatsForLayout();
}
RenderBox::styleWillChange(diff, newStyle);
@@ -269,12 +272,33 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
}
// After our style changed, if we lose our ability to propagate floats into next sibling
- // blocks, then we need to mark our descendants with floats for layout and clear all floats
- // from next sibling blocks that exist in our floating objects list. See bug 56299.
+ // blocks, then we need to find the top most parent containing that overhanging float and
+ // then mark its descendants with floats for layout and clear all floats from its next
+ // sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloats();
if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canPropagateFloatIntoSibling && hasOverhangingFloats()) {
- markAllDescendantsWithFloatsForLayout();
- markSiblingsWithFloatsForLayout();
+ RenderBlock* parentBlock = this;
+ FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+ FloatingObjectSetIterator end = floatingObjectSet.end();
+
+ for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
+ if (curr->isRenderBlock()) {
+ RenderBlock* currBlock = toRenderBlock(curr);
+
+ if (currBlock->hasOverhangingFloats()) {
+ for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
+ RenderBox* renderer = (*it)->renderer();
+ if (currBlock->hasOverhangingFloat(renderer)) {
+ parentBlock = currBlock;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ parentBlock->markAllDescendantsWithFloatsForLayout();
+ parentBlock->markSiblingsWithFloatsForLayout();
}
}
@@ -3738,6 +3762,19 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int logicalLeftOffset,
return lowestFloatLogicalBottom;
}
+bool RenderBlock::hasOverhangingFloat(RenderBox* renderer)
+{
+ if (!m_floatingObjects || hasColumns() || !parent())
+ return false;
+
+ FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+ FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(renderer);
+ if (it == floatingObjectSet.end())
+ return false;
+
+ return logicalBottomForFloat(*it) > logicalHeight();
+}
+
void RenderBlock::addIntrudingFloats(RenderBlock* prev, int logicalLeftOffset, int logicalTopOffset)
{
// If the parent or previous sibling doesn't have any floats to add, don't bother.
diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h
index d45ab66..7ca13c6 100644
--- a/Source/WebCore/rendering/RenderBlock.h
+++ b/Source/WebCore/rendering/RenderBlock.h
@@ -542,6 +542,7 @@ private:
virtual bool avoidsFloats() const;
bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
+ bool hasOverhangingFloat(RenderBox*);
void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats);
diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 3134a44..0be31eb 100644
--- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -919,9 +919,13 @@ void FrameLoaderClientAndroid::transitionToCommittedFromCachedFrame(WebCore::Cac
#ifdef ANDROID_META_SUPPORT
platformData->restoreMetadata(m_frame->settings());
#endif
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+#else
WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view());
webViewCore->clearContent();
+#endif
m_webFrame->transitionToCommitted(m_frame);
}
@@ -956,7 +960,12 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() {
// Create a new WebFrameView for the new FrameView
WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore);
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+#else
webViewCore->clearContent();
+#endif
+
newFrameView->setLocation(bounds.x(), bounds.y());
newFrameView->setSize(bounds.width(), bounds.height());
newFrameView->setVisibleSize(visBounds.width(), visBounds.height());
diff --git a/Source/WebKit/android/jni/ViewStateSerializer.cpp b/Source/WebKit/android/jni/ViewStateSerializer.cpp
index c896637..93f4375 100644
--- a/Source/WebKit/android/jni/ViewStateSerializer.cpp
+++ b/Source/WebKit/android/jni/ViewStateSerializer.cpp
@@ -27,6 +27,7 @@
#include "BaseLayerAndroid.h"
#include "CreateJavaOutputStreamAdaptor.h"
+#include "ImagesManager.h"
#include "Layer.h"
#include "LayerAndroid.h"
#include "PictureSet.h"
@@ -302,7 +303,7 @@ void serializeLayer(LayerAndroid* layer, SkWStream* stream)
SkFlattenableWriteBuffer buffer(1024);
buffer.setFlags(SkFlattenableWriteBuffer::kCrossProcess_Flag);
ImageTexture* imagetexture =
- TilesManager::instance()->getTextureForImage(layer->m_imageRef, false);
+ ImagesManager::instance()->getTextureForImage(layer->m_imageRef, false);
if (imagetexture && imagetexture->bitmap())
imagetexture->bitmap()->flatten(buffer);
stream->write32(buffer.size());
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index 7f791ea..bb28d28 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -983,7 +983,7 @@ WebFrame::didReceiveAuthenticationChallenge(WebUrlLoaderClient* client, const st
}
void
-WebFrame::reportSslCertError(WebUrlLoaderClient* client, int cert_error, const std::string& cert, const std::string& url)
+WebFrame::reportSslCertError(WebUrlLoaderClient* client, int error, const std::string& cert, const std::string& url)
{
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
@@ -994,16 +994,14 @@ WebFrame::reportSslCertError(WebUrlLoaderClient* client, int cert_error, const s
return;
int jHandle = reinterpret_cast<int>(client);
+ // Don't copy the null terminator.
int len = cert.length();
- jbyteArray jCert = env->NewByteArray(len);
- jbyte* bytes = env->GetByteArrayElements(jCert, NULL);
- cert.copy(reinterpret_cast<char*>(bytes), len);
+ ScopedLocalRef<jbyteArray> jCert(env, env->NewByteArray(len));
+ env->SetByteArrayRegion(jCert.get(), 0, len, reinterpret_cast<const jbyte*>(cert.c_str()));
- jstring jUrl = env->NewStringUTF(url.c_str());
+ ScopedLocalRef<jstring> jUrl(env, env->NewStringUTF(url.c_str()));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mReportSslCertError, jHandle, cert_error, jCert, jUrl);
- env->DeleteLocalRef(jCert);
- env->DeleteLocalRef(jUrl);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mReportSslCertError, jHandle, error, jCert.get(), jUrl.get());
checkException(env);
}
@@ -1057,12 +1055,10 @@ WebFrame::didReceiveData(const char* data, int size) {
if (!javaFrame.get())
return;
- jbyteArray jData = env->NewByteArray(size);
- jbyte* bytes = env->GetByteArrayElements(jData, NULL);
- memcpy(reinterpret_cast<char*>(bytes), data, size);
+ ScopedLocalRef<jbyteArray> jData(env, env->NewByteArray(size));
+ env->SetByteArrayRegion(jData.get(), 0, size, reinterpret_cast<const jbyte*>(data));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mDidReceiveData, jData, size);
- env->DeleteLocalRef(jData);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mDidReceiveData, jData.get(), size);
checkException(env);
}
@@ -1091,13 +1087,11 @@ void WebFrame::setCertificate(const std::string& cert)
return;
int len = cert.length();
- jbyteArray jCert = env->NewByteArray(len);
- jbyte* bytes = env->GetByteArrayElements(jCert, NULL);
- cert.copy(reinterpret_cast<char*>(bytes), len);
+ ScopedLocalRef<jbyteArray> jCert(env, env->NewByteArray(len));
+ env->SetByteArrayRegion(jCert.get(), 0, len, reinterpret_cast<const jbyte*>(cert.c_str()));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mSetCertificate, jCert);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mSetCertificate, jCert.get());
- env->DeleteLocalRef(jCert);
checkException(env);
}
#endif // USE(CHROME_NETWORK_STACK)
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index d062db3..0876db6 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -570,24 +570,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
}
unsigned int pic = m_glWebViewState->currentPictureCounter();
-
- if (extra == &m_ring) {
- if (m_ring.m_isButton || root != m_ring.m_frame) {
- // TODO: Fix the navcache to work with layers correctly
- // In the meantime, this works around the bug. However, the rings
- // it produces are not as nice for some reason, thus we use
- // m_ring.rings() as produced by navcache for the base layer and
- // for layers we generate a new ring set
- m_ring.rings().clear();
- for (size_t i = 0; i < m_ring.m_node->rings().size(); i++) {
- IntRect rect = m_ring.m_node->rings().at(i);
- rect = m_ring.m_frame->adjustBounds(m_ring.m_node, rect);
- if (!m_ring.m_isButton)
- rect.inflate(4);
- m_ring.rings().append(rect);
- }
- }
- }
m_glWebViewState->glExtras()->setDrawExtra(extra);
LayerAndroid* compositeLayer = compositeRoot();
@@ -1934,15 +1916,16 @@ static jint nativeDraw(JNIEnv *env, jobject obj, jobject canv, jint color,
return reinterpret_cast<jint>(GET_NATIVE_VIEW(env, obj)->draw(canvas, color, extras, split));
}
-static jint nativeGetDrawGLFunction(JNIEnv *env, jobject obj, jobject jrect, jobject jviewrect,
- jfloat scale, jint extras) {
+static jint nativeGetDrawGLFunction(JNIEnv *env, jobject obj, jint nativeView,
+ jobject jrect, jobject jviewrect,
+ jfloat scale, jint extras) {
WebCore::IntRect viewRect;
if (jrect == NULL) {
viewRect = WebCore::IntRect();
} else {
viewRect = jrect_to_webrect(env, jrect);
}
- WebView *wvInstance = GET_NATIVE_VIEW(env, obj);
+ WebView *wvInstance = (WebView*) nativeView;
GLDrawFunctor* functor = new GLDrawFunctor(wvInstance, &android::WebView::drawGL,
viewRect, scale, extras);
wvInstance->setFunctor((Functor*) functor);
@@ -1982,10 +1965,10 @@ static void nativeUpdateDrawGLFunction(JNIEnv *env, jobject obj, jobject jrect,
}
}
-static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
+static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj, jint nativeView)
{
#if USE(ACCELERATED_COMPOSITING)
- LayerAndroid* root = GET_NATIVE_VIEW(env, obj)->compositeRoot();
+ LayerAndroid* root = ((WebView*)nativeView)->compositeRoot();
if (root)
return root->evaluateAnimations();
#endif
@@ -2303,10 +2286,10 @@ static bool nativeMoveCursor(JNIEnv *env, jobject obj,
return view->moveCursor(key, count, ignoreScroll);
}
-static void nativeRecordButtons(JNIEnv* env, jobject obj, bool hasFocus,
- bool pressed, bool invalidate)
+static void nativeRecordButtons(JNIEnv* env, jobject obj, jint nativeView,
+ bool hasFocus, bool pressed, bool invalidate)
{
- WebView* view = GET_NATIVE_VIEW(env, obj);
+ WebView* view = (WebView*) nativeView;
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
view->nativeRecordButtons(hasFocus, pressed, invalidate);
}
@@ -2566,10 +2549,10 @@ static jint nativeSelectionY(JNIEnv *env, jobject obj)
return GET_NATIVE_VIEW(env, obj)->selectionY();
}
-static void nativeSetSelectionPointer(JNIEnv *env, jobject obj, jboolean set,
- jfloat scale, jint x, jint y)
+static void nativeSetSelectionPointer(JNIEnv *env, jobject obj, jint nativeView,
+ jboolean set, jfloat scale, jint x, jint y)
{
- GET_NATIVE_VIEW(env, obj)->setSelectionPointer(set, scale, x, y);
+ ((WebView*)nativeView)->setSelectionPointer(set, scale, x, y);
}
static void nativeRegisterPageSwapCallback(JNIEnv *env, jobject obj)
@@ -2809,13 +2792,13 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeDestroy },
{ "nativeDraw", "(Landroid/graphics/Canvas;IIZ)I",
(void*) nativeDraw },
- { "nativeGetDrawGLFunction", "(Landroid/graphics/Rect;Landroid/graphics/Rect;FI)I",
+ { "nativeGetDrawGLFunction", "(ILandroid/graphics/Rect;Landroid/graphics/Rect;FI)I",
(void*) nativeGetDrawGLFunction },
{ "nativeUpdateDrawGLFunction", "(Landroid/graphics/Rect;Landroid/graphics/Rect;)V",
(void*) nativeUpdateDrawGLFunction },
{ "nativeDumpDisplayTree", "(Ljava/lang/String;)V",
(void*) nativeDumpDisplayTree },
- { "nativeEvaluateLayersAnimations", "()Z",
+ { "nativeEvaluateLayersAnimations", "(I)Z",
(void*) nativeEvaluateLayersAnimations },
{ "nativeExtendSelection", "(II)V",
(void*) nativeExtendSelection },
@@ -2893,7 +2876,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeMoveSelection },
{ "nativePointInNavCache", "(III)Z",
(void*) nativePointInNavCache },
- { "nativeRecordButtons", "(ZZZ)V",
+ { "nativeRecordButtons", "(IZZZ)V",
(void*) nativeRecordButtons },
{ "nativeResetSelection", "()V",
(void*) nativeResetSelection },
@@ -2929,7 +2912,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeCopyBaseContentToPicture },
{ "nativeHasContent", "()Z",
(void*) nativeHasContent },
- { "nativeSetSelectionPointer", "(ZFII)V",
+ { "nativeSetSelectionPointer", "(IZFII)V",
(void*) nativeSetSelectionPointer },
{ "nativeShowCursorTimed", "()V",
(void*) nativeShowCursorTimed },