[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:19:50 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 62108aba6520f26b382b9dcffcc39c74bd76244d
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 17 23:48:54 2003 +0000

            Reviewed by Dave.
    
            - fixed 3469085: can't tab to all links on aintitcool.com
    
            * khtml/html/html_inlineimpl.cpp:
            (HTMLAnchorElementImpl::isFocusable): Re-implemented this to check width and height of
            all continuations, not just the main render object. Also, check the absoluteRects after
            checking all the render objects to catch things like floats.
            (HTMLAnchorElementImpl::isMouseFocusable): Clean up the code here a bit.
    
            * khtml/rendering/render_inline.h:
            * khtml/rendering/render_inline.cpp: (RenderInline::absoluteRects):
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_object.cpp: (RenderObject::absoluteRects):
            * khtml/rendering/render_text.h:
            * khtml/rendering/render_text.cpp: (RenderText::absoluteRects):
            * kwq/KWQAccObject.mm: (boundingBoxRect):
            Use QValueList instead of QPtrList for clarity and to fix storage leaks.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5e6c569..4b128d1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2003-12-17  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3469085: can't tab to all links on aintitcool.com
+
+        * khtml/html/html_inlineimpl.cpp:
+        (HTMLAnchorElementImpl::isFocusable): Re-implemented this to check width and height of
+        all continuations, not just the main render object. Also, check the absoluteRects after
+        checking all the render objects to catch things like floats.
+        (HTMLAnchorElementImpl::isMouseFocusable): Clean up the code here a bit.
+
+        * khtml/rendering/render_inline.h:
+        * khtml/rendering/render_inline.cpp: (RenderInline::absoluteRects):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_object.cpp: (RenderObject::absoluteRects):
+        * khtml/rendering/render_text.h:
+        * khtml/rendering/render_text.cpp: (RenderText::absoluteRects):
+        * kwq/KWQAccObject.mm: (boundingBoxRect):
+        Use QValueList instead of QPtrList for clarity and to fix storage leaks.
+
 === Safari-118 ===
 
 2003-12-16  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/khtml/html/html_inlineimpl.cpp b/WebCore/khtml/html/html_inlineimpl.cpp
index fc174f3..a8c2920 100644
--- a/WebCore/khtml/html/html_inlineimpl.cpp
+++ b/WebCore/khtml/html/html_inlineimpl.cpp
@@ -55,22 +55,37 @@ HTMLAnchorElementImpl::~HTMLAnchorElementImpl()
 
 bool HTMLAnchorElementImpl::isFocusable() const
 {
-    return m_hasAnchor && 
-        m_render && 
-        m_render->style() && m_render->style()->visibility() == VISIBLE &&
-        (m_render->width() > 0 && m_render->height() > 0) && 
-        (m_render->firstChild() || m_render->continuation());
+    // FIXME: Even if we are not visible, we might have a child that is visible.
+    // Dave wants to fix that some day with a "has visible content" flag or the like.
+    if (!(m_hasAnchor && m_render && m_render->style()->visibility() == VISIBLE))
+        return false;
+
+    // Before calling absoluteRects, check for the common case where the renderer
+    // or one of the continuations is non-empty, since this is a faster check and
+    // almost always returns true.
+    for (RenderObject *r = m_render; r; r = r->continuation()) {
+        if (r->width() > 0 && r->height() > 0)
+            return true;
+    }
+
+    QValueList<QRect> rects;
+    int x = 0, y = 0;
+    m_render->absolutePosition(x, y);
+    m_render->absoluteRects(rects, x, y);
+    for (QValueList<QRect>::ConstIterator it = rects.begin(); it != rects.end(); ++it) {
+        if ((*it).isValid())
+            return true;
+    }
+
+    return false;
 }
 
 bool HTMLAnchorElementImpl::isMouseFocusable() const
 {
-    if (!isFocusable())
-        return false;
-    
-#ifdef APPLE_CHANGES
-    return false; // FIXME: This behavior is being debated currently. We might want to make links be mouse focusable.
+#if APPLE_CHANGES
+    return false;
 #else
-    return true;
+    return isFocusable();
 #endif
 }
 
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index 6478b28..56984aa 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -304,13 +304,10 @@ void RenderInline::paintObject(QPainter *p, int _x, int _y,
     }
 }
 
-void RenderInline::absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty)
+void RenderInline::absoluteRects(QValueList<QRect>& rects, int _tx, int _ty)
 {
     for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
-        rects.append(new QRect(_tx + curr->xPos(), 
-                               _ty + curr->yPos(), 
-                               curr->width(), 
-                               curr->height()));
+        rects.append(QRect(_tx + curr->xPos(), _ty + curr->yPos(), curr->width(), curr->height()));
     
     for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
         if (!curr->isText())
diff --git a/WebCore/khtml/rendering/render_inline.h b/WebCore/khtml/rendering/render_inline.h
index fbba6a8..de55952 100644
--- a/WebCore/khtml/rendering/render_inline.h
+++ b/WebCore/khtml/rendering/render_inline.h
@@ -74,7 +74,7 @@ public:
     virtual int offsetLeft() const;
     virtual int offsetTop() const;
 
-    void absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty);
+    void absoluteRects(QValueList<QRect>& rects, int _tx, int _ty);
 
 #ifdef APPLE_CHANGES
     virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 0aa34b5..130eee2 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -904,20 +904,20 @@ void RenderObject::paintBorder(QPainter *p, int _tx, int _ty, int w, int h, cons
     }
 }
 
-void RenderObject::absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty)
+void RenderObject::absoluteRects(QValueList<QRect>& rects, int _tx, int _ty)
 {
     // For blocks inside inlines, we go ahead and include margins so that we run right up to the
     // inline boxes above and below us (thus getting merged with them to form a single irregular
     // shape).
     if (continuation()) {
-        rects.append(new QRect(_tx, _ty - collapsedMarginTop(), 
-                               width(), height()+collapsedMarginTop()+collapsedMarginBottom()));
+        rects.append(QRect(_tx, _ty - collapsedMarginTop(), 
+                           width(), height()+collapsedMarginTop()+collapsedMarginBottom()));
         continuation()->absoluteRects(rects, 
                                       _tx - xPos() + continuation()->containingBlock()->xPos(),
                                       _ty - yPos() + continuation()->containingBlock()->yPos());
     }
     else
-        rects.append(new QRect(_tx, _ty, width(), height()));
+        rects.append(QRect(_tx, _ty, width(), height()));
 }
 
 #if APPLE_CHANGES
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 3a51cad..021b11d 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -564,7 +564,7 @@ public:
     virtual int borderLeft() const { return style()->borderLeftWidth(); }
     virtual int borderRight() const { return style()->borderRightWidth(); }
 
-    virtual void absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty);
+    virtual void absoluteRects(QValueList<QRect>& rects, int _tx, int _ty);
 
 #if APPLE_CHANGES
     virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 5bf7102..8419ecb 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -366,13 +366,13 @@ DOM::DOMStringImpl* RenderText::originalString() const
     return element() ? element()->string() : 0;
 }
 
-void RenderText::absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty)
+void RenderText::absoluteRects(QValueList<QRect>& rects, int _tx, int _ty)
 {
     for (unsigned int i = 0; i < m_lines.count(); i++)
-        rects.append(new QRect(_tx + m_lines[i]->xPos(), 
-                               _ty + m_lines[i]->yPos(), 
-                               m_lines[i]->width(), 
-                               m_lines[i]->height()));
+        rects.append(QRect(_tx + m_lines[i]->xPos(), 
+                           _ty + m_lines[i]->yPos(), 
+                           m_lines[i]->width(), 
+                           m_lines[i]->height()));
 }
 
 InlineTextBox * RenderText::findNextInlineTextBox( int offset, int &pos )
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index de702fc..a670086 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -147,7 +147,7 @@ public:
     virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty,
                              HitTestAction hitTestAction = HitTestAll, bool inside=false);
 
-    virtual void absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty);
+    virtual void absoluteRects(QValueList<QRect>& rects, int _tx, int _ty);
 
     // Return before, after (offset set to max), or inside the text, at @p offset
     virtual FindSelectionResult checkSelectionPointIgnoringContinuations
diff --git a/WebCore/kwq/KWQAccObject.mm b/WebCore/kwq/KWQAccObject.mm
index 97c81da..27ee5f0 100644
--- a/WebCore/kwq/KWQAccObject.mm
+++ b/WebCore/kwq/KWQAccObject.mm
@@ -283,15 +283,18 @@ static QRect boundingBoxRect(RenderObject* obj)
     if (obj) {
         if (obj->isInlineContinuation())
             obj = obj->element()->renderer();
-        QPtrList<QRect> rects;
+        QValueList<QRect> rects;
         int x = 0, y = 0;
         obj->absolutePosition(x, y);
         obj->absoluteRects(rects, x, y);
-        for (QRect* curr = rects.first(); curr; curr = rects.next()) {
-            if (rect.isEmpty())
-                rect = *curr;
-            else if (!curr->isEmpty())
-                rect = rect.unite(*curr);
+        for (QValueList<QRect>::ConstIterator it = rects.begin(); it != rects.end(); ++it) {
+            QRect r = *it;
+            if (r.isValid()) {
+                if (rect.isEmpty())
+                    rect = r;
+                else
+                    rect.unite(r);
+            }
         }
     }
     return rect;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list