[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 07:16:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f3f98f68bd48908323e76f3a75195f11554dbcea
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 20 22:27:12 2002 +0000

    	Remove the clip hack from setLayout and make it
    	asynchronous instead.  This fixes the crasher
    	on autosite.com, which had a sync layout occur
    	while in the middle of making a block box's
    	children get wrapped in anonymous boxes.  It
    	was only half done when the layout got
    	triggered, which is what caused the assert to fire.
    
    	The bug # is 3129534.
    
            Reviewed by rjw
    
            * khtml/khtmlview.cpp:
            (KHTMLView::KHTMLView):
            (KHTMLView::timerEvent):
            (KHTMLView::scheduleRelayout):
            * khtml/khtmlview.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::setLayouted):
            (RenderObject::scheduleRelayout):
            * khtml/rendering/render_object.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3160 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c72f7f3..5f23317 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,29 @@
+2002-12-19  David Hyatt  <hyatt at apple.com>
+
+	Remove the clip hack from setLayout and make it
+	asynchronous instead.  This fixes the crasher
+	on autosite.com, which had a sync layout occur
+	while in the middle of making a block box's
+	children get wrapped in anonymous boxes.  It
+	was only half done when the layout got
+	triggered, which is what caused the assert to fire.
+
+	The bug # is 3129534.
+	
+        Reviewed by rjw
+
+        * khtml/khtmlview.cpp:
+        (KHTMLView::KHTMLView):
+        (KHTMLView::timerEvent):
+        (KHTMLView::scheduleRelayout):
+        * khtml/khtmlview.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::setLayouted):
+        (RenderObject::scheduleRelayout):
+        * khtml/rendering/render_object.h:
+
+=======
+=======
 2002-12-20  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c72f7f3..5f23317 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,29 @@
+2002-12-19  David Hyatt  <hyatt at apple.com>
+
+	Remove the clip hack from setLayout and make it
+	asynchronous instead.  This fixes the crasher
+	on autosite.com, which had a sync layout occur
+	while in the middle of making a block box's
+	children get wrapped in anonymous boxes.  It
+	was only half done when the layout got
+	triggered, which is what caused the assert to fire.
+
+	The bug # is 3129534.
+	
+        Reviewed by rjw
+
+        * khtml/khtmlview.cpp:
+        (KHTMLView::KHTMLView):
+        (KHTMLView::timerEvent):
+        (KHTMLView::scheduleRelayout):
+        * khtml/khtmlview.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::setLayouted):
+        (RenderObject::scheduleRelayout):
+        * khtml/rendering/render_object.h:
+
+=======
+=======
 2002-12-20  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 6b33566..838726b 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -205,6 +205,8 @@ KHTMLView::KHTMLView( KHTMLPart *part, QWidget *parent, const char *name)
 {
     m_medium = "screen";
 
+    m_layoutObject = 0;
+    
     m_part = part;
 #if APPLE_CHANGES
     m_part->ref();
@@ -1492,7 +1494,8 @@ void KHTMLView::timerEvent ( QTimerEvent *e )
         DOM::DocumentImpl *document = m_part->xmlDocImpl();
         khtml::RenderRoot* root = static_cast<khtml::RenderRoot *>(document->renderer());
         if (root){
-            if ( !root->layouted() ) {
+            // Do not allow a full layout if we had a clip object set.
+            if ( !root->layouted() && !m_layoutObject) {
                 killTimer(d->repaintTimerId);
                 d->repaintTimerId = 0;
                 //qDebug("not layouted, delaying repaint");
@@ -1505,17 +1508,47 @@ void KHTMLView::timerEvent ( QTimerEvent *e )
     setStaticBackground(d->useSlowRepaints);
 
 //        kdDebug() << "scheduled repaint "<< d->repaintTimerId  << endl;
-    killTimer(d->repaintTimerId);
+    // If we have an overflow:hidden object, we cache the current update rect and then
+    // clear the update rect, so that when we call repaint(), the union of the layout
+    // object's rect and the current update rect is just the layout object's' rect.
+    QRect oldUpdateRect = d->updateRect;
+    bool hasRepaintTimer = d->repaintTimerId;
+    if (m_layoutObject) {
+        d->updateRect = QRect();
+        m_layoutObject->repaint();
+    }
+    
+    // Now we paint.  This will be either a full paint or just the paint of a clipped
+    // object's area.
     updateContents( d->updateRect );
-
+    killTimer(d->repaintTimerId);
     d->repaintTimerId = 0;
+
+    if (m_layoutObject) {
+        // Restore the update rect, and if we had a repaint pending before the clipped
+        // object did its paint, go ahead and reschedule that paint to occur as soon
+        // as possible.
+        d->updateRect = oldUpdateRect;
+        if (hasRepaintTimer)
+            scheduleRepaint(d->updateRect.x(), d->updateRect.y(), d->updateRect.width(),
+                            d->updateRect.height());
+        m_layoutObject = 0;
+    }
 }
 
-void KHTMLView::scheduleRelayout()
+void KHTMLView::scheduleRelayout(khtml::RenderObject* clippedObj)
 {
-    if (!d->layoutSchedulingEnabled || d->timerId)
+    if (!d->layoutSchedulingEnabled)
+        return;
+        
+    if (m_layoutObject != clippedObj)
+        m_layoutObject = 0;
+    
+    if (d->timerId)
         return;
 
+    m_layoutObject = clippedObj;
+    
     bool parsing = false;
     if( m_part->xmlDocImpl() ) {
         parsing = m_part->xmlDocImpl()->parsing();
diff --git a/WebCore/khtml/khtmlview.h b/WebCore/khtml/khtmlview.h
index 163da7f..81f37dd 100644
--- a/WebCore/khtml/khtmlview.h
+++ b/WebCore/khtml/khtmlview.h
@@ -193,7 +193,7 @@ private:
 
     void resetCursor();
 
-    void scheduleRelayout();
+    void scheduleRelayout(khtml::RenderObject* clippedObj=0);
     void unscheduleRelayout();
 
     void scheduleRepaint(int x, int y, int w, int h);
@@ -245,6 +245,9 @@ private:
 
     void complete();
 
+    // Returns the clipped object we will repaint when we perform our scheduled layout.
+    khtml::RenderObject* layoutObject() { return m_layoutObject; }
+    
     // ------------------------------------- member variables ------------------------------------
  private:
     int _width;
@@ -257,6 +260,10 @@ private:
     KHTMLViewPrivate *d;
 
     QString m_medium;   // media type
+    
+    // An overflow: hidden clipped object.  If this is set, a scheduled layout will only repaint
+    // the object's clipped area, and it will not do a full repaint.
+    khtml::RenderObject* m_layoutObject;
 };
 
 #endif
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 1975ba4..8c5c9a4 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -271,13 +271,6 @@ RenderObject* RenderObject::offsetParent() const
     return curr;
 }
 
-// This function now contains a rather unsavory hack.  If an attempt is made to
-// setLayout(false) an object inside a clipped (overflow:hidden) object, we just
-// lay that object out immediately and then repaint only the clipped rectangle.
-// scheduleRelayout always causes a full repaint, so we have to avoid it.  This
-// is gross, and we want to fix scheduleRelayout not to always do a full repaint
-// in the future. -dwh
-static RenderObject* gClipObject = 0;
 void RenderObject::setLayouted(bool b) 
 {
     m_layouted = b;
@@ -292,45 +285,25 @@ void RenderObject::setLayouted(bool b)
     else {
         RenderObject *o = m_parent;
         RenderObject *root = this;
-        bool rootAlreadyNeedsLayout = false;
         
+        // If an attempt is made to
+        // setLayouted(false) an object inside a clipped (overflow:hidden) object, we 
+        // have to make sure to repaint only the clipped rectangle.
+        // We do this by passing an argument to scheduleRelayout.  This hint really
+        // shouldn't be needed, and it's unfortunate that it is necessary.  -dwh
+
         RenderObject* clippedObj = 
             (style()->overflow() == OHIDDEN && !isText()) ? this : 0;
         
-        if (clippedObj) {
-            // Update our hack for positioned objects.  It doesn't work because
-            // this can be called from setStyle.  This whole clip hack is evil and must die. -dwh
-            bool positioned = style()->position() == ABSOLUTE || 
-                            style()->position() == FIXED;
-            bool relpositioned  = style()->position() == RELATIVE;
-            if (positioned && !isPositioned()) {
-                setPositioned(true);
-                setInline(false);
-            }
-            else if (relpositioned && !isRelPositioned())
-                setRelPositioned(true);
-        }
-        
         while( o ) {
             root = o;
-            rootAlreadyNeedsLayout = !o->m_layouted;
             o->m_layouted = false;
             if (o->style()->overflow() == OHIDDEN && !clippedObj)
                 clippedObj = o;
             o = o->m_parent;
         }
         
-        if (!gClipObject) {
-            if (clippedObj && !rootAlreadyNeedsLayout) {
-                gClipObject = clippedObj;
-                root->layout();
-                clippedObj->repaint();
-                gClipObject = 0;
-                m_layouted = true;
-            }
-            else
-                root->scheduleRelayout();
-        }
+        root->scheduleRelayout(clippedObj);
     }
 }
     
@@ -983,6 +956,14 @@ RenderArena* RenderObject::renderArena() {
 
 void RenderObject::detach(RenderArena* renderArena)
 {
+    // If we're an overflow:hidden object that currently needs layout, we need
+    // to make sure the view isn't holding on to us.
+    if (!layouted() && style()->overflow() == OHIDDEN) {
+        RenderRoot* r = root();
+        if (r && r->view()->layoutObject() == this)
+            r->view()->unscheduleRelayout();
+    }
+    
     remove();
     
     m_next = m_previous = 0;
@@ -1289,12 +1270,12 @@ void RenderObject::recalcMinMaxWidths()
     m_recalcMinMax = false;
 }
 
-void RenderObject::scheduleRelayout()
+void RenderObject::scheduleRelayout(RenderObject* clippedObj)
 {
     if (!isRoot()) return;
     KHTMLView *view = static_cast<RenderRoot *>(this)->view();
     if ( view )
-        view->scheduleRelayout();
+        view->scheduleRelayout(clippedObj);
 }
 
 
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 91d35bc..2751f0e 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -236,7 +236,7 @@ public:
     void setReplaced(bool b=true) { m_replaced = b; }
     void setIsSelectionBorder(bool b=true) { m_isSelectionBorder = b; }
 
-    void scheduleRelayout();
+    void scheduleRelayout(RenderObject* clippedObj = 0);
 
     // for discussion of lineHeight see CSS2 spec
     virtual short lineHeight( bool firstLine ) const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list