diff options
Diffstat (limited to 'WebKit/android')
-rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 9 | ||||
-rw-r--r-- | WebKit/android/nav/CachedRoot.h | 4 | ||||
-rw-r--r-- | WebKit/android/nav/SelectText.cpp | 11 | ||||
-rw-r--r-- | WebKit/android/nav/SelectText.h | 1 |
4 files changed, 20 insertions, 5 deletions
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp index 813357c..4ae66de 100644 --- a/WebKit/android/nav/CachedRoot.cpp +++ b/WebKit/android/nav/CachedRoot.cpp @@ -1661,7 +1661,7 @@ const CachedNode* CachedRoot::nextTextField(const CachedNode* start, return CachedFrame::nextTextField(start, framePtr, &startFound); } -SkPicture* CachedRoot::pictureAt(int* xPtr, int* yPtr) const +SkPicture* CachedRoot::pictureAt(int* xPtr, int* yPtr, int* id) const { #if USE(ACCELERATED_COMPOSITING) if (mRootLayer) { @@ -1675,13 +1675,18 @@ SkPicture* CachedRoot::pictureAt(int* xPtr, int* yPtr) const layer->bounds(&localBounds); *xPtr -= localBounds.fLeft; *yPtr -= localBounds.fTop; - if (picture) + if (picture) { + if (id) + *id = layer->uniqueId(); return picture; + } } } #endif DBG_NAV_LOGD("root mPicture=%p (%d,%d)", mPicture, mPicture ? mPicture->width() : 0, mPicture ? mPicture->height() : 0); + if (id) + *id = -1; return mPicture; } diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h index 18bace3..a09e4fb 100644 --- a/WebKit/android/nav/CachedRoot.h +++ b/WebKit/android/nav/CachedRoot.h @@ -85,7 +85,9 @@ public: */ const CachedNode* nextTextField(const CachedNode* start, const CachedFrame** framePtr) const; - SkPicture* pictureAt(int* xPtr, int* yPtr) const; + SkPicture* pictureAt(int* xPtr, int* yPtr, int* id) const; + SkPicture* pictureAt(int* xPtr, int* yPtr) const { + return pictureAt(xPtr, yPtr, 0); } void reset(); CachedHistory* rootHistory() const { return mHistory; } const WebCore::LayerAndroid* rootLayer() const { return mRootLayer; } diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp index e606f62..f6548cf 100644 --- a/WebKit/android/nav/SelectText.cpp +++ b/WebKit/android/nav/SelectText.cpp @@ -1290,8 +1290,12 @@ SelectText::~SelectText() void SelectText::draw(SkCanvas* canvas, LayerAndroid* layer) { - if (!m_picture || m_picture != layer->picture()) + if (m_layerId != layer->uniqueId()) return; + // reset m_picture to match m_layerId + m_picture->safeUnref(); + m_picture = layer->picture(); + m_picture->safeRef(); DBG_NAV_LOGD("m_extendSelection=%d m_drawPointer=%d layer [%d]", m_extendSelection, m_drawPointer, layer->uniqueId()); if (m_extendSelection) @@ -1330,6 +1334,8 @@ void SelectText::drawSelectionPointer(SkCanvas* canvas) void SelectText::drawSelectionRegion(SkCanvas* canvas) { + if (!m_picture) + return; m_selRegion.setEmpty(); SkIRect ivisBounds = m_visibleRect; ivisBounds.join(m_selStart); @@ -1512,6 +1518,7 @@ void SelectText::reset() m_startSelection = false; m_picture->safeUnref(); m_picture = 0; + m_layerId = 0; } void SelectText::selectAll() @@ -1548,7 +1555,7 @@ bool SelectText::startSelection(const CachedRoot* root, const IntRect& vis, { m_startOffset.set(x, y); m_picture->safeUnref(); - m_picture = root->pictureAt(&x, &y); + m_picture = root->pictureAt(&x, &y, &m_layerId); if (!m_picture) { DBG_NAV_LOG("picture==0"); return false; diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h index d210117..8247356 100644 --- a/WebKit/android/nav/SelectText.h +++ b/WebKit/android/nav/SelectText.h @@ -73,6 +73,7 @@ private: SkIRect m_selEnd; int m_startBase; int m_endBase; + int m_layerId; SkIRect m_visibleRect; // constrains picture computations to visible area SkRegion m_selRegion; // computed from sel start, end SkPicture m_startControl; |