Changeset 74003 in webkit


Ignore:
Timestamp:
Dec 13, 2010 10:51:41 PM (13 years ago)
Author:
tonikitoo@webkit.org
Message:

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

Reviewed by Daniel Bates.

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

No new tests needed.

  • page/SpatialNavigation.h: Added FocusCandidate::isFrameOwnerElement and WebCore::frameOwnerElement helper functions. (WebCore::FocusCandidate::isFrameOwnerElement): Returns true if the Node pointer wrapped by FocusCandidate is an instance of HTMLFrameOwnerElement. Returns false otherwise.
  • page/SpatialNavigation.cpp: (WebCore::frameOwnerElement): Returns the HTMLFrameOwnerElement associated with the FocusCandidate if appropriate.
  • page/FocusController.cpp: (WebCore::updateFocusCandidateIfNeeded): Make use of newly added frameOwnerElement() helper. (WebCore::FocusController::adva
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r74001 r74003  
     12010-12-13  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Spatial Navigation: code clean up (part III)
     6        https://bugs.webkit.org/show_bug.cgi?id=50666
     7
     8        No new tests needed.
     9
     10        * page/SpatialNavigation.h: Added FocusCandidate::isFrameOwnerElement and
     11        WebCore::frameOwnerElement helper functions.
     12        (WebCore::FocusCandidate::isFrameOwnerElement): Returns true if the Node pointer
     13        wrapped by FocusCandidate is an instance of HTMLFrameOwnerElement. Returns false
     14        otherwise.
     15        * page/SpatialNavigation.cpp:
     16        (WebCore::frameOwnerElement): Returns the HTMLFrameOwnerElement associated with
     17        the FocusCandidate if appropriate.
     18        * page/FocusController.cpp:
     19        (WebCore::updateFocusCandidateIfNeeded): Make use of newly added frameOwnerElement() helper.
     20        (WebCore::FocusController::advanceFocusDirectionallyInContainer): Ditto.
     21
    1222010-12-13  Mike Lawther  <mikelawther@chromium.org>
    223
  • trunk/WebCore/page/FocusController.cpp

    r73885 r74003  
    4242#include "FrameView.h"
    4343#include "HTMLAreaElement.h"
    44 #include "HTMLFrameOwnerElement.h"
    4544#include "HTMLImageElement.h"
    4645#include "HTMLNames.h"
     
    420419
    421420    // Ignore iframes that don't have a src attribute
    422     if (candidate.visibleNode->isFrameOwnerElement() && (!static_cast<HTMLFrameOwnerElement*>(candidate.visibleNode)->contentFrame() || candidate.rect.isEmpty()))
     421    if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentFrame() || candidate.rect.isEmpty()))
    423422        return;
    424423
     
    510509        return false;
    511510    }
    512     if (focusCandidate.visibleNode->isFrameOwnerElement()) {
    513         HTMLFrameOwnerElement* frameElement = static_cast<HTMLFrameOwnerElement*>(focusCandidate.visibleNode);
     511
     512    if (HTMLFrameOwnerElement* frameElement = frameOwnerElement(focusCandidate)) {
    514513        // If we have an iframe without the src attribute, it will not have a contentFrame().
    515514        // We ASSERT here to make sure that
  • trunk/WebCore/page/SpatialNavigation.cpp

    r73885 r74003  
    3434#include "FrameView.h"
    3535#include "HTMLAreaElement.h"
    36 #include "HTMLFrameOwnerElement.h"
    3736#include "HTMLImageElement.h"
    3837#include "HTMLMapElement.h"
     
    703702}
    704703
     704HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
     705{
     706    return candidate.isFrameOwnerElement() ? static_cast<HTMLFrameOwnerElement*>(candidate.visibleNode) : 0;
     707};
    705708
    706709} // namespace WebCore
  • trunk/WebCore/page/SpatialNavigation.h

    r73885 r74003  
    2323
    2424#include "FocusDirection.h"
     25#include "HTMLFrameOwnerElement.h"
    2526#include "IntRect.h"
    2627#include "Node.h"
     
    117118    bool isNull() const { return !visibleNode; }
    118119    bool inScrollableContainer() const { return visibleNode && enclosingScrollableBox; }
     120    bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFrameOwnerElement(); }
    119121    Document* document() const { return visibleNode ? visibleNode->document() : 0; }
    120122
     
    146148IntRect virtualRectForDirection(FocusDirection, const IntRect& startingRect, int width = 0);
    147149IntRect virtualRectForAreaElementAndDirection(FocusDirection, HTMLAreaElement*);
     150HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&);
     151
    148152} // namspace WebCore
    149153
Note: See TracChangeset for help on using the changeset viewer.