2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
|
|
*
|
|
|
|
* 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.org 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):
|
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2008-06-02 20:17:35 -07:00
|
|
|
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* 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 MPL, 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 MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* representation of CSS style rules (selectors+declaration) and CSS
|
|
|
|
* selectors
|
|
|
|
*/
|
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
#ifndef mozilla_css_StyleRule_h__
|
|
|
|
#define mozilla_css_StyleRule_h__
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//#include <stdio.h>
|
2011-03-06 19:59:03 -08:00
|
|
|
#include "Rule.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2009-12-10 23:37:40 -08:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2009-12-10 23:37:41 -08:00
|
|
|
#include "nsCSSPseudoClasses.h"
|
2011-03-10 18:48:57 -08:00
|
|
|
#include "nsAutoPtr.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIAtom;
|
2010-05-11 13:41:47 -07:00
|
|
|
class nsCSSStyleSheet;
|
2010-04-23 19:59:47 -07:00
|
|
|
struct nsCSSSelectorList;
|
2011-03-10 18:48:57 -08:00
|
|
|
class nsCSSCompressedDataBlock;
|
2010-06-28 15:49:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
struct nsAtomList {
|
|
|
|
public:
|
|
|
|
nsAtomList(nsIAtom* aAtom);
|
|
|
|
nsAtomList(const nsString& aAtomValue);
|
|
|
|
~nsAtomList(void);
|
|
|
|
|
|
|
|
/** Do a deep clone. Should be used only on the first in the linked list. */
|
|
|
|
nsAtomList* Clone() const { return Clone(PR_TRUE); }
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAtom> mAtom;
|
|
|
|
nsAtomList* mNext;
|
|
|
|
private:
|
|
|
|
nsAtomList* Clone(PRBool aDeep) const;
|
|
|
|
|
|
|
|
// These are not supported and are not implemented!
|
|
|
|
nsAtomList(const nsAtomList& aCopy);
|
|
|
|
nsAtomList& operator=(const nsAtomList& aCopy);
|
|
|
|
};
|
|
|
|
|
2008-06-02 20:17:35 -07:00
|
|
|
struct nsPseudoClassList {
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2011-03-23 06:52:25 -07:00
|
|
|
nsPseudoClassList(nsCSSPseudoClasses::Type aType);
|
|
|
|
nsPseudoClassList(nsCSSPseudoClasses::Type aType, const PRUnichar *aString);
|
|
|
|
nsPseudoClassList(nsCSSPseudoClasses::Type aType, const PRInt32 *aIntPair);
|
|
|
|
nsPseudoClassList(nsCSSPseudoClasses::Type aType,
|
2010-04-23 19:59:47 -07:00
|
|
|
nsCSSSelectorList *aSelectorList /* takes ownership */);
|
2008-06-02 20:17:35 -07:00
|
|
|
~nsPseudoClassList(void);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Do a deep clone. Should be used only on the first in the linked list. */
|
2008-06-02 20:17:35 -07:00
|
|
|
nsPseudoClassList* Clone() const { return Clone(PR_TRUE); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-06-02 20:17:35 -07:00
|
|
|
union {
|
2011-03-23 06:52:24 -07:00
|
|
|
// For a given value of mType, we have either:
|
2008-06-02 20:17:35 -07:00
|
|
|
// a. no value, which means mMemory is always null
|
2010-04-23 19:59:47 -07:00
|
|
|
// (if none of the conditions for (b), (c), or (d) is true)
|
2008-06-02 20:17:35 -07:00
|
|
|
// b. a string value, which means mString/mMemory is non-null
|
2011-03-23 06:52:24 -07:00
|
|
|
// (if nsCSSPseudoClasses::HasStringArg(mType))
|
2008-06-02 20:17:35 -07:00
|
|
|
// c. an integer pair value, which means mNumbers/mMemory is non-null
|
2011-03-23 06:52:24 -07:00
|
|
|
// (if nsCSSPseudoClasses::HasNthPairArg(mType))
|
2010-04-23 19:59:47 -07:00
|
|
|
// d. a selector list, which means mSelectors is non-null
|
2011-03-23 06:52:24 -07:00
|
|
|
// (if nsCSSPseudoClasses::HasSelectorListArg(mType))
|
2010-04-23 19:59:47 -07:00
|
|
|
void* mMemory; // mString and mNumbers use NS_Alloc/NS_Free
|
2008-06-02 20:17:35 -07:00
|
|
|
PRUnichar* mString;
|
|
|
|
PRInt32* mNumbers;
|
2010-04-23 19:59:47 -07:00
|
|
|
nsCSSSelectorList* mSelectors;
|
2008-06-02 20:17:35 -07:00
|
|
|
} u;
|
2009-12-10 23:37:41 -08:00
|
|
|
nsCSSPseudoClasses::Type mType;
|
2008-06-02 20:17:35 -07:00
|
|
|
nsPseudoClassList* mNext;
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2008-06-02 20:17:35 -07:00
|
|
|
nsPseudoClassList* Clone(PRBool aDeep) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// These are not supported and are not implemented!
|
2008-06-02 20:17:35 -07:00
|
|
|
nsPseudoClassList(const nsPseudoClassList& aCopy);
|
|
|
|
nsPseudoClassList& operator=(const nsPseudoClassList& aCopy);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NS_ATTR_FUNC_SET 0 // [attr]
|
|
|
|
#define NS_ATTR_FUNC_EQUALS 1 // [attr=value]
|
|
|
|
#define NS_ATTR_FUNC_INCLUDES 2 // [attr~=value] (space separated)
|
|
|
|
#define NS_ATTR_FUNC_DASHMATCH 3 // [attr|=value] ('-' truncated)
|
|
|
|
#define NS_ATTR_FUNC_BEGINSMATCH 4 // [attr^=value] (begins with)
|
|
|
|
#define NS_ATTR_FUNC_ENDSMATCH 5 // [attr$=value] (ends with)
|
|
|
|
#define NS_ATTR_FUNC_CONTAINSMATCH 6 // [attr*=value] (contains substring)
|
|
|
|
|
|
|
|
struct nsAttrSelector {
|
|
|
|
public:
|
|
|
|
nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr);
|
|
|
|
nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint8 aFunction,
|
|
|
|
const nsString& aValue, PRBool aCaseSensitive);
|
2009-09-28 23:07:45 -07:00
|
|
|
nsAttrSelector(PRInt32 aNameSpace, nsIAtom* aLowercaseAttr,
|
|
|
|
nsIAtom* aCasedAttr, PRUint8 aFunction,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsString& aValue, PRBool aCaseSensitive);
|
|
|
|
~nsAttrSelector(void);
|
|
|
|
|
|
|
|
/** Do a deep clone. Should be used only on the first in the linked list. */
|
|
|
|
nsAttrSelector* Clone() const { return Clone(PR_TRUE); }
|
|
|
|
|
2009-05-13 01:26:48 -07:00
|
|
|
nsString mValue;
|
|
|
|
nsAttrSelector* mNext;
|
2009-09-28 23:07:45 -07:00
|
|
|
nsCOMPtr<nsIAtom> mLowercaseAttr;
|
|
|
|
nsCOMPtr<nsIAtom> mCasedAttr;
|
2009-05-13 01:26:48 -07:00
|
|
|
PRInt32 mNameSpace;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint8 mFunction;
|
2009-09-28 23:07:45 -07:00
|
|
|
PRPackedBool mCaseSensitive; // If we are in an HTML document,
|
|
|
|
// is the value case sensitive?
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
nsAttrSelector* Clone(PRBool aDeep) const;
|
|
|
|
|
|
|
|
// These are not supported and are not implemented!
|
|
|
|
nsAttrSelector(const nsAttrSelector& aCopy);
|
|
|
|
nsAttrSelector& operator=(const nsAttrSelector& aCopy);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nsCSSSelector {
|
|
|
|
public:
|
|
|
|
nsCSSSelector(void);
|
|
|
|
~nsCSSSelector(void);
|
|
|
|
|
|
|
|
/** Do a deep clone. Should be used only on the first in the linked list. */
|
|
|
|
nsCSSSelector* Clone() const { return Clone(PR_TRUE, PR_TRUE); }
|
|
|
|
|
|
|
|
void Reset(void);
|
|
|
|
void SetNameSpace(PRInt32 aNameSpace);
|
2009-09-28 23:07:45 -07:00
|
|
|
void SetTag(const nsString& aTag);
|
2007-03-22 10:30:00 -07:00
|
|
|
void AddID(const nsString& aID);
|
|
|
|
void AddClass(const nsString& aClass);
|
2011-03-23 06:52:25 -07:00
|
|
|
void AddPseudoClass(nsCSSPseudoClasses::Type aType);
|
|
|
|
void AddPseudoClass(nsCSSPseudoClasses::Type aType, const PRUnichar* aString);
|
|
|
|
void AddPseudoClass(nsCSSPseudoClasses::Type aType, const PRInt32* aIntPair);
|
2010-04-23 19:59:47 -07:00
|
|
|
// takes ownership of aSelectorList
|
2011-03-23 06:52:25 -07:00
|
|
|
void AddPseudoClass(nsCSSPseudoClasses::Type aType,
|
2010-04-23 19:59:47 -07:00
|
|
|
nsCSSSelectorList* aSelectorList);
|
2007-03-22 10:30:00 -07:00
|
|
|
void AddAttribute(PRInt32 aNameSpace, const nsString& aAttr);
|
|
|
|
void AddAttribute(PRInt32 aNameSpace, const nsString& aAttr, PRUint8 aFunc,
|
|
|
|
const nsString& aValue, PRBool aCaseSensitive);
|
|
|
|
void SetOperator(PRUnichar aOperator);
|
|
|
|
|
2009-08-01 08:53:40 -07:00
|
|
|
inline PRBool HasTagSelector() const {
|
|
|
|
return !!mCasedTag;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline PRBool IsPseudoElement() const {
|
|
|
|
return mLowercaseTag && !mCasedTag;
|
|
|
|
}
|
|
|
|
|
2009-01-16 19:44:21 -08:00
|
|
|
// Calculate the specificity of this selector (not including its mNext!).
|
|
|
|
PRInt32 CalcWeight() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-11 13:41:47 -07:00
|
|
|
void ToString(nsAString& aString, nsCSSStyleSheet* aSheet,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aAppend = PR_FALSE) const;
|
|
|
|
|
|
|
|
private:
|
2008-06-02 20:17:35 -07:00
|
|
|
void AddPseudoClassInternal(nsPseudoClassList *aPseudoClass);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCSSSelector* Clone(PRBool aDeepNext, PRBool aDeepNegations) const;
|
|
|
|
|
2009-02-19 13:55:48 -08:00
|
|
|
void AppendToStringWithoutCombinators(nsAString& aString,
|
2010-05-11 13:41:47 -07:00
|
|
|
nsCSSStyleSheet* aSheet) const;
|
2009-02-19 13:55:48 -08:00
|
|
|
void AppendToStringWithoutCombinatorsOrNegations(nsAString& aString,
|
2010-05-11 13:41:47 -07:00
|
|
|
nsCSSStyleSheet* aSheet,
|
2009-02-19 13:55:48 -08:00
|
|
|
PRBool aIsNegated)
|
|
|
|
const;
|
2008-11-11 19:36:20 -08:00
|
|
|
// Returns true if this selector can have a namespace specified (which
|
|
|
|
// happens if and only if the default namespace would apply to this
|
|
|
|
// selector).
|
|
|
|
PRBool CanBeNamespaced(PRBool aIsNegated) const;
|
2009-01-16 19:44:21 -08:00
|
|
|
// Calculate the specificity of this selector (not including its mNext
|
|
|
|
// or its mNegations).
|
|
|
|
PRInt32 CalcWeightWithoutNegations() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2009-12-10 23:37:40 -08:00
|
|
|
// Get and set the selector's pseudo type
|
|
|
|
nsCSSPseudoElements::Type PseudoType() const {
|
|
|
|
return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
|
|
|
|
}
|
|
|
|
void SetPseudoType(nsCSSPseudoElements::Type aType) {
|
|
|
|
NS_ASSERTION(aType > PR_INT16_MIN && aType < PR_INT16_MAX, "Out of bounds");
|
|
|
|
mPseudoType = static_cast<PRInt16>(aType);
|
|
|
|
}
|
|
|
|
|
2009-08-01 08:53:40 -07:00
|
|
|
// For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
|
|
|
|
// but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
|
|
|
|
// Also, for pseudo-elements mCasedTag will be null but mLowercaseTag
|
|
|
|
// contains their name.
|
|
|
|
nsCOMPtr<nsIAtom> mLowercaseTag;
|
|
|
|
nsCOMPtr<nsIAtom> mCasedTag;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAtomList* mIDList;
|
|
|
|
nsAtomList* mClassList;
|
2008-06-02 20:17:35 -07:00
|
|
|
nsPseudoClassList* mPseudoClassList; // atom for the pseudo, string for
|
|
|
|
// the argument to functional pseudos
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAttrSelector* mAttrList;
|
|
|
|
nsCSSSelector* mNegations;
|
|
|
|
nsCSSSelector* mNext;
|
2009-05-13 01:26:48 -07:00
|
|
|
PRInt32 mNameSpace;
|
|
|
|
PRUnichar mOperator;
|
2009-12-10 23:37:40 -08:00
|
|
|
private:
|
|
|
|
// PRInt16 to make sure it packs well with mOperator
|
|
|
|
PRInt16 mPseudoType;
|
2007-03-22 10:30:00 -07:00
|
|
|
// These are not supported and are not implemented!
|
|
|
|
nsCSSSelector(const nsCSSSelector& aCopy);
|
|
|
|
nsCSSSelector& operator=(const nsCSSSelector& aCopy);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A selector list is the unit of selectors that each style rule has.
|
|
|
|
* For example, "P B, H1 B { ... }" would be a selector list with two
|
|
|
|
* items (where each |nsCSSSelectorList| object's |mSelectors| has
|
|
|
|
* an |mNext| for the P or H1). We represent them as linked lists.
|
|
|
|
*/
|
|
|
|
struct nsCSSSelectorList {
|
|
|
|
nsCSSSelectorList(void);
|
|
|
|
~nsCSSSelectorList(void);
|
|
|
|
|
|
|
|
/**
|
2010-03-31 11:08:09 -07:00
|
|
|
* Create a new selector and push it onto the beginning of |mSelectors|,
|
|
|
|
* setting its |mNext| to the current value of |mSelectors|. If there is an
|
|
|
|
* earlier selector, set its |mOperator| to |aOperator|; else |aOperator|
|
|
|
|
* must be PRUnichar(0).
|
|
|
|
* Returns the new selector.
|
|
|
|
* The list owns the new selector.
|
2007-03-22 10:30:00 -07:00
|
|
|
* The caller is responsible for updating |mWeight|.
|
|
|
|
*/
|
2010-03-31 11:08:09 -07:00
|
|
|
nsCSSSelector* AddSelector(PRUnichar aOperator);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Should be used only on the first in the list
|
|
|
|
*/
|
2010-05-11 13:41:47 -07:00
|
|
|
void ToString(nsAString& aResult, nsCSSStyleSheet* aSheet);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do a deep clone. Should be used only on the first in the list.
|
|
|
|
*/
|
|
|
|
nsCSSSelectorList* Clone() const { return Clone(PR_TRUE); }
|
|
|
|
|
|
|
|
nsCSSSelector* mSelectors;
|
|
|
|
PRInt32 mWeight;
|
|
|
|
nsCSSSelectorList* mNext;
|
|
|
|
private:
|
|
|
|
nsCSSSelectorList* Clone(PRBool aDeep) const;
|
|
|
|
|
|
|
|
// These are not supported and are not implemented!
|
|
|
|
nsCSSSelectorList(const nsCSSSelectorList& aCopy);
|
|
|
|
nsCSSSelectorList& operator=(const nsCSSSelectorList& aCopy);
|
|
|
|
};
|
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
// 464bab7a-2fce-4f30-ab44-b7a5f3aae57d
|
|
|
|
#define NS_CSS_STYLE_RULE_IMPL_CID \
|
|
|
|
{ 0x464bab7a, 0x2fce, 0x4f30, \
|
|
|
|
{ 0xab, 0x44, 0xb7, 0xa5, 0xf3, 0xaa, 0xe5, 0x7d } }
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
class Declaration;
|
|
|
|
class ImportantRule;
|
|
|
|
class DOMCSSStyleRule;
|
|
|
|
|
2011-03-06 19:59:03 -08:00
|
|
|
class NS_FINAL_CLASS StyleRule : public Rule
|
2011-03-28 20:21:20 -07:00
|
|
|
{
|
2011-03-10 18:48:57 -08:00
|
|
|
public:
|
|
|
|
StyleRule(nsCSSSelectorList* aSelector,
|
|
|
|
Declaration *aDeclaration);
|
|
|
|
private:
|
|
|
|
// for |Clone|
|
|
|
|
StyleRule(const StyleRule& aCopy);
|
|
|
|
// for |DeclarationChanged|
|
|
|
|
StyleRule(StyleRule& aCopy,
|
|
|
|
Declaration *aDeclaration);
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2011-03-10 18:48:57 -08:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_RULE_IMPL_CID)
|
|
|
|
|
2011-03-17 22:18:08 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// null for style attribute
|
2011-03-10 18:50:12 -08:00
|
|
|
nsCSSSelectorList* Selector() { return mSelector; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-10 18:50:12 -08:00
|
|
|
PRUint32 GetLineNumber() const { return mLineNumber; }
|
|
|
|
void SetLineNumber(PRUint32 aLineNumber) { mLineNumber = aLineNumber; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-10 18:50:12 -08:00
|
|
|
Declaration* GetDeclaration() const { return mDeclaration; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
2010-07-23 11:00:47 -07:00
|
|
|
* Return a new |nsIStyleRule| instance that replaces the current
|
|
|
|
* one, with |aDecl| replacing the previous declaration. Due to the
|
|
|
|
* |nsIStyleRule| contract of immutability, this must be called if
|
|
|
|
* the declaration is modified.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* |DeclarationChanged| handles replacing the object in the container
|
|
|
|
* sheet or group rule if |aHandleContainer| is true.
|
|
|
|
*/
|
2011-03-10 18:50:12 -08:00
|
|
|
already_AddRefed<StyleRule>
|
2011-03-10 18:48:57 -08:00
|
|
|
DeclarationChanged(Declaration* aDecl, PRBool aHandleContainer);
|
|
|
|
|
2011-03-10 18:50:12 -08:00
|
|
|
nsIStyleRule* GetImportantRule();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-11 08:13:19 -08:00
|
|
|
/**
|
|
|
|
* The rule processor must call this method before calling
|
|
|
|
* nsRuleWalker::Forward on this rule during rule matching.
|
|
|
|
*/
|
2011-03-10 18:50:12 -08:00
|
|
|
void RuleMatched();
|
2009-12-11 08:13:19 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// hooks for DOM rule
|
2011-03-10 18:50:20 -08:00
|
|
|
void GetCssText(nsAString& aCssText);
|
|
|
|
void SetCssText(const nsAString& aCssText);
|
|
|
|
nsCSSStyleSheet* GetParentStyleSheet() { return mSheet; }
|
2010-08-07 22:28:33 -07:00
|
|
|
GroupRule* GetParentRule() { return mParentRule; }
|
2011-03-10 18:50:20 -08:00
|
|
|
void GetSelectorText(nsAString& aSelectorText);
|
|
|
|
void SetSelectorText(const nsAString& aSelectorText);
|
2011-03-10 18:48:57 -08:00
|
|
|
|
|
|
|
virtual PRInt32 GetType() const;
|
|
|
|
|
|
|
|
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;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
} // namespace css
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(mozilla::css::StyleRule, NS_CSS_STYLE_RULE_IMPL_CID)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
#endif /* mozilla_css_StyleRule_h__ */
|