summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/nav
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2012-05-14 16:04:49 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-14 16:04:49 -0700
commit248cd27071497cb61def0b07d4fd2dc23af657dd (patch)
tree82fee0c7937fecea2709e32a9952f268f9fabc7f /Source/WebKit/android/nav
parent9c3ba7668c398bf33a509c6b3138b9575a9bb24d (diff)
parent406da428774aa12dbabb663814e0558942765133 (diff)
downloadexternal_webkit-248cd27071497cb61def0b07d4fd2dc23af657dd.zip
external_webkit-248cd27071497cb61def0b07d4fd2dc23af657dd.tar.gz
external_webkit-248cd27071497cb61def0b07d4fd2dc23af657dd.tar.bz2
Merge "Change selection to work with left/right instead of base/extent." into jb-dev
Diffstat (limited to 'Source/WebKit/android/nav')
-rw-r--r--Source/WebKit/android/nav/SelectText.cpp14
-rw-r--r--Source/WebKit/android/nav/SelectText.h24
-rw-r--r--Source/WebKit/android/nav/WebView.cpp10
3 files changed, 8 insertions, 40 deletions
diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp
index 22c67bc..7ce32c3 100644
--- a/Source/WebKit/android/nav/SelectText.cpp
+++ b/Source/WebKit/android/nav/SelectText.cpp
@@ -144,17 +144,3 @@ void ReverseBidi(UChar* chars, int len) {
}
-namespace android {
-
-SelectText::HandleId SelectText::mapId(HandleId id)
-{
- if (id == StartHandle || id == EndHandle)
- return id;
- if (isBaseFirst())
- return (HandleId) (id - 2);
- if (id == BaseHandle)
- return EndHandle;
- return StartHandle;
-}
-
-}
diff --git a/Source/WebKit/android/nav/SelectText.h b/Source/WebKit/android/nav/SelectText.h
index 50bc82e..aaaf3bb 100644
--- a/Source/WebKit/android/nav/SelectText.h
+++ b/Source/WebKit/android/nav/SelectText.h
@@ -35,32 +35,24 @@ namespace android {
class SelectText : public RegionLayerDrawExtra {
public:
enum HandleId {
- StartHandle = 0,
- EndHandle = 1,
- BaseHandle = 2,
- ExtentHandle = 3,
+ LeftHandle = 0,
+ RightHandle = 1,
};
- IntRect& caretRect(HandleId id) { return m_caretRects[mapId(id)]; }
- void setCaretRect(HandleId id, const IntRect& rect) { m_caretRects[mapId(id)] = rect; }
- IntRect& textRect(HandleId id) { return m_textRects[mapId(id)]; }
- void setTextRect(HandleId id, const IntRect& rect) { m_textRects[mapId(id)] = rect; }
- int caretLayerId(HandleId id) { return m_caretLayerId[mapId(id)]; }
- void setCaretLayerId(HandleId id, int layerId) { m_caretLayerId[mapId(id)] = layerId; }
-
- bool isBaseFirst() const { return m_baseIsFirst; }
- void setBaseFirst(bool isFirst) { m_baseIsFirst = isFirst; }
+ IntRect& caretRect(HandleId id) { return m_caretRects[id]; }
+ void setCaretRect(HandleId id, const IntRect& rect) { m_caretRects[id] = rect; }
+ IntRect& textRect(HandleId id) { return m_textRects[id]; }
+ void setTextRect(HandleId id, const IntRect& rect) { m_textRects[id] = rect; }
+ int caretLayerId(HandleId id) { return m_caretLayerId[id]; }
+ void setCaretLayerId(HandleId id, int layerId) { m_caretLayerId[id] = layerId; }
void setText(const String& text) { m_text = text.threadsafeCopy(); }
String& getText() { return m_text; }
private:
- HandleId mapId(HandleId id);
-
IntRect m_caretRects[2];
IntRect m_textRects[2];
int m_caretLayerId[2];
- bool m_baseIsFirst;
String m_text;
};
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index a78392b..09e808b 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -1199,14 +1199,6 @@ static jint nativeGetHandleLayerId(JNIEnv *env, jobject obj, jint nativeView,
return layerId;
}
-static jboolean nativeIsBaseFirst(JNIEnv *env, jobject obj, jint nativeView)
-{
- WebView* webview = reinterpret_cast<WebView*>(nativeView);
- SelectText* select = static_cast<SelectText*>(
- webview->getDrawExtra(WebView::DrawExtrasSelection));
- return select ? select->isBaseFirst() : false;
-}
-
static void nativeMapLayerRect(JNIEnv *env, jobject obj, jint nativeView,
jint layerId, jobject rect)
{
@@ -1298,8 +1290,6 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetTextSelection },
{ "nativeGetHandleLayerId", "(IILandroid/graphics/Point;Landroid/webkit/QuadF;)I",
(void*) nativeGetHandleLayerId },
- { "nativeIsBaseFirst", "(I)Z",
- (void*) nativeIsBaseFirst },
{ "nativeMapLayerRect", "(IILandroid/graphics/Rect;)V",
(void*) nativeMapLayerRect },
{ "nativeSetHwAccelerated", "(IZ)I",