diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 7fd30cab729..5f3ad8f0d47 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -584,6 +584,11 @@ nsFrameItems::AddChild(nsIFrame* aChild) lastChild->SetNextSibling(aChild); lastChild = aChild; } + // if aChild has siblings, lastChild needs to be the last one + nsIFrame* sib; + for (lastChild->GetNextSibling(&sib); sib; sib->GetNextSibling(&sib)) { + lastChild = sib; + } } // ----------------------------------------------------------- @@ -2813,16 +2818,15 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel if (cgContent) { cgContent->GetSpan(&span); nsIFrame* lastCol = aNewFrame; + nsCOMPtr styleContext; for (PRInt32 spanX = 1; spanX < span; spanX++) { - nsCOMPtr styleContext; - aPresContext->ResolvePseudoStyleContextFor(aContent, nsHTMLAtoms::tableColPseudo, aStyleContext, - getter_AddRefs(styleContext)); + // The same content node should always resolve to the same style context. + if (1 == spanX) + aNewFrame->GetStyleContext(getter_AddRefs(styleContext)); nsIFrame* newCol; rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv; - InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol); - if (aIsPseudoParent) { - aPresContext->ReParentStyleContext(newCol, aStyleContext); - } + InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, + styleContext, nsnull, newCol); ((nsTableColFrame*)newCol)->SetType(eColAnonymousCol); lastCol->SetNextSibling(newCol); lastCol = newCol; @@ -2833,13 +2837,14 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel nsFrameItems childItems; nsIFrame* captionFrame; rv = TableProcessChildren(aPresShell, aPresContext, aState, aContent, aNewFrame, - aTableCreator, childItems, captionFrame); if (NS_FAILED(rv)) return rv; + aTableCreator, childItems, captionFrame); + if (NS_FAILED(rv)) return rv; aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList); if (aIsPseudoParent) { aState.mPseudoFrames.mColGroup.mChildList.AddChild(aNewFrame); } } - + return rv; } @@ -3217,7 +3222,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell, // for every table related frame except captions and ones with pseudo parents, // link into the child list - if (childFrame && !childIsCaption && !isPseudoParent) { + if (childFrame && !childIsCaption && !isPseudoParent) { aChildItems.AddChild(childFrame); } return rv; diff --git a/mozilla/layout/html/document/src/html.css b/mozilla/layout/html/document/src/html.css index 8eebe3e68c8..004a000a030 100644 --- a/mozilla/layout/html/document/src/html.css +++ b/mozilla/layout/html/document/src/html.css @@ -231,13 +231,10 @@ tr { display: table-row; } +/* The :-moz-table-column pseudo-element is for extra columns at the end + of a table. */ col, *|*:-moz-table-column { display: table-column; - border: inherit; - width: inherit; - height: inherit; - background: inherit; - border: inherit; } colgroup, *|*:-moz-table-column-group { diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 7fd30cab729..5f3ad8f0d47 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -584,6 +584,11 @@ nsFrameItems::AddChild(nsIFrame* aChild) lastChild->SetNextSibling(aChild); lastChild = aChild; } + // if aChild has siblings, lastChild needs to be the last one + nsIFrame* sib; + for (lastChild->GetNextSibling(&sib); sib; sib->GetNextSibling(&sib)) { + lastChild = sib; + } } // ----------------------------------------------------------- @@ -2813,16 +2818,15 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel if (cgContent) { cgContent->GetSpan(&span); nsIFrame* lastCol = aNewFrame; + nsCOMPtr styleContext; for (PRInt32 spanX = 1; spanX < span; spanX++) { - nsCOMPtr styleContext; - aPresContext->ResolvePseudoStyleContextFor(aContent, nsHTMLAtoms::tableColPseudo, aStyleContext, - getter_AddRefs(styleContext)); + // The same content node should always resolve to the same style context. + if (1 == spanX) + aNewFrame->GetStyleContext(getter_AddRefs(styleContext)); nsIFrame* newCol; rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv; - InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol); - if (aIsPseudoParent) { - aPresContext->ReParentStyleContext(newCol, aStyleContext); - } + InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, + styleContext, nsnull, newCol); ((nsTableColFrame*)newCol)->SetType(eColAnonymousCol); lastCol->SetNextSibling(newCol); lastCol = newCol; @@ -2833,13 +2837,14 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel nsFrameItems childItems; nsIFrame* captionFrame; rv = TableProcessChildren(aPresShell, aPresContext, aState, aContent, aNewFrame, - aTableCreator, childItems, captionFrame); if (NS_FAILED(rv)) return rv; + aTableCreator, childItems, captionFrame); + if (NS_FAILED(rv)) return rv; aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList); if (aIsPseudoParent) { aState.mPseudoFrames.mColGroup.mChildList.AddChild(aNewFrame); } } - + return rv; } @@ -3217,7 +3222,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell, // for every table related frame except captions and ones with pseudo parents, // link into the child list - if (childFrame && !childIsCaption && !isPseudoParent) { + if (childFrame && !childIsCaption && !isPseudoParent) { aChildItems.AddChild(childFrame); } return rv; diff --git a/mozilla/layout/html/tests/table/bugs/bug139524-1.html b/mozilla/layout/html/tests/table/bugs/bug139524-1.html new file mode 100644 index 00000000000..e6fd6d5380c --- /dev/null +++ b/mozilla/layout/html/tests/table/bugs/bug139524-1.html @@ -0,0 +1,18 @@ + + + +testcase: col with multilength width and span + + + + + + + + + + + +
060504
+ + diff --git a/mozilla/layout/html/tests/table/bugs/bug139524-2.html b/mozilla/layout/html/tests/table/bugs/bug139524-2.html new file mode 100644 index 00000000000..314acc370dc --- /dev/null +++ b/mozilla/layout/html/tests/table/bugs/bug139524-2.html @@ -0,0 +1,49 @@ + + + +SPAN attribute in COL element being ignored. + + + + + +

SPAN attribute of COL element being ignored in Mozilla 1.0 rc1

+ +

(Note: this is a regression bug - I don't know when it appeared, but I remember the SPAN attribute on COL elements worked fine sometime before Mozilla 0.9.6)

+ +

The following TABLE has a COLGROUP structure of:

+
<colgroup>
+ <col width="100" span="2">
+ <col width="200">
+</colgroup>
+
+ +

So the first two colums should both be 100px wide, and the third should be 200px wide.

+

However, the first column is 100px, the second is 200px, and the third is the default width.

+

So it would appear that the SPAN attribute is being ignored.

+ + + ++ + + + + + + + + + +
col 1col 2col 3
+ + + diff --git a/mozilla/layout/html/tests/table/bugs/bug139524-3.html b/mozilla/layout/html/tests/table/bugs/bug139524-3.html new file mode 100644 index 00000000000..9f1ee126202 --- /dev/null +++ b/mozilla/layout/html/tests/table/bugs/bug139524-3.html @@ -0,0 +1,20 @@ + + + +testcase: col with multilength width and span + + + ++ + + + + + + + + +
060504
+ + diff --git a/mozilla/layout/html/tests/table/bugs/bug139524-4.html b/mozilla/layout/html/tests/table/bugs/bug139524-4.html new file mode 100644 index 00000000000..a3ac86d302c --- /dev/null +++ b/mozilla/layout/html/tests/table/bugs/bug139524-4.html @@ -0,0 +1,18 @@ + + Table col span test + + + + + + + + + + + + + +
1234
+ + diff --git a/mozilla/layout/html/tests/table/bugs/file_list1.txt b/mozilla/layout/html/tests/table/bugs/file_list1.txt index 474f955ddac..636d60f66db 100644 --- a/mozilla/layout/html/tests/table/bugs/file_list1.txt +++ b/mozilla/layout/html/tests/table/bugs/file_list1.txt @@ -86,3 +86,7 @@ file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-1.html file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-2.html file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-3.html file:///s|/mozilla/layout/html/tests/table/bugs/bug138725.html +file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-1.html +file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-2.html +file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-3.html +file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-4.html diff --git a/mozilla/layout/style/html.css b/mozilla/layout/style/html.css index 8eebe3e68c8..004a000a030 100644 --- a/mozilla/layout/style/html.css +++ b/mozilla/layout/style/html.css @@ -231,13 +231,10 @@ tr { display: table-row; } +/* The :-moz-table-column pseudo-element is for extra columns at the end + of a table. */ col, *|*:-moz-table-column { display: table-column; - border: inherit; - width: inherit; - height: inherit; - background: inherit; - border: inherit; } colgroup, *|*:-moz-table-column-group {