summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/platform/android/PlatformBridge.h6
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp14
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp25
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp28
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.h1
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp8
-rw-r--r--WebKit/android/jni/WebViewCore.cpp5
-rw-r--r--WebKit/android/jni/WebViewCore.h8
8 files changed, 56 insertions, 39 deletions
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h
index 0918fe9..45da526 100644
--- a/WebCore/platform/android/PlatformBridge.h
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -81,6 +81,10 @@ class NPObject;
namespace WebCore {
+#if USE(ACCELERATED_COMPOSITING)
+class LayerAndroid;
+#endif
+
class FrameView;
class Widget;
@@ -121,7 +125,7 @@ public:
#if USE(ACCELERATED_COMPOSITING)
// Those methods are used by the layers system
- static void setRootLayer(const FrameView* view, int layer);
+ static void setUIRootLayer(const FrameView* view, const LayerAndroid* layer);
static void immediateRepaint(const FrameView* view);
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index ee7c888..be275a8 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -418,9 +418,9 @@ void GraphicsLayerAndroid::sendImmediateRepaint()
&& rootGraphicsLayer->m_frame->view()) {
LayerAndroid* copyLayer = new LayerAndroid(*m_contentLayer);
TLOG("(%x) sendImmediateRepaint, copy the layer, (%.2f,%.2f => %.2f,%.2f)",
- this, m_contentLayer->size().width(), m_contentLayer->size().height(),
- copyLayer->size().width(), copyLayer->size().height());
- PlatformBridge::setRootLayer(m_frame->view(), (int)copyLayer);
+ this, m_contentLayer->getSize().width(), m_contentLayer->getSize().height(),
+ copyLayer->getSize().width(), copyLayer->getSize().height());
+ PlatformBridge::setUIRootLayer(m_frame->view(), copyLayer);
PlatformBridge::immediateRepaint(m_frame->view());
}
}
@@ -457,10 +457,10 @@ bool GraphicsLayerAndroid::repaint(const FloatRect& rect)
TLOG("(%x) repaint(%.2f,%.2f,%.2f,%.2f) on (%.2f,%.2f) contentlayer(%.2f,%.2f,%.2f,%.2f)paintGraphicsLayer called!",
this, rect.x(), rect.y(), rect.width(),
rect.height(), m_size.width(), m_size.height(),
- m_contentLayer->position().fX,
- m_contentLayer->position().fY,
- m_contentLayer->size().width(),
- m_contentLayer->size().height());
+ m_contentLayer->getPosition().fX,
+ m_contentLayer->getPosition().fY,
+ m_contentLayer->getSize().width(),
+ m_contentLayer->getSize().height());
}
return true;
}
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 9d60efd..2dc8a05 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -300,10 +300,10 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) {
canvas->clipRect(r);
}
- if (!prepareContext())
+ if (!m_haveImage && !m_drawsContent && !m_isRootLayer)
return;
- if (!m_haveImage && !m_drawsContent && !m_isRootLayer)
+ if (!prepareContext())
return;
// we just have this save/restore for opacity...
@@ -314,6 +314,20 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) {
canvas->setDrawFilter(new OpacityDrawFilter(canvasOpacity));
m_recordingPicture->draw(canvas);
+
+#ifdef LAYER_DEBUG
+ float w = getSize().width();
+ float h = getSize().height();
+ SkPaint paint;
+ paint.setARGB(128, 255, 0, 0);
+ canvas->drawLine(0, 0, w, h, paint);
+ canvas->drawLine(0, h, w, 0, paint);
+ paint.setARGB(128, 0, 255, 0);
+ canvas->drawLine(0, 0, 0, h, paint);
+ canvas->drawLine(0, h, w, h, paint);
+ canvas->drawLine(w, h, w, 0, paint);
+ canvas->drawLine(w, 0, 0, 0, paint);
+#endif
}
SkPicture* LayerAndroid::recordContext()
@@ -393,6 +407,12 @@ void writeIntVal(FILE* file, int indentLevel, const char* str, int value)
fprintf(file, "%s = %d;\n", str, value);
}
+void writeHexVal(FILE* file, int indentLevel, const char* str, int value)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = %x;\n", str, value);
+}
+
void writeFloatVal(FILE* file, int indentLevel, const char* str, float value)
{
writeIndent(file, indentLevel);
@@ -422,6 +442,7 @@ void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const
{
writeln(file, indentLevel, "{");
+ writeHexVal(file, indentLevel + 1, "layer", (int)this);
writeIntVal(file, indentLevel + 1, "haveContents", m_haveContents);
writeIntVal(file, indentLevel + 1, "drawsContent", m_drawsContent);
writeIntVal(file, indentLevel + 1, "haveImage", m_haveImage);
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index e9e77e9..8187871 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -58,41 +58,26 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin
void ChromeClientAndroid::syncTimerFired(Timer<ChromeClientAndroid>* client)
{
- m_syncTimer.stop();
- compositingLayerSync();
-}
-
-void ChromeClientAndroid::compositingLayerSync()
-{
- if (!m_rootGraphicsLayer) {
+ if (!m_rootGraphicsLayer)
return;
- }
if (m_webFrame) {
FrameView* frameView = m_webFrame->page()->mainFrame()->view();
- if (frameView && !frameView->layoutPending() && !frameView->needsLayout()) {
- frameView->syncCompositingStateRecursive();
+ if (frameView && frameView->syncCompositingStateRecursive()) {
GraphicsLayerAndroid* androidGraphicsLayer =
static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer);
if (androidGraphicsLayer) {
androidGraphicsLayer->sendImmediateRepaint();
androidGraphicsLayer->notifyClientAnimationStarted();
}
- return;
}
}
- if (m_askToDrawAgain) {
- m_askToDrawAgain = false;
- scheduleCompositingLayerSync();
- }
}
void ChromeClientAndroid::scheduleCompositingLayerSync()
{
if (!m_syncTimer.isActive())
m_syncTimer.startOneShot(0.001); // 1ms
- else
- m_askToDrawAgain = true;
}
void ChromeClientAndroid::setNeedsOneShotDrawingSynchronization()
@@ -104,15 +89,12 @@ void ChromeClientAndroid::attachRootGraphicsLayer(WebCore::Frame* frame, WebCore
{
m_rootGraphicsLayer = layer;
if (!layer) {
- WebViewCore::getWebViewCore(frame->view())->setRootLayer(0);
+ WebViewCore::getWebViewCore(frame->view())->setUIRootLayer(0);
return;
}
WebCore::GraphicsLayerAndroid* androidGraphicsLayer = static_cast<GraphicsLayerAndroid*>(layer);
- if (frame && frame->view() && androidGraphicsLayer) {
- androidGraphicsLayer->setFrame(frame);
- WebCore::LayerAndroid* androidLayer = new LayerAndroid(androidGraphicsLayer->contentLayer());
- WebViewCore::getWebViewCore(frame->view())->setRootLayer((int)androidLayer);
- }
+ androidGraphicsLayer->setFrame(frame);
+ scheduleCompositingLayerSync();
}
#endif
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
index 2c061b2..68cac24 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
@@ -166,7 +166,6 @@ namespace android {
virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer* g);
virtual void setNeedsOneShotDrawingSynchronization();
virtual void scheduleCompositingLayerSync();
- void compositingLayerSync();
void syncTimerFired(Timer<ChromeClientAndroid>*);
#endif
diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index c04600d..b8bee7b 100644
--- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -35,16 +35,20 @@
#include <wtf/android/AndroidThreading.h>
#include <wtf/MainThread.h>
+#if USE(ACCELERATED_COMPOSITING)
+#include "LayerAndroid.h"
+#endif
+
using namespace android;
namespace WebCore {
#if USE(ACCELERATED_COMPOSITING)
-void PlatformBridge::setRootLayer(const WebCore::FrameView* view, int layer)
+void PlatformBridge::setUIRootLayer(const WebCore::FrameView* view, const LayerAndroid* layer)
{
android::WebViewCore* core = android::WebViewCore::getWebViewCore(view);
- core->setRootLayer(layer);
+ core->setUIRootLayer(layer);
}
void PlatformBridge::immediateRepaint(const WebCore::FrameView* view)
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6164fd6..fecacc9 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -137,6 +137,7 @@ FILE* gRenderTreeFile = 0;
#if USE(ACCELERATED_COMPOSITING)
#include "GraphicsLayerAndroid.h"
+#include "LayerAndroid.h"
#include "RenderLayerCompositor.h"
#endif
@@ -893,12 +894,12 @@ void WebViewCore::immediateRepaint()
checkException(env);
}
-void WebViewCore::setRootLayer(int layer)
+void WebViewCore::setUIRootLayer(const LayerAndroid* layer)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_setRootLayer,
- layer);
+ reinterpret_cast<jint>(layer));
checkException(env);
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index aca06d1..967023a 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -58,6 +58,12 @@ namespace WebCore {
class PageGroup;
}
+#if USE(ACCELERATED_COMPOSITING)
+namespace WebCore {
+ class LayerAndroid;
+}
+#endif
+
struct PluginWidgetAndroid;
class SkPicture;
class SkIRect;
@@ -128,7 +134,7 @@ namespace android {
#if USE(ACCELERATED_COMPOSITING)
void immediateRepaint();
- void setRootLayer(int layer);
+ void setUIRootLayer(const LayerAndroid* layer);
#endif
/** Invalidate the view/screen, NOT the content/DOM, but expressed in