[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

tonikitoo at webkit.org tonikitoo at webkit.org
Fri Jan 21 14:44:48 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 3d62372dac084ab44275fa683de3197925c7fc5c
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 28 21:57:11 2010 +0000

    2010-12-20  Antonio Gomes  <agomes at rim.com>
    
            Reviewed by Daniel Bates.
    
            Spatial Navigation: code clean up (Part VI)
            https://bugs.webkit.org/show_bug.cgi?id=50666
    
            No new tests needed.
    
            * page/FocusController.cpp:
            (WebCore::updatFocusCandidateIfNeeded): Assert renderer() and
            isElementNode() now that we are bailing out earlier in both the
            FocusCandidate constructor and FocusController::findFocusCandidateInContainer().
            * page/SpatialNavigation.h: Swapped the parameters order in canScrollInDirection
            and virtualRectForAreaElementAndDirection functions.
            (WebCore::FocusController::findFocusCandidateInContainer):
            (WebCore::FocusController::advanceFocusDirectionallyInContainer): Adjusted call sites
            of canScrollInDirection(), and added an early return if !isElementNode().
            (WebCore::FocusController::advanceFocusDirectionally): Adjusted call site of
            virtualRectForAreaElementAndDirection().
            * page/SpatialNavigation.cpp:
            (WebCore::FocusCandidate::FocusCandidate): Assert if node is not an Element node.
            (WebCore::isScrollableNode): Renamed from isScrollableContainerNode.
            (WebCore::scrollInDirection): Adjusted call site after function name change;
            (WebCore::scrollableEnclosingBoxOrParentFrameForNodeInDi:rection): Assert if node is
            a Document node.
            (WebCore::canScrollInDirection): Signature changed.
            (WebCore::canBeScrolledIntoView): Ditto.
            (WebCore::virtualRectForAreaElementAndDirection): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74723 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d102a47..af13109 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-12-20  Antonio Gomes  <agomes at rim.com>
+
+        Reviewed by Daniel Bates.
+
+        Spatial Navigation: code clean up (Part VI)
+        https://bugs.webkit.org/show_bug.cgi?id=50666
+
+        No new tests needed.
+
+        * page/FocusController.cpp:
+        (WebCore::updatFocusCandidateIfNeeded): Assert renderer() and
+        isElementNode() now that we are bailing out earlier in both the
+        FocusCandidate constructor and FocusController::findFocusCandidateInContainer().
+        * page/SpatialNavigation.h: Swapped the parameters order in canScrollInDirection
+        and virtualRectForAreaElementAndDirection functions.
+        (WebCore::FocusController::findFocusCandidateInContainer):
+        (WebCore::FocusController::advanceFocusDirectionallyInContainer): Adjusted callsites
+        of canScrollInDirection(), and added an early return if !isElementNode().
+        (WebCore::FocusController::advanceFocusDirectionally): Adjusted callsite of
+        virtualRectForAreaElementAndDirection();
+        * page/SpatialNavigation.cpp:
+        (WebCore::FocusCandidate::FocusCandidate): Assert if node is not a element node;
+        (WebCore::isScrollableNode): Renamed from isScrollableContainerNode;
+        (WebCore::scrollInDirection): Adjusted callsite after function name change;
+        (WebCore::scrollableEnclosingBoxOrParentFrameForNodeInDi:rection): Assert if node is
+        a documentNode.
+        (WebCore::canScrollInDirection): Signature changed.
+        (WebCore::canBeScrolledIntoView): Ditto.
+        (WebCore::virtualRectForAreaElementAndDirection): Ditto.
+
 2010-12-28  Adrienne Walker  <enne at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index 9ca18dd..eda1005 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -417,8 +417,8 @@ void FocusController::setActive(bool active)
 
 static void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& startingRect, FocusCandidate& candidate, FocusCandidate& closest)
 {
-    if (!candidate.visibleNode->isElementNode() || !candidate.visibleNode->renderer())
-        return;
+    ASSERT(candidate.visibleNode->isElementNode());
+    ASSERT(candidate.visibleNode->renderer());
 
     // Ignore iframes that don't have a src attribute
     if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentFrame() || candidate.rect.isEmpty()))
@@ -472,11 +472,14 @@ void FocusController::findFocusCandidateInContainer(Node* container, const IntRe
     Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedNode() : 0;
 
     Node* node = container->firstChild();
-    for (; node; node = (node->isFrameOwnerElement() || canScrollInDirection(direction, node)) ? node->traverseNextSibling(container) : node->traverseNextNode(container)) {
+    for (; node; node = (node->isFrameOwnerElement() || canScrollInDirection(node, direction)) ? node->traverseNextSibling(container) : node->traverseNextNode(container)) {
         if (node == focusedNode)
             continue;
 
-        if (!node->isKeyboardFocusable(event) && !node->isFrameOwnerElement() && !canScrollInDirection(direction, node))
+        if (!node->isElementNode())
+            continue;
+
+        if (!node->isKeyboardFocusable(event) && !node->isFrameOwnerElement() && !canScrollInDirection(node, direction))
             continue;
 
         FocusCandidate candidate = FocusCandidate(node, direction);
@@ -531,7 +534,8 @@ bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
         }
         return true;
     }
-    if (canScrollInDirection(direction, focusCandidate.visibleNode)) {
+
+    if (canScrollInDirection(focusCandidate.visibleNode, direction)) {
         if (focusCandidate.isOffscreenAfterScrolling) {
             scrollInDirection(focusCandidate.visibleNode, direction);
             return true;
@@ -578,7 +582,7 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa
         } else if (focusedNode->hasTagName(areaTag)) {
             HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focusedNode);
             container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, area->imageElement());
-            startingRect = virtualRectForAreaElementAndDirection(direction, area);
+            startingRect = virtualRectForAreaElementAndDirection(area, direction);
         }
     }
 
diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp
index 5cb3c95..7d8ede3 100644
--- a/WebCore/page/SpatialNavigation.cpp
+++ b/WebCore/page/SpatialNavigation.cpp
@@ -52,7 +52,7 @@ static bool isRectInDirection(FocusDirection, const IntRect&, const IntRect&);
 static void deflateIfOverlapped(IntRect&, IntRect&);
 static IntRect rectToAbsoluteCoordinates(Frame* initialFrame, const IntRect&);
 static void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& startingRect, const IntRect& potentialRect, IntPoint& exitPoint, IntPoint& entryPoint);
-static bool isScrollableContainerNode(const Node*);
+static bool isScrollableNode(const Node*);
 
 FocusCandidate::FocusCandidate(Node* node, FocusDirection direction)
     : visibleNode(0)
@@ -66,6 +66,8 @@ FocusCandidate::FocusCandidate(Node* node, FocusDirection direction)
     , isOffscreenAfterScrolling(true)
 {
     ASSERT(node);
+    ASSERT(node->isElementNode());
+
     if (node->hasTagName(HTMLNames::areaTag)) {
         HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node);
         HTMLImageElement* image = area->imageElement();
@@ -73,7 +75,7 @@ FocusCandidate::FocusCandidate(Node* node, FocusDirection direction)
             return;
 
         visibleNode = image;
-        rect = virtualRectForAreaElementAndDirection(direction, area);
+        rect = virtualRectForAreaElementAndDirection(area, direction);
     } else {
         if (!node->renderer())
             return;
@@ -336,7 +338,7 @@ bool scrollInDirection(Frame* frame, FocusDirection direction)
 {
     ASSERT(frame);
 
-    if (frame && canScrollInDirection(direction, frame->document())) {
+    if (frame && canScrollInDirection(frame->document(), direction)) {
         int dx = 0;
         int dy = 0;
         switch (direction) {
@@ -372,7 +374,7 @@ bool scrollInDirection(Node* container, FocusDirection direction)
     if (!container->renderBox())
         return false;
 
-    if (canScrollInDirection(direction, container)) {
+    if (canScrollInDirection(container, direction)) {
         int dx = 0;
         int dy = 0;
         switch (direction) {
@@ -417,15 +419,15 @@ static void deflateIfOverlapped(IntRect& a, IntRect& b)
         b.inflate(deflateFactor);
 }
 
-bool isScrollableContainerNode(const Node* node)
+bool isScrollableNode(const Node* node)
 {
+    ASSERT(!node->isDocumentNode());
+
     if (!node)
         return false;
 
-    if (RenderObject* renderer = node->renderer()) {
-        return (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()
-             && node->hasChildNodes() && !node->isDocumentNode());
-    }
+    if (RenderObject* renderer = node->renderer())
+        return renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea() && node->hasChildNodes();
 
     return false;
 }
@@ -439,18 +441,18 @@ Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection direc
             parent = static_cast<Document*>(parent)->document()->frame()->ownerElement();
         else
             parent = parent->parentNode();
-    } while (parent && !canScrollInDirection(direction, parent) && !parent->isDocumentNode());
+    } while (parent && !canScrollInDirection(parent, direction) && !parent->isDocumentNode());
 
     return parent;
 }
 
-bool canScrollInDirection(FocusDirection direction, const Node* container)
+bool canScrollInDirection(const Node* container, FocusDirection direction)
 {
     ASSERT(container);
     if (container->isDocumentNode())
-        return canScrollInDirection(direction, static_cast<const Document*>(container)->frame());
+        return canScrollInDirection(static_cast<const Document*>(container)->frame(), direction);
 
-    if (!isScrollableContainerNode(container))
+    if (!isScrollableNode(container))
         return false;
 
     switch (direction) {
@@ -468,7 +470,7 @@ bool canScrollInDirection(FocusDirection direction, const Node* container)
     }
 }
 
-bool canScrollInDirection(FocusDirection direction, const Frame* frame)
+bool canScrollInDirection(const Frame* frame, FocusDirection direction)
 {
     if (!frame->view())
         return false;
@@ -659,7 +661,7 @@ bool canBeScrolledIntoView(FocusDirection direction, const FocusCandidate& candi
                 return false;
         }
         if (parentNode == candidate.enclosingScrollableBox)
-            return canScrollInDirection(direction, parentNode);
+            return canScrollInDirection(parentNode, direction);
     }
     return true;
 }
@@ -693,7 +695,7 @@ IntRect virtualRectForDirection(FocusDirection direction, const IntRect& startin
     return virtualStartingRect;
 }
 
-IntRect virtualRectForAreaElementAndDirection(FocusDirection direction, HTMLAreaElement* area)
+IntRect virtualRectForAreaElementAndDirection(HTMLAreaElement* area, FocusDirection direction)
 {
     ASSERT(area);
     ASSERT(area->imageElement());
diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h
index a6dcf24..9795f28 100644
--- a/WebCore/page/SpatialNavigation.h
+++ b/WebCore/page/SpatialNavigation.h
@@ -138,15 +138,15 @@ struct FocusCandidate {
 bool hasOffscreenRect(Node*, FocusDirection direction = FocusDirectionNone);
 bool scrollInDirection(Frame*, FocusDirection);
 bool scrollInDirection(Node* container, FocusDirection);
-bool canScrollInDirection(FocusDirection, const Node* container);
-bool canScrollInDirection(FocusDirection, const Frame*);
+bool canScrollInDirection(const Node* container, FocusDirection);
+bool canScrollInDirection(const Frame*, FocusDirection);
 bool canBeScrolledIntoView(FocusDirection, const FocusCandidate&);
 void distanceDataForNode(FocusDirection, const FocusCandidate& current, FocusCandidate& candidate);
 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node*);
 IntRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false);
 IntRect frameRectInAbsoluteCoordinates(Frame*);
 IntRect virtualRectForDirection(FocusDirection, const IntRect& startingRect, int width = 0);
-IntRect virtualRectForAreaElementAndDirection(FocusDirection, HTMLAreaElement*);
+IntRect virtualRectForAreaElementAndDirection(HTMLAreaElement*, FocusDirection);
 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&);
 
 } // namspace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list