summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-03-05 17:51:19 -0500
committerCary Clark <cary@android.com>2010-03-08 09:19:06 -0500
commit5065a677456ac1cb630e5271e781b2aa796af7a5 (patch)
tree9c625d63b30fd21130214f0d0051ab9dcd61f22a /WebCore/platform
parent5e539fa27ce46dc45a8529eff3a5aab16db633c2 (diff)
downloadexternal_webkit-5065a677456ac1cb630e5271e781b2aa796af7a5.zip
external_webkit-5065a677456ac1cb630e5271e781b2aa796af7a5.tar.gz
external_webkit-5065a677456ac1cb630e5271e781b2aa796af7a5.tar.bz2
scroll into view considers layers
LayerAndroid.* - Add a utility that takes the given rectangle and subtracts layers that overlay it. FindCanvas.* - Add function that returns if the current match is on the main page or in a layer. WebView.cpp - Add jni caller for WebView.java calcOurContentVisibleRect. Call it instead of getVisibleRect, which has the side effect of sending messages back to webkit. - Remove jni caller for getViewMetrics, since it is redundant. - Only call scrollRectOnScreen for non-layers. companion fix in framework/base http://b/2485168
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp32
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.h4
2 files changed, 36 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index c0851dd..b0c2629 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -349,6 +349,38 @@ bool LayerAndroid::prepareContext(bool force)
return m_recordingPicture;
}
+SkRect LayerAndroid::subtractLayers(const SkRect& visibleRect) const
+{
+ SkRect result;
+ if (m_recordingPicture) {
+ SkRect globalRect = bounds();
+ globalRect.offset(-getPosition()); // localToGlobal adds in position
+ SkMatrix globalMatrix;
+ localToGlobal(&globalMatrix);
+ globalMatrix.mapRect(&globalRect);
+ SkIRect roundedGlobal;
+ globalRect.round(&roundedGlobal);
+ SkIRect iVisibleRect;
+ visibleRect.round(&iVisibleRect);
+ SkRegion visRegion(iVisibleRect);
+ visRegion.op(roundedGlobal, SkRegion::kDifference_Op);
+ result.set(visRegion.getBounds());
+#if DEBUG_NAV_UI
+ SkDebugf("%s visibleRect=(%g,%g,r=%g,b=%g) globalRect=(%g,%g,r=%g,b=%g)"
+ "result=(%g,%g,r=%g,b=%g)", __FUNCTION__,
+ visibleRect.fLeft, visibleRect.fTop,
+ visibleRect.fRight, visibleRect.fBottom,
+ globalRect.fLeft, globalRect.fTop,
+ globalRect.fRight, globalRect.fBottom,
+ result.fLeft, result.fTop, result.fRight, result.fBottom);
+#endif
+ } else
+ result = visibleRect;
+ for (int i = 0; i < countChildren(); i++)
+ result = getChild(i)->subtractLayers(result);
+ return result;
+}
+
// Debug tools : dump the layers tree in a file.
// The format is simple:
// properties have the form: key = value;
diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h
index 3cd7e36..2554fb9 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/WebCore/platform/graphics/android/LayerAndroid.h
@@ -119,6 +119,10 @@ public:
SkPicture* picture() const { return m_recordingPicture; }
+ // remove layers bounds from visible rectangle to show what can be
+ // scrolled into view; returns original minus layer bounds in global space.
+ SkRect subtractLayers(const SkRect& visibleRect) const;
+
void dumpLayers(FILE*, int indentLevel) const;
void dumpToLog() const;