summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/platform/graphics/android/MediaLayer.cpp10
-rw-r--r--WebCore/platform/graphics/android/MediaLayer.h2
-rw-r--r--WebCore/platform/graphics/android/TextureOwner.cpp7
-rw-r--r--WebCore/plugins/android/PluginPackageAndroid.cpp30
-rw-r--r--WebCore/rendering/RenderLayer.h6
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp1
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp1
-rw-r--r--WebKit/android/jni/WebViewCore.cpp4
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp14
-rw-r--r--WebKit/android/nav/WebView.cpp4
-rw-r--r--WebKit/android/plugins/ANPOpenGLInterface.cpp21
-rw-r--r--WebKit/android/plugins/ANPOpenGL_npapi.h6
-rw-r--r--WebKit/android/plugins/PluginTimer.cpp1
13 files changed, 77 insertions, 30 deletions
diff --git a/WebCore/platform/graphics/android/MediaLayer.cpp b/WebCore/platform/graphics/android/MediaLayer.cpp
index 9c370a5..e4ccbdb 100644
--- a/WebCore/platform/graphics/android/MediaLayer.cpp
+++ b/WebCore/platform/graphics/android/MediaLayer.cpp
@@ -46,6 +46,7 @@ MediaLayer::MediaLayer() : LayerAndroid(false)
m_bufferedTexture = new MediaTexture(EGL_NO_CONTEXT);
m_bufferedTexture->incStrong(this);
m_currentTextureInfo = 0;
+ m_isContentInverted = false;
XLOG("Creating Media Layer %p", this);
}
@@ -54,6 +55,7 @@ MediaLayer::MediaLayer(const MediaLayer& layer) : LayerAndroid(layer)
m_bufferedTexture = layer.getTexture();
m_bufferedTexture->incStrong(this);
m_currentTextureInfo = 0;
+ m_isContentInverted = layer.m_isContentInverted;
XLOG("Creating Media Layer Copy %p -> %p", &layer, this);
}
@@ -71,6 +73,14 @@ bool MediaLayer::drawGL(SkMatrix& matrix)
SkRect rect;
rect.set(0, 0, getSize().width(), getSize().height());
TransformationMatrix m = drawTransform();
+
+ // the layer's shader draws the content inverted so we must undo
+ // that change in the transformation matrix
+ if (!m_isContentInverted) {
+ m.flipY();
+ m.translate(0, -getSize().height());
+ }
+
TilesManager::instance()->shader()->drawLayerQuad(m, rect,
textureInfo->m_textureId,
1.0f); //TODO fix this m_drawOpacity
diff --git a/WebCore/platform/graphics/android/MediaLayer.h b/WebCore/platform/graphics/android/MediaLayer.h
index eb56440..1944512 100644
--- a/WebCore/platform/graphics/android/MediaLayer.h
+++ b/WebCore/platform/graphics/android/MediaLayer.h
@@ -54,6 +54,7 @@ public:
void setCurrentTextureInfo(TextureInfo* info) { m_currentTextureInfo = info; }
TextureInfo* getCurrentTextureInfo() const { return m_currentTextureInfo; }
+ void invertContents(bool invertContent) { m_isContentInverted = invertContent; }
private:
@@ -62,6 +63,7 @@ private:
TextureInfo* m_currentTextureInfo;
+ bool m_isContentInverted;
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/TextureOwner.cpp b/WebCore/platform/graphics/android/TextureOwner.cpp
index 6a6845a..c4446d7 100644
--- a/WebCore/platform/graphics/android/TextureOwner.cpp
+++ b/WebCore/platform/graphics/android/TextureOwner.cpp
@@ -34,8 +34,11 @@ TextureOwner::~TextureOwner()
{
if (m_ownedTextures.size()) {
// This TextureOwner owns textures still!
- HashSet<BackedDoubleBufferedTexture*>::iterator it = m_ownedTextures.begin();
- for (; it != m_ownedTextures.end(); ++it)
+ HashSet<BackedDoubleBufferedTexture*> textures;
+ // Swap to a local copy because release will modify the iterator.
+ textures.swap(m_ownedTextures);
+ HashSet<BackedDoubleBufferedTexture*>::const_iterator it = textures.begin();
+ for (; it != textures.end(); ++it)
(*it)->release(this);
}
}
diff --git a/WebCore/plugins/android/PluginPackageAndroid.cpp b/WebCore/plugins/android/PluginPackageAndroid.cpp
index 97ec624..24de122 100644
--- a/WebCore/plugins/android/PluginPackageAndroid.cpp
+++ b/WebCore/plugins/android/PluginPackageAndroid.cpp
@@ -206,21 +206,23 @@ bool PluginPackage::load()
m_loadCount++;
PLUGIN_LOG("Already loaded, count now %d\n", m_loadCount);
return true;
- }
- ASSERT(m_loadCount == 0);
- ASSERT(m_module == NULL);
+ } else {
+ ASSERT(m_loadCount == 0);
+ ASSERT(m_module == NULL);
- PLUGIN_LOG("Loading \"%s\"\n", m_path.utf8().data());
+ PLUGIN_LOG("Loading \"%s\"\n", m_path.utf8().data());
- // Open the library
- void *handle = dlopen(m_path.utf8().data(), RTLD_NOW);
- if(!handle) {
- PLUGIN_LOG("Couldn't load plugin library \"%s\": %s\n",
- m_path.utf8().data(), dlerror());
- return false;
+ // Open the library
+ void *handle = dlopen(m_path.utf8().data(), RTLD_NOW);
+ if(!handle) {
+ PLUGIN_LOG("Couldn't load plugin library \"%s\": %s\n",
+ m_path.utf8().data(), dlerror());
+ return false;
+ }
+ m_module = handle;
+ PLUGIN_LOG("Fetch Info Loaded %p\n", m_module);
}
- m_module = handle;
- PLUGIN_LOG("Fetch Info Loaded %p\n", m_module);
+
// This object will call dlclose() and set m_module to NULL
// when going out of scope.
DynamicLibraryCloser dlCloser(&m_module);
@@ -228,7 +230,7 @@ bool PluginPackage::load()
NP_InitializeFuncPtr NP_Initialize;
if(!getEntryPoint(m_module, "NP_Initialize", (void **) &NP_Initialize) ||
- !getEntryPoint(handle, "NP_Shutdown", (void **) &m_NPP_Shutdown)) {
+ !getEntryPoint(m_module, "NP_Shutdown", (void **) &m_NPP_Shutdown)) {
PLUGIN_LOG("Couldn't find Initialize function\n");
return false;
}
@@ -254,8 +256,6 @@ bool PluginPackage::load()
// Don't close the library - loaded OK.
dlCloser.ok();
- // Retain the handle so we can close it in the future.
- m_module = handle;
m_isLoaded = true;
++m_loadCount;
PLUGIN_LOG("Initial load ok, count now %d\n", m_loadCount);
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index c3c9097..711d398 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -142,6 +142,9 @@ public:
return m_overflowClipRect == other.overflowClipRect() &&
m_fixedClipRect == other.fixedClipRect() &&
m_posClipRect == other.posClipRect() &&
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ m_hitTestClip == other.hitTestClip() &&
+#endif
m_fixed == other.fixed();
}
@@ -150,6 +153,9 @@ public:
m_overflowClipRect = other.overflowClipRect();
m_fixedClipRect = other.fixedClipRect();
m_posClipRect = other.posClipRect();
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ m_hitTestClip = other.hitTestClip();
+#endif
m_fixed = other.fixed();
return *this;
}
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index cb1efe1..f0958d9 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -37,7 +37,6 @@
#include "FrameLoader.h"
#include "FrameView.h"
#include "Geolocation.h"
-#include "GraphicsLayerAndroid.h"
#include "Icon.h"
#include "Page.h"
#include "PopupMenuAndroid.h"
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 5468a1e..476f017 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -539,7 +539,6 @@ WebFrame::loadStarted(WebCore::Frame* frame)
WebCore::FrameLoadType loadType = frame->loader()->loadType();
if (loadType == WebCore::FrameLoadTypeReplace ||
- loadType == WebCore::FrameLoadTypeSame ||
(loadType == WebCore::FrameLoadTypeRedirectWithLockedBackForwardList &&
!isMainFrame))
return;
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6322acd..0163376 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -3233,7 +3233,7 @@ static void scrollLayer(WebCore::RenderObject* renderer, WebCore::IntPoint* pos)
return;
// The cache uses absolute coordinates when clicking on nodes and it assumes
// the layer is not scrolled.
- layer->scrollToOffset(0, 0, false, false);
+ layer->scrollToOffset(0, 0, true, false);
WebCore::IntRect absBounds = renderer->absoluteBoundingBoxRect();
// Do not include the outline when moving the node's bounds.
@@ -3243,7 +3243,7 @@ static void scrollLayer(WebCore::RenderObject* renderer, WebCore::IntPoint* pos)
absBounds.move(-layerBounds.x(), -layerBounds.y());
// Scroll the layer to the node's position.
- layer->scrollToOffset(absBounds.x(), absBounds.y(), false, true);
+ layer->scrollToOffset(absBounds.x(), absBounds.y(), true, true);
// Update the mouse position to the layer offset.
pos->move(-layer->scrollXOffset(), -layer->scrollYOffset());
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 40b2711..135bacc 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -36,7 +36,6 @@
#include "FrameTree.h"
#include "FrameView.h"
//#include "GraphicsContext.h"
-#include "GraphicsLayerAndroid.h"
#include "HTMLAreaElement.h"
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
@@ -47,6 +46,7 @@
#include "HTMLTextAreaElement.h"
#include "InlineTextBox.h"
#include "KURL.h"
+#include "LayerAndroid.h"
#include "PluginView.h"
#include "RegisteredEventListener.h"
#include "RenderImage.h"
@@ -508,9 +508,8 @@ void CacheBuilder::Debug::groups() {
if (renderer && renderer->hasLayer()) {
RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
RenderLayerBacking* back = layer->backing();
- GraphicsLayerAndroid* grLayer = static_cast
- <GraphicsLayerAndroid*>(back ? back->graphicsLayer() : 0);
- LayerAndroid* aLayer = grLayer ? grLayer->contentLayer() : 0;
+ GraphicsLayer* grLayer = back ? back->graphicsLayer() : 0;
+ LayerAndroid* aLayer = grLayer ? grLayer->platformLayer() : 0;
const SkPicture* pict = aLayer ? aLayer->picture() : 0;
const IntRect& r = renderer->absoluteBoundingBoxRect();
snprintf(scratch, sizeof(scratch), "// layer:%p back:%p"
@@ -2906,11 +2905,12 @@ void CacheBuilder::TrackLayer(WTF::Vector<LayerTracker>& layerTracker,
RenderLayerBacking* back = layer->backing();
if (!back)
return;
- GraphicsLayerAndroid* grLayer = static_cast
- <GraphicsLayerAndroid*>(back->graphicsLayer());
+ GraphicsLayer* grLayer = back->graphicsLayer();
+ if (back->hasContentsLayer())
+ grLayer = back->foregroundLayer();
if (!grLayer)
return;
- LayerAndroid* aLayer = grLayer->contentLayer();
+ LayerAndroid* aLayer = grLayer->platformLayer();
if (!aLayer)
return;
IntPoint scroll(layer->scrollXOffset(), layer->scrollYOffset());
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index b11dc69..046b354 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -1015,8 +1015,8 @@ static const ScrollableLayerAndroid* findScrollableLayer(
x -= bounds.fLeft;
y -= bounds.fTop;
int count = parent->countChildren();
- for (int i = 0; i < count; i++) {
- const LayerAndroid* child = parent->getChild(i);
+ while (count--) {
+ const LayerAndroid* child = parent->getChild(count);
const ScrollableLayerAndroid* result = findScrollableLayer(child, x, y,
foundBounds);
if (result) {
diff --git a/WebKit/android/plugins/ANPOpenGLInterface.cpp b/WebKit/android/plugins/ANPOpenGLInterface.cpp
index 55eb3e0..8f5f9b4 100644
--- a/WebKit/android/plugins/ANPOpenGLInterface.cpp
+++ b/WebKit/android/plugins/ANPOpenGLInterface.cpp
@@ -30,6 +30,11 @@
#include "PluginView.h"
#include "PluginWidgetAndroid.h"
#include "MediaLayer.h"
+#include "WebViewCore.h"
+#include "Frame.h"
+#include "Page.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
using namespace android;
@@ -84,6 +89,21 @@ static void anp_releaseTexture(NPP instance, const ANPTextureInfo* textureInfo)
texture->producerReleaseAndSwap();
}
+static void anp_invertPluginContent(NPP instance, bool isContentInverted) {
+ WebCore::PluginView* pluginView = pluginViewForInstance(instance);
+ PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
+ WebCore::MediaLayer* mediaLayer = pluginWidget->getLayer();
+
+ mediaLayer->invertContents(isContentInverted);
+
+ //force the layer to sync to the UI thread
+ WebViewCore* wvc = pluginWidget->webViewCore();
+ if (wvc)
+ wvc->mainFrame()->page()->chrome()->client()->scheduleCompositingLayerSync();
+}
+
+
+
///////////////////////////////////////////////////////////////////////////////
#define ASSIGN(obj, name) (obj)->name = anp_##name
@@ -94,4 +114,5 @@ void ANPOpenGLInterfaceV0_Init(ANPInterface* v) {
ASSIGN(i, acquireContext);
ASSIGN(i, lockTexture);
ASSIGN(i, releaseTexture);
+ ASSIGN(i, invertPluginContent);
}
diff --git a/WebKit/android/plugins/ANPOpenGL_npapi.h b/WebKit/android/plugins/ANPOpenGL_npapi.h
index bfca0dd..5aabbc4 100644
--- a/WebKit/android/plugins/ANPOpenGL_npapi.h
+++ b/WebKit/android/plugins/ANPOpenGL_npapi.h
@@ -52,6 +52,12 @@ struct ANPOpenGLInterfaceV0 : ANPInterface {
/**
*/
void (*releaseTexture)(NPP instance, const ANPTextureInfo*);
+
+ /**
+ * Invert the contents of the plugin on the y-axis.
+ * default is to not be inverted (i.e. use OpenGL coordinates)
+ */
+ void (*invertPluginContent)(NPP instance, bool isContentInverted);
};
#endif //ANPOpenGL_npapi_H
diff --git a/WebKit/android/plugins/PluginTimer.cpp b/WebKit/android/plugins/PluginTimer.cpp
index 23cac77..9ed6a80 100644
--- a/WebKit/android/plugins/PluginTimer.cpp
+++ b/WebKit/android/plugins/PluginTimer.cpp
@@ -48,6 +48,7 @@ namespace WebCore {
}
m_prev = 0;
*list = this;
+ relaxAdoptionRequirement();
}
PluginTimer::~PluginTimer()