if (onlyChildCached->parent() == lastCached)
onlyChildCached->setParentIndex(lastCached->parentIndex());
bool hasFocus = lastCached->isFocus() || onlyChildCached->isFocus();
- if (outerIsMouseMoveOnly || onlyChild->isKeyboardFocusable(NULL))
+ if (outerIsMouseMoveOnly || onlyChild->isKeyboardFocusable(NULL)) {
+ int index = lastCached->index();
*lastCached = *onlyChildCached;
+ lastCached->setIndex(index);
+ CachedFrame* frame = cachedFrame->hasFrame(lastCached);
+ if (frame)
+ frame->setIndexInParent(index);
+ }
cachedFrame->removeLast();
if (hasFocus)
cachedRoot->setCachedFocus(cachedFrame, cachedFrame->lastNode());
return bestData->mNode;
}
-const CachedFrame* CachedFrame::hasFrame(const CachedNode* node) const
+CachedFrame* CachedFrame::hasFrame(const CachedNode* node)
{
return node->isFrame() ? &mCachedFrames[node->childFrameIndex()] : NULL;
}
void* framePointer() const { return mFrame; }
CachedNode* getIndex(int index) { return index >= 0 ?
&mCachedNodes[index] : NULL; }
- const CachedFrame* hasFrame(const CachedNode* node) const;
+ const CachedFrame* hasFrame(const CachedNode* node) const {
+ return const_cast<CachedFrame*>(this)->hasFrame(node);
+ }
+ CachedFrame* hasFrame(const CachedNode* node);
void hideCursor();
int indexInParent() const { return mIndexInParent; }
void init(const CachedRoot* root, int index, WebCore::Frame* frame);
void setData();
bool setFocus(WebCore::Frame* , WebCore::Node* , int x, int y);
void setFocusIndex(int index) { mFocusIndex = index; }
+ void setIndexInParent(int index) { mIndexInParent = index; }
void setLocalViewBounds(const WebCore::IntRect& bounds) { mLocalViewBounds = bounds; }
int size() { return mCachedNodes.size(); }
const CachedInput* textInput(const CachedNode* node) const {
#include "FindCanvas.h"
#include "LayerAndroid.h"
#include "IntRect.h"
+#include "SelectText.h"
#include "SkBlurMaskFilter.h"
#include "SkCornerPathEffect.h"
#include "SkRect.h"
+#include "SkUtils.h"
#include <utils/Log.h>
, mUpperText(upper)
, mLength(byteLength)
, mNumFound(0) {
+ // the text has been provided in read order. Reverse as needed so the
+ // result contains left-to-right characters.
+ const uint16_t* start = mLowerText;
+ size_t count = byteLength >> 1;
+ const uint16_t* end = mLowerText + count;
+ while (start < end) {
+ SkUnichar ch = SkUTF16_NextUnichar(&start);
+ WTF::Unicode::Direction charDirection = WTF::Unicode::direction(ch);
+ if (WTF::Unicode::RightToLeftArabic == charDirection
+ || WTF::Unicode::RightToLeft == charDirection) {
+ mLowerReversed.clear();
+ mLowerReversed.append(mLowerText, count);
+ WebCore::ReverseBidi(mLowerReversed.begin(), count);
+ mLowerText = mLowerReversed.begin();
+ mUpperReversed.clear();
+ mUpperReversed.append(mUpperText, count);
+ WebCore::ReverseBidi(mUpperReversed.begin(), count);
+ mUpperText = mUpperReversed.begin();
+ break;
+ }
+ }
setBounder(&mBounder);
mOutset = -SkIntToScalar(INTEGER_OUTSET);
WTF::Vector<MatchInfo>* mMatches;
const UChar* mLowerText;
const UChar* mUpperText;
+ Vector<UChar> mLowerReversed;
+ Vector<UChar> mUpperReversed;
size_t mLength;
FindBounder mBounder;
int mNumFound;