[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 07:32:14 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit e7e49d9d988aed18d19055ce516952ae6954353b
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 28 20:09:20 2003 +0000

            Reviewed by Ken.
    
            - fixed 3191163 -- hang in QPtrListIterator at www.phiffer.com
            - fixed 3183520 -- XML page has no vertical scrollbar
    
            The hang was due to an exponential algorithm in lowest/rightmostPosition.
            Fixed by making some simplifications to these functions, used only to determine the size
            of the entire web page. While doing that I cleared some things up that made the XML
            scroll bar problem go away too.
    
            Note that www.phiffer.com still does not render right.
    
            * khtml/rendering/render_block.cpp:
            (RenderBlock::lowestPosition): Since this is always called on the whole tree, don't worry
            about which parent deals with which child. Just make sure that every object is visited
            exactly once.
            (RenderBlock::rightmostPosition): Ditto.
            * khtml/rendering/render_html.cpp: (RenderHtml::layout): Use the result from calling
            lowestPosition on the root, since some floating/positioned objects hang off there, rather
            than here. This seems consistent with the long term approach of doing more work in the root
            and less in RenderHtml, since XML documents don't have a RenderHtml.
            * khtml/rendering/render_root.cpp:
            (RenderRoot::docHeight): Call lowestPosition() on self rather than on children. Now that
            I understand the method, it's clear this is the correct way to do things.
            (RenderRoot::docWidth): Ditto, but rightmostPosition().
    
    	- fixed 3211289 -- REGRESSION: nil-deref in bridgeForWidget
    
            Maciej may have some ideas about how to fix this even better, but this
            is better than just rolling his change out.
    
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::nextKeyViewForWidget): Added an assertion.
            (KWQKHTMLPart::bridgeForWidget): Handle case where node is 0 by returning 0.
            (KWQKHTMLPart::partForNode): Added an assertion.
            (KWQKHTMLPart::nodeForWidget): Handle case where eventFilterObject is 0 by returning 0.
            (KWQKHTMLPart::setDocumentFocus): Quietly do nothing if the node is 0.
            (KWQKHTMLPart::clearDocumentFocus): Quietly do nothing if the node is 0.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3957 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 5c4801a..cf0f2e4 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,44 @@
+2003-03-28  Darin Adler  <darin at apple.com>
+
+        Reviewed by Ken.
+
+        - fixed 3191163 -- hang in QPtrListIterator at www.phiffer.com
+        - fixed 3183520 -- XML page has no vertical scrollbar
+
+        The hang was due to an exponential algorithm in lowest/rightmostPosition.
+        Fixed by making some simplifications to these functions, used only to determine the size
+        of the entire web page. While doing that I cleared some things up that made the XML
+        scroll bar problem go away too.
+        
+        Note that www.phiffer.com still does not render right.
+
+        * khtml/rendering/render_block.cpp:
+        (RenderBlock::lowestPosition): Since this is always called on the whole tree, don't worry
+        about which parent deals with which child. Just make sure that every object is visited
+        exactly once.
+        (RenderBlock::rightmostPosition): Ditto.
+        * khtml/rendering/render_html.cpp: (RenderHtml::layout): Use the result from calling
+        lowestPosition on the root, since some floating/positioned objects hang off there, rather
+        than here. This seems consistent with the long term approach of doing more work in the root
+        and less in RenderHtml, since XML documents don't have a RenderHtml.
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::docHeight): Call lowestPosition() on self rather than on children. Now that
+        I understand the method, it's clear this is the correct way to do things.
+        (RenderRoot::docWidth): Ditto, but rightmostPosition().
+
+	- fixed 3211289 -- REGRESSION: nil-deref in bridgeForWidget
+
+        Maciej may have some ideas about how to fix this even better, but this
+        is better than just rolling his change out.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::nextKeyViewForWidget): Added an assertion.
+        (KWQKHTMLPart::bridgeForWidget): Handle case where node is 0 by returning 0.
+        (KWQKHTMLPart::partForNode): Added an assertion.
+        (KWQKHTMLPart::nodeForWidget): Handle case where eventFilterObject is 0 by returning 0.
+        (KWQKHTMLPart::setDocumentFocus): Quietly do nothing if the node is 0.
+        (KWQKHTMLPart::clearDocumentFocus): Quietly do nothing if the node is 0.
+
 2003-03-27  David Hyatt  <hyatt at apple.com>
 
 	A collection of fixes for tables.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5c4801a..cf0f2e4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,44 @@
+2003-03-28  Darin Adler  <darin at apple.com>
+
+        Reviewed by Ken.
+
+        - fixed 3191163 -- hang in QPtrListIterator at www.phiffer.com
+        - fixed 3183520 -- XML page has no vertical scrollbar
+
+        The hang was due to an exponential algorithm in lowest/rightmostPosition.
+        Fixed by making some simplifications to these functions, used only to determine the size
+        of the entire web page. While doing that I cleared some things up that made the XML
+        scroll bar problem go away too.
+        
+        Note that www.phiffer.com still does not render right.
+
+        * khtml/rendering/render_block.cpp:
+        (RenderBlock::lowestPosition): Since this is always called on the whole tree, don't worry
+        about which parent deals with which child. Just make sure that every object is visited
+        exactly once.
+        (RenderBlock::rightmostPosition): Ditto.
+        * khtml/rendering/render_html.cpp: (RenderHtml::layout): Use the result from calling
+        lowestPosition on the root, since some floating/positioned objects hang off there, rather
+        than here. This seems consistent with the long term approach of doing more work in the root
+        and less in RenderHtml, since XML documents don't have a RenderHtml.
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::docHeight): Call lowestPosition() on self rather than on children. Now that
+        I understand the method, it's clear this is the correct way to do things.
+        (RenderRoot::docWidth): Ditto, but rightmostPosition().
+
+	- fixed 3211289 -- REGRESSION: nil-deref in bridgeForWidget
+
+        Maciej may have some ideas about how to fix this even better, but this
+        is better than just rolling his change out.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::nextKeyViewForWidget): Added an assertion.
+        (KWQKHTMLPart::bridgeForWidget): Handle case where node is 0 by returning 0.
+        (KWQKHTMLPart::partForNode): Added an assertion.
+        (KWQKHTMLPart::nodeForWidget): Handle case where eventFilterObject is 0 by returning 0.
+        (KWQKHTMLPart::setDocumentFocus): Quietly do nothing if the node is 0.
+        (KWQKHTMLPart::clearDocumentFocus): Quietly do nothing if the node is 0.
+
 2003-03-27  David Hyatt  <hyatt at apple.com>
 
 	A collection of fixes for tables.
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 3e16436..9065de4 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -1472,31 +1472,37 @@ RenderBlock::floatBottom() const
 int
 RenderBlock::lowestPosition() const
 {
-    int bottom = RenderBox::lowestPosition();
-    //kdDebug(0) << renderName() << "("<<this<<") lowest = " << bottom << endl;
-    int lp = 0;
-    RenderObject *last = 0;
-    if ( !m_childrenInline ) {
-        last = lastChild();
-        while (last && last->isFloatingOrPositioned())
-            last = last->previousSibling();
-        if( last )
-            lp = last->yPos() + last->lowestPosition();
-    }
+    // We don't make any attempt to have this be correct for
+    // any single object, since this is only done for the entire
+    // render tree as a whole. Instead the focus is on visiting
+    // each object once. If we visit an object more than once,
+    // then this becomes an exponential algorithm.
+    
+    // FIXME: Maybe we can use m_overflowHeight instead?
 
-    if(  lp > bottom )
-        bottom = lp;
+    int bottom = RenderBox::lowestPosition();
 
-    //kdDebug(0) << "     bottom = " << bottom << endl;
+    // FIXME: Used to do nothing here in the m_childrenInline case,
+    // but that demonstrably didn't work (layout tests failed).
+    // FIXME: Is it still OK to look only at the last non-floating
+    // non-positioned child? Testing indicates it is, but is the concept
+    // 100% right?
+    for (RenderObject *c = lastChild(); c; c = c->previousSibling()) {
+        if (!c->isFloatingOrPositioned()) {
+            int lp = c->yPos() + c->lowestPosition();
+            bottom = QMAX(bottom, lp);
+            break;
+        }
+    }
 
     if (m_floatingObjects) {
         FloatingObject* r;
         QPtrListIterator<FloatingObject> it(*m_floatingObjects);
         for ( ; (r = it.current()); ++it ) {
-            lp = r->startY + r->node->lowestPosition();
-            //kdDebug(0) << r->node->renderName() << " lp = " << lp << "startY=" << r->startY << endl;
-            if( lp > bottom)
-                bottom = lp;
+            if (!r->noPaint) {
+                int lp = r->startY + r->node->lowestPosition();
+                bottom = QMAX(bottom, lp);
+            }
         }
     }
 
@@ -1504,47 +1510,41 @@ RenderBlock::lowestPosition() const
         RenderObject* r;
         QPtrListIterator<RenderObject> it(*m_positionedObjects);
         for ( ; (r = it.current()); ++it ) {
-            lp = r->yPos()+ r->lowestPosition();
-            if( lp > bottom)
-                bottom = lp;
-        }
-    }
-    
-    if ( overhangingContents() ) {
-        RenderObject *child = firstChild();
-        while( child ) {
-            if ( child != last && child->overhangingContents() ) {
-                int lp = child->yPos() + child->lowestPosition();
-                if ( lp > bottom ) bottom = lp;
-            }
-            child = child->nextSibling();
+            int lp = r->yPos() + r->lowestPosition();
+            bottom = QMAX(bottom, lp);
         }
     }
 
-    //kdDebug(0) << renderName() << "      bottom final = " << bottom << endl;
     return bottom;
 }
 
 int RenderBlock::rightmostPosition() const
 {
+    // We don't make any attempt to have this be correct for
+    // any single object, since this is only done for the entire
+    // render tree as a whole. Instead the focus is on visiting
+    // each object once. If we visit an object more than once,
+    // then this becomes an exponential algorithm.
+    
+    // FIXME: Maybe we can use m_overflowWidth instead?
+
     int right = RenderBox::rightmostPosition();
 
-    RenderObject *c;
-    for (c = firstChild(); c; c = c->nextSibling()) {
-        if (!c->isPositioned() && !c->isFloating()) {
-            int childRight = c->xPos() + c->rightmostPosition();
-            if (childRight > right)
-                right = childRight;
-        }
+    for (RenderObject *c = firstChild(); c; c = c->nextSibling()) {
+        if (!c->isFloatingOrPositioned()) {
+            int rp = c->xPos() + c->rightmostPosition();
+            right = QMAX(right, rp);
+	}
     }
 
     if (m_floatingObjects) {
         FloatingObject* r;
         QPtrListIterator<FloatingObject> it(*m_floatingObjects);
         for ( ; (r = it.current()); ++it ) {
-            int specialRight = r->left + r->node->rightmostPosition();
-            if (specialRight > right)
-                right = specialRight;
+            if (!r->noPaint) {
+                int rp = r->left + r->node->rightmostPosition();
+           	right = QMAX(right, rp);
+            }
         }
     }
 
@@ -1552,20 +1552,8 @@ int RenderBlock::rightmostPosition() const
         RenderObject* r;
         QPtrListIterator<RenderObject> it(*m_positionedObjects);
         for ( ; (r = it.current()); ++it ) {
-            int specialRight = r->xPos()+ r->rightmostPosition();
-            if (specialRight > right)
-                right = specialRight;
-        }
-    }
-    
-    if ( overhangingContents() ) {
-        RenderObject *child = firstChild();
-        while( child ) {
-            if ( (child->isPositioned() || child->isFloating()) && child->overhangingContents() ) {
-                int r = child->xPos() + child->rightmostPosition();
-                if ( r > right ) right = r;
-            }
-            child = child->nextSibling();
+            int rp = r->yPos() + r->rightmostPosition();
+            right = QMAX(right, rp);
         }
     }
 
diff --git a/WebCore/khtml/rendering/render_html.cpp b/WebCore/khtml/rendering/render_html.cpp
index 7892cbb..a76aa92 100644
--- a/WebCore/khtml/rendering/render_html.cpp
+++ b/WebCore/khtml/rendering/render_html.cpp
@@ -121,7 +121,8 @@ void RenderHtml::layout()
     RenderBlock::layout();
 
     //kdDebug(0) << renderName() << " height = " << m_height << endl;
-    int lp = lowestPosition();
+    RenderObject *r = root();
+    int lp = r ? r->lowestPosition() : lowestPosition();
     // margins of Html element can only be fixed, right?
     int margins  = style()->marginTop().isFixed() ? style()->marginTop().value : 0;
         margins += style()->marginBottom().isFixed() ? style()->marginBottom().value : 0;
diff --git a/WebCore/khtml/rendering/render_root.cpp b/WebCore/khtml/rendering/render_root.cpp
index 9cea269..e7a2b2c 100644
--- a/WebCore/khtml/rendering/render_root.cpp
+++ b/WebCore/khtml/rendering/render_root.cpp
@@ -593,18 +593,20 @@ int RenderRoot::docHeight() const
     else
         h = m_view->visibleHeight();
 
+    int lowestPos = lowestPosition();
+    if( lowestPos > h )
+        h = lowestPos;
+
     // FIXME: This doesn't do any margin collapsing.
     // Instead of this dh computation we should keep the result
     // when we call RenderBlock::layout.
     int dh = 0;
     for (RenderObject *c = firstChild(); c; c = c->nextSibling()) {
         dh += c->height() + c->marginTop() + c->marginBottom();
-        int lowestPos = c->lowestPosition();
-        if( lowestPos > h )
-            h = lowestPos;
     }
     if( dh > h )
         h = dh;
+
     return h;
 }
 
@@ -616,13 +618,14 @@ int RenderRoot::docWidth() const
     else
         w = m_view->visibleWidth();
 
+    int rightmostPos = rightmostPosition();
+    if( rightmostPos > w )
+        w = rightmostPos;
+
     for (RenderObject *c = firstChild(); c; c = c->nextSibling()) {
         int dw = c->width() + c->marginLeft() + c->marginRight();
         if( dw > w )
             w = dw;
-        int rightmostPos = c->rightmostPosition();
-        if( rightmostPos > w )
-            w = rightmostPos;
     }
     return w;
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 960296a..51fcea0 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -723,6 +723,7 @@ NSView *KWQKHTMLPart::nextKeyViewForWidget(QWidget *startingWidget, KWQSelection
     // Use the event filter object to figure out which RenderWidget owns this QWidget and get to the DOM.
     // Then get the next key view in the order determined by the DOM.
     NodeImpl *node = nodeForWidget(startingWidget);
+    ASSERT(node);
     return partForNode(node)->nextKeyView(node, direction);
 }
 
@@ -872,28 +873,42 @@ void KWQKHTMLPart::openURLFromPageCache(KWQPageState *state)
 
 WebCoreBridge *KWQKHTMLPart::bridgeForWidget(const QWidget *widget)
 {
-    return partForNode(nodeForWidget(widget))->bridge();
+    ASSERT_ARG(widget, widget);
+    NodeImpl *node = nodeForWidget(widget);
+    return node ? partForNode(node)->bridge() : 0;
 }
 
 KWQKHTMLPart *KWQKHTMLPart::partForNode(NodeImpl *node)
 {
+    ASSERT_ARG(node, node);
     return KWQ(node->getDocument()->view()->part());
 }
 
 NodeImpl *KWQKHTMLPart::nodeForWidget(const QWidget *widget)
 {
-    return static_cast<const RenderWidget *>(widget->eventFilterObject())->element();
+    ASSERT_ARG(widget, widget);
+    const QObject *o = widget->eventFilterObject();
+    return o ? static_cast<const RenderWidget *>(o)->element() : 0;
 }
 
 void KWQKHTMLPart::setDocumentFocus(QWidget *widget)
 {
     NodeImpl *node = nodeForWidget(widget);
-    node->getDocument()->setFocusNode(node);
+    if (node) {
+        node->getDocument()->setFocusNode(node);
+    } else {
+        ERROR("unable to clear focus because widget had no corresponding node");
+    }
 }
 
 void KWQKHTMLPart::clearDocumentFocus(QWidget *widget)
 {
-    nodeForWidget(widget)->getDocument()->setFocusNode(0);
+    NodeImpl *node = nodeForWidget(widget);
+    if (node) {
+    	node->getDocument()->setFocusNode(0);
+    } else {
+        ERROR("unable to clear focus because widget had no corresponding node");
+    }
 }
 
 void KWQKHTMLPart::saveDocumentState()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list