Fixed: <rdar://problem/3992803> Cannot navigate through list items with the keyboard...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2005 01:22:40 +0000 (01:22 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2005 01:22:40 +0000 (01:22 +0000)
        Reviewed by harrison.

        * khtml/rendering/render_line.cpp:
        (khtml::RootInlineBox::closestLeafChildForXPos): avoid returning list markers when possible. Also improved heuristic for returning the best InlineBox given the passed X position.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8767 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_line.cpp

index 543b759657bb6c21f132141add41a37500a22611..bf249106cb5941fa2a719c4e78cb4905a6cf2231 100644 (file)
@@ -1,3 +1,13 @@
+2005-03-03  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3992803> Cannot navigate through list items with the keyboard, you're stuck in the same <li> block unless you click out
+
+        Reviewed by harrison.
+
+        * khtml/rendering/render_line.cpp:
+        (khtml::RootInlineBox::closestLeafChildForXPos): avoid returning list markers when possible. Also improved heuristic for returning the best InlineBox given the passed X position.
+
+
 2005-03-03  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by John
index 492afee4e5011b28ce69ac2922554f6e049039d2..ed03c231660fa4abc9b4d54aecebce4319eee484 100644 (file)
@@ -1287,22 +1287,30 @@ RenderBlock* RootInlineBox::block() const
 InlineBox* RootInlineBox::closestLeafChildForXPos(int _x, int _tx)
 {
     InlineBox *firstLeaf = firstLeafChildAfterBox();
-    if (_x <= _tx + firstLeaf->m_x)
+    InlineBox *lastLeaf = lastLeafChildBeforeBox();
+    if (firstLeaf == lastLeaf)
+        return firstLeaf;
+    
+    // Avoid returning a list marker when possible.
+    if (_x <= _tx + firstLeaf->m_x && !firstLeaf->object()->isListMarker())
         // The x coordinate is less or equal to left edge of the firstLeaf.
         // Return it.
         return firstLeaf;
-
-    InlineBox *lastLeaf = lastLeafChildBeforeBox();
-    if (_x >= _tx + lastLeaf->m_x + lastLeaf->m_width)
+    
+    if (_x >= _tx + lastLeaf->m_x + lastLeaf->m_width && !lastLeaf->object()->isListMarker())
         // The x coordinate is greater or equal to right edge of the lastLeaf.
         // Return it.
         return lastLeaf;
 
-    for (InlineBox *box = firstLeaf; box && box != lastLeaf; box = box->nextLeafChild()) {
-        if (_x >= _tx + box->m_x)
-            // The x coordinate is greater or equal to left edge of the box's start.
-            // Return it.
-            return box;
+    for (InlineBox *leaf = firstLeaf; leaf && leaf != lastLeaf; leaf = leaf->nextLeafChild()) {
+        if (!leaf->object()->isListMarker()) {
+            int leafX = _tx + leaf->m_x;
+            assert(_x >= leafX);
+            if (_x < leafX + leaf->m_width)
+                // The x coordinate is greater or equal to left edge of the box's start.
+                // Return it.
+                return leaf;
+        }
     }
 
     return lastLeaf;