Bug 542620. Need to paint the table background if columns or column-groups have backgrounds. r=dbaron

--HG--
extra : rebase_source : aebb3f9c4c83d2eecc779939e87dcf7195f5d103
This commit is contained in:
Robert O'Callahan 2010-02-02 12:21:13 +13:00
Родитель 67692a0491
Коммит f69799234f
4 изменённых файлов: 40 добавлений и 19 удалений

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<body>
<table>
<tr><td style="background:lime; width:100px; height:100px;"></td></tr>
</table>
<table>
<tr><td style="background:lime; width:100px; height:100px;"></td></tr>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<body>
<table>
<col style="background: lime"></col>
<tr><td style="width:100px; height:100px;"></td></tr>
</table>
<table>
<colgroup style="background: lime"></colgroup>
<tr><td style="width:100px; height:100px;"></td></tr>
</table>
</body>
</html>

Просмотреть файл

@ -1381,4 +1381,5 @@ fails HTTP(..) == 518172-2b.html 518172-b-ref.html # bug 518172
== 537471-1.html 537471-1-ref.html
== 538935-1.html 538935-1-ref.html
== 539226-1.html about:blank
== 542620-1.html 542620-1-ref.html
== 541382-1.html 541382-1-ref.html

Просмотреть файл

@ -1273,28 +1273,23 @@ IsFrameAllowedInTable(nsIAtom* aType)
#endif
static PRBool
AnyTablePartHasBorderOrBackground(nsIFrame* aFrame)
AnyTablePartHasBorderOrBackground(const nsFrameList& aFrames)
{
NS_ASSERTION(IsFrameAllowedInTable(aFrame->GetType()), "unexpected frame type");
for (nsFrameList::Enumerator e(aFrames); !e.AtEnd(); e.Next()) {
nsIFrame* f = e.get();
NS_ASSERTION(IsFrameAllowedInTable(f->GetType()), "unexpected frame type");
nsIScrollableFrame *scrollFrame = do_QueryFrame(aFrame);
if (scrollFrame) {
return AnyTablePartHasBorderOrBackground(scrollFrame->GetScrolledFrame());
}
if (f->GetStyleVisibility()->IsVisible() &&
(!f->GetStyleBackground()->IsTransparent() ||
f->GetStyleDisplay()->mAppearance ||
f->HasBorder()))
return PR_TRUE;
if (aFrame->GetStyleVisibility()->IsVisible() &&
(!aFrame->GetStyleBackground()->IsTransparent() ||
aFrame->GetStyleDisplay()->mAppearance ||
aFrame->HasBorder()))
return PR_TRUE;
nsTableCellFrame *cellFrame = do_QueryFrame(f);
if (cellFrame)
continue;
nsTableCellFrame *cellFrame = do_QueryFrame(aFrame);
if (cellFrame)
return PR_FALSE;
nsFrameList children = aFrame->GetChildList(nsnull);
for (nsIFrame* f = children.FirstChild(); f; f = f->GetNextSibling()) {
if (AnyTablePartHasBorderOrBackground(f))
if (AnyTablePartHasBorderOrBackground(f->GetChildList(nsnull)))
return PR_TRUE;
}
@ -1331,7 +1326,8 @@ nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Specific visibility decisions are delegated to the table background
// painter, which handles borders and backgrounds for the table.
if (aBuilder->IsForEventDelivery() ||
AnyTablePartHasBorderOrBackground(this)) {
AnyTablePartHasBorderOrBackground(nsFrameList(this, GetNextSibling())) ||
AnyTablePartHasBorderOrBackground(mColGroups)) {
item = new (aBuilder) nsDisplayTableBorderBackground(this);
nsresult rv = aLists.BorderBackground()->AppendNewToTop(item);
NS_ENSURE_SUCCESS(rv, rv);