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


The following commit has been merged in the debian/unstable branch:
commit 130a831dba560595b8d03c0eee804b3ad786e14c
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 29 23:43:19 2002 +0000

    	Begin connecting the layer system.  The root box and the <html>
    	box now construct layers for themselves.  Those layers are
    	connected in a layer tree properly and they correctly update
    	their positions.
    
    	Implemented all the code for layer construction and for keeping
    	the layer tree in sync with the render object tree.
    
    	The goal is to get the layer tree fully constructed and correct
    	(with lots of testing) before actually switching over to it for
    	painting.
    
    	This change requires a clean of WebCore.
    
            * force-clean-timestamp:
            * khtml/rendering/render_box.cpp:
            (RenderBox::RenderBox):
            (RenderBox::~RenderBox):
            (RenderBox::setPos):
            (RenderBox::positionChildLayers):
            * khtml/rendering/render_box.h:
            * khtml/rendering/render_container.cpp:
            (RenderContainer::~RenderContainer):
            (RenderContainer::addChild):
            (RenderContainer::removeChildNode):
            * khtml/rendering/render_container.h:
            * khtml/rendering/render_html.cpp:
            (RenderHtml::RenderHtml):
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::updateLayerPosition):
            * khtml/rendering/render_layer.h:
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_root.cpp:
            (RenderRoot::RenderRoot):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1938 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index b0512f8..85b39bb 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,40 @@
+2002-08-29  David Hyatt  <hyatt at apple.com>
+
+	Begin connecting the layer system.  The root box and the <html>
+	box now construct layers for themselves.  Those layers are
+	connected in a layer tree properly and they correctly update
+	their positions.
+
+	Implemented all the code for layer construction and for keeping
+	the layer tree in sync with the render object tree.  
+
+	The goal is to get the layer tree fully constructed and correct
+	(with lots of testing) before actually switching over to it for
+	painting.
+
+	This change requires a clean of WebCore.
+	
+        * force-clean-timestamp:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::RenderBox):
+        (RenderBox::~RenderBox):
+        (RenderBox::setPos):
+        (RenderBox::positionChildLayers):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::~RenderContainer):
+        (RenderContainer::addChild):
+        (RenderContainer::removeChildNode):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::RenderHtml):
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::updateLayerPosition):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::RenderRoot):
+
 === Alexander-21 ===
 
 2002-08-28  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b0512f8..85b39bb 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,40 @@
+2002-08-29  David Hyatt  <hyatt at apple.com>
+
+	Begin connecting the layer system.  The root box and the <html>
+	box now construct layers for themselves.  Those layers are
+	connected in a layer tree properly and they correctly update
+	their positions.
+
+	Implemented all the code for layer construction and for keeping
+	the layer tree in sync with the render object tree.  
+
+	The goal is to get the layer tree fully constructed and correct
+	(with lots of testing) before actually switching over to it for
+	painting.
+
+	This change requires a clean of WebCore.
+	
+        * force-clean-timestamp:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::RenderBox):
+        (RenderBox::~RenderBox):
+        (RenderBox::setPos):
+        (RenderBox::positionChildLayers):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::~RenderContainer):
+        (RenderContainer::addChild):
+        (RenderContainer::removeChildNode):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::RenderHtml):
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::updateLayerPosition):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::RenderRoot):
+
 === Alexander-21 ===
 
 2002-08-28  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b0512f8..85b39bb 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,40 @@
+2002-08-29  David Hyatt  <hyatt at apple.com>
+
+	Begin connecting the layer system.  The root box and the <html>
+	box now construct layers for themselves.  Those layers are
+	connected in a layer tree properly and they correctly update
+	their positions.
+
+	Implemented all the code for layer construction and for keeping
+	the layer tree in sync with the render object tree.  
+
+	The goal is to get the layer tree fully constructed and correct
+	(with lots of testing) before actually switching over to it for
+	painting.
+
+	This change requires a clean of WebCore.
+	
+        * force-clean-timestamp:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::RenderBox):
+        (RenderBox::~RenderBox):
+        (RenderBox::setPos):
+        (RenderBox::positionChildLayers):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::~RenderContainer):
+        (RenderContainer::addChild):
+        (RenderContainer::removeChildNode):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::RenderHtml):
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::updateLayerPosition):
+        * khtml/rendering/render_layer.h:
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::RenderRoot):
+
 === Alexander-21 ===
 
 2002-08-28  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/force-clean-timestamp b/WebCore/force-clean-timestamp
index bac16f1..d6f74cf 100644
--- a/WebCore/force-clean-timestamp
+++ b/WebCore/force-clean-timestamp
@@ -1 +1,2 @@
-KHTML change 8/27
+KHTML change 8/29
+
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index 2ad0e19..441d432 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -57,6 +57,7 @@ RenderBox::RenderBox(DOM::NodeImpl* node)
     m_marginLeft = 0;
     m_marginRight = 0;
     m_layer = 0;
+    m_hasChildLayers = false;
 }
 
 void RenderBox::setStyle(RenderStyle *_style)
@@ -88,6 +89,7 @@ void RenderBox::setStyle(RenderStyle *_style)
 RenderBox::~RenderBox()
 {
     //kdDebug( 6040 ) << "Element destructor: this=" << nodeName().string() << endl;
+    delete m_layer;
 }
 
 short RenderBox::contentWidth() const
@@ -111,7 +113,26 @@ int RenderBox::contentHeight() const
 
 void RenderBox::setPos( int xPos, int yPos )
 {
+    if (xPos == m_x && yPos == m_y)
+        return; // Optimize for the case where we don't move at all.
+    
     m_x = xPos; m_y = yPos;
+    if (m_layer)
+        m_layer->updateLayerPosition();
+    else if (m_hasChildLayers)
+        // We don't have a layer, but we have children whose positions need to
+        // be updated.  Crawl into our frame tree, find those views, and
+        // reposition the children.
+        positionChildLayers();
+}
+
+void RenderBox::positionChildLayers()
+{
+    if (m_layer)
+        m_layer->updateLayerPosition();
+    else
+        for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+            curr->positionChildLayers();
 }
 
 short RenderBox::width() const
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index 91f31ed..6180ef7 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -25,10 +25,10 @@
 
 #include "render_container.h"
 #include "misc/loader.h"
+#include "render_layer.h"
 
 namespace khtml {
     class CachedObject;
-    class RenderLayer;
     
 class RenderBox : public RenderContainer
 {
@@ -69,8 +69,8 @@ public:
     virtual short marginLeft() const { return m_marginLeft; }
     virtual short marginRight() const { return m_marginRight; }
 
-    virtual void setWidth( int width ) { m_width = width; }
-    virtual void setHeight( int height ) { m_height = height; }
+    virtual void setWidth( int width ) { m_width = width; if (m_layer) m_layer->setWidth(width); }
+    virtual void setHeight( int height ) { m_height = height; if (m_layer) m_layer->setHeight(height); }
 
     // This method is now public so that centered objects like tables that are
     // shifted right by left-aligned floats can recompute their left and
@@ -101,8 +101,19 @@ public:
 
     void relativePositionOffset(int &tx, int &ty);
 
-    RenderLayer* layer() { return m_layer; }
-    
+    virtual RenderLayer* layer() const { return m_layer; }
+    virtual bool hasChildLayers() const { return m_hasChildLayers; }
+    virtual void setHasChildLayers(bool hasLayers) {
+        if (m_hasChildLayers == hasLayers)
+            return;
+        
+        m_hasChildLayers = hasLayers;
+
+        if (parent() && hasLayers)
+            parent()->setHasChildLayers(hasLayers);
+    }
+    virtual void positionChildLayers();
+
 protected:
     virtual void printBoxDecorations(QPainter *p,int _x, int _y,
                                        int _w, int _h, int _tx, int _ty);
@@ -144,6 +155,7 @@ protected:
     // A pointer to our layer if we have one.  Currently only positioned elements
     // and floaters have layers.
     RenderLayer* m_layer;
+    bool m_hasChildLayers : 1;
 };
 
 
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 49230a3..d8df692 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -47,7 +47,7 @@ RenderContainer::~RenderContainer()
 {
     RenderObject* next;
     for(RenderObject* n = m_first; n; n = next ) {
-	n->removeFromSpecialObjects();
+        n->removeFromSpecialObjects();
         n->setParent(0);
         next = n->nextSibling();
         n->detach();
@@ -134,12 +134,25 @@ void RenderContainer::addChild(RenderObject *newChild, RenderObject *beforeChild
     }
     newChild->setLayouted( false );
     newChild->setMinMaxKnown( false );
+
+    // Keep our layer hierarchy updated.
+    if (newChild->layer()) {
+        RenderObject* ancestor = (newChild->isPositioned()) ? newChild->containingBlock() : this;
+        ancestor->enclosingLayer()->addChild(newChild->layer());
+        ancestor->setHasChildLayers(true);
+    }
 }
 
 RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
 {
     KHTMLAssert(oldChild->parent() == this);
 
+    // Keep our layer hierarchy updated.
+    if (oldChild->layer()) {
+        RenderObject* ancestor = (oldChild->isPositioned()) ? oldChild->containingBlock() : this;
+        ancestor->enclosingLayer()->removeChild(oldChild->layer());
+    }
+    
     // if oldChild is the start or end of the selection, then clear the selection to
     // avoid problems of invalid pointers
 
@@ -176,6 +189,7 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
     setLayouted( false );
     setMinMaxKnown( false );
 
+          
     return oldChild;
 }
 
diff --git a/WebCore/khtml/rendering/render_container.h b/WebCore/khtml/rendering/render_container.h
index b893f69..14d1d43 100644
--- a/WebCore/khtml/rendering/render_container.h
+++ b/WebCore/khtml/rendering/render_container.h
@@ -51,6 +51,15 @@ 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_html.cpp b/WebCore/khtml/rendering/render_html.cpp
index c10629b..9c5056c 100644
--- a/WebCore/khtml/rendering/render_html.cpp
+++ b/WebCore/khtml/rendering/render_html.cpp
@@ -32,6 +32,7 @@ using namespace khtml;
 RenderHtml::RenderHtml(DOM::HTMLElementImpl* node)
     : RenderFlow(node)
 {
+    m_layer = new RenderLayer(this);
 }
 
 RenderHtml::~RenderHtml()
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 38aadd0..dc851b2 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -49,6 +49,20 @@ RenderLayer::~RenderLayer()
     // our destructor doesn't have to do anything.
 }
 
+void RenderLayer::updateLayerPosition()
+{
+    int x = m_object->xPos();
+    int y = m_object->yPos();
+
+    RenderObject* curr = m_object->parent();
+    while (curr && !curr->layer()) {
+        x += curr->xPos();
+        y += curr->yPos();
+    }
+
+    setPos(x,y);
+}
+
 void RenderLayer::addChild(RenderLayer *child, RenderLayer *beforeChild)
 {
     if (!beforeChild)
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index 95968ef..b14f420 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -67,7 +67,8 @@ public:
     void setHeight( int height ) { m_height = height; }
     
     void setPos( int xPos, int yPos ) { m_x = xPos; m_y = yPos; }
-
+    void updateLayerPosition();
+    
     void convertToLayerCoords(RenderLayer* ancestorLayer, int& x, int& y);
     
     bool hasAutoZIndex() { return renderer()->style()->hasAutoZIndex(); }
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 4985e9c..ceccc3c 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -65,6 +65,7 @@ namespace khtml {
     class RenderRoot;
     class RenderText;
     class RenderFrameSet;
+    class RenderLayer;
 
 /**
  * Base Class for all rendering tree objects.
@@ -84,6 +85,12 @@ public:
     virtual RenderObject *firstChild() const { return 0; }
     virtual RenderObject *lastChild() const { return 0; }
 
+    virtual RenderLayer* layer() const { return 0; }
+    virtual RenderLayer* enclosingLayer() { return 0; }
+    virtual bool hasChildLayers() const { return false; }
+    virtual void setHasChildLayers(bool hasLayers) { }
+    virtual void positionChildLayers() { }
+    
     // RenderObject tree manipulation
     //////////////////////////////////////////
     virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
@@ -171,25 +178,26 @@ public:
     void closeEntireTree() {
       RenderObject *child = firstChild();
       while (child) {
-	child->closeEntireTree();
-	child = child->nextSibling();
+          child->closeEntireTree();
+          child = child->nextSibling();
       }
       close();
     }
 
     void setLayouted(bool b=true) {
-	m_layouted = b;
-	if(!b) {
-	    RenderObject *o = m_parent;
-	    RenderObject *root = this;
-	    while( o ) {
-		o->m_layouted = false;
-		root = o;
-		o = o->m_parent;
-	    }
-	    root->scheduleRelayout();
-	}
+        m_layouted = b;
+        if(!b) {
+            RenderObject *o = m_parent;
+            RenderObject *root = this;
+            while( o ) {
+                o->m_layouted = false;
+                root = o;
+                o = o->m_parent;
+            }
+            root->scheduleRelayout();
+        }
     }
+    
     // hack to block inline layouts during parsing
     // evil, evil. I didn't do it. <tm>
     virtual void setBlockBidi() {}
diff --git a/WebCore/khtml/rendering/render_root.cpp b/WebCore/khtml/rendering/render_root.cpp
index fdf437f..63f07e0 100644
--- a/WebCore/khtml/rendering/render_root.cpp
+++ b/WebCore/khtml/rendering/render_root.cpp
@@ -19,7 +19,7 @@
  * Boston, MA 02111-1307, USA.
  */
 #include "rendering/render_root.h"
-
+#include "render_layer.h"
 
 #include "khtmlview.h"
 #include <kdebug.h>
@@ -60,6 +60,9 @@ RenderRoot::RenderRoot(DOM::NodeImpl* node, KHTMLView *view)
     m_selectionEnd = 0;
     m_selectionStartPos = -1;
     m_selectionEndPos = -1;
+
+    // Create a new root layer for our layer hierarchy.
+    m_layer = new RenderLayer(this);
 }
 
 RenderRoot::~RenderRoot()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list