Changeset 61298 in webkit


Ignore:
Timestamp:
Jun 16, 2010 5:57:15 PM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

Spatial Navigation: refactor scrollInDirection to work with scrollable content
https://bugs.webkit.org/show_bug.cgi?id=39195

Reviewed by Simon Fraser.
Patch by Antonio Gomes <tonikitoo@webkit.org>

WebCore:

scrollInDirection now receives as parameter the node that the Spatial Navigation
found as the more appropriated to move focus to. If it is in a scrollable container
(e.g. <div> with clipped overflow content), it scrolls recursively starting from
the container, not the current focused node.

Test: fast/events/spatial-navigation/snav-only-clipped-overflow-content.html

  • page/FocusController.cpp:

(WebCore::FocusController::advanceFocusDirectionally):

  • page/SpatialNavigation.cpp:

(WebCore::scrollInDirection):

  • page/SpatialNavigation.h:

LayoutTests:

  • fast/events/spatial-navigation/snav-only-clipped-overflow-content-expected.txt: Added.
  • fast/events/spatial-navigation/snav-only-clipped-overflow-content.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61295 r61298  
     12010-06-16  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Spatial Navigation: refactor scrollInDirection to work with scrollable content
     6        https://bugs.webkit.org/show_bug.cgi?id=39195
     7
     8        * fast/events/spatial-navigation/snav-only-clipped-overflow-content-expected.txt: Added.
     9        * fast/events/spatial-navigation/snav-only-clipped-overflow-content.html: Added.
     10
    1112010-06-16  Dimitri Glazkov  <dglazkov@chromium.org>
    212
  • trunk/WebCore/ChangeLog

    r61296 r61298  
     12010-06-16  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Spatial Navigation: refactor scrollInDirection to work with scrollable content
     6        https://bugs.webkit.org/show_bug.cgi?id=39195
     7
     8        scrollInDirection now receives as parameter the node that the Spatial Navigation
     9        found as the more appropriated to move focus to. If it is in a scrollable container
     10        (e.g. <div> with clipped overflow content), it scrolls recursively starting from
     11        the container, not the current focused node.
     12
     13        Test: fast/events/spatial-navigation/snav-only-clipped-overflow-content.html
     14
     15        * page/FocusController.cpp:
     16        (WebCore::FocusController::advanceFocusDirectionally):
     17        * page/SpatialNavigation.cpp:
     18        (WebCore::scrollInDirection):
     19        * page/SpatialNavigation.h:
     20
    1212010-06-16  Brady Eidson  <beidson@apple.com>
    222
  • trunk/WebCore/page/FocusController.cpp

    r61135 r61298  
    320320    if (hasOffscreenRect(node)) {
    321321        Frame* frame = node->document()->view()->frame();
    322         scrollInDirection(frame, direction);
     322        scrollInDirection(frame, direction, focusCandidate);
    323323        return true;
    324324    }
  • trunk/WebCore/page/SpatialNavigation.cpp

    r61250 r61298  
    449449// In a bottom-up way, this method tries to scroll |frame| in a given direction
    450450// |direction|, going up in the frame tree hierarchy in case it does not succeed.
    451 bool scrollInDirection(Frame* frame, FocusDirection direction)
     451bool scrollInDirection(Frame* frame, FocusDirection direction, const FocusCandidate& candidate)
    452452{
    453453    if (!frame)
     
    472472        return false;
    473473    }
     474
     475    if (!candidate.isNull() && isScrollableContainerNode(candidate.enclosingScrollableBox))
     476        return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine, candidate.enclosingScrollableBox);
    474477
    475478    return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine);
  • trunk/WebCore/page/SpatialNavigation.h

    r61134 r61298  
    129129
    130130void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate& candidate);
    131 bool scrollInDirection(Frame*, FocusDirection);
     131bool scrollInDirection(Frame*, FocusDirection, const FocusCandidate& candidate = FocusCandidate());
    132132void scrollIntoView(Element*);
    133133bool hasOffscreenRect(Node*);
Note: See TracChangeset for help on using the changeset viewer.