Bug 576831 part 4. Remove nsICSSStyleRule and use mozilla::css::StyleRule instead. r=bzbarsky

--HG--
rename : layout/style/nsCSSStyleRule.cpp => layout/style/StyleRule.cpp
rename : layout/style/nsICSSStyleRule.h => layout/style/StyleRule.h
This commit is contained in:
Craig Topper 2011-03-10 21:48:57 -05:00
parent 952a977004
commit 678b9c7c11
31 changed files with 250 additions and 254 deletions

View File

@ -50,7 +50,6 @@ class nsIDOMEvent;
class nsIContent;
class nsIEventListenerManager;
class nsIURI;
class nsICSSStyleRule;
class nsRuleWalker;
class nsAttrValue;
class nsAttrName;
@ -62,6 +61,12 @@ class nsISMILAttr;
class nsIDOMCSSStyleDeclaration;
#endif // MOZ_SMIL
namespace mozilla {
namespace css {
class StyleRule;
}
}
enum nsLinkState {
eLinkState_Unknown = 0,
eLinkState_Unvisited = 1,
@ -71,8 +76,8 @@ enum nsLinkState {
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x71afb9e6, 0xe8a7, 0x475d, \
{ 0x89, 0xc4, 0xe4, 0x62, 0x21, 0xeb, 0xe1, 0xa4 } }
{ 0x557a7d96, 0xb9cd, 0x4be2, \
{ 0xa3, 0xe7, 0x5f, 0x43, 0x6d, 0xfd, 0xd9, 0x4f } }
/**
* A node of content in a document's content model. This interface
@ -823,13 +828,13 @@ public:
/**
* Get the inline style rule, if any, for this content node
*/
virtual nsICSSStyleRule* GetInlineStyleRule() = 0;
virtual mozilla::css::StyleRule* GetInlineStyleRule() = 0;
/**
* Set the inline style rule for this node. This will send an
* appropriate AttributeChanged notification if aNotify is true.
*/
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify) = 0;
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify) = 0;
/**
* Is the attribute named stored in the mapped attributes?
@ -916,14 +921,14 @@ public:
* hasn't been created (or if this nsIContent object doesn't support SMIL
* override style), this method simply returns null.
*/
virtual nsICSSStyleRule* GetSMILOverrideStyleRule() = 0;
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule() = 0;
/**
* Set the SMIL override style rule for this node. If aNotify is true, this
* method will notify the document's pres context, so that the style changes
* will be noticed.
*/
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
PRBool aNotify) = 0;
#endif // MOZ_SMIL

View File

@ -44,7 +44,7 @@
#include "nsAttrValue.h"
#include "nsIAtom.h"
#include "nsUnicharUtils.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h"
#include "nsIHTMLDocument.h"
#include "nsIDocument.h"
@ -80,7 +80,7 @@ nsAttrValue::nsAttrValue(const nsAString& aValue)
SetTo(aValue);
}
nsAttrValue::nsAttrValue(nsICSSStyleRule* aValue, const nsAString* aSerialized)
nsAttrValue::nsAttrValue(css::StyleRule* aValue, const nsAString* aSerialized)
: mBits(0)
{
SetTo(aValue, aSerialized);
@ -313,7 +313,7 @@ nsAttrValue::SetTo(PRInt16 aInt)
}
void
nsAttrValue::SetTo(nsICSSStyleRule* aValue, const nsAString* aSerialized)
nsAttrValue::SetTo(css::StyleRule* aValue, const nsAString* aSerialized)
{
if (EnsureEmptyMiscContainer()) {
MiscContainer* cont = GetMiscContainer();

View File

@ -55,13 +55,18 @@
typedef PRUptrdiff PtrBits;
class nsAString;
class nsIAtom;
class nsICSSStyleRule;
class nsISVGValue;
class nsIDocument;
template<class E, class A> class nsTArray;
template<class E, class A> class nsTPtrArray;
struct nsTArrayDefaultAllocator;
namespace mozilla {
namespace css {
class StyleRule;
}
}
#define NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM 12
#define NS_ATTRVALUE_BASETYPE_MASK (PtrBits(3))
@ -99,7 +104,7 @@ public:
nsAttrValue();
nsAttrValue(const nsAttrValue& aOther);
explicit nsAttrValue(const nsAString& aValue);
nsAttrValue(nsICSSStyleRule* aValue, const nsAString* aSerialized);
nsAttrValue(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
#ifdef MOZ_SVG
explicit nsAttrValue(nsISVGValue* aValue);
#endif
@ -136,7 +141,7 @@ public:
void SetTo(const nsAttrValue& aOther);
void SetTo(const nsAString& aValue);
void SetTo(PRInt16 aInt);
void SetTo(nsICSSStyleRule* aValue, const nsAString* aSerialized);
void SetTo(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
#ifdef MOZ_SVG
void SetTo(nsISVGValue* aValue);
#endif
@ -156,7 +161,7 @@ public:
inline PRInt16 GetEnumValue() const;
inline float GetPercentValue() const;
inline AtomArray* GetAtomArrayValue() const;
inline nsICSSStyleRule* GetCSSStyleRuleValue() const;
inline mozilla::css::StyleRule* GetCSSStyleRuleValue() const;
#ifdef MOZ_SVG
inline nsISVGValue* GetSVGValue() const;
#endif
@ -336,7 +341,7 @@ private:
nscolor mColor;
PRUint32 mEnumValue;
PRInt32 mPercent;
nsICSSStyleRule* mCSSStyleRule;
mozilla::css::StyleRule* mCSSStyleRule;
AtomArray* mAtomArray;
#ifdef MOZ_SVG
nsISVGValue* mSVGValue;
@ -437,7 +442,7 @@ nsAttrValue::GetAtomArrayValue() const
return GetMiscContainer()->mAtomArray;
}
inline nsICSSStyleRule*
inline mozilla::css::StyleRule*
nsAttrValue::GetCSSStyleRuleValue() const
{
NS_PRECONDITION(Type() == eCSSStyleRule, "wrong type");

View File

@ -67,6 +67,8 @@
#include "pldhash.h"
#include "prprf.h"
namespace css = mozilla::css;
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsIContent(aNodeInfo)
{
@ -1120,14 +1122,14 @@ nsGenericDOMDataNode::GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsICSSStyleRule*
css::StyleRule*
nsGenericDOMDataNode::GetSMILOverrideStyleRule()
{
return nsnull;
}
nsresult
nsGenericDOMDataNode::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
nsGenericDOMDataNode::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
PRBool aNotify)
{
NS_NOTREACHED("How come we're setting SMILOverrideStyle on a non-element?");
@ -1135,14 +1137,14 @@ nsGenericDOMDataNode::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
}
#endif // MOZ_SMIL
nsICSSStyleRule*
css::StyleRule*
nsGenericDOMDataNode::GetInlineStyleRule()
{
return nsnull;
}
NS_IMETHODIMP
nsGenericDOMDataNode::SetInlineStyleRule(nsICSSStyleRule* aStyleRule,
nsGenericDOMDataNode::SetInlineStyleRule(css::StyleRule* aStyleRule,
PRBool aNotify)
{
NS_NOTREACHED("How come we're setting inline style on a non-element?");

View File

@ -235,8 +235,8 @@ public:
return nsnull;
}
virtual nsresult GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle);
virtual nsICSSStyleRule* GetSMILOverrideStyleRule();
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
PRBool aNotify);
#endif // MOZ_SMIL
@ -252,8 +252,8 @@ public:
virtual nsIAtom* DoGetID() const;
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;

View File

@ -133,7 +133,7 @@
#include "nsIViewManager.h"
#include "nsIScrollableFrame.h"
#include "nsXBLInsertionPoint.h"
#include "nsICSSStyleRule.h" /* For nsCSSSelectorList */
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
#include "nsCSSRuleProcessor.h"
#include "nsRuleProcessorData.h"
@ -155,6 +155,7 @@
#endif /* MOZ_SVG */
using namespace mozilla::dom;
namespace css = mozilla::css;
NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
@ -3368,7 +3369,7 @@ nsGenericElement::GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle)
return NS_OK;
}
nsICSSStyleRule*
css::StyleRule*
nsGenericElement::GetSMILOverrideStyleRule()
{
nsGenericElement::nsDOMSlots *slots = GetExistingDOMSlots();
@ -3376,7 +3377,7 @@ nsGenericElement::GetSMILOverrideStyleRule()
}
nsresult
nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
nsGenericElement::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
PRBool aNotify)
{
nsGenericElement::nsDOMSlots *slots = DOMSlots();
@ -3400,14 +3401,14 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
}
#endif // MOZ_SMIL
nsICSSStyleRule*
css::StyleRule*
nsGenericElement::GetInlineStyleRule()
{
return nsnull;
}
NS_IMETHODIMP
nsGenericElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule,
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
PRBool aNotify)
{
NS_NOTYETIMPLEMENTED("nsGenericElement::SetInlineStyleRule");

View File

@ -456,8 +456,8 @@ public:
return nsnull;
}
virtual nsresult GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle);
virtual nsICSSStyleRule* GetSMILOverrideStyleRule();
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
PRBool aNotify);
#endif // MOZ_SMIL
@ -473,8 +473,8 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
NS_IMETHOD_(PRBool)
IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -961,7 +961,7 @@ public:
/**
* Holds any SMIL override style rules for this element.
*/
nsCOMPtr<nsICSSStyleRule> mSMILOverrideStyleRule;
nsRefPtr<mozilla::css::StyleRule> mSMILOverrideStyleRule;
/**
* An object implementing nsIDOMNamedNodeMap for this content (attributes)

View File

@ -47,7 +47,7 @@
#include "nsDOMCSSAttrDeclaration.h"
#include "nsServiceManagerUtils.h"
#include "nsIDocument.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsCSSParser.h"
#include "mozilla/css/Loader.h"
#include "nsIDOMMutationEvent.h"
@ -57,6 +57,8 @@
#include "nsIDOMSVGStylable.h"
#endif
namespace css = mozilla::css;
//----------------------------------------------------------------------
// nsIContent methods
@ -157,7 +159,7 @@ nsStyledElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aAttribute,
}
NS_IMETHODIMP
nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
nsStyledElement::SetInlineStyleRule(css::StyleRule* aStyleRule, PRBool aNotify)
{
SetFlags(NODE_MAY_HAVE_STYLE);
PRBool modification = PR_FALSE;
@ -195,7 +197,7 @@ nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
aNotify, nsnull);
}
nsICSSStyleRule*
css::StyleRule*
nsStyledElement::GetInlineStyleRule()
{
if (!HasFlag(NODE_MAY_HAVE_STYLE)) {
@ -320,12 +322,12 @@ nsStyledElement::ParseStyleAttribute(const nsAString& aValue,
}
if (isCSS) {
mozilla::css::Loader* cssLoader = doc->CSSLoader();
css::Loader* cssLoader = doc->CSSLoader();
nsCSSParser cssParser(cssLoader);
if (cssParser) {
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsCOMPtr<nsICSSStyleRule> rule;
nsRefPtr<css::StyleRule> rule;
cssParser.ParseStyleAttribute(aValue, doc->GetDocumentURI(),
baseURI,
NodePrincipal(),

View File

@ -49,7 +49,11 @@
#include "nsString.h"
#include "nsGenericElement.h"
class nsICSSStyleRule;
namespace mozilla {
namespace css {
class StyleRule;
}
}
typedef nsGenericElement nsStyledElementBase;
@ -70,8 +74,8 @@ public:
virtual nsIAtom* DoGetID() const;
virtual const nsAttrValue* DoGetClasses() const;
virtual nsICSSStyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,

View File

@ -74,7 +74,7 @@
#include "nsIScriptError.h"
#include "nsCSSParser.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h"
#include "nsComputedDOMStyle.h"
#include "nsStyleSet.h"
@ -2175,9 +2175,9 @@ nsCanvasRenderingContext2D::Rect(float x, float y, float w, float h)
static nsresult
CreateFontStyleRule(const nsAString& aFont,
nsINode* aNode,
nsICSSStyleRule** aResult)
css::StyleRule** aResult)
{
nsCOMPtr<nsICSSStyleRule> rule;
nsRefPtr<css::StyleRule> rule;
PRBool changed;
nsIPrincipal* principal = aNode->NodePrincipal();
@ -2241,7 +2241,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
nsCOMArray<nsIStyleRule> rules;
nsCOMPtr<nsICSSStyleRule> rule;
nsRefPtr<css::StyleRule> rule;
rv = CreateFontStyleRule(font, document, getter_AddRefs(rule));
if (NS_FAILED(rv))
return rv;
@ -2278,7 +2278,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
presShell);
} else {
// otherwise inherit from default (10px sans-serif)
nsCOMPtr<nsICSSStyleRule> parentRule;
nsRefPtr<css::StyleRule> parentRule;
rv = CreateFontStyleRule(NS_LITERAL_STRING("10px sans-serif"),
document,
getter_AddRefs(parentRule));

View File

@ -41,7 +41,7 @@
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsIContentViewer.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsCSSStruct.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
@ -320,7 +320,7 @@ nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst) const
// to reparse the string into style data until the node is
// inserted into the document. Clone the nsICSSRule instead.
nsCOMPtr<nsICSSRule> ruleClone = value->GetCSSStyleRuleValue()->Clone();
nsCOMPtr<nsICSSStyleRule> styleRule = do_QueryInterface(ruleClone);
nsRefPtr<mozilla::css::StyleRule> styleRule = do_QueryObject(ruleClone);
NS_ENSURE_TRUE(styleRule, NS_ERROR_UNEXPECTED);
rv = aDst->SetInlineStyleRule(styleRule, PR_FALSE);

View File

@ -70,7 +70,7 @@
#include "nsCSSParser.h"
#include "nsCSSProperty.h"
#include "mozilla/css/Declaration.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsUnicharInputStream.h"
#include "nsCSSStyleSheet.h"
#include "nsICSSRuleList.h"
@ -815,7 +815,7 @@ protected:
nsIAtom **aResult);
// The return value will be true if we have sanitized the rule
PRBool SanitizeStyleRule(nsICSSStyleRule *aRule, nsAutoString &aRuleText);
PRBool SanitizeStyleRule(css::StyleRule *aRule, nsAutoString &aRuleText);
PRPackedBool mSkip; // used when we descend into <style> or <script>
PRPackedBool mProcessStyle; // used when style is explicitly white-listed
@ -1050,7 +1050,7 @@ nsHTMLParanoidFragmentSink::AddAttributes(const nsIParserNode& aNode,
// Pass the CSS Loader object to the parser, to allow parser error reports
// to include the outer window ID.
nsCSSParser parser(mTargetDocument->CSSLoader());
nsCOMPtr<nsICSSStyleRule> rule;
nsRefPtr<css::StyleRule> rule;
rv = parser.ParseStyleAttribute(aNode.GetValueAt(i),
mTargetDocument->GetDocumentURI(),
baseURI,
@ -1213,7 +1213,7 @@ nsHTMLParanoidFragmentSink::CloseContainer(const nsHTMLTag aTag)
case nsICSSRule::STYLE_RULE: {
// For style rules, we will just look for and remove the
// -moz-binding properties.
nsCOMPtr<nsICSSStyleRule> styleRule = do_QueryInterface(rule);
nsRefPtr<css::StyleRule> styleRule = do_QueryObject(rule);
NS_ASSERTION(styleRule, "Must be a style rule");
nsAutoString decl;
didSanitize = SanitizeStyleRule(styleRule, decl) || didSanitize;
@ -1239,7 +1239,7 @@ nsHTMLParanoidFragmentSink::CloseContainer(const nsHTMLTag aTag)
}
PRBool
nsHTMLParanoidFragmentSink::SanitizeStyleRule(nsICSSStyleRule *aRule, nsAutoString &aRuleText)
nsHTMLParanoidFragmentSink::SanitizeStyleRule(css::StyleRule *aRule, nsAutoString &aRuleText)
{
PRBool didSanitize = PR_FALSE;
aRuleText.Truncate();

View File

@ -56,7 +56,7 @@
#include "nsIServiceManager.h"
#include "nsIXBLService.h"
#include "nsGkAtoms.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsRuleWalker.h"
#include "mozilla/css/Declaration.h"
#include "nsCSSProps.h"
@ -870,7 +870,7 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
} else {
// Ok, this is an animation restyle -- go ahead and update/walk the
// animated content style rule.
nsICSSStyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
if (!animContentStyleRule) {
UpdateAnimatedContentStyleRule();
animContentStyleRule = GetAnimatedContentStyleRule();
@ -1183,9 +1183,9 @@ public:
nsAString& aMappedAttrValue);
// If we've parsed any values for mapped attributes, this method returns
// a new already_AddRefed nsICSSStyleRule that incorporates the parsed
// a new already_AddRefed css::StyleRule that incorporates the parsed
// values. Otherwise, this method returns null.
already_AddRefed<nsICSSStyleRule> CreateStyleRule();
already_AddRefed<css::StyleRule> CreateStyleRule();
private:
// MEMBER DATA
@ -1246,14 +1246,14 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
mNodePrincipal, mDecl, &changed, PR_FALSE);
}
already_AddRefed<nsICSSStyleRule>
already_AddRefed<css::StyleRule>
MappedAttrParser::CreateStyleRule()
{
if (!mDecl) {
return nsnull; // No mapped attributes were parsed
}
nsCOMPtr<nsICSSStyleRule> rule = NS_NewCSSStyleRule(nsnull, mDecl);
nsRefPtr<css::StyleRule> rule = NS_NewCSSStyleRule(nsnull, mDecl);
mDecl = nsnull; // We no longer own the declaration -- drop our pointer to it
return rule.forget();
}
@ -1333,7 +1333,7 @@ ReleaseStyleRule(void* aObject, /* unused */
NS_ABORT_IF_FALSE(aPropertyName == SMIL_MAPPED_ATTR_STYLERULE_ATOM,
"unexpected property name, for "
"animated content style rule");
nsICSSStyleRule* styleRule = static_cast<nsICSSStyleRule*>(aPropertyValue);
css::StyleRule* styleRule = static_cast<css::StyleRule*>(aPropertyValue);
NS_ABORT_IF_FALSE(styleRule, "unexpected null style rule");
styleRule->Release();
}
@ -1355,7 +1355,7 @@ nsSVGElement::UpdateAnimatedContentStyleRule()
doc->PropertyTable(SMIL_MAPPED_ATTR_ANIMVAL)->
Enumerate(this, ParseMappedAttrAnimValueCallback, &mappedAttrParser);
nsRefPtr<nsICSSStyleRule>
nsRefPtr<css::StyleRule>
animContentStyleRule(mappedAttrParser.CreateStyleRule());
if (animContentStyleRule) {
@ -1372,13 +1372,13 @@ nsSVGElement::UpdateAnimatedContentStyleRule()
}
}
nsICSSStyleRule*
css::StyleRule*
nsSVGElement::GetAnimatedContentStyleRule()
{
return
static_cast<nsICSSStyleRule*>(GetProperty(SMIL_MAPPED_ATTR_ANIMVAL,
SMIL_MAPPED_ATTR_STYLERULE_ATOM,
nsnull));
static_cast<css::StyleRule*>(GetProperty(SMIL_MAPPED_ATTR_ANIMVAL,
SMIL_MAPPED_ATTR_STYLERULE_ATOM,
nsnull));
}
#endif // MOZ_SMIL

View File

@ -52,7 +52,6 @@
#include "nsISVGValue.h"
#include "nsISVGValueObserver.h"
#include "nsWeakReference.h"
#include "nsICSSStyleRule.h"
#ifdef MOZ_SMIL
#include "nsISMILAttr.h"
@ -254,7 +253,7 @@ protected:
void UpdateContentStyleRule();
#ifdef MOZ_SMIL
void UpdateAnimatedContentStyleRule();
nsICSSStyleRule* GetAnimatedContentStyleRule();
mozilla::css::StyleRule* GetAnimatedContentStyleRule();
#endif // MOZ_SMIL
nsISVGValue* GetMappedAttribute(PRInt32 aNamespaceID, nsIAtom* aName);
@ -497,7 +496,7 @@ private:
GetModificationDataForObservable(nsISVGValue* aObservable,
nsISVGValue::modificationType aModType);
nsCOMPtr<nsICSSStyleRule> mContentStyleRule;
nsRefPtr<mozilla::css::StyleRule> mContentStyleRule;
nsAttrAndChildArray mMappedAttributes;
PRPackedBool mSuppressNotification;

View File

@ -100,7 +100,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIServiceManager.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsIStyleSheet.h"
#include "nsIURL.h"
#include "nsIViewManager.h"
@ -153,6 +153,8 @@
#include "nsIDOMNSEvent.h"
#include "nsCCUncollectableMarker.h"
namespace css = mozilla::css;
// Global object maintenance
nsIXBLService * nsXULElement::gXBLService = nsnull;
@ -1804,7 +1806,7 @@ nsXULElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
nsICSSStyleRule*
css::StyleRule*
nsXULElement::GetInlineStyleRule()
{
if (!HasFlag(NODE_MAY_HAVE_STYLE)) {
@ -1969,7 +1971,7 @@ nsXULElement::EnsureLocalStyle()
protoattr->mValue.ToString(stringValue);
nsAttrValue value;
nsCOMPtr<nsICSSStyleRule> styleRule = do_QueryInterface(ruleClone);
nsRefPtr<css::StyleRule> styleRule = do_QueryObject(ruleClone);
value.SetTo(styleRule, &stringValue);
nsresult rv =
@ -2347,7 +2349,7 @@ nsresult nsXULElement::MakeHeavyweight()
nsString stringValue;
protoattr->mValue.ToString(stringValue);
nsCOMPtr<nsICSSStyleRule> styleRule = do_QueryInterface(ruleClone);
nsRefPtr<css::StyleRule> styleRule = do_QueryObject(ruleClone);
attrValue.SetTo(styleRule, &stringValue);
}
else {
@ -2878,7 +2880,7 @@ nsXULPrototypeElement::SetAttrAt(PRUint32 aPos, const nsAString& aValue,
else if (mAttributes[aPos].mName.Equals(nsGkAtoms::style)) {
mHasStyleAttribute = PR_TRUE;
// Parse the element's 'style' attribute
nsCOMPtr<nsICSSStyleRule> rule;
nsRefPtr<css::StyleRule> rule;
nsCSSParser parser;
NS_ENSURE_TRUE(parser, NS_ERROR_OUT_OF_MEMORY);

View File

@ -80,7 +80,6 @@
class nsIDocument;
class nsString;
class nsIDocShell;
class nsICSSStyleRule;
class nsIObjectInputStream;
class nsIObjectOutputStream;
@ -88,6 +87,12 @@ class nsIScriptGlobalObjectOwner;
class nsXULPrototypeNode;
typedef nsTArray<nsRefPtr<nsXULPrototypeNode> > nsPrototypeArray;
namespace mozilla {
namespace css {
class StyleRule;
}
}
static NS_DEFINE_CID(kCSSParserCID, NS_CSSPARSER_CID);
////////////////////////////////////////////////////////////////////////
@ -540,7 +545,7 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual nsICSSStyleRule* GetInlineStyleRule();
virtual mozilla::css::StyleRule* GetInlineStyleRule();
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;

View File

@ -2276,7 +2276,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
}
// XXX We want these after the @namespace rule. Does order matter
// for these rules, or can we call nsICSSStyleRule::StyleRuleCount()
// for these rules, or can we call StyleRule::StyleRuleCount()
// and just "append"?
static PRUint32 sInsertPrefSheetRulesAt = 1;

View File

@ -48,7 +48,7 @@
#include "nsIDOMCharacterData.h"
#include "nsRuleNode.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsICSSStyleRuleDOMWrapper.h"
#include "nsIDOMWindowInternal.h"
#include "nsXBLBinding.h"
@ -170,10 +170,10 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
NS_NewISupportsArray(getter_AddRefs(rules));
if (!rules) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsICSSStyleRule> cssRule;
nsRefPtr<mozilla::css::StyleRule> cssRule;
nsCOMPtr<nsIDOMCSSRule> domRule;
for ( ; !ruleNode->IsRoot(); ruleNode = ruleNode->GetParent()) {
cssRule = do_QueryInterface(ruleNode->GetRule());
cssRule = do_QueryObject(ruleNode->GetRule());
if (cssRule) {
cssRule->GetDOMRule(getter_AddRefs(domRule));
if (domRule)
@ -195,7 +195,7 @@ inDOMUtils::GetRuleLine(nsIDOMCSSStyleRule *aRule, PRUint32 *_retval)
NS_ENSURE_ARG_POINTER(aRule);
nsCOMPtr<nsICSSStyleRuleDOMWrapper> rule = do_QueryInterface(aRule);
nsCOMPtr<nsICSSStyleRule> cssrule;
nsRefPtr<mozilla::css::StyleRule> cssrule;
nsresult rv = rule->GetCSSStyleRule(getter_AddRefs(cssrule));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(cssrule != nsnull, NS_ERROR_FAILURE);

View File

@ -47,7 +47,6 @@
#include "nsIStyleSheet.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsICSSRule.h"
#include "nsICSSStyleRule.h"
#include "nsStyleChangeList.h"
#include "nsFrameManager.h"
#include "nsNetUtil.h"

View File

@ -80,7 +80,6 @@ EXPORTS = \
nsICSSPseudoComparator.h \
nsICSSRule.h \
nsICSSRuleList.h \
nsICSSStyleRule.h \
nsICSSStyleRuleDOMWrapper.h \
nsIStyleRule.h \
nsIStyleRuleProcessor.h \
@ -104,6 +103,7 @@ EXPORTS = \
EXPORTS_mozilla/css = \
Declaration.h \
Loader.h \
StyleRule.h \
$(NULL)
CPPSRCS = \
@ -120,7 +120,6 @@ CPPSRCS = \
nsCSSRules.cpp \
nsCSSScanner.cpp \
nsCSSStruct.cpp \
nsCSSStyleRule.cpp \
nsCSSStyleSheet.cpp \
nsCSSValue.cpp \
nsComputedDOMStyle.cpp \
@ -145,6 +144,7 @@ CPPSRCS = \
nsStyleTransformMatrix.cpp \
nsStyleUtil.cpp \
nsTransitionManager.cpp \
StyleRule.cpp \
$(NULL)
FORCE_STATIC_LIB = 1

View File

@ -44,9 +44,7 @@
* declarations
*/
#include "nsCOMPtr.h"
#include "nsCSSRule.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsICSSGroupRule.h"
#include "mozilla/css/Declaration.h"
#include "nsCSSStyleSheet.h"
@ -967,7 +965,7 @@ class DOMCSSStyleRule;
class DOMCSSDeclarationImpl : public nsDOMCSSDeclaration
{
public:
DOMCSSDeclarationImpl(nsICSSStyleRule *aRule);
DOMCSSDeclarationImpl(css::StyleRule *aRule);
virtual ~DOMCSSDeclarationImpl(void);
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent);
@ -977,7 +975,7 @@ public:
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
nsIURI** aBaseURI,
nsIPrincipal** aSheetPrincipal,
mozilla::css::Loader** aCSSLoader);
css::Loader** aCSSLoader);
virtual nsIDocument* DocToUpdate();
// Override |AddRef| and |Release| for being a member of
@ -995,7 +993,7 @@ public:
protected:
// This reference is not reference-counted. The rule object tells us
// when it's about to go away.
nsICSSStyleRule *mRule;
css::StyleRule *mRule;
inline css::DOMCSSStyleRule* DomRule();
@ -1012,7 +1010,7 @@ namespace css {
class DOMCSSStyleRule : public nsICSSStyleRuleDOMWrapper
{
public:
DOMCSSStyleRule(nsICSSStyleRule *aRule);
DOMCSSStyleRule(StyleRule *aRule);
virtual ~DOMCSSStyleRule();
NS_DECL_ISUPPORTS
@ -1020,7 +1018,7 @@ public:
NS_DECL_NSIDOMCSSSTYLERULE
// nsICSSStyleRuleDOMWrapper
NS_IMETHOD GetCSSStyleRule(nsICSSStyleRule **aResult);
NS_IMETHOD GetCSSStyleRule(StyleRule **aResult);
DOMCSSDeclarationImpl* DOMDeclaration() { return &mDOMDeclaration; }
@ -1029,7 +1027,7 @@ public:
protected:
DOMCSSDeclarationImpl mDOMDeclaration;
nsICSSStyleRule* Rule() {
StyleRule* Rule() {
return mDOMDeclaration.mRule;
}
};
@ -1037,7 +1035,7 @@ protected:
} // namespace css
} // namespace mozilla
DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule)
DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(css::StyleRule *aRule)
: mRule(aRule)
{
MOZ_COUNT_CTOR(DOMCSSDeclarationImpl);
@ -1085,7 +1083,7 @@ nsresult
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,
nsIURI** aBaseURI,
nsIPrincipal** aSheetPrincipal,
mozilla::css::Loader** aCSSLoader)
css::Loader** aCSSLoader)
{
// null out the out params since some of them may not get initialized below
*aSheetURI = nsnull;
@ -1148,7 +1146,7 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(css::Declaration* aDecl)
mozAutoDocUpdate updateBatch(owningDoc, UPDATE_STYLE, PR_TRUE);
nsCOMPtr<nsICSSStyleRule> oldRule = mRule;
nsRefPtr<css::StyleRule> oldRule = mRule;
mRule = oldRule->DeclarationChanged(aDecl, PR_TRUE).get();
if (!mRule)
return NS_ERROR_OUT_OF_MEMORY;
@ -1177,7 +1175,7 @@ DOMCI_DATA(CSSStyleRule, css::DOMCSSStyleRule)
namespace mozilla {
namespace css {
DOMCSSStyleRule::DOMCSSStyleRule(nsICSSStyleRule* aRule)
DOMCSSStyleRule::DOMCSSStyleRule(StyleRule* aRule)
: mDOMDeclaration(aRule)
{
}
@ -1281,7 +1279,7 @@ DOMCSSStyleRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
}
NS_IMETHODIMP
DOMCSSStyleRule::GetCSSStyleRule(nsICSSStyleRule **aResult)
DOMCSSStyleRule::GetCSSStyleRule(StyleRule **aResult)
{
*aResult = Rule();
NS_IF_ADDREF(*aResult);
@ -1296,76 +1294,6 @@ DOMCSSStyleRule::GetCSSStyleRule(nsICSSStyleRule **aResult)
namespace mozilla {
namespace css {
class NS_FINAL_CLASS StyleRule : public nsCSSRule,
public nsICSSStyleRule
{
public:
StyleRule(nsCSSSelectorList* aSelector,
Declaration *aDeclaration);
private:
// for |Clone|
StyleRule(const StyleRule& aCopy);
// for |DeclarationChanged|
StyleRule(StyleRule& aCopy,
Declaration *aDeclaration);
public:
NS_DECL_ISUPPORTS
virtual nsCSSSelectorList* Selector(void);
virtual PRUint32 GetLineNumber(void) const;
virtual void SetLineNumber(PRUint32 aLineNumber);
virtual Declaration* GetDeclaration(void) const;
virtual nsIStyleRule* GetImportantRule(void);
virtual void RuleMatched();
virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const;
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
virtual void SetParentRule(nsICSSGroupRule* aRule);
virtual nsresult GetCssText(nsAString& aCssText);
virtual nsresult SetCssText(const nsAString& aCssText);
virtual nsresult GetParentStyleSheet(nsCSSStyleSheet** aSheet);
virtual nsresult GetParentRule(nsICSSGroupRule** aParentRule);
virtual nsresult GetSelectorText(nsAString& aSelectorText);
virtual nsresult SetSelectorText(const nsAString& aSelectorText);
virtual PRInt32 GetType() const;
virtual already_AddRefed<nsICSSRule> Clone() const;
nsIDOMCSSRule* GetDOMRuleWeak(nsresult* aResult);
virtual already_AddRefed<nsICSSStyleRule>
DeclarationChanged(Declaration* aDecl, PRBool aHandleContainer);
// The new mapping function.
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
private:
// These are not supported and are not implemented!
StyleRule& operator=(const StyleRule& aCopy);
private:
~StyleRule();
protected:
nsCSSSelectorList* mSelector; // null for style attribute
Declaration* mDeclaration;
ImportantRule* mImportantRule; // initialized by RuleMatched
DOMCSSStyleRule* mDOMRule;
// Keep the same type so that MSVC packs them.
PRUint32 mLineNumber : 31;
PRUint32 mWasMatched : 1;
};
StyleRule::StyleRule(nsCSSSelectorList* aSelector,
Declaration* aDeclaration)
: nsCSSRule(),
@ -1432,10 +1360,15 @@ StyleRule::~StyleRule()
// QueryInterface implementation for StyleRule
NS_INTERFACE_MAP_BEGIN(StyleRule)
NS_INTERFACE_MAP_ENTRY(nsICSSStyleRule)
if (aIID.Equals(NS_GET_IID(mozilla::css::StyleRule))) {
*aInstancePtr = this;
NS_ADDREF_THIS();
return NS_OK;
}
else
NS_INTERFACE_MAP_ENTRY(nsICSSRule)
NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICSSStyleRule)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICSSRule)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(StyleRule)
@ -1532,7 +1465,7 @@ StyleRule::GetDOMRuleWeak(nsresult *aResult)
return mDOMRule;
}
/* virtual */ already_AddRefed<nsICSSStyleRule>
/* virtual */ already_AddRefed<StyleRule>
StyleRule::DeclarationChanged(Declaration* aDecl,
PRBool aHandleContainer)
{
@ -1559,7 +1492,7 @@ StyleRule::DeclarationChanged(Declaration* aDecl,
StyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
NS_ABORT_IF_FALSE(mWasMatched,
"somebody forgot to call nsICSSStyleRule::RuleMatched");
"somebody forgot to call css::StyleRule::RuleMatched");
mDeclaration->MapNormalRuleInfoInto(aRuleData);
}
@ -1651,7 +1584,7 @@ StyleRule::SetSelectorText(const nsAString& aSelectorText)
} // namespace css
} // namespace mozilla
already_AddRefed<nsICSSStyleRule>
already_AddRefed<css::StyleRule>
NS_NewCSSStyleRule(nsCSSSelectorList* aSelector,
css::Declaration* aDeclaration)
{

View File

@ -42,26 +42,22 @@
* selectors
*/
#ifndef nsICSSStyleRule_h___
#define nsICSSStyleRule_h___
#ifndef mozilla_css_StyleRule_h__
#define mozilla_css_StyleRule_h__
//#include <stdio.h>
#include "nsICSSRule.h"
#include "nsCSSRule.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsCSSValue.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPseudoClasses.h"
#include "nsAutoPtr.h"
class nsIAtom;
class nsCSSStyleSheet;
struct nsCSSSelectorList;
namespace mozilla {
namespace css {
class Declaration;
}
}
class nsCSSCompressedDataBlock;
struct nsAtomList {
public:
@ -292,22 +288,41 @@ private:
nsCSSSelectorList& operator=(const nsCSSSelectorList& aCopy);
};
// 97eb9881-55fb-462c-be1a-b6309d42f8d0
#define NS_ICSS_STYLE_RULE_IID \
{ 0x97eb9881, 0x55fb, 0x462c, \
{ 0xbe, 0x1a, 0xb6, 0x30, 0x9d, 0x42, 0xf8, 0xd0 } }
// 464bab7a-2fce-4f30-ab44-b7a5f3aae57d
#define NS_CSS_STYLE_RULE_IMPL_CID \
{ 0x464bab7a, 0x2fce, 0x4f30, \
{ 0xab, 0x44, 0xb7, 0xa5, 0xf3, 0xaa, 0xe5, 0x7d } }
class nsICSSStyleRule : public nsICSSRule {
namespace mozilla {
namespace css {
class Declaration;
class ImportantRule;
class DOMCSSStyleRule;
class NS_FINAL_CLASS StyleRule : public nsCSSRule,
public nsICSSRule {
public:
StyleRule(nsCSSSelectorList* aSelector,
Declaration *aDeclaration);
private:
// for |Clone|
StyleRule(const StyleRule& aCopy);
// for |DeclarationChanged|
StyleRule(StyleRule& aCopy,
Declaration *aDeclaration);
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSS_STYLE_RULE_IID)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_RULE_IMPL_CID)
NS_DECL_ISUPPORTS
// null for style attribute
virtual nsCSSSelectorList* Selector(void) = 0;
virtual nsCSSSelectorList* Selector();
virtual PRUint32 GetLineNumber(void) const = 0;
virtual void SetLineNumber(PRUint32 aLineNumber) = 0;
virtual PRUint32 GetLineNumber() const;
virtual void SetLineNumber(PRUint32 aLineNumber);
virtual mozilla::css::Declaration* GetDeclaration(void) const = 0;
virtual Declaration* GetDeclaration() const;
/**
* Return a new |nsIStyleRule| instance that replaces the current
@ -318,29 +333,66 @@ public:
* |DeclarationChanged| handles replacing the object in the container
* sheet or group rule if |aHandleContainer| is true.
*/
virtual already_AddRefed<nsICSSStyleRule>
DeclarationChanged(mozilla::css::Declaration* aDecl,
PRBool aHandleContainer) = 0;
virtual already_AddRefed<StyleRule>
DeclarationChanged(Declaration* aDecl, PRBool aHandleContainer);
virtual nsIStyleRule* GetImportantRule();
/**
* The rule processor must call this method before calling
* nsRuleWalker::Forward on this rule during rule matching.
*/
virtual void RuleMatched() = 0;
virtual void RuleMatched();
// hooks for DOM rule
virtual nsresult GetCssText(nsAString& aCssText) = 0;
virtual nsresult SetCssText(const nsAString& aCssText) = 0;
virtual nsresult GetParentStyleSheet(nsCSSStyleSheet** aSheet) = 0;
virtual nsresult GetParentRule(nsICSSGroupRule** aParentRule) = 0;
virtual nsresult GetSelectorText(nsAString& aSelectorText) = 0;
virtual nsresult SetSelectorText(const nsAString& aSelectorText) = 0;
virtual nsresult GetCssText(nsAString& aCssText);
virtual nsresult SetCssText(const nsAString& aCssText);
virtual nsresult GetParentStyleSheet(nsCSSStyleSheet** aSheet);
virtual nsresult GetParentRule(nsICSSGroupRule** aParentRule);
virtual nsresult GetSelectorText(nsAString& aSelectorText);
virtual nsresult SetSelectorText(const nsAString& aSelectorText);
virtual PRInt32 GetType() const;
virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const;
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
virtual void SetParentRule(nsICSSGroupRule* aRule);
virtual already_AddRefed<nsICSSRule> Clone() const;
nsIDOMCSSRule* GetDOMRuleWeak(nsresult* aResult);
// The new mapping function.
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
private:
// This is not supported and not implemented!
StyleRule& operator=(const StyleRule& aCopy);
private:
~StyleRule();
private:
nsCSSSelectorList* mSelector; // null for style attribute
Declaration* mDeclaration;
ImportantRule* mImportantRule; // initialized by RuleMatched
DOMCSSStyleRule* mDOMRule;
// Keep the same type so that MSVC packs them.
PRUint32 mLineNumber : 31;
PRUint32 mWasMatched : 1;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSStyleRule, NS_ICSS_STYLE_RULE_IID)
} // namespace css
} // namespace mozilla
already_AddRefed<nsICSSStyleRule>
NS_DEFINE_STATIC_IID_ACCESSOR(mozilla::css::StyleRule, NS_CSS_STYLE_RULE_IMPL_CID)
already_AddRefed<mozilla::css::StyleRule>
NS_NewCSSStyleRule(nsCSSSelectorList* aSelector,
mozilla::css::Declaration* aDeclaration);
#endif /* nsICSSStyleRule_h___ */
#endif /* mozilla_css_StyleRule_h__ */

View File

@ -51,7 +51,7 @@
#include "nsCSSKeywords.h"
#include "nsCSSScanner.h"
#include "mozilla/css/Loader.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsICSSImportRule.h"
#include "nsCSSRules.h"
#include "nsICSSNameSpaceRule.h"
@ -214,7 +214,7 @@ public:
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult);
css::StyleRule** aResult);
nsresult ParseDeclarations(const nsAString& aBuffer,
nsIURI* aSheetURL,
@ -962,10 +962,10 @@ NonMozillaVendorIdentifier(const nsAString& ident)
nsresult
CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
nsIURI* aDocURI,
nsIURI* aBaseURI,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult)
nsIURI* aDocURI,
nsIURI* aBaseURI,
nsIPrincipal* aNodePrincipal,
css::StyleRule** aResult)
{
NS_PRECONDITION(aNodePrincipal, "Must have principal here!");
AssertInitialState();
@ -2460,7 +2460,7 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData,
// Translate the selector list and declaration block into style data
nsCOMPtr<nsICSSStyleRule> rule = NS_NewCSSStyleRule(slist, declaration);
nsRefPtr<css::StyleRule> rule = NS_NewCSSStyleRule(slist, declaration);
rule->SetLineNumber(linenum);
(*aAppendFunc)(rule, aData);
@ -8504,7 +8504,7 @@ nsCSSParser::ParseStyleAttribute(const nsAString& aAttributeValue,
nsIURI* aDocURI,
nsIURI* aBaseURI,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult)
css::StyleRule** aResult)
{
return static_cast<CSSParserImpl*>(mImpl)->
ParseStyleAttribute(aAttributeValue, aDocURI, aBaseURI,

View File

@ -46,7 +46,6 @@
#include "nsCOMArray.h"
class nsICSSRule;
class nsICSSStyleRule;
class nsCSSStyleSheet;
class nsIPrincipal;
class nsIURI;
@ -58,6 +57,7 @@ namespace mozilla {
namespace css {
class Declaration;
class Loader;
class StyleRule;
}
}
@ -128,7 +128,7 @@ public:
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aNodePrincipal,
nsICSSStyleRule** aResult);
mozilla::css::StyleRule** aResult);
// Parse the body of a declaration block. Very similar to
// ParseStyleAttribute, but used under different circumstances.

View File

@ -58,7 +58,7 @@
#include "nsHashtable.h"
#include "nsICSSPseudoComparator.h"
#include "nsCSSRuleProcessor.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsICSSGroupRule.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
@ -95,6 +95,7 @@
#include "nsGenericElement.h"
using namespace mozilla::dom;
namespace css = mozilla::css;
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
@ -112,10 +113,10 @@ PRUint8 nsCSSRuleProcessor::sWinThemeId = nsILookAndFeel::eWindowsTheme_Generic;
* from that rule's selector list.
*/
struct RuleSelectorPair {
RuleSelectorPair(nsICSSStyleRule* aRule, nsCSSSelector* aSelector)
RuleSelectorPair(css::StyleRule* aRule, nsCSSSelector* aSelector)
: mRule(aRule), mSelector(aSelector) {}
nsICSSStyleRule* mRule;
css::StyleRule* mRule;
nsCSSSelector* mSelector; // which of |mRule|'s selectors
};
@ -590,7 +591,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
#endif
static inline
void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
void ContentEnumFunc(css::StyleRule* aRule, nsCSSSelector* aSelector,
RuleProcessorData* data);
void RuleHash::EnumerateAllRules(PRInt32 aNameSpace, nsIAtom* aTag,
@ -2347,7 +2348,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
}
static inline
void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
void ContentEnumFunc(css::StyleRule* aRule, nsCSSSelector* aSelector,
RuleProcessorData* data)
{
TreeMatchContext treeContext(PR_TRUE, data->mRuleWalker->VisitedHandling());
@ -2359,14 +2360,6 @@ void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
nsCSSSelector *next = aSelector->mNext;
if (!next || SelectorMatchesTree(*data, next, treeContext,
!nodeContext.mIsRelevantLink)) {
// for performance, require that every implementation of
// nsICSSStyleRule return the same pointer for nsIStyleRule (why
// would anything multiply inherit nsIStyleRule anyway?)
#ifdef DEBUG
nsCOMPtr<nsIStyleRule> iRule = do_QueryInterface(aRule);
NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule.get(),
"Please fix QI so this performance optimization is valid");
#endif
aRule->RuleMatched();
data->mRuleWalker->Forward(static_cast<nsIStyleRule*>(aRule));
// nsStyleSet will deal with the !important rule
@ -2422,14 +2415,6 @@ nsCSSRuleProcessor::RulesMatching(AnonBoxRuleProcessorData* aData)
nsTArray<RuleValue>& rules = entry->mRules;
for (RuleValue *value = rules.Elements(), *end = value + rules.Length();
value != end; ++value) {
// for performance, require that every implementation of
// nsICSSStyleRule return the same pointer for nsIStyleRule (why
// would anything multiply inherit nsIStyleRule anyway?)
#ifdef DEBUG
nsCOMPtr<nsIStyleRule> iRule = do_QueryInterface(value->mRule);
NS_ASSERTION(static_cast<nsIStyleRule*>(value->mRule) == iRule.get(),
"Please fix QI so this performance optimization is valid");
#endif
value->mRule->RuleMatched();
aData->mRuleWalker->Forward(static_cast<nsIStyleRule*>(value->mRule));
}
@ -2981,7 +2966,7 @@ CascadeRuleEnumFunc(nsICSSRule* aRule, void* aData)
PRInt32 type = aRule->GetType();
if (nsICSSRule::STYLE_RULE == type) {
nsICSSStyleRule* styleRule = (nsICSSStyleRule*)aRule;
css::StyleRule* styleRule = static_cast<css::StyleRule*>(aRule);
for (nsCSSSelectorList *sel = styleRule->Selector();
sel; sel = sel->mNext) {

View File

@ -42,8 +42,8 @@
#include "mozilla/css/Declaration.h"
#include "mozilla/css/Loader.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/dom/Element.h"
#include "nsICSSStyleRule.h"
#include "nsIDocument.h"
#include "nsIDOMMutationEvent.h"
#include "nsIPrincipal.h"
@ -87,14 +87,14 @@ nsresult
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
nsICSSStyleRule* oldRule =
css::StyleRule* oldRule =
#ifdef MOZ_SMIL
mIsSMILOverride ? mElement->GetSMILOverrideStyleRule() :
#endif // MOZ_SMIL
mElement->GetInlineStyleRule();
NS_ASSERTION(oldRule, "Element must have rule");
nsCOMPtr<nsICSSStyleRule> newRule =
nsRefPtr<css::StyleRule> newRule =
oldRule->DeclarationChanged(aDecl, PR_FALSE);
if (!newRule) {
return NS_ERROR_OUT_OF_MEMORY;
@ -134,7 +134,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(PRBool aAllocate)
if (!mElement)
return nsnull;
nsICSSStyleRule* cssRule;
css::StyleRule* cssRule;
#ifdef MOZ_SMIL
if (mIsSMILOverride)
cssRule = mElement->GetSMILOverrideStyleRule();
@ -152,7 +152,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(PRBool aAllocate)
// cannot fail
css::Declaration *decl = new css::Declaration();
decl->InitializeEmpty();
nsCOMPtr<nsICSSStyleRule> newRule = NS_NewCSSStyleRule(nsnull, decl);
nsRefPtr<css::StyleRule> newRule = NS_NewCSSStyleRule(nsnull, decl);
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;

View File

@ -47,7 +47,7 @@
#include "nsCSSPseudoElements.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsIStyleRuleProcessor.h"
#include "nsPresContext.h"
#include "nsIDocument.h"
@ -58,6 +58,7 @@
#include "mozilla/dom/Element.h"
using namespace mozilla::dom;
namespace css = mozilla::css;
nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet()
: mDocument(nsnull)
@ -74,7 +75,7 @@ nsHTMLCSSStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
Element* element = aData->mElement;
// just get the one and only style rule from the content's STYLE attribute
nsICSSStyleRule* rule = element->GetInlineStyleRule();
css::StyleRule* rule = element->GetInlineStyleRule();
if (rule) {
rule->RuleMatched();
aData->mRuleWalker->Forward(rule);

View File

@ -46,15 +46,16 @@
#include "nsIDOMCSSStyleRule.h"
// IID for the nsICSSStyleRuleDOMWrapper interface
// {476a4290-1194-4099-8f2d-a1ccc9bdd676}
// {cee1bbb6-0a32-4cf3-8d42-ba3938e9ecaa}
#define NS_ICSS_STYLE_RULE_DOM_WRAPPER_IID \
{0x476a4290, 0x1194, 0x4099, {0x8f, 0x2d, 0xa1, 0xcc, 0xc9, 0xbd, 0xd6, 0x76}}
{0xcee1bbb6, 0x0a32, 0x4cf3, {0x8d, 0x42, 0xba, 0x39, 0x38, 0xe9, 0xec, 0xaa}}
class nsICSSStyleRuleDOMWrapper : public nsIDOMCSSStyleRule {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSS_STYLE_RULE_DOM_WRAPPER_IID)
NS_IMETHOD GetCSSStyleRule(nsICSSStyleRule** aResult) = 0;
NS_IMETHOD GetCSSStyleRule(mozilla::css::StyleRule** aResult) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSStyleRuleDOMWrapper,

View File

@ -42,7 +42,7 @@
#include "nsStyleAnimation.h"
#include "nsCOMArray.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsString.h"
#include "nsStyleContext.h"
#include "nsStyleSet.h"
@ -1778,7 +1778,7 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
return PR_FALSE;
}
already_AddRefed<nsICSSStyleRule>
already_AddRefed<css::StyleRule>
BuildStyleRule(nsCSSProperty aProperty,
nsIContent* aTargetElement,
const nsAString& aSpecifiedValue,
@ -1870,8 +1870,8 @@ StyleWithDeclarationAdded(nsCSSProperty aProperty,
return nsnull;
}
// Parse specified value into a temporary nsICSSStyleRule
nsCOMPtr<nsICSSStyleRule> styleRule =
// Parse specified value into a temporary StyleRule
nsRefPtr<css::StyleRule> styleRule =
BuildStyleRule(aProperty, aTargetElement, aSpecifiedValue, aUseSVGMode);
if (!styleRule) {
return nsnull;

View File

@ -50,7 +50,7 @@
#include "nsIDocument.h"
#include "nsRuleWalker.h"
#include "nsStyleContext.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRuleProcessor.h"
@ -564,7 +564,7 @@ nsStyleSet::AssertNoCSSRules(nsRuleNode* aCurrLevelNode,
for (nsRuleNode *node = aCurrLevelNode; node != aLastPrevLevelNode;
node = node->GetParent()) {
nsIStyleRule *rule = node->GetRule();
nsCOMPtr<nsICSSStyleRule> cssRule(do_QueryInterface(rule));
nsRefPtr<mozilla::css::StyleRule> cssRule(do_QueryObject(rule));
NS_ASSERTION(!cssRule || !cssRule->Selector(), "Unexpected CSS rule");
}
}

View File

@ -74,7 +74,7 @@
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsICSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsCSSRendering.h"
#include "nsIFontMetrics.h"
#include "nsIDeviceContext.h"