Skip to content

Commit 508d705

Browse files
author
Teng-Hui Zhu
committed
Unify the rect names according to the coordinates
This is a pure refactor, no functional change. bug:6338456 Change-Id: Ib40af53f4e2ff8ce5c9f82f3472989b2d3f2007c
1 parent 28d9911 commit 508d705

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
@@ -152,7 +152,7 @@ private class InnerGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayo
152152
@Override
153153
public void onGlobalLayout() {
154154
if (mWebView.isShown()) {
155-
setGLRectViewport();
155+
setInvScreenRect();
156156
}
157157
}
158158
}
@@ -161,7 +161,7 @@ private class InnerScrollChangedListener implements ViewTreeObserver.OnScrollCha
161161
@Override
162162
public void onScrollChanged() {
163163
if (mWebView.isShown()) {
164-
setGLRectViewport();
164+
setInvScreenRect();
165165
}
166166
}
167167
}
@@ -643,8 +643,8 @@ protected void measureContent() {
643643

644644
private ZoomManager mZoomManager;
645645

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

42184218
calcOurContentVisibleRectF(mVisibleContentRect);
42194219
if (canvas.isHardwareAccelerated()) {
4220-
Rect glRectViewport = mGLViewportEmpty ? null : mGLRectViewport;
4221-
Rect viewRectViewport = mGLViewportEmpty ? null : mViewRectViewport;
4220+
Rect invScreenRect = mGLViewportEmpty ? null : mInvScreenRect;
4221+
Rect screenRect = mGLViewportEmpty ? null : mScreenRect;
42224222

4223-
int functor = nativeCreateDrawGLFunction(mNativeClass, glRectViewport,
4224-
viewRectViewport, mVisibleContentRect, getScale(), extras);
4223+
int functor = nativeCreateDrawGLFunction(mNativeClass, invScreenRect,
4224+
screenRect, mVisibleContentRect, getScale(), extras);
42254225
((HardwareCanvas) canvas).callDrawGLFunction(functor);
42264226
if (mHardwareAccelSkia != getSettings().getHardwareAccelSkiaEnabled()) {
42274227
mHardwareAccelSkia = getSettings().getHardwareAccelSkiaEnabled();
@@ -5542,26 +5542,26 @@ public void onFocusChanged(boolean focused, int direction,
55425542
}
55435543
}
55445544

5545-
void setGLRectViewport() {
5545+
void setInvScreenRect() {
55465546
// Use the getGlobalVisibleRect() to get the intersection among the parents
55475547
// visible == false means we're clipped - send a null rect down to indicate that
55485548
// we should not draw
5549-
boolean visible = mWebView.getGlobalVisibleRect(mGLRectViewport);
5549+
boolean visible = mWebView.getGlobalVisibleRect(mInvScreenRect);
55505550
if (visible) {
55515551
// Then need to invert the Y axis, just for GL
55525552
View rootView = mWebView.getRootView();
55535553
int rootViewHeight = rootView.getHeight();
5554-
mViewRectViewport.set(mGLRectViewport);
5555-
int savedWebViewBottom = mGLRectViewport.bottom;
5556-
mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeightImpl();
5557-
mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
5554+
mScreenRect.set(mInvScreenRect);
5555+
int savedWebViewBottom = mInvScreenRect.bottom;
5556+
mInvScreenRect.bottom = rootViewHeight - mInvScreenRect.top - getVisibleTitleHeightImpl();
5557+
mInvScreenRect.top = rootViewHeight - savedWebViewBottom;
55585558
mGLViewportEmpty = false;
55595559
} else {
55605560
mGLViewportEmpty = true;
55615561
}
55625562
calcOurContentVisibleRectF(mVisibleContentRect);
5563-
nativeUpdateDrawGLFunction(mNativeClass, mGLViewportEmpty ? null : mGLRectViewport,
5564-
mGLViewportEmpty ? null : mViewRectViewport,
5563+
nativeUpdateDrawGLFunction(mNativeClass, mGLViewportEmpty ? null : mInvScreenRect,
5564+
mGLViewportEmpty ? null : mScreenRect,
55655565
mVisibleContentRect, getScale());
55665566
}
55675567

@@ -5577,7 +5577,7 @@ public boolean setFrame(int left, int top, int right, int bottom) {
55775577
// notify the WebKit about the new dimensions.
55785578
sendViewSizeZoom(false);
55795579
}
5580-
setGLRectViewport();
5580+
setInvScreenRect();
55815581
return changed;
55825582
}
55835583

@@ -8568,11 +8568,11 @@ private native void nativeDraw(Canvas canvas, RectF visibleRect,
85688568
int color, int extra);
85698569
private native void nativeDumpDisplayTree(String urlOrNull);
85708570
private native boolean nativeEvaluateLayersAnimations(int nativeInstance);
8571-
private native int nativeCreateDrawGLFunction(int nativeInstance, Rect rect,
8572-
Rect viewRect, RectF visibleRect, float scale, int extras);
8571+
private native int nativeCreateDrawGLFunction(int nativeInstance, Rect invScreenRect,
8572+
Rect screenRect, RectF visibleContentRect, float scale, int extras);
85738573
private native int nativeGetDrawGLFunction(int nativeInstance);
8574-
private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect rect, Rect viewRect,
8575-
RectF visibleRect, float scale);
8574+
private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect invScreenRect,
8575+
Rect screenRect, RectF visibleContentRect, float scale);
85768576
private native String nativeGetSelection();
85778577
private native Rect nativeLayerBounds(int layer);
85788578
private native void nativeSetHeightCanMeasure(boolean measure);

0 commit comments

Comments
 (0)