Don't go below BODY in search for a background color (Print only bug). b=294836 r+sr=bzbarsky

This commit is contained in:
mats.palmgren%bredband.net 2005-08-29 04:39:31 +00:00
Родитель 06566eee67
Коммит 7e23bbba0b
1 изменённых файлов: 9 добавлений и 20 удалений

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

@ -21,6 +21,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mats Palmgren <mats.palmgren@bredband.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -2576,32 +2577,20 @@ FindCanvasBackground(nsPresContext* aPresContext,
nsIFrame *firstChild = aForFrame->GetFirstChild(nsnull);
if (firstChild) {
const nsStyleBackground* result = firstChild->GetStyleBackground();
// for printing and print preview.. this should be a pageContentFrame
nsStyleContext* parentContext;
nsIFrame* topFrame = aForFrame;
if (firstChild->GetType() == nsLayoutAtoms::pageContentFrame) {
// we have to find the background style ourselves.. since the
// pageContentframe does not have content
while(firstChild){
for (nsIFrame* kidFrame = firstChild; nsnull != kidFrame; ) {
parentContext = kidFrame->GetStyleContext();
result = parentContext->GetStyleBackground();
if (!result->IsTransparent()) {
*aBackground = kidFrame->GetStyleBackground();
return PR_TRUE;
} else {
kidFrame = kidFrame->GetNextSibling();
}
}
firstChild = firstChild->GetFirstChild(nsnull);
}
return PR_FALSE; // nothing found for this
topFrame = firstChild->GetFirstChild(nsnull);
NS_ASSERTION(topFrame,
"nsPageContentFrame is missing a normal flow child");
NS_ASSERTION(topFrame->GetContent(),
"nsPageContentFrame child without content");
result = topFrame->GetStyleBackground();
}
// Check if we need to do propagation from BODY rather than HTML.
if (result->IsTransparent()) {
nsIContent* content = aForFrame->GetContent();
nsIContent* content = topFrame->GetContent();
if (content) {
// Use |GetOwnerDoc| so it works during destruction.
nsIDocument* document = content->GetOwnerDoc();