Changeset 153704 in webkit
- Timestamp:
- Aug 5, 2013 6:09:19 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r153702 r153704 1 2013-08-05 Abhijeet Kandalkar <abhijeet.k@samsung.com> 2 3 Spatial Navigation should avoid unwanted calculation while deciding focus candidate. 4 https://bugs.webkit.org/show_bug.cgi?id=117265 5 6 Reviewed by Antonio Gomes. 7 8 Added testcases to count how many target nodes were tested before choosing a final target. 9 10 * fast/spatial-navigation/snav-search-optimization-expected.txt: Added. 11 * fast/spatial-navigation/snav-search-optimization.html: Added. 12 1 13 2013-08-05 Mihai Tica <mitica@adobe.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r153702 r153704 1 2013-08-05 Abhijeet Kandalkar <abhijeet.k@samsung.com> 2 3 Spatial Navigation should avoid unwanted calculation while deciding focus candidate. 4 https://bugs.webkit.org/show_bug.cgi?id=117265 5 6 Reviewed by Antonio Gomes. 7 8 Spatial Navigation should consider only those nodes as candidate which are exactly in the focus-direction. 9 e.g. If we are moving down then the nodes that are above CURRENT focused node should be considered as invalid. 10 Added isValidCandidate() which checks whether node is exactly in the focus-direction. 11 12 Test: fast/spatial-navigation/snav-search-optimization.html 13 14 * page/FocusController.cpp: 15 (WebCore::FocusController::findFocusCandidateInContainer): 16 (WebCore::FocusController::advanceFocusDirectionally): 17 * page/Page.cpp: 18 (WebCore::Page::Page): 19 * page/Page.h: 20 (WebCore::Page::setLastSpatialNavigationCandidateCount): 21 (WebCore::Page::lastSpatialNavigationCandidateCount): 22 * page/SpatialNavigation.cpp: 23 (WebCore::isValidCandidate): 24 * page/SpatialNavigation.h: 25 * testing/Internals.cpp: 26 (WebCore::Internals::lastSpatialNavigationCandidateCount): 27 * testing/Internals.h: 28 * testing/Internals.idl: 29 1 30 2013-08-05 Mihai Tica <mitica@adobe.com> 2 31 -
trunk/Source/WebCore/page/FocusController.cpp
r152218 r153704 767 767 current.visibleNode = focusedNode; 768 768 769 unsigned candidateCount = 0; 769 770 for (; element; element = (element->isFrameOwnerElement() || canScrollInDirection(element, direction)) 770 771 ? ElementTraversal::nextSkippingChildren(element, container) … … 780 781 continue; 781 782 783 if (!isValidCandidate(direction, current, candidate)) 784 continue; 785 786 candidateCount++; 782 787 candidate.enclosingScrollableBox = container; 783 788 updateFocusCandidateIfNeeded(direction, current, candidate, closest); 789 } 790 791 // The variable 'candidateCount' keeps track of the number of nodes traversed in a given container. 792 // If we have more than one container in a page then the total number of nodes traversed is equal to the sum of nodes traversed in each container. 793 if (focusedFrame() && focusedFrame()->document()) { 794 candidateCount += focusedFrame()->document()->page()->lastSpatialNavigationCandidateCount(); 795 focusedFrame()->document()->page()->setLastSpatialNavigationCandidateCount(candidateCount); 784 796 } 785 797 } … … 869 881 if (container->isDocumentNode()) 870 882 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 871 883 872 884 // Figure out the starting rect. 873 885 LayoutRect startingRect; … … 883 895 } 884 896 897 if (focusedFrame() && focusedFrame()->document()) 898 focusedDocument->page()->setLastSpatialNavigationCandidateCount(0); 899 885 900 bool consumed = false; 886 901 do { -
trunk/Source/WebCore/page/Page.cpp
r153451 r153704 188 188 , m_pageThrottler(PageThrottler::create(this)) 189 189 , m_console(PageConsole::create(this)) 190 , m_lastSpatialNavigationCandidatesCount(0) // NOTE: Only called from Internals for Spatial Navigation testing. 190 191 , m_framesHandlingBeforeUnloadEvent(0) 191 192 { -
trunk/Source/WebCore/page/Page.h
r152941 r153704 410 410 void decrementFrameHandlingBeforeUnloadEventCount(); 411 411 bool isAnyFrameHandlingBeforeUnloadEvent(); 412 void setLastSpatialNavigationCandidateCount(unsigned count) { m_lastSpatialNavigationCandidatesCount = count; } 413 unsigned lastSpatialNavigationCandidateCount() const { return m_lastSpatialNavigationCandidatesCount; } 412 414 413 415 private: … … 547 549 HashSet<String> m_seenPlugins; 548 550 HashSet<String> m_seenMediaEngines; 549 551 552 unsigned m_lastSpatialNavigationCandidatesCount; 550 553 unsigned m_framesHandlingBeforeUnloadEvent; 551 554 }; -
trunk/Source/WebCore/page/SpatialNavigation.cpp
r153469 r153704 621 621 } 622 622 623 // Consider only those nodes as candidate which are exactly in the focus-direction. 624 // e.g. If we are moving down then the nodes that are above current focused node should be considered as invalid. 625 bool isValidCandidate(FocusDirection direction, const FocusCandidate& current, FocusCandidate& candidate) 626 { 627 LayoutRect currentRect = current.rect; 628 LayoutRect candidateRect = candidate.rect; 629 630 switch (direction) { 631 case FocusDirectionLeft: 632 return candidateRect.x() < currentRect.maxX(); 633 case FocusDirectionUp: 634 return candidateRect.y() < currentRect.maxY(); 635 case FocusDirectionRight: 636 return candidateRect.maxX() > currentRect.x(); 637 case FocusDirectionDown: 638 return candidateRect.maxY() > currentRect.y(); 639 default: 640 ASSERT_NOT_REACHED(); 641 } 642 return false; 643 } 644 623 645 void distanceDataForNode(FocusDirection direction, const FocusCandidate& current, FocusCandidate& candidate) 624 646 { -
trunk/Source/WebCore/page/SpatialNavigation.h
r153469 r153704 137 137 bool canBeScrolledIntoView(FocusDirection, const FocusCandidate&); 138 138 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCandidate& secondCandidate); 139 bool isValidCandidate(FocusDirection, const FocusCandidate&, FocusCandidate&); 139 140 void distanceDataForNode(FocusDirection, const FocusCandidate& current, FocusCandidate& candidate); 140 141 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node*); -
trunk/Source/WebCore/testing/Internals.cpp
r153054 r153704 394 394 } 395 395 396 unsigned Internals::lastSpatialNavigationCandidateCount(ExceptionCode& ec) const 397 { 398 if (!contextDocument() || !contextDocument()->page()) { 399 ec = INVALID_ACCESS_ERR; 400 return 0; 401 } 402 403 return contextDocument()->page()->lastSpatialNavigationCandidateCount(); 404 } 405 396 406 unsigned Internals::numberOfActiveAnimations() const 397 407 { -
trunk/Source/WebCore/testing/Internals.h
r153054 r153704 95 95 void setShadowPseudoId(Element*, const String&, ExceptionCode&); 96 96 97 // Spatial Navigation testing. 98 unsigned lastSpatialNavigationCandidateCount(ExceptionCode&) const; 99 97 100 // CSS Animation testing. 98 101 unsigned numberOfActiveAnimations() const; -
trunk/Source/WebCore/testing/Internals.idl
r153054 r153704 55 55 [RaisesException] Node parentTreeScope(Node node); 56 56 57 // Spatial Navigation testing 58 [RaisesException] unsigned long lastSpatialNavigationCandidateCount(); 59 57 60 // CSS Animation testing. 58 61 unsigned long numberOfActiveAnimations();
Note: See TracChangeset
for help on using the changeset viewer.