[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:12:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7133ed224479b615d55e67299544d0615c5d17ed
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 7 02:21:45 2002 +0000

    	Sigh. I forgot to commit the first layer fix (that has already
    	been reviewed), so now this is also including that.
    
    	The first layer fix was to deal with the yale.edu crasher.
    	It involved making sure that append/remove of render object
    	trees drill down into those trees to remove/append corresponding
    	layers (instead of just checking the root of the trees).
    
    	The second fix involves making sure that cliprects are right
    	for painting backgrounds and borders of clipped objects.
    	Fixes benoit's bug.
    
            Reviewed by: mjs and darin (fix 1), mjs and gramps (fix 2)
    
            * khtml/rendering/render_container.cpp:
            (RenderContainer::removeChildNode):
            (RenderContainer::appendChildNode):
            (RenderContainer::insertChildNode):
            * khtml/rendering/render_container.h:
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::paint):
            (RenderLayer::constructZTree):
            * khtml/rendering/render_layer.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::appendLayers):
            (RenderObject::removeLayers):
            (RenderObject::enclosingLayer):
            * khtml/rendering/render_object.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2965 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 85b54d4..e432cff 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,34 @@
+2002-12-06  David Hyatt  <hyatt at apple.com>
+
+	Sigh. I forgot to commit the first layer fix (that has already
+	been reviewed), so now this is also including that.
+
+	The first layer fix was to deal with the yale.edu crasher.
+	It involved making sure that append/remove of render object
+	trees drill down into those trees to remove/append corresponding
+	layers (instead of just checking the root of the trees).
+
+	The second fix involves making sure that cliprects are right
+	for painting backgrounds and borders of clipped objects.
+	Fixes benoit's bug.
+	
+        Reviewed by: mjs and darin (fix 1), mjs and gramps (fix 2)
+
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChildNode):
+        (RenderContainer::appendChildNode):
+        (RenderContainer::insertChildNode):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::constructZTree):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::appendLayers):
+        (RenderObject::removeLayers):
+        (RenderObject::enclosingLayer):
+        * khtml/rendering/render_object.h:
+
 2002-12-06  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by: Darin
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 85b54d4..e432cff 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,34 @@
+2002-12-06  David Hyatt  <hyatt at apple.com>
+
+	Sigh. I forgot to commit the first layer fix (that has already
+	been reviewed), so now this is also including that.
+
+	The first layer fix was to deal with the yale.edu crasher.
+	It involved making sure that append/remove of render object
+	trees drill down into those trees to remove/append corresponding
+	layers (instead of just checking the root of the trees).
+
+	The second fix involves making sure that cliprects are right
+	for painting backgrounds and borders of clipped objects.
+	Fixes benoit's bug.
+	
+        Reviewed by: mjs and darin (fix 1), mjs and gramps (fix 2)
+
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChildNode):
+        (RenderContainer::appendChildNode):
+        (RenderContainer::insertChildNode):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::constructZTree):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::appendLayers):
+        (RenderObject::removeLayers):
+        (RenderObject::enclosingLayer):
+        * khtml/rendering/render_object.h:
+
 2002-12-06  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by: Darin
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 9492113..f3b93f6 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -147,8 +147,7 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
     KHTMLAssert(oldChild->parent() == this);
 
     // Keep our layer hierarchy updated.
-    if (oldChild->layer())
-        enclosingLayer()->removeChild(oldChild->layer());
+    oldChild->removeLayers(enclosingLayer());
    
     // if oldChild is the start or end of the selection, then clear the selection to
     // avoid problems of invalid pointers
@@ -256,9 +255,8 @@ void RenderContainer::appendChildNode(RenderObject* newChild)
     setLastChild(newChild);
     
     // Keep our layer hierarchy updated.
-    if (newChild->layer())
-        enclosingLayer()->addChild(newChild->layer());
-        
+    newChild->appendLayers(enclosingLayer());
+         
     newChild->setMinMaxKnown( false );
     newChild->setLayouted( false );
 }
@@ -288,10 +286,9 @@ void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeC
     
     // Keep our layer hierarchy updated.
     // XXX Need this to do an insertion and really find the right place to
-    // put the new layer. -dwh
-    if (child->layer())
-        enclosingLayer()->addChild(child->layer());
-       
+    // put the new layer. Not a big deal though. -dwh
+    child->appendLayers(enclosingLayer());
+           
     child->setMinMaxKnown( false );
     child->setLayouted( false );
 }
diff --git a/WebCore/khtml/rendering/render_container.h b/WebCore/khtml/rendering/render_container.h
index 68eb913..0fbf19b 100644
--- a/WebCore/khtml/rendering/render_container.h
+++ b/WebCore/khtml/rendering/render_container.h
@@ -53,15 +53,6 @@ public:
     virtual void calcMinMaxWidth() { setMinMaxKnown( true ); }
 
     virtual void removeLeftoverAnonymousBoxes();
-
-    virtual RenderLayer* enclosingLayer() {
-        RenderObject* curr = this;
-        while (curr) {
-            if (curr->layer()) return curr->layer();
-            curr = curr->parent();
-        }
-        return 0;
-    }
     
 private:
 
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index bf035ce..49d76af 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -196,19 +196,47 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h)
         // position after you call into it). -dwh
         //printf("Painting layer at %d %d\n", elt->absBounds.x(), elt->absBounds.y());
     
+        if (elt->clipOriginator) {
+            // We originated a clip (we're either positioned or an element with
+            // overflow: hidden).  We need to paint our background and border, subject
+            // to clip regions established by our parent layers.
+            if (elt->backgroundClipRect != currRect) {
+                if (currRect != paintRect)
+                    p->restore(); // Pop the clip.
+                    
+                currRect = elt->backgroundClipRect;
+                
+                // Now apply the clip rect.
+                QRect clippedRect = p->xForm(currRect);
+#if APPLE_CHANGES
+                p->save();
+                p->addClip(clippedRect);
+#else
+                QRegion creg(cr);
+                QRegion old = p->clipRegion();
+                if (!old.isNull())
+                    creg = old.intersect(creg);
+            
+                p->save();
+                p->setClipRegion(creg);
+#endif
+            }
+            
+            // A clip is in effect.  The clip is never allowed to clip our render object's
+            // background or borders.  Go ahead and draw those now without our clip (that will
+            // be used for our children) in effect.
+            elt->layer->renderer()->paintBoxDecorations(p, x, y, w, h,
+                                elt->absBounds.x(),
+                                elt->absBounds.y());
+        }
+        
         if (elt->clipRect != currRect) {
             if (currRect != paintRect)
                 p->restore(); // Pop the clip.
-                
+            
             currRect = elt->clipRect;
             if (currRect != paintRect) {
-                // A clip is in effect.  The clip is never allowed to clip our render object's
-                // background or borders.  Go ahead and draw those now without the clip in
-                // effect.
-                elt->layer->renderer()->paintBoxDecorations(p, x, y, w, h,
-                                      elt->absBounds.x(),
-                                      elt->absBounds.y());
-                
+                                
                 // Now apply the clip rect.
                 QRect clippedRect = p->xForm(currRect);
 #if APPLE_CHANGES
@@ -315,15 +343,21 @@ RenderLayer::constructZTree(QRect damageRect,
 
     // If we establish a clip rect, then we want to intersect that rect
     // with the damage rect to form a new damage rect.
+    bool clipOriginator = false;
+    QRect clipRect = damageRect;
     if (m_object->style()->overflow() == OHIDDEN || m_object->style()->hasClip()) {
-        QRect clipRect = m_object->getClipRect(x, y);
-        if ((eventProcessing && !clipRect.contains(damageRect.x(),
-                                                  damageRect.y())) ||
-            (!eventProcessing && !clipRect.intersects(damageRect)))
+        clipOriginator = true;
+        QRect backgroundRect(x,y,m_object->width(), m_object->height());
+        clipRect = m_object->getClipRect(x, y);
+        if ((eventProcessing && !backgroundRect.contains(damageRect.x(),
+                                                         damageRect.y())) ||
+            (!eventProcessing && !backgroundRect.intersects(damageRect)))
             return 0; // We don't overlap at all.
 
-	if (!eventProcessing)
-	  damageRect = damageRect.intersect(clipRect);
+        if (!eventProcessing) {
+            damageRect = damageRect.intersect(backgroundRect);
+            clipRect = damageRect.intersect(clipRect);
+        }
     }
     
     // Walk our list of child layers looking only for those layers that have a 
@@ -333,7 +367,7 @@ RenderLayer::constructZTree(QRect damageRect,
         if (child->zIndex() < 0)
             continue; // Ignore negative z-indices in this first pass.
 
-        RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, eventProcessing);
+        RenderZTreeNode* childNode = child->constructZTree(clipRect, rootLayer, eventProcessing);
         if (childNode) {
             // Put the new node into the tree at the front of the parent's list.
             if (lastChildNode)
@@ -356,7 +390,7 @@ RenderLayer::constructZTree(QRect damageRect,
 						 damageRect.y())) ||
         (!eventProcessing && layerBounds.intersects(damageRect))) {
         RenderLayerElement* layerElt = new (renderArena) RenderLayerElement(this, layerBounds, 
-                                                              damageRect, x, y);
+                                                              damageRect, clipRect, clipOriginator, x, y);
         if (returnNode->child) {
             RenderZTreeNode* leaf = new (renderArena) RenderZTreeNode(layerElt);
             leaf->next = returnNode->child;
@@ -377,7 +411,7 @@ RenderLayer::constructZTree(QRect damageRect,
         if (child->zIndex() >= 0)
             continue; // Ignore non-negative z-indices in this second pass.
 
-        RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, eventProcessing);
+        RenderZTreeNode* childNode = child->constructZTree(clipRect, rootLayer, eventProcessing);
         if (childNode) {
             // Deal with the case where all our children views had negative z-indices.
             // Demote our leaf node and make a new interior node that can hold these
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index be88cc8..6b01181 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -136,16 +136,20 @@ public:
     struct RenderLayerElement {
       RenderLayer* layer;
       QRect absBounds; // Our bounds in absolute coordinates relative to the root.
-      QRect clipRect; // Our clip rect.
+      QRect backgroundClipRect; // Clip rect used for our background/borders. 
+      QRect clipRect; // Clip rect used for our children.
       int zindex; // Temporary z-index used for processing and sorting.
-      bool zauto; // Whether or not we are using auto z-indexing.
+      bool zauto : 1; // Whether or not we are using auto z-indexing.
+      bool clipOriginator : 1; // Whether or not we established a clip.
       int x; // The coords relative to the layer that will be using this list
              // to paint.
       int y;
 
-      RenderLayerElement(RenderLayer* l, const QRect& rect, const QRect& clip, int xpos, int ypos)
-          :layer(l), absBounds(rect), clipRect(clip), zindex(l->zIndex()), zauto(l->hasAutoZIndex()),
-          x(xpos), y(ypos) {}
+      RenderLayerElement(RenderLayer* l, const QRect& rect, const QRect& bgclip, 
+                         const QRect& clip, bool clipOrig, int xpos, int ypos)
+          :layer(l), absBounds(rect), backgroundClipRect(bgclip), clipRect(clip), 
+           zindex(l->zIndex()), zauto(l->hasAutoZIndex()), clipOriginator(clipOrig),
+           x(xpos), y(ypos) {}
           
       void detach(RenderArena* renderArena);
     
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 22dd588..1eba145 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -170,6 +170,44 @@ void RenderObject::insertChildNode(RenderObject*, RenderObject*)
     KHTMLAssert(0);
 }
 
+void RenderObject::appendLayers(RenderLayer* parentLayer)
+{
+    if (!parentLayer)
+        return;
+    
+    if (layer()) {
+        parentLayer->addChild(layer());
+        return;
+    }
+
+    for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+        curr->appendLayers(parentLayer);
+}
+
+void RenderObject::removeLayers(RenderLayer* parentLayer)
+{
+    if (!parentLayer)
+        return;
+    
+    if (layer()) {
+        parentLayer->removeChild(layer());
+        return;
+    }
+
+    for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+        curr->removeLayers(parentLayer);
+}
+
+RenderLayer* RenderObject::enclosingLayer()
+{
+    RenderObject* curr = this;
+    while (curr) {
+        if (curr->layer()) return curr->layer();
+        curr = curr->parent();
+    }
+    return 0;
+}
+
 int RenderObject::offsetLeft() const
 {
     int x = xPos();
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 2c8f61e..b448329 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -102,7 +102,9 @@ public:
     virtual RenderObject *lastChild() const { return 0; }
 
     virtual RenderLayer* layer() const { return 0; }
-    virtual RenderLayer* enclosingLayer() { return 0; }
+    RenderLayer* enclosingLayer();
+    void appendLayers(RenderLayer* parentLayer);
+    void removeLayers(RenderLayer* parentLayer);
     virtual void setHasChildLayers(bool hasLayers) { }
     virtual void positionChildLayers() { }
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list