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

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


The following commit has been merged in the debian/unstable branch:
commit 32c6661e5dfd04e33fc74d1f25a5e0fdff2bc574
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 16 00:45:11 2003 +0000

    	Fix for 3508807, positions/sizes wrong for text elts and multi-line elts for accessibility.
    
            Reviewed by john
    
            * khtml/rendering/render_inline.cpp:
            (RenderInline::absoluteRects):
            * khtml/rendering/render_inline.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::absoluteRects):
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_text.cpp:
            (RenderText::absoluteRects):
            * khtml/rendering/render_text.h:
            * kwq/KWQAccObject.mm:
            (boundingBoxRect):
            (-[KWQAccObject position]):
            (-[KWQAccObject size]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5802 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5fec647..4b51a7f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2003-12-15  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3508807, positions/sizes wrong for text elts and multi-line elts for accessibility.
+	
+        Reviewed by john
+
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::absoluteRects):
+        * khtml/rendering/render_inline.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::absoluteRects):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::absoluteRects):
+        * khtml/rendering/render_text.h:
+        * kwq/KWQAccObject.mm:
+        (boundingBoxRect):
+        (-[KWQAccObject position]):
+        (-[KWQAccObject size]):
+
 2003-12-15  Richard Williamson   <rjw at apple.com>
 
 	Return 0 if the view doesn't have a bridge.
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index 4471d20..6478b28 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -304,6 +304,24 @@ void RenderInline::paintObject(QPainter *p, int _x, int _y,
     }
 }
 
+void RenderInline::absoluteRects(QPtrList<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()));
+    
+    for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+        if (!curr->isText())
+            curr->absoluteRects(rects, _tx + curr->xPos(), _ty + curr->yPos());
+    
+    if (continuation())
+        continuation()->absoluteRects(rects, 
+                                      _tx - containingBlock()->xPos() + continuation()->xPos(),
+                                      _ty - containingBlock()->yPos() + continuation()->yPos());
+}
+
 #if APPLE_CHANGES
 void RenderInline::addFocusRingRects(QPainter *p, int _tx, int _ty)
 {
diff --git a/WebCore/khtml/rendering/render_inline.h b/WebCore/khtml/rendering/render_inline.h
index ac70483..fbba6a8 100644
--- a/WebCore/khtml/rendering/render_inline.h
+++ b/WebCore/khtml/rendering/render_inline.h
@@ -74,6 +74,8 @@ public:
     virtual int offsetLeft() const;
     virtual int offsetTop() const;
 
+    void absoluteRects(QPtrList<QRect>& rects, int _tx, int _ty);
+
 #ifdef APPLE_CHANGES
     virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);
     void paintFocusRing(QPainter *p, int tx, int ty);
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index e837b26..674bfb0 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -904,6 +904,23 @@ void RenderObject::paintBorder(QPainter *p, int _tx, int _ty, int w, int h, cons
     }
 }
 
+void RenderObject::absoluteRects(QPtrList<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()));
+        continuation()->absoluteRects(rects, 
+                                      _tx - xPos() + continuation()->containingBlock()->xPos(),
+                                      _ty - yPos() + continuation()->containingBlock()->yPos());
+    }
+    else
+        rects.append(new QRect(_tx, _ty, width(), height()));
+}
+
+#if APPLE_CHANGES
 void RenderObject::addFocusRingRects(QPainter *p, int _tx, int _ty)
 {
     // For blocks inside inlines, we go ahead and include margins so that we run right up to the
@@ -918,6 +935,7 @@ void RenderObject::addFocusRingRects(QPainter *p, int _tx, int _ty)
     else
         p->addFocusRingRect(_tx, _ty, width(), height());
 }
+#endif
 
 void RenderObject::paintOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style)
 {
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 2393b27..3a51cad 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -564,6 +564,8 @@ 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);
+
 #if APPLE_CHANGES
     virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);
 #endif
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 2538995..5bf7102 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -366,6 +366,15 @@ DOM::DOMStringImpl* RenderText::originalString() const
     return element() ? element()->string() : 0;
 }
 
+void RenderText::absoluteRects(QPtrList<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()));
+}
+
 InlineTextBox * RenderText::findNextInlineTextBox( int offset, int &pos )
 {
     // The text runs point to parts of the rendertext's str string
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index ff4eb03..de702fc 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -147,6 +147,8 @@ 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);
+
     // Return before, after (offset set to max), or inside the text, at @p offset
     virtual FindSelectionResult checkSelectionPointIgnoringContinuations
         (int _x, int _y, int _tx, int _ty, DOM::NodeImpl*& node, int & offset);
diff --git a/WebCore/kwq/KWQAccObject.mm b/WebCore/kwq/KWQAccObject.mm
index e303beb..97c81da 100644
--- a/WebCore/kwq/KWQAccObject.mm
+++ b/WebCore/kwq/KWQAccObject.mm
@@ -90,14 +90,20 @@ using khtml::RenderCanvas;
 -(HTMLAnchorElementImpl*)anchorElement
 {
     RenderObject* currRenderer;
-    for (currRenderer = m_renderer; 
-         currRenderer && (!currRenderer->element() || !currRenderer->element()->hasAnchor());
-         currRenderer = currRenderer->parent());
+    for (currRenderer = m_renderer; currRenderer && !currRenderer->element(); currRenderer = currRenderer->parent())
+        if (currRenderer->continuation())
+            return [currRenderer->document()->getOrCreateAccObjectCache()->accObject(currRenderer->continuation()) anchorElement];
     
-    if (!currRenderer)
+    if (!currRenderer || !currRenderer->element())
         return 0;
     
-    return static_cast<HTMLAnchorElementImpl*>(currRenderer->element());
+    NodeImpl* elt = currRenderer->element();
+    for ( ; elt; elt = elt->parentNode()) {
+        if (elt->hasAnchor())
+            return static_cast<HTMLAnchorElementImpl*>(elt);
+    }
+  
+    return 0;
 }
 
 -(KWQAccObject*)firstChild
@@ -271,15 +277,32 @@ using khtml::RenderCanvas;
     return nil;
 }
 
--(NSValue*)position
+static QRect boundingBoxRect(RenderObject* obj)
 {
-    int x = 0;
-    int y = 0;
-    if (m_renderer) {
-        m_renderer->absolutePosition(x, y);
-        y += m_renderer->height(); // The API wants the lower-left corner, not the upper-left.
+    QRect rect(0,0,0,0);
+    if (obj) {
+        if (obj->isInlineContinuation())
+            obj = obj->element()->renderer();
+        QPtrList<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);
+        }
     }
-    NSPoint point = NSMakePoint(x, y);
+    return rect;
+}
+
+-(NSValue*)position
+{
+    QRect rect = boundingBoxRect(m_renderer);
+    
+    // The Cocoa accessibility API wants the lower-left corner, not the upper-left, so we add in our height.
+    NSPoint point = NSMakePoint(rect.x(), rect.y() + rect.height());
     if (m_renderer && m_renderer->canvas() && m_renderer->canvas()->view()) {
         NSView* view = m_renderer->canvas()->view()->getDocumentView();
         point = [[view window] convertBaseToScreen: [view convertPoint: point toView:nil]];
@@ -289,12 +312,8 @@ using khtml::RenderCanvas;
 
 -(NSValue*)size
 {
-    long width = 0, height = 0;
-    if (m_renderer) {
-        width = m_renderer->width();
-        height = m_renderer->height();
-    }
-    return [NSValue valueWithSize: NSMakeSize(width, height)];
+    QRect rect = boundingBoxRect(m_renderer);
+    return [NSValue valueWithSize: NSMakeSize(rect.width(), rect.height())];
 }
 
 -(BOOL)accessibilityIsIgnored

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list