summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp11
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.h5
-rw-r--r--Source/WebCore/platform/graphics/android/BaseRenderer.cpp22
-rw-r--r--Source/WebCore/platform/graphics/android/BaseRenderer.h6
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp6
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h3
-rw-r--r--Source/WebCore/platform/graphics/android/GaneshContext.cpp151
-rw-r--r--Source/WebCore/platform/graphics/android/GaneshContext.h23
-rw-r--r--Source/WebCore/platform/graphics/android/GaneshRenderer.cpp48
-rw-r--r--Source/WebCore/platform/graphics/android/SharedTexture.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/TextureInfo.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/TextureInfo.h4
-rw-r--r--Source/WebCore/platform/graphics/android/TilesProfiler.cpp6
-rw-r--r--Source/WebCore/rendering/RenderLayer.cpp3
-rw-r--r--Source/WebCore/rendering/RenderLayer.h9
-rw-r--r--Source/WebCore/rendering/RenderLayerCompositor.cpp135
-rw-r--r--Source/WebCore/rendering/RenderLayerCompositor.h4
-rw-r--r--Source/WebKit/Android.mk1
-rw-r--r--Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h2
-rw-r--r--Source/WebKit/android/WebCoreSupport/ChromiumInit.cpp3
-rw-r--r--Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp139
-rw-r--r--Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h75
-rw-r--r--Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp1
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp1
-rw-r--r--Source/WebKit/android/nav/WebView.cpp36
27 files changed, 385 insertions, 323 deletions
diff --git a/Android.mk b/Android.mk
index 39fa75a..623a35f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -362,6 +362,7 @@ LOCAL_LDLIBS += -lpthread -ldl
# Build the list of shared libraries
LOCAL_SHARED_LIBRARIES := \
+ libandroid \
libandroid_runtime \
libnativehelper \
libsqlite \
@@ -407,8 +408,7 @@ LOCAL_STATIC_LIBRARIES += libv8
endif
ifeq ($(HTTP_STACK),chrome)
-LOCAL_STATIC_LIBRARIES += libchromium_net
-LOCAL_SHARED_LIBRARIES += libcrypto libssl libz
+LOCAL_SHARED_LIBRARIES += libcrypto libssl libz libchromium_net
endif # HTTP_STACK == chrome
ifeq ($(ENABLE_AUTOFILL),true)
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index a09eb35..014fa40 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -112,7 +112,8 @@ void BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
}
#if USE(ACCELERATED_COMPOSITING)
-bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale, double currentTime)
+bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
+ double currentTime, bool* pagesSwapped)
{
if (!m_glWebViewState)
return false;
@@ -249,6 +250,8 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale, double
m_glWebViewState->setCurrentScale(scale);
m_glWebViewState->swapPages();
m_glWebViewState->unlockBaseLayerUpdate();
+ if (pagesSwapped)
+ *pagesSwapped = true;
}
m_glWebViewState->paintExtras();
@@ -259,7 +262,8 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale, double
bool BaseLayerAndroid::drawGL(LayerAndroid* compositedRoot,
IntRect& viewRect, SkRect& visibleRect,
IntRect& webViewRect, int titleBarHeight,
- IntRect& screenClip, float scale, SkColor color)
+ IntRect& screenClip, float scale,
+ bool* pagesSwapped, SkColor color)
{
bool needsRedraw = false;
#if USE(ACCELERATED_COMPOSITING)
@@ -299,7 +303,8 @@ bool BaseLayerAndroid::drawGL(LayerAndroid* compositedRoot,
shader->resetBlending();
double currentTime = WTF::currentTime();
- needsRedraw = drawBasePictureInGL(visibleRect, scale, currentTime);
+ needsRedraw = drawBasePictureInGL(visibleRect, scale, currentTime,
+ pagesSwapped);
bool goingDown = m_previousVisible.fTop - visibleRect.fTop <= 0;
bool goingLeft = m_previousVisible.fLeft - visibleRect.fLeft >= 0;
m_glWebViewState->setDirection(goingDown, goingLeft);
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
index 29ecf57..62aabb6 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
@@ -57,11 +57,12 @@ public:
bool drawGL(LayerAndroid* compositedRoot, IntRect& rect, SkRect& viewport,
IntRect& webViewRect, int titleBarHeight, IntRect& screenClip,
- float scale, SkColor color = SK_ColorWHITE);
+ float scale, bool* pagesSwapped, SkColor color = SK_ColorWHITE);
void swapExtra(BaseLayerAndroid* base) { m_extra.swap(base->m_extra); }
private:
#if USE(ACCELERATED_COMPOSITING)
- bool drawBasePictureInGL(SkRect& viewport, float scale, double currentTime);
+ bool drawBasePictureInGL(SkRect& viewport, float scale, double currentTime,
+ bool* pagesSwapped);
GLWebViewState* m_glWebViewState;
android::Mutex m_drawLock;
diff --git a/Source/WebCore/platform/graphics/android/BaseRenderer.cpp b/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
index 4fde188..ea6c8ec 100644
--- a/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
@@ -29,7 +29,9 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "GaneshRenderer.h"
#include "GLUtils.h"
+#include "RasterRenderer.h"
#include "SkBitmap.h"
#include "SkBitmapRef.h"
#include "SkCanvas.h"
@@ -56,6 +58,26 @@
namespace WebCore {
+BaseRenderer::RendererType BaseRenderer::g_currentType = BaseRenderer::Raster;
+
+BaseRenderer* BaseRenderer::createRenderer()
+{
+ if (g_currentType == Raster)
+ return new RasterRenderer();
+ else if (g_currentType == Ganesh)
+ return new GaneshRenderer();
+ return NULL;
+}
+
+void BaseRenderer::swapRendererIfNeeded(BaseRenderer*& renderer)
+{
+ if (renderer->getType() == g_currentType)
+ return;
+
+ delete renderer;
+ renderer = createRenderer();
+}
+
void BaseRenderer::drawTileInfo(SkCanvas* canvas,
const TileRenderInfo& renderInfo, int pictureCount)
{
diff --git a/Source/WebCore/platform/graphics/android/BaseRenderer.h b/Source/WebCore/platform/graphics/android/BaseRenderer.h
index 0ee9ebd..7780db1 100644
--- a/Source/WebCore/platform/graphics/android/BaseRenderer.h
+++ b/Source/WebCore/platform/graphics/android/BaseRenderer.h
@@ -80,6 +80,11 @@ public:
RendererType getType() { return m_type; }
+ static BaseRenderer* createRenderer();
+ static void swapRendererIfNeeded(BaseRenderer*& renderer);
+ static RendererType getCurrentRendererType() { return g_currentType; }
+ static void setCurrentRendererType(RendererType type) { g_currentType = type; }
+
protected:
virtual void setupCanvas(const TileRenderInfo& renderInfo, SkCanvas* canvas) = 0;
@@ -96,6 +101,7 @@ protected:
private:
RendererType m_type;
+ static RendererType g_currentType;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index 4cbcf7c..6ab2cd2 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -86,6 +86,8 @@ BaseTile::BaseTile(bool isLayerTile)
m_fullRepaint = new bool[m_maxBufferNumber];
for (int i = 0; i < m_maxBufferNumber; i++)
m_fullRepaint[i] = true;
+
+ m_renderer = BaseRenderer::createRenderer();
}
BaseTile::~BaseTile()
@@ -306,6 +308,9 @@ void BaseTile::paintBitmap()
unsigned int pictureCount = 0;
+ // swap out the renderer if necessary
+ BaseRenderer::swapRendererIfNeeded(m_renderer);
+
// setup the common renderInfo fields;
TileRenderInfo renderInfo;
renderInfo.x = x;
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 2e379bc..07dda03 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -501,7 +501,8 @@ void GLWebViewState::resetLayersDirtyArea()
bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
IntRect& webViewRect, int titleBarHeight,
- IntRect& clip, float scale, SkColor color)
+ IntRect& clip, float scale, bool* pagesSwapped,
+ SkColor color)
{
glFinish();
TilesManager::instance()->registerGLWebViewState(this);
@@ -548,7 +549,8 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
TilesManager::instance()->cleanupTilesTextures();
}
- bool ret = baseLayer->drawGL(compositedRoot, rect, viewport, webViewRect, titleBarHeight, clip, scale, color);
+ bool ret = baseLayer->drawGL(compositedRoot, rect, viewport, webViewRect,
+ titleBarHeight, clip, scale, pagesSwapped, color);
SkSafeRef(compositedRoot);
SkSafeUnref(m_previouslyUsedRoot);
m_previouslyUsedRoot = compositedRoot;
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index 6834974..4f8d4fe 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -220,7 +220,8 @@ public:
bool drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
IntRect& webViewRect, int titleBarHeight,
- IntRect& clip, float scale, SkColor color = SK_ColorWHITE);
+ IntRect& clip, float scale, bool* pagesSwapped,
+ SkColor color = SK_ColorWHITE);
void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
SkColor getBackgroundColor() { return m_backgroundColor; }
diff --git a/Source/WebCore/platform/graphics/android/GaneshContext.cpp b/Source/WebCore/platform/graphics/android/GaneshContext.cpp
index b316e5a..6118aef 100644
--- a/Source/WebCore/platform/graphics/android/GaneshContext.cpp
+++ b/Source/WebCore/platform/graphics/android/GaneshContext.cpp
@@ -28,6 +28,8 @@
#include "GaneshContext.h"
#include "GLUtils.h"
+#include "android/native_window.h"
+
#if USE(ACCELERATED_COMPOSITING)
#ifdef DEBUG
@@ -49,9 +51,12 @@ namespace WebCore {
GaneshContext::GaneshContext()
: m_grContext(0)
- , m_baseTileDevice(0)
- , m_baseTileFbo(0)
+ , m_baseTileDeviceFBO(0)
+ , m_baseTileFBO(0)
, m_baseTileStencil(0)
+ , m_baseTileDeviceSurface(0)
+ , m_surfaceConfig(0)
+ , m_surfaceContext(EGL_NO_CONTEXT)
{
}
@@ -72,10 +77,130 @@ GrContext* GaneshContext::getGrContext()
return m_grContext;
}
-SkDevice* GaneshContext::getDeviceForBaseTile(GLuint textureId)
+void GaneshContext::flush()
+{
+ if (m_grContext)
+ m_grContext->flush();
+}
+
+SkDevice* GaneshContext::getDeviceForBaseTile(const TileRenderInfo& renderInfo)
+{
+ SkDevice* device = 0;
+ if (renderInfo.textureInfo->getSharedTextureMode() == SurfaceTextureMode)
+ device = getDeviceForBaseTileSurface(renderInfo);
+ else if (renderInfo.textureInfo->getSharedTextureMode() == EglImageMode)
+ device = getDeviceForBaseTileFBO(renderInfo);
+
+ // TODO only need to reset if others are sharing our context
+ if (device)
+ getGrContext()->resetContext();
+
+ return device;
+}
+
+SkDevice* GaneshContext::getDeviceForBaseTileSurface(const TileRenderInfo& renderInfo)
+{
+ EGLDisplay display = eglGetCurrentDisplay();
+ GLUtils::checkEglError("eglGetCurrentDisplay");
+
+ if (!m_surfaceContext) {
+
+ EGLint numConfigs;
+ static const EGLint configAttribs[] = {
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_STENCIL_SIZE, 8,
+ EGL_NONE
+ };
+
+ eglChooseConfig(display, configAttribs, &m_surfaceConfig, 1, &numConfigs);
+ GLUtils::checkEglError("eglChooseConfig");
+
+ static const EGLint contextAttribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
+ m_surfaceContext = eglCreateContext(display, m_surfaceConfig, NULL, contextAttribs);
+ GLUtils::checkEglError("eglCreateContext");
+ }
+
+ if (renderInfo.textureInfo->m_eglSurface == EGL_NO_SURFACE) {
+
+ const float tileWidth = renderInfo.tileSize.width();
+ const float tileHeight = renderInfo.tileSize.height();
+ ANativeWindow* anw = renderInfo.textureInfo->m_ANW.get();
+
+ int result = ANativeWindow_setBuffersGeometry(anw, (int)tileWidth,
+ (int)tileHeight, WINDOW_FORMAT_RGBA_8888);
+
+ renderInfo.textureInfo->m_width = tileWidth;
+ renderInfo.textureInfo->m_height = tileHeight;
+ renderInfo.textureInfo->m_eglSurface = eglCreateWindowSurface(display, m_surfaceConfig, anw, NULL);
+
+ GLUtils::checkEglError("eglCreateWindowSurface");
+ XLOG("eglCreateWindowSurface");
+ }
+
+ EGLBoolean returnValue = eglMakeCurrent(display, renderInfo.textureInfo->m_eglSurface, renderInfo.textureInfo->m_eglSurface, m_surfaceContext);
+ GLUtils::checkEglError("eglMakeCurrent", returnValue);
+ XLOG("eglMakeCurrent");
+
+ if (!m_baseTileDeviceSurface) {
+
+ GrPlatformSurfaceDesc surfaceDesc;
+ surfaceDesc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
+ surfaceDesc.fRenderTargetFlags = kNone_GrPlatformRenderTargetFlagBit;
+ surfaceDesc.fWidth = TilesManager::tileWidth();
+ surfaceDesc.fHeight = TilesManager::tileHeight();
+ surfaceDesc.fConfig = kRGBA_8888_GrPixelConfig;
+ surfaceDesc.fStencilBits = 8;
+ surfaceDesc.fPlatformRenderTarget = 0;
+
+ GrContext* grContext = getGrContext();
+ GrRenderTarget* renderTarget = (GrRenderTarget*) grContext->createPlatformSurface(surfaceDesc);
+
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ renderInfo.tileSize.width(),
+ renderInfo.tileSize.height());
+
+ m_baseTileDeviceSurface = new SkGpuDevice(grContext, bitmap, renderTarget);
+ renderTarget->unref();
+ XLOG("generated device %p", m_baseTileDeviceSurface);
+ }
+
+ GLUtils::checkGlError("getDeviceForBaseTile");
+ return m_baseTileDeviceSurface;
+}
+
+SkDevice* GaneshContext::getDeviceForBaseTileFBO(const TileRenderInfo& renderInfo)
{
- if (!m_baseTileFbo) {
- glGenFramebuffers(1, &m_baseTileFbo);
+ const GLuint textureId = renderInfo.textureInfo->m_textureId;
+ const float tileWidth = renderInfo.tileSize.width();
+ const float tileHeight = renderInfo.tileSize.height();
+
+ // bind to the current texture
+ glBindTexture(GL_TEXTURE_2D, textureId);
+
+ // setup the texture if needed
+ if (renderInfo.textureInfo->m_width != tileWidth
+ || renderInfo.textureInfo->m_height != tileHeight) {
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tileWidth, tileHeight,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ renderInfo.textureInfo->m_width = tileWidth;
+ renderInfo.textureInfo->m_height = tileHeight;
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ }
+
+ if (!m_baseTileFBO) {
+ glGenFramebuffers(1, &m_baseTileFBO);
XLOG("generated FBO");
}
@@ -90,20 +215,21 @@ SkDevice* GaneshContext::getDeviceForBaseTile(GLuint textureId)
XLOG("generated stencil");
}
- glBindFramebuffer(GL_FRAMEBUFFER, m_baseTileFbo);
+ // bind the FBO and attach the texture and stencil
+ glBindFramebuffer(GL_FRAMEBUFFER, m_baseTileFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_baseTileStencil);
- if (!m_baseTileDevice) {
+ if (!m_baseTileDeviceFBO) {
GrPlatformSurfaceDesc surfaceDesc;
surfaceDesc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
surfaceDesc.fRenderTargetFlags = kNone_GrPlatformRenderTargetFlagBit;
surfaceDesc.fWidth = TilesManager::tileWidth();
- surfaceDesc.fHeight = TilesManager::tileWidth();
+ surfaceDesc.fHeight = TilesManager::tileHeight();
surfaceDesc.fConfig = kRGBA_8888_GrPixelConfig;
surfaceDesc.fStencilBits = 8;
- surfaceDesc.fPlatformRenderTarget = m_baseTileFbo;
+ surfaceDesc.fPlatformRenderTarget = m_baseTileFBO;
GrContext* grContext = getGrContext();
GrRenderTarget* renderTarget = (GrRenderTarget*) grContext->createPlatformSurface(surfaceDesc);
@@ -112,17 +238,16 @@ SkDevice* GaneshContext::getDeviceForBaseTile(GLuint textureId)
bitmap.setConfig(SkBitmap::kARGB_8888_Config,
TilesManager::tileWidth(), TilesManager::tileWidth());
- m_baseTileDevice = new SkGpuDevice(grContext, bitmap, renderTarget);
+ m_baseTileDeviceFBO = new SkGpuDevice(grContext, bitmap, renderTarget);
renderTarget->unref();
- XLOG("generated device %p", m_baseTileDevice);
+ XLOG("generated device %p", m_baseTileDeviceFBO);
}
GLUtils::checkGlError("getDeviceForBaseTile");
- return m_baseTileDevice;
+ return m_baseTileDeviceFBO;
}
-
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/android/GaneshContext.h b/Source/WebCore/platform/graphics/android/GaneshContext.h
index 9d90b96..12ea92d 100644
--- a/Source/WebCore/platform/graphics/android/GaneshContext.h
+++ b/Source/WebCore/platform/graphics/android/GaneshContext.h
@@ -28,6 +28,7 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "BaseRenderer.h"
#include "GrContext.h"
#include "SkGpuDevice.h"
#include "TilesManager.h"
@@ -38,19 +39,33 @@ class GaneshContext {
public:
static GaneshContext* instance();
- GrContext* getGrContext();
+ SkDevice* getDeviceForBaseTile(const TileRenderInfo& renderInfo);
- SkDevice* getDeviceForBaseTile(GLuint textureId);
+ void flush();
private:
GaneshContext();
+ GrContext* getGrContext();
+
+ // Creates a device for rendering into a SurfaceTexture via an EGLSurface
+ SkDevice* getDeviceForBaseTileSurface(const TileRenderInfo& renderInfo);
+ // Creates a device for rendering into a EGLImage via an FBO
+ SkDevice* getDeviceForBaseTileFBO(const TileRenderInfo& renderInfo);
+
GrContext* m_grContext;
- SkGpuDevice* m_baseTileDevice;
- GLuint m_baseTileFbo;
+
+ // FBO specific variables
+ SkGpuDevice* m_baseTileDeviceFBO;
+ GLuint m_baseTileFBO;
GLuint m_baseTileStencil;
+ // Surface specific variables
+ SkGpuDevice* m_baseTileDeviceSurface;
+ EGLConfig m_surfaceConfig;
+ EGLContext m_surfaceContext;
+
static GaneshContext* gInstance;
};
diff --git a/Source/WebCore/platform/graphics/android/GaneshRenderer.cpp b/Source/WebCore/platform/graphics/android/GaneshRenderer.cpp
index fcb0675..8f4d0b3 100644
--- a/Source/WebCore/platform/graphics/android/GaneshRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/GaneshRenderer.cpp
@@ -34,12 +34,12 @@
#include "SkGpuDevice.h"
#include "TilesManager.h"
-#include <wtf/text/CString.h>
#ifdef DEBUG
#include <cutils/log.h>
#include <wtf/CurrentTime.h>
+#include <wtf/text/CString.h>
#undef XLOG
#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "GaneshRenderer", __VA_ARGS__)
@@ -63,7 +63,7 @@ static const String TAGS[] = {
TAG_UPDATE_TEXTURE,
};
-GaneshRenderer::GaneshRenderer() : BaseRenderer(BaseRenderer::Raster)
+GaneshRenderer::GaneshRenderer() : BaseRenderer(BaseRenderer::Ganesh)
{
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("GaneshRenderer");
@@ -82,37 +82,17 @@ void GaneshRenderer::setupCanvas(const TileRenderInfo& renderInfo, SkCanvas* can
if (renderInfo.measurePerf)
m_perfMon.start(TAG_CREATE_FBO);
- const float tileWidth = renderInfo.tileSize.width();
- const float tileHeight = renderInfo.tileSize.height();
-
- glBindTexture(GL_TEXTURE_2D, renderInfo.textureInfo->m_textureId);
-
- // setup the texture if needed
- if (renderInfo.textureInfo->m_width != tileWidth
- || renderInfo.textureInfo->m_height != tileHeight) {
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tileWidth, tileHeight,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- renderInfo.textureInfo->m_width = tileWidth;
- renderInfo.textureInfo->m_height = tileHeight;
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
-
GaneshContext* ganesh = GaneshContext::instance();
- // TODO only need to reset if others are sharing our context
- ganesh->getGrContext()->resetContext();
-
SkDevice* device = NULL;
- if (tileWidth == TilesManager::tileWidth() && tileHeight == TilesManager::tileHeight()) {
- device = ganesh->getDeviceForBaseTile(renderInfo.textureInfo->m_textureId);
+ if (renderInfo.tileSize.width() == TilesManager::tileWidth()
+ && renderInfo.tileSize.height() == TilesManager::tileHeight()) {
+ device = ganesh->getDeviceForBaseTile(renderInfo);
} else {
// TODO support arbitrary sizes for layers
XLOG("ERROR: expected (%d,%d) actual (%d,%d)",
TilesManager::tileWidth(), TilesManager::tileHeight(),
- tileWidth, tileHeight);
+ renderInfo.tileSize.width(), renderInfo.tileSize.height());
}
if (renderInfo.measurePerf) {
@@ -124,8 +104,10 @@ void GaneshRenderer::setupCanvas(const TileRenderInfo& renderInfo, SkCanvas* can
canvas->setDevice(device);
// invert canvas contents
- canvas->scale(SK_Scalar1, -SK_Scalar1);
- canvas->translate(0, -SkIntToScalar(renderInfo.tileSize.height()));
+ if (renderInfo.textureInfo->getSharedTextureMode() == EglImageMode) {
+ canvas->scale(SK_Scalar1, -SK_Scalar1);
+ canvas->translate(0, -renderInfo.tileSize.height());
+ }
}
void GaneshRenderer::setupPartialInval(const TileRenderInfo& renderInfo, SkCanvas* canvas)
@@ -145,9 +127,15 @@ void GaneshRenderer::renderingComplete(const TileRenderInfo& renderInfo, SkCanva
m_perfMon.start(TAG_UPDATE_TEXTURE);
}
- GaneshContext::instance()->getGrContext()->flush();
+ XLOG("rendered to tile (%d,%d)", renderInfo.x, renderInfo.y);
+
+ GaneshContext::instance()->flush();
- //TODO if texture is surfaceTexture then...
+ // In SurfaceTextureMode we must call swapBuffers to unlock and post the
+ // tile's ANativeWindow (i.e. SurfaceTexture) buffer
+ if (renderInfo.textureInfo->getSharedTextureMode() == SurfaceTextureMode) {
+ eglSwapBuffers(eglGetCurrentDisplay(), renderInfo.textureInfo->m_eglSurface);
+ }
if (renderInfo.measurePerf)
m_perfMon.stop(TAG_UPDATE_TEXTURE);
diff --git a/Source/WebCore/platform/graphics/android/SharedTexture.cpp b/Source/WebCore/platform/graphics/android/SharedTexture.cpp
index 4f52107..a7d43b5 100644
--- a/Source/WebCore/platform/graphics/android/SharedTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/SharedTexture.cpp
@@ -60,11 +60,9 @@ SharedTexture::SharedTexture(SharedTextureMode mode)
glGenTextures(1, &m_sourceTexture->m_textureId);
m_sourceTexture->m_surfaceTexture =
- new android::SurfaceTexture(m_sourceTexture->m_textureId);
+ new android::SurfaceTexture(m_sourceTexture->m_textureId, false);
m_sourceTexture->m_ANW =
new android::SurfaceTextureClient(m_sourceTexture->m_surfaceTexture);
-
- m_sourceTexture->m_surfaceTexture->setSynchronousMode(false);
}
}
diff --git a/Source/WebCore/platform/graphics/android/TextureInfo.cpp b/Source/WebCore/platform/graphics/android/TextureInfo.cpp
index 849e6fc..5db1711 100644
--- a/Source/WebCore/platform/graphics/android/TextureInfo.cpp
+++ b/Source/WebCore/platform/graphics/android/TextureInfo.cpp
@@ -42,6 +42,7 @@ TextureInfo::TextureInfo(SharedTextureMode mode)
m_height = 0;
m_internalFormat = 0;
m_sharedTextureMode = mode;
+ m_eglSurface = EGL_NO_SURFACE;
}
bool TextureInfo::equalsAttributes(const TextureInfo* otherTexture)
diff --git a/Source/WebCore/platform/graphics/android/TextureInfo.h b/Source/WebCore/platform/graphics/android/TextureInfo.h
index 252d288..c1cb1cd 100644
--- a/Source/WebCore/platform/graphics/android/TextureInfo.h
+++ b/Source/WebCore/platform/graphics/android/TextureInfo.h
@@ -26,6 +26,7 @@
#ifndef TextureInfo_h
#define TextureInfo_h
+#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <jni.h>
#include <ui/GraphicBuffer.h>
@@ -70,6 +71,9 @@ public:
sp<android::SurfaceTexture> m_surfaceTexture;
sp<ANativeWindow> m_ANW;
+ // The EGLSurface wraps the m_ANW to enable direct OpenGL rendering (e.g. Ganesh)
+ EGLSurface m_eglSurface;
+
private:
SharedTextureMode m_sharedTextureMode;
};
diff --git a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
index 466923a..653d525 100644
--- a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
@@ -97,7 +97,7 @@ void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float sc
m_records.append(WTF::Vector<TileProfileRecord>());
- //first two records designate viewport
+ //first record designates viewport
m_records.last().append(TileProfileRecord(
left, top, right, bottom,
scale, true, (int)(timeDelta * 1000)));
@@ -105,7 +105,7 @@ void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float sc
void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
{
- if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+ if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES) || (m_records.size() == 0))
return;
bool isReady = tile.isTileReady();
@@ -128,7 +128,7 @@ void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
void TilesProfiler::nextInval(const IntRect& rect, float scale)
{
- if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+ if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES) || (m_records.size() == 0))
return;
m_records.last().append(TileProfileRecord(
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 4e1c875..ce5bf27 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -177,6 +177,9 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer)
#if USE(ACCELERATED_COMPOSITING)
, m_hasCompositingDescendant(false)
, m_mustOverlapCompositedLayers(false)
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ , m_shouldComposite(false)
+#endif
#endif
, m_containsDirtyOverlayScrollbars(false)
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h
index 2174920..f257593 100644
--- a/Source/WebCore/rendering/RenderLayer.h
+++ b/Source/WebCore/rendering/RenderLayer.h
@@ -354,7 +354,7 @@ public:
if (hasOverflowScroll())
return true;
#endif
- return !hasAutoZIndex() || renderer()->isRenderView() || (isComposited() && isFixed());
+ return !hasAutoZIndex() || renderer()->isRenderView() || (isComposited() && isFixed()) || m_shouldComposite;
}
#else
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
@@ -641,6 +641,10 @@ private:
bool mustOverlapCompositedLayers() const { return m_mustOverlapCompositedLayers; }
void setMustOverlapCompositedLayers(bool b) { m_mustOverlapCompositedLayers = b; }
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ bool shouldComposite() { return m_shouldComposite; }
+ void setShouldComposite(bool b) { m_shouldComposite = b; }
+#endif
#endif
void updateContentsScale(float);
@@ -743,6 +747,9 @@ protected:
#if USE(ACCELERATED_COMPOSITING)
bool m_hasCompositingDescendant : 1; // In the z-order tree.
bool m_mustOverlapCompositedLayers : 1;
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ bool m_shouldComposite : 1;
+#endif
#endif
bool m_containsDirtyOverlayScrollbars : 1;
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 786f806..8d066e9 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -80,6 +80,9 @@ struct CompositingState {
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
, m_fixedSibling(false)
#endif
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ , m_hasScrollableElement(false)
+#endif
#ifndef NDEBUG
, m_depth(0)
#endif
@@ -91,6 +94,9 @@ struct CompositingState {
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
bool m_fixedSibling;
#endif
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ bool m_hasScrollableElement;
+#endif
#ifndef NDEBUG
int m_depth;
#endif
@@ -288,6 +294,10 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
// FIXME: we could maybe do this and the hierarchy udpate in one pass, but the parenting logic would be more complex.
CompositingState compState(updateRoot);
bool layersChanged = false;
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ compState.m_hasScrollableElement = false;
+#endif
if (m_compositingConsultsOverlap) {
OverlapMap overlapTestRequestMap;
computeCompositingRequirements(updateRoot, &overlapTestRequestMap, compState, layersChanged);
@@ -589,14 +599,6 @@ bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, con
for (RenderLayerCompositor::OverlapMap::const_iterator it = overlapMap.begin(); it != end; ++it) {
const IntRect& bounds = it->second;
if (layerBounds.intersects(bounds)) {
-#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- RenderLayer* intersectedLayer = it->first;
- if (intersectedLayer && intersectedLayer->isFixed()) {
- if (bounds.contains(layerBounds)) {
- continue;
- }
- }
-#endif
return true;
}
}
@@ -604,6 +606,53 @@ bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, con
return false;
}
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+
+// to properly support z-index with composited fixed elements, we need to turn
+// layers following a fixed layer into compositing mode; but if a layer is fully
+// contained into a previous layer already composited (that is not the fixed
+// layer), we don't need to composite it. This saves up quite a bit on the
+// number of layers we have to composite.
+//
+bool RenderLayerCompositor::checkForFixedLayers(Vector<RenderLayer*>* list, bool stopAtFixedLayer)
+{
+ size_t listSize = list->size();
+ int haveFixedLayer = -1;
+ bool fixedSibling = false;
+ for (size_t j = 0; j < listSize; ++j) {
+ RenderLayer* currentLayer = list->at(j);
+ if (currentLayer->isFixed() && needsToBeComposited(currentLayer)) {
+ haveFixedLayer = j;
+ fixedSibling = true;
+ }
+ if (haveFixedLayer != -1 && haveFixedLayer != j) {
+ IntRect currentLayerBounds = currentLayer->renderer()->localToAbsoluteQuad(
+ FloatRect(currentLayer->localBoundingBox())).enclosingBoundingBox();
+ bool needComposite = true;
+ int stop = 0;
+ if (stopAtFixedLayer)
+ stop = haveFixedLayer + 1;
+
+ for (size_t k = j - 1; k >= stop; --k) {
+ RenderLayer* aLayer = list->at(k);
+ if (aLayer && aLayer->renderer()) {
+ IntRect bounds = aLayer->renderer()->localToAbsoluteQuad(
+ FloatRect(aLayer->localBoundingBox())).enclosingBoundingBox();
+ if (bounds.contains(currentLayerBounds)
+ && needsToBeComposited(aLayer)) {
+ needComposite = false;
+ break;
+ }
+ }
+ }
+ currentLayer->setShouldComposite(needComposite);
+ }
+ }
+ return fixedSibling;
+}
+
+#endif
+
// Recurse through the layers in z-index and overflow order (which is equivalent to painting order)
// For the z-order children of a compositing layer:
// If a child layers has a compositing layer, then all subsequent layers must
@@ -636,7 +685,14 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds);
}
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ if (compositingState.m_fixedSibling)
+ layer->setMustOverlapCompositedLayers(layer->shouldComposite());
+ else
+ layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers);
+#else
layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers);
+#endif
// The children of this layer don't need to composite, unless there is
// a compositing layer among them, so start by inheriting the compositing
@@ -648,17 +704,20 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
bool willBeComposited = needsToBeComposited(layer);
-#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- // If we are a fixed layer, signal it to our siblings
- if (willBeComposited && layer->isFixed())
- compositingState.m_fixedSibling = true;
-
- if (!willBeComposited && compositingState.m_fixedSibling) {
- layer->setMustOverlapCompositedLayers(true);
- willBeComposited = true;
- }
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ // tell the parent it has scrollable descendants.
+ if (layer->hasOverflowScroll())
+ compositingState.m_hasScrollableElement = true;
#endif
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ // we don't want to signal that the subtree is compositing if the reason
+ // is because the layer is an overflow layer -- doing so would trigger
+ // all the above layers to be composited unnecessarily
+ if (willBeComposited && !layer->hasOverflowScroll()) {
+#else
if (willBeComposited) {
+#endif
// Tell the parent it has compositing descendants.
compositingState.m_subtreeIsCompositing = true;
// This layer now acts as the ancestor for kids.
@@ -680,25 +739,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- childState.m_fixedSibling = false;
-
- // For the negative z-order, if we have a fixed layer
- // we need to make all the siblings composited layers.
- // Otherwise a negative layer (below the fixed layer) could
- // still be drawn onto a higher z-order layer (e.g. the body)
- // if not immediately intersecting with our fixed layer.
- // So it's not enough here to only set m_fixedSibling for
- // subsequent siblings as we do for the normal flow
- // and positive z-order.
- for (size_t j = 0; j < listSize; ++j) {
- if ((negZOrderList->at(j))->isFixed() &&
- needsToBeComposited(negZOrderList->at(j))) {
- childState.m_fixedSibling = true;
- break;
- }
- }
+ childState.m_fixedSibling = compositingState.m_fixedSibling;
+ if (checkForFixedLayers(negZOrderList, false))
+ childState.m_fixedSibling = true;
#endif
-
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = negZOrderList->at(i);
computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged);
@@ -716,12 +760,14 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
}
}
}
-
+
ASSERT(!layer->m_normalFlowListDirty);
if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
size_t listSize = normalFlowList->size();
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- childState.m_fixedSibling = false;
+ childState.m_fixedSibling = compositingState.m_fixedSibling;
+ if (checkForFixedLayers(normalFlowList, true))
+ childState.m_fixedSibling = true;
#endif
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = normalFlowList->at(i);
@@ -733,7 +779,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
size_t listSize = posZOrderList->size();
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- childState.m_fixedSibling = false;
+ childState.m_fixedSibling = compositingState.m_fixedSibling;
+ if (checkForFixedLayers(posZOrderList, true))
+ childState.m_fixedSibling = true;
#endif
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = posZOrderList->at(i);
@@ -768,6 +816,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (childState.m_subtreeIsCompositing)
compositingState.m_subtreeIsCompositing = true;
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ if (childState.m_hasScrollableElement)
+ compositingState.m_hasScrollableElement = true;
+#endif
+
// Set the flag to say that this SC has compositing children.
layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing);
@@ -781,7 +834,13 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
// If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
// to be composited, then we can drop out of compositing mode altogether.
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ // We also need to check that we don't have a scrollable layer, as this
+ // would not have set the m_subtreeIsCompositing flag
+ if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !childState.m_hasScrollableElement && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
+#else
if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
+#endif
enableCompositingMode(false);
willBeComposited = false;
}
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h
index 0315050..813e265 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.h
+++ b/Source/WebCore/rendering/RenderLayerCompositor.h
@@ -218,6 +218,10 @@ private:
void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ bool checkForFixedLayers(Vector<RenderLayer*>* list, bool stopAtFixedLayer);
+#endif
+
// Returns true if any layer's compositing changed
void computeCompositingRequirements(RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged);
diff --git a/Source/WebKit/Android.mk b/Source/WebKit/Android.mk
index 3a47909..f3d33c6 100644
--- a/Source/WebKit/Android.mk
+++ b/Source/WebKit/Android.mk
@@ -131,7 +131,6 @@ LOCAL_CFLAGS += -DENABLE_WEB_AUTOFILL
LOCAL_SRC_FILES += \
android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp \
- android/WebCoreSupport/autofill/FormFieldAndroid.cpp \
android/WebCoreSupport/autofill/FormManagerAndroid.cpp \
android/WebCoreSupport/autofill/WebAutofill.cpp
endif # ENABLE_AUTOFILL == true
diff --git a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
index 9728aad..022511a 100644
--- a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
+++ b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
@@ -46,6 +46,7 @@
#endif
#include <android/net/android_network_library_impl.h>
+#include <android/jni/jni_utils.h>
#include <base/callback.h>
#include <base/memory/ref_counted.h>
#include <base/message_loop_proxy.h>
@@ -95,6 +96,7 @@
#include <chrome/browser/profiles/profile.h>
#include <content/browser/tab_contents/tab_contents.h>
#include <webkit/glue/form_data.h>
+#include <webkit/glue/form_field.h>
#endif
#undef LOG
diff --git a/Source/WebKit/android/WebCoreSupport/ChromiumInit.cpp b/Source/WebKit/android/WebCoreSupport/ChromiumInit.cpp
index 2bb4d3d..500975c 100644
--- a/Source/WebKit/android/WebCoreSupport/ChromiumInit.cpp
+++ b/Source/WebKit/android/WebCoreSupport/ChromiumInit.cpp
@@ -27,6 +27,8 @@
#include "ChromiumInit.h"
#include "ChromiumIncludes.h"
+#include "JNIUtility.h"
+#include "jni.h"
#include <cutils/log.h>
#include <string>
@@ -68,6 +70,7 @@ void initChromium()
networkChangeNotifier.reset(net::NetworkChangeNotifier::Create());
net::HttpNetworkLayer::EnableSpdy("npn");
initCalled = true;
+ jni::SetJavaVM(JSC::Bindings::getJavaVM());
}
}
diff --git a/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp b/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp
deleted file mode 100644
index 3f5970a..0000000
--- a/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2010 The Chromium Authors. All rights reserved.
- * Copyright 2010, 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 "FormFieldAndroid.h"
-
-#include "ChromiumIncludes.h"
-#include "Element.h"
-#include "HTMLFormControlElement.h"
-#include "HTMLInputElement.h"
-#include "HTMLNames.h"
-#include "HTMLOptionElement.h"
-#include "HTMLSelectElement.h"
-#include "StringUtils.h"
-#include <wtf/Vector.h>
-
-using WebCore::Element;
-using WebCore::HTMLFormControlElement;
-using WebCore::HTMLInputElement;
-using WebCore::HTMLOptionElement;
-using WebCore::HTMLSelectElement;
-
-using namespace WebCore::HTMLNames;
-
-// TODO: This file is taken from chromium/webkit/glue/form_field.cc and
-// customised to use WebCore types rather than WebKit API types. It would
-// be nice and would ease future merge pain if the two could be combined.
-
-namespace webkit_glue {
-
-FormField::FormField()
- : max_length(0),
- is_autofilled(false) {
-}
-
-// TODO: This constructor should probably be deprecated and the
-// functionality moved to FormManager.
-FormField::FormField(const HTMLFormControlElement& element)
- : max_length(0),
- is_autofilled(false) {
- name = nameForAutofill(element);
-
- // TODO: Extract the field label. For now we just use the field
- // name.
- label = name;
-
- form_control_type = formControlType(element);
- if (form_control_type == kText) {
- const HTMLInputElement& input_element = static_cast<const HTMLInputElement&>(element);
- value = WTFStringToString16(input_element.value());
- max_length = input_element.size();
- is_autofilled = input_element.isAutofilled();
- } else if (form_control_type == kSelectOne) {
- const HTMLSelectElement& const_select_element = static_cast<const HTMLSelectElement&>(element);
- HTMLSelectElement& select_element = const_cast<HTMLSelectElement&>(const_select_element);
- value = WTFStringToString16(select_element.value());
-
- // For select-one elements copy option strings.
- WTF::Vector<Element*> list_items = select_element.listItems();
- option_strings.reserve(list_items.size());
- for (size_t i = 0; i < list_items.size(); ++i) {
- if (list_items[i]->hasTagName(optionTag))
- option_strings.push_back(WTFStringToString16(static_cast<HTMLOptionElement*>(list_items[i])->value()));
- }
- }
-
- TrimWhitespace(value, TRIM_LEADING, &value);
-}
-
-FormField::FormField(const string16& _label, const string16& _name, const string16& _value, const string16& _form_control_type, int _max_length, bool _is_autofilled)
- : label(_label),
- name(_name),
- value(_value),
- form_control_type(_form_control_type),
- max_length(_max_length),
- is_autofilled(_is_autofilled) {
-}
-
-FormField::~FormField() {
-}
-
-bool FormField::operator==(const FormField& field) const {
- // A FormField stores a value, but the value is not part of the identity of
- // the field, so we don't want to compare the values.
- return (label == field.label &&
- name == field.name &&
- form_control_type == field.form_control_type &&
- max_length == field.max_length);
-}
-
-bool FormField::operator!=(const FormField& field) const {
- return !operator==(field);
-}
-
-bool FormField::StrictlyEqualsHack(const FormField& field) const {
- return (label == field.label &&
- name == field.name &&
- value == field.value &&
- form_control_type == field.form_control_type &&
- max_length == field.max_length);
-}
-
-std::ostream& operator<<(std::ostream& os, const FormField& field) {
- return os
- << UTF16ToUTF8(field.label)
- << " "
- << UTF16ToUTF8(field.name)
- << " "
- << UTF16ToUTF8(field.value)
- << " "
- << UTF16ToUTF8(field.form_control_type)
- << " "
- << field.max_length;
-}
-
-} // namespace webkit_glue
diff --git a/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h b/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h
deleted file mode 100644
index 7367f86..0000000
--- a/Source/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 The Chromium Authors. All rights reserved.
- * Copyright 2010, 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 FormFieldAndroid_h
-#define FormFieldAndroid_h
-
-#include <base/string16.h>
-#include <vector>
-
-// TODO: This file is taken from chromium/webkit/glue/form_field.h and
-// customised to use WebCore types rather than WebKit API types. It would
-// be nice and would ease future merge pain if the two could be combined.
-
-namespace WebCore {
-class HTMLFormControlElement;
-}
-
-namespace webkit_glue {
-
-// Stores information about a field in a form.
-struct FormField {
- FormField();
- explicit FormField(const WebCore::HTMLFormControlElement& element);
- FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, int max_length, bool is_autofilled);
- virtual ~FormField();
-
- // Equality tests for identity which does not include |value_| or |size_|.
- // Use |StrictlyEqualsHack| method to test all members.
- // TODO: These operators need to be revised when we implement field
- // ids.
- bool operator==(const FormField& field) const;
- bool operator!=(const FormField& field) const;
-
- // Test equality of all data members.
- // TODO: This will be removed when we implement field ids.
- bool StrictlyEqualsHack(const FormField& field) const;
-
- string16 label;
- string16 name;
- string16 value;
- string16 form_control_type;
- int max_length;
- bool is_autofilled;
- std::vector<string16> option_strings;
-};
-
-// So we can compare FormFields with EXPECT_EQ().
-std::ostream& operator<<(std::ostream& os, const FormField& field);
-
-} // namespace webkit_glue
-
-#endif // WEBKIT_GLUE_FORM_FIELD_H_
diff --git a/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
index ba015e2..65b6771 100644
--- a/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
@@ -44,7 +44,6 @@
#include "NodeList.h"
#include "HTMLCollection.h"
#include "FormAssociatedElement.h"
-#include "FormFieldAndroid.h"
#include "QualifiedName.h"
#include "StringUtils.h"
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 1c51b14..a883075 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -437,6 +437,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
// Static initialisation of certain important V8 static data gets performed at system startup when
// libwebcore gets loaded. We now need to associate the WebCore thread with V8 to complete
// initialisation.
+ WebCore::ScriptController::setFlags("--nocrankshaft", strlen("--nocrankshaft"));
v8::V8::Initialize();
#endif
}
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 6a95d33..69d1ee8 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -126,6 +126,7 @@ struct JavaGlue {
jmethodID m_viewInvalidate;
jmethodID m_viewInvalidateRect;
jmethodID m_postInvalidateDelayed;
+ jmethodID m_pageSwapCallback;
jmethodID m_inFullScreenMode;
jfieldID m_rectLeft;
jfieldID m_rectTop;
@@ -162,6 +163,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_javaGlue.m_viewInvalidateRect = GetJMethod(env, clazz, "viewInvalidate", "(IIII)V");
m_javaGlue.m_postInvalidateDelayed = GetJMethod(env, clazz,
"viewInvalidateDelayed", "(JIIII)V");
+ m_javaGlue.m_pageSwapCallback = GetJMethod(env, clazz, "pageSwapCallback", "()V");
m_javaGlue.m_inFullScreenMode = GetJMethod(env, clazz, "inFullScreenMode", "()Z");
env->DeleteLocalRef(clazz);
@@ -198,6 +200,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_buttonSkin = new RenderSkinButton(am, drawableDir);
#if USE(ACCELERATED_COMPOSITING)
m_glWebViewState = 0;
+ m_pageSwapCallbackRegistered = false;
#endif
}
@@ -513,8 +516,20 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
// once the correct scale is set
if (!visibleRect.hasValidCoordinates())
return false;
+ bool pagesSwapped = false;
bool ret = m_glWebViewState->drawGL(viewRect, visibleRect, invalRect,
- webViewRect, titleBarHeight, clip, scale);
+ webViewRect, titleBarHeight, clip, scale,
+ &pagesSwapped);
+ if (m_pageSwapCallbackRegistered && pagesSwapped) {
+ m_pageSwapCallbackRegistered = false;
+ LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject javaObject = m_javaGlue.object(env);
+ if (javaObject.get()) {
+ env->CallVoidMethod(javaObject.get(), m_javaGlue.m_pageSwapCallback);
+ checkException(env);
+ }
+ }
if (ret || m_glWebViewState->currentPictureCounter() != pic)
return true;
#endif
@@ -1435,12 +1450,13 @@ static void copyScrollPositionRecursive(const LayerAndroid* from,
#endif
void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndicator,
- bool isPictureAfterFirstLayout)
+ bool isPictureAfterFirstLayout, bool registerPageSwapCallback)
{
#if USE(ACCELERATED_COMPOSITING)
if (m_glWebViewState)
m_glWebViewState->setBaseLayer(layer, inval, showVisualIndicator,
isPictureAfterFirstLayout);
+ m_pageSwapCallbackRegistered |= registerPageSwapCallback;
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
@@ -1513,6 +1529,7 @@ private: // local state for WebView
Functor* m_glDrawFunctor;
#if USE(ACCELERATED_COMPOSITING)
GLWebViewState* m_glWebViewState;
+ bool m_pageSwapCallbackRegistered;
#endif
const RenderSkinButton* m_buttonSkin;
}; // end of WebView class
@@ -1875,14 +1892,16 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject inval,
jboolean showVisualIndicator,
- jboolean isPictureAfterFirstLayout)
+ jboolean isPictureAfterFirstLayout,
+ jboolean registerPageSwapCallback)
{
BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer);
SkRegion invalRegion;
if (inval)
invalRegion = *GraphicsJNI::getNativeRegion(env, inval);
GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, invalRegion, showVisualIndicator,
- isPictureAfterFirstLayout);
+ isPictureAfterFirstLayout,
+ registerPageSwapCallback);
}
static BaseLayerAndroid* nativeGetBaseLayer(JNIEnv *env, jobject obj)
@@ -2587,6 +2606,11 @@ static void nativeSetExpandedTileBounds(JNIEnv*, jobject, jboolean enabled)
TilesManager::instance()->setExpandedTileBounds(enabled);
}
+static void nativeUseHardwareAccelSkia(JNIEnv*, jobject, jboolean enabled)
+{
+ BaseRenderer::setCurrentRendererType(enabled ? BaseRenderer::Ganesh : BaseRenderer::Raster);
+}
+
static int nativeGetBackgroundColor(JNIEnv* env, jobject obj)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
@@ -2748,7 +2772,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetFindIsUp },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
- { "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZ)V",
+ { "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZZ)V",
(void*) nativeSetBaseLayer },
{ "nativeGetBaseLayer", "()I",
(void*) nativeGetBaseLayer },
@@ -2796,6 +2820,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeScrollLayer },
{ "nativeSetExpandedTileBounds", "(Z)V",
(void*) nativeSetExpandedTileBounds },
+ { "nativeUseHardwareAccelSkia", "(Z)V",
+ (void*) nativeUseHardwareAccelSkia },
{ "nativeGetBackgroundColor", "()I",
(void*) nativeGetBackgroundColor },
{ "nativeSetProperty", "(Ljava/lang/String;Ljava/lang/String;)V",