summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/graphics/android/Layer.h1
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp35
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.h6
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp33
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h1
5 files changed, 63 insertions, 13 deletions
diff --git a/Source/WebCore/platform/graphics/android/Layer.h b/Source/WebCore/platform/graphics/android/Layer.h
index 24302ce..c8bb81d 100644
--- a/Source/WebCore/platform/graphics/android/Layer.h
+++ b/Source/WebCore/platform/graphics/android/Layer.h
@@ -136,7 +136,6 @@ protected:
bool m_hasOverflowChildren;
-private:
bool isAncestor(const Layer*) const;
Layer* fParent;
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index b086c79..4e00a4b 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -575,6 +575,7 @@ void LayerAndroid::updatePositions()
void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentMatrix,
const FloatRect& clipping, float opacity, float scale)
{
+ m_atomicSync.lock();
IntSize layerSize(getSize().width(), getSize().height());
FloatPoint anchorPoint(getAnchorPoint().fX, getAnchorPoint().fY);
FloatPoint position(getPosition().fX, getPosition().fY);
@@ -593,6 +594,7 @@ void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentM
-originY,
-anchorPointZ());
+ m_atomicSync.unlock();
setDrawTransform(localMatrix);
if (m_drawTransform.isIdentityOrTranslation()) {
// adjust the translation coordinates of the draw transform matrix so
@@ -762,6 +764,39 @@ void LayerAndroid::assignTextureTo(LayerAndroid* newTree)
}
}
+bool LayerAndroid::updateWithTree(LayerAndroid* newTree)
+{
+ bool needsRepaint = false;
+ int count = this->countChildren();
+ for (int i = 0; i < count; i++)
+ needsRepaint |= this->getChild(i)->updateWithTree(newTree);
+
+ if (newTree) {
+ LayerAndroid* newLayer = newTree->findById(uniqueId());
+ needsRepaint |= updateWithLayer(newLayer);
+ }
+ return needsRepaint;
+}
+
+bool LayerAndroid::updateWithLayer(LayerAndroid* layer)
+{
+ if (!layer)
+ return true;
+
+ android::AutoMutex lock(m_atomicSync);
+ m_position = layer->m_position;
+ m_anchorPoint = layer->m_anchorPoint;
+ m_size = layer->m_size;
+ m_opacity = layer->m_opacity;
+ m_transform = layer->m_transform;
+
+ if ((m_recordingPicture != layer->m_recordingPicture)
+ || (m_imageRef != layer->m_imageRef))
+ return true;
+
+ return false;
+}
+
void LayerAndroid::createTexture()
{
int count = this->countChildren();
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h
index 90f4e86..cd52937 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -276,6 +276,12 @@ public:
void assignTextureTo(LayerAndroid* newTree);
void createTexture();
+ // Update layers using another tree. Only works for basic properties
+ // such as the position, the transform. Return true if anything more
+ // complex is needed.
+ bool updateWithTree(LayerAndroid*);
+ bool updateWithLayer(LayerAndroid*);
+
SkBitmapRef* imageRef() { return m_imageRef; }
ImageTexture* imageTexture() { return m_imageTexture; }
int type() { return m_type; }
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 26c73b2..6d6b81c 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -919,6 +919,19 @@ void WebViewCore::rebuildPictureSet(PictureSet* pictureSet)
#endif
}
+bool WebViewCore::updateLayers(LayerAndroid* layers)
+{
+ // We update the layers
+ ChromeClientAndroid* chromeC = static_cast<ChromeClientAndroid*>(m_mainFrame->page()->chrome()->client());
+ GraphicsLayerAndroid* root = static_cast<GraphicsLayerAndroid*>(chromeC->layersSync());
+ if (root) {
+ root->notifyClientAnimationStarted();
+ LayerAndroid* updatedLayer = root->contentLayer();
+ return layers->updateWithTree(updatedLayer);
+ }
+ return true;
+}
+
BaseLayerAndroid* WebViewCore::createBaseLayer()
{
BaseLayerAndroid* base = new BaseLayerAndroid();
@@ -4119,20 +4132,16 @@ void WebViewCore::addVisitedLink(const UChar* string, int length)
m_groupForVisitedLinks->addVisitedLink(string, length);
}
-static jint UpdateLayers(JNIEnv *env, jobject obj, jobject region)
+static bool UpdateLayers(JNIEnv *env, jobject obj, jint jbaseLayer)
{
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- BaseLayerAndroid* result = viewImpl->createBaseLayer();
- SkRegion* nativeRegion = GraphicsJNI::getNativeRegion(env, region);
- if (result) {
- SkIRect bounds;
- LayerAndroid* root = static_cast<LayerAndroid*>(result->getChild(0));
- if (root) {
- root->bounds().roundOut(&bounds);
- nativeRegion->setRect(bounds);
- }
+ BaseLayerAndroid* baseLayer = (BaseLayerAndroid*) jbaseLayer;
+ if (baseLayer) {
+ LayerAndroid* root = static_cast<LayerAndroid*>(baseLayer->getChild(0));
+ if (root)
+ return viewImpl->updateLayers(root);
}
- return reinterpret_cast<jint>(result);
+ return true;
}
static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt)
@@ -4707,7 +4716,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) UpdateFrameCache },
{ "nativeGetContentMinPrefWidth", "()I",
(void*) GetContentMinPrefWidth },
- { "nativeUpdateLayers", "(Landroid/graphics/Region;)I",
+ { "nativeUpdateLayers", "(I)Z",
(void*) UpdateLayers },
{ "nativeRecordContent", "(Landroid/graphics/Region;Landroid/graphics/Point;)I",
(void*) RecordContent },
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 877f716..a25c5bb 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -525,6 +525,7 @@ namespace android {
// and doing a copy of the layers. The layers' content may be updated
// as we are calling layersSync().
BaseLayerAndroid* createBaseLayer();
+ bool updateLayers(LayerAndroid*);
int textWrapWidth() const { return m_textWrapWidth; }
float scale() const { return m_scale; }