зеркало из https://github.com/mozilla/pjs.git
Fix bug 107270
Reduce nsCSSDeclaration footprint r=dbaron, sr=hyatt
This commit is contained in:
Родитель
cfa801748a
Коммит
3a5aa3eab9
|
@ -44,7 +44,7 @@
|
|||
#include "nsICSSParser.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
@ -1734,10 +1734,10 @@ static PRInt32 GetStyleImpactFrom(const nsHTMLValue& aValue)
|
|||
nsCOMPtr<nsICSSStyleRule> cssRule(do_QueryInterface(supports));
|
||||
|
||||
if (cssRule) {
|
||||
nsCOMPtr<nsICSSDeclaration> declaration(dont_AddRef(cssRule->GetDeclaration()));
|
||||
nsCSSDeclaration* declaration = cssRule->GetDeclaration();
|
||||
|
||||
if (declaration) {
|
||||
declaration->GetStyleImpact(&hint);
|
||||
hint = declaration->GetStyleImpact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2386,10 +2386,9 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
|
|||
if (rule) {
|
||||
nsICSSStyleRule* cssRule;
|
||||
if (NS_OK == rule->QueryInterface(NS_GET_IID(nsICSSStyleRule), (void**)&cssRule)) {
|
||||
nsICSSDeclaration* decl = cssRule->GetDeclaration();
|
||||
nsCSSDeclaration* decl = cssRule->GetDeclaration();
|
||||
if (nsnull != decl) {
|
||||
decl->ToString(aResult);
|
||||
NS_RELEASE(decl);
|
||||
}
|
||||
NS_RELEASE(cssRule);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "nsStyleUtil.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsRuleNode.h"
|
||||
|
||||
class nsHTMLFontElement : public nsGenericHTMLContainerElement,
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIPresContext.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
|
||||
// XXX wrap, variable, cols, tabstop
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class nsIStyleRule;
|
|||
class nsICSSStyleSheet;
|
||||
class nsIUnicharInputStream;
|
||||
class nsIURI;
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSLoader;
|
||||
class nsICSSRule;
|
||||
class nsISupportsArray;
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint) = 0;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
NS_IMETHOD ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint) = 0;
|
||||
|
||||
// Charset management method:
|
||||
|
|
|
@ -80,7 +80,7 @@ EXPORTS = \
|
|||
nsICSSImportRule.h \
|
||||
nsICSSMediaRule.h \
|
||||
nsICSSNameSpaceRule.h \
|
||||
nsICSSDeclaration.h \
|
||||
nsCSSDeclaration.h \
|
||||
nsICSSOMFactory.h \
|
||||
nsIHTMLCSSStyleSheet.h \
|
||||
nsIHTMLAttributes.h \
|
||||
|
|
|
@ -54,7 +54,7 @@ EXPORTS = \
|
|||
nsICSSImportRule.h \
|
||||
nsICSSMediaRule.h \
|
||||
nsICSSNameSpaceRule.h \
|
||||
nsICSSDeclaration.h \
|
||||
nsCSSDeclaration.h \
|
||||
nsICSSOMFactory.h \
|
||||
nsIHTMLCSSStyleSheet.h \
|
||||
nsDOMCSSDeclaration.h \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,663 @@
|
|||
/* -*- 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.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):
|
||||
*
|
||||
*
|
||||
* 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 nsCSSDeclaration_h___
|
||||
#define nsCSSDeclaration_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include <stdio.h>
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsValueArray.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
class nsStringArray;
|
||||
|
||||
struct nsCSSStruct {
|
||||
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
|
||||
};
|
||||
|
||||
|
||||
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_FONT_SID \
|
||||
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_COLOR_SID \
|
||||
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_TEXT_SID \
|
||||
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_DISPLAY_SID \
|
||||
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_MARGIN_SID \
|
||||
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_POSITION_SID \
|
||||
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_LIST_SID \
|
||||
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_TABLE_SID \
|
||||
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_BREAKS_SID \
|
||||
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_PAGE_SID \
|
||||
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_CONTENT_SID \
|
||||
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
|
||||
#define NS_CSS_USER_INTERFACE_SID \
|
||||
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_AURAL_SID \
|
||||
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
|
||||
#define NS_CSS_XUL_SID \
|
||||
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// {9A41A036-027B-45ef-89C9-6E32797839E7}
|
||||
#define NS_CSS_SVG_SID \
|
||||
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
|
||||
#endif
|
||||
|
||||
struct nsCSSFont : public nsCSSStruct {
|
||||
nsCSSFont(void);
|
||||
nsCSSFont(const nsCSSFont& aCopy);
|
||||
~nsCSSFont(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFamily;
|
||||
nsCSSValue mStyle;
|
||||
nsCSSValue mVariant;
|
||||
nsCSSValue mWeight;
|
||||
nsCSSValue mSize;
|
||||
nsCSSValue mSizeAdjust; // NEW
|
||||
nsCSSValue mStretch; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSValueList {
|
||||
nsCSSValueList(void);
|
||||
nsCSSValueList(const nsCSSValueList& aCopy);
|
||||
~nsCSSValueList(void);
|
||||
|
||||
nsCSSValue mValue;
|
||||
nsCSSValueList* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSColor : public nsCSSStruct {
|
||||
nsCSSColor(void);
|
||||
nsCSSColor(const nsCSSColor& aCopy);
|
||||
~nsCSSColor(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mBackColor;
|
||||
nsCSSValue mBackImage;
|
||||
nsCSSValue mBackRepeat;
|
||||
nsCSSValue mBackAttachment;
|
||||
nsCSSValue mBackPositionX;
|
||||
nsCSSValue mBackPositionY;
|
||||
};
|
||||
|
||||
struct nsCSSShadow {
|
||||
nsCSSShadow(void);
|
||||
nsCSSShadow(const nsCSSShadow& aCopy);
|
||||
~nsCSSShadow(void);
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mXOffset;
|
||||
nsCSSValue mYOffset;
|
||||
nsCSSValue mRadius;
|
||||
nsCSSShadow* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSText : public nsCSSStruct {
|
||||
nsCSSText(void);
|
||||
nsCSSText(const nsCSSText& aCopy);
|
||||
~nsCSSText(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWordSpacing;
|
||||
nsCSSValue mLetterSpacing;
|
||||
nsCSSValue mVerticalAlign;
|
||||
nsCSSValue mTextTransform;
|
||||
nsCSSValue mTextAlign;
|
||||
nsCSSValue mTextIndent;
|
||||
nsCSSValue mDecoration;
|
||||
nsCSSShadow* mTextShadow; // NEW
|
||||
nsCSSValue mUnicodeBidi; // NEW
|
||||
nsCSSValue mLineHeight;
|
||||
nsCSSValue mWhiteSpace;
|
||||
};
|
||||
|
||||
struct nsCSSRect {
|
||||
nsCSSRect(void);
|
||||
nsCSSRect(const nsCSSRect& aCopy);
|
||||
~nsCSSRect();
|
||||
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
|
||||
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
|
||||
|
||||
nsCSSValue mTop;
|
||||
nsCSSValue mRight;
|
||||
nsCSSValue mBottom;
|
||||
nsCSSValue mLeft;
|
||||
};
|
||||
|
||||
struct nsCSSDisplay : public nsCSSStruct {
|
||||
nsCSSDisplay(void);
|
||||
nsCSSDisplay(const nsCSSDisplay& aCopy);
|
||||
~nsCSSDisplay(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mDirection;
|
||||
nsCSSValue mDisplay;
|
||||
nsCSSValue mBinding;
|
||||
nsCSSValue mAppearance;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSValue mFloat;
|
||||
nsCSSValue mClear;
|
||||
nsCSSRect* mClip;
|
||||
nsCSSValue mOverflow;
|
||||
nsCSSValue mVisibility;
|
||||
nsCSSValue mOpacity;
|
||||
// mLang member variable is here not because in needs to be stored
|
||||
// in nsCSSDeclaration objects but because it's needed on the
|
||||
// stack when the struct is used in WalkRuleTree.
|
||||
nsCSSValue mLang;
|
||||
};
|
||||
|
||||
struct nsCSSMargin : public nsCSSStruct {
|
||||
nsCSSMargin(void);
|
||||
nsCSSMargin(const nsCSSMargin& aCopy);
|
||||
~nsCSSMargin(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void EnsureBorderColors();
|
||||
|
||||
nsCSSRect* mMargin;
|
||||
nsCSSRect* mPadding;
|
||||
nsCSSRect* mBorderWidth;
|
||||
nsCSSRect* mBorderColor;
|
||||
nsCSSValueList** mBorderColors;
|
||||
nsCSSRect* mBorderStyle;
|
||||
nsCSSRect* mBorderRadius; // (extension)
|
||||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSRect* mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSPosition : public nsCSSStruct {
|
||||
nsCSSPosition(void);
|
||||
nsCSSPosition(const nsCSSPosition& aCopy);
|
||||
~nsCSSPosition(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWidth;
|
||||
nsCSSValue mMinWidth;
|
||||
nsCSSValue mMaxWidth;
|
||||
nsCSSValue mHeight;
|
||||
nsCSSValue mMinHeight;
|
||||
nsCSSValue mMaxHeight;
|
||||
nsCSSValue mBoxSizing; // NEW
|
||||
nsCSSRect* mOffset;
|
||||
nsCSSValue mZIndex;
|
||||
};
|
||||
|
||||
struct nsCSSList : public nsCSSStruct {
|
||||
nsCSSList(void);
|
||||
nsCSSList(const nsCSSList& aCopy);
|
||||
~nsCSSList(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mType;
|
||||
nsCSSValue mImage;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSRect* mImageRegion;
|
||||
};
|
||||
|
||||
struct nsCSSTable : public nsCSSStruct { // NEW
|
||||
nsCSSTable(void);
|
||||
nsCSSTable(const nsCSSTable& aCopy);
|
||||
~nsCSSTable(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBorderCollapse;
|
||||
nsCSSValue mBorderSpacingX;
|
||||
nsCSSValue mBorderSpacingY;
|
||||
nsCSSValue mCaptionSide;
|
||||
nsCSSValue mEmptyCells;
|
||||
|
||||
nsCSSValue mLayout;
|
||||
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
};
|
||||
|
||||
struct nsCSSBreaks : public nsCSSStruct { // NEW
|
||||
nsCSSBreaks(void);
|
||||
nsCSSBreaks(const nsCSSBreaks& aCopy);
|
||||
~nsCSSBreaks(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mOrphans;
|
||||
nsCSSValue mWidows;
|
||||
nsCSSValue mPage;
|
||||
nsCSSValue mPageBreakAfter;
|
||||
nsCSSValue mPageBreakBefore;
|
||||
nsCSSValue mPageBreakInside;
|
||||
};
|
||||
|
||||
struct nsCSSPage : public nsCSSStruct { // NEW
|
||||
nsCSSPage(void);
|
||||
nsCSSPage(const nsCSSPage& aCopy);
|
||||
~nsCSSPage(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mMarks;
|
||||
nsCSSValue mSizeWidth;
|
||||
nsCSSValue mSizeHeight;
|
||||
};
|
||||
|
||||
struct nsCSSCounterData {
|
||||
nsCSSCounterData(void);
|
||||
nsCSSCounterData(const nsCSSCounterData& aCopy);
|
||||
~nsCSSCounterData(void);
|
||||
|
||||
nsCSSValue mCounter;
|
||||
nsCSSValue mValue;
|
||||
nsCSSCounterData* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSQuotes {
|
||||
nsCSSQuotes(void);
|
||||
nsCSSQuotes(const nsCSSQuotes& aCopy);
|
||||
~nsCSSQuotes(void);
|
||||
|
||||
nsCSSValue mOpen;
|
||||
nsCSSValue mClose;
|
||||
nsCSSQuotes* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSContent : public nsCSSStruct {
|
||||
nsCSSContent(void);
|
||||
nsCSSContent(const nsCSSContent& aCopy);
|
||||
~nsCSSContent(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValueList* mContent;
|
||||
nsCSSCounterData* mCounterIncrement;
|
||||
nsCSSCounterData* mCounterReset;
|
||||
nsCSSValue mMarkerOffset;
|
||||
nsCSSQuotes* mQuotes;
|
||||
};
|
||||
|
||||
struct nsCSSUserInterface : public nsCSSStruct { // NEW
|
||||
nsCSSUserInterface(void);
|
||||
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
|
||||
~nsCSSUserInterface(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mUserInput;
|
||||
nsCSSValue mUserModify;
|
||||
nsCSSValue mUserSelect;
|
||||
nsCSSValueList* mKeyEquivalent;
|
||||
nsCSSValue mUserFocus;
|
||||
nsCSSValue mResizer;
|
||||
|
||||
nsCSSValueList* mCursor;
|
||||
};
|
||||
|
||||
struct nsCSSAural : public nsCSSStruct { // NEW
|
||||
nsCSSAural(void);
|
||||
nsCSSAural(const nsCSSAural& aCopy);
|
||||
~nsCSSAural(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mAzimuth;
|
||||
nsCSSValue mElevation;
|
||||
nsCSSValue mCueAfter;
|
||||
nsCSSValue mCueBefore;
|
||||
nsCSSValue mPauseAfter;
|
||||
nsCSSValue mPauseBefore;
|
||||
nsCSSValue mPitch;
|
||||
nsCSSValue mPitchRange;
|
||||
nsCSSValue mPlayDuring;
|
||||
nsCSSValue mPlayDuringFlags;
|
||||
nsCSSValue mRichness;
|
||||
nsCSSValue mSpeak;
|
||||
nsCSSValue mSpeakHeader;
|
||||
nsCSSValue mSpeakNumeral;
|
||||
nsCSSValue mSpeakPunctuation;
|
||||
nsCSSValue mSpeechRate;
|
||||
nsCSSValue mStress;
|
||||
nsCSSValue mVoiceFamily;
|
||||
nsCSSValue mVolume;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
struct nsCSSXUL : public nsCSSStruct {
|
||||
nsCSSXUL(void);
|
||||
nsCSSXUL(const nsCSSXUL& aCopy);
|
||||
~nsCSSXUL(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBoxAlign;
|
||||
nsCSSValue mBoxDirection;
|
||||
nsCSSValue mBoxFlex;
|
||||
nsCSSValue mBoxOrient;
|
||||
nsCSSValue mBoxPack;
|
||||
nsCSSValue mBoxOrdinal;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
struct nsCSSSVG : public nsCSSStruct {
|
||||
nsCSSSVG(void);
|
||||
nsCSSSVG(const nsCSSSVG& aCopy);
|
||||
~nsCSSSVG(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFill;
|
||||
nsCSSValue mFillOpacity;
|
||||
nsCSSValue mFillRule;
|
||||
nsCSSValue mStroke;
|
||||
nsCSSValue mStrokeDasharray;
|
||||
nsCSSValue mStrokeDashoffset;
|
||||
nsCSSValue mStrokeLinecap;
|
||||
nsCSSValue mStrokeLinejoin;
|
||||
nsCSSValue mStrokeMiterlimit;
|
||||
nsCSSValue mStrokeOpacity;
|
||||
nsCSSValue mStrokeWidth;
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some useful types.
|
||||
//
|
||||
typedef PRUint16 nsCSSBitField;
|
||||
typedef PRUint16 nsCSSDeclRefCount;
|
||||
struct nsCSSDeclContains
|
||||
{
|
||||
nsCSSBitField mHasDisplay:1; // 1
|
||||
nsCSSBitField mHasText:1; // 2
|
||||
nsCSSBitField mHasColor:1; // 3
|
||||
nsCSSBitField mHasMargin:1; // 4
|
||||
nsCSSBitField mHasList:1; // 4
|
||||
nsCSSBitField mHasFont:1; // 5
|
||||
nsCSSBitField mHasPosition:1; // 6
|
||||
nsCSSBitField mHasUserInterface:1; // 8
|
||||
nsCSSBitField mHasTable:1; // 9
|
||||
nsCSSBitField mHasContent:1; // 10
|
||||
#if defined(INCLUDE_XUL)
|
||||
nsCSSBitField mHasXUL:1; // 11
|
||||
#endif
|
||||
nsCSSBitField mHasBreaks:1; // 12
|
||||
nsCSSBitField mHasPage:1; // 13
|
||||
nsCSSBitField mHasAural:1; // 14
|
||||
#if defined(MOZ_SVG)
|
||||
nsCSSBitField mHasSVG:1; // 15
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Macros used to figure out at what index the pointer to the object is.
|
||||
// These macros have been placed in the order of what is considered most
|
||||
// created nsCSSStruct first, such that "less math for most likely" will
|
||||
// lend itself to the speed of the index lookup calculation.
|
||||
// I have also ordered the bit fields, in case the compiler can come up
|
||||
// with an optimization if the ordering would matter.
|
||||
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
|
||||
//
|
||||
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
|
||||
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
|
||||
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
|
||||
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
|
||||
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
|
||||
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
|
||||
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
|
||||
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
|
||||
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
|
||||
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
|
||||
#if defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
|
||||
#endif
|
||||
#if !defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_Content(decl))
|
||||
#else
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
|
||||
#endif
|
||||
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
|
||||
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
|
||||
#if defined(MOZ_SVG)
|
||||
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
|
||||
#endif
|
||||
|
||||
// --- nsCSSDeclaration -----------------
|
||||
|
||||
class nsCSSDeclaration {
|
||||
public:
|
||||
nsCSSDeclaration(void);
|
||||
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
|
||||
|
||||
public:
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
|
||||
nsCSSStruct* GetData(const nsID& aSID);
|
||||
nsCSSStruct* EnsureData(const nsID& aSID);
|
||||
|
||||
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
|
||||
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
|
||||
nsresult SetValueImportant(nsCSSProperty aProperty);
|
||||
nsresult AppendComment(const nsAReadableString& aComment);
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsAWritableString& aValue);
|
||||
nsresult GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue);
|
||||
|
||||
nsCSSDeclaration* GetImportantValues();
|
||||
PRBool GetValueIsImportant(nsCSSProperty aProperty);
|
||||
PRBool GetValueIsImportant(const nsAReadableString& aProperty);
|
||||
|
||||
PRUint32 Count();
|
||||
nsresult GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn);
|
||||
|
||||
PRInt32 GetStyleImpact() const;
|
||||
|
||||
nsresult ToString(nsAWritableString& aString);
|
||||
|
||||
nsCSSDeclaration* Clone() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty);
|
||||
|
||||
private:
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult);
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult);
|
||||
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
|
||||
PRBool operator==(const nsCSSDeclaration& aCopy) const;
|
||||
|
||||
void TryBorderShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBorderTopWidth,
|
||||
PRInt32 & aBorderTopStyle,
|
||||
PRInt32 & aBorderTopColor,
|
||||
PRInt32 & aBorderBottomWidth,
|
||||
PRInt32 & aBorderBottomStyle,
|
||||
PRInt32 & aBorderBottomColor,
|
||||
PRInt32 & aBorderLeftWidth,
|
||||
PRInt32 & aBorderLeftStyle,
|
||||
PRInt32 & aBorderLeftColor,
|
||||
PRInt32 & aBorderRightWidth,
|
||||
PRInt32 & aBorderRightStyle,
|
||||
PRInt32 & aBorderRightColor);
|
||||
void TryBorderSideShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aBorderWidth,
|
||||
PRInt32 & aBorderStyle,
|
||||
PRInt32 & aBorderColor);
|
||||
void TryMarginOrPaddingShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aTop, PRInt32 & aBottom,
|
||||
PRInt32 & aLeft, PRInt32 & aRight);
|
||||
void TryBackgroundShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBgColor, PRInt32 & aBgImage,
|
||||
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
void TryBackgroundPosition(nsAWritableString & aString,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
|
||||
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
|
||||
PRInt32 aThird, PRInt32 aFourth);
|
||||
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
|
||||
nsAWritableString& aResult);
|
||||
|
||||
protected:
|
||||
//
|
||||
// Specialized ref counting.
|
||||
// We do not want everyone to ref count us, only the rules which hold
|
||||
// onto us (our well defined lifetime is when the last rule releases
|
||||
// us).
|
||||
// It's worth a comment here that the main nsCSSDeclaration is refcounted,
|
||||
// but it's |mImportant| is not refcounted, but just owned by the
|
||||
// non-important declaration.
|
||||
//
|
||||
friend class CSSStyleRuleImpl;
|
||||
void AddRef(void) {
|
||||
NS_ASSERTION(0 <= mRuleRefs, "bad AddRef");
|
||||
mRuleRefs++;
|
||||
}
|
||||
void Release(void) {
|
||||
NS_ASSERTION(0 < mRuleRefs, "bad Release");
|
||||
if (0 == --mRuleRefs) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
public:
|
||||
void RuleAbort(void) {
|
||||
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
|
||||
delete this;
|
||||
}
|
||||
protected:
|
||||
//
|
||||
// Block everyone, except us or a derivitive, from deleting us.
|
||||
//
|
||||
~nsCSSDeclaration(void);
|
||||
|
||||
|
||||
private:
|
||||
nsValueArray* mOrder;
|
||||
nsCSSDeclaration* mImportant;
|
||||
nsSmallVoidArray mStructs;
|
||||
|
||||
//
|
||||
// Keep these two together, as they should pack.
|
||||
//
|
||||
nsCSSDeclRefCount mRuleRefs;
|
||||
nsCSSDeclContains mContains;
|
||||
};
|
||||
|
||||
|
||||
extern NS_EXPORT nsresult
|
||||
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif /* nsCSSDeclaration_h___ */
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint);
|
||||
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
NS_IMETHOD ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint);
|
||||
|
||||
NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const;
|
||||
|
@ -242,13 +242,13 @@ protected:
|
|||
PRBool ParseSelectorList(PRInt32& aErrorCode, SelectorList*& aListHead);
|
||||
PRBool ParseSelectorGroup(PRInt32& aErrorCode, SelectorList*& aListHead);
|
||||
PRBool ParseSelector(PRInt32& aErrorCode, nsCSSSelector& aSelectorResult);
|
||||
nsICSSDeclaration* ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
nsCSSDeclaration* ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
PRBool aCheckForBraces);
|
||||
PRBool ParseDeclaration(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aCheckForBraces,
|
||||
PRInt32& aChangeHint);
|
||||
PRBool ParseProperty(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseProperty(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint);
|
||||
PRBool ParseSingleValueProperty(PRInt32& aErrorCode, nsCSSValue& aValue,
|
||||
nsCSSProperty aPropID);
|
||||
|
@ -258,51 +258,51 @@ protected:
|
|||
#endif
|
||||
|
||||
// Property specific parsing routines
|
||||
PRBool ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseAppearance(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseAzimuth(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBackgroundPosition(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint,
|
||||
PRBool ParseBackground(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBackgroundPosition(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorder(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColors(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint,
|
||||
nsCSSProperty aProperty);
|
||||
PRBool ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseBorderSpacing(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderSide(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint);
|
||||
PRBool ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderWidth(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#endif
|
||||
PRBool ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseClip(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseContent(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCounterData(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint);
|
||||
PRBool ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFont(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCue(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCursor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFont(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFontWeight(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseFamily(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMargin(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseImageRegion(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseListStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMargin(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMarks(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseOutline(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#endif
|
||||
PRBool ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePause(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePlayDuring(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseQuotes(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseSize(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePadding(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePause(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePlayDuring(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseQuotes(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseSize(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseTextDecoration(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseTextShadow(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseTextShadow(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
|
||||
// Reused utility parsing routines
|
||||
nsresult AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
nsresult AppendValue(nsCSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
const nsCSSValue& aValue, PRInt32& aChangeHint);
|
||||
PRBool ParseBoxProperties(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseBoxProperties(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint);
|
||||
PRInt32 ParseChoice(PRInt32& aErrorCode, nsCSSValue aValues[],
|
||||
const nsCSSProperty aPropIDs[], PRInt32 aNumIDs);
|
||||
|
@ -665,7 +665,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
haveBraces = PR_FALSE;
|
||||
}
|
||||
|
||||
nsICSSDeclaration* declaration =
|
||||
nsCSSDeclaration* declaration =
|
||||
ParseDeclarationBlock(errorCode, haveBraces);
|
||||
if (nsnull != declaration) {
|
||||
// Create a style rule for the delcaration
|
||||
|
@ -673,7 +673,6 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
NS_NewCSSStyleRule(&rule, nsCSSSelector());
|
||||
rule->SetDeclaration(declaration);
|
||||
*aResult = rule;
|
||||
NS_RELEASE(declaration);
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
|
@ -687,7 +686,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint)
|
||||
{
|
||||
|
@ -792,7 +791,7 @@ NS_IMETHODIMP
|
|||
CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint)
|
||||
{
|
||||
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
|
||||
|
@ -1446,7 +1445,7 @@ PRBool CSSParserImpl::ParseRuleSet(PRInt32& aErrorCode, RuleAppendFunc aAppendFu
|
|||
CLEAR_ERROR();
|
||||
|
||||
// Next parse the declaration block
|
||||
nsICSSDeclaration* declaration = ParseDeclarationBlock(aErrorCode, PR_TRUE);
|
||||
nsCSSDeclaration* declaration = ParseDeclarationBlock(aErrorCode, PR_TRUE);
|
||||
if (nsnull == declaration) {
|
||||
// XXX skip something here
|
||||
delete slist;
|
||||
|
@ -1487,7 +1486,6 @@ PRBool CSSParserImpl::ParseRuleSet(PRInt32& aErrorCode, RuleAppendFunc aAppendFu
|
|||
|
||||
// Release temporary storage
|
||||
delete slist;
|
||||
NS_RELEASE(declaration);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2387,7 +2385,7 @@ PRBool CSSParserImpl::ParseSelector(PRInt32& aErrorCode,
|
|||
return PRBool(0 != dataMask);
|
||||
}
|
||||
|
||||
nsICSSDeclaration*
|
||||
nsCSSDeclaration*
|
||||
CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
PRBool aCheckForBraces)
|
||||
{
|
||||
|
@ -2398,7 +2396,7 @@ CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
|||
return nsnull;
|
||||
}
|
||||
}
|
||||
nsICSSDeclaration* declaration = nsnull;
|
||||
nsCSSDeclaration* declaration = nsnull;
|
||||
if (NS_OK == NS_NewCSSDeclaration(&declaration)) {
|
||||
PRInt32 count = 0;
|
||||
PRBool dropDeclaration = PR_FALSE;
|
||||
|
@ -2423,7 +2421,10 @@ CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
|||
}
|
||||
if (dropDeclaration ||
|
||||
(0 == count)) { // didn't get any XXX is this ok with the DOM?
|
||||
NS_RELEASE(declaration);
|
||||
if (nsnull != declaration) {
|
||||
declaration->RuleAbort();
|
||||
declaration = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
return declaration;
|
||||
|
@ -2601,7 +2602,7 @@ PRBool CSSParserImpl::ParseOutlinerPseudoElement(PRInt32& aErrorCode,
|
|||
|
||||
PRBool
|
||||
CSSParserImpl::ParseDeclaration(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aCheckForBraces,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3329,7 +3330,7 @@ done:
|
|||
return found;
|
||||
}
|
||||
|
||||
nsresult CSSParserImpl::AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
nsresult CSSParserImpl::AppendValue(nsCSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
const nsCSSValue& aValue, PRInt32& aChangeHint)
|
||||
{
|
||||
nsresult result;
|
||||
|
@ -3351,7 +3352,7 @@ nsresult CSSParserImpl::AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProper
|
|||
* existing values.
|
||||
*/
|
||||
PRBool CSSParserImpl::ParseBoxProperties(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[],
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3399,7 +3400,7 @@ PRBool CSSParserImpl::ParseBoxProperties(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseProperty(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3955,7 +3956,7 @@ PRBool CSSParserImpl::ParseAzimuth(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue appearance;
|
||||
|
@ -3970,7 +3971,7 @@ PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 6;
|
||||
|
@ -4110,7 +4111,7 @@ PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBackgroundPosition(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
// First try a number or a length value
|
||||
|
@ -4232,7 +4233,7 @@ static const nsCSSProperty kOutlineRadiusIDs[] = {
|
|||
eCSSProperty__moz_outline_radius_bottomLeft
|
||||
};
|
||||
|
||||
PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4271,13 +4272,13 @@ PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDecla
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderColor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderColor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderColorIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue xValue;
|
||||
|
@ -4307,7 +4308,7 @@ PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration*
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4335,33 +4336,33 @@ PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderStyleIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderWidth(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderWidthIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderRadiusIDs, aChangeHint);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kOutlineRadiusIDs, aChangeHint);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint, nsCSSProperty aProperty)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4395,7 +4396,7 @@ PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration*
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kClipIDs[] = {
|
||||
|
@ -4466,7 +4467,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclara
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kImageRegionIDs[] = {
|
||||
|
@ -4536,7 +4537,7 @@ PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* a
|
|||
|
||||
#define VARIANT_CONTENT (VARIANT_STRING | VARIANT_URL | VARIANT_COUNTER | VARIANT_ATTR | \
|
||||
VARIANT_KEYWORD)
|
||||
PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4584,7 +4585,7 @@ PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint)
|
||||
{
|
||||
nsString* ident = NextIdent(aErrorCode);
|
||||
|
@ -4664,7 +4665,7 @@ PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* a
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue before;
|
||||
|
@ -4689,7 +4690,7 @@ PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclarat
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4741,7 +4742,7 @@ PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDecla
|
|||
}
|
||||
|
||||
|
||||
PRBool CSSParserImpl::ParseFont(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseFont(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty fontIDs[] = {
|
||||
|
@ -4927,7 +4928,7 @@ PRBool CSSParserImpl::ParseFamily(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4961,7 +4962,7 @@ PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDe
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseMargin(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseMargin(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kMarginSideIDs[] = {
|
||||
|
@ -4992,7 +4993,7 @@ PRBool CSSParserImpl::ParseMarks(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
}
|
||||
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -5027,7 +5028,7 @@ PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
}
|
||||
#endif
|
||||
|
||||
PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kPaddingSideIDs[] = {
|
||||
|
@ -5040,7 +5041,7 @@ PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParsePause(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint)
|
||||
nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue before;
|
||||
if (ParseSingleValueProperty(aErrorCode, before, eCSSProperty_pause_before)) {
|
||||
|
@ -5065,7 +5066,7 @@ PRBool CSSParserImpl::ParsePause(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParsePlayDuring(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue playDuring;
|
||||
|
@ -5089,7 +5090,7 @@ PRBool CSSParserImpl::ParsePlayDuring(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseQuotes(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32 &aChangeHint)
|
||||
{
|
||||
nsCSSValue open;
|
||||
|
@ -5136,7 +5137,7 @@ PRBool CSSParserImpl::ParseQuotes(PRInt32& aErrorCode,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseSize(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseSize(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue width;
|
||||
|
@ -5184,7 +5185,7 @@ PRBool CSSParserImpl::ParseTextDecoration(PRInt32& aErrorCode, nsCSSValue& aValu
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseTextShadow(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,663 @@
|
|||
/* -*- 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.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):
|
||||
*
|
||||
*
|
||||
* 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 nsCSSDeclaration_h___
|
||||
#define nsCSSDeclaration_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include <stdio.h>
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsValueArray.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
class nsStringArray;
|
||||
|
||||
struct nsCSSStruct {
|
||||
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
|
||||
};
|
||||
|
||||
|
||||
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_FONT_SID \
|
||||
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_COLOR_SID \
|
||||
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_TEXT_SID \
|
||||
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_DISPLAY_SID \
|
||||
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_MARGIN_SID \
|
||||
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_POSITION_SID \
|
||||
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_LIST_SID \
|
||||
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_TABLE_SID \
|
||||
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_BREAKS_SID \
|
||||
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_PAGE_SID \
|
||||
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_CONTENT_SID \
|
||||
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
|
||||
#define NS_CSS_USER_INTERFACE_SID \
|
||||
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_AURAL_SID \
|
||||
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
|
||||
#define NS_CSS_XUL_SID \
|
||||
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// {9A41A036-027B-45ef-89C9-6E32797839E7}
|
||||
#define NS_CSS_SVG_SID \
|
||||
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
|
||||
#endif
|
||||
|
||||
struct nsCSSFont : public nsCSSStruct {
|
||||
nsCSSFont(void);
|
||||
nsCSSFont(const nsCSSFont& aCopy);
|
||||
~nsCSSFont(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFamily;
|
||||
nsCSSValue mStyle;
|
||||
nsCSSValue mVariant;
|
||||
nsCSSValue mWeight;
|
||||
nsCSSValue mSize;
|
||||
nsCSSValue mSizeAdjust; // NEW
|
||||
nsCSSValue mStretch; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSValueList {
|
||||
nsCSSValueList(void);
|
||||
nsCSSValueList(const nsCSSValueList& aCopy);
|
||||
~nsCSSValueList(void);
|
||||
|
||||
nsCSSValue mValue;
|
||||
nsCSSValueList* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSColor : public nsCSSStruct {
|
||||
nsCSSColor(void);
|
||||
nsCSSColor(const nsCSSColor& aCopy);
|
||||
~nsCSSColor(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mBackColor;
|
||||
nsCSSValue mBackImage;
|
||||
nsCSSValue mBackRepeat;
|
||||
nsCSSValue mBackAttachment;
|
||||
nsCSSValue mBackPositionX;
|
||||
nsCSSValue mBackPositionY;
|
||||
};
|
||||
|
||||
struct nsCSSShadow {
|
||||
nsCSSShadow(void);
|
||||
nsCSSShadow(const nsCSSShadow& aCopy);
|
||||
~nsCSSShadow(void);
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mXOffset;
|
||||
nsCSSValue mYOffset;
|
||||
nsCSSValue mRadius;
|
||||
nsCSSShadow* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSText : public nsCSSStruct {
|
||||
nsCSSText(void);
|
||||
nsCSSText(const nsCSSText& aCopy);
|
||||
~nsCSSText(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWordSpacing;
|
||||
nsCSSValue mLetterSpacing;
|
||||
nsCSSValue mVerticalAlign;
|
||||
nsCSSValue mTextTransform;
|
||||
nsCSSValue mTextAlign;
|
||||
nsCSSValue mTextIndent;
|
||||
nsCSSValue mDecoration;
|
||||
nsCSSShadow* mTextShadow; // NEW
|
||||
nsCSSValue mUnicodeBidi; // NEW
|
||||
nsCSSValue mLineHeight;
|
||||
nsCSSValue mWhiteSpace;
|
||||
};
|
||||
|
||||
struct nsCSSRect {
|
||||
nsCSSRect(void);
|
||||
nsCSSRect(const nsCSSRect& aCopy);
|
||||
~nsCSSRect();
|
||||
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
|
||||
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
|
||||
|
||||
nsCSSValue mTop;
|
||||
nsCSSValue mRight;
|
||||
nsCSSValue mBottom;
|
||||
nsCSSValue mLeft;
|
||||
};
|
||||
|
||||
struct nsCSSDisplay : public nsCSSStruct {
|
||||
nsCSSDisplay(void);
|
||||
nsCSSDisplay(const nsCSSDisplay& aCopy);
|
||||
~nsCSSDisplay(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mDirection;
|
||||
nsCSSValue mDisplay;
|
||||
nsCSSValue mBinding;
|
||||
nsCSSValue mAppearance;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSValue mFloat;
|
||||
nsCSSValue mClear;
|
||||
nsCSSRect* mClip;
|
||||
nsCSSValue mOverflow;
|
||||
nsCSSValue mVisibility;
|
||||
nsCSSValue mOpacity;
|
||||
// mLang member variable is here not because in needs to be stored
|
||||
// in nsCSSDeclaration objects but because it's needed on the
|
||||
// stack when the struct is used in WalkRuleTree.
|
||||
nsCSSValue mLang;
|
||||
};
|
||||
|
||||
struct nsCSSMargin : public nsCSSStruct {
|
||||
nsCSSMargin(void);
|
||||
nsCSSMargin(const nsCSSMargin& aCopy);
|
||||
~nsCSSMargin(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void EnsureBorderColors();
|
||||
|
||||
nsCSSRect* mMargin;
|
||||
nsCSSRect* mPadding;
|
||||
nsCSSRect* mBorderWidth;
|
||||
nsCSSRect* mBorderColor;
|
||||
nsCSSValueList** mBorderColors;
|
||||
nsCSSRect* mBorderStyle;
|
||||
nsCSSRect* mBorderRadius; // (extension)
|
||||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSRect* mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSPosition : public nsCSSStruct {
|
||||
nsCSSPosition(void);
|
||||
nsCSSPosition(const nsCSSPosition& aCopy);
|
||||
~nsCSSPosition(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWidth;
|
||||
nsCSSValue mMinWidth;
|
||||
nsCSSValue mMaxWidth;
|
||||
nsCSSValue mHeight;
|
||||
nsCSSValue mMinHeight;
|
||||
nsCSSValue mMaxHeight;
|
||||
nsCSSValue mBoxSizing; // NEW
|
||||
nsCSSRect* mOffset;
|
||||
nsCSSValue mZIndex;
|
||||
};
|
||||
|
||||
struct nsCSSList : public nsCSSStruct {
|
||||
nsCSSList(void);
|
||||
nsCSSList(const nsCSSList& aCopy);
|
||||
~nsCSSList(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mType;
|
||||
nsCSSValue mImage;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSRect* mImageRegion;
|
||||
};
|
||||
|
||||
struct nsCSSTable : public nsCSSStruct { // NEW
|
||||
nsCSSTable(void);
|
||||
nsCSSTable(const nsCSSTable& aCopy);
|
||||
~nsCSSTable(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBorderCollapse;
|
||||
nsCSSValue mBorderSpacingX;
|
||||
nsCSSValue mBorderSpacingY;
|
||||
nsCSSValue mCaptionSide;
|
||||
nsCSSValue mEmptyCells;
|
||||
|
||||
nsCSSValue mLayout;
|
||||
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
};
|
||||
|
||||
struct nsCSSBreaks : public nsCSSStruct { // NEW
|
||||
nsCSSBreaks(void);
|
||||
nsCSSBreaks(const nsCSSBreaks& aCopy);
|
||||
~nsCSSBreaks(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mOrphans;
|
||||
nsCSSValue mWidows;
|
||||
nsCSSValue mPage;
|
||||
nsCSSValue mPageBreakAfter;
|
||||
nsCSSValue mPageBreakBefore;
|
||||
nsCSSValue mPageBreakInside;
|
||||
};
|
||||
|
||||
struct nsCSSPage : public nsCSSStruct { // NEW
|
||||
nsCSSPage(void);
|
||||
nsCSSPage(const nsCSSPage& aCopy);
|
||||
~nsCSSPage(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mMarks;
|
||||
nsCSSValue mSizeWidth;
|
||||
nsCSSValue mSizeHeight;
|
||||
};
|
||||
|
||||
struct nsCSSCounterData {
|
||||
nsCSSCounterData(void);
|
||||
nsCSSCounterData(const nsCSSCounterData& aCopy);
|
||||
~nsCSSCounterData(void);
|
||||
|
||||
nsCSSValue mCounter;
|
||||
nsCSSValue mValue;
|
||||
nsCSSCounterData* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSQuotes {
|
||||
nsCSSQuotes(void);
|
||||
nsCSSQuotes(const nsCSSQuotes& aCopy);
|
||||
~nsCSSQuotes(void);
|
||||
|
||||
nsCSSValue mOpen;
|
||||
nsCSSValue mClose;
|
||||
nsCSSQuotes* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSContent : public nsCSSStruct {
|
||||
nsCSSContent(void);
|
||||
nsCSSContent(const nsCSSContent& aCopy);
|
||||
~nsCSSContent(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValueList* mContent;
|
||||
nsCSSCounterData* mCounterIncrement;
|
||||
nsCSSCounterData* mCounterReset;
|
||||
nsCSSValue mMarkerOffset;
|
||||
nsCSSQuotes* mQuotes;
|
||||
};
|
||||
|
||||
struct nsCSSUserInterface : public nsCSSStruct { // NEW
|
||||
nsCSSUserInterface(void);
|
||||
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
|
||||
~nsCSSUserInterface(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mUserInput;
|
||||
nsCSSValue mUserModify;
|
||||
nsCSSValue mUserSelect;
|
||||
nsCSSValueList* mKeyEquivalent;
|
||||
nsCSSValue mUserFocus;
|
||||
nsCSSValue mResizer;
|
||||
|
||||
nsCSSValueList* mCursor;
|
||||
};
|
||||
|
||||
struct nsCSSAural : public nsCSSStruct { // NEW
|
||||
nsCSSAural(void);
|
||||
nsCSSAural(const nsCSSAural& aCopy);
|
||||
~nsCSSAural(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mAzimuth;
|
||||
nsCSSValue mElevation;
|
||||
nsCSSValue mCueAfter;
|
||||
nsCSSValue mCueBefore;
|
||||
nsCSSValue mPauseAfter;
|
||||
nsCSSValue mPauseBefore;
|
||||
nsCSSValue mPitch;
|
||||
nsCSSValue mPitchRange;
|
||||
nsCSSValue mPlayDuring;
|
||||
nsCSSValue mPlayDuringFlags;
|
||||
nsCSSValue mRichness;
|
||||
nsCSSValue mSpeak;
|
||||
nsCSSValue mSpeakHeader;
|
||||
nsCSSValue mSpeakNumeral;
|
||||
nsCSSValue mSpeakPunctuation;
|
||||
nsCSSValue mSpeechRate;
|
||||
nsCSSValue mStress;
|
||||
nsCSSValue mVoiceFamily;
|
||||
nsCSSValue mVolume;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
struct nsCSSXUL : public nsCSSStruct {
|
||||
nsCSSXUL(void);
|
||||
nsCSSXUL(const nsCSSXUL& aCopy);
|
||||
~nsCSSXUL(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBoxAlign;
|
||||
nsCSSValue mBoxDirection;
|
||||
nsCSSValue mBoxFlex;
|
||||
nsCSSValue mBoxOrient;
|
||||
nsCSSValue mBoxPack;
|
||||
nsCSSValue mBoxOrdinal;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
struct nsCSSSVG : public nsCSSStruct {
|
||||
nsCSSSVG(void);
|
||||
nsCSSSVG(const nsCSSSVG& aCopy);
|
||||
~nsCSSSVG(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFill;
|
||||
nsCSSValue mFillOpacity;
|
||||
nsCSSValue mFillRule;
|
||||
nsCSSValue mStroke;
|
||||
nsCSSValue mStrokeDasharray;
|
||||
nsCSSValue mStrokeDashoffset;
|
||||
nsCSSValue mStrokeLinecap;
|
||||
nsCSSValue mStrokeLinejoin;
|
||||
nsCSSValue mStrokeMiterlimit;
|
||||
nsCSSValue mStrokeOpacity;
|
||||
nsCSSValue mStrokeWidth;
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some useful types.
|
||||
//
|
||||
typedef PRUint16 nsCSSBitField;
|
||||
typedef PRUint16 nsCSSDeclRefCount;
|
||||
struct nsCSSDeclContains
|
||||
{
|
||||
nsCSSBitField mHasDisplay:1; // 1
|
||||
nsCSSBitField mHasText:1; // 2
|
||||
nsCSSBitField mHasColor:1; // 3
|
||||
nsCSSBitField mHasMargin:1; // 4
|
||||
nsCSSBitField mHasList:1; // 4
|
||||
nsCSSBitField mHasFont:1; // 5
|
||||
nsCSSBitField mHasPosition:1; // 6
|
||||
nsCSSBitField mHasUserInterface:1; // 8
|
||||
nsCSSBitField mHasTable:1; // 9
|
||||
nsCSSBitField mHasContent:1; // 10
|
||||
#if defined(INCLUDE_XUL)
|
||||
nsCSSBitField mHasXUL:1; // 11
|
||||
#endif
|
||||
nsCSSBitField mHasBreaks:1; // 12
|
||||
nsCSSBitField mHasPage:1; // 13
|
||||
nsCSSBitField mHasAural:1; // 14
|
||||
#if defined(MOZ_SVG)
|
||||
nsCSSBitField mHasSVG:1; // 15
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Macros used to figure out at what index the pointer to the object is.
|
||||
// These macros have been placed in the order of what is considered most
|
||||
// created nsCSSStruct first, such that "less math for most likely" will
|
||||
// lend itself to the speed of the index lookup calculation.
|
||||
// I have also ordered the bit fields, in case the compiler can come up
|
||||
// with an optimization if the ordering would matter.
|
||||
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
|
||||
//
|
||||
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
|
||||
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
|
||||
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
|
||||
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
|
||||
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
|
||||
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
|
||||
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
|
||||
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
|
||||
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
|
||||
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
|
||||
#if defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
|
||||
#endif
|
||||
#if !defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_Content(decl))
|
||||
#else
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
|
||||
#endif
|
||||
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
|
||||
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
|
||||
#if defined(MOZ_SVG)
|
||||
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
|
||||
#endif
|
||||
|
||||
// --- nsCSSDeclaration -----------------
|
||||
|
||||
class nsCSSDeclaration {
|
||||
public:
|
||||
nsCSSDeclaration(void);
|
||||
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
|
||||
|
||||
public:
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
|
||||
nsCSSStruct* GetData(const nsID& aSID);
|
||||
nsCSSStruct* EnsureData(const nsID& aSID);
|
||||
|
||||
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
|
||||
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
|
||||
nsresult SetValueImportant(nsCSSProperty aProperty);
|
||||
nsresult AppendComment(const nsAReadableString& aComment);
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsAWritableString& aValue);
|
||||
nsresult GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue);
|
||||
|
||||
nsCSSDeclaration* GetImportantValues();
|
||||
PRBool GetValueIsImportant(nsCSSProperty aProperty);
|
||||
PRBool GetValueIsImportant(const nsAReadableString& aProperty);
|
||||
|
||||
PRUint32 Count();
|
||||
nsresult GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn);
|
||||
|
||||
PRInt32 GetStyleImpact() const;
|
||||
|
||||
nsresult ToString(nsAWritableString& aString);
|
||||
|
||||
nsCSSDeclaration* Clone() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty);
|
||||
|
||||
private:
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult);
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult);
|
||||
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
|
||||
PRBool operator==(const nsCSSDeclaration& aCopy) const;
|
||||
|
||||
void TryBorderShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBorderTopWidth,
|
||||
PRInt32 & aBorderTopStyle,
|
||||
PRInt32 & aBorderTopColor,
|
||||
PRInt32 & aBorderBottomWidth,
|
||||
PRInt32 & aBorderBottomStyle,
|
||||
PRInt32 & aBorderBottomColor,
|
||||
PRInt32 & aBorderLeftWidth,
|
||||
PRInt32 & aBorderLeftStyle,
|
||||
PRInt32 & aBorderLeftColor,
|
||||
PRInt32 & aBorderRightWidth,
|
||||
PRInt32 & aBorderRightStyle,
|
||||
PRInt32 & aBorderRightColor);
|
||||
void TryBorderSideShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aBorderWidth,
|
||||
PRInt32 & aBorderStyle,
|
||||
PRInt32 & aBorderColor);
|
||||
void TryMarginOrPaddingShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aTop, PRInt32 & aBottom,
|
||||
PRInt32 & aLeft, PRInt32 & aRight);
|
||||
void TryBackgroundShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBgColor, PRInt32 & aBgImage,
|
||||
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
void TryBackgroundPosition(nsAWritableString & aString,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
|
||||
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
|
||||
PRInt32 aThird, PRInt32 aFourth);
|
||||
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
|
||||
nsAWritableString& aResult);
|
||||
|
||||
protected:
|
||||
//
|
||||
// Specialized ref counting.
|
||||
// We do not want everyone to ref count us, only the rules which hold
|
||||
// onto us (our well defined lifetime is when the last rule releases
|
||||
// us).
|
||||
// It's worth a comment here that the main nsCSSDeclaration is refcounted,
|
||||
// but it's |mImportant| is not refcounted, but just owned by the
|
||||
// non-important declaration.
|
||||
//
|
||||
friend class CSSStyleRuleImpl;
|
||||
void AddRef(void) {
|
||||
NS_ASSERTION(0 <= mRuleRefs, "bad AddRef");
|
||||
mRuleRefs++;
|
||||
}
|
||||
void Release(void) {
|
||||
NS_ASSERTION(0 < mRuleRefs, "bad Release");
|
||||
if (0 == --mRuleRefs) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
public:
|
||||
void RuleAbort(void) {
|
||||
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
|
||||
delete this;
|
||||
}
|
||||
protected:
|
||||
//
|
||||
// Block everyone, except us or a derivitive, from deleting us.
|
||||
//
|
||||
~nsCSSDeclaration(void);
|
||||
|
||||
|
||||
private:
|
||||
nsValueArray* mOrder;
|
||||
nsCSSDeclaration* mImportant;
|
||||
nsSmallVoidArray mStructs;
|
||||
|
||||
//
|
||||
// Keep these two together, as they should pack.
|
||||
//
|
||||
nsCSSDeclRefCount mRuleRefs;
|
||||
nsCSSDeclContains mContains;
|
||||
};
|
||||
|
||||
|
||||
extern NS_EXPORT nsresult
|
||||
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif /* nsCSSDeclaration_h___ */
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsCSSRule.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsICSSGroupRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsICSSLoader.h"
|
||||
|
@ -861,30 +861,30 @@ nsresult nsCSSSelector::ToString( nsAWritableString& aString, nsICSSStyleSheet*
|
|||
// -- CSSImportantRule -------------------------------
|
||||
|
||||
// New map helpers shared by both important and regular rules.
|
||||
static nsresult MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont);
|
||||
static nsresult MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
|
||||
static nsresult MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
|
||||
static nsresult MapMarginForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
|
||||
static nsresult MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList);
|
||||
static nsresult MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition);
|
||||
static nsresult MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
|
||||
static nsresult MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
|
||||
static nsresult MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
|
||||
static nsresult MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
|
||||
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont);
|
||||
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
|
||||
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
|
||||
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
|
||||
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList);
|
||||
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition);
|
||||
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
|
||||
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
|
||||
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
|
||||
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
static nsresult MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL);
|
||||
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
static nsresult MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG);
|
||||
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG);
|
||||
#endif
|
||||
|
||||
class CSSStyleRuleImpl;
|
||||
|
||||
class CSSImportantRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsICSSDeclaration* aDeclaration);
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -908,23 +908,22 @@ public:
|
|||
protected:
|
||||
virtual ~CSSImportantRule(void);
|
||||
|
||||
nsICSSDeclaration* mDeclaration;
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
nsICSSStyleSheet* mSheet;
|
||||
|
||||
friend class CSSStyleRuleImpl;
|
||||
};
|
||||
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsICSSDeclaration* aDeclaration)
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration),
|
||||
mSheet(aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_IF_ADDREF(mDeclaration);
|
||||
}
|
||||
|
||||
CSSImportantRule::~CSSImportantRule(void)
|
||||
{
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSImportantRule, nsIStyleRule)
|
||||
|
@ -1073,9 +1072,9 @@ public:
|
|||
nsAWritableString& aReturn);
|
||||
|
||||
virtual void DropReference(void);
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl);
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsICSSStyleRule* aRule,
|
||||
nsICSSStyleSheet** aSheet,
|
||||
nsIDocument** aDocument,
|
||||
|
@ -1115,8 +1114,8 @@ DOMCSSDeclarationImpl::RemoveProperty(const nsAReadableString& aPropertyName,
|
|||
{
|
||||
aReturn.Truncate();
|
||||
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && decl) {
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
|
@ -1145,7 +1144,7 @@ DOMCSSDeclarationImpl::DropReference(void)
|
|||
}
|
||||
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
DOMCSSDeclarationImpl::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate)
|
||||
{
|
||||
if (nsnull != mRule) {
|
||||
|
@ -1159,7 +1158,7 @@ DOMCSSDeclarationImpl::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
}
|
||||
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::SetCSSDeclaration(nsICSSDeclaration *aDecl)
|
||||
DOMCSSDeclarationImpl::SetCSSDeclaration(nsCSSDeclaration *aDecl)
|
||||
{
|
||||
if (nsnull != mRule) {
|
||||
mRule->SetDeclaration(aDecl);
|
||||
|
@ -1215,8 +1214,8 @@ nsresult
|
|||
DOMCSSDeclarationImpl::ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
if (!decl) {
|
||||
return result;
|
||||
}
|
||||
|
@ -1262,8 +1261,8 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
PRBool aParseOnlyOneDecl,
|
||||
PRBool aClearOldDecl)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (decl) {
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
|
@ -1280,8 +1279,7 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
getter_AddRefs(cssParser));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsICSSDeclaration> declClone;
|
||||
decl->Clone(*getter_AddRefs(declClone));
|
||||
nsCSSDeclaration* declClone = decl->Clone();
|
||||
NS_ENSURE_TRUE(declClone, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (aClearOldDecl) {
|
||||
|
@ -1289,7 +1287,7 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
nsAutoString propName;
|
||||
PRUint32 count, i;
|
||||
|
||||
decl->Count(&count);
|
||||
count = decl->Count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
decl->GetNthProperty(0, propName);
|
||||
|
@ -1366,8 +1364,8 @@ public:
|
|||
virtual PRUint32 GetLineNumber(void) const;
|
||||
virtual void SetLineNumber(PRUint32 aLineNumber);
|
||||
|
||||
virtual nsICSSDeclaration* GetDeclaration(void) const;
|
||||
virtual void SetDeclaration(nsICSSDeclaration* aDeclaration);
|
||||
virtual nsCSSDeclaration* GetDeclaration(void) const;
|
||||
virtual void SetDeclaration(nsCSSDeclaration* aDeclaration);
|
||||
|
||||
virtual PRInt32 GetWeight(void) const;
|
||||
virtual void SetWeight(PRInt32 aWeight);
|
||||
|
@ -1406,7 +1404,7 @@ protected:
|
|||
|
||||
protected:
|
||||
nsCSSSelector mSelector;
|
||||
nsICSSDeclaration* mDeclaration;
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
PRInt32 mWeight;
|
||||
CSSImportantRule* mImportantRule;
|
||||
DOMCSSDeclarationImpl* mDOMDeclaration;
|
||||
|
@ -1452,7 +1450,10 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
|
|||
}
|
||||
|
||||
if (aCopy.mDeclaration) {
|
||||
aCopy.mDeclaration->Clone(mDeclaration);
|
||||
mDeclaration = aCopy.mDeclaration->Clone();
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->AddRef();
|
||||
}
|
||||
}
|
||||
// rest is constructed lazily on existing data
|
||||
}
|
||||
|
@ -1472,10 +1473,14 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
|
|||
next = selector->mNext;
|
||||
delete selector;
|
||||
}
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->Release();
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
if (nsnull != mImportantRule) {
|
||||
mImportantRule->mSheet = nsnull;
|
||||
NS_RELEASE(mImportantRule);
|
||||
delete mImportantRule;
|
||||
mImportantRule = nsnull;
|
||||
}
|
||||
if (nsnull != mDOMDeclaration) {
|
||||
mDOMDeclaration->DropReference();
|
||||
|
@ -1619,20 +1624,21 @@ void CSSStyleRuleImpl::SetLineNumber(PRUint32 aLineNumber)
|
|||
mLineNumber = aLineNumber;
|
||||
}
|
||||
|
||||
nsICSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
nsCSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
{
|
||||
nsICSSDeclaration* result = mDeclaration;
|
||||
NS_IF_ADDREF(result);
|
||||
nsCSSDeclaration* result = mDeclaration;
|
||||
return result;
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::SetDeclaration(nsICSSDeclaration* aDeclaration)
|
||||
void CSSStyleRuleImpl::SetDeclaration(nsCSSDeclaration* aDeclaration)
|
||||
{
|
||||
if (mDeclaration != aDeclaration) {
|
||||
NS_IF_RELEASE(mImportantRule);
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->Release();
|
||||
}
|
||||
mDeclaration = aDeclaration;
|
||||
NS_IF_ADDREF(mDeclaration);
|
||||
mDeclaration->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1649,12 +1655,10 @@ void CSSStyleRuleImpl::SetWeight(PRInt32 aWeight)
|
|||
nsIStyleRule* CSSStyleRuleImpl::GetImportantRule(void)
|
||||
{
|
||||
if ((nsnull == mImportantRule) && (nsnull != mDeclaration)) {
|
||||
nsICSSDeclaration* important;
|
||||
mDeclaration->GetImportantValues(important);
|
||||
nsCSSDeclaration* important = mDeclaration->GetImportantValues();
|
||||
if (nsnull != important) {
|
||||
mImportantRule = new CSSImportantRule(mSheet, important);
|
||||
NS_ADDREF(mImportantRule);
|
||||
NS_RELEASE(important);
|
||||
}
|
||||
}
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
|
@ -1740,13 +1744,12 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont)
|
||||
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSFont* ourFont;
|
||||
aDecl->GetData(kCSSFontSID, (nsCSSStruct**)&ourFont);
|
||||
nsCSSFont* ourFont = (nsCSSFont*)aDecl->GetData(kCSSFontSID);
|
||||
if (!ourFont)
|
||||
return NS_OK; // We don't have any rules for fonts.
|
||||
|
||||
|
@ -1773,13 +1776,12 @@ MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont)
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
static nsresult
|
||||
MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
||||
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSXUL* ourXUL;
|
||||
aDecl->GetData(kCSSXULSID, (nsCSSStruct**)&ourXUL);
|
||||
nsCSSXUL* ourXUL = (nsCSSXUL*)aDecl->GetData(kCSSXULSID);
|
||||
if (!ourXUL)
|
||||
return NS_OK; // We don't have any rules for XUL.
|
||||
|
||||
|
@ -1813,13 +1815,12 @@ MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
|||
|
||||
#ifdef MOZ_SVG
|
||||
static nsresult
|
||||
MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
||||
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSSVG* ourSVG;
|
||||
aDecl->GetData(kCSSSVGSID, (nsCSSStruct**)&ourSVG);
|
||||
nsCSSSVG* ourSVG = (nsCSSSVG*)aDecl->GetData(kCSSSVGSID);
|
||||
if (!ourSVG)
|
||||
return NS_OK; // We don't have any rules for SVG.
|
||||
|
||||
|
@ -1863,13 +1864,12 @@ MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
|||
|
||||
|
||||
static nsresult
|
||||
MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
||||
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSPosition* ourPosition;
|
||||
aDecl->GetData(kCSSPositionSID, (nsCSSStruct**)&ourPosition);
|
||||
nsCSSPosition* ourPosition = (nsCSSPosition*)aDecl->GetData(kCSSPositionSID);
|
||||
if (!ourPosition)
|
||||
return NS_OK; // We don't have any rules for position.
|
||||
|
||||
|
@ -1916,13 +1916,12 @@ MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList)
|
||||
MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSList* ourList;
|
||||
aDecl->GetData(kCSSListSID, (nsCSSStruct**)&ourList);
|
||||
nsCSSList* ourList = (nsCSSList*)aDecl->GetData(kCSSListSID);
|
||||
if (!ourList)
|
||||
return NS_OK; // We don't have any rules for lists.
|
||||
|
||||
|
@ -1961,10 +1960,9 @@ MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapMarginForDeclaration(nsICSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
|
||||
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
|
||||
{
|
||||
nsCSSMargin* ourMargin;
|
||||
aDeclaration->GetData(kCSSMarginSID, (nsCSSStruct**)&ourMargin);
|
||||
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
|
||||
if (!ourMargin)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2106,13 +2104,12 @@ MapMarginForDeclaration(nsICSSDeclaration* aDeclaration, const nsStyleStructID&
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
|
||||
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK;
|
||||
|
||||
nsCSSColor* ourColor;
|
||||
aDecl->GetData(kCSSColorSID, (nsCSSStruct**)&ourColor);
|
||||
nsCSSColor* ourColor = (nsCSSColor*)aDecl->GetData(kCSSColorSID);
|
||||
if (!ourColor)
|
||||
return NS_OK; // No rules for color or background.
|
||||
|
||||
|
@ -2149,13 +2146,12 @@ MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsC
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
|
||||
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSTable* ourTable;
|
||||
aDecl->GetData(kCSSTableSID, (nsCSSStruct**)&ourTable);
|
||||
nsCSSTable* ourTable = (nsCSSTable*)aDecl->GetData(kCSSTableSID);
|
||||
if (!ourTable)
|
||||
return NS_OK; // We don't have any rules for tables.
|
||||
|
||||
|
@ -2190,13 +2186,12 @@ MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsC
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
|
||||
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSContent* ourContent;
|
||||
aDecl->GetData(kCSSContentSID, (nsCSSStruct**)&ourContent);
|
||||
nsCSSContent* ourContent = (nsCSSContent*)aDecl->GetData(kCSSContentSID);
|
||||
if (!ourContent)
|
||||
return NS_OK; // We don't have any rules for content.
|
||||
|
||||
|
@ -2222,13 +2217,12 @@ MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, n
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
|
||||
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSText* ourText;
|
||||
aDecl->GetData(kCSSTextSID, (nsCSSStruct**)&ourText);
|
||||
nsCSSText* ourText = (nsCSSText*)aDecl->GetData(kCSSTextSID);
|
||||
if (!ourText)
|
||||
return NS_OK; // We don't have any rules for text.
|
||||
|
||||
|
@ -2272,13 +2266,12 @@ MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
|
||||
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSDisplay* ourDisplay;
|
||||
aDecl->GetData(kCSSDisplaySID, (nsCSSStruct**)&ourDisplay);
|
||||
nsCSSDisplay* ourDisplay = (nsCSSDisplay*)aDecl->GetData(kCSSDisplaySID);
|
||||
if (!ourDisplay)
|
||||
return NS_OK; // We don't have any rules for display.
|
||||
|
||||
|
@ -2342,13 +2335,12 @@ MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, n
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
|
||||
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSUserInterface* ourUI;
|
||||
aDecl->GetData(kCSSUserInterfaceSID, (nsCSSStruct**)&ourUI);
|
||||
nsCSSUserInterface* ourUI = (nsCSSUserInterface*)aDecl->GetData(kCSSUserInterfaceSID);
|
||||
if (!ourUI)
|
||||
return NS_OK; // We don't have any rules for UI.
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDOMCSSAttrDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
|
@ -47,7 +47,6 @@
|
|||
#include "nsINodeInfo.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
|
@ -72,8 +71,8 @@ NS_IMETHODIMP
|
|||
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyName,
|
||||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && decl && mContent) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
@ -86,8 +85,7 @@ nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyN
|
|||
nsHTMLAtoms::style);
|
||||
}
|
||||
|
||||
PRInt32 hint;
|
||||
decl->GetStyleImpact(&hint);
|
||||
PRInt32 hint = decl->GetStyleImpact();
|
||||
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
nsCSSValue val;
|
||||
|
@ -122,7 +120,7 @@ nsDOMCSSAttributeDeclaration::DropReference()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
|
@ -156,7 +154,8 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
NS_RELEASE(cssRule);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(*aDecl);
|
||||
(*aDecl)->RuleAbort();
|
||||
*aDecl = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsICSSDeclaration *aDecl)
|
||||
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsCSSDeclaration *aDecl)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
nsIStyleRule* rule;
|
||||
|
@ -245,8 +244,8 @@ nsresult
|
|||
nsDOMCSSAttributeDeclaration::ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (!decl) {
|
||||
return result;
|
||||
|
@ -295,8 +294,8 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
PRBool aParseOnlyOneDecl,
|
||||
PRBool aClearOldDecl)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (decl) {
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
|
@ -321,15 +320,14 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
doc->AttributeWillChange(mContent, kNameSpaceID_None,
|
||||
nsHTMLAtoms::style);
|
||||
}
|
||||
nsCOMPtr<nsICSSDeclaration> declClone;
|
||||
decl->Clone(*getter_AddRefs(declClone));
|
||||
nsCSSDeclaration* declClone = decl->Clone();
|
||||
|
||||
if (aClearOldDecl) {
|
||||
// This should be done with decl->Clear() once such a method exists.
|
||||
nsAutoString propName;
|
||||
PRUint32 count, i;
|
||||
|
||||
decl->Count(&count);
|
||||
count = decl->Count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
decl->GetNthProperty(0, propName);
|
||||
|
|
|
@ -59,9 +59,9 @@ public:
|
|||
nsAWritableString& aReturn);
|
||||
|
||||
virtual void DropReference();
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl);
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIContent* aContent,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIDOMCSSRule.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -75,9 +75,9 @@ NS_IMPL_RELEASE(nsDOMCSSDeclaration);
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetCssText(nsAWritableString& aCssText)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsCSSDeclaration* decl;
|
||||
aCssText.Truncate();
|
||||
GetCSSDeclaration(getter_AddRefs(decl), PR_FALSE);
|
||||
GetCSSDeclaration(&decl, PR_FALSE);
|
||||
NS_ASSERTION(decl, "null CSSDeclaration");
|
||||
|
||||
if (decl) {
|
||||
|
@ -96,13 +96,12 @@ nsDOMCSSDeclaration::SetCssText(const nsAReadableString& aCssText)
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetLength(PRUint32* aLength)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
*aLength = 0;
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->Count(aLength);
|
||||
NS_RELEASE(decl);
|
||||
*aLength = decl->Count();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -140,13 +139,12 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAWritableString& aReturn)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.SetLength(0);
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetNthProperty(aIndex, aReturn);
|
||||
NS_RELEASE(decl);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -157,13 +155,12 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsAReadableString& aPropertyName,
|
|||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsCSSValue val;
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.SetLength(0);
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetValue(aPropertyName, aReturn);
|
||||
NS_RELEASE(decl);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -173,13 +170,12 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::GetPropertyPriority(const nsAReadableString& aPropertyName,
|
||||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
PRBool isImportant = PR_FALSE;
|
||||
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetValueIsImportant(aPropertyName, isImportant);
|
||||
NS_RELEASE(decl);
|
||||
isImportant = decl->GetValueIsImportant(aPropertyName);
|
||||
}
|
||||
|
||||
if ((NS_OK == result) && isImportant) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMCSS2Properties.h"
|
||||
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSParser;
|
||||
class nsIURI;
|
||||
|
||||
|
@ -77,10 +77,10 @@ public:
|
|||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
virtual void DropReference() = 0;
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate) = 0;
|
||||
// Note! This will only set the declaration if a style rule already exists
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl) = 0;
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl) = 0;
|
||||
|
||||
virtual nsresult ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue) = 0;
|
||||
|
|
|
@ -47,7 +47,7 @@ class nsISizeOfHandler;
|
|||
|
||||
class nsIAtom;
|
||||
class nsIArena;
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSStyleSheet;
|
||||
|
||||
struct nsAtomList {
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
virtual PRUint32 GetLineNumber(void) const = 0;
|
||||
virtual void SetLineNumber(PRUint32 aLineNumber) = 0;
|
||||
|
||||
virtual nsICSSDeclaration* GetDeclaration(void) const = 0;
|
||||
virtual void SetDeclaration(nsICSSDeclaration* aDeclaration) = 0;
|
||||
virtual nsCSSDeclaration* GetDeclaration(void) const = 0;
|
||||
virtual void SetDeclaration(nsCSSDeclaration* aDeclaration) = 0;
|
||||
|
||||
virtual PRInt32 GetWeight(void) const = 0;
|
||||
virtual void SetWeight(PRInt32 aWeight) = 0;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
|
||||
class nsIStyleContext;
|
||||
|
|
|
@ -314,7 +314,7 @@ inCSSValueSearch::SearchStyleRule(nsIStyleRule* aStyleRule)
|
|||
|
||||
nsCOMPtr<nsICSSStyleRule> cssRule = do_QueryInterface(aStyleRule);
|
||||
if (cssRule) {
|
||||
nsCOMPtr<nsICSSDeclaration> aDec = cssRule->GetDeclaration();
|
||||
nsCSSDeclaration* aDec = cssRule->GetDeclaration();
|
||||
for (PRUint32 i = 0; i < mPropertyCount; i++) {
|
||||
nsCSSProperty prop = mProperties[i];
|
||||
SearchStyleValue(aDec, prop);
|
||||
|
@ -327,7 +327,7 @@ inCSSValueSearch::SearchStyleRule(nsIStyleRule* aStyleRule)
|
|||
}
|
||||
|
||||
nsresult
|
||||
inCSSValueSearch::SearchStyleValue(nsICSSDeclaration* aDec, nsCSSProperty aProp)
|
||||
inCSSValueSearch::SearchStyleValue(nsCSSDeclaration* aDec, nsCSSProperty aProp)
|
||||
{
|
||||
const nsAFlatCString& cstring = nsCSSProps::GetStringValue(aProp);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsCSSValue.h"
|
||||
|
||||
class inCSSValueSearch : public inICSSValueSearch
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
nsresult KillSearch(PRInt16 aResult);
|
||||
nsresult SearchStyleSheet(nsIStyleSheet* aStyleSheet);
|
||||
nsresult SearchStyleRule(nsIStyleRule* aStyleRule);
|
||||
nsresult SearchStyleValue(nsICSSDeclaration* aDec, nsCSSProperty aProp);
|
||||
nsresult SearchStyleValue(nsCSSDeclaration* aDec, nsCSSProperty aProp);
|
||||
nsresult EqualizeURL(nsAutoString* aURL);
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ EXTRA_DSO_LDOPTS += \
|
|||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(PNG_LIBS) \
|
||||
$(ZLIB_LIBS) \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -48,16 +48,25 @@ CPP_OBJS= \
|
|||
$(NULL)
|
||||
|
||||
SUB_LIBRARIES = \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\rdfutil_s.lib \
|
||||
$(DIST)\lib\inspector_s.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\contenthtmlstyle_s.lib \
|
||||
$(DIST)\lib\contentshared_s.lib \
|
||||
$(DIST)\lib\unicharutil_s.lib \
|
||||
$(DIST)\lib\contentbase_s.lib \
|
||||
$(DIST)\lib\contentxmldoc_s.lib \
|
||||
$(DIST)\lib\contenthtmldoc_s.lib \
|
||||
$(DIST)\lib\contenthtmlcontent_s.lib \
|
||||
$(DIST)\lib\contentxmlcontent_s.lib \
|
||||
$(DIST)\lib\contentxsldoc_s.lib \
|
||||
$(DIST)\lib\contentevents_s.lib \
|
||||
$(DIST)\lib\inscreencap_s.lib \
|
||||
$(DIST)\lib\png.lib \
|
||||
$(DIST)\lib\zlib.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,663 @@
|
|||
/* -*- 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.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):
|
||||
*
|
||||
*
|
||||
* 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 nsCSSDeclaration_h___
|
||||
#define nsCSSDeclaration_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include <stdio.h>
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsValueArray.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
class nsStringArray;
|
||||
|
||||
struct nsCSSStruct {
|
||||
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
|
||||
};
|
||||
|
||||
|
||||
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_FONT_SID \
|
||||
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_COLOR_SID \
|
||||
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_TEXT_SID \
|
||||
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_DISPLAY_SID \
|
||||
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_MARGIN_SID \
|
||||
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_POSITION_SID \
|
||||
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_LIST_SID \
|
||||
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_TABLE_SID \
|
||||
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_BREAKS_SID \
|
||||
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_PAGE_SID \
|
||||
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_CONTENT_SID \
|
||||
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
|
||||
#define NS_CSS_USER_INTERFACE_SID \
|
||||
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_AURAL_SID \
|
||||
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
|
||||
#define NS_CSS_XUL_SID \
|
||||
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// {9A41A036-027B-45ef-89C9-6E32797839E7}
|
||||
#define NS_CSS_SVG_SID \
|
||||
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
|
||||
#endif
|
||||
|
||||
struct nsCSSFont : public nsCSSStruct {
|
||||
nsCSSFont(void);
|
||||
nsCSSFont(const nsCSSFont& aCopy);
|
||||
~nsCSSFont(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFamily;
|
||||
nsCSSValue mStyle;
|
||||
nsCSSValue mVariant;
|
||||
nsCSSValue mWeight;
|
||||
nsCSSValue mSize;
|
||||
nsCSSValue mSizeAdjust; // NEW
|
||||
nsCSSValue mStretch; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSValueList {
|
||||
nsCSSValueList(void);
|
||||
nsCSSValueList(const nsCSSValueList& aCopy);
|
||||
~nsCSSValueList(void);
|
||||
|
||||
nsCSSValue mValue;
|
||||
nsCSSValueList* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSColor : public nsCSSStruct {
|
||||
nsCSSColor(void);
|
||||
nsCSSColor(const nsCSSColor& aCopy);
|
||||
~nsCSSColor(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mBackColor;
|
||||
nsCSSValue mBackImage;
|
||||
nsCSSValue mBackRepeat;
|
||||
nsCSSValue mBackAttachment;
|
||||
nsCSSValue mBackPositionX;
|
||||
nsCSSValue mBackPositionY;
|
||||
};
|
||||
|
||||
struct nsCSSShadow {
|
||||
nsCSSShadow(void);
|
||||
nsCSSShadow(const nsCSSShadow& aCopy);
|
||||
~nsCSSShadow(void);
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mXOffset;
|
||||
nsCSSValue mYOffset;
|
||||
nsCSSValue mRadius;
|
||||
nsCSSShadow* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSText : public nsCSSStruct {
|
||||
nsCSSText(void);
|
||||
nsCSSText(const nsCSSText& aCopy);
|
||||
~nsCSSText(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWordSpacing;
|
||||
nsCSSValue mLetterSpacing;
|
||||
nsCSSValue mVerticalAlign;
|
||||
nsCSSValue mTextTransform;
|
||||
nsCSSValue mTextAlign;
|
||||
nsCSSValue mTextIndent;
|
||||
nsCSSValue mDecoration;
|
||||
nsCSSShadow* mTextShadow; // NEW
|
||||
nsCSSValue mUnicodeBidi; // NEW
|
||||
nsCSSValue mLineHeight;
|
||||
nsCSSValue mWhiteSpace;
|
||||
};
|
||||
|
||||
struct nsCSSRect {
|
||||
nsCSSRect(void);
|
||||
nsCSSRect(const nsCSSRect& aCopy);
|
||||
~nsCSSRect();
|
||||
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
|
||||
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
|
||||
|
||||
nsCSSValue mTop;
|
||||
nsCSSValue mRight;
|
||||
nsCSSValue mBottom;
|
||||
nsCSSValue mLeft;
|
||||
};
|
||||
|
||||
struct nsCSSDisplay : public nsCSSStruct {
|
||||
nsCSSDisplay(void);
|
||||
nsCSSDisplay(const nsCSSDisplay& aCopy);
|
||||
~nsCSSDisplay(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mDirection;
|
||||
nsCSSValue mDisplay;
|
||||
nsCSSValue mBinding;
|
||||
nsCSSValue mAppearance;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSValue mFloat;
|
||||
nsCSSValue mClear;
|
||||
nsCSSRect* mClip;
|
||||
nsCSSValue mOverflow;
|
||||
nsCSSValue mVisibility;
|
||||
nsCSSValue mOpacity;
|
||||
// mLang member variable is here not because in needs to be stored
|
||||
// in nsCSSDeclaration objects but because it's needed on the
|
||||
// stack when the struct is used in WalkRuleTree.
|
||||
nsCSSValue mLang;
|
||||
};
|
||||
|
||||
struct nsCSSMargin : public nsCSSStruct {
|
||||
nsCSSMargin(void);
|
||||
nsCSSMargin(const nsCSSMargin& aCopy);
|
||||
~nsCSSMargin(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void EnsureBorderColors();
|
||||
|
||||
nsCSSRect* mMargin;
|
||||
nsCSSRect* mPadding;
|
||||
nsCSSRect* mBorderWidth;
|
||||
nsCSSRect* mBorderColor;
|
||||
nsCSSValueList** mBorderColors;
|
||||
nsCSSRect* mBorderStyle;
|
||||
nsCSSRect* mBorderRadius; // (extension)
|
||||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSRect* mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSPosition : public nsCSSStruct {
|
||||
nsCSSPosition(void);
|
||||
nsCSSPosition(const nsCSSPosition& aCopy);
|
||||
~nsCSSPosition(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWidth;
|
||||
nsCSSValue mMinWidth;
|
||||
nsCSSValue mMaxWidth;
|
||||
nsCSSValue mHeight;
|
||||
nsCSSValue mMinHeight;
|
||||
nsCSSValue mMaxHeight;
|
||||
nsCSSValue mBoxSizing; // NEW
|
||||
nsCSSRect* mOffset;
|
||||
nsCSSValue mZIndex;
|
||||
};
|
||||
|
||||
struct nsCSSList : public nsCSSStruct {
|
||||
nsCSSList(void);
|
||||
nsCSSList(const nsCSSList& aCopy);
|
||||
~nsCSSList(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mType;
|
||||
nsCSSValue mImage;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSRect* mImageRegion;
|
||||
};
|
||||
|
||||
struct nsCSSTable : public nsCSSStruct { // NEW
|
||||
nsCSSTable(void);
|
||||
nsCSSTable(const nsCSSTable& aCopy);
|
||||
~nsCSSTable(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBorderCollapse;
|
||||
nsCSSValue mBorderSpacingX;
|
||||
nsCSSValue mBorderSpacingY;
|
||||
nsCSSValue mCaptionSide;
|
||||
nsCSSValue mEmptyCells;
|
||||
|
||||
nsCSSValue mLayout;
|
||||
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
};
|
||||
|
||||
struct nsCSSBreaks : public nsCSSStruct { // NEW
|
||||
nsCSSBreaks(void);
|
||||
nsCSSBreaks(const nsCSSBreaks& aCopy);
|
||||
~nsCSSBreaks(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mOrphans;
|
||||
nsCSSValue mWidows;
|
||||
nsCSSValue mPage;
|
||||
nsCSSValue mPageBreakAfter;
|
||||
nsCSSValue mPageBreakBefore;
|
||||
nsCSSValue mPageBreakInside;
|
||||
};
|
||||
|
||||
struct nsCSSPage : public nsCSSStruct { // NEW
|
||||
nsCSSPage(void);
|
||||
nsCSSPage(const nsCSSPage& aCopy);
|
||||
~nsCSSPage(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mMarks;
|
||||
nsCSSValue mSizeWidth;
|
||||
nsCSSValue mSizeHeight;
|
||||
};
|
||||
|
||||
struct nsCSSCounterData {
|
||||
nsCSSCounterData(void);
|
||||
nsCSSCounterData(const nsCSSCounterData& aCopy);
|
||||
~nsCSSCounterData(void);
|
||||
|
||||
nsCSSValue mCounter;
|
||||
nsCSSValue mValue;
|
||||
nsCSSCounterData* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSQuotes {
|
||||
nsCSSQuotes(void);
|
||||
nsCSSQuotes(const nsCSSQuotes& aCopy);
|
||||
~nsCSSQuotes(void);
|
||||
|
||||
nsCSSValue mOpen;
|
||||
nsCSSValue mClose;
|
||||
nsCSSQuotes* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSContent : public nsCSSStruct {
|
||||
nsCSSContent(void);
|
||||
nsCSSContent(const nsCSSContent& aCopy);
|
||||
~nsCSSContent(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValueList* mContent;
|
||||
nsCSSCounterData* mCounterIncrement;
|
||||
nsCSSCounterData* mCounterReset;
|
||||
nsCSSValue mMarkerOffset;
|
||||
nsCSSQuotes* mQuotes;
|
||||
};
|
||||
|
||||
struct nsCSSUserInterface : public nsCSSStruct { // NEW
|
||||
nsCSSUserInterface(void);
|
||||
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
|
||||
~nsCSSUserInterface(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mUserInput;
|
||||
nsCSSValue mUserModify;
|
||||
nsCSSValue mUserSelect;
|
||||
nsCSSValueList* mKeyEquivalent;
|
||||
nsCSSValue mUserFocus;
|
||||
nsCSSValue mResizer;
|
||||
|
||||
nsCSSValueList* mCursor;
|
||||
};
|
||||
|
||||
struct nsCSSAural : public nsCSSStruct { // NEW
|
||||
nsCSSAural(void);
|
||||
nsCSSAural(const nsCSSAural& aCopy);
|
||||
~nsCSSAural(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mAzimuth;
|
||||
nsCSSValue mElevation;
|
||||
nsCSSValue mCueAfter;
|
||||
nsCSSValue mCueBefore;
|
||||
nsCSSValue mPauseAfter;
|
||||
nsCSSValue mPauseBefore;
|
||||
nsCSSValue mPitch;
|
||||
nsCSSValue mPitchRange;
|
||||
nsCSSValue mPlayDuring;
|
||||
nsCSSValue mPlayDuringFlags;
|
||||
nsCSSValue mRichness;
|
||||
nsCSSValue mSpeak;
|
||||
nsCSSValue mSpeakHeader;
|
||||
nsCSSValue mSpeakNumeral;
|
||||
nsCSSValue mSpeakPunctuation;
|
||||
nsCSSValue mSpeechRate;
|
||||
nsCSSValue mStress;
|
||||
nsCSSValue mVoiceFamily;
|
||||
nsCSSValue mVolume;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
struct nsCSSXUL : public nsCSSStruct {
|
||||
nsCSSXUL(void);
|
||||
nsCSSXUL(const nsCSSXUL& aCopy);
|
||||
~nsCSSXUL(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBoxAlign;
|
||||
nsCSSValue mBoxDirection;
|
||||
nsCSSValue mBoxFlex;
|
||||
nsCSSValue mBoxOrient;
|
||||
nsCSSValue mBoxPack;
|
||||
nsCSSValue mBoxOrdinal;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
struct nsCSSSVG : public nsCSSStruct {
|
||||
nsCSSSVG(void);
|
||||
nsCSSSVG(const nsCSSSVG& aCopy);
|
||||
~nsCSSSVG(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFill;
|
||||
nsCSSValue mFillOpacity;
|
||||
nsCSSValue mFillRule;
|
||||
nsCSSValue mStroke;
|
||||
nsCSSValue mStrokeDasharray;
|
||||
nsCSSValue mStrokeDashoffset;
|
||||
nsCSSValue mStrokeLinecap;
|
||||
nsCSSValue mStrokeLinejoin;
|
||||
nsCSSValue mStrokeMiterlimit;
|
||||
nsCSSValue mStrokeOpacity;
|
||||
nsCSSValue mStrokeWidth;
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some useful types.
|
||||
//
|
||||
typedef PRUint16 nsCSSBitField;
|
||||
typedef PRUint16 nsCSSDeclRefCount;
|
||||
struct nsCSSDeclContains
|
||||
{
|
||||
nsCSSBitField mHasDisplay:1; // 1
|
||||
nsCSSBitField mHasText:1; // 2
|
||||
nsCSSBitField mHasColor:1; // 3
|
||||
nsCSSBitField mHasMargin:1; // 4
|
||||
nsCSSBitField mHasList:1; // 4
|
||||
nsCSSBitField mHasFont:1; // 5
|
||||
nsCSSBitField mHasPosition:1; // 6
|
||||
nsCSSBitField mHasUserInterface:1; // 8
|
||||
nsCSSBitField mHasTable:1; // 9
|
||||
nsCSSBitField mHasContent:1; // 10
|
||||
#if defined(INCLUDE_XUL)
|
||||
nsCSSBitField mHasXUL:1; // 11
|
||||
#endif
|
||||
nsCSSBitField mHasBreaks:1; // 12
|
||||
nsCSSBitField mHasPage:1; // 13
|
||||
nsCSSBitField mHasAural:1; // 14
|
||||
#if defined(MOZ_SVG)
|
||||
nsCSSBitField mHasSVG:1; // 15
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Macros used to figure out at what index the pointer to the object is.
|
||||
// These macros have been placed in the order of what is considered most
|
||||
// created nsCSSStruct first, such that "less math for most likely" will
|
||||
// lend itself to the speed of the index lookup calculation.
|
||||
// I have also ordered the bit fields, in case the compiler can come up
|
||||
// with an optimization if the ordering would matter.
|
||||
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
|
||||
//
|
||||
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
|
||||
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
|
||||
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
|
||||
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
|
||||
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
|
||||
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
|
||||
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
|
||||
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
|
||||
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
|
||||
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
|
||||
#if defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
|
||||
#endif
|
||||
#if !defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_Content(decl))
|
||||
#else
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
|
||||
#endif
|
||||
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
|
||||
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
|
||||
#if defined(MOZ_SVG)
|
||||
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
|
||||
#endif
|
||||
|
||||
// --- nsCSSDeclaration -----------------
|
||||
|
||||
class nsCSSDeclaration {
|
||||
public:
|
||||
nsCSSDeclaration(void);
|
||||
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
|
||||
|
||||
public:
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
|
||||
nsCSSStruct* GetData(const nsID& aSID);
|
||||
nsCSSStruct* EnsureData(const nsID& aSID);
|
||||
|
||||
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
|
||||
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
|
||||
nsresult SetValueImportant(nsCSSProperty aProperty);
|
||||
nsresult AppendComment(const nsAReadableString& aComment);
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsAWritableString& aValue);
|
||||
nsresult GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue);
|
||||
|
||||
nsCSSDeclaration* GetImportantValues();
|
||||
PRBool GetValueIsImportant(nsCSSProperty aProperty);
|
||||
PRBool GetValueIsImportant(const nsAReadableString& aProperty);
|
||||
|
||||
PRUint32 Count();
|
||||
nsresult GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn);
|
||||
|
||||
PRInt32 GetStyleImpact() const;
|
||||
|
||||
nsresult ToString(nsAWritableString& aString);
|
||||
|
||||
nsCSSDeclaration* Clone() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty);
|
||||
|
||||
private:
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult);
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult);
|
||||
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
|
||||
PRBool operator==(const nsCSSDeclaration& aCopy) const;
|
||||
|
||||
void TryBorderShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBorderTopWidth,
|
||||
PRInt32 & aBorderTopStyle,
|
||||
PRInt32 & aBorderTopColor,
|
||||
PRInt32 & aBorderBottomWidth,
|
||||
PRInt32 & aBorderBottomStyle,
|
||||
PRInt32 & aBorderBottomColor,
|
||||
PRInt32 & aBorderLeftWidth,
|
||||
PRInt32 & aBorderLeftStyle,
|
||||
PRInt32 & aBorderLeftColor,
|
||||
PRInt32 & aBorderRightWidth,
|
||||
PRInt32 & aBorderRightStyle,
|
||||
PRInt32 & aBorderRightColor);
|
||||
void TryBorderSideShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aBorderWidth,
|
||||
PRInt32 & aBorderStyle,
|
||||
PRInt32 & aBorderColor);
|
||||
void TryMarginOrPaddingShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aTop, PRInt32 & aBottom,
|
||||
PRInt32 & aLeft, PRInt32 & aRight);
|
||||
void TryBackgroundShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBgColor, PRInt32 & aBgImage,
|
||||
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
void TryBackgroundPosition(nsAWritableString & aString,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
|
||||
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
|
||||
PRInt32 aThird, PRInt32 aFourth);
|
||||
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
|
||||
nsAWritableString& aResult);
|
||||
|
||||
protected:
|
||||
//
|
||||
// Specialized ref counting.
|
||||
// We do not want everyone to ref count us, only the rules which hold
|
||||
// onto us (our well defined lifetime is when the last rule releases
|
||||
// us).
|
||||
// It's worth a comment here that the main nsCSSDeclaration is refcounted,
|
||||
// but it's |mImportant| is not refcounted, but just owned by the
|
||||
// non-important declaration.
|
||||
//
|
||||
friend class CSSStyleRuleImpl;
|
||||
void AddRef(void) {
|
||||
NS_ASSERTION(0 <= mRuleRefs, "bad AddRef");
|
||||
mRuleRefs++;
|
||||
}
|
||||
void Release(void) {
|
||||
NS_ASSERTION(0 < mRuleRefs, "bad Release");
|
||||
if (0 == --mRuleRefs) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
public:
|
||||
void RuleAbort(void) {
|
||||
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
|
||||
delete this;
|
||||
}
|
||||
protected:
|
||||
//
|
||||
// Block everyone, except us or a derivitive, from deleting us.
|
||||
//
|
||||
~nsCSSDeclaration(void);
|
||||
|
||||
|
||||
private:
|
||||
nsValueArray* mOrder;
|
||||
nsCSSDeclaration* mImportant;
|
||||
nsSmallVoidArray mStructs;
|
||||
|
||||
//
|
||||
// Keep these two together, as they should pack.
|
||||
//
|
||||
nsCSSDeclRefCount mRuleRefs;
|
||||
nsCSSDeclContains mContains;
|
||||
};
|
||||
|
||||
|
||||
extern NS_EXPORT nsresult
|
||||
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif /* nsCSSDeclaration_h___ */
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint);
|
||||
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
NS_IMETHOD ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint);
|
||||
|
||||
NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const;
|
||||
|
@ -242,13 +242,13 @@ protected:
|
|||
PRBool ParseSelectorList(PRInt32& aErrorCode, SelectorList*& aListHead);
|
||||
PRBool ParseSelectorGroup(PRInt32& aErrorCode, SelectorList*& aListHead);
|
||||
PRBool ParseSelector(PRInt32& aErrorCode, nsCSSSelector& aSelectorResult);
|
||||
nsICSSDeclaration* ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
nsCSSDeclaration* ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
PRBool aCheckForBraces);
|
||||
PRBool ParseDeclaration(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aCheckForBraces,
|
||||
PRInt32& aChangeHint);
|
||||
PRBool ParseProperty(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseProperty(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint);
|
||||
PRBool ParseSingleValueProperty(PRInt32& aErrorCode, nsCSSValue& aValue,
|
||||
nsCSSProperty aPropID);
|
||||
|
@ -258,51 +258,51 @@ protected:
|
|||
#endif
|
||||
|
||||
// Property specific parsing routines
|
||||
PRBool ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseAppearance(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseAzimuth(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBackgroundPosition(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint,
|
||||
PRBool ParseBackground(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBackgroundPosition(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorder(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderColors(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint,
|
||||
nsCSSProperty aProperty);
|
||||
PRBool ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseBorderSpacing(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderSide(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint);
|
||||
PRBool ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderWidth(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseBorderRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#endif
|
||||
PRBool ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseClip(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseContent(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCounterData(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint);
|
||||
PRBool ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFont(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCue(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseCursor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFont(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseFontWeight(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseFamily(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMargin(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseImageRegion(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseListStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMargin(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseMarks(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseOutline(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
#endif
|
||||
PRBool ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePause(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePlayDuring(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseQuotes(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseSize(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePadding(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePause(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParsePlayDuring(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseQuotes(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseSize(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseTextDecoration(PRInt32& aErrorCode, nsCSSValue& aValue);
|
||||
PRBool ParseTextShadow(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
PRBool ParseTextShadow(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint);
|
||||
|
||||
// Reused utility parsing routines
|
||||
nsresult AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
nsresult AppendValue(nsCSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
const nsCSSValue& aValue, PRInt32& aChangeHint);
|
||||
PRBool ParseBoxProperties(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool ParseBoxProperties(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint);
|
||||
PRInt32 ParseChoice(PRInt32& aErrorCode, nsCSSValue aValues[],
|
||||
const nsCSSProperty aPropIDs[], PRInt32 aNumIDs);
|
||||
|
@ -665,7 +665,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
haveBraces = PR_FALSE;
|
||||
}
|
||||
|
||||
nsICSSDeclaration* declaration =
|
||||
nsCSSDeclaration* declaration =
|
||||
ParseDeclarationBlock(errorCode, haveBraces);
|
||||
if (nsnull != declaration) {
|
||||
// Create a style rule for the delcaration
|
||||
|
@ -673,7 +673,6 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
NS_NewCSSStyleRule(&rule, nsCSSSelector());
|
||||
rule->SetDeclaration(declaration);
|
||||
*aResult = rule;
|
||||
NS_RELEASE(declaration);
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
|
@ -687,7 +686,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
|||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint)
|
||||
{
|
||||
|
@ -792,7 +791,7 @@ NS_IMETHODIMP
|
|||
CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint)
|
||||
{
|
||||
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
|
||||
|
@ -1446,7 +1445,7 @@ PRBool CSSParserImpl::ParseRuleSet(PRInt32& aErrorCode, RuleAppendFunc aAppendFu
|
|||
CLEAR_ERROR();
|
||||
|
||||
// Next parse the declaration block
|
||||
nsICSSDeclaration* declaration = ParseDeclarationBlock(aErrorCode, PR_TRUE);
|
||||
nsCSSDeclaration* declaration = ParseDeclarationBlock(aErrorCode, PR_TRUE);
|
||||
if (nsnull == declaration) {
|
||||
// XXX skip something here
|
||||
delete slist;
|
||||
|
@ -1487,7 +1486,6 @@ PRBool CSSParserImpl::ParseRuleSet(PRInt32& aErrorCode, RuleAppendFunc aAppendFu
|
|||
|
||||
// Release temporary storage
|
||||
delete slist;
|
||||
NS_RELEASE(declaration);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2387,7 +2385,7 @@ PRBool CSSParserImpl::ParseSelector(PRInt32& aErrorCode,
|
|||
return PRBool(0 != dataMask);
|
||||
}
|
||||
|
||||
nsICSSDeclaration*
|
||||
nsCSSDeclaration*
|
||||
CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
||||
PRBool aCheckForBraces)
|
||||
{
|
||||
|
@ -2398,7 +2396,7 @@ CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
|||
return nsnull;
|
||||
}
|
||||
}
|
||||
nsICSSDeclaration* declaration = nsnull;
|
||||
nsCSSDeclaration* declaration = nsnull;
|
||||
if (NS_OK == NS_NewCSSDeclaration(&declaration)) {
|
||||
PRInt32 count = 0;
|
||||
PRBool dropDeclaration = PR_FALSE;
|
||||
|
@ -2423,7 +2421,10 @@ CSSParserImpl::ParseDeclarationBlock(PRInt32& aErrorCode,
|
|||
}
|
||||
if (dropDeclaration ||
|
||||
(0 == count)) { // didn't get any XXX is this ok with the DOM?
|
||||
NS_RELEASE(declaration);
|
||||
if (nsnull != declaration) {
|
||||
declaration->RuleAbort();
|
||||
declaration = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
return declaration;
|
||||
|
@ -2601,7 +2602,7 @@ PRBool CSSParserImpl::ParseOutlinerPseudoElement(PRInt32& aErrorCode,
|
|||
|
||||
PRBool
|
||||
CSSParserImpl::ParseDeclaration(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aCheckForBraces,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3329,7 +3330,7 @@ done:
|
|||
return found;
|
||||
}
|
||||
|
||||
nsresult CSSParserImpl::AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
nsresult CSSParserImpl::AppendValue(nsCSSDeclaration* aDeclaration, nsCSSProperty aPropID,
|
||||
const nsCSSValue& aValue, PRInt32& aChangeHint)
|
||||
{
|
||||
nsresult result;
|
||||
|
@ -3351,7 +3352,7 @@ nsresult CSSParserImpl::AppendValue(nsICSSDeclaration* aDeclaration, nsCSSProper
|
|||
* existing values.
|
||||
*/
|
||||
PRBool CSSParserImpl::ParseBoxProperties(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[],
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3399,7 +3400,7 @@ PRBool CSSParserImpl::ParseBoxProperties(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseProperty(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
|
@ -3955,7 +3956,7 @@ PRBool CSSParserImpl::ParseAzimuth(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue appearance;
|
||||
|
@ -3970,7 +3971,7 @@ PRBool CSSParserImpl::ParseAppearance(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 6;
|
||||
|
@ -4110,7 +4111,7 @@ PRBool CSSParserImpl::ParseBackground(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBackgroundPosition(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
// First try a number or a length value
|
||||
|
@ -4232,7 +4233,7 @@ static const nsCSSProperty kOutlineRadiusIDs[] = {
|
|||
eCSSProperty__moz_outline_radius_bottomLeft
|
||||
};
|
||||
|
||||
PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4271,13 +4272,13 @@ PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDecla
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderColor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderColor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderColorIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue xValue;
|
||||
|
@ -4307,7 +4308,7 @@ PRBool CSSParserImpl::ParseBorderSpacing(PRInt32& aErrorCode, nsICSSDeclaration*
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
const nsCSSProperty aPropIDs[], PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4335,33 +4336,33 @@ PRBool CSSParserImpl::ParseBorderSide(PRInt32& aErrorCode, nsICSSDeclaration* aD
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderStyleIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderWidth(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderWidthIDs, aChangeHint);
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kBorderRadiusIDs, aChangeHint);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
return ParseBoxProperties(aErrorCode, aDeclaration, kOutlineRadiusIDs, aChangeHint);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint, nsCSSProperty aProperty)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4395,7 +4396,7 @@ PRBool CSSParserImpl::ParseBorderColors(PRInt32& aErrorCode, nsICSSDeclaration*
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kClipIDs[] = {
|
||||
|
@ -4466,7 +4467,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclara
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kImageRegionIDs[] = {
|
||||
|
@ -4536,7 +4537,7 @@ PRBool CSSParserImpl::ParseImageRegion(PRInt32& aErrorCode, nsICSSDeclaration* a
|
|||
|
||||
#define VARIANT_CONTENT (VARIANT_STRING | VARIANT_URL | VARIANT_COUNTER | VARIANT_ATTR | \
|
||||
VARIANT_KEYWORD)
|
||||
PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4584,7 +4585,7 @@ PRBool CSSParserImpl::ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
nsCSSProperty aPropID, PRInt32& aChangeHint)
|
||||
{
|
||||
nsString* ident = NextIdent(aErrorCode);
|
||||
|
@ -4664,7 +4665,7 @@ PRBool CSSParserImpl::ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* a
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue before;
|
||||
|
@ -4689,7 +4690,7 @@ PRBool CSSParserImpl::ParseCue(PRInt32& aErrorCode, nsICSSDeclaration* aDeclarat
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
@ -4741,7 +4742,7 @@ PRBool CSSParserImpl::ParseCursor(PRInt32& aErrorCode, nsICSSDeclaration* aDecla
|
|||
}
|
||||
|
||||
|
||||
PRBool CSSParserImpl::ParseFont(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseFont(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty fontIDs[] = {
|
||||
|
@ -4927,7 +4928,7 @@ PRBool CSSParserImpl::ParseFamily(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -4961,7 +4962,7 @@ PRBool CSSParserImpl::ParseListStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDe
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseMargin(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseMargin(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kMarginSideIDs[] = {
|
||||
|
@ -4992,7 +4993,7 @@ PRBool CSSParserImpl::ParseMarks(PRInt32& aErrorCode, nsCSSValue& aValue)
|
|||
}
|
||||
|
||||
#ifdef ENABLE_OUTLINE
|
||||
PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
const PRInt32 numProps = 3;
|
||||
|
@ -5027,7 +5028,7 @@ PRBool CSSParserImpl::ParseOutline(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
}
|
||||
#endif
|
||||
|
||||
PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
static const nsCSSProperty kPaddingSideIDs[] = {
|
||||
|
@ -5040,7 +5041,7 @@ PRBool CSSParserImpl::ParsePadding(PRInt32& aErrorCode, nsICSSDeclaration* aDecl
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParsePause(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint)
|
||||
nsCSSDeclaration* aDeclaration, PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue before;
|
||||
if (ParseSingleValueProperty(aErrorCode, before, eCSSProperty_pause_before)) {
|
||||
|
@ -5065,7 +5066,7 @@ PRBool CSSParserImpl::ParsePause(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParsePlayDuring(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue playDuring;
|
||||
|
@ -5089,7 +5090,7 @@ PRBool CSSParserImpl::ParsePlayDuring(PRInt32& aErrorCode,
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseQuotes(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32 &aChangeHint)
|
||||
{
|
||||
nsCSSValue open;
|
||||
|
@ -5136,7 +5137,7 @@ PRBool CSSParserImpl::ParseQuotes(PRInt32& aErrorCode,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseSize(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration,
|
||||
PRBool CSSParserImpl::ParseSize(PRInt32& aErrorCode, nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue width;
|
||||
|
@ -5184,7 +5185,7 @@ PRBool CSSParserImpl::ParseTextDecoration(PRInt32& aErrorCode, nsCSSValue& aValu
|
|||
}
|
||||
|
||||
PRBool CSSParserImpl::ParseTextShadow(PRInt32& aErrorCode,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32& aChangeHint)
|
||||
{
|
||||
nsCSSValue value;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,663 @@
|
|||
/* -*- 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.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):
|
||||
*
|
||||
*
|
||||
* 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 nsCSSDeclaration_h___
|
||||
#define nsCSSDeclaration_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include <stdio.h>
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsValueArray.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
class nsStringArray;
|
||||
|
||||
struct nsCSSStruct {
|
||||
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
|
||||
};
|
||||
|
||||
|
||||
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_FONT_SID \
|
||||
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_COLOR_SID \
|
||||
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_TEXT_SID \
|
||||
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_DISPLAY_SID \
|
||||
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_MARGIN_SID \
|
||||
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_POSITION_SID \
|
||||
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
|
||||
#define NS_CSS_LIST_SID \
|
||||
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
|
||||
|
||||
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_TABLE_SID \
|
||||
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_BREAKS_SID \
|
||||
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_PAGE_SID \
|
||||
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_CONTENT_SID \
|
||||
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
|
||||
#define NS_CSS_USER_INTERFACE_SID \
|
||||
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
|
||||
#define NS_CSS_AURAL_SID \
|
||||
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
|
||||
#define NS_CSS_XUL_SID \
|
||||
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// {9A41A036-027B-45ef-89C9-6E32797839E7}
|
||||
#define NS_CSS_SVG_SID \
|
||||
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
|
||||
#endif
|
||||
|
||||
struct nsCSSFont : public nsCSSStruct {
|
||||
nsCSSFont(void);
|
||||
nsCSSFont(const nsCSSFont& aCopy);
|
||||
~nsCSSFont(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFamily;
|
||||
nsCSSValue mStyle;
|
||||
nsCSSValue mVariant;
|
||||
nsCSSValue mWeight;
|
||||
nsCSSValue mSize;
|
||||
nsCSSValue mSizeAdjust; // NEW
|
||||
nsCSSValue mStretch; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSValueList {
|
||||
nsCSSValueList(void);
|
||||
nsCSSValueList(const nsCSSValueList& aCopy);
|
||||
~nsCSSValueList(void);
|
||||
|
||||
nsCSSValue mValue;
|
||||
nsCSSValueList* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSColor : public nsCSSStruct {
|
||||
nsCSSColor(void);
|
||||
nsCSSColor(const nsCSSColor& aCopy);
|
||||
~nsCSSColor(void);
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mBackColor;
|
||||
nsCSSValue mBackImage;
|
||||
nsCSSValue mBackRepeat;
|
||||
nsCSSValue mBackAttachment;
|
||||
nsCSSValue mBackPositionX;
|
||||
nsCSSValue mBackPositionY;
|
||||
};
|
||||
|
||||
struct nsCSSShadow {
|
||||
nsCSSShadow(void);
|
||||
nsCSSShadow(const nsCSSShadow& aCopy);
|
||||
~nsCSSShadow(void);
|
||||
|
||||
nsCSSValue mColor;
|
||||
nsCSSValue mXOffset;
|
||||
nsCSSValue mYOffset;
|
||||
nsCSSValue mRadius;
|
||||
nsCSSShadow* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSText : public nsCSSStruct {
|
||||
nsCSSText(void);
|
||||
nsCSSText(const nsCSSText& aCopy);
|
||||
~nsCSSText(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWordSpacing;
|
||||
nsCSSValue mLetterSpacing;
|
||||
nsCSSValue mVerticalAlign;
|
||||
nsCSSValue mTextTransform;
|
||||
nsCSSValue mTextAlign;
|
||||
nsCSSValue mTextIndent;
|
||||
nsCSSValue mDecoration;
|
||||
nsCSSShadow* mTextShadow; // NEW
|
||||
nsCSSValue mUnicodeBidi; // NEW
|
||||
nsCSSValue mLineHeight;
|
||||
nsCSSValue mWhiteSpace;
|
||||
};
|
||||
|
||||
struct nsCSSRect {
|
||||
nsCSSRect(void);
|
||||
nsCSSRect(const nsCSSRect& aCopy);
|
||||
~nsCSSRect();
|
||||
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
|
||||
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
|
||||
|
||||
nsCSSValue mTop;
|
||||
nsCSSValue mRight;
|
||||
nsCSSValue mBottom;
|
||||
nsCSSValue mLeft;
|
||||
};
|
||||
|
||||
struct nsCSSDisplay : public nsCSSStruct {
|
||||
nsCSSDisplay(void);
|
||||
nsCSSDisplay(const nsCSSDisplay& aCopy);
|
||||
~nsCSSDisplay(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mDirection;
|
||||
nsCSSValue mDisplay;
|
||||
nsCSSValue mBinding;
|
||||
nsCSSValue mAppearance;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSValue mFloat;
|
||||
nsCSSValue mClear;
|
||||
nsCSSRect* mClip;
|
||||
nsCSSValue mOverflow;
|
||||
nsCSSValue mVisibility;
|
||||
nsCSSValue mOpacity;
|
||||
// mLang member variable is here not because in needs to be stored
|
||||
// in nsCSSDeclaration objects but because it's needed on the
|
||||
// stack when the struct is used in WalkRuleTree.
|
||||
nsCSSValue mLang;
|
||||
};
|
||||
|
||||
struct nsCSSMargin : public nsCSSStruct {
|
||||
nsCSSMargin(void);
|
||||
nsCSSMargin(const nsCSSMargin& aCopy);
|
||||
~nsCSSMargin(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void EnsureBorderColors();
|
||||
|
||||
nsCSSRect* mMargin;
|
||||
nsCSSRect* mPadding;
|
||||
nsCSSRect* mBorderWidth;
|
||||
nsCSSRect* mBorderColor;
|
||||
nsCSSValueList** mBorderColors;
|
||||
nsCSSRect* mBorderStyle;
|
||||
nsCSSRect* mBorderRadius; // (extension)
|
||||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSRect* mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
||||
struct nsCSSPosition : public nsCSSStruct {
|
||||
nsCSSPosition(void);
|
||||
nsCSSPosition(const nsCSSPosition& aCopy);
|
||||
~nsCSSPosition(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mWidth;
|
||||
nsCSSValue mMinWidth;
|
||||
nsCSSValue mMaxWidth;
|
||||
nsCSSValue mHeight;
|
||||
nsCSSValue mMinHeight;
|
||||
nsCSSValue mMaxHeight;
|
||||
nsCSSValue mBoxSizing; // NEW
|
||||
nsCSSRect* mOffset;
|
||||
nsCSSValue mZIndex;
|
||||
};
|
||||
|
||||
struct nsCSSList : public nsCSSStruct {
|
||||
nsCSSList(void);
|
||||
nsCSSList(const nsCSSList& aCopy);
|
||||
~nsCSSList(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mType;
|
||||
nsCSSValue mImage;
|
||||
nsCSSValue mPosition;
|
||||
nsCSSRect* mImageRegion;
|
||||
};
|
||||
|
||||
struct nsCSSTable : public nsCSSStruct { // NEW
|
||||
nsCSSTable(void);
|
||||
nsCSSTable(const nsCSSTable& aCopy);
|
||||
~nsCSSTable(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBorderCollapse;
|
||||
nsCSSValue mBorderSpacingX;
|
||||
nsCSSValue mBorderSpacingY;
|
||||
nsCSSValue mCaptionSide;
|
||||
nsCSSValue mEmptyCells;
|
||||
|
||||
nsCSSValue mLayout;
|
||||
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
|
||||
};
|
||||
|
||||
struct nsCSSBreaks : public nsCSSStruct { // NEW
|
||||
nsCSSBreaks(void);
|
||||
nsCSSBreaks(const nsCSSBreaks& aCopy);
|
||||
~nsCSSBreaks(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mOrphans;
|
||||
nsCSSValue mWidows;
|
||||
nsCSSValue mPage;
|
||||
nsCSSValue mPageBreakAfter;
|
||||
nsCSSValue mPageBreakBefore;
|
||||
nsCSSValue mPageBreakInside;
|
||||
};
|
||||
|
||||
struct nsCSSPage : public nsCSSStruct { // NEW
|
||||
nsCSSPage(void);
|
||||
nsCSSPage(const nsCSSPage& aCopy);
|
||||
~nsCSSPage(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mMarks;
|
||||
nsCSSValue mSizeWidth;
|
||||
nsCSSValue mSizeHeight;
|
||||
};
|
||||
|
||||
struct nsCSSCounterData {
|
||||
nsCSSCounterData(void);
|
||||
nsCSSCounterData(const nsCSSCounterData& aCopy);
|
||||
~nsCSSCounterData(void);
|
||||
|
||||
nsCSSValue mCounter;
|
||||
nsCSSValue mValue;
|
||||
nsCSSCounterData* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSQuotes {
|
||||
nsCSSQuotes(void);
|
||||
nsCSSQuotes(const nsCSSQuotes& aCopy);
|
||||
~nsCSSQuotes(void);
|
||||
|
||||
nsCSSValue mOpen;
|
||||
nsCSSValue mClose;
|
||||
nsCSSQuotes* mNext;
|
||||
};
|
||||
|
||||
struct nsCSSContent : public nsCSSStruct {
|
||||
nsCSSContent(void);
|
||||
nsCSSContent(const nsCSSContent& aCopy);
|
||||
~nsCSSContent(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValueList* mContent;
|
||||
nsCSSCounterData* mCounterIncrement;
|
||||
nsCSSCounterData* mCounterReset;
|
||||
nsCSSValue mMarkerOffset;
|
||||
nsCSSQuotes* mQuotes;
|
||||
};
|
||||
|
||||
struct nsCSSUserInterface : public nsCSSStruct { // NEW
|
||||
nsCSSUserInterface(void);
|
||||
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
|
||||
~nsCSSUserInterface(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mUserInput;
|
||||
nsCSSValue mUserModify;
|
||||
nsCSSValue mUserSelect;
|
||||
nsCSSValueList* mKeyEquivalent;
|
||||
nsCSSValue mUserFocus;
|
||||
nsCSSValue mResizer;
|
||||
|
||||
nsCSSValueList* mCursor;
|
||||
};
|
||||
|
||||
struct nsCSSAural : public nsCSSStruct { // NEW
|
||||
nsCSSAural(void);
|
||||
nsCSSAural(const nsCSSAural& aCopy);
|
||||
~nsCSSAural(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mAzimuth;
|
||||
nsCSSValue mElevation;
|
||||
nsCSSValue mCueAfter;
|
||||
nsCSSValue mCueBefore;
|
||||
nsCSSValue mPauseAfter;
|
||||
nsCSSValue mPauseBefore;
|
||||
nsCSSValue mPitch;
|
||||
nsCSSValue mPitchRange;
|
||||
nsCSSValue mPlayDuring;
|
||||
nsCSSValue mPlayDuringFlags;
|
||||
nsCSSValue mRichness;
|
||||
nsCSSValue mSpeak;
|
||||
nsCSSValue mSpeakHeader;
|
||||
nsCSSValue mSpeakNumeral;
|
||||
nsCSSValue mSpeakPunctuation;
|
||||
nsCSSValue mSpeechRate;
|
||||
nsCSSValue mStress;
|
||||
nsCSSValue mVoiceFamily;
|
||||
nsCSSValue mVolume;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
struct nsCSSXUL : public nsCSSStruct {
|
||||
nsCSSXUL(void);
|
||||
nsCSSXUL(const nsCSSXUL& aCopy);
|
||||
~nsCSSXUL(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mBoxAlign;
|
||||
nsCSSValue mBoxDirection;
|
||||
nsCSSValue mBoxFlex;
|
||||
nsCSSValue mBoxOrient;
|
||||
nsCSSValue mBoxPack;
|
||||
nsCSSValue mBoxOrdinal;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
struct nsCSSSVG : public nsCSSStruct {
|
||||
nsCSSSVG(void);
|
||||
nsCSSSVG(const nsCSSSVG& aCopy);
|
||||
~nsCSSSVG(void);
|
||||
|
||||
const nsID& GetID(void);
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsCSSValue mFill;
|
||||
nsCSSValue mFillOpacity;
|
||||
nsCSSValue mFillRule;
|
||||
nsCSSValue mStroke;
|
||||
nsCSSValue mStrokeDasharray;
|
||||
nsCSSValue mStrokeDashoffset;
|
||||
nsCSSValue mStrokeLinecap;
|
||||
nsCSSValue mStrokeLinejoin;
|
||||
nsCSSValue mStrokeMiterlimit;
|
||||
nsCSSValue mStrokeOpacity;
|
||||
nsCSSValue mStrokeWidth;
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some useful types.
|
||||
//
|
||||
typedef PRUint16 nsCSSBitField;
|
||||
typedef PRUint16 nsCSSDeclRefCount;
|
||||
struct nsCSSDeclContains
|
||||
{
|
||||
nsCSSBitField mHasDisplay:1; // 1
|
||||
nsCSSBitField mHasText:1; // 2
|
||||
nsCSSBitField mHasColor:1; // 3
|
||||
nsCSSBitField mHasMargin:1; // 4
|
||||
nsCSSBitField mHasList:1; // 4
|
||||
nsCSSBitField mHasFont:1; // 5
|
||||
nsCSSBitField mHasPosition:1; // 6
|
||||
nsCSSBitField mHasUserInterface:1; // 8
|
||||
nsCSSBitField mHasTable:1; // 9
|
||||
nsCSSBitField mHasContent:1; // 10
|
||||
#if defined(INCLUDE_XUL)
|
||||
nsCSSBitField mHasXUL:1; // 11
|
||||
#endif
|
||||
nsCSSBitField mHasBreaks:1; // 12
|
||||
nsCSSBitField mHasPage:1; // 13
|
||||
nsCSSBitField mHasAural:1; // 14
|
||||
#if defined(MOZ_SVG)
|
||||
nsCSSBitField mHasSVG:1; // 15
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Macros used to figure out at what index the pointer to the object is.
|
||||
// These macros have been placed in the order of what is considered most
|
||||
// created nsCSSStruct first, such that "less math for most likely" will
|
||||
// lend itself to the speed of the index lookup calculation.
|
||||
// I have also ordered the bit fields, in case the compiler can come up
|
||||
// with an optimization if the ordering would matter.
|
||||
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
|
||||
//
|
||||
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
|
||||
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
|
||||
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
|
||||
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
|
||||
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
|
||||
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
|
||||
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
|
||||
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
|
||||
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
|
||||
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
|
||||
#if defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
|
||||
#endif
|
||||
#if !defined(INCLUDE_XUL)
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_Content(decl))
|
||||
#else
|
||||
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
|
||||
#endif
|
||||
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
|
||||
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
|
||||
#if defined(MOZ_SVG)
|
||||
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
|
||||
#endif
|
||||
|
||||
// --- nsCSSDeclaration -----------------
|
||||
|
||||
class nsCSSDeclaration {
|
||||
public:
|
||||
nsCSSDeclaration(void);
|
||||
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
|
||||
|
||||
public:
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
|
||||
nsCSSStruct* GetData(const nsID& aSID);
|
||||
nsCSSStruct* EnsureData(const nsID& aSID);
|
||||
|
||||
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
|
||||
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
|
||||
nsresult SetValueImportant(nsCSSProperty aProperty);
|
||||
nsresult AppendComment(const nsAReadableString& aComment);
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
|
||||
nsresult GetValue(nsCSSProperty aProperty, nsAWritableString& aValue);
|
||||
nsresult GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue);
|
||||
|
||||
nsCSSDeclaration* GetImportantValues();
|
||||
PRBool GetValueIsImportant(nsCSSProperty aProperty);
|
||||
PRBool GetValueIsImportant(const nsAReadableString& aProperty);
|
||||
|
||||
PRUint32 Count();
|
||||
nsresult GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn);
|
||||
|
||||
PRInt32 GetStyleImpact() const;
|
||||
|
||||
nsresult ToString(nsAWritableString& aString);
|
||||
|
||||
nsCSSDeclaration* Clone() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsresult RemoveProperty(nsCSSProperty aProperty);
|
||||
|
||||
private:
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult);
|
||||
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult);
|
||||
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
|
||||
PRBool operator==(const nsCSSDeclaration& aCopy) const;
|
||||
|
||||
void TryBorderShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBorderTopWidth,
|
||||
PRInt32 & aBorderTopStyle,
|
||||
PRInt32 & aBorderTopColor,
|
||||
PRInt32 & aBorderBottomWidth,
|
||||
PRInt32 & aBorderBottomStyle,
|
||||
PRInt32 & aBorderBottomColor,
|
||||
PRInt32 & aBorderLeftWidth,
|
||||
PRInt32 & aBorderLeftStyle,
|
||||
PRInt32 & aBorderLeftColor,
|
||||
PRInt32 & aBorderRightWidth,
|
||||
PRInt32 & aBorderRightStyle,
|
||||
PRInt32 & aBorderRightColor);
|
||||
void TryBorderSideShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aBorderWidth,
|
||||
PRInt32 & aBorderStyle,
|
||||
PRInt32 & aBorderColor);
|
||||
void TryMarginOrPaddingShorthand(nsAWritableString & aString,
|
||||
nsCSSProperty aShorthand,
|
||||
PRInt32 & aTop, PRInt32 & aBottom,
|
||||
PRInt32 & aLeft, PRInt32 & aRight);
|
||||
void TryBackgroundShorthand(nsAWritableString & aString,
|
||||
PRInt32 & aBgColor, PRInt32 & aBgImage,
|
||||
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
void TryBackgroundPosition(nsAWritableString & aString,
|
||||
PRInt32 & aBgPositionX,
|
||||
PRInt32 & aBgPositionY);
|
||||
|
||||
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
|
||||
PRInt32 aThird, PRInt32 aFourth);
|
||||
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
|
||||
nsAWritableString& aResult);
|
||||
|
||||
protected:
|
||||
//
|
||||
// Specialized ref counting.
|
||||
// We do not want everyone to ref count us, only the rules which hold
|
||||
// onto us (our well defined lifetime is when the last rule releases
|
||||
// us).
|
||||
// It's worth a comment here that the main nsCSSDeclaration is refcounted,
|
||||
// but it's |mImportant| is not refcounted, but just owned by the
|
||||
// non-important declaration.
|
||||
//
|
||||
friend class CSSStyleRuleImpl;
|
||||
void AddRef(void) {
|
||||
NS_ASSERTION(0 <= mRuleRefs, "bad AddRef");
|
||||
mRuleRefs++;
|
||||
}
|
||||
void Release(void) {
|
||||
NS_ASSERTION(0 < mRuleRefs, "bad Release");
|
||||
if (0 == --mRuleRefs) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
public:
|
||||
void RuleAbort(void) {
|
||||
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
|
||||
delete this;
|
||||
}
|
||||
protected:
|
||||
//
|
||||
// Block everyone, except us or a derivitive, from deleting us.
|
||||
//
|
||||
~nsCSSDeclaration(void);
|
||||
|
||||
|
||||
private:
|
||||
nsValueArray* mOrder;
|
||||
nsCSSDeclaration* mImportant;
|
||||
nsSmallVoidArray mStructs;
|
||||
|
||||
//
|
||||
// Keep these two together, as they should pack.
|
||||
//
|
||||
nsCSSDeclRefCount mRuleRefs;
|
||||
nsCSSDeclContains mContains;
|
||||
};
|
||||
|
||||
|
||||
extern NS_EXPORT nsresult
|
||||
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif /* nsCSSDeclaration_h___ */
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsCSSRule.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsICSSGroupRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsICSSLoader.h"
|
||||
|
@ -861,30 +861,30 @@ nsresult nsCSSSelector::ToString( nsAWritableString& aString, nsICSSStyleSheet*
|
|||
// -- CSSImportantRule -------------------------------
|
||||
|
||||
// New map helpers shared by both important and regular rules.
|
||||
static nsresult MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont);
|
||||
static nsresult MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
|
||||
static nsresult MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
|
||||
static nsresult MapMarginForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
|
||||
static nsresult MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList);
|
||||
static nsresult MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition);
|
||||
static nsresult MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
|
||||
static nsresult MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
|
||||
static nsresult MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
|
||||
static nsresult MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
|
||||
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont);
|
||||
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
|
||||
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
|
||||
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
|
||||
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList);
|
||||
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition);
|
||||
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
|
||||
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
|
||||
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
|
||||
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
static nsresult MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL);
|
||||
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
static nsresult MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG);
|
||||
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG);
|
||||
#endif
|
||||
|
||||
class CSSStyleRuleImpl;
|
||||
|
||||
class CSSImportantRule : public nsIStyleRule {
|
||||
public:
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsICSSDeclaration* aDeclaration);
|
||||
CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -908,23 +908,22 @@ public:
|
|||
protected:
|
||||
virtual ~CSSImportantRule(void);
|
||||
|
||||
nsICSSDeclaration* mDeclaration;
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
nsICSSStyleSheet* mSheet;
|
||||
|
||||
friend class CSSStyleRuleImpl;
|
||||
};
|
||||
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsICSSDeclaration* aDeclaration)
|
||||
CSSImportantRule::CSSImportantRule(nsICSSStyleSheet* aSheet, nsCSSDeclaration* aDeclaration)
|
||||
: mDeclaration(aDeclaration),
|
||||
mSheet(aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_IF_ADDREF(mDeclaration);
|
||||
}
|
||||
|
||||
CSSImportantRule::~CSSImportantRule(void)
|
||||
{
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CSSImportantRule, nsIStyleRule)
|
||||
|
@ -1073,9 +1072,9 @@ public:
|
|||
nsAWritableString& aReturn);
|
||||
|
||||
virtual void DropReference(void);
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl);
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsICSSStyleRule* aRule,
|
||||
nsICSSStyleSheet** aSheet,
|
||||
nsIDocument** aDocument,
|
||||
|
@ -1115,8 +1114,8 @@ DOMCSSDeclarationImpl::RemoveProperty(const nsAReadableString& aPropertyName,
|
|||
{
|
||||
aReturn.Truncate();
|
||||
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && decl) {
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
|
@ -1145,7 +1144,7 @@ DOMCSSDeclarationImpl::DropReference(void)
|
|||
}
|
||||
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
DOMCSSDeclarationImpl::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate)
|
||||
{
|
||||
if (nsnull != mRule) {
|
||||
|
@ -1159,7 +1158,7 @@ DOMCSSDeclarationImpl::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
}
|
||||
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::SetCSSDeclaration(nsICSSDeclaration *aDecl)
|
||||
DOMCSSDeclarationImpl::SetCSSDeclaration(nsCSSDeclaration *aDecl)
|
||||
{
|
||||
if (nsnull != mRule) {
|
||||
mRule->SetDeclaration(aDecl);
|
||||
|
@ -1215,8 +1214,8 @@ nsresult
|
|||
DOMCSSDeclarationImpl::ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
if (!decl) {
|
||||
return result;
|
||||
}
|
||||
|
@ -1262,8 +1261,8 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
PRBool aParseOnlyOneDecl,
|
||||
PRBool aClearOldDecl)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (decl) {
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
|
@ -1280,8 +1279,7 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
getter_AddRefs(cssParser));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsICSSDeclaration> declClone;
|
||||
decl->Clone(*getter_AddRefs(declClone));
|
||||
nsCSSDeclaration* declClone = decl->Clone();
|
||||
NS_ENSURE_TRUE(declClone, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (aClearOldDecl) {
|
||||
|
@ -1289,7 +1287,7 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
nsAutoString propName;
|
||||
PRUint32 count, i;
|
||||
|
||||
decl->Count(&count);
|
||||
count = decl->Count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
decl->GetNthProperty(0, propName);
|
||||
|
@ -1366,8 +1364,8 @@ public:
|
|||
virtual PRUint32 GetLineNumber(void) const;
|
||||
virtual void SetLineNumber(PRUint32 aLineNumber);
|
||||
|
||||
virtual nsICSSDeclaration* GetDeclaration(void) const;
|
||||
virtual void SetDeclaration(nsICSSDeclaration* aDeclaration);
|
||||
virtual nsCSSDeclaration* GetDeclaration(void) const;
|
||||
virtual void SetDeclaration(nsCSSDeclaration* aDeclaration);
|
||||
|
||||
virtual PRInt32 GetWeight(void) const;
|
||||
virtual void SetWeight(PRInt32 aWeight);
|
||||
|
@ -1406,7 +1404,7 @@ protected:
|
|||
|
||||
protected:
|
||||
nsCSSSelector mSelector;
|
||||
nsICSSDeclaration* mDeclaration;
|
||||
nsCSSDeclaration* mDeclaration;
|
||||
PRInt32 mWeight;
|
||||
CSSImportantRule* mImportantRule;
|
||||
DOMCSSDeclarationImpl* mDOMDeclaration;
|
||||
|
@ -1452,7 +1450,10 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
|
|||
}
|
||||
|
||||
if (aCopy.mDeclaration) {
|
||||
aCopy.mDeclaration->Clone(mDeclaration);
|
||||
mDeclaration = aCopy.mDeclaration->Clone();
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->AddRef();
|
||||
}
|
||||
}
|
||||
// rest is constructed lazily on existing data
|
||||
}
|
||||
|
@ -1472,10 +1473,14 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
|
|||
next = selector->mNext;
|
||||
delete selector;
|
||||
}
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->Release();
|
||||
mDeclaration = nsnull;
|
||||
}
|
||||
if (nsnull != mImportantRule) {
|
||||
mImportantRule->mSheet = nsnull;
|
||||
NS_RELEASE(mImportantRule);
|
||||
delete mImportantRule;
|
||||
mImportantRule = nsnull;
|
||||
}
|
||||
if (nsnull != mDOMDeclaration) {
|
||||
mDOMDeclaration->DropReference();
|
||||
|
@ -1619,20 +1624,21 @@ void CSSStyleRuleImpl::SetLineNumber(PRUint32 aLineNumber)
|
|||
mLineNumber = aLineNumber;
|
||||
}
|
||||
|
||||
nsICSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
nsCSSDeclaration* CSSStyleRuleImpl::GetDeclaration(void) const
|
||||
{
|
||||
nsICSSDeclaration* result = mDeclaration;
|
||||
NS_IF_ADDREF(result);
|
||||
nsCSSDeclaration* result = mDeclaration;
|
||||
return result;
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::SetDeclaration(nsICSSDeclaration* aDeclaration)
|
||||
void CSSStyleRuleImpl::SetDeclaration(nsCSSDeclaration* aDeclaration)
|
||||
{
|
||||
if (mDeclaration != aDeclaration) {
|
||||
NS_IF_RELEASE(mImportantRule);
|
||||
NS_IF_RELEASE(mDeclaration);
|
||||
if (nsnull != mDeclaration) {
|
||||
mDeclaration->Release();
|
||||
}
|
||||
mDeclaration = aDeclaration;
|
||||
NS_IF_ADDREF(mDeclaration);
|
||||
mDeclaration->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1649,12 +1655,10 @@ void CSSStyleRuleImpl::SetWeight(PRInt32 aWeight)
|
|||
nsIStyleRule* CSSStyleRuleImpl::GetImportantRule(void)
|
||||
{
|
||||
if ((nsnull == mImportantRule) && (nsnull != mDeclaration)) {
|
||||
nsICSSDeclaration* important;
|
||||
mDeclaration->GetImportantValues(important);
|
||||
nsCSSDeclaration* important = mDeclaration->GetImportantValues();
|
||||
if (nsnull != important) {
|
||||
mImportantRule = new CSSImportantRule(mSheet, important);
|
||||
NS_ADDREF(mImportantRule);
|
||||
NS_RELEASE(important);
|
||||
}
|
||||
}
|
||||
NS_IF_ADDREF(mImportantRule);
|
||||
|
@ -1740,13 +1744,12 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont)
|
||||
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSFont* ourFont;
|
||||
aDecl->GetData(kCSSFontSID, (nsCSSStruct**)&ourFont);
|
||||
nsCSSFont* ourFont = (nsCSSFont*)aDecl->GetData(kCSSFontSID);
|
||||
if (!ourFont)
|
||||
return NS_OK; // We don't have any rules for fonts.
|
||||
|
||||
|
@ -1773,13 +1776,12 @@ MapFontForDeclaration(nsICSSDeclaration* aDecl, nsCSSFont& aFont)
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
static nsresult
|
||||
MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
||||
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSXUL* ourXUL;
|
||||
aDecl->GetData(kCSSXULSID, (nsCSSStruct**)&ourXUL);
|
||||
nsCSSXUL* ourXUL = (nsCSSXUL*)aDecl->GetData(kCSSXULSID);
|
||||
if (!ourXUL)
|
||||
return NS_OK; // We don't have any rules for XUL.
|
||||
|
||||
|
@ -1813,13 +1815,12 @@ MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL)
|
|||
|
||||
#ifdef MOZ_SVG
|
||||
static nsresult
|
||||
MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
||||
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSSVG* ourSVG;
|
||||
aDecl->GetData(kCSSSVGSID, (nsCSSStruct**)&ourSVG);
|
||||
nsCSSSVG* ourSVG = (nsCSSSVG*)aDecl->GetData(kCSSSVGSID);
|
||||
if (!ourSVG)
|
||||
return NS_OK; // We don't have any rules for SVG.
|
||||
|
||||
|
@ -1863,13 +1864,12 @@ MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG)
|
|||
|
||||
|
||||
static nsresult
|
||||
MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
||||
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSPosition* ourPosition;
|
||||
aDecl->GetData(kCSSPositionSID, (nsCSSStruct**)&ourPosition);
|
||||
nsCSSPosition* ourPosition = (nsCSSPosition*)aDecl->GetData(kCSSPositionSID);
|
||||
if (!ourPosition)
|
||||
return NS_OK; // We don't have any rules for position.
|
||||
|
||||
|
@ -1916,13 +1916,12 @@ MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList)
|
||||
MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSList* ourList;
|
||||
aDecl->GetData(kCSSListSID, (nsCSSStruct**)&ourList);
|
||||
nsCSSList* ourList = (nsCSSList*)aDecl->GetData(kCSSListSID);
|
||||
if (!ourList)
|
||||
return NS_OK; // We don't have any rules for lists.
|
||||
|
||||
|
@ -1961,10 +1960,9 @@ MapListForDeclaration(nsICSSDeclaration* aDecl, nsCSSList& aList)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapMarginForDeclaration(nsICSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
|
||||
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
|
||||
{
|
||||
nsCSSMargin* ourMargin;
|
||||
aDeclaration->GetData(kCSSMarginSID, (nsCSSStruct**)&ourMargin);
|
||||
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
|
||||
if (!ourMargin)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2106,13 +2104,12 @@ MapMarginForDeclaration(nsICSSDeclaration* aDeclaration, const nsStyleStructID&
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
|
||||
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK;
|
||||
|
||||
nsCSSColor* ourColor;
|
||||
aDecl->GetData(kCSSColorSID, (nsCSSStruct**)&ourColor);
|
||||
nsCSSColor* ourColor = (nsCSSColor*)aDecl->GetData(kCSSColorSID);
|
||||
if (!ourColor)
|
||||
return NS_OK; // No rules for color or background.
|
||||
|
||||
|
@ -2149,13 +2146,12 @@ MapColorForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsC
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
|
||||
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSTable* ourTable;
|
||||
aDecl->GetData(kCSSTableSID, (nsCSSStruct**)&ourTable);
|
||||
nsCSSTable* ourTable = (nsCSSTable*)aDecl->GetData(kCSSTableSID);
|
||||
if (!ourTable)
|
||||
return NS_OK; // We don't have any rules for tables.
|
||||
|
||||
|
@ -2190,13 +2186,12 @@ MapTableForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsC
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
|
||||
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSContent* ourContent;
|
||||
aDecl->GetData(kCSSContentSID, (nsCSSStruct**)&ourContent);
|
||||
nsCSSContent* ourContent = (nsCSSContent*)aDecl->GetData(kCSSContentSID);
|
||||
if (!ourContent)
|
||||
return NS_OK; // We don't have any rules for content.
|
||||
|
||||
|
@ -2222,13 +2217,12 @@ MapContentForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, n
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
|
||||
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSText* ourText;
|
||||
aDecl->GetData(kCSSTextSID, (nsCSSStruct**)&ourText);
|
||||
nsCSSText* ourText = (nsCSSText*)aDecl->GetData(kCSSTextSID);
|
||||
if (!ourText)
|
||||
return NS_OK; // We don't have any rules for text.
|
||||
|
||||
|
@ -2272,13 +2266,12 @@ MapTextForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
|
||||
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSDisplay* ourDisplay;
|
||||
aDecl->GetData(kCSSDisplaySID, (nsCSSStruct**)&ourDisplay);
|
||||
nsCSSDisplay* ourDisplay = (nsCSSDisplay*)aDecl->GetData(kCSSDisplaySID);
|
||||
if (!ourDisplay)
|
||||
return NS_OK; // We don't have any rules for display.
|
||||
|
||||
|
@ -2342,13 +2335,12 @@ MapDisplayForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, n
|
|||
}
|
||||
|
||||
static nsresult
|
||||
MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
|
||||
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
|
||||
{
|
||||
if (!aDecl)
|
||||
return NS_OK; // The rule must have a declaration.
|
||||
|
||||
nsCSSUserInterface* ourUI;
|
||||
aDecl->GetData(kCSSUserInterfaceSID, (nsCSSStruct**)&ourUI);
|
||||
nsCSSUserInterface* ourUI = (nsCSSUserInterface*)aDecl->GetData(kCSSUserInterfaceSID);
|
||||
if (!ourUI)
|
||||
return NS_OK; // We don't have any rules for UI.
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDOMCSSAttrDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
|
@ -47,7 +47,6 @@
|
|||
#include "nsINodeInfo.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
|
@ -72,8 +71,8 @@ NS_IMETHODIMP
|
|||
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyName,
|
||||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && decl && mContent) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
@ -86,8 +85,7 @@ nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyN
|
|||
nsHTMLAtoms::style);
|
||||
}
|
||||
|
||||
PRInt32 hint;
|
||||
decl->GetStyleImpact(&hint);
|
||||
PRInt32 hint = decl->GetStyleImpact();
|
||||
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
nsCSSValue val;
|
||||
|
@ -122,7 +120,7 @@ nsDOMCSSAttributeDeclaration::DropReference()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
|
@ -156,7 +154,8 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
NS_RELEASE(cssRule);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(*aDecl);
|
||||
(*aDecl)->RuleAbort();
|
||||
*aDecl = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsICSSDeclaration *aDecl)
|
||||
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsCSSDeclaration *aDecl)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
nsIStyleRule* rule;
|
||||
|
@ -245,8 +244,8 @@ nsresult
|
|||
nsDOMCSSAttributeDeclaration::ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (!decl) {
|
||||
return result;
|
||||
|
@ -295,8 +294,8 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
PRBool aParseOnlyOneDecl,
|
||||
PRBool aClearOldDecl)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsresult result = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
|
||||
|
||||
if (decl) {
|
||||
nsCOMPtr<nsICSSLoader> cssLoader;
|
||||
|
@ -321,15 +320,14 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
|
|||
doc->AttributeWillChange(mContent, kNameSpaceID_None,
|
||||
nsHTMLAtoms::style);
|
||||
}
|
||||
nsCOMPtr<nsICSSDeclaration> declClone;
|
||||
decl->Clone(*getter_AddRefs(declClone));
|
||||
nsCSSDeclaration* declClone = decl->Clone();
|
||||
|
||||
if (aClearOldDecl) {
|
||||
// This should be done with decl->Clear() once such a method exists.
|
||||
nsAutoString propName;
|
||||
PRUint32 count, i;
|
||||
|
||||
decl->Count(&count);
|
||||
count = decl->Count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
decl->GetNthProperty(0, propName);
|
||||
|
|
|
@ -59,9 +59,9 @@ public:
|
|||
nsAWritableString& aReturn);
|
||||
|
||||
virtual void DropReference();
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate);
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl);
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIContent* aContent,
|
||||
nsIURI** aBaseURI,
|
||||
nsICSSLoader** aCSSLoader,
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIDOMCSSRule.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -75,9 +75,9 @@ NS_IMPL_RELEASE(nsDOMCSSDeclaration);
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetCssText(nsAWritableString& aCssText)
|
||||
{
|
||||
nsCOMPtr<nsICSSDeclaration> decl;
|
||||
nsCSSDeclaration* decl;
|
||||
aCssText.Truncate();
|
||||
GetCSSDeclaration(getter_AddRefs(decl), PR_FALSE);
|
||||
GetCSSDeclaration(&decl, PR_FALSE);
|
||||
NS_ASSERTION(decl, "null CSSDeclaration");
|
||||
|
||||
if (decl) {
|
||||
|
@ -96,13 +96,12 @@ nsDOMCSSDeclaration::SetCssText(const nsAReadableString& aCssText)
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetLength(PRUint32* aLength)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
*aLength = 0;
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->Count(aLength);
|
||||
NS_RELEASE(decl);
|
||||
*aLength = decl->Count();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -140,13 +139,12 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
|
|||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAWritableString& aReturn)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.SetLength(0);
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetNthProperty(aIndex, aReturn);
|
||||
NS_RELEASE(decl);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -157,13 +155,12 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsAReadableString& aPropertyName,
|
|||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsCSSValue val;
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.SetLength(0);
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetValue(aPropertyName, aReturn);
|
||||
NS_RELEASE(decl);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -173,13 +170,12 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::GetPropertyPriority(const nsAReadableString& aPropertyName,
|
||||
nsAWritableString& aReturn)
|
||||
{
|
||||
nsICSSDeclaration *decl;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
PRBool isImportant = PR_FALSE;
|
||||
|
||||
if ((NS_OK == result) && (nsnull != decl)) {
|
||||
result = decl->GetValueIsImportant(aPropertyName, isImportant);
|
||||
NS_RELEASE(decl);
|
||||
isImportant = decl->GetValueIsImportant(aPropertyName);
|
||||
}
|
||||
|
||||
if ((NS_OK == result) && isImportant) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMCSS2Properties.h"
|
||||
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSParser;
|
||||
class nsIURI;
|
||||
|
||||
|
@ -77,10 +77,10 @@ public:
|
|||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
virtual void DropReference() = 0;
|
||||
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
|
||||
PRBool aAllocate) = 0;
|
||||
// Note! This will only set the declaration if a style rule already exists
|
||||
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl) = 0;
|
||||
virtual nsresult SetCSSDeclaration(nsCSSDeclaration *aDecl) = 0;
|
||||
|
||||
virtual nsresult ParsePropertyValue(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue) = 0;
|
||||
|
|
|
@ -44,7 +44,7 @@ class nsIStyleRule;
|
|||
class nsICSSStyleSheet;
|
||||
class nsIUnicharInputStream;
|
||||
class nsIURI;
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSLoader;
|
||||
class nsICSSRule;
|
||||
class nsISupportsArray;
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRBool aParseOnlyOneDecl,
|
||||
PRInt32* aHint) = 0;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
NS_IMETHOD ParseProperty(const nsAReadableString& aPropName,
|
||||
const nsAReadableString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsICSSDeclaration* aDeclaration,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
PRInt32* aHint) = 0;
|
||||
|
||||
// Charset management method:
|
||||
|
|
|
@ -47,7 +47,7 @@ class nsISizeOfHandler;
|
|||
|
||||
class nsIAtom;
|
||||
class nsIArena;
|
||||
class nsICSSDeclaration;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSStyleSheet;
|
||||
|
||||
struct nsAtomList {
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
virtual PRUint32 GetLineNumber(void) const = 0;
|
||||
virtual void SetLineNumber(PRUint32 aLineNumber) = 0;
|
||||
|
||||
virtual nsICSSDeclaration* GetDeclaration(void) const = 0;
|
||||
virtual void SetDeclaration(nsICSSDeclaration* aDeclaration) = 0;
|
||||
virtual nsCSSDeclaration* GetDeclaration(void) const = 0;
|
||||
virtual void SetDeclaration(nsCSSDeclaration* aDeclaration) = 0;
|
||||
|
||||
virtual PRInt32 GetWeight(void) const = 0;
|
||||
virtual void SetWeight(PRInt32 aWeight) = 0;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
|
||||
class nsIStyleContext;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsVoidBTree.h"
|
||||
#include "nsValueArray.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsFileSpec.h"
|
||||
//#include "nsIBuffer.h"
|
||||
|
@ -115,6 +116,7 @@ void XXXNeverCalled()
|
|||
nsVoidArray();
|
||||
nsSmallVoidArray();
|
||||
nsVoidBTree();
|
||||
nsValueArray(0);
|
||||
nsAVLTree(dummy, nsnull);
|
||||
nsSupportsArray();
|
||||
NS_GetNumberOfAtoms();
|
||||
|
|
|
@ -70,6 +70,7 @@ CPPSRCS = \
|
|||
nsVoidBTree.cpp \
|
||||
nsTextFormatter.cpp \
|
||||
nsTimelineService.cpp \
|
||||
nsValueArray.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
@ -102,6 +103,7 @@ EXPORTS = \
|
|||
pldhash.h \
|
||||
plvector.h \
|
||||
nsTextFormatter.h \
|
||||
nsValueArray.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
|
|
@ -56,6 +56,7 @@ EXPORTS = \
|
|||
nsVector.h \
|
||||
nsVoidArray.h \
|
||||
nsVoidBTree.h \
|
||||
nsValueArray.h \
|
||||
pldhash.h \
|
||||
plvector.h \
|
||||
$(NULL)
|
||||
|
@ -120,6 +121,7 @@ CPP_OBJS = \
|
|||
.\$(OBJDIR)\nsVariant.obj \
|
||||
.\$(OBJDIR)\nsVoidArray.obj \
|
||||
.\$(OBJDIR)\nsVoidBTree.obj \
|
||||
.\$(OBJDIR)\nsValueArray.obj \
|
||||
.\$(OBJDIR)\pldhash.obj \
|
||||
.\$(OBJDIR)\plvector.obj \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,299 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 oqr
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is nsValueArray.h/nsValueArray.cpp code, released
|
||||
* Dec 28, 2001.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garrett Arch Blythe, 20-December-2001
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsValueArray.cpp
|
||||
//
|
||||
// Implement an array class to store unsigned integer values.
|
||||
// The maximum value must be known up front. Once known, the
|
||||
// smallest memory representation will be attempted; i.e. if the
|
||||
// maximum value was 1275, then 2 bytes (uint16) would represent each value
|
||||
// in the array instead of 4 bytes (uint32).
|
||||
//
|
||||
#include "nsValueArray.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prmem.h"
|
||||
#include "prbit.h"
|
||||
|
||||
#define NSVALUEARRAY_LINEAR_GROWBY 8
|
||||
#define NSVALUEARRAY_LINEAR_THRESHOLD 128
|
||||
|
||||
nsValueArray::nsValueArray(nsValueArrayValue aMaxValue, nsValueArrayCount aInitialCapacity) {
|
||||
mCount = 0;
|
||||
mCapacity = 0;
|
||||
mValueArray = nsnull;
|
||||
|
||||
PRUint8 test8 = (PRUint8)aMaxValue;
|
||||
PRUint16 test16 = (PRUint16)aMaxValue;
|
||||
PRUint32 test32 = (PRUint32)aMaxValue;
|
||||
if ((nsValueArrayValue)test8 == aMaxValue) {
|
||||
mBytesPerValue = sizeof(test8);
|
||||
}
|
||||
else if ((nsValueArrayValue)test16 == aMaxValue) {
|
||||
mBytesPerValue = sizeof(test16);
|
||||
}
|
||||
else if ((nsValueArrayValue)test32 == aMaxValue) {
|
||||
mBytesPerValue = sizeof(test32);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(0, "not supported yet, add it yourself...");
|
||||
mBytesPerValue = 0;
|
||||
}
|
||||
|
||||
if (aInitialCapacity) {
|
||||
mValueArray = (PRUint8*)PR_Malloc(aInitialCapacity * mBytesPerValue);
|
||||
if (nsnull != mValueArray) {
|
||||
mCapacity = aInitialCapacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsValueArray::~nsValueArray() {
|
||||
if (nsnull != mValueArray) {
|
||||
PR_Free(mValueArray);
|
||||
mValueArray = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Copy it.
|
||||
//
|
||||
nsValueArray& nsValueArray::operator=(const nsValueArray& aOther) {
|
||||
//
|
||||
// Free off what you know if not enough space, or units differ.
|
||||
//
|
||||
if ((mBytesPerValue != aOther.mBytesPerValue || mCapacity < aOther.mCount) && nsnull != mValueArray) {
|
||||
PR_Free(mValueArray);
|
||||
mValueArray = nsnull;
|
||||
mCount = mCapacity = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy some attribs.
|
||||
//
|
||||
mBytesPerValue = aOther.mBytesPerValue;
|
||||
mCount = aOther.mCount;
|
||||
|
||||
//
|
||||
// Anything to do?
|
||||
//
|
||||
if (0 != mCount) {
|
||||
//
|
||||
// May need to allocate our buffer.
|
||||
//
|
||||
if (0 == mCapacity) {
|
||||
mValueArray = (PRUint8*)PR_Malloc(mCount * mBytesPerValue);
|
||||
mCapacity = mCount;
|
||||
}
|
||||
|
||||
NS_ASSERTION(nsnull != mValueArray, "loss of value array assignment and original data.");
|
||||
if (nsnull != mValueArray) {
|
||||
nsCRT::memcpy(mValueArray, aOther.mValueArray, mCount * mBytesPerValue);
|
||||
}
|
||||
else {
|
||||
mCount = mCapacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert a value into the array.
|
||||
// No validity checking other than index is done.
|
||||
//
|
||||
PRBool nsValueArray::InsertValueAt(nsValueArrayValue aValue, nsValueArrayIndex aIndex) {
|
||||
PRBool retval = PR_FALSE;
|
||||
|
||||
nsValueArrayCount count = Count();
|
||||
if (aIndex <= count) {
|
||||
//
|
||||
// If we're at capacity, then we'll need to grow a little.
|
||||
//
|
||||
if (Capacity() == count) {
|
||||
PRUint8* reallocRes = nsnull;
|
||||
nsValueArrayCount growBy = NSVALUEARRAY_LINEAR_GROWBY;
|
||||
|
||||
//
|
||||
// Up to a particular limit we grow in small increments.
|
||||
// Otherwise, grow exponentially.
|
||||
//
|
||||
if (count >= NSVALUEARRAY_LINEAR_THRESHOLD) {
|
||||
growBy = PR_BIT(PR_CeilingLog2(count + 1)) - count;
|
||||
}
|
||||
|
||||
if (nsnull == mValueArray) {
|
||||
reallocRes = (PRUint8*)PR_Malloc((count + growBy) * mBytesPerValue);
|
||||
}
|
||||
else {
|
||||
reallocRes = (PRUint8*)PR_Realloc(mValueArray, (count + growBy) * mBytesPerValue);
|
||||
}
|
||||
if (nsnull != reallocRes) {
|
||||
mValueArray = reallocRes;
|
||||
mCapacity += growBy;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Only if we are below capacity do we continue.
|
||||
//
|
||||
if (Capacity() > count) {
|
||||
//
|
||||
// All those at and beyond the insertion point need to move.
|
||||
//
|
||||
if (aIndex < count) {
|
||||
nsCRT::memmove(&mValueArray[(aIndex + 1) * mBytesPerValue], &mValueArray[aIndex * mBytesPerValue], (count - aIndex) * mBytesPerValue);
|
||||
}
|
||||
|
||||
//
|
||||
// Do the assignment.
|
||||
//
|
||||
switch (mBytesPerValue) {
|
||||
case sizeof(PRUint8):
|
||||
*((PRUint8*)&mValueArray[aIndex * mBytesPerValue]) = (PRUint8)aValue;
|
||||
NS_ASSERTION(*((PRUint8*)&mValueArray[aIndex * mBytesPerValue]) == aValue, "Lossy value array detected. Report a higher maximum upon construction!");
|
||||
break;
|
||||
case sizeof(PRUint16):
|
||||
*((PRUint16*)&mValueArray[aIndex * mBytesPerValue]) = (PRUint16)aValue;
|
||||
NS_ASSERTION(*((PRUint16*)&mValueArray[aIndex * mBytesPerValue]) == aValue, "Lossy value array detected. Report a higher maximum upon construction!");
|
||||
break;
|
||||
case sizeof(PRUint32):
|
||||
*((PRUint32*)&mValueArray[aIndex * mBytesPerValue]) = (PRUint32)aValue;
|
||||
NS_ASSERTION(*((PRUint32*)&mValueArray[aIndex * mBytesPerValue]) == aValue, "Lossy value array detected. Report a higher maximum upon construction!");
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "surely you've been warned prior to this!");
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Up the count by 1.
|
||||
//
|
||||
mCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove the index from the value array.
|
||||
// The array does not shrink until Compact() is invoked.
|
||||
//
|
||||
PRBool nsValueArray::RemoveValueAt(nsValueArrayIndex aIndex) {
|
||||
PRBool retval = PR_FALSE;
|
||||
|
||||
nsValueArrayCount count = Count();
|
||||
if (aIndex < count) {
|
||||
//
|
||||
// Move memory around if appropriate.
|
||||
//
|
||||
if (aIndex != (count - 1)) {
|
||||
nsCRT::memmove(&mValueArray[aIndex * mBytesPerValue], &mValueArray[(aIndex + 1) * mBytesPerValue], (count - aIndex - 1) * mBytesPerValue);
|
||||
}
|
||||
|
||||
//
|
||||
// Update our count.
|
||||
//
|
||||
mCount--;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//
|
||||
// Shrink as much as possible.
|
||||
//
|
||||
void nsValueArray::Compact() {
|
||||
nsValueArrayCount count = Count();
|
||||
if (Capacity() != count)
|
||||
{
|
||||
if (0 == count) {
|
||||
PR_Free(mValueArray);
|
||||
mValueArray = nsnull;
|
||||
mCapacity = 0;
|
||||
}
|
||||
else {
|
||||
PRUint8* reallocRes = (PRUint8*)PR_Realloc(mValueArray, count * mBytesPerValue);
|
||||
if (nsnull != reallocRes) {
|
||||
mValueArray = reallocRes;
|
||||
mCapacity = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the value at the index.
|
||||
//
|
||||
nsValueArrayValue nsValueArray::ValueAt(nsValueArrayIndex aIndex) const {
|
||||
nsValueArrayValue retval = NSVALUEARRAY_INVALID;
|
||||
|
||||
if (aIndex < Count()) {
|
||||
switch (mBytesPerValue) {
|
||||
case sizeof(PRUint8):
|
||||
retval = (nsValueArrayIndex)*((PRUint8*)&mValueArray[aIndex * mBytesPerValue]);
|
||||
break;
|
||||
case sizeof(PRUint16):
|
||||
retval = (nsValueArrayIndex)*((PRUint16*)&mValueArray[aIndex * mBytesPerValue]);
|
||||
break;
|
||||
case sizeof(PRUint32):
|
||||
retval = (nsValueArrayIndex)*((PRUint32*)&mValueArray[aIndex * mBytesPerValue]);
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "unexpected for sure.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the first encountered index of the value.
|
||||
//
|
||||
nsValueArrayIndex nsValueArray::IndexOf(nsValueArrayValue aPossibleValue) const {
|
||||
nsValueArrayIndex retval = NSVALUEARRAY_INVALID;
|
||||
nsValueArrayIndex traverse;
|
||||
|
||||
for (traverse = 0; traverse < Count(); traverse++) {
|
||||
if (aPossibleValue == ValueAt(traverse)) {
|
||||
retval = traverse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 oqr
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is nsValueArray.h/nsValueArray.cpp code, released
|
||||
* Dec 28, 2001.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garrett Arch Blythe, 20-December-2001
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the MPL or the GPL.
|
||||
*/
|
||||
#ifndef nsValueArray_h___
|
||||
#define nsValueArray_h___
|
||||
|
||||
//
|
||||
// nsValueArray.h
|
||||
//
|
||||
// Implement an array class to store unsigned integer values.
|
||||
// The maximum value must be known up front. Once known, the
|
||||
// smallest memory representation will be attempted; i.e. if the
|
||||
// maximum value was 1275, then 2 bytes (uint16) would represent each value
|
||||
// in the array instead of 4 bytes (uint32).
|
||||
//
|
||||
#include "nscore.h"
|
||||
|
||||
typedef PRUint32 nsValueArrayCount;
|
||||
typedef PRUint32 nsValueArrayIndex;
|
||||
typedef PRUint32 nsValueArrayValue;
|
||||
#define NSVALUEARRAY_INVALID ((nsValueArrayValue)-1)
|
||||
|
||||
class NS_COM nsValueArray {
|
||||
public:
|
||||
nsValueArray(nsValueArrayValue aMaxValue,
|
||||
nsValueArrayCount aInitialCapacity = 0);
|
||||
~nsValueArray();
|
||||
|
||||
//
|
||||
// Assignment.
|
||||
//
|
||||
public:
|
||||
nsValueArray& operator=(const nsValueArray& other);
|
||||
|
||||
//
|
||||
// Array size information.
|
||||
// Ability to add more values without growing is Capacity - Count.
|
||||
//
|
||||
public:
|
||||
inline nsValueArrayCount Count() const {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
inline nsValueArrayCount Capacity() const {
|
||||
return mCapacity;
|
||||
}
|
||||
|
||||
void Compact();
|
||||
|
||||
//
|
||||
// Array access.
|
||||
//
|
||||
public:
|
||||
nsValueArrayValue ValueAt(nsValueArrayIndex aIndex) const;
|
||||
|
||||
inline nsValueArrayValue operator[](nsValueArrayIndex aIndex) const {
|
||||
return ValueAt(aIndex);
|
||||
}
|
||||
|
||||
nsValueArrayIndex IndexOf(nsValueArrayValue aPossibleValue) const;
|
||||
|
||||
inline PRBool AppendValue(nsValueArrayValue aValue) {
|
||||
return InsertValueAt(aValue, Count());
|
||||
}
|
||||
|
||||
inline PRBool RemoveValue(nsValueArrayValue aValue) {
|
||||
return RemoveValueAt(IndexOf(aValue));
|
||||
}
|
||||
|
||||
PRBool InsertValueAt(nsValueArrayValue aValue, nsValueArrayIndex aIndex);
|
||||
|
||||
PRBool RemoveValueAt(nsValueArrayIndex aIndex);
|
||||
|
||||
//
|
||||
// Data members.
|
||||
//
|
||||
private:
|
||||
nsValueArrayCount mCount;
|
||||
nsValueArrayCount mCapacity;
|
||||
PRUint8* mValueArray;
|
||||
PRUint8 mBytesPerValue;
|
||||
};
|
||||
|
||||
#endif /* nsValueArray_h___ */
|
|
@ -333,17 +333,23 @@ private:
|
|||
|
||||
// XXX we're really re-implementing the whole nsVoidArray interface here -
|
||||
// some form of abstract class would be useful
|
||||
|
||||
// I disagree on the abstraction here. If the point of this class is to be
|
||||
// as small as possible, and no one will ever derive from it, as I found
|
||||
// today, there should not be any virtualness to it to avoid the vtable
|
||||
// ptr overhead.
|
||||
|
||||
class NS_COM nsSmallVoidArray
|
||||
{
|
||||
public:
|
||||
nsSmallVoidArray();
|
||||
virtual ~nsSmallVoidArray();
|
||||
~nsSmallVoidArray();
|
||||
|
||||
nsSmallVoidArray& operator=(nsSmallVoidArray& other);
|
||||
void* operator[](PRInt32 aIndex) const { return ElementAt(aIndex); }
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
|
||||
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
|
||||
#endif
|
||||
PRInt32 GetArraySize() const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче