Skip to content

Commit 73975e0

Browse files
Michael KolbAndroid (Google) Code Review
authored andcommitted
Merge "Remove embedded titlebar rendering"
2 parents 2cee762 + 8116da5 commit 73975e0

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
@@ -2011,7 +2011,7 @@ protected int getTitleHeight() {
20112011
if (mWebView instanceof TitleBarDelegate) {
20122012
return ((TitleBarDelegate) mWebView).getTitleHeight();
20132013
}
2014-
return mTitleBar != null ? mTitleBar.getHeight() : 0;
2014+
return 0;
20152015
}
20162016

20172017
/**
@@ -2942,50 +2942,6 @@ int pinLocY(int y) {
29422942
computeRealVerticalScrollRange() + getTitleHeight());
29432943
}
29442944

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

4404-
@Override
4405-
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
4406-
if (child == mTitleBar) {
4407-
// When drawing the title bar, move it horizontally to always show
4408-
// at the top of the WebView.
4409-
mTitleBar.offsetLeftAndRight(getScrollX() - mTitleBar.getLeft());
4410-
int newTop = 0;
4411-
if (mTitleGravity == Gravity.NO_GRAVITY) {
4412-
newTop = Math.min(0, getScrollY());
4413-
} else if (mTitleGravity == Gravity.TOP) {
4414-
newTop = getScrollY();
4415-
}
4416-
mTitleBar.setBottom(newTop + mTitleBar.getHeight());
4417-
mTitleBar.setTop(newTop);
4418-
}
4419-
return false; // We never call invalidate(), so unconditionally returning false.
4420-
}
4421-
44224360
private void drawContent(Canvas canvas) {
44234361
if (mDrawHistory) {
44244362
canvas.scale(mZoomManager.getScale(), mZoomManager.getScale());
@@ -4583,9 +4521,8 @@ public void onDraw(Canvas canvas) {
45834521
.getUseWebViewBackgroundForOverscrollBackground()) {
45844522
drawOverScrollBackground(canvas);
45854523
}
4586-
if (mTitleBar != null) {
4587-
canvas.translate(0, getTitleHeight());
4588-
}
4524+
4525+
canvas.translate(0, getTitleHeight());
45894526
drawContent(canvas);
45904527
canvas.restoreToCount(saveCount);
45914528

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)