[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:40:45 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 54fccbc7899c0374ed17710f9df65ce1a48c2e43
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue May 6 22:26:07 2003 +0000

    	Make negative z-index content paint above the background of
    	the stacking context element that encloses it.  This fixes
    	gettyimages.com and hotwired.com.
    
            Reviewed by kocienda
    
            * khtml/css/html4.css:
            * khtml/rendering/render_block.cpp:
            * khtml/rendering/render_inline.cpp:
            (RenderInline::paintObject):
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::paint):
            (RenderLayer::nodeAtPoint):
            (RenderLayer::RenderZTreeNode::constructLayerList):
            * khtml/rendering/render_layer.h:
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_root.cpp:
            * khtml/rendering/render_table.cpp:
            (RenderTable::paint):
            * kwq/KWQRenderTreeDebug.cpp:
            (write):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4294 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 14bad15..e5aa99c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,27 @@
+2003-05-06  David Hyatt  <hyatt at apple.com>
+
+	Make negative z-index content paint above the background of
+	the stacking context element that encloses it.  This fixes
+	gettyimages.com and hotwired.com.
+	
+        Reviewed by kocienda
+
+        * khtml/css/html4.css:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::paintObject):
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::nodeAtPoint):
+        (RenderLayer::RenderZTreeNode::constructLayerList):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_root.cpp:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        * kwq/KWQRenderTreeDebug.cpp:
+        (write):
+
 2003-05-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 14bad15..e5aa99c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,27 @@
+2003-05-06  David Hyatt  <hyatt at apple.com>
+
+	Make negative z-index content paint above the background of
+	the stacking context element that encloses it.  This fixes
+	gettyimages.com and hotwired.com.
+	
+        Reviewed by kocienda
+
+        * khtml/css/html4.css:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::paintObject):
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::nodeAtPoint):
+        (RenderLayer::RenderZTreeNode::constructLayerList):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_root.cpp:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        * kwq/KWQRenderTreeDebug.cpp:
+        (write):
+
 2003-05-06  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Darin.
diff --git a/WebCore/khtml/css/html4.css b/WebCore/khtml/css/html4.css
index eaa36a8..06dc980 100644
--- a/WebCore/khtml/css/html4.css
+++ b/WebCore/khtml/css/html4.css
@@ -7,6 +7,11 @@
  * what you are doing.
  */
 
+/* The root element establishes its own stacking context. */
+:root {
+    z-index: 0
+}
+
 html {
 	display: block;
 } 
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index b373fbc..4030bed 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -1073,9 +1073,19 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
     bool inlineFlow = isInlineFlow();
     
     // 1. paint background, borders etc
-    if (!inlineFlow && paintAction == PaintActionBackground &&
-        shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE )
+    if (!inlineFlow &&
+        (paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground) &&
+        shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE) {
         paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    }
+
+    // We're done.  We don't bother painting any children.
+    if (paintAction == PaintActionElementBackground)
+        return;
+    // We don't paint our own background, but we do let the kids paint their backgrounds.
+    if (paintAction == PaintActionChildBackgrounds)
+        paintAction = PaintActionChildBackground;
+    
     paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
 
     // 2. paint contents
@@ -1097,7 +1107,7 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
         paintFloats(p, _x, _y, _w, _h, scrolledX, scrolledY, paintAction == PaintActionSelection);
 
     // 4. paint outline.
-    if (!inlineFlow && paintAction == PaintActionBackground &&
+    if (!inlineFlow && paintAction == PaintActionForeground &&
         !childrenInline() && style()->outlineWidth())
         paintOutline(p, _tx, _ty, width(), height(), style());
 
@@ -1134,7 +1144,11 @@ void RenderBlock::paintFloats(QPainter *p, int _x, int _y,
                 r->node->paint(p, _x, _y, _w, _h,
                                _tx + r->left - r->node->xPos() + r->node->marginLeft(),
                                _ty + r->startY - r->node->yPos() + r->node->marginTop(),
-                               PaintActionBackground);
+                               PaintActionElementBackground);
+                r->node->paint(p, _x, _y, _w, _h,
+                               _tx + r->left - r->node->xPos() + r->node->marginLeft(),
+                               _ty + r->startY - r->node->yPos() + r->node->marginTop(),
+                               PaintActionChildBackgrounds);
                 r->node->paint(p, _x, _y, _w, _h,
                                _tx + r->left - r->node->xPos() + r->node->marginLeft(),
                                _ty + r->startY - r->node->yPos() + r->node->marginTop(),
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index 2533c8a..a80b8b3 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -259,6 +259,13 @@ void RenderInline::paintObject(QPainter *p, int _x, int _y,
     //    kdDebug( 6040 ) << renderName() << "(RenderInline) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
 
+    // We're done.  We don't bother painting any children.
+    if (paintAction == PaintActionElementBackground)
+        return;
+    // We don't paint our own background, but we do let the kids paint their backgrounds.
+    if (paintAction == PaintActionChildBackgrounds)
+        paintAction = PaintActionChildBackground;
+    
     paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
     
     RenderObject *child = firstChild();
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 901048c..45626a1 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -603,32 +603,45 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h, bool selectionOnly)
             continue;
         
         if (selectionOnly) {
-            elt->layer->renderer()->paint(p, x, y, w, h,
-                                          elt->absBounds.x() - elt->layer->renderer()->xPos(),
-                                          elt->absBounds.y() - elt->layer->renderer()->yPos(),
-                                          PaintActionSelection);
+            if (elt->layerElementType == RenderLayerElement::Normal ||
+                elt->layerElementType == RenderLayerElement::Foreground)
+                elt->layer->renderer()->paint(p, x, y, w, h,
+                                            elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                            elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                            PaintActionSelection);
         } else {
-            elt->layer->renderer()->paint(p, x, y, w, h,
-                                        elt->absBounds.x() - elt->layer->renderer()->xPos(),
-                                        elt->absBounds.y() - elt->layer->renderer()->yPos(),
-                                        PaintActionBackground);
-            elt->layer->renderer()->paint(p, x, y, w, h,
-                                        elt->absBounds.x() - elt->layer->renderer()->xPos(),
-                                        elt->absBounds.y() - elt->layer->renderer()->yPos(),
-                                        PaintActionFloat);
-            elt->layer->renderer()->paint(p, x, y, w, h,
-                                        elt->absBounds.x() - elt->layer->renderer()->xPos(),
-                                        elt->absBounds.y() - elt->layer->renderer()->yPos(),
-                                        PaintActionForeground);
-
-            // Position our scrollbars.
-            elt->layer->positionScrollbars(elt->absBounds);
+            if (elt->layerElementType == RenderLayerElement::Normal ||
+                elt->layerElementType == RenderLayerElement::Background)
+                elt->layer->renderer()->paint(p, x, y, w, h,
+                                            elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                            elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                            PaintActionElementBackground);
+
+            if (elt->layerElementType == RenderLayerElement::Normal ||
+                elt->layerElementType == RenderLayerElement::Foreground) {
+                elt->layer->renderer()->paint(p, x, y, w, h,
+                                              elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                              elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                              PaintActionChildBackgrounds);
+                elt->layer->renderer()->paint(p, x, y, w, h,
+                                            elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                            elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                            PaintActionFloat);
+                elt->layer->renderer()->paint(p, x, y, w, h,
+                                            elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                            elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                            PaintActionForeground);
 
+                
+                // Position our scrollbars.
+                elt->layer->positionScrollbars(elt->absBounds);
+    
 #if APPLE_CHANGES
-            // Our widgets paint exactly when we tell them to, so that they work properly with
-            // z-index.
-            elt->layer->paintScrollbars(p, x, y, w, h);
+                // Our widgets paint exactly when we tell them to, so that they work properly with
+                // z-index.
+                elt->layer->paintScrollbars(p, x, y, w, h);
 #endif
+            }
         }
     }
     
@@ -692,7 +705,7 @@ RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
     uint count = layerList.count();
     for (int i = count-1; i >= 0; i--) {
         RenderLayerElement* elt = layerList.at(i);
-
+        
         // Elements add in their own positions as a translation factor.  This forces
         // us to subtract that out, so that when it's added back in, we get the right
         // bounds.  This is really disgusting (that paint only sets up the right paint
@@ -703,6 +716,18 @@ RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
                                       elt->absBounds.x() - elt->layer->renderer()->xPos(),
                                       elt->absBounds.y() - elt->layer->renderer()->yPos());
         if (inside) {
+            // For foreground layer elements where the layer has been split into two, we
+            // are only considered to be inside the foreground layer if we hit content other
+            // than ourselves.
+            if (elt->layerElementType == RenderLayerElement::Foreground &&
+                info.innerNode() == elt->layer->renderer()->element()) {
+                inside = false;
+                info.setInnerNode(0);
+                info.setInnerNonSharedNode(0);
+                info.setURLElement(0);
+                continue;
+            }
+            // Otherwise the mouse is inside this layer, and we can stop looking.
             insideLayer = elt->layer;
             break;
         }
@@ -969,16 +994,51 @@ void RenderLayer::RenderZTreeNode::constructLayerList(QPtrVector<RenderLayerElem
         current->constructLayerList(mergeTmpBuffer, buffer);
     uint endIndex = buffer->count();
 
-    if (autoZIndex)
+    if (autoZIndex || !(endIndex-startIndex))
         return; // We just had to collect the kids.  We don't apply a sort to them, since
                 // they will actually be layered in some ancestor layer's stacking context.
     
     sortByZOrder(buffer, mergeTmpBuffer, startIndex, endIndex);
 
+    // Find out if we have any elements with negative z-indices in this stacking context.
+    // If so, then we need to split our layer in two (a background layer and a foreground
+    // layer).  We then put the background layer before the negative z-index objects, and
+    // leave the foreground layer in the position previously occupied by the unsplit original.
+    RenderLayerElement* elt = buffer->at(startIndex);
+    if (elt->zindex < 0) {
+        // Locate our layer in the layer list.
+        for (uint i = startIndex; i < endIndex; i++) {
+            elt = buffer->at(i);
+            if (elt->layer == layer) {
+                // Clone the layer element.
+                RenderLayerElement* bgLayer =
+                  new (layer->renderer()->renderArena()) RenderLayerElement(*elt);
+
+                // Set the layer types (foreground and background) on the two layer elements.
+                elt->layerElementType = RenderLayerElement::Foreground;
+                bgLayer->layerElementType = RenderLayerElement::Background;
+
+                // Ensure our buffer is big enough to hold a new layer element.
+                if (buffer->count() == buffer->size())
+                    // Resize by a power of 2.
+                    buffer->resize(2*(buffer->size()+1));
+
+                // Insert the background layer element at the front of our sorted list.
+                for (uint j = buffer->count(); j > startIndex; j--)
+                    buffer->insert(j, buffer->at(j-1));
+                buffer->insert(startIndex, bgLayer);
+
+                // Augment endIndex since we added a layer element.
+                endIndex++;
+                break;
+            }
+        }
+    }
+    
     // Now set all of the elements' z-indices to match the parent's explicit z-index, so that
     // they will be layered properly in the ancestor layer's stacking context.
     for (uint i = startIndex; i < endIndex; i++) {
-        RenderLayerElement* elt = buffer->at(i);
+        elt = buffer->at(i);
         elt->zindex = explicitZIndex;
     }
 }
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index 0eb002b..74b604d 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -195,6 +195,8 @@ public:
     // (more on this below).
     // 
     struct RenderLayerElement {
+      enum LayerElementType { Normal, Background, Foreground };
+        
       RenderLayer* layer;
       QRect absBounds; // Our bounds in absolute coordinates relative to the root.
       QRect backgroundClipRect; // Clip rect used for our background/borders. 
@@ -205,12 +207,17 @@ public:
       int x; // The coords relative to the layer that will be using this list
              // to paint.
       int y;
-
+      LayerElementType layerElementType; // For negative z-indices, we have to split a single layer into two
+                           // RenderLayerElements, one that sits beneath the negative content, and
+                           // another that sits above (denoted with values of Background and Foreground,
+                           // respectively).  A normal layer that fully paints is denoted with the value Normal.
+      
       RenderLayerElement(RenderLayer* l, const QRect& rect, const QRect& bgclip, 
-                         const QRect& clip, bool clipOrig, int xpos, int ypos)
+                         const QRect& clip, bool clipOrig, int xpos, int ypos,
+                         LayerElementType lType = Normal)
           :layer(l), absBounds(rect), backgroundClipRect(bgclip), clipRect(clip), 
            zindex(l->zIndex()), zauto(l->hasAutoZIndex()), clipOriginator(clipOrig),
-           x(xpos), y(ypos) {}
+           x(xpos), y(ypos), layerElementType(lType) {}
           
       void detach(RenderArena* renderArena);
     
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 5922298..73c15b6 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -62,7 +62,9 @@ class RenderArena;
  */
 
 typedef enum {
-    PaintActionBackground = 0,
+    PaintActionElementBackground = 0,
+    PaintActionChildBackground,
+    PaintActionChildBackgrounds,
     PaintActionFloat,
     PaintActionForeground,
     PaintActionSelection
@@ -348,6 +350,7 @@ public:
     // if readonly == false, it will recalc hover styles accordingly
     class NodeInfo
     {
+        friend class RenderLayer;
         friend class RenderImage;
         friend class RenderText;
         friend class RenderInline;
diff --git a/WebCore/khtml/rendering/render_root.cpp b/WebCore/khtml/rendering/render_root.cpp
index 9e54481..c58835f 100644
--- a/WebCore/khtml/rendering/render_root.cpp
+++ b/WebCore/khtml/rendering/render_root.cpp
@@ -205,9 +205,11 @@ void RenderRoot::paintObject(QPainter *p, int _x, int _y,
     kdDebug( 6040 ) << renderName() << "(RenderRoot) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
     // 1. paint background, borders etc
-    if (paintAction == PaintActionBackground)
+    if (paintAction == PaintActionElementBackground) {
         paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
-
+        return;
+    }
+    
     // 2. paint contents
     RenderObject *child = firstChild();
     while(child != 0) {
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index 418671a..68a18b3 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -401,9 +401,18 @@ void RenderTable::paint( QPainter *p, int _x, int _y,
     kdDebug( 6040 ) << "RenderTable::paint(2) " << _tx << "/" << _ty << " (" << _y << "/" << _h << ")" << endl;
 #endif
 
-    if(paintAction == PaintActionBackground && style()->visibility() == VISIBLE)
+    if ((paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground)
+        && style()->visibility() == VISIBLE) {
         paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    }
 
+    // We're done.  We don't bother painting any children.
+    if (paintAction == PaintActionElementBackground)
+        return;
+    // We don't paint our own background, but we do let the kids paint their backgrounds.
+    if (paintAction == PaintActionChildBackgrounds)
+        paintAction = PaintActionChildBackground;
+    
     RenderObject *child = firstChild();
     while( child ) {
 	if ( child->isTableSection() || child == tCaption )
diff --git a/WebCore/kwq/KWQRenderTreeDebug.cpp b/WebCore/kwq/KWQRenderTreeDebug.cpp
index cf80ce8..c7adcb7 100644
--- a/WebCore/kwq/KWQRenderTreeDebug.cpp
+++ b/WebCore/kwq/KWQRenderTreeDebug.cpp
@@ -173,10 +173,16 @@ static void write(QTextStream &ts, const RenderLayerElement &e, int indent = 0)
     if (r != r.intersect(e.clipRect)) {
         ts << " clip " << e.clipRect;
     }
+
+    if (e.layerElementType == RenderLayerElement::Background)
+        ts << " layerType: background only";
+    else if (e.layerElementType == RenderLayerElement::Foreground)
+        ts << " layerType: foreground only";
     
     ts << "\n";
 
-    write(ts, *l.renderer(), indent + 1);
+    if (e.layerElementType != RenderLayerElement::Background)
+        write(ts, *l.renderer(), indent + 1);
 }
 
 static void writeLayers(QTextStream &ts, const RenderObject &o, int indent)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list