summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/CachedFrame.cpp
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-04-22 13:24:19 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-04-22 13:24:19 -0700
commit68b8e349574b5d6db35108cbb5236133b99eeaa6 (patch)
tree7c08fce0e3ae0295ddde48b7ce578025db7f52d1 /WebKit/android/nav/CachedFrame.cpp
parent3c27e79b9a94ccd27938cffbf5abcef20f5716f5 (diff)
parent0f92e845ed6499088958acf229f196ad67965f63 (diff)
downloadexternal_webkit-68b8e349574b5d6db35108cbb5236133b99eeaa6.zip
external_webkit-68b8e349574b5d6db35108cbb5236133b99eeaa6.tar.gz
external_webkit-68b8e349574b5d6db35108cbb5236133b99eeaa6.tar.bz2
am 0f92e845: am 55ab51c0: Merge "nextTextField may walk off the end or try invalid frames" into froyo
Merge commit '0f92e845ed6499088958acf229f196ad67965f63' into kraken * commit '0f92e845ed6499088958acf229f196ad67965f63': nextTextField may walk off the end or try invalid frames
Diffstat (limited to 'WebKit/android/nav/CachedFrame.cpp')
-rw-r--r--WebKit/android/nav/CachedFrame.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index 21a4115..ce5600b 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -928,28 +928,27 @@ int CachedFrame::maxWorkingVertical() const
}
const CachedNode* CachedFrame::nextTextField(const CachedNode* start,
- const CachedFrame** framePtr) const
+ const CachedFrame** framePtr, bool* startFound) const
{
- CachedNode* test;
- if (start) {
- test = const_cast<CachedNode*>(start);
- test++;
- } else {
- test = const_cast<CachedNode*>(mCachedNodes.begin());
- }
- while (test != mCachedNodes.end()) {
- CachedFrame* frame = const_cast<CachedFrame*>(hasFrame(test));
+ const CachedNode* test = mCachedNodes.begin();
+ while ((test = test->traverseNextNode())) {
+ const CachedFrame* frame = hasFrame(test);
if (frame) {
+ if (!frame->validDocument())
+ continue;
const CachedNode* node
- = frame->nextTextField(0, framePtr);
+ = frame->nextTextField(start, framePtr, startFound);
if (node)
return node;
} else if (test->isTextInput()) {
- if (framePtr)
- *framePtr = this;
- return test;
+ if (test == start)
+ *startFound = true;
+ else if (*startFound) {
+ if (framePtr)
+ *framePtr = this;
+ return test;
+ }
}
- test++;
}
return 0;
}