Border collapsing fix
David Hyatt
hyatt at apple.com
Mon Dec 1 20:23:07 CET 2003
I did something stupid that caused tables not to paint backgrounds if
they had border-collapse set... here's the fix (not the most elegant
fix in the world, but it works).
dave
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2315
diff -u -p -r1.2315 ChangeLog
--- ChangeLog 2003/11/22 00:27:21 1.2315
+++ ChangeLog 2003/12/01 19:12:50
@@ -1,3 +1,15 @@
+2003-12-01 David Hyatt <hyatt at apple.com>
+
+ Fix for 3490959, collapsed border tables don't paint backgrounds.
+
+ Reviewed by NOBODY (OOPS!).
+
+ * khtml/rendering/render_table.cpp:
+ (RenderTable::setStyle):
+ (RenderTable::paint):
+ (RenderTable::paintBoxDecorations):
+ * khtml/rendering/render_table.h:
+
=== Safari-115 ===
2003-11-21 Maciej Stachowiak <mjs at apple.com>
Index: khtml/rendering/render_table.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.84
diff -u -p -r1.84 khtml/rendering/render_table.cpp
--- khtml/rendering/render_table.cpp 2003/11/16 20:48:12 1.84
+++ khtml/rendering/render_table.cpp 2003/12/01 19:12:50
@@ -108,10 +108,6 @@ void RenderTable::setStyle(RenderStyle *
} else
tableLayout = new AutoTableLayout(this);
}
-
- // The table never paints its border if it collapses. It lets the cells do the painting.
- if (collapseBorders())
- setShouldPaintBackgroundOrBorder(false);
}
void RenderTable::addChild(RenderObject *child, RenderObject *beforeChild)
@@ -471,6 +467,26 @@ void RenderTable::paint( QPainter *p, in
#ifdef BOX_DEBUG
outlineBox(p, _tx, _ty, "blue");
#endif
+}
+
+void RenderTable::paintBoxDecorations(QPainter *p,int _x, int _y,
+ int _w, int _h, int _tx, int _ty)
+{
+ int w = width();
+ int h = height() + borderTopExtra() + borderBottomExtra();
+ _ty -= borderTopExtra();
+
+ int my = kMax(_ty,_y);
+ int mh;
+ if (_ty<_y)
+ mh= kMax(0,h-(_y-_ty));
+ else
+ mh = kMin(_h,h);
+
+ paintBackground(p, style()->backgroundColor(), style()->backgroundImage(), my, mh, _tx, _ty, w, h);
+
+ if (style()->hasBorder() && !collapseBorders())
+ paintBorder(p, _tx, _ty, w, h, style());
}
void RenderTable::calcMinMaxWidth()
Index: khtml/rendering/render_table.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.h,v
retrieving revision 1.30
diff -u -p -r1.30 khtml/rendering/render_table.h
--- khtml/rendering/render_table.h 2003/10/23 22:23:25 1.30
+++ khtml/rendering/render_table.h 2003/12/01 19:12:50
@@ -106,6 +106,8 @@ public:
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 layout();
virtual void calcMinMaxWidth();
virtual void close();
-------------- next part --------------
More information about the Khtml-devel
mailing list