[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 06:35:20 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit cd5bc422ceef49c0eb86106c3cb172b80d640682
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 28 22:32:56 2002 +0000

    	Adding knowledge to the style system of auto z-indices.  The old
    	code doesn't use this yet, but the new layering code will.
    
    	Also wrote the ztree construction function (not used yet) and
    	stubbed out the display list flattening routines.
    
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::convertToLayerCoords):
            (RenderLayer::constructZTree):
            (RenderLayer::constructLayerList):
            * khtml/rendering/render_layer.h:
            * khtml/rendering/render_style.cpp:
            (StyleBoxData::StyleBoxData):
            * khtml/rendering/render_style.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1931 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index f4e82b4..f5bfc72 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,20 @@
+2002-08-28  David Hyatt  <hyatt at apple.com>
+
+	Adding knowledge to the style system of auto z-indices.  The old
+	code doesn't use this yet, but the new layering code will.
+
+	Also wrote the ztree construction function (not used yet) and
+	stubbed out the display list flattening routines.
+	
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::convertToLayerCoords):
+        (RenderLayer::constructZTree):
+        (RenderLayer::constructLayerList):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_style.cpp:
+        (StyleBoxData::StyleBoxData):
+        * khtml/rendering/render_style.h:
+
 2002-08-28  Darin Adler  <darin at apple.com>
 
 	- fixed 2977587 -- JavaScript code that reads the values of text areas
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index f4e82b4..f5bfc72 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2002-08-28  David Hyatt  <hyatt at apple.com>
+
+	Adding knowledge to the style system of auto z-indices.  The old
+	code doesn't use this yet, but the new layering code will.
+
+	Also wrote the ztree construction function (not used yet) and
+	stubbed out the display list flattening routines.
+	
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::convertToLayerCoords):
+        (RenderLayer::constructZTree):
+        (RenderLayer::constructLayerList):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_style.cpp:
+        (StyleBoxData::StyleBoxData):
+        * khtml/rendering/render_style.h:
+
 2002-08-28  Darin Adler  <darin at apple.com>
 
 	- fixed 2977587 -- JavaScript code that reads the values of text areas
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f4e82b4..f5bfc72 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2002-08-28  David Hyatt  <hyatt at apple.com>
+
+	Adding knowledge to the style system of auto z-indices.  The old
+	code doesn't use this yet, but the new layering code will.
+
+	Also wrote the ztree construction function (not used yet) and
+	stubbed out the display list flattening routines.
+	
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::convertToLayerCoords):
+        (RenderLayer::constructZTree):
+        (RenderLayer::constructLayerList):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_style.cpp:
+        (StyleBoxData::StyleBoxData):
+        * khtml/rendering/render_style.h:
+
 2002-08-28  Darin Adler  <darin at apple.com>
 
 	- fixed 2977587 -- JavaScript code that reads the values of text areas
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 92e2692..06bdf90 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -24,6 +24,7 @@
 #include <kdebug.h>
 #include <assert.h>
 #include "khtmlview.h"
+#include "render_object.h"
 
 using namespace DOM;
 using namespace khtml;
@@ -84,4 +85,100 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
     return oldChild;
 }
 
+void 
+RenderLayer::convertToLayerCoords(RenderLayer* ancestorLayer, int& x, int& y)
+{
+    x = xPos();
+    y = yPos();
+    if (ancestorLayer == this) return;
+    
+    for (RenderLayer* current = parent(); current && current != ancestorLayer;
+         current = current->parent()) {
+        x += current->xPos();
+        y += current->yPos();
+    }
+}
+
+RenderLayer::RenderZTreeNode*
+RenderLayer::constructZTree(const QRect& damageRect, 
+                            RenderLayer* rootLayer, 
+                            RenderLayer* paintingLayer)
+{
+    // This variable stores the result we will hand back.
+    RenderLayer::RenderZTreeNode* returnNode = 0;
+    
+    // If a layer isn't visible, then none of its child layers are visible either.
+    // Don't build this branch of the z-tree, since these layers should not be painted.
+    if (renderer()->style()->visibility() != VISIBLE)
+        return 0;
+    
+    // Compute this layer's absolute position, so that we can compare it with our
+    // damage rect and avoid repainting the layer if it falls outside that rect.
+    int x, y;
+    convertToLayerCoords(rootLayer, x, y);
+    QRect layerBounds(x, y, width(), height());
+    if (!layerBounds.intersects(damageRect))
+        return 0;
+    
+    // Compute our coordinates relative to the layer being painted.
+    convertToLayerCoords(paintingLayer, x, y);
+
+    returnNode = new RenderLayer::RenderZTreeNode(this);
+    
+    // Walk our list of child layers looking only for those layers that have a 
+    // non-negative z-index (a z-index >= 0).
+    for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
+        if (child->zIndex() < 0)
+            continue; // Ignore negative z-indices in this first pass.
+
+        RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, paintingLayer);
+        if (childNode) {
+            // Put the new node into the tree at the front of the parent's list.
+            childNode->next = returnNode->child;
+            returnNode->child = childNode;
+        }
+    }
+
+    // Now add a leaf node for ourselves.
+    RenderLayerElement* layerElt = new RenderLayerElement(this, layerBounds, x, y);
+    if (returnNode->child) {
+        RenderZTreeNode* leaf = new RenderZTreeNode(layerElt);
+        leaf->next = returnNode->child;
+        returnNode->child = leaf;
+    }
+    else
+        returnNode->layerElement = layerElt;
+
+    // Now look for children that have a negative z-index.
+    for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
+        if (child->zIndex() >= 0)
+            continue; // Ignore non-negative z-indices in this second pass.
+
+        RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, paintingLayer);
+        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
+            // children.
+            if (returnNode->layerElement) {
+                RenderZTreeNode* leaf = returnNode;
+                returnNode = new RenderLayer::RenderZTreeNode(this);
+                returnNode->child = leaf;
+            }
+            
+            // Put the new node into the tree at the front of the parent's list.
+            childNode->next = returnNode->child;
+            returnNode->child = childNode;
+        }
+    }
+    
+    return returnNode;
+}
+
+void
+RenderLayer::constructLayerList(RenderZTreeNode* ztree, QPtrVector<RenderLayer::RenderLayerElement>* result)
+{
+    // This merge buffer is just a temporary used during computation as we do merge sorting.
+    QPtrVector<RenderLayer::RenderLayerElement> mergeBuffer;
+    ztree->constructLayerList(&mergeBuffer, result);
+}
 
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index 4fdb33d..af3c20b 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -28,10 +28,7 @@
 #include <qrect.h>
 #include <assert.h>
 
-#include "misc/khtmllayout.h"
-#include "misc/loader_client.h"
-#include "misc/helper.h"
-#include "rendering/render_style.h"
+#include "render_object.h"
 #include <qvector.h>
 
 namespace khtml {
@@ -50,6 +47,7 @@ public:
     RenderLayer(RenderObject* object);
     ~RenderLayer();
     
+    RenderObject* renderer() const { return m_object; }
     RenderLayer *parent() const { return m_parent; }
     RenderLayer *previousSibling() const { return m_previous; }
     RenderLayer *nextSibling() const { return m_next; }
@@ -70,7 +68,12 @@ public:
     
     void setPos( int xPos, int yPos ) { m_x = xPos; m_y = yPos; }
 
-protected:
+    void convertToLayerCoords(RenderLayer* ancestorLayer, int& x, int& y);
+    
+    bool hasAutoZIndex() { return renderer()->style()->hasAutoZIndex(); }
+    int zIndex() { return renderer()->style()->zIndex(); }
+    
+public:
     // Z-Index Implementation Notes
     //
     // In order to properly handle mouse events as well as painting,
@@ -94,10 +97,16 @@ protected:
     // 
     struct RenderLayerElement {
       RenderLayer* layer;
+      QRect absBounds; // Our bounds in absolute coordinates relative to the root.
       int zindex; // Temporary z-index used for processing and sorting.
-      int x; // The coords relative to the view that will be using this list
+      bool zauto; // Whether or not we are using auto z-indexing.
+      int x; // The coords relative to the layer that will be using this list
              // to paint.
       int y;
+
+      RenderLayerElement(RenderLayer* l, const QRect& rect, int xpos, int ypos)
+          :layer(l), absBounds(rect), zindex(l->zIndex()), zauto(l->hasAutoZIndex()),
+          x(xpos), y(ypos) {}
     };
 
     // The list of layer elements is built through a recursive examination
@@ -123,13 +132,25 @@ protected:
       // Only one of these will ever be defined.
       RenderZTreeNode* child; // Defined for interior nodes.
       RenderLayerElement* layerElement; // Defined for leaf nodes.
+
+      RenderZTreeNode(RenderLayer* l)
+          :layer(l), next(0), child(0), layerElement(0) {}
+
+      RenderZTreeNode(RenderLayerElement* layerElt)
+          :layer(layerElt->layer), next(0), child(0), layerElement(layerElt) {}
+      
+      ~RenderZTreeNode() { delete next; delete child; }
+
+      void constructLayerList(QPtrVector<RenderLayerElement>* mergeTmpBuffer,
+                              QPtrVector<RenderLayerElement>* finalBuffer) { };
+      
     };
       
-public:
+private:
     // The createZTree function creates a z-tree for a given layer hierarchy
     // rooted on this layer.  It will ensure that immediate child
     // elements of a given z-tree node are at least initially sorted
-    // into <negative z-index children>, <this layer>, <positive z-index
+    // into <negative z-index children>, <this layer>, <non-negative z-index
     // children>.
     //
     // Here is a concrete example (lifted from Gecko's view system,
@@ -153,7 +174,9 @@ public:
     // +-------> L(L5)
     // +-------> L(L6)
     //
-    void constructZTree(RenderZTreeNode*& ztree) {};
+    RenderZTreeNode* constructZTree(const QRect& damageRect, 
+                                    RenderLayer* rootLayer,
+                                    RenderLayer* paintingLayer);
 
     // Once the z-tree has been constructed, we call constructLayerList
     // to produce a flattened layer list for rendering/event handling.
@@ -173,23 +196,22 @@ public:
     // I(L2) has a list [ L(L2)(0), L(L3)(0), L(L4)(2) ]
     // I(L2) is auto so the z-indices of the child layer elements remain
     // unaltered.
-    // I(L1) has a list [ L(L1)(0), L(L2)(0), L(L3)(0), L(L4)(2), L(L5)(1)
+    // I(L1) has a list [ L(L1)(0), L(L2)(0), L(L3)(0), L(L4)(2), L(L5)(1) ]
     // The nodes are sorted and then reassigned a z-index of 0, so this
     // list becomes:
-    //   [ L(L1)(0), L(L2)(0), L(L3)(0), L(L5)(0), L(L4)(0) ]
+    // [ L(L1)(0), L(L2)(0), L(L3)(0), L(L5)(0), L(L4)(0) ]
     // Finally we end up with the list for L0, which sorted becomes:
     // [ L(L0)(0), L(L1)(0), L(L2)(0), L(L3)(0), L(L5)(0), L(L4)(0), L(L6)(1) ]
-
     void constructLayerList(RenderZTreeNode* ztree,
-			    QPtrVector<RenderLayerElement>& layerList) {};
-
+                            QPtrVector<RenderLayerElement>* result);
+    
 private:
     void setNextSibling(RenderLayer* next) { m_next = next; }
     void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
     void setParent(RenderLayer* parent) { m_parent = parent; }
     void setFirstChild(RenderLayer* first) { m_first = first; }
     void setLastChild(RenderLayer* last) { m_last = last; }
-    
+
 protected:   
     RenderObject* m_object;
     
diff --git a/WebCore/khtml/rendering/render_style.cpp b/WebCore/khtml/rendering/render_style.cpp
index 435c6bf..b30f6e8 100644
--- a/WebCore/khtml/rendering/render_style.cpp
+++ b/WebCore/khtml/rendering/render_style.cpp
@@ -47,7 +47,7 @@ bool StyleSurroundData::operator==(const StyleSurroundData& o) const
 }
 
 StyleBoxData::StyleBoxData()
-    : z_index( ZAUTO )
+    : z_index( 0 ), z_auto(true)
 {
 }
 
diff --git a/WebCore/khtml/rendering/render_style.h b/WebCore/khtml/rendering/render_style.h
index ca5f571..5c60321 100644
--- a/WebCore/khtml/rendering/render_style.h
+++ b/WebCore/khtml/rendering/render_style.h
@@ -255,9 +255,6 @@ public:
 //------------------------------------------------
 // Box attributes. Not inherited.
 
-
-const int ZAUTO=0;
-
 class StyleBoxData : public Shared<StyleBoxData>
 {
 public:
@@ -287,6 +284,7 @@ public:
     Length vertical_align;
 
     int z_index;
+    bool z_auto : 1;
 };
 
 //------------------------------------------------
@@ -883,8 +881,9 @@ public:
     bool flowAroundFloats() const { return  noninherited_flags._flowAroundFloats; }
     void setFlowAroundFloats(bool b=true) {  noninherited_flags._flowAroundFloats = b; }
 
+    bool hasAutoZIndex() { return box->z_auto; }
     int zIndex() const { return box->z_index; }
-    void setZIndex(int v) { SET_VAR(box,z_index,v) }
+    void setZIndex(int v) { SET_VAR(box, z_auto, false); SET_VAR(box,z_index,v) }
 
     QPalette palette() const { return visual->palette; }
     void setPaletteColor(QPalette::ColorGroup g, QColorGroup::ColorRole r, const QColor& c);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list