diff options
Diffstat (limited to 'WebKit/android/nav/CachedFrame.cpp')
| -rw-r--r-- | WebKit/android/nav/CachedFrame.cpp | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp index ce5600b..81ef299 100644 --- a/WebKit/android/nav/CachedFrame.cpp +++ b/WebKit/android/nav/CachedFrame.cpp @@ -48,6 +48,19 @@ WebCore::IntRect CachedFrame::adjustBounds(const CachedNode* node, #endif } +// This is for nodes inside a layer. It takes an IntRect that has been +// adjusted by the layer's position and removes the adjustment made by the +// layer. +WebCore::IntRect CachedFrame::unadjustBounds(const CachedNode* node, + const WebCore::IntRect& rect) const +{ +#if USE(ACCELERATED_COMPOSITING) + if (node->isInLayer()) + return layer(node)->unadjustBounds(mRoot->rootLayer(), rect); +#endif + return rect; +} + bool CachedFrame::CheckBetween(Direction direction, const WebCore::IntRect& bestRect, const WebCore::IntRect& prior, WebCore::IntRect* result) { @@ -119,9 +132,10 @@ bool CachedFrame::checkBetween(BestData* best, Direction direction) bool CachedFrame::checkRings(const CachedNode* node, const WTF::Vector<WebCore::IntRect>& rings, - const WebCore::IntRect& bounds) const + const WebCore::IntRect& nodeBounds, + const WebCore::IntRect& testBounds) const { - return mRoot->checkRings(picture(node), rings, bounds); + return mRoot->checkRings(picture(node), rings, nodeBounds, testBounds); } bool CachedFrame::checkVisited(const CachedNode* node, Direction direction) const @@ -394,8 +408,10 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, if (*directHit == NULL) { *directHit = test; *directHitFramePtr = this; - *x = center.x(); - *y = center.y(); + IntRect r(center, IntSize(0, 0)); + r = unadjustBounds(test, r); + *x = r.x(); + *y = r.y(); } else { // We have hit another one before const CachedNode* d = *directHit; @@ -436,6 +452,7 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, *inside = testInside; result = test; *framePtr = this; + both = unadjustBounds(test, both); *x = both.x() + (both.width() >> 1); *y = both.y() + (both.height() >> 1); } @@ -495,17 +512,30 @@ const CachedNode* CachedFrame::findBestHitAt(const WebCore::IntRect& rect, testData.setNodeBounds(testRect); if (mRoot->maskIfHidden(&testData) == true) continue; + DBG_NAV_LOGD("candidate %d rect=(%d,%d,r=%d,b=%d)" + " testRect=(%d,%d,r=%d,b=%d)", + test->index(), rect.x(), rect.y(), rect.right(), rect.bottom(), + testRect.x(), testRect.y(), testRect.right(), testRect.bottom()); for (int i = 0; i < test->navableRects(); i++) { WebCore::IntRect cursorRect = test->ring(this, i); + DBG_NAV_LOGD("candidate %d cursorRect=(%d,%d,r=%d,b=%d)", + i, cursorRect.x(), cursorRect.y(), cursorRect.right(), + cursorRect.bottom()); if (cursorRect.intersects(rect)) { WebCore::IntRect intersection(cursorRect); intersection.intersect(rect); + intersection = unadjustBounds(test, intersection); *x = intersection.x() + (intersection.width() >> 1); *y = intersection.y() + (intersection.height() >> 1); *framePtr = this; return test; } } + testRect.intersect(rect); + *x = testRect.x() + (testRect.width() >> 1); + *y = testRect.y() + (testRect.height() >> 1); + *framePtr = this; + return test; } return NULL; } @@ -696,12 +726,17 @@ int CachedFrame::frameNodeCommon(BestData& testData, const CachedNode* test, testData.mNode->setCondition(CachedNode::DISABLED); return REJECT_TEST; } - if (mRoot->scrolledBounds().intersects(test->bounds(this)) == false) { + WebCore::IntRect bounds = test->bounds(this); + if (bounds.isEmpty()) { + testData.mNode->setCondition(CachedNode::NAVABLE); + return REJECT_TEST; + } + if (mRoot->scrolledBounds().intersects(bounds) == false) { testData.mNode->setCondition(CachedNode::NAVABLE); return REJECT_TEST; } if (mRoot->rootLayer() && !test->isInLayer() - && !mRoot->baseUncovered().intersects(test->bounds(this))) { + && !mRoot->baseUncovered().intersects(bounds)) { testData.mNode->setCondition(CachedNode::UNDER_LAYER); return REJECT_TEST; } @@ -901,7 +936,7 @@ WebCore::IntRect CachedFrame::localBounds(const CachedNode* node, DBG_NAV_LOGD("node=%p [%d] rect=(%d,%d,w=%d,h=%d)", node, node->index(), rect.x(), rect.y(), rect.width(), rect.height()); #if USE(ACCELERATED_COMPOSITING) - return layer(node)->localBounds(rect); + return layer(node)->localBounds(mRoot->rootLayer(), rect); #else return rect; #endif @@ -1390,6 +1425,7 @@ void CachedFrame::Debug::print() const const CachedInput* input = b->textInput(node); if (input) input->mDebug.print(); + DUMP_NAV_LOGD("\n"); } DUMP_NAV_LOGD("// }; // end of nodes\n"); #if USE(ACCELERATED_COMPOSITING) @@ -1400,6 +1436,12 @@ void CachedFrame::Debug::print() const } DUMP_NAV_LOGD("// }; // end of layers\n"); #endif // USE(ACCELERATED_COMPOSITING) + DUMP_NAV_LOGD("// CachedColor mCachedColors={ // count=%d\n", b->mCachedColors.size()); + for (CachedColor* color = b->mCachedColors.begin(); + color != b->mCachedColors.end(); color++) { + color->mDebug.print(); + } + DUMP_NAV_LOGD("// }; // end of colors\n"); DUMP_NAV_LOGD("// CachedFrame mCachedFrames={ // count=%d\n", b->mCachedFrames.size()); for (CachedFrame* child = b->mCachedFrames.begin(); child != b->mCachedFrames.end(); child++) |
