Replace the BodyFixupRule with code in nsCSSRendering to fix all the problems with dynamic style changes and backgrounds on the root element and the BODY element. Change the way the HTMLDocumentColorRule (for the table color quirk) is initialized since it used to depend on the BodyFixupRule. b=116161 (also fixes other bugs) r=attinasi sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@111511 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
845f74be1e
commit
b7194a0ea8
@ -3109,30 +3109,9 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
|
||||
// background-color: color, string, enum (flags), inherit
|
||||
if (eCSSUnit_Inherit == colorData.mBackColor.GetUnit()) { // do inherit first, so SetColor doesn't do it
|
||||
const nsStyleBackground* inheritBG = parentBG;
|
||||
if (inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT) {
|
||||
// walk up the contexts until we get to a context that does not have its
|
||||
// background propagated to its parent (or a context that has had its background
|
||||
// propagated from its child)
|
||||
if (nsnull != parentContext) {
|
||||
nsCOMPtr<nsIStyleContext> higherContext = getter_AddRefs(parentContext->GetParent());
|
||||
do {
|
||||
if (higherContext) {
|
||||
inheritBG = (const nsStyleBackground*)higherContext->GetStyleData(eStyleStruct_Background);
|
||||
if (inheritBG &&
|
||||
(!(inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) ||
|
||||
(inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_FROM_CHILD)) {
|
||||
// done walking up the higher contexts
|
||||
break;
|
||||
}
|
||||
higherContext = getter_AddRefs(higherContext->GetParent());
|
||||
}
|
||||
} while (higherContext);
|
||||
}
|
||||
}
|
||||
bg->mBackgroundColor = inheritBG->mBackgroundColor;
|
||||
bg->mBackgroundColor = parentBG->mBackgroundColor;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
bg->mBackgroundFlags |= (inheritBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
inherited = PR_TRUE;
|
||||
}
|
||||
else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||
|
||||
@ -56,7 +56,6 @@
|
||||
#include "nsIStyleRuleSupplier.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
|
||||
@ -173,8 +172,6 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument);
|
||||
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
@ -1324,24 +1321,6 @@ StyleSetImpl::ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
StyleSetImpl::RemoveBodyFixupRule(nsIDocument *aDocument)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> node;
|
||||
htmlDoc->GetBodyElement(getter_AddRefs(node));
|
||||
if (node) {
|
||||
nsCOMPtr<nsIBodySuper> bodyElement = do_QueryInterface(node);
|
||||
bodyElement->RemoveBodyFixupRule();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:content directory
|
||||
#
|
||||
nsIBodySuper.h
|
||||
nsIForm.h
|
||||
nsIFormControl.h
|
||||
nsILink.h
|
||||
|
||||
@ -29,7 +29,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = content
|
||||
|
||||
EXPORTS = \
|
||||
nsIBodySuper.h \
|
||||
nsIFormControl.h \
|
||||
nsIForm.h \
|
||||
nsILink.h \
|
||||
|
||||
@ -21,9 +21,15 @@
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
EXPORTS=nsIFormControl.h nsIForm.h nsILink.h nsIOptionElement.h \
|
||||
nsISelectElement.h nsIScriptElement.h nsIBodySuper.h \
|
||||
nsITextControlElement.h
|
||||
EXPORTS= \
|
||||
nsIFormControl.h \
|
||||
nsIForm.h \
|
||||
nsILink.h \
|
||||
nsIOptionElement.h \
|
||||
nsISelectElement.h \
|
||||
nsIScriptElement.h \
|
||||
nsITextControlElement.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=content
|
||||
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIBodySuper_h___
|
||||
#define nsIBodySuper_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
|
||||
// IID for the nsIBodySuper interface {61ed2ed8-1dd2-11b2-b51d-c0d42f7f5a56}
|
||||
|
||||
#define NS_IBODY_SUPER_IID \
|
||||
{0x61ed2ed8, 0x1dd2, 0x11b2, {0xb5, 0x1d, 0xc0, 0xd4, 0x2f, 0x7f, 0x5a, 0x56}}
|
||||
|
||||
class nsIBodySuper : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBODY_SUPER_IID)
|
||||
|
||||
NS_IMETHOD RemoveBodyFixupRule(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIBodySuper_h___ */
|
||||
|
||||
|
||||
|
||||
@ -69,7 +69,6 @@
|
||||
#include "nsIView.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
#include "nsIViewManager.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -105,110 +104,7 @@ public:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BodyFixupRule : public nsIStyleRule {
|
||||
public:
|
||||
BodyFixupRule(nsHTMLBodyElement* aPart, nsIHTMLCSSStyleSheet* aSheet);
|
||||
virtual ~BodyFixupRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aValue) const;
|
||||
NS_IMETHOD HashValue(PRUint32& aValue) const;
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
// Strength is an out-of-band weighting, always maxint here
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const;
|
||||
|
||||
// The new mapping function.
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
|
||||
#endif
|
||||
|
||||
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
nsIHTMLCSSStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// special subclass of inner class to override set document
|
||||
class nsBodySuper: public nsGenericHTMLContainerElement,
|
||||
public nsIBodySuper
|
||||
{
|
||||
public:
|
||||
nsBodySuper();
|
||||
virtual ~nsBodySuper();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers);
|
||||
NS_IMETHOD RemoveBodyFixupRule();
|
||||
|
||||
BodyRule* mContentStyleRule;
|
||||
BodyFixupRule* mInlineStyleRule;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsBodySuper, nsGenericHTMLContainerElement, nsIBodySuper)
|
||||
|
||||
nsBodySuper::nsBodySuper() : nsGenericHTMLContainerElement(),
|
||||
mContentStyleRule(nsnull),
|
||||
mInlineStyleRule(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsBodySuper::~nsBodySuper()
|
||||
{
|
||||
if (nsnull != mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
if (nsnull != mInlineStyleRule) {
|
||||
mInlineStyleRule->mPart = nsnull;
|
||||
mInlineStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mInlineStyleRule);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBodySuper::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers)
|
||||
{
|
||||
if (nsnull != mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
|
||||
// destroy old style rule since the sheet will probably change
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
if (nsnull != mInlineStyleRule) {
|
||||
mInlineStyleRule->mPart = nsnull;
|
||||
mInlineStyleRule->mSheet = nsnull;
|
||||
|
||||
// destroy old style rule since the sheet will probably change
|
||||
NS_RELEASE(mInlineStyleRule);
|
||||
}
|
||||
return nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep,
|
||||
aCompileEventHandlers);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBodySuper::RemoveBodyFixupRule(void)
|
||||
{
|
||||
if (mInlineStyleRule) {
|
||||
mInlineStyleRule->mPart = nsnull;
|
||||
mInlineStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mInlineStyleRule);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsHTMLBodyElement : public nsBodySuper,
|
||||
class nsHTMLBodyElement : public nsGenericHTMLContainerElement,
|
||||
public nsIDOMHTMLBodyElement
|
||||
{
|
||||
public:
|
||||
@ -233,9 +129,10 @@ public:
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAReadableString& aValue,
|
||||
nsHTMLValue& aResult);
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers);
|
||||
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
PRInt32& aHint) const;
|
||||
#ifdef DEBUG
|
||||
@ -243,19 +140,11 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
friend class BodyRule;
|
||||
friend class BodyFixupRule;
|
||||
BodyRule* mContentStyleRule;
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLBodyElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLBodyElement, nsGenericElement)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@ -464,287 +353,6 @@ void BodyRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
BodyFixupRule::BodyFixupRule(nsHTMLBodyElement* aPart,
|
||||
nsIHTMLCSSStyleSheet* aSheet)
|
||||
: mPart(aPart),
|
||||
mSheet(aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
BodyFixupRule::~BodyFixupRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(BodyFixupRule);
|
||||
NS_IMPL_RELEASE(BodyFixupRule);
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(BodyFixupRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::Equals(const nsIStyleRule* aRule, PRBool& aResult) const
|
||||
{
|
||||
aResult = PRBool(this == aRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::HashValue(PRUint32& aValue) const
|
||||
{
|
||||
aValue = NS_PTR_TO_INT32(mPart);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Strength is an out-of-band weighting, always MaxInt here
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::GetStrength(PRInt32& aStrength) const
|
||||
{
|
||||
aStrength = 2000000000;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
HandleFixedBackground(nsIPresContext* aPresContext,
|
||||
nsIPresShell *aPresShell,
|
||||
PRBool aIsFixed)
|
||||
{
|
||||
// we have to tell the canvas' view if we want to bitblt on scroll or not
|
||||
// - if we have a fixed background we cannot bitblt when we scroll,
|
||||
// otherewise we can
|
||||
nsIView* viewportView = nsnull;
|
||||
nsIFrame* canvasFrame = nsnull;
|
||||
|
||||
nsCOMPtr<nsIFrameManager> manager;
|
||||
nsresult rv = aPresShell->GetFrameManager(getter_AddRefs(manager));
|
||||
if (NS_SUCCEEDED(rv) && manager) {
|
||||
manager->GetCanvasFrame(aPresContext, &canvasFrame);
|
||||
}
|
||||
|
||||
if (canvasFrame) {
|
||||
canvasFrame->GetView(aPresContext, (nsIView**)&viewportView);
|
||||
}
|
||||
if (viewportView) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
aPresShell->GetViewManager(getter_AddRefs(vm));
|
||||
vm->SetViewBitBltEnabled(viewportView, !aIsFixed);
|
||||
}
|
||||
}
|
||||
|
||||
static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
|
||||
{
|
||||
// get the context data for the BODY, HTML element, and CANVAS
|
||||
nsCOMPtr<nsIStyleContext> parentContext;
|
||||
nsCOMPtr<nsIStyleContext> canvasContext;
|
||||
// this is used below to hold the default canvas style. Since we may need the color data
|
||||
// until the end of this function, we declare the nsCOMPtr here.
|
||||
nsCOMPtr<nsIStyleContext> recalculatedCanvasStyle;
|
||||
parentContext = dont_AddRef(aRuleData->mStyleContext->GetParent());
|
||||
|
||||
if (parentContext){
|
||||
canvasContext = getter_AddRefs(parentContext->GetParent());
|
||||
}
|
||||
|
||||
if (!(parentContext && canvasContext))
|
||||
return;
|
||||
|
||||
// get the context data for the background information
|
||||
PRBool bFixedBackground = PR_FALSE;
|
||||
nsStyleBackground* canvasStyleBackground;
|
||||
nsStyleBackground* htmlStyleBackground;
|
||||
nsStyleBackground* bodyStyleBackground;
|
||||
bodyStyleBackground =
|
||||
(nsStyleBackground*)aRuleData->mStyleContext->GetUniqueStyleData(aRuleData->mPresContext, eStyleStruct_Background);
|
||||
htmlStyleBackground =
|
||||
(nsStyleBackground*)parentContext->GetUniqueStyleData(aRuleData->mPresContext, eStyleStruct_Background);
|
||||
canvasStyleBackground =
|
||||
(nsStyleBackground*)canvasContext->GetUniqueStyleData(aRuleData->mPresContext, eStyleStruct_Background);
|
||||
nsStyleBackground* styleBackground = bodyStyleBackground; // default to BODY
|
||||
|
||||
NS_ASSERTION(bodyStyleBackground && htmlStyleBackground && canvasStyleBackground, "null context data");
|
||||
if (!(bodyStyleBackground && htmlStyleBackground && canvasStyleBackground))
|
||||
return;
|
||||
|
||||
// Use the CSS precedence rules for dealing with background: if the value
|
||||
// of the 'background' property for the HTML element is different from
|
||||
// 'transparent' then use it, else use the value of the 'background' property
|
||||
// for the BODY element
|
||||
|
||||
// See if the BODY or HTML has a non-transparent background
|
||||
// or if the HTML element was previously propagated from its child (the BODY)
|
||||
//
|
||||
// Also, check if the canvas has a non-transparent background in case it is being
|
||||
// cleared via the DOM
|
||||
if ((!bodyStyleBackground->BackgroundIsTransparent()) ||
|
||||
(!htmlStyleBackground->BackgroundIsTransparent()) ||
|
||||
(!canvasStyleBackground->BackgroundIsTransparent()) ||
|
||||
(NS_STYLE_BG_PROPAGATED_FROM_CHILD == (htmlStyleBackground->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_FROM_CHILD)) ) {
|
||||
|
||||
// if HTML background is not transparent then we use its background for the canvas,
|
||||
// otherwise we use the BODY's background
|
||||
if (!(htmlStyleBackground->BackgroundIsTransparent())) {
|
||||
styleBackground = htmlStyleBackground;
|
||||
} else if (!(bodyStyleBackground->BackgroundIsTransparent())) {
|
||||
styleBackground = bodyStyleBackground;
|
||||
} else {
|
||||
PRBool isPaginated = PR_FALSE;
|
||||
aRuleData->mPresContext->IsPaginated(&isPaginated);
|
||||
nsIAtom* rootPseudo = isPaginated ? nsLayoutAtoms::pageSequencePseudo : nsLayoutAtoms::canvasPseudo;
|
||||
|
||||
nsCOMPtr<nsIStyleContext> canvasParentStyle = getter_AddRefs(canvasContext->GetParent());
|
||||
aRuleData->mPresContext->ResolvePseudoStyleContextFor(nsnull, rootPseudo, canvasParentStyle,
|
||||
PR_TRUE, // IMPORTANT don't share; otherwise things go wrong
|
||||
getter_AddRefs(recalculatedCanvasStyle));
|
||||
|
||||
styleBackground = (nsStyleBackground*)recalculatedCanvasStyle->GetStyleData(eStyleStruct_Background);
|
||||
}
|
||||
|
||||
// set the canvas bg values
|
||||
canvasStyleBackground->mBackgroundAttachment = styleBackground->mBackgroundAttachment;
|
||||
canvasStyleBackground->mBackgroundRepeat = styleBackground->mBackgroundRepeat;
|
||||
canvasStyleBackground->mBackgroundColor = styleBackground->mBackgroundColor;
|
||||
canvasStyleBackground->mBackgroundXPosition = styleBackground->mBackgroundXPosition;
|
||||
canvasStyleBackground->mBackgroundYPosition = styleBackground->mBackgroundYPosition;
|
||||
canvasStyleBackground->mBackgroundImage = styleBackground->mBackgroundImage;
|
||||
canvasStyleBackground->mBackgroundFlags = (styleBackground->mBackgroundFlags & ~NS_STYLE_BG_PROPAGATED_TO_PARENT);
|
||||
canvasStyleBackground->mBackgroundFlags |= NS_STYLE_BG_PROPAGATED_FROM_CHILD;
|
||||
|
||||
bFixedBackground =
|
||||
canvasStyleBackground->mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED ? PR_TRUE : PR_FALSE;
|
||||
|
||||
// only reset the background values if we used something other than the default canvas style
|
||||
if (styleBackground == htmlStyleBackground || styleBackground == bodyStyleBackground) {
|
||||
// reset the background values for the context that was propagated
|
||||
styleBackground->mBackgroundImage.SetLength(0);
|
||||
styleBackground->mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
|
||||
styleBackground->mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT |
|
||||
NS_STYLE_BG_IMAGE_NONE |
|
||||
NS_STYLE_BG_PROPAGATED_TO_PARENT;
|
||||
// NOTE: if this was the BODY then this flag is somewhat erroneous
|
||||
// as it was propagated to the GRANDPARENT! We patch this next by
|
||||
// marking the HTML's background as propagated too, so we can walk
|
||||
// up the chain of contexts that have to propagation bit set (see
|
||||
// nsCSSStyleRule.cpp MapDeclarationColorInto)
|
||||
}
|
||||
|
||||
if (styleBackground == bodyStyleBackground) {
|
||||
htmlStyleBackground->mBackgroundFlags |= NS_STYLE_BG_PROPAGATED_TO_PARENT;
|
||||
}
|
||||
}
|
||||
|
||||
// To fix the regression in bug 70831 caused by the fix to bug 67478,
|
||||
// use the nsStyleBackground that we would have used before the fix to
|
||||
// bug 67478.
|
||||
nsStyleBackground* documentStyleBackground = styleBackground;
|
||||
if (bodyStyleBackground != styleBackground && htmlStyleBackground != styleBackground) {
|
||||
nsCompatibility mode;
|
||||
aRuleData->mPresContext->GetCompatibilityMode(&mode);
|
||||
if (eCompatibility_NavQuirks == mode)
|
||||
documentStyleBackground = bodyStyleBackground;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aRuleData->mPresContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIHTMLContentContainer> htmlContainer(do_QueryInterface(doc));
|
||||
|
||||
if (htmlContainer) {
|
||||
nsCOMPtr<nsIHTMLStyleSheet> styleSheet;
|
||||
htmlContainer->GetAttributeStyleSheet(getter_AddRefs(styleSheet));
|
||||
|
||||
if (styleSheet) {
|
||||
const nsStyleColor* bodyStyleColor = (const nsStyleColor*)aRuleData->mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
styleSheet->SetDocumentForegroundColor(bodyStyleColor->mColor);
|
||||
if (!(documentStyleBackground->mBackgroundFlags &
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
styleSheet->SetDocumentBackgroundColor(
|
||||
documentStyleBackground->mBackgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// take care of some special requirements for fixed backgrounds
|
||||
HandleFixedBackground(aRuleData->mPresContext, presShell, bFixedBackground);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (aRuleData && aRuleData->mSID == eStyleStruct_Background)
|
||||
aRuleData->mPostResolveCallback = &PostResolveCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
// Indent
|
||||
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
fputs("Special BODY tag fixup rule\n", out);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* SizeOf method:
|
||||
*
|
||||
* Self (reported as BodyFixupRule's size):
|
||||
* 1) sizeof(*this)
|
||||
*
|
||||
* Contained / Aggregated data (not reported as BodyFixupRule's size):
|
||||
* 1) Delegates to the mSheet if it exists
|
||||
*
|
||||
* Children / siblings / parents:
|
||||
* none
|
||||
*
|
||||
******************************************************************************/
|
||||
void BodyFixupRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
{
|
||||
NS_ASSERTION(aSizeOfHandler != nsnull, "SizeOf handler cannot be null");
|
||||
|
||||
// first get the unique items collection
|
||||
UNIQUE_STYLE_ITEMS(uniqueItems);
|
||||
if(! uniqueItems->AddItem((void*)this)){
|
||||
return;
|
||||
}
|
||||
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("BodyFixupRule"));
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
aSizeOfHandler->AddSize(tag, aSize);
|
||||
|
||||
if(mSheet){
|
||||
mSheet->SizeOf(aSizeOfHandler, localSize);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
@ -773,18 +381,27 @@ NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult,
|
||||
|
||||
|
||||
nsHTMLBodyElement::nsHTMLBodyElement()
|
||||
: nsGenericHTMLContainerElement(),
|
||||
mContentStyleRule(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
{
|
||||
if (mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLBodyElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLBodyElement, nsGenericElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLBodyElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBodyElement,
|
||||
nsBodySuper)
|
||||
nsGenericHTMLContainerElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBodyElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
@ -831,7 +448,7 @@ nsHTMLBodyElement::GetBgColor(nsAWritableString& aBgColor)
|
||||
{
|
||||
// If we don't have an attribute, find the actual color used for
|
||||
// (generally from the user agent style sheet) for compatibility
|
||||
if (NS_CONTENT_ATTR_NOT_THERE == nsBodySuper::GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) {
|
||||
if (NS_CONTENT_ATTR_NOT_THERE == GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) {
|
||||
nsresult result = NS_OK;
|
||||
if (mDocument) {
|
||||
// Make sure the presentation is up-to-date
|
||||
@ -878,8 +495,7 @@ nsHTMLBodyElement::GetBgColor(nsAWritableString& aBgColor)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::SetBgColor(const nsAReadableString& aBgColor)
|
||||
{
|
||||
return nsBodySuper::SetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor,
|
||||
aBgColor, PR_TRUE);
|
||||
return SetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -908,6 +524,21 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers)
|
||||
{
|
||||
if (nsnull != mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
|
||||
// destroy old style rule since the sheet will probably change
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
return nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep,
|
||||
aCompileEventHandlers);
|
||||
}
|
||||
|
||||
static
|
||||
void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aData)
|
||||
{
|
||||
@ -946,6 +577,7 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
styleSheet->SetVisitedLinkColor(value.GetColorValue());
|
||||
}
|
||||
|
||||
NS_RELEASE(styleSheet);
|
||||
}
|
||||
NS_RELEASE(htmlContainer);
|
||||
@ -976,7 +608,6 @@ nsHTMLBodyElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRu
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
static nsIHTMLStyleSheet* GetAttrStyleSheet(nsIDocument* aDocument)
|
||||
{
|
||||
nsIHTMLStyleSheet* sheet = nsnull;
|
||||
@ -996,7 +627,7 @@ static nsIHTMLStyleSheet* GetAttrStyleSheet(nsIDocument* aDocument)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
nsBodySuper::WalkContentStyleRules(aRuleWalker);
|
||||
nsGenericHTMLContainerElement::WalkContentStyleRules(aRuleWalker);
|
||||
|
||||
if (!mContentStyleRule) {
|
||||
nsCOMPtr<nsIHTMLStyleSheet> sheet;
|
||||
@ -1014,68 +645,6 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsIHTMLCSSStyleSheet* GetInlineStyleSheet(nsIDocument* aDocument)
|
||||
{
|
||||
nsIHTMLCSSStyleSheet* sheet = nsnull;
|
||||
|
||||
if (aDocument) {
|
||||
nsCOMPtr<nsIHTMLContentContainer> container(do_QueryInterface(aDocument));
|
||||
|
||||
if (container) {
|
||||
container->GetInlineStyleSheet(&sheet);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(nsnull != sheet, "can't get attribute style sheet");
|
||||
return sheet;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
PRBool useBodyFixupRule = PR_FALSE;
|
||||
|
||||
nsGenericHTMLContainerElement::WalkInlineStyleRules(aRuleWalker);
|
||||
|
||||
// The BodyFixupRule only applies when we have HTML as the parent of the BODY
|
||||
// and we are in an HTML doc (as opposed to an XML doc)
|
||||
// - check if this is the case, and set the flag to use the rule only if
|
||||
// the HTML is the parent of the BODY
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
if (htmlDoc) {
|
||||
// not XML, so we might need to back propagate the background...
|
||||
nsCOMPtr<nsIContent> parentElement;
|
||||
GetParent(*getter_AddRefs(parentElement));
|
||||
if (parentElement) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
parentElement->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsHTMLAtoms::html) {
|
||||
// create the fixup rule
|
||||
useBodyFixupRule = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mInlineStyleRule && useBodyFixupRule) {
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> sheet;
|
||||
|
||||
if (mDocument) { // find style sheet
|
||||
sheet = dont_AddRef(GetInlineStyleSheet(mDocument));
|
||||
}
|
||||
|
||||
mInlineStyleRule = new BodyFixupRule(this, sheet);
|
||||
NS_IF_ADDREF(mInlineStyleRule);
|
||||
}
|
||||
|
||||
if (aRuleWalker && mInlineStyleRule) {
|
||||
aRuleWalker->Forward(mInlineStyleRule);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
PRInt32& aHint) const
|
||||
|
||||
@ -2967,18 +2967,10 @@ nsHTMLDocument::GetBgColor(nsAWritableString& aBgColor)
|
||||
|
||||
aBgColor.Truncate();
|
||||
result = GetBodyElement(&body);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = body->GetBgColor(aBgColor);
|
||||
NS_RELEASE(body);
|
||||
}
|
||||
else if (nsnull != mAttrStyleSheet) {
|
||||
nscolor color;
|
||||
result = mAttrStyleSheet->GetDocumentBackgroundColor(color);
|
||||
if (NS_OK == result) {
|
||||
nsHTMLValue value(color);
|
||||
nsGenericHTMLElement::ColorToString(value, aBgColor);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2990,16 +2982,11 @@ nsHTMLDocument::SetBgColor(const nsAReadableString& aBgColor)
|
||||
nsIDOMHTMLBodyElement* body;
|
||||
|
||||
result = GetBodyElement(&body);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = body->SetBgColor(aBgColor);
|
||||
NS_RELEASE(body);
|
||||
}
|
||||
else if (nsnull != mAttrStyleSheet) {
|
||||
nsHTMLValue value;
|
||||
if (nsGenericHTMLElement::ParseColor(aBgColor, this, value)) {
|
||||
mAttrStyleSheet->SetDocumentBackgroundColor(value.GetColorValue());
|
||||
}
|
||||
}
|
||||
// XXXldb And otherwise?
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3012,18 +2999,10 @@ nsHTMLDocument::GetFgColor(nsAWritableString& aFgColor)
|
||||
|
||||
aFgColor.Truncate();
|
||||
result = GetBodyElement(&body);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = body->GetText(aFgColor);
|
||||
NS_RELEASE(body);
|
||||
}
|
||||
else if (nsnull != mAttrStyleSheet) {
|
||||
nscolor color;
|
||||
result = mAttrStyleSheet->GetDocumentForegroundColor(color);
|
||||
if (NS_OK == result) {
|
||||
nsHTMLValue value(color);
|
||||
nsGenericHTMLElement::ColorToString(value, aFgColor);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3035,17 +3014,11 @@ nsHTMLDocument::SetFgColor(const nsAReadableString& aFgColor)
|
||||
nsIDOMHTMLBodyElement* body;
|
||||
|
||||
result = GetBodyElement(&body);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = body->SetText(aFgColor);
|
||||
NS_RELEASE(body);
|
||||
}
|
||||
else if (nsnull != mAttrStyleSheet) {
|
||||
nsHTMLValue value;
|
||||
|
||||
if (nsGenericHTMLElement::ParseColor(aFgColor, this, value)) {
|
||||
mAttrStyleSheet->SetDocumentForegroundColor(value.GetColorValue());
|
||||
}
|
||||
}
|
||||
// XXXldb And otherwise?
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1032,8 +1032,7 @@ nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
|
||||
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)color, aFrame);
|
||||
|
||||
if(color) {
|
||||
if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&
|
||||
!(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) {
|
||||
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
||||
const nsAFlatCString& backgroundColor =
|
||||
nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT,
|
||||
nsCSSProps::kBackgroundColorKTable);
|
||||
|
||||
@ -56,6 +56,8 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
|
||||
#include "nsRuleWalker.h"
|
||||
|
||||
@ -102,13 +104,13 @@ public:
|
||||
#endif
|
||||
|
||||
void Reset() {
|
||||
mForegroundSet = PR_FALSE;
|
||||
mBackgroundSet = PR_FALSE;
|
||||
mInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
nscolor mBackgroundColor;
|
||||
PRPackedBool mForegroundSet;
|
||||
PRPackedBool mBackgroundSet;
|
||||
protected:
|
||||
void Initialize(nsIPresContext* aPresContext);
|
||||
|
||||
PRBool mInitialized;
|
||||
};
|
||||
|
||||
HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet)
|
||||
@ -156,7 +158,7 @@ HTMLColorRule::GetStrength(PRInt32& aStrength) const
|
||||
NS_IMETHODIMP
|
||||
HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (aRuleData->mSID == eStyleStruct_Color && aRuleData->mColorData) {
|
||||
if (aRuleData->mSID == eStyleStruct_Color) {
|
||||
if (aRuleData->mColorData->mColor.GetUnit() == eCSSUnit_Null)
|
||||
aRuleData->mColorData->mColor = nsCSSValue(mColor);
|
||||
}
|
||||
@ -222,17 +224,41 @@ HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
||||
NS_IMETHODIMP
|
||||
HTMLDocumentColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (mForegroundSet && aRuleData->mSID == eStyleStruct_Color && aRuleData->mColorData) {
|
||||
nsCSSValue val; val.SetColorValue(mColor);
|
||||
aRuleData->mColorData->mColor = val;
|
||||
}
|
||||
else if (mBackgroundSet && aRuleData->mSID == eStyleStruct_Background && aRuleData->mColorData) {
|
||||
nsCSSValue val; val.SetColorValue(mBackgroundColor);
|
||||
aRuleData->mColorData->mBackColor = val;
|
||||
if (aRuleData->mSID == eStyleStruct_Color) {
|
||||
if (aRuleData->mColorData->mColor.GetUnit() == eCSSUnit_Null) {
|
||||
if (!mInitialized)
|
||||
Initialize(aRuleData->mPresContext);
|
||||
nsCSSValue val; val.SetColorValue(mColor);
|
||||
aRuleData->mColorData->mColor = val;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLDocumentColorRule::Initialize(nsIPresContext* aPresContext)
|
||||
{
|
||||
aPresContext->GetDefaultColor(&mColor); // in case something below fails
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> domdoc = do_QueryInterface(doc);
|
||||
if (!domdoc)
|
||||
return;
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
domdoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsIFrame *bodyFrame;
|
||||
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
if (!bodyFrame)
|
||||
return;
|
||||
const nsStyleColor *bodyColor;
|
||||
::GetStyleData(bodyFrame, &bodyColor);
|
||||
mColor = bodyColor->mColor;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/******************************************************************************
|
||||
* SizeOf method:
|
||||
@ -574,13 +600,9 @@ public:
|
||||
NS_IMETHOD GetLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetActiveLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetVisitedLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetDocumentForegroundColor(nscolor& aColor);
|
||||
NS_IMETHOD GetDocumentBackgroundColor(nscolor& aColor);
|
||||
NS_IMETHOD SetLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetActiveLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetVisitedLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetDocumentForegroundColor(nscolor aColor);
|
||||
NS_IMETHOD SetDocumentBackgroundColor(nscolor aColor);
|
||||
|
||||
// Attribute management methods, aAttributes is an in/out param
|
||||
NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent,
|
||||
@ -830,9 +852,6 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
||||
if (aData->mIsQuirkMode)
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
else if (tag == nsHTMLAtoms::html) {
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
} // end html element
|
||||
|
||||
// just get the style rules from the content
|
||||
@ -1034,26 +1053,6 @@ HTMLStyleSheetImpl::GetVisitedLinkColor(nscolor& aColor)
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
||||
{
|
||||
if (!mDocumentColorRule->mForegroundSet)
|
||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||
|
||||
aColor = mDocumentColorRule->mColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
||||
{
|
||||
if (!mDocumentColorRule->mBackgroundSet)
|
||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||
|
||||
aColor = mDocumentColorRule->mBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
||||
{
|
||||
@ -1097,22 +1096,6 @@ HTMLStyleSheetImpl::SetVisitedLinkColor(nscolor aColor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor)
|
||||
{
|
||||
mDocumentColorRule->mColor = aColor;
|
||||
mDocumentColorRule->mForegroundSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetDocumentBackgroundColor(nscolor aColor)
|
||||
{
|
||||
mDocumentColorRule->mBackgroundColor = aColor;
|
||||
mDocumentColorRule->mBackgroundSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent,
|
||||
nsIHTMLAttributes*& aAttributes)
|
||||
|
||||
@ -2949,41 +2949,6 @@ IsCanvasFrame(nsIFrame* aFrame)
|
||||
return parentType.get() == nsLayoutAtoms::canvasFrame;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsRootFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> parentType;
|
||||
|
||||
aFrame->GetFrameType(getter_AddRefs(parentType));
|
||||
return parentType.get() == nsLayoutAtoms::rootFrame;
|
||||
}
|
||||
|
||||
static void
|
||||
PropagateBackgroundToParent(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
const nsStyleBackground* aColor,
|
||||
nsIStyleContext* aParentStyleContext)
|
||||
{
|
||||
nsStyleBackground* mutableColor =
|
||||
(nsStyleBackground*)aParentStyleContext->GetUniqueStyleData(aPresContext, eStyleStruct_Background);
|
||||
|
||||
mutableColor->mBackgroundAttachment = aColor->mBackgroundAttachment;
|
||||
mutableColor->mBackgroundFlags = aColor->mBackgroundFlags | NS_STYLE_BG_PROPAGATED_FROM_CHILD;
|
||||
mutableColor->mBackgroundRepeat = aColor->mBackgroundRepeat;
|
||||
mutableColor->mBackgroundColor = aColor->mBackgroundColor;
|
||||
mutableColor->mBackgroundXPosition = aColor->mBackgroundXPosition;
|
||||
mutableColor->mBackgroundYPosition = aColor->mBackgroundYPosition;
|
||||
mutableColor->mBackgroundImage = aColor->mBackgroundImage;
|
||||
|
||||
// Reset the BODY's background to transparent
|
||||
mutableColor = (nsStyleBackground*)aStyleContext->GetUniqueStyleData(aPresContext, eStyleStruct_Background);
|
||||
mutableColor->mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT |
|
||||
NS_STYLE_BG_IMAGE_NONE |
|
||||
NS_STYLE_BG_PROPAGATED_TO_PARENT;
|
||||
mutableColor->mBackgroundImage.SetLength(0);
|
||||
mutableColor->mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
|
||||
}
|
||||
|
||||
/**
|
||||
* New one
|
||||
*/
|
||||
@ -3093,9 +3058,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
}
|
||||
}
|
||||
|
||||
const nsStyleBackground* bg =
|
||||
(const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
PRBool docElemIsTable = IsTableRelated(display->mDisplay, PR_FALSE);
|
||||
|
||||
|
||||
@ -3227,38 +3189,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
ProcessChildren(aPresShell, aPresContext, aState, aDocElement, contentFrame,
|
||||
PR_TRUE, childItems, isBlockFrame);
|
||||
|
||||
// See if the document element has a fixed background attachment.
|
||||
// Note: the reason we wait until after processing the document element's
|
||||
// children is because of special treatment of the background for the HTML
|
||||
// element. See BodyFixupRule::MapStyleInto() for details
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment) {
|
||||
// Fixed background attachments are handled by setting the
|
||||
// NS_VIEW_PUBLIC_FLAG_DONT_BITBLT flag bit on the view.
|
||||
//
|
||||
// If the document element's frame is scrollable, then set the bit on its
|
||||
// view; otherwise, set it on the root frame's view. This avoids
|
||||
// unnecessarily creating another view and should be faster
|
||||
nsIView* view;
|
||||
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
contentFrame->GetView(aPresContext, &view);
|
||||
} else {
|
||||
nsIFrame* parentFrame;
|
||||
|
||||
contentFrame->GetParent(&parentFrame);
|
||||
parentFrame->GetView(aPresContext, &view);
|
||||
}
|
||||
|
||||
// Not all shells have scroll frames, even in scrollable presContext (bug 30317)
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the initial child lists
|
||||
contentFrame->SetInitialChildList(aPresContext, nsnull,
|
||||
childItems.childList);
|
||||
@ -3278,22 +3208,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
||||
// this is not sufficient: if the background gets changed via DOM after
|
||||
// frame construction we need to do this again...
|
||||
|
||||
// Section 14.2 of the CSS2 spec says that the background of the root element
|
||||
// covers the entire canvas. See if a background was specified for the root
|
||||
// element
|
||||
if (!bg->BackgroundIsTransparent() && (IsCanvasFrame(aParentFrame) || IsRootFrame(aParentFrame))) {
|
||||
nsIStyleContext* parentContext;
|
||||
|
||||
// Propagate the document element's background to the canvas so that it
|
||||
// renders the background over the entire canvas
|
||||
aParentFrame->GetStyleContext(&parentContext);
|
||||
PropagateBackgroundToParent(aPresContext, styleContext, bg, parentContext);
|
||||
NS_RELEASE(parentContext);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
// vim:cindent:ts=2:et:sw=2:
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -60,6 +61,8 @@
|
||||
#include "nsITheme.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
||||
#define BORDER_FULL 0 //entire side
|
||||
#define BORDER_INSIDE 1 //inside half
|
||||
@ -83,7 +86,6 @@ enum ePathTypes{
|
||||
|
||||
static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurIndex,ePathTypes aPathType,PRInt32 &aC1Index,float aFrac=0);
|
||||
static void TileImage(nsIRenderingContext& aRC,nsDrawingSurface aDS,nsRect &aSrcRect,PRInt16 aWidth,PRInt16 aHeight);
|
||||
static PRBool GetBGColorForHTMLElement(nsIPresContext *aPresContext,const nsStyleColor *&aBGColor);
|
||||
static nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame);
|
||||
|
||||
// FillRect or InvertRect depending on the renderingaInvert parameter
|
||||
@ -1610,9 +1612,6 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Get our style context's background struct.
|
||||
const nsStyleBackground* ourBG = (const nsStyleBackground*)aStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
// in NavQuirks mode we want to use the parent's context as a starting point
|
||||
// for determining the background color
|
||||
const nsStyleBackground* bgColor =
|
||||
@ -2402,23 +2401,204 @@ GetNearestScrollFrame(nsIFrame* aFrame)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* |FindBackground| finds the correct style data to use to paint the
|
||||
* background. It is responsible for handling the following two
|
||||
* statements in section 14.2 of CSS2:
|
||||
*
|
||||
* The background of the box generated by the root element covers the
|
||||
* entire canvas.
|
||||
*
|
||||
* For HTML documents, however, we recommend that authors specify the
|
||||
* background for the BODY element rather than the HTML element. User
|
||||
* agents should observe the following precedence rules to fill in the
|
||||
* background: if the value of the 'background' property for the HTML
|
||||
* element is different from 'transparent' then use it, else use the
|
||||
* value of the 'background' property for the BODY element. If the
|
||||
* resulting value is 'transparent', the rendering is undefined.
|
||||
*
|
||||
* Thus, in our implementation, it is responsible for ensuring that:
|
||||
* + we paint the correct background on the |nsCanvasFrame|,
|
||||
* |nsRootBoxFrame|, or |nsPageFrame|,
|
||||
* + we don't paint the background on the root element, and
|
||||
* + we don't paint the background on the BODY element in *some* cases,
|
||||
* and for SGML-based HTML documents only.
|
||||
*
|
||||
* |FindBackground| returns true if a background should be painted, and
|
||||
* the resulting style context to use for the background information
|
||||
* will be filled in to |aBackground|. It fills in a boolean indicating
|
||||
* whether the frame is the canvas frame to allow PaintBackground to
|
||||
* ensure that it always paints something non-transparent for the
|
||||
* canvas.
|
||||
*/
|
||||
|
||||
inline PRBool
|
||||
IsCanvasFrame(nsIFrame *aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
return (frameType == nsLayoutAtoms::canvasFrame ||
|
||||
frameType == nsLayoutAtoms::rootFrame ||
|
||||
frameType == nsLayoutAtoms::pageFrame);
|
||||
}
|
||||
|
||||
inline PRBool
|
||||
FindCanvasBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground)
|
||||
{
|
||||
// XXXldb What if the root element is positioned, etc.? (We don't
|
||||
// allow that yet, do we?)
|
||||
nsIFrame *firstChild;
|
||||
aForFrame->FirstChild(aPresContext, nsnull, &firstChild);
|
||||
NS_ASSERTION(firstChild, "no first child");
|
||||
if (firstChild) {
|
||||
const nsStyleBackground *result;
|
||||
GetStyleData(firstChild, &result);
|
||||
|
||||
// Check if we need to do propagation from BODY rather than HTML.
|
||||
if (result->BackgroundIsTransparent()) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aForFrame->GetContent(getter_AddRefs(content));
|
||||
if (content) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
content->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
htmlDoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame *bodyFrame;
|
||||
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
if (bodyFrame)
|
||||
::GetStyleData(bodyFrame, &result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aBackground = result;
|
||||
} else {
|
||||
// This should always give transparent, so we'll fill it in with the
|
||||
// default color if needed. But this should never happen anyway...
|
||||
GetStyleData(aForFrame, aBackground);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
inline PRBool
|
||||
FindElementBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground)
|
||||
{
|
||||
nsIFrame *parentFrame;
|
||||
aForFrame->GetParent(&parentFrame);
|
||||
if (IsCanvasFrame(parentFrame)) {
|
||||
// Check that we're really the root (rather than in another child list).
|
||||
nsIFrame *childFrame;
|
||||
parentFrame->FirstChild(aPresContext, nsnull, &childFrame);
|
||||
if (childFrame == aForFrame)
|
||||
return PR_FALSE; // Background was already drawn for the canvas.
|
||||
}
|
||||
|
||||
::GetStyleData(aForFrame, aBackground);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aForFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(content);
|
||||
if (!body)
|
||||
return PR_TRUE; // not frame for BODY element
|
||||
|
||||
const nsStyleBackground *htmlBG;
|
||||
::GetStyleData(parentFrame, &htmlBG);
|
||||
return !htmlBG->BackgroundIsTransparent();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSRendering::FindBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground,
|
||||
PRBool* aIsCanvas)
|
||||
{
|
||||
PRBool isCanvas = IsCanvasFrame(aForFrame);
|
||||
*aIsCanvas = isCanvas;
|
||||
return isCanvas
|
||||
? FindCanvasBackground(aPresContext, aForFrame, aBackground)
|
||||
: FindElementBackground(aPresContext, aForFrame, aBackground);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY)
|
||||
{
|
||||
NS_ASSERTION(aForFrame, "Frame is expected to be provided to PaintBackground");
|
||||
NS_PRECONDITION(aForFrame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
PRBool isCanvas;
|
||||
const nsStyleBackground *color;
|
||||
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas))
|
||||
return;
|
||||
if (!isCanvas) {
|
||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, *color, aBorder, aDX, aDY);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that we always paint a color for the root (in case there's
|
||||
// no background at all or a partly transparent image).
|
||||
nsStyleBackground canvasColor(*color);
|
||||
if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
||||
canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
aPresContext->GetDefaultBackgroundColor(&canvasColor.mBackgroundColor);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
|
||||
|
||||
// Since nsHTMLContainerFrame::CreateViewForFrame might have created
|
||||
// the view before we knew about the child with the fixed background
|
||||
// attachment (root or BODY) or the stylesheet specifying that
|
||||
// attachment, set the BitBlt flag here as well.
|
||||
if (canvasColor.mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED) {
|
||||
nsIView *view;
|
||||
aForFrame->GetView(aPresContext, &view);
|
||||
if (view)
|
||||
vm->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
|
||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, canvasColor,
|
||||
aBorder, aDX, aDY);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY)
|
||||
{
|
||||
NS_PRECONDITION(aForFrame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
// consider it transparent if transparent is set, or if it is propagated to the parent
|
||||
PRBool transparentBG =
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) ||
|
||||
(aColor.mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT);
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT ==
|
||||
(aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
float percent;
|
||||
nsStyleCoord bordStyleRadius[4];
|
||||
PRInt16 borderRadii[4],i;
|
||||
|
||||
@ -105,6 +105,17 @@ public:
|
||||
nsRect* aGap = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Fill in an nsStyleBackground to be used to paint the background for
|
||||
* an element. The nsStyleBackground should first be initialized
|
||||
* using the pres context. This applies the rules for propagating
|
||||
* backgrounds between BODY, the root element, and the canvas.
|
||||
*/
|
||||
static PRBool FindBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground,
|
||||
PRBool* aIsCanvas);
|
||||
|
||||
/**
|
||||
* Render the background for an element using css rendering rules
|
||||
* for backgrounds.
|
||||
@ -117,11 +128,25 @@ public:
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY);
|
||||
|
||||
/**
|
||||
* Same as |PaintBackground|, except using the provided style context
|
||||
* (which short-circuits the code that ensures that the root element's
|
||||
* background is drawn on the canvas.
|
||||
*/
|
||||
static void PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY);
|
||||
|
||||
static void DrawDashedSides(PRIntn startSide,
|
||||
nsIRenderingContext& aContext,
|
||||
const nsRect& aDirtyRect,
|
||||
|
||||
@ -229,7 +229,6 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
|
||||
const nsStyleBackground* bg = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
if ((bg->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) ||
|
||||
(bg->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT) ||
|
||||
(bg->mBackgroundRepeat == NS_STYLE_BG_REPEAT_OFF)) {
|
||||
// The frame does not have a background image so we are free
|
||||
// to invalidate only the intersection of the damage rect and
|
||||
|
||||
@ -5440,19 +5440,11 @@ PresShell::StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
PRBool aDisabled)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// first notify the style set that a sheet's state has changed
|
||||
if (mStyleSet) {
|
||||
rv = mStyleSet->NotifyStyleSheetStateChanged(aDisabled ? PR_FALSE : PR_TRUE);
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aDisabled) {
|
||||
// If the stylesheet is disabled, remove existing BodyFixupRule for
|
||||
// bug 88681
|
||||
rv = mStyleSet->RemoveBodyFixupRule(aDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = mStyleSet->NotifyStyleSheetStateChanged(!aDisabled);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We don't need to rebuild the
|
||||
|
||||
@ -218,8 +218,6 @@
|
||||
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
||||
#define NS_STYLE_BG_Y_POSITION_PERCENT 0x10
|
||||
#define NS_STYLE_BG_Y_POSITION_LENGTH 0x20
|
||||
#define NS_STYLE_BG_PROPAGATED_TO_PARENT 0x40 // for the BodyFixupRule
|
||||
#define NS_STYLE_BG_PROPAGATED_FROM_CHILD 0x80 // '' ''
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_REPEAT_OFF 0x00
|
||||
|
||||
@ -124,8 +124,6 @@ public:
|
||||
virtual nsresult BeginRuleTreeReconstruct()=0;
|
||||
virtual nsresult EndRuleTreeReconstruct()=0;
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument) = 0;
|
||||
|
||||
virtual nsresult GetStyleFrameConstruction(nsIStyleFrameConstruction** aResult) = 0;
|
||||
|
||||
// ClearCachedStyleData is used to invalidate portions of both the style context tree
|
||||
|
||||
@ -218,8 +218,6 @@
|
||||
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
||||
#define NS_STYLE_BG_Y_POSITION_PERCENT 0x10
|
||||
#define NS_STYLE_BG_Y_POSITION_LENGTH 0x20
|
||||
#define NS_STYLE_BG_PROPAGATED_TO_PARENT 0x40 // for the BodyFixupRule
|
||||
#define NS_STYLE_BG_PROPAGATED_FROM_CHILD 0x80 // '' ''
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_REPEAT_OFF 0x00
|
||||
|
||||
@ -229,7 +229,6 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
|
||||
const nsStyleBackground* bg = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
if ((bg->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) ||
|
||||
(bg->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT) ||
|
||||
(bg->mBackgroundRepeat == NS_STYLE_BG_REPEAT_OFF)) {
|
||||
// The frame does not have a background image so we are free
|
||||
// to invalidate only the intersection of the damage rect and
|
||||
|
||||
@ -199,22 +199,13 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
mFrame->GetStyleContext(getter_AddRefs(context));
|
||||
|
||||
|
||||
// get the styles
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)context->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)context->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
|
||||
// paint the border and background
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, *color, *border, 0, 0);
|
||||
|
||||
aDirtyRect, buttonRect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, *border, context, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -179,8 +179,6 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) &&
|
||||
isVisible && mRect.width && mRect.height) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* borderStyle =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
|
||||
@ -199,8 +197,7 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsRect rect(0, yoff, mRect.width, mRect.height - yoff);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *borderStyle, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *borderStyle, 0, 0);
|
||||
|
||||
if (mLegendFrame) {
|
||||
|
||||
@ -249,9 +246,10 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
aRenderingContext.PopState(clipState);
|
||||
} else {
|
||||
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, nsRect(0,0,mRect.width, mRect.height), *borderStyle, mStyleContext, skipSides);
|
||||
aDirtyRect,
|
||||
nsRect(0,0,mRect.width, mRect.height),
|
||||
*borderStyle, mStyleContext, skipSides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsRect rect(x, y, width, height);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mCheckButtonFaceStyle, 0);
|
||||
doDefaultPainting = PR_FALSE;
|
||||
|
||||
@ -305,10 +305,14 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
|
||||
// So we will use the PaintBackground to paint the dot,
|
||||
// but it uses the mBackgroundColor for painting and we need to use the mColor
|
||||
// so create a temporary style color struct and set it up appropriately
|
||||
// XXXldb It would make more sense to use
|
||||
// |aRenderingContext.FillEllipse| here, but on at least GTK that
|
||||
// doesn't draw a round enough circle.
|
||||
nsStyleBackground tmpColor = *myColor;
|
||||
tmpColor.mBackgroundColor = color->mColor;
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, tmpColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, rect,
|
||||
tmpColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mRadioButtonFaceStyle, 0);
|
||||
}
|
||||
|
||||
@ -5331,8 +5331,6 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (isVisible && (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) &&
|
||||
(0 != mRect.width) && (0 != mRect.height)) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -5341,12 +5339,13 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
||||
// Paint background, border and outline
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
PRBool paintingSuppressed = PR_FALSE;
|
||||
|
||||
@ -4072,29 +4072,6 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::SetDefaultBackgroundColor(nsIPresContext* aPresContext)
|
||||
{
|
||||
const nsStyleBackground* bg =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
if ((bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) != 0) {
|
||||
NS_WARNING("Frame setting default background color but it has transparent background!");
|
||||
} else {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
|
||||
if (vm) {
|
||||
vm->SetDefaultBackgroundColor(bg->mBackgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* retrieve Bidi property of this frame
|
||||
|
||||
@ -481,10 +481,6 @@ protected:
|
||||
|
||||
static void XMLQuote(nsString& aString);
|
||||
|
||||
// Helper function that sets the view manager's default background to be
|
||||
// the background of this frame.
|
||||
void SetDefaultBackgroundColor(nsIPresContext* aPresContext);
|
||||
|
||||
virtual PRBool ParentDisablesSelection() const;
|
||||
|
||||
// Set the overflow clip rect into the rendering-context. Used for block-level
|
||||
|
||||
@ -86,8 +86,6 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -95,11 +93,13 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
|
||||
// The sole purpose of this is to trigger display
|
||||
// of the selection window for Named Anchors,
|
||||
@ -457,8 +457,6 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
PRBool fixedBackgroundAttachment = PR_FALSE;
|
||||
|
||||
// Get nsStyleColor and nsStyleDisplay
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
const nsStylePosition* position = (const nsStylePosition*)
|
||||
@ -474,7 +472,12 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// See if the frame has a fixed background attachment
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
|
||||
const nsStyleBackground *color;
|
||||
PRBool isCanvas;
|
||||
PRBool hasBackground =
|
||||
nsCSSRendering::FindBackground(aPresContext, aFrame, &color, &isCanvas);
|
||||
if (hasBackground &&
|
||||
NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
|
||||
aForce = PR_TRUE;
|
||||
fixedBackgroundAttachment = PR_TRUE;
|
||||
}
|
||||
@ -613,8 +616,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
|
||||
// See if the view should be hidden
|
||||
PRBool viewIsVisible = PR_TRUE;
|
||||
PRBool viewHasTransparentContent = (color->mBackgroundFlags &
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
PRBool viewHasTransparentContent =
|
||||
!isCanvas &&
|
||||
(!hasBackground ||
|
||||
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
|
||||
|
||||
|
||||
if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
|
||||
viewIsVisible = PR_FALSE;
|
||||
|
||||
@ -385,9 +385,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
SetDefaultBackgroundColor(aPresContext);
|
||||
}
|
||||
nsresult rv = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
|
||||
@ -1201,21 +1201,19 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBackground* myColor = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myOutline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,21 +66,19 @@ nsLeafFrame::Paint(nsIPresContext* aPresContext,
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBackground* myColor = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myOutline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
}
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame", &aRenderingContext);
|
||||
|
||||
@ -724,18 +724,15 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsSimplePageSequenceFrame* seqFrame = NS_STATIC_CAST(nsSimplePageSequenceFrame*, mParent);
|
||||
if (seqFrame != nsnull) {
|
||||
nsStyleBackground *theBackground;
|
||||
theBackground = mPD->mBackground;
|
||||
|
||||
nsRect rect = mPD->mReflowRect;
|
||||
rect.Deflate(mPD->mReflowMargin);
|
||||
rect.Deflate(mPD->mExtraMargin);
|
||||
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border));
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *theBackground, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -234,11 +234,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE; // we're always complete
|
||||
|
||||
if (aReflowState.reason == eReflowReason_Initial) {
|
||||
CacheBackground(aPresContext);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||
|
||||
// *** Special Override ***
|
||||
@ -1080,25 +1075,3 @@ nsSimplePageSequenceFrame::SetPageSizes(const nsRect& aRect, const nsMargin& aMa
|
||||
mPageData->mReflowRect = aRect;
|
||||
mPageData->mReflowMargin = aMarginRect;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Get the Style Data from the first child of this frame, the nsPageFrame
|
||||
// uses this to paint the background for printing
|
||||
// No return code, there not much we can do if this fails
|
||||
void
|
||||
nsSimplePageSequenceFrame::CacheBackground(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsIFrame* pageFrame = mFrames.FirstChild();
|
||||
if (pageFrame == nsnull) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStyleContext> parentContext;
|
||||
pageFrame->GetStyleContext(getter_AddRefs(parentContext));
|
||||
mPageData->mBackground = (nsStyleBackground*)parentContext->GetStyleData(eStyleStruct_Background);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -63,9 +63,6 @@ public:
|
||||
nsMargin mExtraMargin; // Extra Margin between the printable area and the edge of the page
|
||||
nscoord mHeadFooterGap; // In twips, gap between H/F from edge of page
|
||||
|
||||
|
||||
nsStyleBackground* mBackground; //weak reference...
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsCOMPtr<nsIPrintOptions> mPrintOptions;
|
||||
};
|
||||
|
||||
@ -5331,8 +5331,6 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (isVisible && (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) &&
|
||||
(0 != mRect.width) && (0 != mRect.height)) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -5341,12 +5339,13 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
||||
// Paint background, border and outline
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
PRBool paintingSuppressed = PR_FALSE;
|
||||
|
||||
@ -4072,29 +4072,6 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::SetDefaultBackgroundColor(nsIPresContext* aPresContext)
|
||||
{
|
||||
const nsStyleBackground* bg =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
if ((bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) != 0) {
|
||||
NS_WARNING("Frame setting default background color but it has transparent background!");
|
||||
} else {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
|
||||
if (vm) {
|
||||
vm->SetDefaultBackgroundColor(bg->mBackgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* retrieve Bidi property of this frame
|
||||
|
||||
@ -481,10 +481,6 @@ protected:
|
||||
|
||||
static void XMLQuote(nsString& aString);
|
||||
|
||||
// Helper function that sets the view manager's default background to be
|
||||
// the background of this frame.
|
||||
void SetDefaultBackgroundColor(nsIPresContext* aPresContext);
|
||||
|
||||
virtual PRBool ParentDisablesSelection() const;
|
||||
|
||||
// Set the overflow clip rect into the rendering-context. Used for block-level
|
||||
|
||||
@ -152,10 +152,9 @@ HRuleFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
color = (nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext,
|
||||
this,aDirtyRect, rect, *color,
|
||||
this,aDirtyRect, rect,
|
||||
*border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext,
|
||||
this,aDirtyRect, rect, *border,
|
||||
|
||||
@ -86,8 +86,6 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -95,11 +93,13 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
|
||||
// The sole purpose of this is to trigger display
|
||||
// of the selection window for Named Anchors,
|
||||
@ -457,8 +457,6 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
PRBool fixedBackgroundAttachment = PR_FALSE;
|
||||
|
||||
// Get nsStyleColor and nsStyleDisplay
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
const nsStylePosition* position = (const nsStylePosition*)
|
||||
@ -474,7 +472,12 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// See if the frame has a fixed background attachment
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
|
||||
const nsStyleBackground *color;
|
||||
PRBool isCanvas;
|
||||
PRBool hasBackground =
|
||||
nsCSSRendering::FindBackground(aPresContext, aFrame, &color, &isCanvas);
|
||||
if (hasBackground &&
|
||||
NS_STYLE_BG_ATTACHMENT_FIXED == color->mBackgroundAttachment) {
|
||||
aForce = PR_TRUE;
|
||||
fixedBackgroundAttachment = PR_TRUE;
|
||||
}
|
||||
@ -613,8 +616,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
|
||||
// See if the view should be hidden
|
||||
PRBool viewIsVisible = PR_TRUE;
|
||||
PRBool viewHasTransparentContent = (color->mBackgroundFlags &
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
PRBool viewHasTransparentContent =
|
||||
!isCanvas &&
|
||||
(!hasBackground ||
|
||||
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
|
||||
|
||||
|
||||
if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
|
||||
viewIsVisible = PR_FALSE;
|
||||
|
||||
@ -385,9 +385,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
SetDefaultBackgroundColor(aPresContext);
|
||||
}
|
||||
nsresult rv = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
|
||||
@ -1201,21 +1201,19 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBackground* myColor = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myOutline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,21 +66,19 @@ nsLeafFrame::Paint(nsIPresContext* aPresContext,
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBackground* myColor = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myOutline, mStyleContext, 0);
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
}
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame", &aRenderingContext);
|
||||
|
||||
@ -724,18 +724,15 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsSimplePageSequenceFrame* seqFrame = NS_STATIC_CAST(nsSimplePageSequenceFrame*, mParent);
|
||||
if (seqFrame != nsnull) {
|
||||
nsStyleBackground *theBackground;
|
||||
theBackground = mPD->mBackground;
|
||||
|
||||
nsRect rect = mPD->mReflowRect;
|
||||
rect.Deflate(mPD->mReflowMargin);
|
||||
rect.Deflate(mPD->mExtraMargin);
|
||||
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border));
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *theBackground, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5440,19 +5440,11 @@ PresShell::StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
PRBool aDisabled)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// first notify the style set that a sheet's state has changed
|
||||
if (mStyleSet) {
|
||||
rv = mStyleSet->NotifyStyleSheetStateChanged(aDisabled ? PR_FALSE : PR_TRUE);
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aDisabled) {
|
||||
// If the stylesheet is disabled, remove existing BodyFixupRule for
|
||||
// bug 88681
|
||||
rv = mStyleSet->RemoveBodyFixupRule(aDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = mStyleSet->NotifyStyleSheetStateChanged(!aDisabled);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We don't need to rebuild the
|
||||
|
||||
@ -234,11 +234,6 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE; // we're always complete
|
||||
|
||||
if (aReflowState.reason == eReflowReason_Initial) {
|
||||
CacheBackground(aPresContext);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||
|
||||
// *** Special Override ***
|
||||
@ -1080,25 +1075,3 @@ nsSimplePageSequenceFrame::SetPageSizes(const nsRect& aRect, const nsMargin& aMa
|
||||
mPageData->mReflowRect = aRect;
|
||||
mPageData->mReflowMargin = aMarginRect;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Get the Style Data from the first child of this frame, the nsPageFrame
|
||||
// uses this to paint the background for printing
|
||||
// No return code, there not much we can do if this fails
|
||||
void
|
||||
nsSimplePageSequenceFrame::CacheBackground(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsIFrame* pageFrame = mFrames.FirstChild();
|
||||
if (pageFrame == nsnull) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStyleContext> parentContext;
|
||||
pageFrame->GetStyleContext(getter_AddRefs(parentContext));
|
||||
mPageData->mBackground = (nsStyleBackground*)parentContext->GetStyleData(eStyleStruct_Background);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -63,9 +63,6 @@ public:
|
||||
nsMargin mExtraMargin; // Extra Margin between the printable area and the edge of the page
|
||||
nscoord mHeadFooterGap; // In twips, gap between H/F from edge of page
|
||||
|
||||
|
||||
nsStyleBackground* mBackground; //weak reference...
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsCOMPtr<nsIPrintOptions> mPrintOptions;
|
||||
};
|
||||
|
||||
@ -199,22 +199,13 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
mFrame->GetStyleContext(getter_AddRefs(context));
|
||||
|
||||
|
||||
// get the styles
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)context->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)context->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
|
||||
// paint the border and background
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, *color, *border, 0, 0);
|
||||
|
||||
aDirtyRect, buttonRect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, *border, context, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -179,8 +179,6 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) &&
|
||||
isVisible && mRect.width && mRect.height) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* borderStyle =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
|
||||
@ -199,8 +197,7 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsRect rect(0, yoff, mRect.width, mRect.height - yoff);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *borderStyle, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *borderStyle, 0, 0);
|
||||
|
||||
if (mLegendFrame) {
|
||||
|
||||
@ -249,9 +246,10 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
||||
aRenderingContext.PopState(clipState);
|
||||
} else {
|
||||
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, nsRect(0,0,mRect.width, mRect.height), *borderStyle, mStyleContext, skipSides);
|
||||
aDirtyRect,
|
||||
nsRect(0,0,mRect.width, mRect.height),
|
||||
*borderStyle, mStyleContext, skipSides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsRect rect(x, y, width, height);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mCheckButtonFaceStyle, 0);
|
||||
doDefaultPainting = PR_FALSE;
|
||||
|
||||
@ -305,10 +305,14 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
|
||||
// So we will use the PaintBackground to paint the dot,
|
||||
// but it uses the mBackgroundColor for painting and we need to use the mColor
|
||||
// so create a temporary style color struct and set it up appropriately
|
||||
// XXXldb It would make more sense to use
|
||||
// |aRenderingContext.FillEllipse| here, but on at least GTK that
|
||||
// doesn't draw a round enough circle.
|
||||
nsStyleBackground tmpColor = *myColor;
|
||||
tmpColor.mBackgroundColor = color->mColor;
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, tmpColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, rect,
|
||||
tmpColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mRadioButtonFaceStyle, 0);
|
||||
}
|
||||
|
||||
@ -2949,41 +2949,6 @@ IsCanvasFrame(nsIFrame* aFrame)
|
||||
return parentType.get() == nsLayoutAtoms::canvasFrame;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsRootFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> parentType;
|
||||
|
||||
aFrame->GetFrameType(getter_AddRefs(parentType));
|
||||
return parentType.get() == nsLayoutAtoms::rootFrame;
|
||||
}
|
||||
|
||||
static void
|
||||
PropagateBackgroundToParent(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
const nsStyleBackground* aColor,
|
||||
nsIStyleContext* aParentStyleContext)
|
||||
{
|
||||
nsStyleBackground* mutableColor =
|
||||
(nsStyleBackground*)aParentStyleContext->GetUniqueStyleData(aPresContext, eStyleStruct_Background);
|
||||
|
||||
mutableColor->mBackgroundAttachment = aColor->mBackgroundAttachment;
|
||||
mutableColor->mBackgroundFlags = aColor->mBackgroundFlags | NS_STYLE_BG_PROPAGATED_FROM_CHILD;
|
||||
mutableColor->mBackgroundRepeat = aColor->mBackgroundRepeat;
|
||||
mutableColor->mBackgroundColor = aColor->mBackgroundColor;
|
||||
mutableColor->mBackgroundXPosition = aColor->mBackgroundXPosition;
|
||||
mutableColor->mBackgroundYPosition = aColor->mBackgroundYPosition;
|
||||
mutableColor->mBackgroundImage = aColor->mBackgroundImage;
|
||||
|
||||
// Reset the BODY's background to transparent
|
||||
mutableColor = (nsStyleBackground*)aStyleContext->GetUniqueStyleData(aPresContext, eStyleStruct_Background);
|
||||
mutableColor->mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT |
|
||||
NS_STYLE_BG_IMAGE_NONE |
|
||||
NS_STYLE_BG_PROPAGATED_TO_PARENT;
|
||||
mutableColor->mBackgroundImage.SetLength(0);
|
||||
mutableColor->mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
|
||||
}
|
||||
|
||||
/**
|
||||
* New one
|
||||
*/
|
||||
@ -3093,9 +3058,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
}
|
||||
}
|
||||
|
||||
const nsStyleBackground* bg =
|
||||
(const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
PRBool docElemIsTable = IsTableRelated(display->mDisplay, PR_FALSE);
|
||||
|
||||
|
||||
@ -3227,38 +3189,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
ProcessChildren(aPresShell, aPresContext, aState, aDocElement, contentFrame,
|
||||
PR_TRUE, childItems, isBlockFrame);
|
||||
|
||||
// See if the document element has a fixed background attachment.
|
||||
// Note: the reason we wait until after processing the document element's
|
||||
// children is because of special treatment of the background for the HTML
|
||||
// element. See BodyFixupRule::MapStyleInto() for details
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment) {
|
||||
// Fixed background attachments are handled by setting the
|
||||
// NS_VIEW_PUBLIC_FLAG_DONT_BITBLT flag bit on the view.
|
||||
//
|
||||
// If the document element's frame is scrollable, then set the bit on its
|
||||
// view; otherwise, set it on the root frame's view. This avoids
|
||||
// unnecessarily creating another view and should be faster
|
||||
nsIView* view;
|
||||
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
contentFrame->GetView(aPresContext, &view);
|
||||
} else {
|
||||
nsIFrame* parentFrame;
|
||||
|
||||
contentFrame->GetParent(&parentFrame);
|
||||
parentFrame->GetView(aPresContext, &view);
|
||||
}
|
||||
|
||||
// Not all shells have scroll frames, even in scrollable presContext (bug 30317)
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the initial child lists
|
||||
contentFrame->SetInitialChildList(aPresContext, nsnull,
|
||||
childItems.childList);
|
||||
@ -3278,22 +3208,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
||||
// this is not sufficient: if the background gets changed via DOM after
|
||||
// frame construction we need to do this again...
|
||||
|
||||
// Section 14.2 of the CSS2 spec says that the background of the root element
|
||||
// covers the entire canvas. See if a background was specified for the root
|
||||
// element
|
||||
if (!bg->BackgroundIsTransparent() && (IsCanvasFrame(aParentFrame) || IsRootFrame(aParentFrame))) {
|
||||
nsIStyleContext* parentContext;
|
||||
|
||||
// Propagate the document element's background to the canvas so that it
|
||||
// renders the background over the entire canvas
|
||||
aParentFrame->GetStyleContext(&parentContext);
|
||||
PropagateBackgroundToParent(aPresContext, styleContext, bg, parentContext);
|
||||
NS_RELEASE(parentContext);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
// vim:cindent:ts=2:et:sw=2:
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -60,6 +61,8 @@
|
||||
#include "nsITheme.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
||||
#define BORDER_FULL 0 //entire side
|
||||
#define BORDER_INSIDE 1 //inside half
|
||||
@ -83,7 +86,6 @@ enum ePathTypes{
|
||||
|
||||
static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurIndex,ePathTypes aPathType,PRInt32 &aC1Index,float aFrac=0);
|
||||
static void TileImage(nsIRenderingContext& aRC,nsDrawingSurface aDS,nsRect &aSrcRect,PRInt16 aWidth,PRInt16 aHeight);
|
||||
static PRBool GetBGColorForHTMLElement(nsIPresContext *aPresContext,const nsStyleColor *&aBGColor);
|
||||
static nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame);
|
||||
|
||||
// FillRect or InvertRect depending on the renderingaInvert parameter
|
||||
@ -1610,9 +1612,6 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Get our style context's background struct.
|
||||
const nsStyleBackground* ourBG = (const nsStyleBackground*)aStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
// in NavQuirks mode we want to use the parent's context as a starting point
|
||||
// for determining the background color
|
||||
const nsStyleBackground* bgColor =
|
||||
@ -2402,23 +2401,204 @@ GetNearestScrollFrame(nsIFrame* aFrame)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* |FindBackground| finds the correct style data to use to paint the
|
||||
* background. It is responsible for handling the following two
|
||||
* statements in section 14.2 of CSS2:
|
||||
*
|
||||
* The background of the box generated by the root element covers the
|
||||
* entire canvas.
|
||||
*
|
||||
* For HTML documents, however, we recommend that authors specify the
|
||||
* background for the BODY element rather than the HTML element. User
|
||||
* agents should observe the following precedence rules to fill in the
|
||||
* background: if the value of the 'background' property for the HTML
|
||||
* element is different from 'transparent' then use it, else use the
|
||||
* value of the 'background' property for the BODY element. If the
|
||||
* resulting value is 'transparent', the rendering is undefined.
|
||||
*
|
||||
* Thus, in our implementation, it is responsible for ensuring that:
|
||||
* + we paint the correct background on the |nsCanvasFrame|,
|
||||
* |nsRootBoxFrame|, or |nsPageFrame|,
|
||||
* + we don't paint the background on the root element, and
|
||||
* + we don't paint the background on the BODY element in *some* cases,
|
||||
* and for SGML-based HTML documents only.
|
||||
*
|
||||
* |FindBackground| returns true if a background should be painted, and
|
||||
* the resulting style context to use for the background information
|
||||
* will be filled in to |aBackground|. It fills in a boolean indicating
|
||||
* whether the frame is the canvas frame to allow PaintBackground to
|
||||
* ensure that it always paints something non-transparent for the
|
||||
* canvas.
|
||||
*/
|
||||
|
||||
inline PRBool
|
||||
IsCanvasFrame(nsIFrame *aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
return (frameType == nsLayoutAtoms::canvasFrame ||
|
||||
frameType == nsLayoutAtoms::rootFrame ||
|
||||
frameType == nsLayoutAtoms::pageFrame);
|
||||
}
|
||||
|
||||
inline PRBool
|
||||
FindCanvasBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground)
|
||||
{
|
||||
// XXXldb What if the root element is positioned, etc.? (We don't
|
||||
// allow that yet, do we?)
|
||||
nsIFrame *firstChild;
|
||||
aForFrame->FirstChild(aPresContext, nsnull, &firstChild);
|
||||
NS_ASSERTION(firstChild, "no first child");
|
||||
if (firstChild) {
|
||||
const nsStyleBackground *result;
|
||||
GetStyleData(firstChild, &result);
|
||||
|
||||
// Check if we need to do propagation from BODY rather than HTML.
|
||||
if (result->BackgroundIsTransparent()) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aForFrame->GetContent(getter_AddRefs(content));
|
||||
if (content) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
content->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
htmlDoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame *bodyFrame;
|
||||
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
if (bodyFrame)
|
||||
::GetStyleData(bodyFrame, &result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aBackground = result;
|
||||
} else {
|
||||
// This should always give transparent, so we'll fill it in with the
|
||||
// default color if needed. But this should never happen anyway...
|
||||
GetStyleData(aForFrame, aBackground);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
inline PRBool
|
||||
FindElementBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground)
|
||||
{
|
||||
nsIFrame *parentFrame;
|
||||
aForFrame->GetParent(&parentFrame);
|
||||
if (IsCanvasFrame(parentFrame)) {
|
||||
// Check that we're really the root (rather than in another child list).
|
||||
nsIFrame *childFrame;
|
||||
parentFrame->FirstChild(aPresContext, nsnull, &childFrame);
|
||||
if (childFrame == aForFrame)
|
||||
return PR_FALSE; // Background was already drawn for the canvas.
|
||||
}
|
||||
|
||||
::GetStyleData(aForFrame, aBackground);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aForFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(content);
|
||||
if (!body)
|
||||
return PR_TRUE; // not frame for BODY element
|
||||
|
||||
const nsStyleBackground *htmlBG;
|
||||
::GetStyleData(parentFrame, &htmlBG);
|
||||
return !htmlBG->BackgroundIsTransparent();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSRendering::FindBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground,
|
||||
PRBool* aIsCanvas)
|
||||
{
|
||||
PRBool isCanvas = IsCanvasFrame(aForFrame);
|
||||
*aIsCanvas = isCanvas;
|
||||
return isCanvas
|
||||
? FindCanvasBackground(aPresContext, aForFrame, aBackground)
|
||||
: FindElementBackground(aPresContext, aForFrame, aBackground);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY)
|
||||
{
|
||||
NS_ASSERTION(aForFrame, "Frame is expected to be provided to PaintBackground");
|
||||
NS_PRECONDITION(aForFrame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
PRBool isCanvas;
|
||||
const nsStyleBackground *color;
|
||||
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas))
|
||||
return;
|
||||
if (!isCanvas) {
|
||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, *color, aBorder, aDX, aDY);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that we always paint a color for the root (in case there's
|
||||
// no background at all or a partly transparent image).
|
||||
nsStyleBackground canvasColor(*color);
|
||||
if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
||||
canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
aPresContext->GetDefaultBackgroundColor(&canvasColor.mBackgroundColor);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
|
||||
|
||||
// Since nsHTMLContainerFrame::CreateViewForFrame might have created
|
||||
// the view before we knew about the child with the fixed background
|
||||
// attachment (root or BODY) or the stylesheet specifying that
|
||||
// attachment, set the BitBlt flag here as well.
|
||||
if (canvasColor.mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED) {
|
||||
nsIView *view;
|
||||
aForFrame->GetView(aPresContext, &view);
|
||||
if (view)
|
||||
vm->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
|
||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, canvasColor,
|
||||
aBorder, aDX, aDY);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY)
|
||||
{
|
||||
NS_PRECONDITION(aForFrame,
|
||||
"Frame is expected to be provided to PaintBackground");
|
||||
|
||||
// consider it transparent if transparent is set, or if it is propagated to the parent
|
||||
PRBool transparentBG =
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT == (aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) ||
|
||||
(aColor.mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT);
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT ==
|
||||
(aColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
float percent;
|
||||
nsStyleCoord bordStyleRadius[4];
|
||||
PRInt16 borderRadii[4],i;
|
||||
|
||||
@ -105,6 +105,17 @@ public:
|
||||
nsRect* aGap = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Fill in an nsStyleBackground to be used to paint the background for
|
||||
* an element. The nsStyleBackground should first be initialized
|
||||
* using the pres context. This applies the rules for propagating
|
||||
* backgrounds between BODY, the root element, and the canvas.
|
||||
*/
|
||||
static PRBool FindBackground(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsStyleBackground** aBackground,
|
||||
PRBool* aIsCanvas);
|
||||
|
||||
/**
|
||||
* Render the background for an element using css rendering rules
|
||||
* for backgrounds.
|
||||
@ -117,11 +128,25 @@ public:
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY);
|
||||
|
||||
/**
|
||||
* Same as |PaintBackground|, except using the provided style context
|
||||
* (which short-circuits the code that ensures that the root element's
|
||||
* background is drawn on the canvas.
|
||||
*/
|
||||
static void PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground& aColor,
|
||||
const nsStyleBorder& aBorder,
|
||||
nscoord aDX,
|
||||
nscoord aDY);
|
||||
|
||||
static void DrawDashedSides(PRIntn startSide,
|
||||
nsIRenderingContext& aContext,
|
||||
const nsRect& aDirtyRect,
|
||||
|
||||
@ -64,10 +64,6 @@ public:
|
||||
NS_IMETHOD SetActiveLinkColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD GetVisitedLinkColor(nscolor& aColor) = 0;
|
||||
NS_IMETHOD SetVisitedLinkColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD GetDocumentForegroundColor(nscolor& aColor) = 0;
|
||||
NS_IMETHOD SetDocumentForegroundColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD GetDocumentBackgroundColor(nscolor& aColor) = 0;
|
||||
NS_IMETHOD SetDocumentBackgroundColor(nscolor aColor) = 0;
|
||||
|
||||
// Attribute management methods
|
||||
NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent,
|
||||
|
||||
@ -428,7 +428,7 @@ nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
||||
NS_STYLE_TABLE_EMPTY_CELLS_SHOW == cellTableStyle->mEmptyCells ||
|
||||
NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND == cellTableStyle->mEmptyCells) {
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
}
|
||||
// draw the border except when the cell is empty and 'empty-cells: hide || -moz-show-background' is set
|
||||
if (!GetContentEmpty() ||
|
||||
|
||||
@ -156,11 +156,9 @@ nsTableColFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,11 +442,9 @@ nsTableColGroupFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1467,13 +1467,11 @@ nsTableFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
|
||||
// paint the column groups and columns
|
||||
nsIFrame* colGroupFrame = mColGroups.FirstChild();
|
||||
|
||||
@ -588,11 +588,9 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,11 +230,9 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0,0,mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1703,12 +1703,10 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
|
||||
styleContext->GetStyleData(eStyleStruct_Border));
|
||||
const nsStyleOutline *outline = NS_STATIC_CAST(const nsStyleOutline*,
|
||||
styleContext->GetStyleData(eStyleStruct_Outline));
|
||||
const nsStyleBackground *backg = NS_STATIC_CAST(const nsStyleBackground*,
|
||||
styleContext->GetStyleData(eStyleStruct_Background));
|
||||
|
||||
nsRect rect(mRect); //0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *backg, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *border, styleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, aForFrame,
|
||||
|
||||
@ -295,8 +295,6 @@ nsMathMLmactionFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (visib->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* backg = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -304,7 +302,7 @@ nsMathMLmactionFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *backg, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
|
||||
@ -1032,8 +1032,7 @@ nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
|
||||
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)color, aFrame);
|
||||
|
||||
if(color) {
|
||||
if ((color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&
|
||||
!(color->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) {
|
||||
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
||||
const nsAFlatCString& backgroundColor =
|
||||
nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT,
|
||||
nsCSSProps::kBackgroundColorKTable);
|
||||
|
||||
@ -56,6 +56,8 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
|
||||
#include "nsRuleWalker.h"
|
||||
|
||||
@ -102,13 +104,13 @@ public:
|
||||
#endif
|
||||
|
||||
void Reset() {
|
||||
mForegroundSet = PR_FALSE;
|
||||
mBackgroundSet = PR_FALSE;
|
||||
mInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
nscolor mBackgroundColor;
|
||||
PRPackedBool mForegroundSet;
|
||||
PRPackedBool mBackgroundSet;
|
||||
protected:
|
||||
void Initialize(nsIPresContext* aPresContext);
|
||||
|
||||
PRBool mInitialized;
|
||||
};
|
||||
|
||||
HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet)
|
||||
@ -156,7 +158,7 @@ HTMLColorRule::GetStrength(PRInt32& aStrength) const
|
||||
NS_IMETHODIMP
|
||||
HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (aRuleData->mSID == eStyleStruct_Color && aRuleData->mColorData) {
|
||||
if (aRuleData->mSID == eStyleStruct_Color) {
|
||||
if (aRuleData->mColorData->mColor.GetUnit() == eCSSUnit_Null)
|
||||
aRuleData->mColorData->mColor = nsCSSValue(mColor);
|
||||
}
|
||||
@ -222,17 +224,41 @@ HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
||||
NS_IMETHODIMP
|
||||
HTMLDocumentColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (mForegroundSet && aRuleData->mSID == eStyleStruct_Color && aRuleData->mColorData) {
|
||||
nsCSSValue val; val.SetColorValue(mColor);
|
||||
aRuleData->mColorData->mColor = val;
|
||||
}
|
||||
else if (mBackgroundSet && aRuleData->mSID == eStyleStruct_Background && aRuleData->mColorData) {
|
||||
nsCSSValue val; val.SetColorValue(mBackgroundColor);
|
||||
aRuleData->mColorData->mBackColor = val;
|
||||
if (aRuleData->mSID == eStyleStruct_Color) {
|
||||
if (aRuleData->mColorData->mColor.GetUnit() == eCSSUnit_Null) {
|
||||
if (!mInitialized)
|
||||
Initialize(aRuleData->mPresContext);
|
||||
nsCSSValue val; val.SetColorValue(mColor);
|
||||
aRuleData->mColorData->mColor = val;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLDocumentColorRule::Initialize(nsIPresContext* aPresContext)
|
||||
{
|
||||
aPresContext->GetDefaultColor(&mColor); // in case something below fails
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> domdoc = do_QueryInterface(doc);
|
||||
if (!domdoc)
|
||||
return;
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
domdoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsIFrame *bodyFrame;
|
||||
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
if (!bodyFrame)
|
||||
return;
|
||||
const nsStyleColor *bodyColor;
|
||||
::GetStyleData(bodyFrame, &bodyColor);
|
||||
mColor = bodyColor->mColor;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/******************************************************************************
|
||||
* SizeOf method:
|
||||
@ -574,13 +600,9 @@ public:
|
||||
NS_IMETHOD GetLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetActiveLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetVisitedLinkColor(nscolor& aColor);
|
||||
NS_IMETHOD GetDocumentForegroundColor(nscolor& aColor);
|
||||
NS_IMETHOD GetDocumentBackgroundColor(nscolor& aColor);
|
||||
NS_IMETHOD SetLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetActiveLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetVisitedLinkColor(nscolor aColor);
|
||||
NS_IMETHOD SetDocumentForegroundColor(nscolor aColor);
|
||||
NS_IMETHOD SetDocumentBackgroundColor(nscolor aColor);
|
||||
|
||||
// Attribute management methods, aAttributes is an in/out param
|
||||
NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent,
|
||||
@ -830,9 +852,6 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
||||
if (aData->mIsQuirkMode)
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
else if (tag == nsHTMLAtoms::html) {
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
} // end html element
|
||||
|
||||
// just get the style rules from the content
|
||||
@ -1034,26 +1053,6 @@ HTMLStyleSheetImpl::GetVisitedLinkColor(nscolor& aColor)
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
||||
{
|
||||
if (!mDocumentColorRule->mForegroundSet)
|
||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||
|
||||
aColor = mDocumentColorRule->mColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
||||
{
|
||||
if (!mDocumentColorRule->mBackgroundSet)
|
||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||
|
||||
aColor = mDocumentColorRule->mBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
||||
{
|
||||
@ -1097,22 +1096,6 @@ HTMLStyleSheetImpl::SetVisitedLinkColor(nscolor aColor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetDocumentForegroundColor(nscolor aColor)
|
||||
{
|
||||
mDocumentColorRule->mColor = aColor;
|
||||
mDocumentColorRule->mForegroundSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetDocumentBackgroundColor(nscolor aColor)
|
||||
{
|
||||
mDocumentColorRule->mBackgroundColor = aColor;
|
||||
mDocumentColorRule->mBackgroundSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent,
|
||||
nsIHTMLAttributes*& aAttributes)
|
||||
|
||||
@ -3109,30 +3109,9 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
|
||||
// background-color: color, string, enum (flags), inherit
|
||||
if (eCSSUnit_Inherit == colorData.mBackColor.GetUnit()) { // do inherit first, so SetColor doesn't do it
|
||||
const nsStyleBackground* inheritBG = parentBG;
|
||||
if (inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT) {
|
||||
// walk up the contexts until we get to a context that does not have its
|
||||
// background propagated to its parent (or a context that has had its background
|
||||
// propagated from its child)
|
||||
if (nsnull != parentContext) {
|
||||
nsCOMPtr<nsIStyleContext> higherContext = getter_AddRefs(parentContext->GetParent());
|
||||
do {
|
||||
if (higherContext) {
|
||||
inheritBG = (const nsStyleBackground*)higherContext->GetStyleData(eStyleStruct_Background);
|
||||
if (inheritBG &&
|
||||
(!(inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_TO_PARENT)) ||
|
||||
(inheritBG->mBackgroundFlags & NS_STYLE_BG_PROPAGATED_FROM_CHILD)) {
|
||||
// done walking up the higher contexts
|
||||
break;
|
||||
}
|
||||
higherContext = getter_AddRefs(higherContext->GetParent());
|
||||
}
|
||||
} while (higherContext);
|
||||
}
|
||||
}
|
||||
bg->mBackgroundColor = inheritBG->mBackgroundColor;
|
||||
bg->mBackgroundColor = parentBG->mBackgroundColor;
|
||||
bg->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
bg->mBackgroundFlags |= (inheritBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
bg->mBackgroundFlags |= (parentBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
inherited = PR_TRUE;
|
||||
}
|
||||
else if (SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
|
||||
|
||||
@ -56,7 +56,6 @@
|
||||
#include "nsIStyleRuleSupplier.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
|
||||
@ -173,8 +172,6 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument);
|
||||
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
@ -1324,24 +1321,6 @@ StyleSetImpl::ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
StyleSetImpl::RemoveBodyFixupRule(nsIDocument *aDocument)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> node;
|
||||
htmlDoc->GetBodyElement(getter_AddRefs(node));
|
||||
if (node) {
|
||||
nsCOMPtr<nsIBodySuper> bodyElement = do_QueryInterface(node);
|
||||
bodyElement->RemoveBodyFixupRule();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
|
||||
@ -794,8 +794,6 @@ nsSVGOuterSVGFrame::Paint(nsIPresContext* aPresContext,
|
||||
// mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
// if (disp->IsVisible() && mRect.width && mRect.height) {
|
||||
// // Paint our background and border
|
||||
// const nsStyleColor* color = (const nsStyleColor*)
|
||||
// mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
// const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
// mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
// const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -803,7 +801,7 @@ nsSVGOuterSVGFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
// nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
// // nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
// // aDirtyRect, rect, *color, *border, 0, 0);
|
||||
// // aDirtyRect, rect, *border, 0, 0);
|
||||
// nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
// aDirtyRect, rect, *border, mStyleContext, 0);
|
||||
// nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
|
||||
@ -428,7 +428,7 @@ nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
||||
NS_STYLE_TABLE_EMPTY_CELLS_SHOW == cellTableStyle->mEmptyCells ||
|
||||
NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND == cellTableStyle->mEmptyCells) {
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
}
|
||||
// draw the border except when the cell is empty and 'empty-cells: hide || -moz-show-background' is set
|
||||
if (!GetContentEmpty() ||
|
||||
|
||||
@ -156,11 +156,9 @@ nsTableColFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,11 +442,9 @@ nsTableColGroupFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1467,13 +1467,11 @@ nsTableFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
|
||||
// paint the column groups and columns
|
||||
nsIFrame* colGroupFrame = mColGroups.FirstChild();
|
||||
|
||||
@ -588,11 +588,9 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,11 +230,9 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* border =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
nsRect rect(0,0,mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1530,8 +1530,6 @@ nsBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
@ -1539,7 +1537,7 @@ nsBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
|
||||
@ -325,14 +325,12 @@ nsDeckFrame::Paint(nsIPresContext* aPresContext,
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color = (const nsStyleBackground*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *border, 0, 0);
|
||||
aDirtyRect, rect, *border, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
}
|
||||
|
||||
@ -127,8 +127,6 @@ nsGroupBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBackground* color =
|
||||
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
||||
const nsStyleBorder* borderStyleData =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
|
||||
@ -163,8 +161,8 @@ nsGroupBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsRect rect(0, yoff, mRect.width, mRect.height - yoff);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *borderStyleData, 0, 0);
|
||||
|
||||
aDirtyRect, rect, *borderStyleData,
|
||||
0, 0);
|
||||
|
||||
if (groupBox) {
|
||||
|
||||
|
||||
@ -109,12 +109,6 @@ public:
|
||||
nsFramePaintLayer aWhichLayer,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags);
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
@ -286,17 +280,6 @@ nsRootBoxFrame::GetFrameType(nsIAtom** aType) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRootBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
SetDefaultBackgroundColor(aPresContext);
|
||||
return nsBoxFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRootBoxFrame::GetPopupSetFrame(nsIFrame** aResult)
|
||||
{
|
||||
|
||||
@ -320,7 +320,7 @@ nsSliderFrame::Paint(nsIPresContext* aPresContext,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myColor, *myBorder, 0, 0);
|
||||
aDirtyRect, rect, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
}
|
||||
|
||||
@ -2511,14 +2511,16 @@ nsOutlinerBodyFrame::PaintBackgroundLayer(nsIStyleContext* aStyleContext, nsIPre
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, aRect,
|
||||
*myColor, *myBorder, 0, 0);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, mStyleContext, 0);
|
||||
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, *myOutline, aStyleContext, 0);
|
||||
aDirtyRect, aRect, *myBorder, *myOutline,
|
||||
aStyleContext, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2511,14 +2511,16 @@ nsOutlinerBodyFrame::PaintBackgroundLayer(nsIStyleContext* aStyleContext, nsIPre
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myColor, *myBorder, 0, 0);
|
||||
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, aRect,
|
||||
*myColor, *myBorder, 0, 0);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, mStyleContext, 0);
|
||||
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, *myOutline, aStyleContext, 0);
|
||||
aDirtyRect, aRect, *myBorder, *myOutline,
|
||||
aStyleContext, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user