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


The following commit has been merged in the debian/unstable branch:
commit c12f04879c37e6c38abb7ac0134e484a29f524d6
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 19 07:44:09 2002 +0000

    	Implement phased painting to correct the paint order of blocks,
    	floats, and inlines.
    
            * khtml/rendering/render_body.cpp:
            (RenderBody::paintBoxDecorations):
            * khtml/rendering/render_body.h:
            * khtml/rendering/render_box.cpp:
            (RenderBox::paint):
            (RenderBox::paintBoxDecorations):
            (RenderBox::paintBackground):
            * khtml/rendering/render_box.h:
            * khtml/rendering/render_br.h:
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::paint):
            (RenderFlow::paintObject):
            (RenderFlow::paintFloats):
            (RenderFlow::addChild):
            * khtml/rendering/render_flow.h:
            * khtml/rendering/render_html.cpp:
            (RenderHtml::setStyle):
            (RenderHtml::paint):
            (RenderHtml::paintBoxDecorations):
            * khtml/rendering/render_html.h:
            * khtml/rendering/render_image.cpp:
            (RenderImage::setStyle):
            (RenderImage::paintObject):
            * khtml/rendering/render_image.h:
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::paint):
            (RenderLayer::nodeAtPoint):
            * khtml/rendering/render_list.cpp:
            (RenderListItem::paint):
            (RenderListItem::paintObject):
            (RenderListMarker::paint):
            (RenderListMarker::paintObject):
            * khtml/rendering/render_list.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::RenderObject):
            (RenderObject::paintBorder):
            (RenderObject::paintOutline):
            (RenderObject::paint):
            (RenderObject::dump):
            (RenderObject::setStyle):
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_replaced.cpp:
            (RenderReplaced::paint):
            (RenderWidget::setStyle):
            (RenderWidget::paintObject):
            * khtml/rendering/render_replaced.h:
            * khtml/rendering/render_root.cpp:
            (RenderRoot::paint):
            (RenderRoot::paintObject):
            * khtml/rendering/render_root.h:
            * khtml/rendering/render_table.cpp:
            (RenderTable::paint):
            (RenderTableCell::RenderTableCell):
            (RenderTableCell::setStyle):
            (RenderTableCell::paint):
            (RenderTableCell::paintBoxDecorations):
            * khtml/rendering/render_table.h:
            * khtml/rendering/render_text.cpp:
            (TextSlave::paintSelection):
            (TextSlave::paintDecoration):
            (TextSlave::paintBoxDecorations):
            (RenderText::paintObject):
            (RenderText::paint):
            (RenderText::paintTextOutline):
            * khtml/rendering/render_text.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2752 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index c7d9be6..93136f7 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,74 @@
+2002-11-18  David Hyatt  <hyatt at apple.com>
+
+	Implement phased painting to correct the paint order of blocks,
+	floats, and inlines.
+	
+        * khtml/rendering/render_body.cpp:
+        (RenderBody::paintBoxDecorations):
+        * khtml/rendering/render_body.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::paint):
+        (RenderBox::paintBoxDecorations):
+        (RenderBox::paintBackground):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_br.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::paint):
+        (RenderFlow::paintObject):
+        (RenderFlow::paintFloats):
+        (RenderFlow::addChild):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::setStyle):
+        (RenderHtml::paint):
+        (RenderHtml::paintBoxDecorations):
+        * khtml/rendering/render_html.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::setStyle):
+        (RenderImage::paintObject):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::nodeAtPoint):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::paint):
+        (RenderListItem::paintObject):
+        (RenderListMarker::paint):
+        (RenderListMarker::paintObject):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::RenderObject):
+        (RenderObject::paintBorder):
+        (RenderObject::paintOutline):
+        (RenderObject::paint):
+        (RenderObject::dump):
+        (RenderObject::setStyle):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::paint):
+        (RenderWidget::setStyle):
+        (RenderWidget::paintObject):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::paint):
+        (RenderRoot::paintObject):
+        * khtml/rendering/render_root.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        (RenderTableCell::RenderTableCell):
+        (RenderTableCell::setStyle):
+        (RenderTableCell::paint):
+        (RenderTableCell::paintBoxDecorations):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (TextSlave::paintSelection):
+        (TextSlave::paintDecoration):
+        (TextSlave::paintBoxDecorations):
+        (RenderText::paintObject):
+        (RenderText::paint):
+        (RenderText::paintTextOutline):
+        * khtml/rendering/render_text.h:
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
         * force-js-clean-timestamp: I changed the size of ObjectImp.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c7d9be6..93136f7 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,74 @@
+2002-11-18  David Hyatt  <hyatt at apple.com>
+
+	Implement phased painting to correct the paint order of blocks,
+	floats, and inlines.
+	
+        * khtml/rendering/render_body.cpp:
+        (RenderBody::paintBoxDecorations):
+        * khtml/rendering/render_body.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::paint):
+        (RenderBox::paintBoxDecorations):
+        (RenderBox::paintBackground):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_br.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::paint):
+        (RenderFlow::paintObject):
+        (RenderFlow::paintFloats):
+        (RenderFlow::addChild):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::setStyle):
+        (RenderHtml::paint):
+        (RenderHtml::paintBoxDecorations):
+        * khtml/rendering/render_html.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::setStyle):
+        (RenderImage::paintObject):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::nodeAtPoint):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::paint):
+        (RenderListItem::paintObject):
+        (RenderListMarker::paint):
+        (RenderListMarker::paintObject):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::RenderObject):
+        (RenderObject::paintBorder):
+        (RenderObject::paintOutline):
+        (RenderObject::paint):
+        (RenderObject::dump):
+        (RenderObject::setStyle):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::paint):
+        (RenderWidget::setStyle):
+        (RenderWidget::paintObject):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::paint):
+        (RenderRoot::paintObject):
+        * khtml/rendering/render_root.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        (RenderTableCell::RenderTableCell):
+        (RenderTableCell::setStyle):
+        (RenderTableCell::paint):
+        (RenderTableCell::paintBoxDecorations):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (TextSlave::paintSelection):
+        (TextSlave::paintDecoration):
+        (TextSlave::paintBoxDecorations):
+        (RenderText::paintObject):
+        (RenderText::paint):
+        (RenderText::paintTextOutline):
+        * khtml/rendering/render_text.h:
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
         * force-js-clean-timestamp: I changed the size of ObjectImp.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c7d9be6..93136f7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,74 @@
+2002-11-18  David Hyatt  <hyatt at apple.com>
+
+	Implement phased painting to correct the paint order of blocks,
+	floats, and inlines.
+	
+        * khtml/rendering/render_body.cpp:
+        (RenderBody::paintBoxDecorations):
+        * khtml/rendering/render_body.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::paint):
+        (RenderBox::paintBoxDecorations):
+        (RenderBox::paintBackground):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_br.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::paint):
+        (RenderFlow::paintObject):
+        (RenderFlow::paintFloats):
+        (RenderFlow::addChild):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_html.cpp:
+        (RenderHtml::setStyle):
+        (RenderHtml::paint):
+        (RenderHtml::paintBoxDecorations):
+        * khtml/rendering/render_html.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::setStyle):
+        (RenderImage::paintObject):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paint):
+        (RenderLayer::nodeAtPoint):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::paint):
+        (RenderListItem::paintObject):
+        (RenderListMarker::paint):
+        (RenderListMarker::paintObject):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::RenderObject):
+        (RenderObject::paintBorder):
+        (RenderObject::paintOutline):
+        (RenderObject::paint):
+        (RenderObject::dump):
+        (RenderObject::setStyle):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::paint):
+        (RenderWidget::setStyle):
+        (RenderWidget::paintObject):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_root.cpp:
+        (RenderRoot::paint):
+        (RenderRoot::paintObject):
+        * khtml/rendering/render_root.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        (RenderTableCell::RenderTableCell):
+        (RenderTableCell::setStyle):
+        (RenderTableCell::paint):
+        (RenderTableCell::paintBoxDecorations):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (TextSlave::paintSelection):
+        (TextSlave::paintDecoration):
+        (TextSlave::paintBoxDecorations):
+        (RenderText::paintObject):
+        (RenderText::paint):
+        (RenderText::paintTextOutline):
+        * khtml/rendering/render_text.h:
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
         * force-js-clean-timestamp: I changed the size of ObjectImp.
diff --git a/WebCore/khtml/rendering/render_body.cpp b/WebCore/khtml/rendering/render_body.cpp
index d5ea50a..8e44fda 100644
--- a/WebCore/khtml/rendering/render_body.cpp
+++ b/WebCore/khtml/rendering/render_body.cpp
@@ -49,10 +49,10 @@ void RenderBody::setStyle(RenderStyle* style)
     scrollbarsStyled = false;
 }
 
-void RenderBody::printBoxDecorations(QPainter *p,int, int _y,
-				       int, int _h, int _tx, int _ty)
+void RenderBody::paintBoxDecorations(QPainter *p,int, int _y,
+                                     int, int _h, int _tx, int _ty)
 {
-    //kdDebug( 6040 ) << renderName() << "::printDecorations()" << endl;
+    //kdDebug( 6040 ) << renderName() << "::paintBoxDecorations()" << endl;
     QColor c;
     CachedImage *bg = 0;
     
@@ -72,10 +72,10 @@ void RenderBody::printBoxDecorations(QPainter *p,int, int _y,
     else
     	mh = QMIN(_h,h);
 
-    printBackground(p, c, bg, my, mh, _tx, _ty, w, h);
+    paintBackground(p, c, bg, my, mh, _tx, _ty, w, h);
 
     if(style()->hasBorder())
-        printBorder(p, _tx, _ty, w, h, style());
+        paintBorder(p, _tx, _ty, w, h, style());
 }
 
 void RenderBody::repaint(bool immediate)
diff --git a/WebCore/khtml/rendering/render_body.h b/WebCore/khtml/rendering/render_body.h
index 84dd001..1740c02 100644
--- a/WebCore/khtml/rendering/render_body.h
+++ b/WebCore/khtml/rendering/render_body.h
@@ -48,7 +48,7 @@ public:
     virtual void setStyle(RenderStyle* style);
 
 protected:
-    virtual void printBoxDecorations(QPainter *p,int _x, int _y,
+    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
                                      int _w, int _h, int _tx, int _ty);
     bool scrollbarsStyled;
 };
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index cc63ff8..2ad4fb5 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -143,10 +143,10 @@ int RenderBox::height() const
 }
 
 
-// --------------------- printing stuff -------------------------------
+// --------------------- painting stuff -------------------------------
 
-void RenderBox::print(QPainter *p, int _x, int _y, int _w, int _h,
-                                  int _tx, int _ty)
+void RenderBox::paint(QPainter *p, int _x, int _y, int _w, int _h,
+                      int _tx, int _ty, int paintPhase)
 {
     _tx += m_x;
     _ty += m_y;
@@ -155,7 +155,7 @@ void RenderBox::print(QPainter *p, int _x, int _y, int _w, int _h,
     RenderObject *child = firstChild();
     while(child != 0)
     {
-        child->print(p, _x, _y, _w, _h, _tx, _ty);
+        child->paint(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
         child = child->nextSibling();
     }
 }
@@ -167,10 +167,10 @@ void RenderBox::setPixmap(const QPixmap &, const QRect&, CachedImage *image)
 }
 
 
-void RenderBox::printBoxDecorations(QPainter *p,int, int _y,
-                                       int, int _h, int _tx, int _ty)
+void RenderBox::paintBoxDecorations(QPainter *p,int, int _y,
+                                    int, int _h, int _tx, int _ty)
 {
-    //kdDebug( 6040 ) << renderName() << "::printDecorations()" << endl;
+    //kdDebug( 6040 ) << renderName() << "::paintDecorations()" << endl;
 
     int w = width();
     int h = height() + borderTopExtra() + borderBottomExtra();
@@ -183,13 +183,13 @@ void RenderBox::printBoxDecorations(QPainter *p,int, int _y,
     else
         mh = QMIN(_h,h);
 
-    printBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
+    paintBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
 
     if(style()->hasBorder())
-        printBorder(p, _tx, _ty, w, h, style());
+        paintBorder(p, _tx, _ty, w, h, style());
 }
 
-void RenderBox::printBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int h)
+void RenderBox::paintBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int h)
 {
     if(c.isValid())
         p->fillRect(_tx, clipy, w, cliph, c);
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index 1848050..1f14353 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -44,8 +44,8 @@ public:
     virtual const char *renderName() const { return "RenderBox"; }
 
     virtual void setStyle(RenderStyle *style);
-    virtual void print(QPainter *p, int _x, int _y, int _w, int _h,
-                       int _tx, int _ty);
+    virtual void paint(QPainter *p, int _x, int _y, int _w, int _h,
+                       int _tx, int _ty, int paintPhase);
 
     virtual void close();
 
@@ -106,9 +106,9 @@ public:
     virtual RenderLayer* layer() const { return m_layer; }
     
 protected:
-    virtual void printBoxDecorations(QPainter *p,int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty);
-    void printBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int h);
+    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
+                                     int _w, int _h, int _tx, int _ty);
+    void paintBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int h);
     void outlineBox(QPainter *p, int _tx, int _ty, const char *color = "red");
 
     virtual int borderTopExtra() { return 0; }
diff --git a/WebCore/khtml/rendering/render_br.h b/WebCore/khtml/rendering/render_br.h
index a8c61b8..06b3bdd 100644
--- a/WebCore/khtml/rendering/render_br.h
+++ b/WebCore/khtml/rendering/render_br.h
@@ -38,8 +38,8 @@ public:
 
     virtual const char *renderName() const { return "RenderBR"; }
 
-    virtual void print( QPainter *, int, int, int, int, int, int) {}
-    virtual void printObject( QPainter *, int, int, int, int, int, int) {}
+    virtual void paint( QPainter *, int, int, int, int, int, int, int) {}
+    virtual void paintObject( QPainter *, int, int, int, int, int, int, int) {}
 
     virtual void position(int, int, int, int, int, bool, bool, int) {}
     virtual unsigned int width(unsigned int, unsigned int, const Font *) const { return 0; }
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index b646f3d..a4620cc 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -104,8 +104,8 @@ RenderFlow::~RenderFlow()
     delete specialObjects;
 }
 
-void RenderFlow::print(QPainter *p, int _x, int _y, int _w, int _h,
-                                 int _tx, int _ty)
+void RenderFlow::paint(QPainter *p, int _x, int _y, int _w, int _h,
+                       int _tx, int _ty, int paintPhase)
 {
 
 #ifdef DEBUG_LAYOUT
@@ -130,35 +130,38 @@ void RenderFlow::print(QPainter *p, int _x, int _y, int _w, int _h,
         }
     }
 
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
-void RenderFlow::printObject(QPainter *p, int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty)
+void RenderFlow::paintObject(QPainter *p, int _x, int _y,
+                             int _w, int _h, int _tx, int _ty, int paintPhase)
 {
 
 #ifdef DEBUG_LAYOUT
-//    kdDebug( 6040 ) << renderName() << "(RenderFlow) " << this << " ::printObject() w/h = (" << width() << "/" << height() << ")" << endl;
+//    kdDebug( 6040 ) << renderName() << "(RenderFlow) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
     
-    // 1. print background, borders etc
-    if(hasSpecialObjects() && !isInline() && style()->visibility() == VISIBLE )
-        printBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    // 1. paint background, borders etc
+    if (paintPhase == BACKGROUND_PHASE && 
+        shouldPaintBackgroundOrBorder() && !isInline() && style()->visibility() == VISIBLE )
+        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
 
-    // 2. print contents
+    // 2. paint contents
     RenderObject *child = firstChild();
     while(child != 0)
     {
         if(!child->layer() && !child->isFloating())
-            child->print(p, _x, _y, _w, _h, _tx, _ty);
+            child->paint(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
         child = child->nextSibling();
     }
 
     // 3. paint floats.
-    paintFloats(p, _x, _y, _w, _h, _tx, _ty);
+    if (paintPhase == FLOAT_PHASE)
+        paintFloats(p, _x, _y, _w, _h, _tx, _ty);
     
-    if(!isInline() && !childrenInline() && style()->outlineWidth())
-        printOutline(p, _tx, _ty, width(), height(), style());
+    if (paintPhase == BACKGROUND_PHASE &&
+        !isInline() && !childrenInline() && style()->outlineWidth())
+        paintOutline(p, _tx, _ty, width(), height(), style());
 
 #ifdef BOX_DEBUG
     if ( style() && style()->visibility() == VISIBLE ) {
@@ -184,9 +187,18 @@ void RenderFlow::paintFloats(QPainter *p, int _x, int _y,
     for ( ; (r = it.current()); ++it) {
         // Only paint the object if our noPaint flag isn't set.
         if (r->node->isFloating() && !r->noPaint) {
-            r->node->print(p, _x, _y, _w, _h, 
+            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());
+                           _ty + r->startY - r->node->yPos() + r->node->marginTop(),
+                           BACKGROUND_PHASE);
+            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(),
+                           FLOAT_PHASE);
+            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(), 
+                           FOREGROUND_PHASE);
         }
     }
 }
@@ -1770,7 +1782,7 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
         }
     }
 
-    // prevent non-layouted elements from getting printed by pushing them far above the top of the
+    // prevent non-layouted elements from getting painted by pushing them far above the top of the
     // page
     if (!newChild->isInline())
         newChild->setPos(newChild->xPos(), -500000);
diff --git a/WebCore/khtml/rendering/render_flow.h b/WebCore/khtml/rendering/render_flow.h
index 311e3bc..8788fc2 100644
--- a/WebCore/khtml/rendering/render_flow.h
+++ b/WebCore/khtml/rendering/render_flow.h
@@ -60,10 +60,10 @@ public:
 
     // overrides RenderObject
 
-    virtual void print( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
-    virtual void printObject( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
+    virtual void paint(QPainter *, int x, int y, int w, int h,
+                       int tx, int ty, int paintPhase);
+    virtual void paintObject(QPainter *, int x, int y, int w, int h,
+                             int tx, int ty, int paintPhase);
     void paintFloats(QPainter *p, int _x, int _y,
                      int _w, int _h, int _tx, int _ty);
                                        
diff --git a/WebCore/khtml/rendering/render_html.cpp b/WebCore/khtml/rendering/render_html.cpp
index 704af75..575d135 100644
--- a/WebCore/khtml/rendering/render_html.cpp
+++ b/WebCore/khtml/rendering/render_html.cpp
@@ -43,22 +43,23 @@ RenderHtml::~RenderHtml()
 void RenderHtml::setStyle(RenderStyle *style)
 {
     RenderFlow::setStyle(style);
-    setSpecialObjects(true);
+    setShouldPaintBackgroundOrBorder(true);
 }
 
-void RenderHtml::print(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _ty)
+void RenderHtml::paint(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _ty,
+                       int paintPhase)
 {
     _tx += m_x;
     _ty += m_y;
 
-    //kdDebug(0) << "html:print " << _tx << "/" << _ty << endl;
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    //kdDebug(0) << "html:paint " << _tx << "/" << _ty << endl;
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
-void RenderHtml::printBoxDecorations(QPainter *p,int, int _y,
-				       int, int _h, int _tx, int _ty)
+void RenderHtml::paintBoxDecorations(QPainter *p,int, int _y,
+                                     int, int _h, int _tx, int _ty)
 {
-    //kdDebug( 6040 ) << renderName() << "::printDecorations()" << _tx << "/" << _ty << endl;
+    //kdDebug( 6040 ) << renderName() << "::paintBoxDecorations()" << _tx << "/" << _ty << endl;
 
     QColor c = style()->backgroundColor();
     CachedImage *bg = style()->backgroundImage();
@@ -94,14 +95,14 @@ void RenderHtml::printBoxDecorations(QPainter *p,int, int _y,
 
     // CSS2 14.2:
     // " The background of the box generated by the root element covers the entire canvas."
-    // hence, print the background even in the margin areas (unlike for every other element!)
+    // hence, paint the background even in the margin areas (unlike for every other element!)
     // I just love these little inconsistencies .. :-( (Dirk)
     int my = QMAX(by,_y);
 
-    printBackground(p, c, bg, my, _h, bx, by, bw, bh);
+    paintBackground(p, c, bg, my, _h, bx, by, bw, bh);
 
     if(style()->hasBorder())
-	printBorder( p, _tx, _ty, w, h, style() );
+        paintBorder( p, _tx, _ty, w, h, style() );
 }
 
 void RenderHtml::repaint(bool immediate)
diff --git a/WebCore/khtml/rendering/render_html.h b/WebCore/khtml/rendering/render_html.h
index 9d24f14..0bc7205 100644
--- a/WebCore/khtml/rendering/render_html.h
+++ b/WebCore/khtml/rendering/render_html.h
@@ -43,12 +43,12 @@ namespace khtml {
 
 	virtual bool isHtml() const { return true; }
 	virtual void setStyle(RenderStyle *style);
-	virtual void print( QPainter *, int x, int y, int w, int h, int tx, int ty);
+	virtual void paint(QPainter *, int x, int y, int w, int h, int tx, int ty, int paintPhase);
 	virtual void repaint(bool immediate=false);
 	virtual void layout();
     virtual short containingBlockWidth() const;
     protected:
-	virtual void printBoxDecorations(QPainter *p,int _x, int _y,
+	virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
 					 int _w, int _h, int _tx, int _ty);
     private:
         QScrollView* m_view;
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 042617d..f1b5c4c 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -70,7 +70,7 @@ void RenderImage::setStyle(RenderStyle* _style)
     // init RenderObject attributes
     setInline( !isPositioned() && style()->display()==INLINE );
     setOverhangingContents(style()->height().isPercent());
-    setSpecialObjects(true);
+    setShouldPaintBackgroundOrBorder(true);
 
     CachedObject* co = style()->contentObject();
     if (co && image != co ) {
@@ -179,8 +179,11 @@ void RenderImage::setPixmap( const QPixmap &p, const QRect& r, CachedImage *o)
     }
 }
 
-void RenderImage::printObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, int /*_h*/, int _tx, int _ty)
+void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, int /*_h*/, int _tx, int _ty, int paintPhase)
 {
+    if (paintPhase != FOREGROUND_PHASE)
+        return;
+        
     int cWidth = contentWidth();
     int cHeight = contentHeight();
     int leftBorder = borderLeft();
@@ -294,7 +297,7 @@ void RenderImage::printObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
         }
     }
     if(style()->outlineWidth())
-        printOutline(p, _tx, _ty, width(), height(), style());
+        paintOutline(p, _tx, _ty, width(), height(), style());
 }
 
 void RenderImage::layout()
diff --git a/WebCore/khtml/rendering/render_image.h b/WebCore/khtml/rendering/render_image.h
index 730b99c..77cae48 100644
--- a/WebCore/khtml/rendering/render_image.h
+++ b/WebCore/khtml/rendering/render_image.h
@@ -46,7 +46,7 @@ public:
     virtual bool isRendered() const { return true; }
     virtual bool isImage() const { return false; }
     
-    virtual void printObject( QPainter *p, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int tx, int ty);
+    virtual void paintObject( QPainter *p, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int tx, int ty, int paintPhase);
 
     virtual void layout();
 
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index c72c26d..d595094 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -192,7 +192,7 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h)
 
         // 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 print only sets up the right paint
+        // bounds.  This is really disgusting (that paint only sets up the right paint
         // position after you call into it). -dwh
         //printf("Painting layer at %d %d\n", elt->absBounds.x(), elt->absBounds.y());
     
@@ -217,9 +217,19 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h)
             }
         }
         
-        elt->layer->renderer()->print(p, x, y, w, h,
+        // Paint the layer.
+        elt->layer->renderer()->paint(p, x, y, w, h,
                                       elt->absBounds.x() - elt->layer->renderer()->xPos(),
-                                      elt->absBounds.y() - elt->layer->renderer()->yPos());
+                                      elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                      BACKGROUND_PHASE);
+        elt->layer->renderer()->paint(p, x, y, w, h,
+                                      elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                      elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                      FLOAT_PHASE);
+        elt->layer->renderer()->paint(p, x, y, w, h,
+                                      elt->absBounds.x() - elt->layer->renderer()->xPos(),
+                                      elt->absBounds.y() - elt->layer->renderer()->yPos(),
+                                      FOREGROUND_PHASE);
     }
     
     if (currRect != paintRect)
@@ -247,7 +257,7 @@ RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
 
         // 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 print only sets up the right paint
+        // bounds.  This is really disgusting (that paint only sets up the right paint
         // position after you call into it). -dwh
         //printf("Painting layer at %d %d\n", elt->absBounds.x(), elt->absBounds.y());
 
diff --git a/WebCore/khtml/rendering/render_list.cpp b/WebCore/khtml/rendering/render_list.cpp
index a35b9eb..06ba0e3 100644
--- a/WebCore/khtml/rendering/render_list.cpp
+++ b/WebCore/khtml/rendering/render_list.cpp
@@ -237,24 +237,24 @@ bool RenderListItem::checkChildren() const
     return false;
 }
 
-void RenderListItem::print(QPainter *p, int _x, int _y, int _w, int _h,
-                             int _tx, int _ty)
+void RenderListItem::paint(QPainter *p, int _x, int _y, int _w, int _h,
+                           int _tx, int _ty, int paintPhase)
 {
     if ( !m_height )
         return;
 
 #ifdef DEBUG_LAYOUT
-    kdDebug( 6040 ) << nodeName().string() << "(LI)::print()" << endl;
+    kdDebug( 6040 ) << nodeName().string() << "(LI)::paint()" << endl;
 #endif
-    RenderFlow::print(p, _x, _y, _w, _h, _tx, _ty);
+    RenderFlow::paint(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
-void RenderListItem::printObject(QPainter *p, int _x, int _y,
-                                    int _w, int _h, int _tx, int _ty)
+void RenderListItem::paintObject(QPainter *p, int _x, int _y,
+                                    int _w, int _h, int _tx, int _ty, int paintPhase)
 {
     // ### this should scale with the font size in the body... possible?
     //m_marker->printIcon(p, _tx, _ty);
-    RenderFlow::printObject(p, _x, _y, _w, _h, _tx, _ty);
+    RenderFlow::paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
 // -----------------------------------------------------------
@@ -291,19 +291,19 @@ void RenderListMarker::setStyle(RenderStyle *s)
 }
 
 
-void RenderListMarker::print(QPainter *p, int _x, int _y, int _w, int _h,
-                             int _tx, int _ty)
+void RenderListMarker::paint(QPainter *p, int _x, int _y, int _w, int _h,
+                             int _tx, int _ty, int paintPhase)
 {
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
-void RenderListMarker::printObject(QPainter *p, int, int _y,
-                                    int, int _h, int _tx, int _ty)
+void RenderListMarker::paintObject(QPainter *p, int, int _y,
+                                    int, int _h, int _tx, int _ty, int paintPhase)
 {
     if (style()->visibility() != VISIBLE) return;
 
 #ifdef DEBUG_LAYOUT
-    kdDebug( 6040 ) << nodeName().string() << "(ListMarker)::printObject(" << _tx << ", " << _ty << ")" << endl;
+    kdDebug( 6040 ) << nodeName().string() << "(ListMarker)::paintObject(" << _tx << ", " << _ty << ")" << endl;
 #endif
     p->setFont(style()->font());
     const QFontMetrics fm = p->fontMetrics();
diff --git a/WebCore/khtml/rendering/render_list.h b/WebCore/khtml/rendering/render_list.h
index ee4cef3..66947ac 100644
--- a/WebCore/khtml/rendering/render_list.h
+++ b/WebCore/khtml/rendering/render_list.h
@@ -47,10 +47,10 @@ public:
     // so the marker gets to layout itself. Only needed for
     // list-style-position: inside
 
-    virtual void print(QPainter *p, int x, int y, int w, int h,
-                           int xoff, int yoff);
-    virtual void printObject(QPainter *p, int x, int y, int w, int h,
-                             int xoff, int yoff);
+    virtual void paint(QPainter *p, int x, int y, int w, int h,
+                       int xoff, int yoff, int paintPhase);
+    virtual void paintObject(QPainter *p, int x, int y, int w, int h,
+                             int xoff, int yoff, int paintPhase);
     virtual void layout( );
     virtual void calcMinMaxWidth();
 
@@ -88,10 +88,10 @@ public:
     void calcListValue();
     bool checkChildren() const;
 
-    virtual void print(QPainter *p, int x, int y, int w, int h,
-                       int xoff, int yoff);
-    virtual void printObject(QPainter *p, int x, int y, int w, int h,
-                       int xoff, int yoff);
+    virtual void paint(QPainter *p, int x, int y, int w, int h,
+                       int xoff, int yoff, int paintPhase);
+    virtual void paintObject(QPainter *p, int x, int y, int w, int h,
+                       int xoff, int yoff, int paintPhase);
 
     virtual void layout( );
 
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index d488b9a..cbe9417 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -120,7 +120,7 @@ m_floating( false ),
 m_positioned( false ),
 m_overhangingContents( false ),
 m_relPositioned( false ),
-m_printSpecial( false ),
+m_paintBackground( false ),
 
 m_isAnonymous( false ),
 m_recalcMinMax( false ),
@@ -534,7 +534,7 @@ void RenderObject::drawBorder(QPainter *p, int x1, int y1, int x2, int y2,
         p->setRasterOp(Qt::CopyROP);
 }
 
-void RenderObject::printBorder(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin, bool end)
+void RenderObject::paintBorder(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin, bool end)
 {
     const QColor& tc = style->borderTopColor();
     const QColor& bc = style->borderBottomColor();
@@ -598,7 +598,7 @@ void RenderObject::printBorder(QPainter *p, int _tx, int _ty, int w, int h, cons
     }
 }
 
-void RenderObject::printOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style)
+void RenderObject::paintOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style)
 {
     int ow = style->outlineWidth();
     if(!ow) return;
@@ -624,9 +624,10 @@ void RenderObject::printOutline(QPainter *p, int _tx, int _ty, int w, int h, con
 
 }
 
-void RenderObject::print( QPainter *p, int x, int y, int w, int h, int tx, int ty)
+void RenderObject::paint(QPainter *p, int x, int y, int w, int h, int tx, int ty,
+                         int paintPhase)
 {
-    printObject(p, x, y, w, h, tx, ty);
+    paintObject(p, x, y, w, h, tx, ty, paintPhase);
 }
 
 void RenderObject::repaintRectangle(int x, int y, int w, int h, bool immediate, bool f)
@@ -696,7 +697,7 @@ void RenderObject::dump(QTextStream *stream, QString ind) const
     if (isText()) { *stream << " text"; }
     if (isInline()) { *stream << " inline"; }
     if (isReplaced()) { *stream << " replaced"; }
-    if (hasSpecialObjects()) { *stream << " specialObjects"; }
+    if (shouldPaintBackgroundOrBorder()) { *stream << " paintBackground"; }
     if (layouted()) { *stream << " layouted"; }
     if (minMaxKnown()) { *stream << " minMaxKnown"; }
     if (overhangingContents()) { *stream << " overhangingContents"; }
@@ -730,7 +731,7 @@ void RenderObject::setStyle(RenderStyle *style)
     m_floating = false;
     m_positioned = false;
     m_relPositioned = false;
-    m_printSpecial = false;
+    m_paintBackground = false;
     // no support for changing the display type dynamically... object must be
     // detached and re-attached as a different type
     //m_inline = true;
@@ -743,21 +744,22 @@ void RenderObject::setStyle(RenderStyle *style)
 
     if (m_style)
     {
-	m_style->ref();
+        m_style->ref();
         nb = m_style->backgroundImage();
     }
     if (oldStyle)
     {
         ob = oldStyle->backgroundImage();
-	oldStyle->deref();
+        oldStyle->deref();
     }
 
     if( ob != nb ) {
-	if(ob) ob->deref(this);
-	if(nb) nb->ref(this);
+        if(ob) ob->deref(this);
+        if(nb) nb->ref(this);
     }
 
-    setSpecialObjects( m_style->backgroundColor().isValid() || m_style->hasBorder() || nb );
+    setShouldPaintBackgroundOrBorder(m_style->backgroundColor().isValid() || 
+                                     m_style->hasBorder() || nb );
     m_hasFirstLine = (style->getPseudoStyle(RenderStyle::FIRST_LINE) != 0);
 
     if ( d >= RenderStyle::Position && m_parent ) {
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 5e821a3..6fd8b4e 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -50,6 +50,21 @@ class RenderArena;
 #define KHTMLAssert( x )
 #endif
 
+// The painting of a layer occurs in three distinct phases.  Each phase involves
+// a recursive descent into the layer's render objects.
+
+// The first phase is the background phase.  The backgrounds and borders of all blocks
+// are painted.  Inlines are not painted at all.
+#define BACKGROUND_PHASE			0 
+
+// Floats must paint above block backgrounds but entirely below inline content that can
+// overlap them.  
+#define FLOAT_PHASE					1
+
+// In the foreground phase, all inlines are fully painted.  Inline replaced elements will
+// get all three phases invoked on them during this phase.
+#define FOREGROUND_PHASE			2
+
 namespace DOM {
     class HTMLAreaElementImpl;
     class DOMString;
@@ -168,7 +183,7 @@ public:
     bool isInline() const { return m_inline; }  // inline object
     bool mouseInside() const { return m_mouseInside; }
     bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
-    bool hasSpecialObjects() const { return m_printSpecial; }
+    bool shouldPaintBackgroundOrBorder() const { return m_paintBackground; }
     bool layouted() const   { return m_layouted; }
     bool minMaxKnown() const{ return m_minMaxKnown; }
     bool overhangingContents() const { return m_overhangingContents; }
@@ -211,7 +226,7 @@ public:
     void setFloating(bool b=true) { m_floating = b; }
     void setInline(bool b=true) { m_inline = b; }
     void setMouseInside(bool b=true) { m_mouseInside = b; }
-    void setSpecialObjects(bool b=true) { m_printSpecial = b; }
+    void setShouldPaintBackgroundOrBorder(bool b=true) { m_paintBackground = b; }
     void setRenderText() { m_isText = true; }
     void setReplaced(bool b=true) { m_replaced = b; }
     void setIsSelectionBorder(bool b=true) { m_isSelectionBorder = b; }
@@ -227,15 +242,17 @@ public:
     virtual short baselinePosition( bool firstLine ) const;
 
     /*
-     * Print the object and its children, clipped by (x|y|w|h).
+     * Paint the object and its children, clipped by (x|y|w|h).
      * (tx|ty) is the calculated position of the parent
      */
-    virtual void print( QPainter *p, int x, int y, int w, int h, int tx, int ty);
+    virtual void paint(QPainter *p, int x, int y, int w, int h, int tx, int ty, 
+                       int paintPhase);
 
-    virtual void printObject( QPainter */*p*/, int /*x*/, int /*y*/,
-                        int /*w*/, int /*h*/, int /*tx*/, int /*ty*/) {}
-    void printBorder(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin=true, bool end=true);
-    void printOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style);
+    virtual void paintObject( QPainter */*p*/, int /*x*/, int /*y*/,
+                              int /*w*/, int /*h*/, int /*tx*/, int /*ty*/,
+                              int paintPhase /*paintPhase*/) {}
+    void paintBorder(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin=true, bool end=true);
+    void paintOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style);
 
 
     /*
@@ -529,7 +546,8 @@ private:
     bool m_positioned                : 1;
     bool m_overhangingContents : 1;
     bool m_relPositioned             : 1;
-    bool m_printSpecial              : 1; // if the box has something special to print (background, border, etc)
+    bool m_paintBackground           : 1; // if the box has something to paint in the
+                                          // background painting phase (background, border, etc)
 
     bool m_isAnonymous               : 1;
     bool m_recalcMinMax 	     : 1;
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index cd15f24..67d136f 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -52,9 +52,12 @@ RenderReplaced::RenderReplaced(DOM::NodeImpl* node)
     m_intrinsicHeight = 150;
 }
 
-void RenderReplaced::print( QPainter *p, int _x, int _y, int _w, int _h,
-                            int _tx, int _ty)
+void RenderReplaced::paint(QPainter *p, int _x, int _y, int _w, int _h,
+                           int _tx, int _ty, int paintPhase)
 {
+    if (paintPhase != FOREGROUND_PHASE)
+        return;
+        
     // not visible or nont even once layouted?
     if (style()->visibility() != VISIBLE || m_y <=  -500000)  return;
 
@@ -64,9 +67,10 @@ void RenderReplaced::print( QPainter *p, int _x, int _y, int _w, int _h,
     if((_ty > _y + _h) || (_ty + m_height < _y))
         return;
 
-    if(hasSpecialObjects()) printBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    if(shouldPaintBackgroundOrBorder()) 
+        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
 
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
 void RenderReplaced::calcMinMaxWidth()
@@ -225,21 +229,23 @@ void RenderWidget::setStyle(RenderStyle *_style)
     }
 
     // do not paint background or borders for widgets
-    setSpecialObjects(false);
+    setShouldPaintBackgroundOrBorder(false);
 }
 
 #if APPLE_CHANGES
-void RenderWidget::printObject(QPainter *p, int x, int y, int width, int height, int _tx, int _ty)
+void RenderWidget::paintObject(QPainter *p, int x, int y, int width, int height, int _tx, int _ty,
+                               int paintPhase)
 #else
-void RenderWidget::printObject(QPainter* /*p*/, int, int, int, int, int _tx, int _ty)
+void RenderWidget::paintObject(QPainter* /*p*/, int, int, int, int, int _tx, int _ty,
+                               int paintPhase)
 #endif
 {
-    if (!m_widget || !m_view)
-	return;
+    if (!m_widget || !m_view || paintPhase != FOREGROUND_PHASE)
+        return;
 
     if (style()->visibility() != VISIBLE) {
-	m_widget->hide();
-	return;
+        m_widget->hide();
+        return;
     }
 
     int xPos = _tx+borderLeft()+paddingLeft();
diff --git a/WebCore/khtml/rendering/render_replaced.h b/WebCore/khtml/rendering/render_replaced.h
index ee6ee02..a67857a 100644
--- a/WebCore/khtml/rendering/render_replaced.h
+++ b/WebCore/khtml/rendering/render_replaced.h
@@ -43,9 +43,10 @@ public:
 
     virtual void calcMinMaxWidth();
 
-    virtual void print( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
-    virtual void printObject(QPainter *p, int x, int y, int w, int h, int tx, int ty) = 0;
+    virtual void paint(QPainter *, int x, int y, int w, int h,
+                       int tx, int ty, int paintPhase);
+    virtual void paintObject(QPainter *p, int x, int y, int w, int h, int tx, int ty,
+                             int paintPhase) = 0;
 
     virtual short intrinsicWidth() const { return m_intrinsicWidth; }
     virtual int intrinsicHeight() const { return m_intrinsicHeight; }
@@ -70,7 +71,8 @@ public:
 
     virtual void setStyle(RenderStyle *style);
 
-    virtual void printObject(QPainter *p, int x, int y, int w, int h, int tx, int ty);
+    virtual void paintObject(QPainter *p, int x, int y, int w, int h, int tx, int ty,
+                             int paintPhase);
 
     virtual bool isWidget() const { return true; };
 
diff --git a/WebCore/khtml/rendering/render_root.cpp b/WebCore/khtml/rendering/render_root.cpp
index 025f897..b2d6282 100644
--- a/WebCore/khtml/rendering/render_root.cpp
+++ b/WebCore/khtml/rendering/render_root.cpp
@@ -191,40 +191,37 @@ bool RenderRoot::absolutePosition(int &xPos, int &yPos, bool f)
     return true;
 }
 
-void RenderRoot::print(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _ty)
+void RenderRoot::paint(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _ty,
+                       int paintPhase)
 {
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 }
 
-void RenderRoot::printObject(QPainter *p, int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty)
+void RenderRoot::paintObject(QPainter *p, int _x, int _y,
+                             int _w, int _h, int _tx, int _ty, int paintPhase)
 {
 #ifdef DEBUG_LAYOUT
-    kdDebug( 6040 ) << renderName() << "(RenderFlow) " << this << " ::printObject() w/h = (" << width() << "/" << height() << ")" << endl;
+    kdDebug( 6040 ) << renderName() << "(RenderFlow) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
-    // 1. print background, borders etc
-    if(hasSpecialObjects() && !isInline())
-        printBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    // 1. paint background, borders etc
+    if (paintPhase == BACKGROUND_PHASE && shouldPaintBackgroundOrBorder() && !isInline())
+        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
 
-    // 2. print contents
+    // 2. paint contents
     RenderObject *child = firstChild();
     while(child != 0) {
         if(!child->layer() && !child->isFloating()) {
-            child->print(p, _x, _y, _w, _h, _tx, _ty);
+            child->paint(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
         }
         child = child->nextSibling();
     }
 
-    // 3. print floats and other non-flow objects.
-    // we have to do that after the contents otherwise they would get obscured by background settings.
-    // it is anyway undefined if regular text is above fixed objects or the other way round.
+#ifdef BOX_DEBUG
     if (m_view)
     {
         _tx += m_view->contentsX();
         _ty += m_view->contentsY();
     }
-
-#ifdef BOX_DEBUG
     outlineBox(p, _tx, _ty);
 #endif
 
diff --git a/WebCore/khtml/rendering/render_root.h b/WebCore/khtml/rendering/render_root.h
index ae0ff4a..adaee8a 100644
--- a/WebCore/khtml/rendering/render_root.h
+++ b/WebCore/khtml/rendering/render_root.h
@@ -54,9 +54,10 @@ public:
 
     virtual void repaint(bool immediate=false);
     virtual void repaintRectangle(int x, int y, int w, int h, bool immediate = false, bool f=false);
-    virtual void print( QPainter *, int x, int y, int w, int h, int tx, int ty);
-    void printObject(QPainter *p, int _x, int _y,
-                     int _w, int _h, int _tx, int _ty);
+    virtual void paint(QPainter *, int x, int y, int w, int h, int tx, int ty,
+                       int paintPhase);
+    void paintObject(QPainter *p, int _x, int _y,
+                     int _w, int _h, int _tx, int _ty, int paintPhase);
 
     virtual void setSelection(RenderObject *s, int sp, RenderObject *e, int ep);
     virtual void clearSelection(bool doRepaint=true);
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index 1fbd8ce..213e5b9 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -1614,8 +1614,8 @@ void RenderTable::setCellWidths()
 
 }
 
-void RenderTable::print( QPainter *p, int _x, int _y,
-                                  int _w, int _h, int _tx, int _ty)
+void RenderTable::paint(QPainter *p, int _x, int _y,
+                        int _w, int _h, int _tx, int _ty, int paintPhase)
 {
 
 //     if(!layouted()) return;
@@ -1624,7 +1624,7 @@ void RenderTable::print( QPainter *p, int _x, int _y,
     _ty += yPos();
 
 #ifdef TABLE_PRINT
-    kdDebug( 6040 ) << "RenderTable::print() w/h = (" << width() << "/" << height() << ")" << endl;
+    kdDebug( 6040 ) << "RenderTable::paint() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
     if (!overhangingContents() && !isRelPositioned() && !isPositioned())
     {
@@ -1633,25 +1633,25 @@ void RenderTable::print( QPainter *p, int _x, int _y,
     }
 
 #ifdef TABLE_PRINT
-     kdDebug( 6040 ) << "RenderTable::print(2) " << _tx << "/" << _ty << " (" << _x << "/" << _y << ")" << endl;
+     kdDebug( 6040 ) << "RenderTable::paint(2) " << _tx << "/" << _ty << " (" << _x << "/" << _y << ")" << endl;
 #endif
     // the case below happens during parsing
-    // when we have a new table that never got layouted. Don't print it.
+    // when we have a new table that never got layouted. Don't paint it.
     if ( totalRows == 1 && rowInfo[1].height == 0 )
 	return;
 
-    if(style()->visibility() == VISIBLE)
-         printBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    if (paintPhase == BACKGROUND_PHASE && style()->visibility() == VISIBLE)
+         paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
 
     int topextra = 0;
 
     if ( tCaption ) {
-        tCaption->print( p, _x, _y, _w, _h, _tx, _ty );
+        tCaption->paint( p, _x, _y, _w, _h, _tx, _ty, paintPhase );
         if (tCaption->style()->captionSide() != CAPBOTTOM)
             topextra = - borderTopExtra();
     }
 
-    // check which rows and cols are visible and only print these
+    // check which rows and cols are visible and only paint these
     // ### fixme: could use a binary search here
     unsigned int startrow = 0;
     unsigned int endrow = totalRows;
@@ -1687,9 +1687,9 @@ void RenderTable::print( QPainter *p, int _x, int _y,
             if ( (r < endrow - 1) && (cells[r+1][c] == cell) )
                 continue;
 #ifdef DEBUG_LAYOUT
-	    kdDebug( 6040 ) << "printing cell " << r << "/" << c << endl;
+	    kdDebug( 6040 ) << "painting cell " << r << "/" << c << endl;
 #endif
-	    cell->print( p, _x, _y, _w, _h, _tx, _ty);
+	    cell->paint( p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 	}
     }
 
@@ -2059,7 +2059,7 @@ RenderTableCell::RenderTableCell(DOM::NodeImpl* _node)
   cellPercentageHeight = 0;
   m_table = 0;
   rowimpl = 0;
-  setSpecialObjects(true);
+  setShouldPaintBackgroundOrBorder(true);
   _topExtra = 0;
   _bottomExtra = 0;
 }
@@ -2206,7 +2206,7 @@ short RenderTableCell::baselinePosition( bool ) const
 void RenderTableCell::setStyle( RenderStyle *style )
 {
     RenderFlow::setStyle( style );
-    setSpecialObjects(true);
+    setShouldPaintBackgroundOrBorder(true);
 }
 
 #ifdef BOX_DEBUG
@@ -2220,12 +2220,12 @@ static void outlineBox(QPainter *p, int _tx, int _ty, int w, int h)
 }
 #endif
 
-void RenderTableCell::print(QPainter *p, int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty)
+void RenderTableCell::paint(QPainter *p, int _x, int _y,
+                            int _w, int _h, int _tx, int _ty, int paintPhase)
 {
 
 #ifdef TABLE_PRINT
-    kdDebug( 6040 ) << renderName() << "(RenderTableCell)::print() w/h = (" << width() << "/" << height() << ")" << endl;
+    kdDebug( 6040 ) << renderName() << "(RenderTableCell)::paint() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
 
 //    if (!layouted())
@@ -2238,7 +2238,7 @@ void RenderTableCell::print(QPainter *p, int _x, int _y,
     if(!overhangingContents() && ((_ty-_topExtra > _y + _h)
         || (_ty + m_height+_topExtra+_bottomExtra < _y))) return;
 
-    printObject(p, _x, _y, _w, _h, _tx, _ty);
+    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintPhase);
 
 #ifdef BOX_DEBUG
     ::outlineBox( p, _tx, _ty - _topExtra, width(), height() + borderTopExtra() + borderBottomExtra());
@@ -2246,10 +2246,10 @@ void RenderTableCell::print(QPainter *p, int _x, int _y,
 }
 
 
-void RenderTableCell::printBoxDecorations(QPainter *p,int, int _y,
-                                       int, int _h, int _tx, int _ty)
+void RenderTableCell::paintBoxDecorations(QPainter *p,int, int _y,
+                                          int, int _h, int _tx, int _ty)
 {
-    //kdDebug( 6040 ) << renderName() << "::printDecorations()" << endl;
+    //kdDebug( 6040 ) << renderName() << "::paintBoxDecorations()" << endl;
 
     int w = width();
     int h = height() + borderTopExtra() + borderBottomExtra();
@@ -2277,10 +2277,10 @@ void RenderTableCell::printBoxDecorations(QPainter *p,int, int _y,
         bg = parent()->parent()->style()->backgroundImage();
 
     if ( bg || c.isValid() )
-	printBackground(p, c, bg, my, mh, _tx, _ty, w, h);
+        paintBackground(p, c, bg, my, mh, _tx, _ty, w, h);
 
     if(style()->hasBorder())
-        printBorder(p, _tx, _ty, w, h, style());
+        paintBorder(p, _tx, _ty, w, h, style());
 }
 
 void RenderTableCell::repaint(bool immediate)
diff --git a/WebCore/khtml/rendering/render_table.h b/WebCore/khtml/rendering/render_table.h
index 0e61f7d..f43a095 100644
--- a/WebCore/khtml/rendering/render_table.h
+++ b/WebCore/khtml/rendering/render_table.h
@@ -106,8 +106,8 @@ public:
 
     // overrides
     virtual void addChild(RenderObject *child, RenderObject *beforeChild = 0);
-    virtual void print( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
+    virtual void paint(QPainter *, int x, int y, int w, int h,
+                       int tx, int ty, int paintPhase);
     virtual void layout();
     virtual void calcMinMaxWidth();
     virtual void close();
@@ -406,8 +406,8 @@ public:
     virtual void setTable(RenderTable *t) { m_table = t; }
     RenderTable *table() const { return m_table; }
 
-    virtual void print( QPainter* p, int x, int y,
-                        int w, int h, int tx, int ty);
+    virtual void paint(QPainter* p, int x, int y,
+                       int w, int h, int tx, int ty, int paintPhase);
 
     virtual void close();
 
@@ -435,7 +435,7 @@ public:
 protected:
     RenderTable *m_table;
 
-    virtual void printBoxDecorations(QPainter *p,int _x, int _y,
+    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
                                      int _w, int _h, int _tx, int _ty);
 
     short _row;
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 914ca10..170239d 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -59,7 +59,7 @@ void TextSlave::operator delete(void* ptr, size_t sz) {
     *szPtr = sz;
 }
 
-void TextSlave::printSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos)
+void TextSlave::paintSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos)
 {
     if(startPos > m_len) return;
     if(startPos < 0) startPos = 0;
@@ -78,13 +78,13 @@ void TextSlave::printSelection(const Font *f, RenderText *text, QPainter *p, Ren
 #endif
     ty += m_baseline;
 
-    //kdDebug( 6040 ) << "textSlave::printing(" << s.string() << ") at(" << x+_tx << "/" << y+_ty << ")" << endl;
+    //kdDebug( 6040 ) << "textSlave::painting(" << s.string() << ") at(" << x+_tx << "/" << y+_ty << ")" << endl;
     f->drawText(p, m_x + tx, m_y + ty, text->str->s, text->str->l, m_start, m_len,
 		m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, startPos, endPos, c);
     p->restore();
 }
 
-void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int deco, bool begin, bool end)
+void TextSlave::paintDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int deco, bool begin, bool end)
 {
     _tx += m_x;
     _ty += m_y;
@@ -117,7 +117,7 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
     // support it. Lars
 }
 
-void TextSlave::printBoxDecorations(QPainter *pt, RenderStyle* style, RenderText *p, int _tx, int _ty, bool begin, bool end)
+void TextSlave::paintBoxDecorations(QPainter *pt, RenderStyle* style, RenderText *p, int _tx, int _ty, bool begin, bool end)
 {
     int topExtra = p->borderTop() + p->paddingTop();
     int bottomExtra = p->borderBottom() + p->paddingBottom();
@@ -151,7 +151,7 @@ void TextSlave::printBoxDecorations(QPainter *pt, RenderStyle* style, RenderText
 #endif
 
     if(style->hasBorder())
-        p->printBorder(pt, _tx, _ty, width, height, style, begin, end);
+        p->paintBorder(pt, _tx, _ty, width, height, style, begin, end);
 }
 
 FindSelectionResult TextSlave::checkSelectionPoint(int _x, int _y, int _tx, int _ty, const Font *f, RenderText *text, int & offset, short lineHeight)
@@ -540,8 +540,8 @@ int RenderText::rightmostPosition() const
     return 0;
 }
 
-void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
-                      int tx, int ty)
+void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
+                             int tx, int ty, int paintPhase)
 {
     int ow = style()->outlineWidth();
     RenderStyle* pseudoStyle = style()->getPseudoStyle(RenderStyle::FIRST_LINE);
@@ -632,10 +632,10 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
 #if APPLE_CHANGES
             if (drawDecorations)
 #endif
-            if((hasSpecialObjects()  &&
+            if((shouldPaintBackgroundOrBorder()  &&
                 (parent()->isInline() || pseudoStyle)) &&
                (!pseudoStyle || s->m_firstLine))
-                s->printBoxDecorations(p, _style, this, tx, ty, si == 0, si == (int)m_lines.count()-1);
+                s->paintBoxDecorations(p, _style, this, tx, ty, si == 0, si == (int)m_lines.count()-1);
 
 
 #if APPLE_CHANGES
@@ -652,7 +652,7 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
             if(d != TDNONE)
             {
                 p->setPen(_style->textDecorationColor());
-                s->printDecoration(p, this, tx, ty, d, si == 0, si == ( int ) m_lines.count()-1);
+                s->paintDecoration(p, this, tx, ty, d, si == 0, si == ( int ) m_lines.count()-1);
             }
 
 #if APPLE_CHANGES
@@ -667,9 +667,9 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
 		int offset = s->m_start;
 		int sPos = QMAX( startPos - offset, 0 );
 		int ePos = QMIN( endPos - offset, s->m_len );
-                //kdDebug(6040) << this << " printSelection with startPos=" << sPos << " endPos=" << ePos << endl;
+                //kdDebug(6040) << this << " paintSelection with startPos=" << sPos << " endPos=" << ePos << endl;
 		if ( sPos < ePos )
-		    s->printSelection(font, this, p, _style, tx, ty, sPos, ePos);
+		    s->paintSelection(font, this, p, _style, tx, ty, sPos, ePos);
 
             }
 
@@ -717,15 +717,16 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
 	    linerects.append(new QRect(minx, outlinebox_y, maxx-minx, m_lineHeight));
 	    linerects.append(new QRect());
 	    for (unsigned int i = 1; i < linerects.count() - 1; i++)
-                printTextOutline(p, tx, ty, *linerects.at(i-1), *linerects.at(i), *linerects.at(i+1));
+            paintTextOutline(p, tx, ty, *linerects.at(i-1), *linerects.at(i), *linerects.at(i+1));
 	  }
     }
 }
 
-void RenderText::print( QPainter *p, int x, int y, int w, int h,
-                      int tx, int ty)
+void RenderText::paint(QPainter *p, int x, int y, int w, int h,
+                       int tx, int ty, int paintPhase)
 {
-    if (style()->visibility() != VISIBLE) return;
+    if (paintPhase != FOREGROUND_PHASE || style()->visibility() != VISIBLE) 
+        return;
 
     int s = m_lines.count() - 1;
     if ( s < 0 ) return;
@@ -734,7 +735,7 @@ void RenderText::print( QPainter *p, int x, int y, int w, int h,
     if ( ty + m_lines[0]->m_y > y + h + 64 ) return;
     if ( ty + m_lines[s]->m_y + m_lines[s]->m_baseline + m_lineHeight + 64 < y ) return;
 
-    printObject(p, x, y, w, h, tx, ty);
+    paintObject(p, x, y, w, h, tx, ty, paintPhase);
 }
 
 void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS, 
@@ -1144,7 +1145,7 @@ const Font *RenderText::htmlFont(bool firstLine) const
     return f;
 }
 
-void RenderText::printTextOutline(QPainter *p, int tx, int ty, const QRect &lastline, const QRect &thisline, const QRect &nextline)
+void RenderText::paintTextOutline(QPainter *p, int tx, int ty, const QRect &lastline, const QRect &thisline, const QRect &nextline)
 {
   int ow = style()->outlineWidth();
   EBorderStyle os = style()->outlineStyle();
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index 875483f..a561b88 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -72,9 +72,9 @@ private:
 
 public:
 
-    void printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int decoration, bool begin, bool end);
-    void printBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, bool begin, bool end);
-    void printSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos);
+    void paintDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int decoration, bool begin, bool end);
+    void paintBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, bool begin, bool end);
+    void paintSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos);
 
     // Return before, after (offset set to max), or inside the text, at @p offset
     FindSelectionResult checkSelectionPoint(int _x, int _y, int _tx, int _ty, const Font *f, RenderText *text, int & offset, short lineheight);
@@ -133,10 +133,10 @@ public:
 
     virtual bool isRendered() const { return true; }
 
-    virtual void print( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
-    virtual void printObject( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty);
+    virtual void paint(QPainter *, int x, int y, int w, int h,
+                       int tx, int ty, int paintPhase);
+    virtual void paintObject(QPainter *, int x, int y, int w, int h,
+                             int tx, int ty, int paintPhase);
 
     void deleteSlaves(RenderArena *renderArena = 0);
     virtual void detach(RenderArena* renderArena);
@@ -215,7 +215,7 @@ public:
 #endif
 
 protected:
-    void printTextOutline(QPainter *p, int tx, int ty, const QRect &prevLine, const QRect &thisLine, const QRect &nextLine);
+    void paintTextOutline(QPainter *p, int tx, int ty, const QRect &prevLine, const QRect &thisLine, const QRect &nextLine);
 
 #if !APPLE_CHANGES
     TextSlave * findTextSlave( int offset, int &pos );

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list