summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-12-03 07:41:08 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-12-03 07:41:08 -0800
commit5ad363b60f5b5db4f0096a3f999a843dae7f646a (patch)
treed37aaeb34f460372b948f54c1dbe9b8c27f1fcb8 /WebKit
parentf1be25c028fafac3594d4a566fcca4708803ea72 (diff)
parent8598c9fb9f861f25ab14efde9efb19cb91d7df1c (diff)
downloadexternal_webkit-5ad363b60f5b5db4f0096a3f999a843dae7f646a.zip
external_webkit-5ad363b60f5b5db4f0096a3f999a843dae7f646a.tar.gz
external_webkit-5ad363b60f5b5db4f0096a3f999a843dae7f646a.tar.bz2
Merge "Attempt to scroll layers everytime the user drags."
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp11
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp23
-rw-r--r--WebKit/android/nav/WebView.cpp30
3 files changed, 29 insertions, 35 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 5f5bb53..f134cb6 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -3557,10 +3557,17 @@ void WebViewCore::addVisitedLink(const UChar* string, int length)
m_groupForVisitedLinks->addVisitedLink(string, length);
}
-static jint UpdateLayers(JNIEnv *env, jobject obj)
+static jint UpdateLayers(JNIEnv *env, jobject obj, jobject region)
{
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));
+ root->bounds().roundOut(&bounds);
+ nativeRegion->setRect(bounds);
+ }
return reinterpret_cast<jint>(result);
}
@@ -4096,7 +4103,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) UpdateFrameCache },
{ "nativeGetContentMinPrefWidth", "()I",
(void*) GetContentMinPrefWidth },
- { "nativeUpdateLayers", "()I",
+ { "nativeUpdateLayers", "(Landroid/graphics/Region;)I",
(void*) UpdateLayers },
{ "nativeRecordContent", "(Landroid/graphics/Region;Landroid/graphics/Point;)I",
(void*) RecordContent },
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index f0333f2..cbc580d 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1177,10 +1177,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
originalAbsBounds = absBounds;
absBounds.move(globalOffsetX, globalOffsetY);
hasClip = nodeRenderer->hasOverflowClip();
-#if ENABLE(ANDROID_OVERFLOW_SCROLL)
- if (nodeRenderer->enclosingLayer() && nodeRenderer->enclosingLayer()->hasOverflowParent())
- hasClip = false;
-#endif
if (node->hasTagName(HTMLNames::canvasTag))
mPictureSetDisabled = true;
@@ -1392,12 +1388,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
clip.intersect(parentClip);
hasClip = true;
}
- if (hasClip) {
- if (clip.isEmpty())
- continue; // skip this node if clip prevents all drawing
- else if (cachedNode.clip(clip) == false)
- continue; // skip this node if outside of the clip
- }
bool isInLayer = false;
#if USE(ACCELERATED_COMPOSITING)
// If this renderer has a composited parent layer (including itself),
@@ -1414,11 +1404,18 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
}
isInLayer = true;
isUnclipped = true; // assume that layers do not have occluded nodes
+ hasClip = false;
AddLayer(cachedFrame, cachedFrame->size(), layerClip.location(),
layer->uniqueId());
}
}
#endif
+ if (hasClip) {
+ if (clip.isEmpty())
+ continue; // skip this node if clip prevents all drawing
+ else if (cachedNode.clip(clip) == false)
+ continue; // skip this node if outside of the clip
+ }
cachedNode.setNavableRects();
cachedNode.setColorIndex(colorIndex);
cachedNode.setExport(exported);
@@ -2935,7 +2932,7 @@ void CacheBuilder::TrackLayer(WTF::Vector<LayerTracker>& layerTracker,
IntPoint scroll(layer->scrollXOffset(), layer->scrollYOffset());
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
// If this is an overflow element, track the content layer.
- if (layer->hasOverflowParent() && aLayer->getChild(0))
+ if (layer->hasOverflowScroll())
aLayer = aLayer->getChild(0)->getChild(0);
if (!aLayer)
return;
@@ -2945,7 +2942,7 @@ void CacheBuilder::TrackLayer(WTF::Vector<LayerTracker>& layerTracker,
LayerTracker& indexTracker = layerTracker.last();
indexTracker.mLayer = aLayer;
indexTracker.mRenderLayer = layer;
- indexTracker.mBounds = IntRect(FloatRect(aLayer->bounds()));
+ indexTracker.mBounds = enclosingIntRect(aLayer->bounds());
// Use the absolute location of the layer as the bounds location. This
// provides the original offset of nodes in the layer so that we can
// translate nodes between their original location and the layer's new
@@ -3094,7 +3091,7 @@ bool CacheBuilder::ConstructPartRects(Node* node, const IntRect& bounds,
return false;
continue;
}
- if (renderer->hasOverflowClip() == false) {
+ if (hasClip == false) {
if (nodeIsAnchor && test->hasTagName(HTMLNames::divTag)) {
IntRect bounds = renderer->absoluteBoundingBoxRect(); // x, y fixup done by AddPartRect
int left = bounds.x() + ((RenderBox*)renderer)->paddingLeft()
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 4d92ce8..09a5c74 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -995,14 +995,15 @@ static const LayerAndroid* findScrollableLayer(const LayerAndroid* parent, int x
}
#endif
-const LayerAndroid* scrollableLayer(int x, int y)
+int scrollableLayer(int x, int y)
{
#if USE(ACCELERATED_COMPOSITING)
const LayerAndroid* layerRoot = compositeRoot();
if (!layerRoot)
return 0;
const LayerAndroid* result = findScrollableLayer(layerRoot, x, y);
- return result;
+ if (result)
+ return result->uniqueId();
#endif
return 0;
}
@@ -2213,31 +2214,20 @@ static int nativeScrollableLayer(JNIEnv* env, jobject jwebview, jint x, jint y)
{
WebView* view = GET_NATIVE_VIEW(env, jwebview);
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- return (int) view->scrollableLayer(x, y);
+ return view->scrollableLayer(x, y);
}
-static bool validLayer(const LayerAndroid* root, const LayerAndroid* layer) {
- if (root == layer)
- return true;
- for (int i = 0; i < root->countChildren(); i++) {
- const LayerAndroid* l = root->getChild(i);
- if (validLayer(l, layer))
- return true;
- }
- return false;
-}
-
-static bool nativeScrollLayer(JNIEnv* env, jobject obj, jint pLayer, jint dx,
+static bool nativeScrollLayer(JNIEnv* env, jobject obj, jint layerId, jint dx,
jint dy)
{
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
WebView* view = GET_NATIVE_VIEW(env, obj);
- const LayerAndroid* root = view->compositeRoot();
- LayerAndroid* layer = (LayerAndroid*) pLayer;
- if (!validLayer(root, layer)) {
+ LayerAndroid* root = view->compositeRoot();
+ if (!root)
+ return false;
+ LayerAndroid* layer = root->findById(layerId);
+ if (!layer)
return false;
- }
- LOG_ASSERT(layer, "layer not set in %s", __FUNCTION__);
return layer->scrollBy(dx, dy);
#endif
return false;