summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/CachedRoot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav/CachedRoot.cpp')
-rw-r--r--WebKit/android/nav/CachedRoot.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 38417b1..d9669bd 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -26,6 +26,7 @@
#include "CachedPrefix.h"
#include "android_graphics.h"
#include "CachedHistory.h"
+#include "CachedInput.h"
#include "CachedNode.h"
#include "SkBitmap.h"
#include "SkBounder.h"
@@ -755,14 +756,17 @@ bool CachedRoot::checkRings(const WTF::Vector<WebCore::IntRect>& rings,
return ringCheck.success();
}
-CachedRoot::ImeAction CachedRoot::cursorTextFieldAction() const
+CachedRoot::ImeAction CachedRoot::currentTextFieldAction() const
{
- const CachedFrame* cursorFrame;
- const CachedNode* cursor = currentCursor(&cursorFrame);
- if (!cursor) {
- // Error case. The cursor has no action, because there is no node under
- // the cursor
- return FAILURE;
+ const CachedFrame* currentFrame;
+ const CachedNode* current = currentCursor(&currentFrame);
+ if (!current || !current->isTextInput()) {
+ // Although the cursor is not on a textfield, a textfield may have
+ // focus. Find the action for that textfield.
+ current = currentFocus(&currentFrame);
+ if (!current || !current->isTextInput())
+ // Error case. No cursor and no focus.
+ return FAILURE;
}
const CachedNode* firstTextfield = nextTextField(0, 0, false);
if (!firstTextfield) {
@@ -770,9 +774,13 @@ CachedRoot::ImeAction CachedRoot::cursorTextFieldAction() const
return FAILURE;
}
// Now find the next textfield/area starting with the cursor
- if (cursorFrame->nextTextField(cursor, 0, true)) {
- // There is a textfield/area after the cursor, so the textfield under
- // the cursor should have the NEXT action
+ const CachedFrame* potentialFrame;
+ const CachedNode* potentialNext
+ = currentFrame->nextTextField(current, &potentialFrame, true);
+ if (potentialNext && currentFrame->textInput(current)->formPointer()
+ == potentialFrame->textInput(potentialNext)->formPointer()) {
+ // There is a textfield/area after the cursor in the same form,
+ // so the textfield under the cursor should have the NEXT action
return NEXT;
}
// If this line is reached, we know that the textfield under the cursor is
@@ -792,7 +800,7 @@ const CachedNode* CachedRoot::findAt(const WebCore::IntRect& rect,
DBG_NAV_LOGD("node=%d (%p)", node == NULL ? 0 : node->index(),
node == NULL ? NULL : node->nodePointer());
if (node == NULL) {
- node = findBestHitAt(rect, &best, framePtr, x, y);
+ node = findBestHitAt(rect, framePtr, x, y);
DBG_NAV_LOGD("node=%d (%p)", node == NULL ? 0 : node->index(),
node == NULL ? NULL : node->nodePointer());
}
@@ -844,9 +852,9 @@ int CachedRoot::getBlockLeftEdge(int x, int y, float scale) const
const CachedFrame* frame;
int fx, fy;
const CachedNode* node = findAt(rect, &frame, &fx, &fy, true);
- if (node && (node->isTextArea() || node->isTextField() || node->isPlugin())) {
+ if (node && node->wantsKeyEvents()) {
DBG_NAV_LOGD("x=%d (%s)", node->bounds().x(),
- node->isTextArea() || node->isTextField() ? "text" : "plugin");
+ node->isTextInput() ? "text" : "plugin");
return node->bounds().x();
}
int halfW = (int) (mViewBounds.width() * scale * 0.5f);