Skip to content

Commit 8116da5

Browse files
author
Michael Kolb
committed
Remove embedded titlebar rendering
Bug: 5032345 During the zoom, the embedded titlebar doesn't get rendered in the correct spot. Browser renders the titlebar differently now, so the old code can be removed Change-Id: I6affc9e6119dc17e89d15dad77e14e1cdf139662
1 parent 0424716 commit 8116da5

File tree

3 files changed

+4
-76
lines changed

3 files changed

+4
-76
lines changed

core/java/android/webkit/WebView.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,13 +1912,6 @@ protected void onWindowVisibilityChanged(int visibility) {
19121912
mProvider.getViewDelegate().onWindowVisibilityChanged(visibility);
19131913
}
19141914

1915-
@Override
1916-
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
1917-
// Not using short-circuit OR: provider does suppress base-class call.
1918-
return mProvider.getViewDelegate().drawChild(canvas, child, drawingTime) |
1919-
super.drawChild(canvas, child, drawingTime);
1920-
}
1921-
19221915
@Override
19231916
protected void onDraw(Canvas canvas) {
19241917
mProvider.getViewDelegate().onDraw(canvas);

core/java/android/webkit/WebViewClassic.java

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,7 +2014,7 @@ protected int getTitleHeight() {
20142014
if (mWebView instanceof TitleBarDelegate) {
20152015
return ((TitleBarDelegate) mWebView).getTitleHeight();
20162016
}
2017-
return mTitleBar != null ? mTitleBar.getHeight() : 0;
2017+
return 0;
20182018
}
20192019

20202020
/**
@@ -2945,50 +2945,6 @@ int pinLocY(int y) {
29452945
computeRealVerticalScrollRange() + getTitleHeight());
29462946
}
29472947

2948-
/**
2949-
* A title bar which is embedded in this WebView, and scrolls along with it
2950-
* vertically, but not horizontally.
2951-
*/
2952-
private View mTitleBar;
2953-
2954-
/**
2955-
* the title bar rendering gravity
2956-
*/
2957-
private int mTitleGravity;
2958-
2959-
/**
2960-
* Add or remove a title bar to be embedded into the WebView, and scroll
2961-
* along with it vertically, while remaining in view horizontally. Pass
2962-
* null to remove the title bar from the WebView, and return to drawing
2963-
* the WebView normally without translating to account for the title bar.
2964-
*/
2965-
public void setEmbeddedTitleBar(View v) {
2966-
if (mWebView instanceof TitleBarDelegate) {
2967-
((TitleBarDelegate) mWebView).onSetEmbeddedTitleBar(v);
2968-
}
2969-
if (mTitleBar == v) return;
2970-
if (mTitleBar != null) {
2971-
mWebView.removeView(mTitleBar);
2972-
}
2973-
if (null != v) {
2974-
mWebView.addView(v, new AbsoluteLayout.LayoutParams(
2975-
ViewGroup.LayoutParams.MATCH_PARENT,
2976-
ViewGroup.LayoutParams.WRAP_CONTENT, 0, 0));
2977-
}
2978-
mTitleBar = v;
2979-
}
2980-
2981-
/**
2982-
* Set where to render the embedded title bar
2983-
* NO_GRAVITY at the top of the page
2984-
* TOP at the top of the screen
2985-
*/
2986-
public void setTitleBarGravity(int gravity) {
2987-
mTitleGravity = gravity;
2988-
// force refresh
2989-
invalidate();
2990-
}
2991-
29922948
/**
29932949
* Given a distance in view space, convert it to content space. Note: this
29942950
* does not reflect translation, just scaling, so this should not be called
@@ -4187,7 +4143,7 @@ private boolean setContentScrollTo(int cx, int cy) {
41874143
// animate the title bar off screen slowly enough that the user can see
41884144
// it.
41894145
if (cx == 0 && cy == 1 && getScrollX() == 0 && getScrollY() == 0
4190-
&& mTitleBar != null) {
4146+
&& getTitleHeight() > 0) {
41914147
// FIXME: 100 should be defined somewhere as our max progress.
41924148
if (getProgress() < 100) {
41934149
// Wait to scroll the title bar off screen until the page has
@@ -4404,24 +4360,6 @@ public void run() {
44044360
}
44054361
}
44064362

4407-
@Override
4408-
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
4409-
if (child == mTitleBar) {
4410-
// When drawing the title bar, move it horizontally to always show
4411-
// at the top of the WebView.
4412-
mTitleBar.offsetLeftAndRight(getScrollX() - mTitleBar.getLeft());
4413-
int newTop = 0;
4414-
if (mTitleGravity == Gravity.NO_GRAVITY) {
4415-
newTop = Math.min(0, getScrollY());
4416-
} else if (mTitleGravity == Gravity.TOP) {
4417-
newTop = getScrollY();
4418-
}
4419-
mTitleBar.setBottom(newTop + mTitleBar.getHeight());
4420-
mTitleBar.setTop(newTop);
4421-
}
4422-
return false; // We never call invalidate(), so unconditionally returning false.
4423-
}
4424-
44254363
private void drawContent(Canvas canvas) {
44264364
if (mDrawHistory) {
44274365
canvas.scale(mZoomManager.getScale(), mZoomManager.getScale());
@@ -4586,9 +4524,8 @@ public void onDraw(Canvas canvas) {
45864524
.getUseWebViewBackgroundForOverscrollBackground()) {
45874525
drawOverScrollBackground(canvas);
45884526
}
4589-
if (mTitleBar != null) {
4590-
canvas.translate(0, getTitleHeight());
4591-
}
4527+
4528+
canvas.translate(0, getTitleHeight());
45924529
drawContent(canvas);
45934530
canvas.restoreToCount(saveCount);
45944531

core/java/android/webkit/WebViewProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ public void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar, int l, in
287287

288288
public void onWindowVisibilityChanged(int visibility);
289289

290-
public boolean drawChild(Canvas canvas, View child, long drawingTime);
291-
292290
public void onDraw(Canvas canvas);
293291

294292
public void setLayoutParams(LayoutParams layoutParams);

0 commit comments

Comments
 (0)