[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

yael.aharon at nokia.com yael.aharon at nokia.com
Wed Dec 22 16:37:40 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 32a9edffa764110d1a31fc694b17b8683f999073
Author: yael.aharon at nokia.com <yael.aharon at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 29 15:40:24 2010 +0000

    Spatial Navigation: Store more information in FocusCandidate
    https://bugs.webkit.org/show_bug.cgi?id=50153
    
    Reviewed by Antonio Gomes.
    
    More information should be stored in FocusCandidate, to avoid
    recalculating it when running the spatial navigation algorithm.
    
    No new tests, since this is code refactoring only.
    
    * page/FocusController.cpp:
    (WebCore::updateFocusCandidateIfNeeded):
    (WebCore::FocusController::findFocusCandidateInContainer):
    (WebCore::FocusController::advanceFocusDirectionallyInContainer):
    * page/SpatialNavigation.cpp:
    (WebCore::FocusCandidate::FocusCandidate):
    (WebCore::canBeScrolledIntoView):
    * page/SpatialNavigation.h:
    (WebCore::FocusCandidate::FocusCandidate):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72797 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3a1618b..251c5c3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-29  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Antonio Gomes.
+
+        Spatial Navigation: Store more information in FocusCandidate
+        https://bugs.webkit.org/show_bug.cgi?id=50153
+
+        More information should be stored in FocusCandidate, to avoid
+        recalculating it when running the spatial navigation algorithm.
+
+        No new tests, since this is code refactoring only.
+
+        * page/FocusController.cpp:
+        (WebCore::updateFocusCandidateIfNeeded):
+        (WebCore::FocusController::findFocusCandidateInContainer):
+        (WebCore::FocusController::advanceFocusDirectionallyInContainer):
+        * page/SpatialNavigation.cpp:
+        (WebCore::FocusCandidate::FocusCandidate):
+        (WebCore::canBeScrolledIntoView):
+        * page/SpatialNavigation.h:
+        (WebCore::FocusCandidate::FocusCandidate):
+
 2010-11-29  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index d112f9a..5418c89 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -422,7 +422,7 @@ void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& start
         return;
 
     // Ignore off screen child nodes of containers that do not scroll (overflow:hidden)
-    if (hasOffscreenRect(candidate.node) && !canBeScrolledIntoView(direction, candidate))
+    if (candidate.isOffscreen && !canBeScrolledIntoView(direction, candidate))
         return;
 
     FocusCandidate current;
@@ -431,7 +431,7 @@ void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& start
     if (candidate.distance == maxDistance())
         return;
 
-    if (hasOffscreenRect(candidate.node, direction) && candidate.alignment < Full)
+    if (candidate.isOffscreenAfterScrolling && candidate.alignment < Full)
         return;
 
     if (closest.isNull()) {
@@ -439,7 +439,7 @@ void updateFocusCandidateIfNeeded(FocusDirection direction, const IntRect& start
         return;
     }
 
-    IntRect intersectionRect = intersection(nodeRectInAbsoluteCoordinates(candidate.node, true), nodeRectInAbsoluteCoordinates(closest.node, true));
+    IntRect intersectionRect = intersection(candidate.rect, closest.rect);
     if (!intersectionRect.isEmpty()) {
         // If 2 nodes are intersecting, do hit test to find which node in on top.
         int x = intersectionRect.x() + intersectionRect.width() / 2;
@@ -479,7 +479,7 @@ void FocusController::findFocusCandidateInContainer(Node* container, const IntRe
         if (!node->isKeyboardFocusable(event) && !node->isFrameOwnerElement() && !canScrollInDirection(direction, node))
             continue;
 
-        FocusCandidate candidate(node);
+        FocusCandidate candidate(node, direction);
         candidate.enclosingScrollableBox = container;
         updateFocusCandidateIfNeeded(direction, startingRect, candidate, closest);
     }
@@ -515,7 +515,7 @@ bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
         // updateFocusCandidateIfNeeded() will never consider such an iframe as a candidate.
         ASSERT(frameElement->contentFrame());
 
-        if (hasOffscreenRect(focusCandidate.node, direction)) {
+        if (focusCandidate.isOffscreenAfterScrolling) {
             scrollInDirection(focusCandidate.node->document(), direction);
             return true;
         }
@@ -532,7 +532,7 @@ bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
         return true;
     }
     if (canScrollInDirection(direction, focusCandidate.node)) {
-        if (hasOffscreenRect(focusCandidate.node, direction)) {
+        if (focusCandidate.isOffscreenAfterScrolling) {
             scrollInDirection(focusCandidate.node, direction);
             return true;
         }
@@ -543,7 +543,7 @@ bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
             startingRect = nodeRectInAbsoluteCoordinates(focusedNode, true);
         return advanceFocusDirectionallyInContainer(focusCandidate.node, startingRect, direction, event);
     }
-    if (hasOffscreenRect(focusCandidate.node, direction)) {
+    if (focusCandidate.isOffscreenAfterScrolling) {
         Node* container = focusCandidate.enclosingScrollableBox;
         scrollInDirection(container, direction);
         return true;
diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp
index 1a7a407..c7bdb51 100644
--- a/WebCore/page/SpatialNavigation.cpp
+++ b/WebCore/page/SpatialNavigation.cpp
@@ -51,7 +51,7 @@ static IntRect rectToAbsoluteCoordinates(Frame* initialFrame, const IntRect& rec
 static void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& startingRect, const IntRect& potentialRect, IntPoint& exitPoint, IntPoint& entryPoint);
 
 
-FocusCandidate::FocusCandidate(Node* n)
+FocusCandidate::FocusCandidate(Node* n, FocusDirection direction)
     : node(n)
     , enclosingScrollableBox(0)
     , distance(maxDistance())
@@ -59,6 +59,8 @@ FocusCandidate::FocusCandidate(Node* n)
     , alignment(None)
     , parentAlignment(None)
     , rect(nodeRectInAbsoluteCoordinates(n, true /* ignore border */))
+    , isOffscreen(hasOffscreenRect(n))
+    , isOffscreenAfterScrolling(hasOffscreenRect(n, direction))
 {
 }
 
@@ -622,7 +624,7 @@ void distanceDataForNode(FocusDirection direction, FocusCandidate& current, Focu
 
 bool canBeScrolledIntoView(FocusDirection direction, const FocusCandidate& candidate)
 {
-    ASSERT(candidate.node && hasOffscreenRect(candidate.node));
+    ASSERT(candidate.node && candidate.isOffscreen);
     IntRect candidateRect = candidate.rect;
     for (Node* parentNode = candidate.node->parent(); parentNode; parentNode = parentNode->parent()) {
         IntRect parentRect = nodeRectInAbsoluteCoordinates(parentNode);
diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h
index 2700a9c..153d0ac 100644
--- a/WebCore/page/SpatialNavigation.h
+++ b/WebCore/page/SpatialNavigation.h
@@ -105,10 +105,12 @@ struct FocusCandidate {
         , parentDistance(maxDistance())
         , alignment(None)
         , parentAlignment(None)
+        , isOffscreen(true)
+        , isOffscreenAfterScrolling(true)
     {
     }
 
-    FocusCandidate(Node* n);
+    FocusCandidate(Node* n, FocusDirection);
     bool isNull() const { return !node; }
     bool inScrollableContainer() const { return node && enclosingScrollableBox; }
     Document* document() const { return node ? node->document() : 0; }
@@ -120,6 +122,8 @@ struct FocusCandidate {
     RectsAlignment alignment;
     RectsAlignment parentAlignment;
     IntRect rect;
+    bool isOffscreen;
+    bool isOffscreenAfterScrolling;
 };
 
 bool scrollInDirection(Frame*, FocusDirection);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list