patch to fix redrawing for table elements with background images

Darin Adler darin at apple.com
Mon Dec 8 18:43:45 CET 2003


Table elements that have background images did not have the code 
necessary to trigger appropriate repaints. This becomes a real issue 
when using the new incremental repaint support that's in our tip of 
tree.

-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2343
diff -p -u -u -p -r1.2343 ChangeLog
--- ChangeLog	2003/12/08 06:04:12	1.2343
+++ ChangeLog	2003/12/08 16:43:31
@@ -1,3 +1,18 @@
+2003-12-07  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixed 3502347: REGRESSION (100-116): bottom of login window sometimes missing (TR background image)
+
+        * khtml/rendering/render_object.h: Added setPixmap.
+        * khtml/rendering/render_object.cpp: (RenderObject::setPixmap): Moved this
+        function here from RenderBox. This code is needed for the table row class and
+        similar classes that supply a background image that is drawn by the table cell,
+        and those are not RenderBox subclasses.
+
+        * khtml/rendering/render_box.cpp: Removed setPixmap.
+        * khtml/rendering/render_box.h: Removed setPixmap.
+
 2003-12-06  John Sullivan  <sullivan at apple.com>
 
         - fixed <rdar://problem/3502655>: REGRESSION: Repro crash at espn.com
Index: khtml/rendering/render_box.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.101
diff -p -u -u -p -r1.101 khtml/rendering/render_box.cpp
--- khtml/rendering/render_box.cpp	2003/12/02 22:06:13	1.101
+++ khtml/rendering/render_box.cpp	2003/12/08 16:43:32
@@ -185,16 +185,6 @@ void RenderBox::paint(QPainter *p, int _
     }
 }
 
-void RenderBox::setPixmap(const QPixmap &, const QRect&, CachedImage *image)
-{
-    if (image && image->pixmap_size() == image->valid_rect().size() && parent()) {
-        if (element() && (element()->id() == ID_HTML || element()->id() == ID_BODY))
-            canvas()->repaint(); // repaint the entire canvas, since the background gets propagated up.
-        else
-            repaint();      //repaint bg when it finished loading
-    }
-}
-
 void RenderBox::paintRootBoxDecorations(QPainter *p,int, int _y,
                                         int, int _h, int _tx, int _ty)
 {
Index: khtml/rendering/render_box.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_box.h,v
retrieving revision 1.32
diff -p -u -u -p -r1.32 khtml/rendering/render_box.h
--- khtml/rendering/render_box.h	2003/10/29 08:57:20	1.32
+++ khtml/rendering/render_box.h	2003/12/08 16:43:32
@@ -95,8 +95,6 @@ public:
     virtual void repaintDuringLayoutIfMoved(int oldX, int oldY);
 #endif
     
-    virtual void setPixmap(const QPixmap &, const QRect&, CachedImage *);
-
     virtual short containingBlockWidth() const;
 
     virtual void calcWidth();
Index: khtml/rendering/render_object.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_object.cpp,v
retrieving revision 1.118
diff -p -u -u -p -r1.118 khtml/rendering/render_object.cpp
--- khtml/rendering/render_object.cpp	2003/12/03 22:46:41	1.118
+++ khtml/rendering/render_object.cpp	2003/12/08 16:43:33
@@ -1980,3 +1980,19 @@ QChar RenderObject::backslashAsCurrencyS
     return codec->backslashAsCurrencySymbol();
 #endif
 }
+
+void RenderObject::setPixmap(const QPixmap&, const QRect&, CachedImage *image)
+{
+    // Repaint when the background image finishes loading.
+    // This is needed for RenderBox objects, and also for table objects that hold
+    // backgrounds that are then respected by the table cells (which are RenderBox
+    // subclasses). It would be even better to find a more elegant way of doing this that
+    // would avoid putting this function and the CachedObjectClient base class into RenderObject.
+
+    if (image && image->pixmap_size() == image->valid_rect().size() && parent()) {
+        if (element() && (element()->id() == ID_HTML || element()->id() == ID_BODY))
+            canvas()->repaint();    // repaint the entire canvas since the background gets propagated up
+        else
+            repaint();              // repaint object, which is a box or a container with boxes inside it
+    }
+}
Index: khtml/rendering/render_object.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_object.h,v
retrieving revision 1.93
diff -p -u -u -p -r1.93 khtml/rendering/render_object.h
--- khtml/rendering/render_object.h	2003/11/16 20:48:12	1.93
+++ khtml/rendering/render_object.h	2003/12/08 16:43:34
@@ -677,6 +677,8 @@ public:
     // Convenience, to avoid repeating the code to dig down to get this.
     QChar backslashAsCurrencySymbol() const;
 
+    virtual void setPixmap(const QPixmap&, const QRect&, CachedImage *);
+
 protected:
     virtual void selectionStartEnd(int& spos, int& epos);
 
-------------- next part --------------


     -- Darin


More information about the Khtml-devel mailing list