Changeset 72797 in webkit
- Timestamp:
- Nov 29, 2010 7:40:24 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72796 r72797 1 2010-11-29 Yael Aharon <yael.aharon@nokia.com> 2 3 Reviewed by Antonio Gomes. 4 5 Spatial Navigation: Store more information in FocusCandidate 6 https://bugs.webkit.org/show_bug.cgi?id=50153 7 8 More information should be stored in FocusCandidate, to avoid 9 recalculating it when running the spatial navigation algorithm. 10 11 No new tests, since this is code refactoring only. 12 13 * page/FocusController.cpp: 14 (WebCore::updateFocusCandidateIfNeeded): 15 (WebCore::FocusController::findFocusCandidateInContainer): 16 (WebCore::FocusController::advanceFocusDirectionallyInContainer): 17 * page/SpatialNavigation.cpp: 18 (WebCore::FocusCandidate::FocusCandidate): 19 (WebCore::canBeScrolledIntoView): 20 * page/SpatialNavigation.h: 21 (WebCore::FocusCandidate::FocusCandidate): 22 1 23 2010-11-29 Dimitri Glazkov <dglazkov@chromium.org> 2 24 -
trunk/WebCore/page/FocusController.cpp
r72596 r72797 423 423 424 424 // Ignore off screen child nodes of containers that do not scroll (overflow:hidden) 425 if ( hasOffscreenRect(candidate.node)&& !canBeScrolledIntoView(direction, candidate))425 if (candidate.isOffscreen && !canBeScrolledIntoView(direction, candidate)) 426 426 return; 427 427 … … 432 432 return; 433 433 434 if ( hasOffscreenRect(candidate.node, direction)&& candidate.alignment < Full)434 if (candidate.isOffscreenAfterScrolling && candidate.alignment < Full) 435 435 return; 436 436 … … 440 440 } 441 441 442 IntRect intersectionRect = intersection( nodeRectInAbsoluteCoordinates(candidate.node, true), nodeRectInAbsoluteCoordinates(closest.node, true));442 IntRect intersectionRect = intersection(candidate.rect, closest.rect); 443 443 if (!intersectionRect.isEmpty()) { 444 444 // If 2 nodes are intersecting, do hit test to find which node in on top. … … 480 480 continue; 481 481 482 FocusCandidate candidate(node );482 FocusCandidate candidate(node, direction); 483 483 candidate.enclosingScrollableBox = container; 484 484 updateFocusCandidateIfNeeded(direction, startingRect, candidate, closest); … … 516 516 ASSERT(frameElement->contentFrame()); 517 517 518 if ( hasOffscreenRect(focusCandidate.node, direction)) {518 if (focusCandidate.isOffscreenAfterScrolling) { 519 519 scrollInDirection(focusCandidate.node->document(), direction); 520 520 return true; … … 533 533 } 534 534 if (canScrollInDirection(direction, focusCandidate.node)) { 535 if ( hasOffscreenRect(focusCandidate.node, direction)) {535 if (focusCandidate.isOffscreenAfterScrolling) { 536 536 scrollInDirection(focusCandidate.node, direction); 537 537 return true; … … 544 544 return advanceFocusDirectionallyInContainer(focusCandidate.node, startingRect, direction, event); 545 545 } 546 if ( hasOffscreenRect(focusCandidate.node, direction)) {546 if (focusCandidate.isOffscreenAfterScrolling) { 547 547 Node* container = focusCandidate.enclosingScrollableBox; 548 548 scrollInDirection(container, direction); -
trunk/WebCore/page/SpatialNavigation.cpp
r72596 r72797 52 52 53 53 54 FocusCandidate::FocusCandidate(Node* n )54 FocusCandidate::FocusCandidate(Node* n, FocusDirection direction) 55 55 : node(n) 56 56 , enclosingScrollableBox(0) … … 60 60 , parentAlignment(None) 61 61 , rect(nodeRectInAbsoluteCoordinates(n, true /* ignore border */)) 62 , isOffscreen(hasOffscreenRect(n)) 63 , isOffscreenAfterScrolling(hasOffscreenRect(n, direction)) 62 64 { 63 65 } … … 623 625 bool canBeScrolledIntoView(FocusDirection direction, const FocusCandidate& candidate) 624 626 { 625 ASSERT(candidate.node && hasOffscreenRect(candidate.node));627 ASSERT(candidate.node && candidate.isOffscreen); 626 628 IntRect candidateRect = candidate.rect; 627 629 for (Node* parentNode = candidate.node->parent(); parentNode; parentNode = parentNode->parent()) { -
trunk/WebCore/page/SpatialNavigation.h
r72596 r72797 106 106 , alignment(None) 107 107 , parentAlignment(None) 108 , isOffscreen(true) 109 , isOffscreenAfterScrolling(true) 108 110 { 109 111 } 110 112 111 FocusCandidate(Node* n );113 FocusCandidate(Node* n, FocusDirection); 112 114 bool isNull() const { return !node; } 113 115 bool inScrollableContainer() const { return node && enclosingScrollableBox; } … … 121 123 RectsAlignment parentAlignment; 122 124 IntRect rect; 125 bool isOffscreen; 126 bool isOffscreenAfterScrolling; 123 127 }; 124 128
Note: See TracChangeset
for help on using the changeset viewer.