[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 08:26:11 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit eaae0512c097f8866e41219891f23eeb24451c85
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 11 19:52:38 2004 +0000

    	Convert paint methods over to use a new PaintInfo struct.  Eliminate the paintObject method.
    
            Reviewed by kocienda
    
            * khtml/rendering/render_block.cpp:
            (khtml::RenderBlock::paint):
            (khtml::RenderBlock::paintObject):
            (khtml::RenderBlock::paintFloats):
            * khtml/rendering/render_block.h:
            * khtml/rendering/render_box.cpp:
            (RenderBox::paint):
            (RenderBox::paintRootBoxDecorations):
            (RenderBox::paintBoxDecorations):
            * khtml/rendering/render_box.h:
            * khtml/rendering/render_br.h:
            (khtml::RenderBR::paint):
            * khtml/rendering/render_canvas.cpp:
            (RenderCanvas::paint):
            (RenderCanvas::paintBoxDecorations):
            * khtml/rendering/render_canvas.h:
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::paintLineBoxBackgroundBorder):
            (RenderFlow::paintLineBoxDecorations):
            * khtml/rendering/render_flow.h:
            * khtml/rendering/render_form.cpp:
            (RenderFieldset::paintBoxDecorations):
            * khtml/rendering/render_form.h:
            * khtml/rendering/render_image.cpp:
            (RenderImage::paint):
            (RenderImage::updateFromElement):
            * khtml/rendering/render_image.h:
            * khtml/rendering/render_inline.cpp:
            (RenderInline::paint):
            * khtml/rendering/render_inline.h:
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::paintLayer):
            * khtml/rendering/render_line.cpp:
            (InlineFlowBox::paintBackgroundAndBorder):
            (InlineFlowBox::paintDecorations):
            * khtml/rendering/render_line.h:
            (khtml::InlineRunBox::paintBackgroundAndBorder):
            (khtml::InlineRunBox::paintDecorations):
            * khtml/rendering/render_list.cpp:
            (RenderListItem::paint):
            (RenderListMarker::paint):
            * khtml/rendering/render_list.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::paint):
            * khtml/rendering/render_object.h:
            (khtml::RenderObject::PaintInfo::PaintInfo):
            (khtml::RenderObject::paintBoxDecorations):
            * khtml/rendering/render_replaced.cpp:
            (RenderReplaced::shouldPaint):
            (RenderWidget::paint):
            * khtml/rendering/render_replaced.h:
            * khtml/rendering/render_table.cpp:
            (RenderTable::paint):
            (RenderTable::paintBoxDecorations):
            (RenderTableSection::paint):
            (RenderTableCell::paint):
            (RenderTableCell::paintBoxDecorations):
            * khtml/rendering/render_table.h:
            * khtml/rendering/render_text.cpp:
            (RenderText::paint):
            * khtml/rendering/render_text.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 33c9b24..31c852a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,71 @@
+2004-02-11  David Hyatt  <hyatt at apple.com>
+
+	Convert paint methods over to use a new PaintInfo struct.  Eliminate the paintObject method.
+	
+        Reviewed by kocienda
+
+        * khtml/rendering/render_block.cpp:
+        (khtml::RenderBlock::paint):
+        (khtml::RenderBlock::paintObject):
+        (khtml::RenderBlock::paintFloats):
+        * khtml/rendering/render_block.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::paint):
+        (RenderBox::paintRootBoxDecorations):
+        (RenderBox::paintBoxDecorations):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_br.h:
+        (khtml::RenderBR::paint):
+        * khtml/rendering/render_canvas.cpp:
+        (RenderCanvas::paint):
+        (RenderCanvas::paintBoxDecorations):
+        * khtml/rendering/render_canvas.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::paintLineBoxBackgroundBorder):
+        (RenderFlow::paintLineBoxDecorations):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderFieldset::paintBoxDecorations):
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::paint):
+        (RenderImage::updateFromElement):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::paint):
+        * khtml/rendering/render_inline.h:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::paintLayer):
+        * khtml/rendering/render_line.cpp:
+        (InlineFlowBox::paintBackgroundAndBorder):
+        (InlineFlowBox::paintDecorations):
+        * khtml/rendering/render_line.h:
+        (khtml::InlineRunBox::paintBackgroundAndBorder):
+        (khtml::InlineRunBox::paintDecorations):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::paint):
+        (RenderListMarker::paint):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::paint):
+        * khtml/rendering/render_object.h:
+        (khtml::RenderObject::PaintInfo::PaintInfo):
+        (khtml::RenderObject::paintBoxDecorations):
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::shouldPaint):
+        (RenderWidget::paint):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::paint):
+        (RenderTable::paintBoxDecorations):
+        (RenderTableSection::paint):
+        (RenderTableCell::paint):
+        (RenderTableCell::paintBoxDecorations):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::paint):
+        * khtml/rendering/render_text.h:
+
 2004-02-11  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by me
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 2cf12a2..d37f80e 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -1147,7 +1147,7 @@ void RenderBlock::repaintObjectsBeforeLayout()
     }
 }
 
-void RenderBlock::paint(QPainter* p, int _x, int _y, int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderBlock::paint(PaintInfo& i, int _tx, int _ty)
 {
     _tx += m_x;
     _ty += m_y;
@@ -1166,31 +1166,27 @@ void RenderBlock::paint(QPainter* p, int _x, int _y, int _w, int _h, int _tx, in
         if (m_firstLineBox && m_firstLineBox->topOverflow() < 0)
             yPos += m_firstLineBox->topOverflow();
         
-        int os = 2*maximalOutlineSize(paintAction);
-        if( (yPos >= _y + _h + os) || (_ty + h <= _y - os))
+        int os = 2*maximalOutlineSize(i.phase);
+        if( (yPos >= i.r.y() + i.r.height() + os) || (_ty + h <= i.r.y() - os))
             return;
     }
 
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    return RenderBlock::paintObject(i, _tx, _ty);
 }
 
-void RenderBlock::paintObject(QPainter *p, int _x, int _y,
-                              int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderBlock::paintObject(PaintInfo& i, int _tx, int _ty)
 {
-
-#ifdef DEBUG_LAYOUT
-    //    kdDebug( 6040 ) << renderName() << "(RenderBlock) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
-#endif
+    PaintAction paintAction = i.phase;
 
     // If we're a repositioned run-in, don't paint background/borders.
     bool inlineFlow = isInlineFlow();
-    bool isPrinting = (p->device()->devType() == QInternal::Printer);
+    bool isPrinting = (i.p->device()->devType() == QInternal::Printer);
 
     // 1. paint background, borders etc
     if (!inlineFlow &&
         (paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground) &&
         shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE) {
-        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+        paintBoxDecorations(i, _tx, _ty);
     }
 
     // We're done.  We don't bother painting any children.
@@ -1199,8 +1195,9 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
     // We don't paint our own background, but we do let the kids paint their backgrounds.
     if (paintAction == PaintActionChildBackgrounds)
         paintAction = PaintActionChildBackground;
+    PaintInfo paintInfo(i.p, i.r, paintAction);
     
-    paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    paintLineBoxBackgroundBorder(paintInfo, _tx, _ty);
 
     // 2. paint contents
     int scrolledX = _tx;
@@ -1210,32 +1207,33 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
     for (RenderObject *child = firstChild(); child; child = child->nextSibling()) {        
         // Check for page-break-before: always, and if it's set, break and bail.
         if (isPrinting && !childrenInline() && child->style()->pageBreakBefore() == PBALWAYS &&
-            inRootBlockContext() && (_ty + child->yPos()) > _y && (_ty + child->yPos()) < _y + _h) {
+            inRootBlockContext() && (_ty + child->yPos()) > i.r.y() && 
+            (_ty + child->yPos()) < i.r.y() + i.r.height()) {
             canvas()->setBestTruncatedAt(_ty + child->yPos(), this, true);
             return;
         }
         
         if (!child->layer() && !child->isFloating())
-            child->paint(p, _x, _y, _w, _h, scrolledX, scrolledY, paintAction);
+            child->paint(paintInfo, scrolledX, scrolledY);
         
         // Check for page-break-after: always, and if it's set, break and bail.
         if (isPrinting && !childrenInline() && child->style()->pageBreakAfter() == PBALWAYS && 
-            inRootBlockContext() && (_ty + child->yPos() + child->height()) > _y && 
-            (_ty + child->yPos() + child->height()) < _y + _h) {
+            inRootBlockContext() && (_ty + child->yPos() + child->height()) > i.r.y() && 
+            (_ty + child->yPos() + child->height()) < i.r.y() + i.r.height()) {
             canvas()->setBestTruncatedAt(_ty + child->yPos() + child->height() + child->collapsedMarginBottom(), this, true);
             return;
         }
     }
-    paintLineBoxDecorations(p, _x, _y, _w, _h, scrolledX, scrolledY, paintAction);
+    paintLineBoxDecorations(paintInfo, scrolledX, scrolledY);
     
     // 3. paint floats.
     if (!inlineFlow && (paintAction == PaintActionFloat || paintAction == PaintActionSelection))
-        paintFloats(p, _x, _y, _w, _h, scrolledX, scrolledY, paintAction == PaintActionSelection);
+        paintFloats(paintInfo, scrolledX, scrolledY, paintAction == PaintActionSelection);
 
     // 4. paint outline.
     if (!inlineFlow && paintAction == PaintActionOutline && 
         style()->outlineWidth() && style()->visibility() == VISIBLE)
-        paintOutline(p, _tx, _ty, width(), height(), style());
+        paintOutline(i.p, _tx, _ty, width(), height(), style());
 
     // 5. paint caret.
     /*
@@ -1248,7 +1246,7 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
         NodeImpl *baseNode = s.baseNode();
         RenderObject *renderer = baseNode ? baseNode->renderer() : 0;
         if (renderer && renderer->containingBlock() == this && baseNode->isContentEditable()) {
-            document()->part()->paintCaret(p, QRect(_x, _y, _w, _h));
+            document()->part()->paintCaret(i.p, i.r);
         }
     }
     
@@ -1256,17 +1254,16 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
 #ifdef BOX_DEBUG
     if ( style() && style()->visibility() == VISIBLE ) {
         if(isAnonymous())
-            outlineBox(p, _tx, _ty, "green");
+            outlineBox(i.p, _tx, _ty, "green");
         if(isFloating())
-            outlineBox(p, _tx, _ty, "yellow");
+            outlineBox(i.p, _tx, _ty, "yellow");
         else
-            outlineBox(p, _tx, _ty);
+            outlineBox(i.p, _tx, _ty);
     }
 #endif
 }
 
-void RenderBlock::paintFloats(QPainter *p, int _x, int _y,
-                              int _w, int _h, int _tx, int _ty, bool paintSelection)
+void RenderBlock::paintFloats(PaintInfo& i, int _tx, int _ty, bool paintSelection)
 {
     if (!m_floatingObjects)
         return;
@@ -1276,33 +1273,19 @@ void RenderBlock::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->noPaint && !r->node->layer()) {
-            if (paintSelection) {
-                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(),
-                               PaintActionSelection);
-            }
-            else {
-                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(),
-                               PaintActionElementBackground);
-                r->node->paint(p, _x, _y, _w, _h,
-                               _tx + r->left - r->node->xPos() + r->node->marginLeft(),
-                               _ty + r->startY - r->node->yPos() + r->node->marginTop(),
-                               PaintActionChildBackgrounds);
-                r->node->paint(p, _x, _y, _w, _h,
-                               _tx + r->left - r->node->xPos() + r->node->marginLeft(),
-                               _ty + r->startY - r->node->yPos() + r->node->marginTop(),
-                               PaintActionFloat);
-                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(),
-                               PaintActionForeground);
-                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(),
-                               PaintActionOutline);
+            PaintInfo info(i.p, i.r, paintSelection ? PaintActionSelection : PaintActionElementBackground);
+            int tx = _tx + r->left - r->node->xPos() + r->node->marginLeft();
+            int ty = _ty + r->startY - r->node->yPos() + r->node->marginTop();
+            r->node->paint(info, tx, ty);
+            if (!paintSelection) {
+                info.phase = PaintActionChildBackgrounds;
+                r->node->paint(info, tx, ty);
+                info.phase = PaintActionFloat;
+                r->node->paint(info, tx, ty);
+                info.phase = PaintActionForeground;
+                r->node->paint(info, tx, ty);
+                info.phase = PaintActionOutline;
+                r->node->paint(info, tx, ty);
             }
         }
     }
diff --git a/WebCore/khtml/rendering/render_block.h b/WebCore/khtml/rendering/render_block.h
index 37f1ef4..1c7d4c3 100644
--- a/WebCore/khtml/rendering/render_block.h
+++ b/WebCore/khtml/rendering/render_block.h
@@ -120,13 +120,9 @@ public:
     void computeVerticalPositionsForLine(InlineFlowBox* lineBox);
     // end bidi.cpp functions
     
-    virtual void paint(QPainter *, int x, int y, int w, int h,
-                       int tx, int ty, PaintAction paintAction);
-    virtual void paintObject(QPainter *, int x, int y, int w, int h,
-                             int tx, int ty, PaintAction paintAction);
-    void paintFloats(QPainter *p, int _x, int _y,
-                     int _w, int _h, int _tx, int _ty, bool paintSelection = false);
-    
+    virtual void paint(PaintInfo& i, int tx, int ty);
+    void paintObject(PaintInfo& i, int tx, int ty);
+    void paintFloats(PaintInfo& i, int _tx, int _ty, bool paintSelection = false);
 
     void insertFloatingObject(RenderObject *o);
     void removeFloatingObject(RenderObject *o);
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index eef0081..a5393c5 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -180,23 +180,17 @@ int RenderBox::height() const
 
 // --------------------- painting stuff -------------------------------
 
-void RenderBox::paint(QPainter *p, int _x, int _y, int _w, int _h,
-                      int _tx, int _ty, PaintAction paintAction)
+void RenderBox::paint(PaintInfo& i, int _tx, int _ty)
 {
     _tx += m_x;
     _ty += m_y;
 
-    // default implementation. Just pass things through to the children
-    RenderObject *child = firstChild();
-    while(child != 0)
-    {
-        child->paint(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-        child = child->nextSibling();
-    }
+    // default implementation. Just pass paint through to the children
+    for (RenderObject* child = firstChild(); child; child = child->nextSibling())
+        child->paint(i, _tx, _ty);
 }
 
-void RenderBox::paintRootBoxDecorations(QPainter *p,int, int _y,
-                                        int, int _h, int _tx, int _ty)
+void RenderBox::paintRootBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     //kdDebug( 6040 ) << renderName() << "::paintBoxDecorations()" << _tx << "/" << _ty << endl;
     QColor c = style()->backgroundColor();
@@ -255,38 +249,37 @@ void RenderBox::paintRootBoxDecorations(QPainter *p,int, int _y,
 
     int bx = _tx - marginLeft();
     int by = _ty - marginTop();
-    int bw = QMAX(w + marginLeft() + marginRight() + borderLeft() + borderRight(), rw);
-    int bh = QMAX(h + marginTop() + marginBottom() + borderTop() + borderBottom(), rh);
+    int bw = kMax(w + marginLeft() + marginRight() + borderLeft() + borderRight(), rw);
+    int bh = kMax(h + marginTop() + marginBottom() + borderTop() + borderBottom(), rh);
 
     // CSS2 14.2:
     // " The background of the box generated by the root element covers the entire canvas."
     // 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);
+    int my = kMax(by, i.r.y());
 
-    paintBackground(p, c, bg, my, _h, bx, by, bw, bh);
+    paintBackground(i.p, c, bg, my, i.r.height(), bx, by, bw, bh);
 
     if (style()->hasBorder() && style()->display() != INLINE)
-        paintBorder( p, _tx, _ty, w, h, style() );
+        paintBorder( i.p, _tx, _ty, w, h, style() );
 }
 
-void RenderBox::paintBoxDecorations(QPainter *p,int _x, int _y,
-                                    int _w, int _h, int _tx, int _ty)
+void RenderBox::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     //kdDebug( 6040 ) << renderName() << "::paintDecorations()" << endl;
     if (isRoot())
-        return paintRootBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+        return paintRootBoxDecorations(i, _tx, _ty);
     
     int w = width();
     int h = height() + borderTopExtra() + borderBottomExtra();
     _ty -= borderTopExtra();
 
-    int my = QMAX(_ty,_y);
+    int my = kMax(_ty, i.r.y());
     int mh;
-    if (_ty<_y)
-        mh= QMAX(0,h-(_y-_ty));
+    if (_ty < i.r.y())
+        mh= kMax(0, h - (i.r.y() - _ty));
     else
-        mh = QMIN(_h,h);
+        mh = kMin(i.r.height(), h);
 
     // The <body> only paints its background if the root element has defined a background
     // independent of the body.  Go through the DOM to get to the root element's render object,
@@ -294,10 +287,10 @@ void RenderBox::paintBoxDecorations(QPainter *p,int _x, int _y,
     if (!isBody()
         || element()->getDocument()->documentElement()->renderer()->style()->backgroundColor().isValid()
         || element()->getDocument()->documentElement()->renderer()->style()->backgroundImage())
-        paintBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
+        paintBackground(i.p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
    
     if (style()->hasBorder())
-        paintBorder(p, _tx, _ty, w, h, style());
+        paintBorder(i.p, _tx, _ty, w, h, style());
 }
 
 void RenderBox::paintBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int height)
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index 1929320..8401afe 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -48,8 +48,7 @@ public:
     virtual const char *renderName() const { return "RenderBox"; }
 
     virtual void setStyle(RenderStyle *style);
-    virtual void paint(QPainter *p, int _x, int _y, int _w, int _h,
-                       int _tx, int _ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int _tx, int _ty);
 
     virtual void detach();
     
@@ -130,10 +129,8 @@ public:
     virtual void setStaticY(int staticY);
 
 protected:
-    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty);
-    void paintRootBoxDecorations(QPainter *p,int, int _y,
-                                 int, int _h, int _tx, int _ty);
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty);
+    void paintRootBoxDecorations(PaintInfo& i, 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");
diff --git a/WebCore/khtml/rendering/render_br.h b/WebCore/khtml/rendering/render_br.h
index e6644fe..180827c 100644
--- a/WebCore/khtml/rendering/render_br.h
+++ b/WebCore/khtml/rendering/render_br.h
@@ -38,9 +38,8 @@ public:
 
     virtual const char *renderName() const { return "RenderBR"; }
 
-    virtual void paint( QPainter *, int, int, int, int, int, int, int) {}
-    virtual void paintObject( QPainter *, int, int, int, int, int, int, int) {}
-
+    virtual void paint(PaintInfo&, int, int) {}
+    
     virtual void position(InlineBox* box, int from, int len, bool reverse);
     virtual unsigned int width(unsigned int, unsigned int, const Font *) const { return 0; }
     virtual unsigned int width( unsigned int, unsigned int, bool) const { return 0; }
diff --git a/WebCore/khtml/rendering/render_canvas.cpp b/WebCore/khtml/rendering/render_canvas.cpp
index 2a4e319..5d04945 100644
--- a/WebCore/khtml/rendering/render_canvas.cpp
+++ b/WebCore/khtml/rendering/render_canvas.cpp
@@ -196,32 +196,21 @@ bool RenderCanvas::absolutePosition(int &xPos, int &yPos, bool f)
     return true;
 }
 
-void RenderCanvas::paint(QPainter *p, int _x, int _y, int _w, int _h, int _tx, int _ty,
-                       PaintAction paintAction)
-{
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-}
-
-void RenderCanvas::paintObject(QPainter *p, int _x, int _y,
-                             int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderCanvas::paint(PaintInfo& i, int _tx, int _ty)
 {
 #ifdef DEBUG_LAYOUT
     kdDebug( 6040 ) << renderName() << "(RenderCanvas) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
     // 1. paint background, borders etc
-    if (paintAction == PaintActionElementBackground) {
-        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+    if (i.phase == PaintActionElementBackground) {
+        paintBoxDecorations(i, _tx, _ty);
         return;
     }
     
     // 2. paint contents
-    RenderObject *child = firstChild();
-    while(child != 0) {
-        if(!child->layer() && !child->isFloating()) {
-            child->paint(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-        }
-        child = child->nextSibling();
-    }
+    for (RenderObject *child = firstChild(); child; child = child->nextSibling())
+        if (!child->layer() && !child->isFloating())
+            child->paint(i, _tx, _ty);
 
     if (m_view)
     {
@@ -230,17 +219,15 @@ void RenderCanvas::paintObject(QPainter *p, int _x, int _y,
     }
     
     // 3. paint floats.
-    if (paintAction == PaintActionFloat)
-        paintFloats(p, _x, _y, _w, _h, _tx, _ty);
+    if (i.phase == PaintActionFloat)
+        paintFloats(i, _tx, _ty);
         
 #ifdef BOX_DEBUG
-    outlineBox(p, _tx, _ty);
+    outlineBox(i.p, _tx, _ty);
 #endif
-
 }
 
-void RenderCanvas::paintBoxDecorations(QPainter *p,int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty)
+void RenderCanvas::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     // Check to see if we are enclosed by a transparent layer.  If so, we cannot blit
     // when scrolling, and we need to use slow repaints.
@@ -260,7 +247,8 @@ void RenderCanvas::paintBoxDecorations(QPainter *p,int _x, int _y,
     if (elt)
         view()->useSlowRepaints(); // The parent must show behind the child.
     else
-        p->fillRect(_x,_y,_w,_h, view()->palette().active().color(QColorGroup::Base));
+        i.p->fillRect(i.r.x(), i.r.y(), i.r.width(), i.r.height(), 
+                    view()->palette().active().color(QColorGroup::Base));
 }
 
 void RenderCanvas::repaintViewRectangle(const QRect& ur, bool immediate)
diff --git a/WebCore/khtml/rendering/render_canvas.h b/WebCore/khtml/rendering/render_canvas.h
index b73abfe..392ca87 100644
--- a/WebCore/khtml/rendering/render_canvas.h
+++ b/WebCore/khtml/rendering/render_canvas.h
@@ -56,13 +56,8 @@ public:
     virtual void computeAbsoluteRepaintRect(QRect& r, bool f=false);
     virtual void repaintViewRectangle(const QRect& r, bool immediate = false);
     
-    virtual void paint(QPainter *, int x, int y, int w, int h, int tx, int ty,
-                       PaintAction paintAction);
-    void paintObject(QPainter *p, int _x, int _y,
-                     int _w, int _h, int _tx, int _ty, PaintAction paintAction);
-
-    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty);
+    virtual void paint(PaintInfo& i, int tx, int ty);
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty);
     
     virtual void setSelection(RenderObject *s, int sp, RenderObject *e, int ep);
     virtual void clearSelection(bool doRepaint=true);
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 4a411de..c038de0 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -197,18 +197,17 @@ InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox, bool isRootLineB
     return flowBox;
 }
 
-void RenderFlow::paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
-                                int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderFlow::paintLineBoxBackgroundBorder(PaintInfo& i, int _tx, int _ty)
 {
     if (!firstLineBox())
         return;
-    
-    if (style()->visibility() == VISIBLE && paintAction == PaintActionForeground) {
+ 
+    if (style()->visibility() == VISIBLE && i.phase == PaintActionForeground) {
         // We can check the first box and last box and avoid painting if we don't
         // intersect.
         int yPos = _ty + firstLineBox()->yPos();
         int h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
-        if( (yPos >= _y + _h) || (yPos + h <= _y))
+        if( (yPos >= i.r.y() + i.r.height()) || (yPos + h <= i.r.y()))
             return;
 
         // See if our boxes intersect with the dirty rect.  If so, then we paint
@@ -218,20 +217,19 @@ void RenderFlow::paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
         for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
             yPos = _ty + curr->yPos();
             h = curr->height();
-            if ((yPos < _y + _h) && (yPos + h > _y))
-                curr->paintBackgroundAndBorder(p, _x, _y, _w, _h, _tx, _ty, xOffsetWithinLineBoxes);
+            if ((yPos < i.r.y() + i.r.height()) && (yPos + h > i.r.y()))
+                curr->paintBackgroundAndBorder(i, _tx, _ty, xOffsetWithinLineBoxes);
             xOffsetWithinLineBoxes += curr->width();
         }
     }
 }
 
-void RenderFlow::paintLineBoxDecorations(QPainter *p, int _x, int _y,
-                                         int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderFlow::paintLineBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     if (!firstLineBox())
         return;
 
-    if (style()->visibility() == VISIBLE && paintAction == PaintActionForeground) {
+    if (style()->visibility() == VISIBLE && i.phase == PaintActionForeground) {
         // We only paint line box decorations in strict or almost strict mode.
         // Otherwise we let the InlineTextBoxes paint their own decorations.
         if (style()->htmlHacks())
@@ -241,7 +239,7 @@ void RenderFlow::paintLineBoxDecorations(QPainter *p, int _x, int _y,
         // intersect.
         int yPos = _ty + firstLineBox()->yPos();;
         int h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
-        if( (yPos >= _y + _h) || (yPos + h <= _y))
+        if( (yPos >= i.r.y() + i.r.height()) || (yPos + h <= i.r.y()))
             return;
 
         // See if our boxes intersect with the dirty rect.  If so, then we paint
@@ -250,8 +248,8 @@ void RenderFlow::paintLineBoxDecorations(QPainter *p, int _x, int _y,
         for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
             yPos = _ty + curr->yPos();
             h = curr->height();
-            if ((yPos < _y + _h) && (yPos + h > _y))
-                curr->paintDecorations(p, _x, _y, _w, _h, _tx, _ty);
+            if ((yPos < i.r.y() + i.r.height()) && (yPos + h > i.r.y()))
+                curr->paintDecorations(i, _tx, _ty);
         }
     }
 }
diff --git a/WebCore/khtml/rendering/render_flow.h b/WebCore/khtml/rendering/render_flow.h
index adb81e8..a2d0daa 100644
--- a/WebCore/khtml/rendering/render_flow.h
+++ b/WebCore/khtml/rendering/render_flow.h
@@ -66,10 +66,8 @@ public:
 
     virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox);
 
-    void paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
-                        int _w, int _h, int _tx, int _ty, PaintAction paintAction);
-    void paintLineBoxDecorations(QPainter *p, int _x, int _y,
-                                 int _w, int _h, int _tx, int _ty, PaintAction paintAction);
+    void paintLineBoxBackgroundBorder(PaintInfo& i, int _tx, int _ty);
+    void paintLineBoxDecorations(PaintInfo& i, int _tx, int _ty);
 
     virtual QRect getAbsoluteRepaintRect();
     
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 867fac9..3ee880e 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -712,8 +712,7 @@ RenderObject* RenderFieldset::findLegend()
     return 0;
 }
 
-void RenderFieldset::paintBoxDecorations(QPainter *p,int _x, int _y,
-                                         int _w, int _h, int _tx, int _ty)
+void RenderFieldset::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     //kdDebug( 6040 ) << renderName() << "::paintDecorations()" << endl;
 
@@ -721,20 +720,20 @@ void RenderFieldset::paintBoxDecorations(QPainter *p,int _x, int _y,
     int h = height() + borderTopExtra() + borderBottomExtra();
     RenderObject* legend = findLegend();
     if (!legend)
-        return RenderBlock::paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+        return RenderBlock::paintBoxDecorations(i, _tx, _ty);
 
     int yOff = (legend->yPos() > 0) ? 0 : (legend->height()-borderTop())/2;
     h -= yOff;
     _ty += yOff - borderTopExtra();
 
-    int my = QMAX(_ty,_y);
-    int end = QMIN( _y + _h,  _ty + h );
+    int my = kMax(_ty, i.r.y());
+    int end = kMin(i.r.y() + i.r.height(),  _ty + h);
     int mh = end - my;
 
-    paintBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
+    paintBackground(i.p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
 
     if (style()->hasBorder())
-        paintBorderMinusLegend(p, _tx, _ty, w, h, style(), legend->xPos(), legend->width());
+        paintBorderMinusLegend(i.p, _tx, _ty, w, h, style(), legend->xPos(), legend->width());
 }
 
 void RenderFieldset::paintBorderMinusLegend(QPainter *p, int _tx, int _ty, int w, int h,
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 1bf1faf..ec13dd0 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -298,8 +298,7 @@ public:
     virtual void setStyle(RenderStyle* _style);
     
 protected:
-    virtual void paintBoxDecorations(QPainter *p,int, int _y,
-                                     int, int _h, int _tx, int _ty);
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty);
     void paintBorderMinusLegend(QPainter *p, int _tx, int _ty, int w,
                                 int h, const RenderStyle *style, int lx, int lw);
     RenderObject* findLegend();
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 104fc99..587cf16 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -206,17 +206,24 @@ QColor RenderImage::selectionTintColor(QPainter *p) const
 }
 #endif
 
-void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, int /*_h*/, int _tx, int _ty, PaintAction paintAction)
+void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
 {
-    if (paintAction == PaintActionOutline && style()->outlineWidth() && style()->visibility() == VISIBLE)
+    if (!shouldPaint(i, _tx, _ty)) return;
+    
+    if (shouldPaintBackgroundOrBorder() && i.phase != PaintActionOutline) 
+        paintBoxDecorations(i, _tx, _ty);
+
+    QPainter* p = i.p;
+    
+    if (i.phase == PaintActionOutline && style()->outlineWidth() && style()->visibility() == VISIBLE)
         paintOutline(p, _tx, _ty, width(), height(), style());
     
-    if (paintAction != PaintActionForeground && paintAction != PaintActionSelection)
+    if (i.phase != PaintActionForeground && i.phase != PaintActionSelection)
         return;
 
 #if APPLE_CHANGES
     bool drawSelectionTint = selectionState() != SelectionNone;
-    if (paintAction == PaintActionSelection) {
+    if (i.phase == PaintActionSelection) {
         if (selectionState() == SelectionNone) {
             return;
         }
@@ -237,9 +244,9 @@ void RenderImage::paintObject(QPainter *p, int /*_x*/, int /*_y*/, int /*_w*/, i
     //kdDebug( 6040 ) << "    contents (" << contentWidth << "/" << contentHeight << ") border=" << borderLeft() << " padding=" << paddingLeft() << endl;
     if ( pix.isNull() || berrorPic)
     {
-        if (paintAction == PaintActionSelection) {
+        if (i.phase == PaintActionSelection)
             return;
-        }
+
         if(cWidth > 2 && cHeight > 2)
         {
 #if APPLE_CHANGES
@@ -533,11 +540,10 @@ void RenderImage::updateFromElement()
     // Treat a lack of src or empty string for src as no image at all, not the page itself
     // loaded as an image.
     CachedImage *new_image;
-    if (attr.isEmpty()) {
+    if (attr.isEmpty())
         new_image = NULL;
-    } else {
+    else
         new_image = element()->getDocument()->docLoader()->requestImage(khtml::parseURL(attr));
-    }
 
     if(new_image && new_image != image && (!style() || !style()->contentData())) {
         loadEventSent = false;
diff --git a/WebCore/khtml/rendering/render_image.h b/WebCore/khtml/rendering/render_image.h
index 8dd3ae8..3788759 100644
--- a/WebCore/khtml/rendering/render_image.h
+++ b/WebCore/khtml/rendering/render_image.h
@@ -48,7 +48,7 @@ public:
 
     virtual bool isImage() const { return true; }
     
-    virtual void paintObject( QPainter *p, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int tx, int ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     virtual void layout();
 
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index 82f5470..97729a8 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -257,52 +257,35 @@ void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox
     block->setNeedsLayoutAndMinMaxRecalc();
 }
 
-void RenderInline::paint(QPainter *p, int _x, int _y, int _w, int _h,
-                      int _tx, int _ty, PaintAction paintAction)
-{
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-}
-
-void RenderInline::paintObject(QPainter *p, int _x, int _y,
-                             int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderInline::paint(PaintInfo& i, int _tx, int _ty)
 {
 #ifdef DEBUG_LAYOUT
     //    kdDebug( 6040 ) << renderName() << "(RenderInline) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
-
-    // If we have an inline root, it has to call the special root box decoration painting
-    // function.
-    if (isRoot() &&
-        (paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground) &&
-        shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE) {
-        paintRootBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
-    }
     
     // We're done.  We don't bother painting any children.
-    if (paintAction == PaintActionElementBackground)
+    if (i.phase == PaintActionElementBackground)
         return;
+    
     // We don't paint our own background, but we do let the kids paint their backgrounds.
-    if (paintAction == PaintActionChildBackgrounds)
-        paintAction = PaintActionChildBackground;
+    PaintInfo paintInfo(i.p, i.r, i.phase);
+    if (i.phase == PaintActionChildBackgrounds)
+        paintInfo.phase = PaintActionChildBackground;
 
-    paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    paintLineBoxBackgroundBorder(paintInfo, _tx, _ty);
     
-    RenderObject *child = firstChild();
-    while(child != 0)
-    {
+    for (RenderObject *child = firstChild(); child; child = child->nextSibling())
         if(!child->layer() && !child->isFloating())
-            child->paint(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-        child = child->nextSibling();
-    }
+            child->paint(paintInfo, _tx, _ty);
 
-    paintLineBoxDecorations(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-    if (style()->visibility() == VISIBLE && paintAction == PaintActionOutline) {
+    paintLineBoxDecorations(paintInfo, _tx, _ty);
+    if (style()->visibility() == VISIBLE && paintInfo.phase == PaintActionOutline) {
 #if APPLE_CHANGES
         if (style()->outlineStyleIsAuto())
-            paintFocusRing(p, _tx, _ty);
+            paintFocusRing(paintInfo.p, _tx, _ty);
         else
 #endif
-        paintOutlines(p, _tx, _ty);
+        paintOutlines(paintInfo.p, _tx, _ty);
     }
 }
 
diff --git a/WebCore/khtml/rendering/render_inline.h b/WebCore/khtml/rendering/render_inline.h
index de55952..c430e71 100644
--- a/WebCore/khtml/rendering/render_inline.h
+++ b/WebCore/khtml/rendering/render_inline.h
@@ -53,10 +53,7 @@ public:
 
     virtual void layout() {} // Do nothing for layout()
     
-    virtual void paint(QPainter *, int x, int y, int w, int h,
-                       int tx, int ty, PaintAction paintAction);
-    virtual void paintObject(QPainter *, int x, int y, int w, int h,
-                             int tx, int ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     virtual bool nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
                              HitTestAction hitTestAction = HitTestAll, bool inside=false);
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 7da48c5..a9ddce8 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -753,11 +753,8 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
         setClip(p, paintDirtyRect, damageRect);
 
         // Paint the background.
-        renderer()->paint(p, damageRect.x(), damageRect.y(),
-                            damageRect.width(), damageRect.height(),
-                            x - renderer()->xPos(), y - renderer()->yPos(),
-                            PaintActionElementBackground);
-        
+        RenderObject::PaintInfo info = RenderObject::PaintInfo(p, damageRect, PaintActionElementBackground);
+        renderer()->paint(info, x - renderer()->xPos(), y - renderer()->yPos());        
 #if APPLE_CHANGES
         // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
         // z-index.  We paint after we painted the background/border, so that the scrollbars will
@@ -788,23 +785,18 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
         // Set up the clip used when painting our children.
         setClip(p, paintDirtyRect, clipRectToApply);
 
-        if (selectionOnly)
-            renderer()->paint(p, clipRectToApply.x(), clipRectToApply.y(),
-                              clipRectToApply.width(), clipRectToApply.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(), PaintActionSelection);
-        else {
-            renderer()->paint(p, clipRectToApply.x(), clipRectToApply.y(),
-                              clipRectToApply.width(), clipRectToApply.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(), PaintActionChildBackgrounds);
-            renderer()->paint(p, clipRectToApply.x(), clipRectToApply.y(),
-                              clipRectToApply.width(), clipRectToApply.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(), PaintActionFloat);
-            renderer()->paint(p, clipRectToApply.x(), clipRectToApply.y(),
-                              clipRectToApply.width(), clipRectToApply.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(), PaintActionForeground);
-            renderer()->paint(p, clipRectToApply.x(), clipRectToApply.y(),
-                              clipRectToApply.width(), clipRectToApply.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(), PaintActionOutline);
+        int tx = x - renderer()->xPos();
+        int ty = y - renderer()->yPos();
+        RenderObject::PaintInfo info(p, clipRectToApply, 
+                                     selectionOnly ? PaintActionSelection : PaintActionChildBackgrounds);
+        renderer()->paint(info, tx, ty);
+        if (!selectionOnly) {
+            info.phase = PaintActionFloat;
+            renderer()->paint(info, tx, ty);
+            info.phase = PaintActionForeground;
+            renderer()->paint(info, tx, ty);
+            info.phase = PaintActionOutline;
+            renderer()->paint(info, tx, ty);
         }
 
         // Now restore our clip.
diff --git a/WebCore/khtml/rendering/render_line.cpp b/WebCore/khtml/rendering/render_line.cpp
index b666078..fc3ce0f 100644
--- a/WebCore/khtml/rendering/render_line.cpp
+++ b/WebCore/khtml/rendering/render_line.cpp
@@ -507,8 +507,7 @@ void InlineFlowBox::shrinkBoxesWithNoTextChildren(int topPos, int bottomPos)
     }
 }
 
-void InlineFlowBox::paintBackgroundAndBorder(QPainter *p, int _x, int _y,
-                                             int _w, int _h, int _tx, int _ty, int xOffsetOnLine)
+void InlineFlowBox::paintBackgroundAndBorder(RenderObject::PaintInfo& i, int _tx, int _ty, int xOffsetOnLine)
 {
     // Move x/y to our coordinates.
     _tx += m_x;
@@ -517,13 +516,15 @@ void InlineFlowBox::paintBackgroundAndBorder(QPainter *p, int _x, int _y,
     int w = width();
     int h = height();
 
-    int my = QMAX(_ty,_y);
+    int my = kMax(_ty, i.r.y());
     int mh;
-    if (_ty<_y)
-        mh= QMAX(0,h-(_y-_ty));
+    if (_ty < i.r.y())
+        mh= kMax(0, h - (i.r.y() - _ty));
     else
-        mh = QMIN(_h,h);
+        mh = kMin(i.r.height(), h);
 
+    QPainter* p = i.p;
+    
     // You can use p::first-line to specify a background. If so, the root line boxes for
     // a line may actually have to paint a background.
     RenderStyle* styleToUse = object()->style(m_firstLine);
@@ -583,11 +584,11 @@ static bool shouldDrawDecoration(RenderObject* obj)
     return shouldDraw;
 }
 
-void InlineFlowBox::paintDecorations(QPainter *p, int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty)
+void InlineFlowBox::paintDecorations(RenderObject::PaintInfo& i, int _tx, int _ty)
 {
     // Now paint our text decorations. We only do this if we aren't in quirks mode (i.e., in
     // almost-strict mode or strict mode).
+    QPainter* p = i.p;
     _tx += m_x;
     _ty += m_y;
     RenderStyle* styleToUse = object()->style(m_firstLine);
diff --git a/WebCore/khtml/rendering/render_line.h b/WebCore/khtml/rendering/render_line.h
index 7475792..abadd9b 100644
--- a/WebCore/khtml/rendering/render_line.h
+++ b/WebCore/khtml/rendering/render_line.h
@@ -142,10 +142,8 @@ public:
     void setNextLineBox(InlineRunBox* n) { m_nextLine = n; }
     void setPreviousLineBox(InlineRunBox* p) { m_prevLine = p; }
 
-    virtual void paintBackgroundAndBorder(QPainter *p, int _x, int _y,
-                       int _w, int _h, int _tx, int _ty, int xOffsetOnLine) {};
-    virtual void paintDecorations(QPainter *p, int _x, int _y,
-                       int _w, int _h, int _tx, int _ty) {};
+    virtual void paintBackgroundAndBorder(RenderObject::PaintInfo& i, int _tx, int _ty, int xOffsetOnLine) {};
+    virtual void paintDecorations(RenderObject::PaintInfo& i, int _tx, int _ty) {};
     
 protected:
     InlineRunBox* m_prevLine;  // The previous box that also uses our RenderObject
@@ -188,10 +186,8 @@ public:
             m_hasTextChildren = true;
     }
 
-    virtual void paintBackgroundAndBorder(QPainter *p, int _x, int _y,
-                       int _w, int _h, int _tx, int _ty, int xOffsetOnLine);
-    virtual void paintDecorations(QPainter *p, int _x, int _y,
-                       int _w, int _h, int _tx, int _ty);
+    virtual void paintBackgroundAndBorder(RenderObject::PaintInfo& i, int _tx, int _ty, int xOffsetOnLine);
+    virtual void paintDecorations(RenderObject::PaintInfo& i, int _tx, int _ty);
     
     int marginBorderPaddingLeft();
     int marginBorderPaddingRight();
diff --git a/WebCore/khtml/rendering/render_list.cpp b/WebCore/khtml/rendering/render_list.cpp
index fd0a916..1dd7731 100644
--- a/WebCore/khtml/rendering/render_list.cpp
+++ b/WebCore/khtml/rendering/render_list.cpp
@@ -271,24 +271,15 @@ void RenderListItem::layout( )
     RenderBlock::layout();
 }
 
-void RenderListItem::paint(QPainter *p, int _x, int _y, int _w, int _h,
-                           int _tx, int _ty, PaintAction paintAction)
+void RenderListItem::paint(PaintInfo& i, int _tx, int _ty)
 {
-    if ( !m_height )
+    if (!m_height)
         return;
 
 #ifdef DEBUG_LAYOUT
     kdDebug( 6040 ) << nodeName().string() << "(LI)::paint()" << endl;
 #endif
-    RenderBlock::paint(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-}
-
-void RenderListItem::paintObject(QPainter *p, int _x, int _y,
-                                    int _w, int _h, int _tx, int _ty, PaintAction paintAction)
-{
-    // ### this should scale with the font size in the body... possible?
-    //m_marker->printIcon(p, _tx, _ty);
-    RenderBlock::paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    RenderBlock::paint(i, _tx, _ty);
 }
 
 QRect RenderListItem::getAbsoluteRepaintRect()
@@ -359,10 +350,9 @@ void RenderListMarker::setStyle(RenderStyle *s)
 }
 
 
-void RenderListMarker::paint(QPainter *p, int _x, int _y, int _w, int _h,
-                             int _tx, int _ty, PaintAction paintAction)
+void RenderListMarker::paint(PaintInfo& i, int _tx, int _ty)
 {
-    if (paintAction != PaintActionForeground)
+    if (i.phase != PaintActionForeground)
         return;
     
     if (style()->visibility() != VISIBLE)  return;
@@ -370,23 +360,17 @@ void RenderListMarker::paint(QPainter *p, int _x, int _y, int _w, int _h,
     _tx += m_x;
     _ty += m_y;
 
-    if((_ty > _y + _h) || (_ty + m_height < _y))
+    if ((_ty > i.r.y() + i.r.height()) || (_ty + m_height < i.r.y()))
         return;
 
-    if(shouldPaintBackgroundOrBorder()) 
-        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
-
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-}
-
-void RenderListMarker::paintObject(QPainter *p, int, int _y,
-                                    int, int _h, int _tx, int _ty, PaintAction paintAction)
-{
-    if (style()->visibility() != VISIBLE) return;
+    if (shouldPaintBackgroundOrBorder()) 
+        paintBoxDecorations(i, _tx, _ty);
 
 #ifdef DEBUG_LAYOUT
     kdDebug( 6040 ) << nodeName().string() << "(ListMarker)::paintObject(" << _tx << ", " << _ty << ")" << endl;
 #endif
+
+    QPainter* p = i.p;
     p->setFont(style()->font());
     const QFontMetrics fm = p->fontMetrics();
     int offset = fm.ascent()*2/3;
@@ -421,12 +405,12 @@ void RenderListMarker::paintObject(QPainter *p, int, int _y,
     bool isPrinting = (p->device()->devType() == QInternal::Printer);
     if (isPrinting)
     {
-        if (_ty < _y)
+        if (_ty < i.r.y())
         {
             // This has been printed already we suppose.
             return;
         }
-        if (_ty + m_height + paddingBottom() + borderBottom() >= _y+_h)
+        if (_ty + m_height + paddingBottom() + borderBottom() >= i.r.y() + i.r.height())
         {
             RenderCanvas *rootObj = canvas();
             if (_ty < rootObj->truncatedAt())
diff --git a/WebCore/khtml/rendering/render_list.h b/WebCore/khtml/rendering/render_list.h
index 4074315..87a5205 100644
--- a/WebCore/khtml/rendering/render_list.h
+++ b/WebCore/khtml/rendering/render_list.h
@@ -48,10 +48,7 @@ public:
     // so the marker gets to layout itself. Only needed for
     // list-style-position: inside
 
-    virtual void paint(QPainter *p, int x, int y, int w, int h,
-                       int xoff, int yoff, PaintAction paintAction);
-    virtual void paintObject(QPainter *p, int x, int y, int w, int h,
-                             int xoff, int yoff, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int xoff, int yoff);
     virtual void layout( );
     virtual void calcMinMaxWidth();
 
@@ -98,10 +95,7 @@ public:
     void setValue( long v ) { predefVal = v; }
     void calcListValue();
     
-    virtual void paint(QPainter *p, int x, int y, int w, int h,
-                       int xoff, int yoff, PaintAction paintAction);
-    virtual void paintObject(QPainter *p, int x, int y, int w, int h,
-                       int xoff, int yoff, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int xoff, int yoff);
 
     virtual void layout( );
     virtual void calcMinMaxWidth();
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 645dc9a..2af72e5 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -1122,10 +1122,8 @@ void RenderObject::paintOutline(QPainter *p, int _tx, int _ty, int w, int h, con
 
 }
 
-void RenderObject::paint(QPainter *p, int x, int y, int w, int h, int tx, int ty,
-                         PaintAction paintAction)
+void RenderObject::paint(PaintInfo& i, int tx, int ty)
 {
-    paintObject(p, x, y, w, h, tx, ty, paintAction);
 }
 
 void RenderObject::repaint(bool immediate)
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 5bee100..fe00d72 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -338,18 +338,19 @@ public:
      * Paint the object and its children, clipped by (x|y|w|h).
      * (tx|ty) is the calculated position of the parent
      */
-    virtual void paint(QPainter *p, int x, int y, int w, int h, int tx, int ty, 
-                       PaintAction paintAction);
-
-    virtual void paintObject( QPainter */*p*/, int /*x*/, int /*y*/,
-                              int /*w*/, int /*h*/, int /*tx*/, int /*ty*/,
-                              PaintAction paintAction /*paintAction*/) {}
+    struct PaintInfo {
+        PaintInfo(QPainter* _p, const QRect& _r, PaintAction _phase)
+        : p(_p), r(_r), phase(_phase) {}
+        QPainter* p;
+        QRect     r;
+        PaintAction phase;
+    };
+    virtual void paint(PaintInfo& i, int tx, int ty);
     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);
 
     // RenderBox implements this.
-    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty) {};
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty) {};
 
     virtual void paintBackgroundExtended(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph,
                                          int _tx, int _ty, int w, int height,
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index deb63b8..d1fd564 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -53,29 +53,25 @@ RenderReplaced::RenderReplaced(DOM::NodeImpl* node)
     m_intrinsicHeight = 150;
 }
 
-void RenderReplaced::paint(QPainter *p, int _x, int _y, int _w, int _h,
-                           int _tx, int _ty, PaintAction paintAction)
+bool RenderReplaced::shouldPaint(PaintInfo& i, int& _tx, int& _ty)
 {
-    if (paintAction != PaintActionForeground && paintAction != PaintActionOutline && paintAction != PaintActionSelection)
-        return;
+    if (i.phase != PaintActionForeground && i.phase != PaintActionOutline && i.phase != PaintActionSelection)
+        return false;
         
     // if we're invisible or haven't received a layout yet, then just bail.
-    if (style()->visibility() != VISIBLE || m_y <=  -500000)  return;
+    if (style()->visibility() != VISIBLE || m_y <=  -500000)  return false;
 
     _tx += m_x;
     _ty += m_y;
 
     // Early exit if the element touches the edges.
-    int os = 2*maximalOutlineSize(paintAction);
-    if((_tx >= _x + _w + os) || (_tx + m_width <= _x - os))
-        return;
-    if((_ty >= _y + _h + os) || (_ty + m_height <= _y - os))
-        return;
+    int os = 2*maximalOutlineSize(i.phase);
+    if ((_tx >= i.r.x() + i.r.width() + os) || (_tx + m_width <= i.r.x() - os))
+        return false;
+    if ((_ty >= i.r.y() + i.r.height() + os) || (_ty + m_height <= i.r.y() - os))
+        return false;
 
-    if(shouldPaintBackgroundOrBorder() && paintAction != PaintActionOutline) 
-        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
-
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    return true;
 }
 
 void RenderReplaced::calcMinMaxWidth()
@@ -272,11 +268,15 @@ void RenderWidget::setStyle(RenderStyle *_style)
     }
 }
 
-void RenderWidget::paintObject(QPainter *p, int x, int y, int width, int height, int _tx, int _ty,
-                               PaintAction paintAction)
+void RenderWidget::paint(PaintInfo& i, int _tx, int _ty)
 {
+    if (!shouldPaint(i, _tx, _ty)) return;
+
+    if (shouldPaintBackgroundOrBorder() && i.phase != PaintActionOutline) 
+        paintBoxDecorations(i, _tx, _ty);
+
 #if APPLE_CHANGES
-    if (!m_widget || !m_view || paintAction != PaintActionForeground ||
+    if (!m_widget || !m_view || i.phase != PaintActionForeground ||
         style()->visibility() != VISIBLE)
         return;
 
@@ -290,10 +290,10 @@ void RenderWidget::paintObject(QPainter *p, int x, int y, int width, int height,
     
     // Tell the widget to paint now.  This is the only time the widget is allowed
     // to paint itself.  That way it will composite properly with z-indexed layers.
-    m_widget->paint(p, QRect(x, y, width, height));
+    m_widget->paint(i.p, i.r);
     
 #else
-    if (!m_widget || !m_view || paintAction != PaintActionForeground)
+    if (!m_widget || !m_view || i.phase != PaintActionForeground)
         return;
     
     if (style()->visibility() != VISIBLE) {
@@ -327,8 +327,8 @@ void RenderWidget::paintObject(QPainter *p, int x, int y, int width, int height,
 	    }
 // 	    qDebug("calculated yNew=%d", yNew);
 	}
-	yNew = QMIN( yNew, yPos + m_height - childh );
-	yNew = QMAX( yNew, yPos );
+	yNew = kMin( yNew, yPos + m_height - childh );
+	yNew = kMax( yNew, yPos );
 	if ( yNew != childy || xNew != childx ) {
 	    if ( vw->contentsHeight() < yNew - yPos + childh )
 		vw->resizeContents( vw->contentsWidth(), yNew - yPos + childh );
diff --git a/WebCore/khtml/rendering/render_replaced.h b/WebCore/khtml/rendering/render_replaced.h
index b2217ee..9c80ce7 100644
--- a/WebCore/khtml/rendering/render_replaced.h
+++ b/WebCore/khtml/rendering/render_replaced.h
@@ -41,10 +41,8 @@ public:
 
     virtual void calcMinMaxWidth();
 
-    virtual void paint(QPainter *, int x, int y, int w, int h,
-                       int tx, int ty, PaintAction paintAction);
-    virtual void paintObject(QPainter *p, int x, int y, int w, int h, int tx, int ty,
-                             PaintAction paintAction) = 0;
+    bool shouldPaint(PaintInfo& i, int& _tx, int& _ty);
+    virtual void paint(PaintInfo& i, int _tx, int _ty) = 0;
 
     virtual short intrinsicWidth() const { return m_intrinsicWidth; }
     virtual int intrinsicHeight() const { return m_intrinsicHeight; }
@@ -72,8 +70,7 @@ public:
 
     virtual void setStyle(RenderStyle *style);
 
-    virtual void paintObject(QPainter *p, int x, int y, int w, int h, int tx, int ty,
-                             PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     virtual bool isWidget() const { return true; };
 
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index afbb542..5bb51b7 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -402,8 +402,7 @@ void RenderTable::setCellWidths()
     }
 }
 
-void RenderTable::paint( QPainter *p, int _x, int _y,
-                                  int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderTable::paint(PaintInfo& i, int _tx, int _ty)
 {
     if (needsLayout())
         return;
@@ -411,14 +410,16 @@ void RenderTable::paint( QPainter *p, int _x, int _y,
     _tx += xPos();
     _ty += yPos();
 
+    PaintAction paintAction = i.phase;
+    
 #ifdef TABLE_PRINT
     kdDebug( 6040 ) << "RenderTable::paint() w/h = (" << width() << "/" << height() << ")" << endl;
 #endif
     if (!overhangingContents() && !isRelPositioned() && !isPositioned())
     {
         int os = 2*maximalOutlineSize(paintAction);
-        if((_ty >= _y + _h + os) || (_ty + height() <= _y - os)) return;
-        if((_tx >= _x + _w + os) || (_tx + width() <= _x - os)) return;
+        if ((_ty >= i.r.y() + i.r.height() + os) || (_ty + height() <= i.r.y() - os)) return;
+        if ((_tx >= i.r.x() + i.r.width() + os) || (_tx + width() <= i.r.x() - os)) return;
     }
 
 #ifdef TABLE_PRINT
@@ -427,7 +428,7 @@ void RenderTable::paint( QPainter *p, int _x, int _y,
 
     if ((paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground)
         && shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE)
-        paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
+        paintBoxDecorations(i, _tx, _ty);
 
     // We're done.  We don't bother painting any children.
     if (paintAction == PaintActionElementBackground)
@@ -435,13 +436,11 @@ void RenderTable::paint( QPainter *p, int _x, int _y,
     // We don't paint our own background, but we do let the kids paint their backgrounds.
     if (paintAction == PaintActionChildBackgrounds)
         paintAction = PaintActionChildBackground;
+    PaintInfo paintInfo(i.p, i.r, paintAction);
     
-    RenderObject *child = firstChild();
-    while( child ) {
-	if ( child->isTableSection() || child == tCaption )
-	    child->paint( p, _x, _y, _w, _h, _tx, _ty, paintAction );
-	child = child->nextSibling();
-    }
+    for (RenderObject *child = firstChild(); child; child = child->nextSibling())
+        if (child->isTableSection() || child == tCaption)
+	    child->paint(paintInfo, _tx, _ty);
 
     if (collapseBorders() && 
         (paintAction == PaintActionElementBackground || paintAction == PaintActionChildBackground)
@@ -452,38 +451,37 @@ void RenderTable::paint( QPainter *p, int _x, int _y,
         QPtrList<CollapsedBorderValue> borderStyles;
         borderStyles.setAutoDelete(true);
         collectBorders(borderStyles);
+        paintInfo.phase = PaintActionCollapsedTableBorders;
         for (uint i = 0; i < borderStyles.count(); i++) {
             m_currentBorder = borderStyles.at(i);
-            for (child = firstChild(); child; child = child->nextSibling()) {
+            for (RenderObject* child = firstChild(); child; child = child->nextSibling())
                 if (child->isTableSection())
-                    child->paint(p, _x, _y, _w, _h, _tx, _ty, PaintActionCollapsedTableBorders);
-            }
+                    child->paint(paintInfo, _tx, _ty);
         }
     }
         
 #ifdef BOX_DEBUG
-    outlineBox(p, _tx, _ty, "blue");
+    outlineBox(i.p, _tx, _ty, "blue");
 #endif
 }
 
-void RenderTable::paintBoxDecorations(QPainter *p,int _x, int _y,
-                                      int _w, int _h, int _tx, int _ty)
+void RenderTable::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     int w = width();
     int h = height() + borderTopExtra() + borderBottomExtra();
     _ty -= borderTopExtra();
     
-    int my = kMax(_ty,_y);
+    int my = kMax(_ty, i.r.y());
     int mh;
-    if (_ty<_y)
-        mh= kMax(0,h-(_y-_ty));
+    if (_ty < i.r.y())
+        mh= kMax(0, h - (i.r.y() - _ty));
     else
-        mh = kMin(_h,h);
+        mh = kMin(i.r.height(), h);
     
-    paintBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
+    paintBackground(i.p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
     
     if (style()->hasBorder() && !collapseBorders())
-        paintBorder(p, _tx, _ty, w, h, style());
+        paintBorder(i.p, _tx, _ty, w, h, style());
 }
 
 void RenderTable::calcMinMaxWidth()
@@ -1379,8 +1377,7 @@ int RenderTableSection::layoutRows( int toAdd )
 }
 
 
-void RenderTableSection::paint( QPainter *p, int x, int y, int w, int h,
-				int tx, int ty, PaintAction paintAction)
+void RenderTableSection::paint(PaintInfo& i, int tx, int ty)
 {
     unsigned int totalRows = grid.size();
     unsigned int totalCols = table()->columns.size();
@@ -1390,6 +1387,9 @@ void RenderTableSection::paint( QPainter *p, int x, int y, int w, int h,
 
     // check which rows and cols are visible and only paint these
     // ### fixme: could use a binary search here
+    PaintAction paintAction = i.phase;
+    int x = i.r.x(); int y = i.r.y(); int w = i.r.width(); int h = i.r.height();
+
     int os = 2*maximalOutlineSize(paintAction);
     unsigned int startrow = 0;
     unsigned int endrow = totalRows;
@@ -1431,7 +1431,7 @@ void RenderTableSection::paint( QPainter *p, int x, int y, int w, int h,
 #ifdef TABLE_PRINT
 		kdDebug( 6040 ) << "painting cell " << r << "/" << c << endl;
 #endif
-		cell->paint( p, x, y, w, h, tx, ty, paintAction);
+		cell->paint(i, tx, ty);
 	    }
 	}
     }
@@ -2061,28 +2061,24 @@ static void outlineBox(QPainter *p, int _tx, int _ty, int w, int h)
 }
 #endif
 
-void RenderTableCell::paint(QPainter *p, int _x, int _y,
-                                       int _w, int _h, int _tx, int _ty, PaintAction paintAction)
+void RenderTableCell::paint(PaintInfo& i, int _tx, int _ty)
 {
 
 #ifdef TABLE_PRINT
     kdDebug( 6040 ) << renderName() << "(RenderTableCell)::paint() w/h = (" << width() << "/" << height() << ")" << " _y/_h=" << _y << "/" << _h << endl;
 #endif
 
-    if (needsLayout()) return;
-
     _tx += m_x;
     _ty += m_y + _topExtra;
 
     // check if we need to do anything at all...
-    int os = 2*maximalOutlineSize(paintAction);
-    if(!overhangingContents() && ((_ty-_topExtra >= _y + _h + os)
-        || (_ty + m_height + _bottomExtra <= _y - os))) return;
-
-    paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
+    int os = 2*maximalOutlineSize(i.phase);
+    if (!overhangingContents() && ((_ty - _topExtra >= i.r.y() + i.r.height() + os)
+                                   || (_ty + m_height + _bottomExtra <= i.r.y() - os))) return;
+    RenderBlock::paintObject(i, _tx, _ty);
 
 #ifdef BOX_DEBUG
-    ::outlineBox( p, _tx, _ty - _topExtra, width(), height() + borderTopExtra() + borderBottomExtra());
+    ::outlineBox( i.p, _tx, _ty - _topExtra, width(), height() + borderTopExtra() + borderBottomExtra());
 #endif
 }
 
@@ -2237,21 +2233,7 @@ QRect RenderTableCell::getAbsoluteRepaintRect()
     return r;
 }
 
-void RenderTableCell::paintObject(QPainter* p, int _x, int _y, int _w, int _h,
-                                  int _tx, int _ty, PaintAction paintAction)
-{
-    if (paintAction == PaintActionCollapsedTableBorders && style()->visibility() == VISIBLE) {
-        int w = width();
-        int h = height() + borderTopExtra() + borderBottomExtra();
-        _ty -= borderTopExtra();
-        paintCollapsedBorder(p, _tx, _ty, w, h);
-    }
-    else
-        RenderBlock::paintObject(p, _x, _y, _w, _h, _tx, _ty, paintAction);
-}
-
-void RenderTableCell::paintBoxDecorations(QPainter *p,int, int _y,
-                                          int, int _h, int _tx, int _ty)
+void RenderTableCell::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
 {
     RenderTable* tableElt = table();
     if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
@@ -2300,15 +2282,15 @@ void RenderTableCell::paintBoxDecorations(QPainter *p,int, int _y,
 	}
     }
 
-    int my = QMAX(_ty,_y);
-    int end = QMIN( _y + _h,  _ty + h );
+    int my = kMax(_ty, i.r.y());
+    int end = kMin(i.r.y() + i.r.height(), _ty + h);
     int mh = end - my;
 
     if ( bg || c.isValid() )
-	paintBackground(p, c, bg, my, mh, _tx, _ty, w, h);
+	paintBackground(i.p, c, bg, my, mh, _tx, _ty, w, h);
 
     if (style()->hasBorder() && !tableElt->collapseBorders())
-        paintBorder(p, _tx, _ty, w, h, style());
+        paintBorder(i.p, _tx, _ty, w, h, style());
 }
 
 
diff --git a/WebCore/khtml/rendering/render_table.h b/WebCore/khtml/rendering/render_table.h
index 30ba12d..2273476 100644
--- a/WebCore/khtml/rendering/render_table.h
+++ b/WebCore/khtml/rendering/render_table.h
@@ -104,10 +104,8 @@ public:
     virtual int overflowHeight(bool includeInterior=true) const { return height(); }
     virtual int overflowWidth(bool includeInterior=true) const { return width(); }
     virtual void addChild(RenderObject *child, RenderObject *beforeChild = 0);
-    virtual void paint( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty, PaintAction paintAction);
-    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty);
+    virtual void paint(PaintInfo& i, int tx, int ty);
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty);
     virtual void layout();
     virtual void calcMinMaxWidth();
     virtual void close();
@@ -251,8 +249,7 @@ public:
 	return (*(grid[row].row))[col];
     }
 
-    virtual void paint( QPainter *, int x, int y, int w, int h,
-                        int tx, int ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     int numRows() const { return grid.size(); }
     int getBaseline(int row) {return grid[row].baseLine;}
@@ -365,8 +362,7 @@ public:
     int getCellPercentageHeight() const;
     void setCellPercentageHeight(int h);
     
-    virtual void paint( QPainter* p, int x, int y,
-                        int w, int h, int tx, int ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     void paintCollapsedBorder(QPainter* p, int x, int y, int w, int h);
     
@@ -390,14 +386,10 @@ public:
     virtual void dump(QTextStream *stream, QString ind = "") const;
 #endif
 
-    virtual void paintObject(QPainter *, int x, int y, int w, int h,
-                             int tx, int ty, PaintAction paintAction);
-    
     virtual QRect getAbsoluteRepaintRect();
     
 protected:
-    virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
-                                     int _w, int _h, int _tx, int _ty);
+    virtual void paintBoxDecorations(PaintInfo& i, int _tx, int _ty);
     
     short _row;
     short _col;
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 9345c1a..ca32c83 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -532,9 +532,18 @@ correctedTextColor(QColor textColor, QColor backgroundColor)
     return textColor.light();
 }
 
-void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
-                             int tx, int ty, PaintAction paintAction)
+void RenderText::paint(PaintInfo& i, int tx, int ty)
 {
+    if (i.phase != PaintActionForeground && i.phase != PaintActionSelection)
+        return;
+    
+    if (style()->visibility() != VISIBLE || !firstTextBox())
+        return;
+    
+    if (ty + firstTextBox()->yPos() > i.r.y() + i.r.height()) return;
+    if (ty + lastTextBox()->yPos() + lastTextBox()->height() < i.r.y()) return;
+    
+    QPainter* p = i.p;
     RenderStyle* pseudoStyle = style(true);
     if (pseudoStyle == style()) pseudoStyle = 0;
     int d = style()->textDecorationsInEffect();
@@ -542,7 +551,7 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
     
     // Walk forward until we hit the first line that needs to be painted.
     InlineTextBox* s = firstTextBox();
-    for (; s && !s->checkVerticalPoint(y, ty, h); s = s->nextTextBox());
+    for (; s && !s->checkVerticalPoint(i.r.y(), ty, i.r.height()); s = s->nextTextBox());
     if (!s) return;
     
     // Now calculate startPos and endPos, for painting selection.
@@ -568,7 +577,7 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
 #if APPLE_CHANGES
     // Do one pass for the selection, then another for the rest.
     bool haveSelection = startPos != endPos && !isPrinting && selectionState() != SelectionNone;
-    if (!haveSelection && paintAction == PaintActionSelection) {
+    if (!haveSelection && i.phase == PaintActionSelection) {
         // When only painting the selection, don't bother to paint if there is none.
         return;
     }
@@ -576,7 +585,7 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
     InlineTextBox* startBox = s;
     for (int pass = 0; pass < (haveSelection ? 2 : 1); pass++) {
         s = startBox;
-        bool drawSelectionBackground = haveSelection && pass == 0 && paintAction != PaintActionSelection;
+        bool drawSelectionBackground = haveSelection && pass == 0 && i.phase != PaintActionSelection;
         bool drawText = !haveSelection || pass == 1;
 #endif
 
@@ -586,13 +595,13 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
         if (isPrinting)
         {
             // FIXME: Need to understand what this section is doing.
-            if (ty+s->m_y < y)
+            if (ty+s->m_y < i.r.y())
             {
                // This has been printed already we suppose.
                continue;
             }
 
-            if (ty+s->m_y+s->height() > y+h)
+            if (ty+s->m_y+s->height() > i.r.y() + i.r.height())
             {
                RenderCanvas* canvasObj = canvas();
                if (ty+s->m_y < canvasObj->truncatedAt())
@@ -638,7 +647,7 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
 #endif
         
         if (s->m_len > 0) {
-            bool paintSelectedTextOnly = (paintAction == PaintActionSelection);
+            bool paintSelectedTextOnly = (i.phase == PaintActionSelection);
             bool paintSelectedTextSeparately = false; // Whether or not we have to do multiple paints.  Only
                                            // necessary when a custom ::selection foreground color is applied.
             QColor selectionColor = p->pen().color();
@@ -737,7 +746,7 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
             } 
         }
         
-        if (d != TDNONE && paintAction == PaintActionForeground &&
+        if (d != TDNONE && i.phase == PaintActionForeground &&
             style()->htmlHacks()) {
             p->setPen(_style->color());
             s->paintDecoration(p, tx, ty, d);
@@ -775,31 +784,13 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
         }
 #endif
 
-    } while (((s = s->nextTextBox()) != 0) && s->checkVerticalPoint(y, ty, h));
+    } while (((s = s->nextTextBox()) != 0) && s->checkVerticalPoint(i.r.y(), ty, i.r.height()));
 
 #if APPLE_CHANGES
     } // end of for loop
 #endif
 }
 
-void RenderText::paint(QPainter *p, int x, int y, int w, int h,
-                       int tx, int ty, PaintAction paintAction)
-{
-    if (paintAction != PaintActionForeground && paintAction != PaintActionSelection)
-        return;
-    
-    if (style()->visibility() != VISIBLE)
-        return;
-
-    if (!firstTextBox())
-        return;
-    
-    if (ty + firstTextBox()->yPos() > y + h) return;
-    if (ty + lastTextBox()->yPos() + lastTextBox()->height() < y ) return;
-
-    paintObject(p, x, y, w, h, tx, ty, paintAction);
-}
-
 #ifdef APPLE_CHANGES
 
 bool RenderText::allAscii() const
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index b505a0e..3fd9b90 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -116,10 +116,7 @@ public:
 
     virtual void setStyle(RenderStyle *style);
     
-    virtual void paint(QPainter *, int x, int y, int w, int h,
-                       int tx, int ty, PaintAction paintAction);
-    virtual void paintObject(QPainter *, int x, int y, int w, int h,
-                             int tx, int ty, PaintAction paintAction);
+    virtual void paint(PaintInfo& i, int tx, int ty);
 
     void deleteTextBoxes();
     virtual void detach();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list