summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav')
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp9
-rw-r--r--WebKit/android/nav/CachedInput.cpp5
-rw-r--r--WebKit/android/nav/CachedInput.h5
-rw-r--r--WebKit/android/nav/CachedNode.h4
-rw-r--r--WebKit/android/nav/CachedNodeType.h4
-rw-r--r--WebKit/android/nav/CachedPrefix.h7
-rw-r--r--WebKit/android/nav/FindCanvas.cpp3
-rw-r--r--WebKit/android/nav/WebView.cpp27
8 files changed, 52 insertions, 12 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 7ee2a16..c5f7b12 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1112,6 +1112,13 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
type = PLUGIN_CACHEDNODETYPE;
goto keepNode;
}
+ // Only use the root contentEditable element
+ if (node->isContentEditable() && !node->parent()->isContentEditable()) {
+ bounds = absBounds;
+ takesFocus = true;
+ type = CONTENT_EDITABLE_CACHEDNODETYPE;
+ goto keepNode;
+ }
if (nodeRenderer->isRenderBlock()) {
RenderBlock* renderBlock = (RenderBlock*) nodeRenderer;
if (renderBlock->hasColumns()) {
@@ -1216,6 +1223,8 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
if (!href.isEmpty() && !WebCore::protocolIsJavaScript(href.string()))
// Set the exported string for all non-javascript anchors.
exported = href.string().threadsafeCopy();
+ } else if (node->hasTagName(HTMLNames::selectTag)) {
+ type = SELECT_CACHEDNODETYPE;
}
if (type == TEXT_INPUT_CACHEDNODETYPE) {
RenderTextControl* renderText =
diff --git a/WebKit/android/nav/CachedInput.cpp b/WebKit/android/nav/CachedInput.cpp
index 924bbca..dcd9ccd 100644
--- a/WebKit/android/nav/CachedInput.cpp
+++ b/WebKit/android/nav/CachedInput.cpp
@@ -28,6 +28,11 @@
namespace android {
+void CachedInput::init() {
+ bzero(this, sizeof(CachedInput));
+ mName = WebCore::String();
+}
+
#if DUMP_NAV_CACHE
#define DEBUG_PRINT_BOOL(field) \
diff --git a/WebKit/android/nav/CachedInput.h b/WebKit/android/nav/CachedInput.h
index 42cadf1..a3d6b10 100644
--- a/WebKit/android/nav/CachedInput.h
+++ b/WebKit/android/nav/CachedInput.h
@@ -39,10 +39,7 @@ public:
// constructor
}
void* formPointer() const { return mForm; }
- void init() {
- bzero(this, sizeof(CachedInput));
- mName = WebCore::String();
- }
+ void init();
WebCore::HTMLInputElement::InputType inputType() const { return mInputType; }
bool isRtlText() const { return mIsRtlText; }
bool isTextField() const { return mIsTextField; }
diff --git a/WebKit/android/nav/CachedNode.h b/WebKit/android/nav/CachedNode.h
index f3cfd98..09f53c3 100644
--- a/WebKit/android/nav/CachedNode.h
+++ b/WebKit/android/nav/CachedNode.h
@@ -108,6 +108,7 @@ public:
int index() const { return mIndex; }
void init(WebCore::Node* node);
bool isAnchor() const { return mType == ANCHOR_CACHEDNODETYPE; }
+ bool isContentEditable() const { return mType == CONTENT_EDITABLE_CACHEDNODETYPE; }
bool isCursor() const { return mIsCursor; }
bool isArea() const { return mType == AREA_CACHEDNODETYPE; }
bool isFocus() const { return mIsFocus; }
@@ -118,6 +119,7 @@ public:
return clip.intersects(bounds(frame));
}
bool isPlugin() const { return mType == PLUGIN_CACHEDNODETYPE; }
+ bool isSelect() const { return mType == SELECT_CACHEDNODETYPE; }
bool isSyntheticLink() const {
return mType >= ADDRESS_CACHEDNODETYPE && mType <= PHONE_CACHEDNODETYPE;
}
@@ -173,7 +175,7 @@ public:
const CachedNode* traverseNextNode() const { return mLast ? NULL : &this[1]; }
bool useBounds() const { return mUseBounds; }
bool useHitBounds() const { return mUseHitBounds; }
- bool wantsKeyEvents() const { return isTextInput() || isPlugin(); }
+ bool wantsKeyEvents() const { return isTextInput() || isPlugin() || isContentEditable(); }
private:
friend class CacheBuilder;
WebCore::String mExport;
diff --git a/WebKit/android/nav/CachedNodeType.h b/WebKit/android/nav/CachedNodeType.h
index 21e2d40..8bc9328 100644
--- a/WebKit/android/nav/CachedNodeType.h
+++ b/WebKit/android/nav/CachedNodeType.h
@@ -37,7 +37,9 @@ enum CachedNodeType {
AREA_CACHEDNODETYPE,
FRAME_CACHEDNODETYPE,
PLUGIN_CACHEDNODETYPE,
- TEXT_INPUT_CACHEDNODETYPE
+ TEXT_INPUT_CACHEDNODETYPE,
+ SELECT_CACHEDNODETYPE,
+ CONTENT_EDITABLE_CACHEDNODETYPE
};
enum CachedNodeBits {
diff --git a/WebKit/android/nav/CachedPrefix.h b/WebKit/android/nav/CachedPrefix.h
index b682288..73a5c2c 100644
--- a/WebKit/android/nav/CachedPrefix.h
+++ b/WebKit/android/nav/CachedPrefix.h
@@ -43,4 +43,11 @@
#define OFFSETOF(type, field) ((char*)&(((type*)1)->field) - (char*)1) // avoids gnu warning
+#ifndef BZERO_DEFINED
+#define BZERO_DEFINED
+// http://www.opengroup.org/onlinepubs/000095399/functions/bzero.html
+// For maximum portability, it is recommended to replace the function call to bzero() as follows:
+#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
+#endif
+
#endif
diff --git a/WebKit/android/nav/FindCanvas.cpp b/WebKit/android/nav/FindCanvas.cpp
index d8e908b..8eaaaef 100644
--- a/WebKit/android/nav/FindCanvas.cpp
+++ b/WebKit/android/nav/FindCanvas.cpp
@@ -98,7 +98,7 @@ GlyphSet::~GlyphSet() {
// part of mLowerGlyphs
}
-GlyphSet::GlyphSet& GlyphSet::operator=(GlyphSet& src) {
+GlyphSet& GlyphSet::operator=(GlyphSet& src) {
mTypeface = src.mTypeface;
mCount = src.mCount;
if (mCount > MAX_STORAGE_COUNT) {
@@ -675,4 +675,3 @@ void FindOnPage::setMatches(WTF::Vector<MatchInfo>* matches)
}
}
-
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index bdcafbf..fff0ea3 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -882,7 +882,8 @@ bool motionUp(int x, int y, int slop)
viewInvalidate();
if (!result->isTextInput()) {
clearTextEntry();
- setFollowedLink(true);
+ if (!result->isSelect() && !result->isContentEditable())
+ setFollowedLink(true);
if (syntheticLink)
overrideUrlLoading(result->getExport());
}
@@ -1262,6 +1263,19 @@ static const CachedInput* getInputCandidate(JNIEnv *env, jobject obj)
return cursor ? frame->textInput(cursor) : 0;
}
+static jboolean nativePageShouldHandleShiftAndArrows(JNIEnv *env, jobject obj)
+{
+ const CachedNode* focus = getFocusNode(env, obj);
+ if (!focus) return false;
+ // Plugins handle shift and arrows whether or not they have focus.
+ if (focus->isPlugin()) return true;
+ const CachedNode* cursor = getCursorNode(env, obj);
+ // ContentEditable nodes should only receive shift and arrows if they have
+ // both the cursor and the focus.
+ return cursor && cursor->nodePointer() == focus->nodePointer()
+ && cursor->isContentEditable();
+}
+
static jboolean nativeCursorMatchesFocus(JNIEnv *env, jobject obj)
{
const CachedNode* cursor = getCursorNode(env, obj);
@@ -1634,9 +1648,12 @@ static void nativeSetFindIsEmpty(JNIEnv *env, jobject obj)
static void nativeSetFollowedLink(JNIEnv *env, jobject obj, bool followed)
{
- WebView* view = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- view->setFollowedLink(followed);
+ const CachedNode* cursor = getCursorNode(env, obj);
+ if (cursor && !cursor->isSelect() && ! cursor->isContentEditable()) {
+ WebView* view = GET_NATIVE_VIEW(env, obj);
+ LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
+ view->setFollowedLink(followed);
+ }
}
static void nativeSetHeightCanMeasure(JNIEnv *env, jobject obj, bool measure)
@@ -1897,6 +1914,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeCreate },
{ "nativeCursorFramePointer", "()I",
(void*) nativeCursorFramePointer },
+ { "nativePageShouldHandleShiftAndArrows", "()Z",
+ (void*) nativePageShouldHandleShiftAndArrows },
{ "nativeCursorMatchesFocus", "()Z",
(void*) nativeCursorMatchesFocus },
{ "nativeCursorNodeBounds", "()Landroid/graphics/Rect;",