Skip to content

Commit 0008f73

Browse files
Teng-Hui ZhuAndroid (Google) Code Review
authored andcommitted
Merge "Unify the rect names according to the coordinates" into jb-dev
2 parents d7247c7 + 508d705 commit 0008f73

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private class InnerGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayo
153153
@Override
154154
public void onGlobalLayout() {
155155
if (mWebView.isShown()) {
156-
setGLRectViewport();
156+
setInvScreenRect();
157157
}
158158
}
159159
}
@@ -162,7 +162,7 @@ private class InnerScrollChangedListener implements ViewTreeObserver.OnScrollCha
162162
@Override
163163
public void onScrollChanged() {
164164
if (mWebView.isShown()) {
165-
setGLRectViewport();
165+
setInvScreenRect();
166166
}
167167
}
168168
}
@@ -644,8 +644,8 @@ protected void measureContent() {
644644

645645
private ZoomManager mZoomManager;
646646

647-
private final Rect mGLRectViewport = new Rect();
648-
private final Rect mViewRectViewport = new Rect();
647+
private final Rect mInvScreenRect = new Rect();
648+
private final Rect mScreenRect = new Rect();
649649
private final RectF mVisibleContentRect = new RectF();
650650
private boolean mGLViewportEmpty = false;
651651
WebViewInputConnection mInputConnection = null;
@@ -4224,11 +4224,11 @@ && nativeEvaluateLayersAnimations(mNativeClass)) {
42244224

42254225
calcOurContentVisibleRectF(mVisibleContentRect);
42264226
if (canvas.isHardwareAccelerated()) {
4227-
Rect glRectViewport = mGLViewportEmpty ? null : mGLRectViewport;
4228-
Rect viewRectViewport = mGLViewportEmpty ? null : mViewRectViewport;
4227+
Rect invScreenRect = mGLViewportEmpty ? null : mInvScreenRect;
4228+
Rect screenRect = mGLViewportEmpty ? null : mScreenRect;
42294229

4230-
int functor = nativeCreateDrawGLFunction(mNativeClass, glRectViewport,
4231-
viewRectViewport, mVisibleContentRect, getScale(), extras);
4230+
int functor = nativeCreateDrawGLFunction(mNativeClass, invScreenRect,
4231+
screenRect, mVisibleContentRect, getScale(), extras);
42324232
((HardwareCanvas) canvas).callDrawGLFunction(functor);
42334233
if (mHardwareAccelSkia != getSettings().getHardwareAccelSkiaEnabled()) {
42344234
mHardwareAccelSkia = getSettings().getHardwareAccelSkiaEnabled();
@@ -5548,26 +5548,26 @@ public void onFocusChanged(boolean focused, int direction,
55485548
}
55495549
}
55505550

5551-
void setGLRectViewport() {
5551+
void setInvScreenRect() {
55525552
// Use the getGlobalVisibleRect() to get the intersection among the parents
55535553
// visible == false means we're clipped - send a null rect down to indicate that
55545554
// we should not draw
5555-
boolean visible = mWebView.getGlobalVisibleRect(mGLRectViewport);
5555+
boolean visible = mWebView.getGlobalVisibleRect(mInvScreenRect);
55565556
if (visible) {
55575557
// Then need to invert the Y axis, just for GL
55585558
View rootView = mWebView.getRootView();
55595559
int rootViewHeight = rootView.getHeight();
5560-
mViewRectViewport.set(mGLRectViewport);
5561-
int savedWebViewBottom = mGLRectViewport.bottom;
5562-
mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeightImpl();
5563-
mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
5560+
mScreenRect.set(mInvScreenRect);
5561+
int savedWebViewBottom = mInvScreenRect.bottom;
5562+
mInvScreenRect.bottom = rootViewHeight - mInvScreenRect.top - getVisibleTitleHeightImpl();
5563+
mInvScreenRect.top = rootViewHeight - savedWebViewBottom;
55645564
mGLViewportEmpty = false;
55655565
} else {
55665566
mGLViewportEmpty = true;
55675567
}
55685568
calcOurContentVisibleRectF(mVisibleContentRect);
5569-
nativeUpdateDrawGLFunction(mNativeClass, mGLViewportEmpty ? null : mGLRectViewport,
5570-
mGLViewportEmpty ? null : mViewRectViewport,
5569+
nativeUpdateDrawGLFunction(mNativeClass, mGLViewportEmpty ? null : mInvScreenRect,
5570+
mGLViewportEmpty ? null : mScreenRect,
55715571
mVisibleContentRect, getScale());
55725572
}
55735573

@@ -5583,7 +5583,7 @@ public boolean setFrame(int left, int top, int right, int bottom) {
55835583
// notify the WebKit about the new dimensions.
55845584
sendViewSizeZoom(false);
55855585
}
5586-
setGLRectViewport();
5586+
setInvScreenRect();
55875587
return changed;
55885588
}
55895589

@@ -8602,11 +8602,11 @@ private native void nativeDraw(Canvas canvas, RectF visibleRect,
86028602
int color, int extra);
86038603
private native void nativeDumpDisplayTree(String urlOrNull);
86048604
private native boolean nativeEvaluateLayersAnimations(int nativeInstance);
8605-
private native int nativeCreateDrawGLFunction(int nativeInstance, Rect rect,
8606-
Rect viewRect, RectF visibleRect, float scale, int extras);
8605+
private native int nativeCreateDrawGLFunction(int nativeInstance, Rect invScreenRect,
8606+
Rect screenRect, RectF visibleContentRect, float scale, int extras);
86078607
private native int nativeGetDrawGLFunction(int nativeInstance);
8608-
private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect rect, Rect viewRect,
8609-
RectF visibleRect, float scale);
8608+
private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect invScreenRect,
8609+
Rect screenRect, RectF visibleContentRect, float scale);
86108610
private native String nativeGetSelection();
86118611
private native Rect nativeLayerBounds(int layer);
86128612
private native void nativeSetHeightCanMeasure(boolean measure);

0 commit comments

Comments
 (0)