BodyFixupRule was not updated nor recreated in case of stylesheet disabling; b=88681; r=pierre,hyatt; sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@100205 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
539f80b7a1
commit
ea8347db88
@ -17,7 +17,8 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*/
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleSet.h"
|
||||
@ -40,6 +41,9 @@
|
||||
#include "nsIStyleRuleSupplier.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsIRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
#include "nsITimeRecorder.h"
|
||||
@ -117,6 +121,8 @@ public:
|
||||
virtual nsresult GetRuleTree(nsIRuleNode** aResult);
|
||||
virtual nsresult ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule, nsIStyleContext* aContext);
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument);
|
||||
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
@ -1033,6 +1039,24 @@ 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,6 +1,7 @@
|
||||
#
|
||||
# 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,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIBodySuper.h \
|
||||
nsIFormControl.h \
|
||||
nsIForm.h \
|
||||
nsILink.h \
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
EXPORTS=nsIFormControl.h nsIForm.h nsILink.h \
|
||||
nsISelectElement.h nsIScriptElement.h
|
||||
nsISelectElement.h nsIScriptElement.h nsIBodySuper.h
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*/
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
@ -51,6 +52,7 @@
|
||||
#include "nsIView.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@ -110,19 +112,24 @@ public:
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// special subclass of inner class to override set document
|
||||
class nsBodySuper: public nsGenericHTMLContainerElement
|
||||
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_INHERITED(nsBodySuper, nsGenericHTMLContainerElement, nsIBodySuper)
|
||||
|
||||
nsBodySuper::nsBodySuper() : nsGenericHTMLContainerElement(),
|
||||
mContentStyleRule(nsnull),
|
||||
@ -166,6 +173,17 @@ nsBodySuper::SetDocument(nsIDocument* aDocument, PRBool 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,
|
||||
@ -711,7 +729,7 @@ nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
|
||||
// QueryInterface implementation for nsHTMLBodyElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBodyElement,
|
||||
nsGenericHTMLContainerElement)
|
||||
nsBodySuper)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBodyElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBodyElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
@ -3530,7 +3530,7 @@ nsHTMLDocument::GetBodyContent()
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetBodyElement(nsIDOMHTMLBodyElement** aBody)
|
||||
{
|
||||
if (mBodyContent == nsnull && PR_FALSE == GetBodyContent()) {
|
||||
|
||||
@ -187,7 +187,7 @@ protected:
|
||||
nsresult GetSourceDocumentURL(JSContext* cx, nsIURI** sourceURL);
|
||||
|
||||
PRBool GetBodyContent();
|
||||
nsresult GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
||||
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
||||
|
||||
NS_IMETHOD GetDomainURI(nsIURI **uri);
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ class nsIHTMLStyleSheet;
|
||||
class nsIStyleSheet;
|
||||
class nsICSSLoader;
|
||||
class nsIContent;
|
||||
class nsIDOMHTMLBodyElement;
|
||||
|
||||
/* b2a848b0-d0a9-11d1-89b1-006008911b81 */
|
||||
#define NS_IHTMLDOCUMENT_IID \
|
||||
@ -75,6 +76,8 @@ public:
|
||||
|
||||
NS_IMETHOD GetFormControlElements(nsIDOMNodeList** aReturn) = 0;
|
||||
|
||||
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIHTMLDocument_h___ */
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsRuleNode.h"
|
||||
@ -899,6 +900,8 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID& aSID, nsIStyleContext* aContext,
|
||||
// branch that they never need to examine their rules for this particular struct type
|
||||
// ever again.
|
||||
PropagateInheritBit(bit, ruleNode);
|
||||
if (eStyleStruct_Background == aSID && aRuleData->mPostResolveCallback)
|
||||
(*aRuleData->mPostResolveCallback) ((nsStyleStruct *)startStruct, aRuleData);
|
||||
return startStruct;
|
||||
}
|
||||
else if (!startStruct && ((!isReset && (detail == eRuleNone || detail == eRulePartialInherited))
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
* Steve Clark <buster@netscape.com>
|
||||
* Håkan Waara <hwaara@chello.se>
|
||||
* Dan Rosen <dr@netscape.com>
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
* IBM Corporation
|
||||
*
|
||||
@ -5088,6 +5089,12 @@ PresShell::StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
}
|
||||
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;
|
||||
}
|
||||
// rebuild the frame-world
|
||||
return ReconstructFrames();
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*/
|
||||
#ifndef nsStyleSet_h___
|
||||
#define nsStyleSet_h___
|
||||
@ -82,6 +83,8 @@ public:
|
||||
|
||||
virtual nsresult GetRuleTree(nsIRuleNode** aResult) = 0;
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument) = 0;
|
||||
|
||||
// ClearCachedStyleData is used to invalidate portions of both the style context tree
|
||||
// and rule tree without destroying the actual nodes in the two trees. |aRule| provides
|
||||
// a hint as to which rule has changed, and all subtree data pruning will occur rooted
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
* Steve Clark <buster@netscape.com>
|
||||
* Håkan Waara <hwaara@chello.se>
|
||||
* Dan Rosen <dr@netscape.com>
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
* IBM Corporation
|
||||
*
|
||||
@ -5088,6 +5089,12 @@ PresShell::StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
}
|
||||
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;
|
||||
}
|
||||
// rebuild the frame-world
|
||||
return ReconstructFrames();
|
||||
}
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*/
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleSet.h"
|
||||
@ -40,6 +41,9 @@
|
||||
#include "nsIStyleRuleSupplier.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsIRuleWalker.h"
|
||||
#include "nsIBodySuper.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
#include "nsITimeRecorder.h"
|
||||
@ -117,6 +121,8 @@ public:
|
||||
virtual nsresult GetRuleTree(nsIRuleNode** aResult);
|
||||
virtual nsresult ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule, nsIStyleContext* aContext);
|
||||
|
||||
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument);
|
||||
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
@ -1033,6 +1039,24 @@ 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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user