[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

tonikitoo at webkit.org tonikitoo at webkit.org
Thu Apr 8 02:23:36 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 4d0624cd978ee7b14b78500555f896a081b40466
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 16 13:32:10 2010 +0000

    Spatial Navigation: Add a scrollIntoView call when focusing an element.
    https://bugs.webkit.org/show_bug.cgi?id=36020
    
    Reviewed by Simon Fraser.
    Patch by Antonio Gomes <tonikitoo at webkit.org>
    
    WebCore:
    
    When focusing an element in Spatial Navigation logic, it is desired to make
    this element visible in the current viewport. For that to happen, there
    could be a call to Element's scrollIntoView method at focusing time. However
    for visual aspects, it is preferable to scroll to an inflated rect of |element|
    in order to consider the focus outline width.
    As Element's scrollIntoView method does not provide this flexibility, patch adds
    a custom scrollIntoView method to SpatialNavigation.h .
    
    * page/FocusController.cpp:
    (WebCore::FocusController::advanceFocusDirectionally):
    * page/SpatialNavigation.cpp:
    (WebCore::scrollIntoView):
    * page/SpatialNavigation.h:
    
    LayoutTests:
    
    * platform/gtk/Skipped: Unskip snav-iframe-with-offscreen-element.html
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56057 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 17c9744..e1fad62 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-11  Antonio Gomes  <tonikitoo at webkit.org>
+
+        Reviewed by Simon Fraser.
+        Patch by Antonio Gomes <tonikitoo at webkit.org>
+
+        Spatial Navigation: Add a scrollIntoView call when focusing an element.
+        https://bugs.webkit.org/show_bug.cgi?id=36020
+
+        * platform/gtk/Skipped: Unskip snav-iframe-with-offscreen-element.html
+
 2010-03-16  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         [GStreamer] media/video-played-collapse.html
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 67a7913..72da317 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5832,10 +5832,6 @@ fast/events/continuous-platform-wheelevent-in-scrolling-div.html
 fast/dom/HTMLProgressElement/progress-element.html
 fast/dom/HTMLProgressElement/set-progress-properties.html
 
-# For some reason it fails on DRT, although works on GtkLauncher and other ports' DRT.
-# https://bugs.webkit.org/show_bug.cgi?id=35984
-fast/events/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html
-
 # Needs mock support, and build slave Geolocation service
 # See https://bugs.webkit.org/show_bug.cgi?id=36053
 fast/dom/Geolocation/maximum-age.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8f511ad..0f537ce 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-03-12  Antonio Gomes  <tonikitoo at webkit.org>
+
+        Reviewed by Simon Fraser.
+        Patch by Antonio Gomes <tonikitoo at webkit.org>
+
+        Spatial Navigation: Add a scrollIntoView call when focusing an element.
+        https://bugs.webkit.org/show_bug.cgi?id=36020
+
+        When focusing an element in Spatial Navigation logic, it is desired to make
+        this element visible in the current viewport. For that to happen, there
+        could be a call to Element's scrollIntoView method at focusing time. However
+        for visual aspects, it is preferable to scroll to an inflated rect of |element|
+        in order to consider the focus outline width.
+        As Element's scrollIntoView method does not provide this flexibility, patch adds
+        a custom scrollIntoView method to SpatialNavigation.h .
+
+        * page/FocusController.cpp:
+        (WebCore::FocusController::advanceFocusDirectionally):
+        * page/SpatialNavigation.cpp:
+        (WebCore::scrollIntoView):
+        * page/SpatialNavigation.h:
+
 2010-03-10  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index 7b0430f..920e8b3 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -333,7 +333,11 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa
     if (newDocument)
         setFocusedFrame(newDocument->frame());
 
-    static_cast<Element*>(node)->focus(false);
+    Element* element = static_cast<Element*>(node);
+    ASSERT(element);
+
+    scrollIntoView(element);
+    element->focus(false);
     return true;
 }
 
diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp
index 6b34aab..bfd9411 100644
--- a/WebCore/page/SpatialNavigation.cpp
+++ b/WebCore/page/SpatialNavigation.cpp
@@ -465,6 +465,18 @@ bool scrollInDirection(Frame* frame, FocusDirection direction)
     return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine);
 }
 
+void scrollIntoView(Element* element)
+{
+    // NOTE: Element's scrollIntoView method could had been used here, but
+    // it is preferable to inflate |element|'s bounding rect a bit before
+    // scrolling it for accurate reason.
+    // Element's scrollIntoView method does not provide this flexibility.
+    static const int fudgeFactor = 2;
+    IntRect bounds = element->getRect();
+    bounds.inflate(fudgeFactor);
+    element->renderer()->enclosingLayer()->scrollRectToVisible(bounds);
+}
+
 bool isInRootDocument(Node* node)
 {
     if (!node)
diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h
index 3a73d29..d54554d 100644
--- a/WebCore/page/SpatialNavigation.h
+++ b/WebCore/page/SpatialNavigation.h
@@ -27,6 +27,7 @@
 
 namespace WebCore {
 
+class Element;
 class Frame;
 class IntRect;
 class Node;
@@ -106,6 +107,7 @@ struct FocusCandidate {
 
 long long distanceInDirection(Node*, Node*, FocusDirection, FocusCandidate&);
 bool scrollInDirection(Frame*, FocusDirection);
+void scrollIntoView(Element*);
 bool hasOffscreenRect(Node*);
 bool isInRootDocument(Node*);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list