am 3c32474f: Merge change 24008 into eclair

Merge commit '3c32474f0e0df419135f1966796d277aba9ee7cb' into eclair-plus-aosp

* commit '3c32474f0e0df419135f1966796d277aba9ee7cb':
  Clean up from earlier changes to place title bar at top of WebView
This commit is contained in:
Leon Scroggins
2009-09-04 14:40:42 -07:00
committed by Android Git Automerger
2 changed files with 19 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ class ViewManager {
}
setBounds(x, y, width, height);
final AbsoluteLayout.LayoutParams lp =
new AbsoluteLayout.LayoutParams(ctvX(width), ctvX(height),
new AbsoluteLayout.LayoutParams(ctvD(width), ctvD(height),
ctvX(x), ctvY(y));
mWebView.mPrivateHandler.post(new Runnable() {
public void run() {
@@ -97,10 +97,18 @@ class ViewManager {
return new ChildView();
}
/**
* Shorthand for calling mWebView.contentToViewDimension. Used when
* obtaining a view dimension from a content dimension, whether it be in x
* or y.
*/
private int ctvD(int val) {
return mWebView.contentToViewDimension(val);
}
/**
* Shorthand for calling mWebView.contentToViewX. Used when obtaining a
* view x coordinate from a content x coordinate, or when getting a
* view dimension from a content dimension, whether it be in x or y.
* view x coordinate from a content x coordinate.
*/
private int ctvX(int val) {
return mWebView.contentToViewX(val);
@@ -119,8 +127,8 @@ class ViewManager {
View view = v.mView;
AbsoluteLayout.LayoutParams lp =
(AbsoluteLayout.LayoutParams) view.getLayoutParams();
lp.width = ctvX(v.width);
lp.height = ctvX(v.height);
lp.width = ctvD(v.width);
lp.height = ctvD(v.height);
lp.x = ctvX(v.x);
lp.y = ctvY(v.y);
view.setLayoutParams(lp);

View File

@@ -1776,13 +1776,15 @@ public class WebView extends AbsoluteLayout
* the WebView normally without translating to account for the title bar.
* @hide
*/
public void addTitleBar(View v) {
if (null == v) {
public void setEmbeddedTitleBar(View v) {
if (mTitleBar == v) return;
if (mTitleBar != null) {
removeView(mTitleBar);
} else {
}
if (null != v) {
addView(v, new AbsoluteLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, mScrollX, 0));
ViewGroup.LayoutParams.WRAP_CONTENT, 0, 0));
}
mTitleBar = v;
}