summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/webkit/WebView.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index dd732e8..874eac8 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1187,7 +1187,7 @@ public class WebView extends AbsoluteLayout
if (AccessibilityManager.getInstance(mContext).isEnabled()
&& getSettings().getJavaScriptEnabled()) {
// exposing the TTS for now ...
- mTextToSpeech = new TextToSpeech(getContext(), null);
+ mTextToSpeech = new TextToSpeech(getContext(), null);
addJavascriptInterface(mTextToSpeech, ALIAS_ACCESSIBILITY_JS_INTERFACE);
}
}
@@ -2323,6 +2323,11 @@ public class WebView extends AbsoluteLayout
private View mTitleBar;
/**
+ * the title bar rendering gravity
+ */
+ private int mTitleGravity;
+
+ /**
* Add or remove a title bar to be embedded into the WebView, and scroll
* along with it vertically, while remaining in view horizontally. Pass
* null to remove the title bar from the WebView, and return to drawing
@@ -2343,6 +2348,16 @@ public class WebView extends AbsoluteLayout
}
/**
+ * Set where to render the embedded title bar
+ * NO_GRAVITY at the top of the page
+ * TOP at the top of the screen
+ * @hide
+ */
+ public void setTitleBarGravity(int gravity) {
+ mTitleGravity = gravity;
+ }
+
+ /**
* Given a distance in view space, convert it to content space. Note: this
* does not reflect translation, just scaling, so this should not be called
* with coordinates, but should be called for dimensions like width or
@@ -3683,7 +3698,12 @@ public class WebView extends AbsoluteLayout
// When drawing the title bar, move it horizontally to always show
// at the top of the WebView.
mTitleBar.offsetLeftAndRight(mScrollX - mTitleBar.getLeft());
- int newTop = Math.min(0, mScrollY);
+ int newTop = 0;
+ if (mTitleGravity == Gravity.NO_GRAVITY) {
+ newTop = Math.min(0, mScrollY);
+ } else if (mTitleGravity == Gravity.TOP) {
+ newTop = mScrollY;
+ }
mTitleBar.setBottom(newTop + getTitleHeight());
mTitleBar.setTop(newTop);
}
@@ -3842,7 +3862,7 @@ public class WebView extends AbsoluteLayout
if (detector != null && detector.isInProgress()) {
return false;
}
-
+
if (mNativeClass != 0 && nativeCursorIsTextInput()) {
// Send the click so that the textfield is in focus
centerKeyPressOnTextField();