summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/CacheBuilder.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav/CacheBuilder.h')
-rw-r--r--WebKit/android/nav/CacheBuilder.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/WebKit/android/nav/CacheBuilder.h b/WebKit/android/nav/CacheBuilder.h
index 35bd623..ff395d3 100644
--- a/WebKit/android/nav/CacheBuilder.h
+++ b/WebKit/android/nav/CacheBuilder.h
@@ -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
@@ -77,19 +77,20 @@ public:
FOUND_COMPLETE
};
CacheBuilder();
- void allowAllTextDetection() { mAllowableTypes = ALL_CACHEDNODETYPES; }
+ void allowAllTextDetection() { mAllowableTypes = ALL_CACHEDNODE_BITS; }
void buildCache(CachedRoot* root);
static bool ConstructPartRects(Node* node, const IntRect& bounds,
IntRect* focusBounds, int x, int y, WTF::Vector<IntRect>* result);
Node* currentFocus() const;
- void disallowAddressDetection() { mAllowableTypes = (CachedNodeType) (
- mAllowableTypes & ~ADDRESS_CACHEDNODETYPE); }
- void disallowEmailDetection() { mAllowableTypes = (CachedNodeType) (
- mAllowableTypes & ~EMAIL_CACHEDNODETYPE); }
- void disallowPhoneDetection() { mAllowableTypes = (CachedNodeType) (
- mAllowableTypes & ~PHONE_CACHEDNODETYPE); }
+ void disallowAddressDetection() { mAllowableTypes = (CachedNodeBits) (
+ mAllowableTypes & ~ADDRESS_CACHEDNODE_BIT); }
+ void disallowEmailDetection() { mAllowableTypes = (CachedNodeBits) (
+ mAllowableTypes & ~EMAIL_CACHEDNODE_BIT); }
+ void disallowPhoneDetection() { mAllowableTypes = (CachedNodeBits) (
+ mAllowableTypes & ~PHONE_CACHEDNODE_BIT); }
static FoundState FindAddress(const UChar* , unsigned length, int* start,
int* end, bool caseInsensitive);
+ static IntRect getAreaRect(const HTMLAreaElement* area);
static void GetGlobalOffset(Frame* , int* x, int * y);
static void GetGlobalOffset(Node* , int* x, int * y);
static bool validNode(Frame* startFrame, void* framePtr, void* nodePtr);
@@ -126,7 +127,6 @@ private:
BoundsPart mPart;
WTF::Vector<BoundsPart> mParts;
char mStore[NAVIGATION_MAX_PHONE_LENGTH + 1];
- CachedNodeType mStoreType;
int mPartIndex;
Node* mNode;
Node* mFinalNode;
@@ -146,6 +146,7 @@ private:
const UChar* mZipStart;
const UChar* mBases[16]; // FIXME: random guess, maybe too small, maybe too big
const UChar* mWords[16];
+ const UChar* mEnds[16];
const UChar* mStarts[16]; // text is not necessarily contiguous
const char* mStates;
int mEndWord;
@@ -165,6 +166,22 @@ private:
bool mInitialized;
bool mContinuationNode;
bool mCaseInsensitive;
+ void shiftWords(int shift) {
+ memmove(mBases, &mBases[shift], (sizeof(mBases) /
+ sizeof(mBases[0]) - shift) * sizeof(mBases[0]));
+ memmove(mWords, &mWords[shift], (sizeof(mWords) /
+ sizeof(mWords[0]) - shift) * sizeof(mWords[0]));
+ memmove(mEnds, &mEnds[shift], (sizeof(mEnds) /
+ sizeof(mEnds[0]) - shift) * sizeof(mEnds[0]));
+ memmove(mStarts, &mStarts[shift], (sizeof(mStarts) /
+ sizeof(mStarts[0]) - shift) * sizeof(mStarts[0]));
+ }
+ void newWord(const UChar* baseChars, const UChar* chars) {
+ mBases[mWordCount] = baseChars;
+ mWords[mWordCount] = chars;
+ mEnds[mWordCount] = mEnd;
+ mStarts[mWordCount] = mCurrentStart;
+ }
};
struct ClipColumnTracker {
IntRect mBounds;
@@ -183,7 +200,6 @@ private:
int mCachedNodeIndex;
int mTabIndex;
Node* mLastChild;
- Node* mParentLastChild;
bool mSomeParentTakesFocus;
};
void adjustForColumns(const ClipColumnTracker& track,
@@ -212,7 +228,6 @@ private:
static Frame* FrameAnd(CacheBuilder* focusNav);
static Frame* FrameAnd(const CacheBuilder* focusNav);
static CacheBuilder* Builder(Frame* );
- static IntRect getAreaRect(const HTMLAreaElement* area);
static Frame* HasFrame(Node* );
static bool HasOverOrOut(Node* );
static bool HasTriggerEvent(Node* );
@@ -225,7 +240,7 @@ private:
bool setData(CachedFrame* );
Node* tryFocus(Direction direction);
Node* trySegment(Direction direction, int mainStart, int mainEnd);
- CachedNodeType mAllowableTypes;
+ CachedNodeBits mAllowableTypes;
#if DUMP_NAV_CACHE
public:
class Debug {