Skip to content

Commit e6a9656

Browse files
Bart SearsAndroid (Google) Code Review
authored andcommitted
Merge "Content and viewport rects set in one step." into ics-mr1
2 parents 0358787 + 82ed95f commit e6a9656

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

core/java/android/webkit/WebView.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ public void onScrollChanged() {
366366

367367
private final Rect mGLRectViewport = new Rect();
368368
private final Rect mViewRectViewport = new Rect();
369+
private final RectF mVisibleContentRect = new RectF();
369370
private boolean mGLViewportEmpty = false;
370371

371372
/**
@@ -4607,11 +4608,14 @@ private void drawCoreAndCursorRing(Canvas canvas, int color,
46074608
+ " extras=" + extras);
46084609
}
46094610

4611+
calcOurContentVisibleRectF(mVisibleContentRect);
46104612
if (canvas.isHardwareAccelerated()) {
4611-
int functor = nativeGetDrawGLFunction(mNativeClass,
4612-
mGLViewportEmpty ? null : mGLRectViewport, mGLViewportEmpty ? null : mViewRectViewport, getScale(), extras);
4613-
((HardwareCanvas) canvas).callDrawGLFunction(functor);
4613+
Rect glRectViewport = mGLViewportEmpty ? null : mGLRectViewport;
4614+
Rect viewRectViewport = mGLViewportEmpty ? null : mViewRectViewport;
46144615

4616+
int functor = nativeGetDrawGLFunction(mNativeClass, glRectViewport,
4617+
viewRectViewport, mVisibleContentRect, getScale(), extras);
4618+
((HardwareCanvas) canvas).callDrawGLFunction(functor);
46154619
if (mHardwareAccelSkia != getSettings().getHardwareAccelSkiaEnabled()) {
46164620
mHardwareAccelSkia = getSettings().getHardwareAccelSkiaEnabled();
46174621
nativeUseHardwareAccelSkia(mHardwareAccelSkia);
@@ -4627,7 +4631,8 @@ private void drawCoreAndCursorRing(Canvas canvas, int color,
46274631
canvas.setDrawFilter(df);
46284632
// XXX: Revisit splitting content. Right now it causes a
46294633
// synchronization problem with layers.
4630-
int content = nativeDraw(canvas, color, extras, false);
4634+
int content = nativeDraw(canvas, mVisibleContentRect, color,
4635+
extras, false);
46314636
canvas.setDrawFilter(null);
46324637
if (!mBlockWebkitViewMessages && content != 0) {
46334638
mWebViewCore.sendMessage(EventHub.SPLIT_PICTURE_SET, content, 0);
@@ -5797,8 +5802,9 @@ void setGLRectViewport() {
57975802
} else {
57985803
mGLViewportEmpty = true;
57995804
}
5805+
calcOurContentVisibleRectF(mVisibleContentRect);
58005806
nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport,
5801-
mGLViewportEmpty ? null : mViewRectViewport);
5807+
mGLViewportEmpty ? null : mViewRectViewport, mVisibleContentRect);
58025808
}
58035809

58045810
/**
@@ -8795,7 +8801,6 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
87958801
mSendScrollEvent = false;
87968802
recordNewContentSize(draw.mContentSize.x,
87978803
draw.mContentSize.y, updateLayout);
8798-
87998804
if (isPictureAfterFirstLayout) {
88008805
// Reset the last sent data here since dealing with new page.
88018806
mLastWidthSent = 0;
@@ -9366,7 +9371,8 @@ public void debugDump() {
93669371
* @hide only needs to be accessible to Browser and testing
93679372
*/
93689373
public void drawPage(Canvas canvas) {
9369-
nativeDraw(canvas, 0, 0, false);
9374+
calcOurContentVisibleRectF(mVisibleContentRect);
9375+
nativeDraw(canvas, mVisibleContentRect, 0, 0, false);
93709376
}
93719377

93729378
/**
@@ -9497,13 +9503,14 @@ public float tileProfilingGetFloat(int frame, int tile, String key) {
94979503
* MUST be passed to WebViewCore with SPLIT_PICTURE_SET message so that the
94989504
* native allocation can be freed.
94999505
*/
9500-
private native int nativeDraw(Canvas canvas, int color, int extra,
9501-
boolean splitIfNeeded);
9506+
private native int nativeDraw(Canvas canvas, RectF visibleRect,
9507+
int color, int extra, boolean splitIfNeeded);
95029508
private native void nativeDumpDisplayTree(String urlOrNull);
95039509
private native boolean nativeEvaluateLayersAnimations(int nativeInstance);
95049510
private native int nativeGetDrawGLFunction(int nativeInstance, Rect rect,
9505-
Rect viewRect, float scale, int extras);
9506-
private native void nativeUpdateDrawGLFunction(Rect rect, Rect viewRect);
9511+
Rect viewRect, RectF visibleRect, float scale, int extras);
9512+
private native void nativeUpdateDrawGLFunction(Rect rect, Rect viewRect,
9513+
RectF visibleRect);
95079514
private native void nativeExtendSelection(int x, int y);
95089515
private native int nativeFindAll(String findLower, String findUpper,
95099516
boolean sameAsLastSearch);

0 commit comments

Comments
 (0)