Changeset 73885 in webkit


Ignore:
Timestamp:
Dec 12, 2010 9:52:40 PM (13 years ago)
Author:
tonikitoo@webkit.org
Message:

2010-12-09 Antonio Gomes <agomes@rim.com>

Reviewed by Daniel Bates.

Spatial Navigation: code clean up (part II)
https://bugs.webkit.org/show_bug.cgi?id=50666

No new tests needed.

  • page/FocusController.cpp: Removed static declaration of updateFocusCandidateIfNeeded() from the top of FocusController.cpp, and added the 'static' keyword where the function is implemented;
  • page/SpatialNavigation.cpp: In FocusCandidate constructor, renamed 'n' to 'node', and added an assert to it; (WebCore::FocusCandidate::FocusCandidate): (WebCore::virtualRectForAreaElementAndDirection): Added an assert to 'node';
  • page/SpatialNavigation.h:I reordered the declaration of some methods in order to group related ones; Removed isScrollableContainerNode() function declaration since it is not used outside SpatialNavigation.cpp; And removed the declaration of isNodeDeepDescendantOfDocument() since it does not exist anymore.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73872 r73885  
     12010-12-09  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Spatial Navigation: code clean up (part II)
     6        https://bugs.webkit.org/show_bug.cgi?id=50666
     7
     8        No new tests needed.
     9
     10        * page/FocusController.cpp: Removed static declaration of updateFocusCandidateIfNeeded() from
     11        the top of FocusController.cpp, and added the 'static' keyword where the function is implemented;
     12        * page/SpatialNavigation.cpp: In FocusCandidate constructor, renamed 'n' to 'node', and added an assert to it;
     13        (WebCore::FocusCandidate::FocusCandidate):
     14        (WebCore::virtualRectForAreaElementAndDirection): Added an assert to 'node';
     15        * page/SpatialNavigation.h:I reordered the declaration of some methods in order to group related ones;
     16        Removed isScrollableContainerNode() function declaration since it is not used outside SpatialNavigation.cpp;
     17        And removed the declaration of isNodeDeepDescendantOfDocument() since it does not exist anymore.
     18
    1192010-12-12  Philippe Normand  <pnormand@igalia.com>
    220
  • trunk/WebCore/page/FocusController.cpp

    r73634 r73885  
    6262using namespace std;
    6363
    64 static void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& startingRect, FocusCandidate& candidate, FocusCandidate& closest);
    6564static inline void dispatchEventsOnWindowAndFocusedNode(Document* document, bool focused)
    6665{
     
    415414}
    416415
    417 void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& startingRect, FocusCandidate& candidate, FocusCandidate& closest)
     416static void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& startingRect, FocusCandidate& candidate, FocusCandidate& closest)
    418417{
    419418    if (!candidate.visibleNode->isElementNode() || !candidate.visibleNode->renderer())
  • trunk/WebCore/page/SpatialNavigation.cpp

    r73627 r73885  
    5252static bool isRectInDirection(FocusDirection, const IntRect&, const IntRect&);
    5353static void deflateIfOverlapped(IntRect&, IntRect&);
    54 static IntRect rectToAbsoluteCoordinates(Frame* initialFrame, const IntRect& rect);
     54static IntRect rectToAbsoluteCoordinates(Frame* initialFrame, const IntRect&);
    5555static void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& startingRect, const IntRect& potentialRect, IntPoint& exitPoint, IntPoint& entryPoint);
    56 
    57 
    58 FocusCandidate::FocusCandidate(Node* n, FocusDirection direction)
     56static bool isScrollableContainerNode(const Node*);
     57
     58FocusCandidate::FocusCandidate(Node* node, FocusDirection direction)
    5959    : visibleNode(0)
    6060    , focusableNode(0)
     
    6767    , isOffscreenAfterScrolling(true)
    6868{
    69     if (n->hasTagName(HTMLNames::areaTag)) {
    70         HTMLAreaElement* area = static_cast<HTMLAreaElement*>(n);
     69    ASSERT(node);
     70    if (node->hasTagName(HTMLNames::areaTag)) {
     71        HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node);
    7172        HTMLImageElement* image = area->imageElement();
    7273        if (!image || !image->renderer())
     
    7677        rect = virtualRectForAreaElementAndDirection(direction, area);
    7778    } else {
    78         if (!n->renderer())
     79        if (!node->renderer())
    7980            return;
    8081
    81         visibleNode = n;
    82         rect = nodeRectInAbsoluteCoordinates(n, true /* ignore border */);
    83     }
    84 
    85     focusableNode = n;
     82        visibleNode = node;
     83        rect = nodeRectInAbsoluteCoordinates(node, true /* ignore border */);
     84    }
     85
     86    focusableNode = node;
    8687    isOffscreen = hasOffscreenRect(visibleNode);
    8788    isOffscreenAfterScrolling = hasOffscreenRect(visibleNode, direction);
     
    694695IntRect virtualRectForAreaElementAndDirection(FocusDirection direction, HTMLAreaElement* area)
    695696{
     697    ASSERT(area);
     698    ASSERT(area->imageElement());
    696699    // Area elements tend to overlap more than other focusable elements. We flatten the rect of the area elements
    697700    // to minimize the effect of overlapping areas.
  • trunk/WebCore/page/SpatialNavigation.h

    r73452 r73885  
    134134};
    135135
     136bool hasOffscreenRect(Node*, FocusDirection direction = FocusDirectionNone);
    136137bool scrollInDirection(Frame*, FocusDirection);
    137138bool scrollInDirection(Node* container, FocusDirection);
    138 bool hasOffscreenRect(Node*, FocusDirection direction = FocusDirectionNone);
    139 bool isScrollableContainerNode(const Node*);
    140 bool isNodeDeepDescendantOfDocument(Node*, Document*);
    141 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node* node);
    142139bool canScrollInDirection(FocusDirection, const Node* container);
    143140bool canScrollInDirection(FocusDirection, const Frame*);
     141bool canBeScrolledIntoView(FocusDirection, const FocusCandidate&);
     142void distanceDataForNode(FocusDirection, FocusCandidate& current, FocusCandidate& candidate);
     143Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node*);
    144144IntRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false);
    145145IntRect frameRectInAbsoluteCoordinates(Frame*);
    146 void distanceDataForNode(FocusDirection, FocusCandidate& current, FocusCandidate& candidate);
    147 bool canBeScrolledIntoView(FocusDirection, const FocusCandidate&);
    148146IntRect virtualRectForDirection(FocusDirection, const IntRect& startingRect, int width = 0);
    149147IntRect virtualRectForAreaElementAndDirection(FocusDirection, HTMLAreaElement*);
Note: See TracChangeset for help on using the changeset viewer.