1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* 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/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* 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.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-14 00:24:54 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
#ifndef nsIStyleContext_h___
|
|
|
|
#define nsIStyleContext_h___
|
|
|
|
|
|
|
|
#include "nslayout.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsColor.h"
|
|
|
|
#include "nsCoord.h"
|
|
|
|
#include "nsMargin.h"
|
2000-04-25 08:43:11 +04:00
|
|
|
#include "nsRect.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsFont.h"
|
1998-12-18 01:58:23 +03:00
|
|
|
#include "nsVoidArray.h"
|
1998-04-29 03:54:06 +04:00
|
|
|
#include "nsStyleCoord.h"
|
1998-05-21 06:34:13 +04:00
|
|
|
#include "nsStyleStruct.h"
|
1998-10-10 00:54:22 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2000-06-22 00:44:59 +04:00
|
|
|
#include "nsIStyleSet.h"
|
2000-05-06 01:04:36 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsILanguageAtom.h"
|
1998-04-29 03:54:06 +04:00
|
|
|
|
2000-03-31 11:08:36 +04:00
|
|
|
class nsISizeOfHandler;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsISupportsArray;
|
|
|
|
|
1998-05-13 02:21:03 +04:00
|
|
|
|
2000-06-22 00:44:59 +04:00
|
|
|
#define SHARE_STYLECONTEXTS
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// The lifetime of these objects is managed by the nsIStyleContext.
|
|
|
|
|
|
|
|
struct nsStyleFont : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleFont(void);
|
|
|
|
~nsStyleFont(void);
|
|
|
|
|
1998-07-17 09:41:02 +04:00
|
|
|
nsFont mFont; // [inherited]
|
|
|
|
nsFont mFixedFont; // [inherited]
|
1998-07-23 21:55:02 +04:00
|
|
|
PRUint8 mFlags; // [inherited] See nsStyleConsts.h
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
protected:
|
1998-07-17 09:41:02 +04:00
|
|
|
nsStyleFont(const nsFont& aVariableFont, const nsFont& aFixedFont);
|
1999-11-24 09:03:41 +03:00
|
|
|
nsStyleFont(nsIPresContext* aPresContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleColor : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleColor(void);
|
|
|
|
~nsStyleColor(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
nscolor mColor; // [inherited]
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mBackgroundAttachment; // [reset] See nsStyleConsts.h
|
|
|
|
PRUint8 mBackgroundFlags; // [reset] See nsStyleConsts.h
|
|
|
|
PRUint8 mBackgroundRepeat; // [reset] See nsStyleConsts.h
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
nscolor mBackgroundColor; // [reset]
|
|
|
|
nscoord mBackgroundXPosition; // [reset]
|
|
|
|
nscoord mBackgroundYPosition; // [reset]
|
|
|
|
nsString mBackgroundImage; // [reset] absolute url string
|
1998-04-25 22:32:11 +04:00
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mCursor; // [reset] See nsStyleConsts.h NS_STYLE_CURSOR_*
|
|
|
|
nsString mCursorImage; // [reset] url string
|
1999-03-28 08:28:22 +04:00
|
|
|
float mOpacity; // [inherited] percentage
|
1998-04-25 22:32:11 +04:00
|
|
|
|
1999-01-08 04:13:34 +03:00
|
|
|
PRBool BackgroundIsTransparent() const {return (mBackgroundFlags &
|
|
|
|
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) ==
|
|
|
|
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE);}
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-04-21 04:02:44 +04:00
|
|
|
struct nsStyleSpacing: public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleSpacing(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
nsStyleSides mMargin; // [reset] length, percent, auto, inherit
|
|
|
|
nsStyleSides mPadding; // [reset] length, percent, inherit
|
1999-04-03 07:15:24 +04:00
|
|
|
nsStyleSides mBorder; // [reset] length, enum (see nsStyleConsts.h)
|
1998-12-07 21:44:02 +03:00
|
|
|
|
1999-12-22 14:27:10 +03:00
|
|
|
nsStyleSides mBorderRadius; // [reset] length, percent, inherit
|
2000-01-24 14:19:55 +03:00
|
|
|
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
|
1999-12-22 14:27:10 +03:00
|
|
|
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
|
1999-03-28 08:28:22 +04:00
|
|
|
|
|
|
|
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
|
1998-05-13 02:21:03 +04:00
|
|
|
|
1999-07-24 22:59:43 +04:00
|
|
|
PRUint8 mFloatEdge; // [reset] see nsStyleConsts.h
|
|
|
|
|
1998-10-13 05:05:52 +04:00
|
|
|
PRBool GetMargin(nsMargin& aMargin) const;
|
|
|
|
PRBool GetPadding(nsMargin& aPadding) const;
|
|
|
|
PRBool GetBorder(nsMargin& aBorder) const;
|
|
|
|
PRBool GetBorderPadding(nsMargin& aBorderPadding) const;
|
|
|
|
|
1998-12-07 21:44:02 +03:00
|
|
|
PRUint8 GetBorderStyle(PRUint8 aSide) const;
|
|
|
|
void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle);
|
1999-03-28 08:28:22 +04:00
|
|
|
PRBool GetBorderColor(PRUint8 aSide, nscolor& aColor) const; // PR_FALSE means TRANSPARENT
|
1998-12-07 21:44:02 +03:00
|
|
|
void SetBorderColor(PRUint8 aSide, nscolor aColor);
|
1999-03-28 08:28:22 +04:00
|
|
|
void SetBorderTransparent(PRUint8 aSide);
|
|
|
|
void UnsetBorderColor(PRUint8 aSide);
|
1998-12-07 21:44:02 +03:00
|
|
|
|
1999-03-28 08:28:22 +04:00
|
|
|
PRBool GetOutlineWidth(nscoord& aWidth) const; // PR_TRUE if pre-computed
|
|
|
|
PRUint8 GetOutlineStyle(void) const;
|
|
|
|
void SetOutlineStyle(PRUint8 aStyle);
|
|
|
|
PRBool GetOutlineColor(nscolor& aColor) const; // PR_FALSE means INVERT
|
|
|
|
void SetOutlineColor(nscolor aColor);
|
|
|
|
void SetOutlineInvert(void);
|
1998-12-07 21:44:02 +03:00
|
|
|
|
1998-10-13 05:05:52 +04:00
|
|
|
// XXX these are deprecated methods
|
1998-05-13 02:21:03 +04:00
|
|
|
void CalcMarginFor(const nsIFrame* aFrame, nsMargin& aMargin) const;
|
|
|
|
void CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) const;
|
|
|
|
void CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const;
|
|
|
|
void CalcBorderPaddingFor(const nsIFrame* aFrame, nsMargin& aBorderPadding) const;
|
1998-04-25 22:32:11 +04:00
|
|
|
|
1998-04-21 04:02:44 +04:00
|
|
|
protected:
|
2000-06-22 00:44:59 +04:00
|
|
|
PRPackedBool mHasCachedMargin;
|
|
|
|
PRPackedBool mHasCachedPadding;
|
|
|
|
PRPackedBool mHasCachedBorder;
|
|
|
|
PRPackedBool mHasCachedOutline;
|
1998-05-13 02:21:03 +04:00
|
|
|
nsMargin mCachedMargin;
|
|
|
|
nsMargin mCachedPadding;
|
|
|
|
nsMargin mCachedBorder;
|
|
|
|
nsMargin mCachedBorderPadding;
|
2000-06-22 00:44:59 +04:00
|
|
|
nscoord mCachedOutlineWidth;
|
1998-12-07 21:44:02 +03:00
|
|
|
|
1999-03-28 08:28:22 +04:00
|
|
|
PRUint8 mBorderStyle[4]; // [reset] See nsStyleConsts.h
|
|
|
|
nscolor mBorderColor[4]; // [reset]
|
|
|
|
PRUint8 mOutlineStyle; // [reset] See nsStyleConsts.h
|
|
|
|
nscolor mOutlineColor; // [reset]
|
1998-04-21 04:02:44 +04:00
|
|
|
};
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
struct nsStyleList : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleList(void);
|
|
|
|
~nsStyleList(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
|
|
|
|
PRUint8 mListStylePosition; // [inherited]
|
|
|
|
nsString mListStyleImage; // [inherited] absolute url string
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-04-23 03:29:01 +04:00
|
|
|
struct nsStylePosition : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStylePosition(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mPosition; // [reset] see nsStyleConsts.h
|
1998-04-28 07:21:18 +04:00
|
|
|
|
1999-01-08 07:47:46 +03:00
|
|
|
nsStyleSides mOffset; // [reset]
|
1998-11-06 03:48:14 +03:00
|
|
|
nsStyleCoord mWidth; // [reset] coord, percent, auto, inherit
|
|
|
|
nsStyleCoord mMinWidth; // [reset] coord, percent, inherit
|
|
|
|
nsStyleCoord mMaxWidth; // [reset] coord, percent, null, inherit
|
|
|
|
nsStyleCoord mHeight; // [reset] coord, percent, auto, inherit
|
|
|
|
nsStyleCoord mMinHeight; // [reset] coord, percent, inherit
|
|
|
|
nsStyleCoord mMaxHeight; // [reset] coord, percent, null, inherit
|
1999-07-24 22:59:43 +04:00
|
|
|
PRUint8 mBoxSizing; // [reset] see nsStyleConsts.h
|
1998-04-28 07:21:18 +04:00
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
nsStyleCoord mZIndex; // [reset]
|
1998-04-25 22:32:11 +04:00
|
|
|
|
1999-01-27 08:35:54 +03:00
|
|
|
PRBool IsAbsolutelyPositioned() const {return (NS_STYLE_POSITION_ABSOLUTE == mPosition) ||
|
|
|
|
(NS_STYLE_POSITION_FIXED == mPosition);}
|
2000-04-25 08:43:11 +04:00
|
|
|
|
|
|
|
PRBool IsPositioned() const {return IsAbsolutelyPositioned() ||
|
|
|
|
(NS_STYLE_POSITION_RELATIVE == mPosition);}
|
1998-04-23 03:29:01 +04:00
|
|
|
};
|
|
|
|
|
1998-04-25 22:32:11 +04:00
|
|
|
struct nsStyleText : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleText(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mTextAlign; // [inherited] see nsStyleConsts.h
|
|
|
|
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
|
|
|
|
PRUint8 mTextTransform; // [inherited] see nsStyleConsts.h
|
|
|
|
PRUint8 mWhiteSpace; // [inherited] see nsStyleConsts.h
|
1998-04-28 01:19:45 +04:00
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
nsStyleCoord mLetterSpacing; // [inherited]
|
|
|
|
nsStyleCoord mLineHeight; // [inherited]
|
|
|
|
nsStyleCoord mTextIndent; // [inherited]
|
|
|
|
nsStyleCoord mWordSpacing; // [inherited]
|
|
|
|
nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums
|
1998-04-25 22:32:11 +04:00
|
|
|
|
1999-08-28 01:39:50 +04:00
|
|
|
PRBool WhiteSpaceIsSignificant() const {
|
1999-04-28 02:07:02 +04:00
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE;
|
|
|
|
}
|
1998-04-25 22:32:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleDisplay : public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleDisplay(void);
|
|
|
|
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
|
|
|
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
|
|
|
PRUint8 mFloats; // [reset] see nsStyleConsts.h NS_STYLE_FLOAT_*
|
|
|
|
PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
|
|
|
|
PRPackedBool mBreakBefore; // [reset]
|
|
|
|
PRPackedBool mBreakAfter; // [reset]
|
1999-02-02 06:24:23 +03:00
|
|
|
PRUint8 mVisible; // [inherited]
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mOverflow; // [reset] see nsStyleConsts.h
|
|
|
|
|
|
|
|
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
|
2000-04-25 08:43:11 +04:00
|
|
|
#if 0
|
|
|
|
// XXX This is how it is defined in the CSS2 spec, but the errata
|
|
|
|
// changed it to be consistent with the positioning draft and how
|
|
|
|
// Nav and IE implement it
|
1998-05-27 03:12:14 +04:00
|
|
|
nsMargin mClip; // [reset] offsets from respective edge
|
2000-04-25 08:43:11 +04:00
|
|
|
#else
|
|
|
|
nsRect mClip; // [reset] offsets from upper-left border edge
|
|
|
|
#endif
|
2000-05-06 01:04:36 +04:00
|
|
|
nsCOMPtr<nsILanguageAtom> mLanguage; // [inherited]
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-10-10 00:54:22 +04:00
|
|
|
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
|
|
|
|
(NS_STYLE_DISPLAY_LIST_ITEM == mDisplay) ||
|
|
|
|
(NS_STYLE_DISPLAY_TABLE == mDisplay);}
|
|
|
|
|
1999-02-26 20:02:05 +03:00
|
|
|
PRBool IsFloating() const {
|
|
|
|
return NS_STYLE_FLOAT_NONE != mFloats;
|
|
|
|
}
|
2000-03-17 13:15:13 +03:00
|
|
|
|
|
|
|
PRBool IsVisible() const {
|
|
|
|
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsVisibleOrCollapsed() const {
|
|
|
|
return ((mVisible == NS_STYLE_VISIBILITY_VISIBLE) ||
|
|
|
|
(mVisible == NS_STYLE_VISIBILITY_COLLAPSE));
|
|
|
|
}
|
1998-05-13 02:21:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleTable: public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleTable(void);
|
|
|
|
|
1998-09-25 05:48:22 +04:00
|
|
|
PRUint8 mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
|
1998-05-27 03:12:14 +04:00
|
|
|
PRUint8 mFrame; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_FRAME_*
|
|
|
|
PRUint8 mRules; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_RULES_*
|
1999-04-02 22:48:55 +04:00
|
|
|
PRUint8 mBorderCollapse;// [inherited]
|
|
|
|
nsStyleCoord mBorderSpacingX;// [inherited]
|
|
|
|
nsStyleCoord mBorderSpacingY;// [inherited]
|
1998-05-27 03:12:14 +04:00
|
|
|
nsStyleCoord mCellPadding; // [reset]
|
1999-04-02 22:48:55 +04:00
|
|
|
PRUint8 mCaptionSide; // [inherited]
|
|
|
|
PRUint8 mEmptyCells; // [inherited]
|
1998-09-25 05:48:22 +04:00
|
|
|
PRInt32 mCols; // [reset] an integer if set, or see nsStyleConsts.h NS_STYLE_TABLE_COLS_*
|
1998-11-12 21:37:28 +03:00
|
|
|
PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col
|
1998-12-09 09:24:27 +03:00
|
|
|
nsStyleCoord mSpanWidth; // [reset] the amount of width this col gets from a spanning cell, if any
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1999-04-02 22:48:55 +04:00
|
|
|
enum nsStyleContentType {
|
|
|
|
eStyleContentType_String = 1,
|
|
|
|
eStyleContentType_URL = 10,
|
|
|
|
eStyleContentType_Attr = 20,
|
|
|
|
eStyleContentType_Counter = 30,
|
|
|
|
eStyleContentType_Counters = 31,
|
|
|
|
eStyleContentType_OpenQuote = 40,
|
|
|
|
eStyleContentType_CloseQuote = 41,
|
|
|
|
eStyleContentType_NoOpenQuote = 42,
|
|
|
|
eStyleContentType_NoCloseQuote = 43
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleContentData {
|
|
|
|
nsStyleContentType mType;
|
|
|
|
nsString mContent;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleCounterData {
|
|
|
|
nsString mCounter;
|
|
|
|
PRInt32 mValue;
|
|
|
|
};
|
|
|
|
|
1999-03-28 08:28:22 +04:00
|
|
|
struct nsStyleContent: public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleContent(void);
|
|
|
|
~nsStyleContent(void);
|
|
|
|
|
1999-04-02 22:48:55 +04:00
|
|
|
PRUint32 ContentCount(void) const { return mContentCount; } // [reset]
|
|
|
|
nsresult GetContentAt(PRUint32 aIndex, nsStyleContentType& aType, nsString& aContent) const;
|
|
|
|
nsresult AllocateContents(PRUint32 aCount);
|
|
|
|
nsresult SetContentAt(PRUint32 aIndex, nsStyleContentType aType, const nsString& aContent);
|
|
|
|
|
|
|
|
PRUint32 CounterIncrementCount(void) const { return mIncrementCount; } // [reset]
|
|
|
|
nsresult GetCounterIncrementAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aIncrement) const;
|
|
|
|
nsresult AllocateCounterIncrements(PRUint32 aCount);
|
|
|
|
nsresult SetCounterIncrementAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aIncrement);
|
|
|
|
|
|
|
|
PRUint32 CounterResetCount(void) const { return mResetCount; } // [reset]
|
|
|
|
nsresult GetCounterResetAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aValue) const;
|
|
|
|
nsresult AllocateCounterResets(PRUint32 aCount);
|
|
|
|
nsresult SetCounterResetAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aValue);
|
|
|
|
|
|
|
|
nsStyleCoord mMarkerOffset; // [reset]
|
|
|
|
|
|
|
|
PRUint32 QuotesCount(void) const { return mQuotesCount; } // [inherited]
|
|
|
|
nsresult GetQuotesAt(PRUint32 aIndex, nsString& aOpen, nsString& aClose) const;
|
|
|
|
nsresult AllocateQuotes(PRUint32 aCount);
|
|
|
|
nsresult SetQuotesAt(PRUint32 aIndex, const nsString& aOpen, const nsString& aClose);
|
1999-03-28 08:28:22 +04:00
|
|
|
|
|
|
|
protected:
|
1999-04-02 22:48:55 +04:00
|
|
|
PRUint32 mContentCount;
|
|
|
|
nsStyleContentData* mContents;
|
|
|
|
|
|
|
|
PRUint32 mIncrementCount;
|
|
|
|
nsStyleCounterData* mIncrements;
|
|
|
|
|
|
|
|
PRUint32 mResetCount;
|
|
|
|
nsStyleCounterData* mResets;
|
|
|
|
|
|
|
|
PRUint32 mQuotesCount;
|
|
|
|
nsString* mQuotes;
|
1999-03-28 08:28:22 +04:00
|
|
|
};
|
|
|
|
|
1999-07-24 22:59:43 +04:00
|
|
|
struct nsStyleUserInterface: public nsStyleStruct {
|
1999-10-16 08:05:59 +04:00
|
|
|
nsStyleUserInterface(void);
|
|
|
|
|
1999-07-24 22:59:43 +04:00
|
|
|
PRUint8 mUserInput; // [inherited]
|
1999-09-04 03:33:06 +04:00
|
|
|
PRUint8 mUserModify; // [inherited] (modify-content)
|
|
|
|
PRUint8 mUserSelect; // [reset] (selection-style)
|
|
|
|
PRUint8 mUserFocus; // [inherited] (auto-select)
|
1999-07-24 22:59:43 +04:00
|
|
|
PRUnichar mKeyEquivalent; // [reset] XXX what type should this be?
|
|
|
|
PRUint8 mResizer; // [reset]
|
2000-01-11 06:40:41 +03:00
|
|
|
nsString mBehavior; // [reset] absolute url string
|
|
|
|
|
1999-07-24 22:59:43 +04:00
|
|
|
};
|
|
|
|
|
1999-12-22 08:00:47 +03:00
|
|
|
struct nsStylePrint: public nsStyleStruct {
|
|
|
|
nsStylePrint(void);
|
|
|
|
|
|
|
|
PRUint8 mPageBreakBefore; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
|
|
|
PRUint8 mPageBreakAfter; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
|
|
|
PRUint8 mPageBreakInside; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
|
|
|
nsString mPage;
|
|
|
|
PRUint32 mWidows; // [reset] = 2, number of isolated lines at the top of a page
|
|
|
|
PRUint32 mOrphans; // [reset] = 2, number of isolated lines at the bottom of a page
|
|
|
|
PRUint8 mMarks; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_MARKS_*
|
|
|
|
nsStyleCoord mSizeWidth; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
|
|
|
nsStyleCoord mSizeHeight; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
|
|
|
};
|
|
|
|
|
1998-12-21 09:35:45 +03:00
|
|
|
#define BORDER_PRECEDENT_EQUAL 0
|
|
|
|
#define BORDER_PRECEDENT_LOWER 1
|
1998-12-18 01:58:23 +03:00
|
|
|
#define BORDER_PRECEDENT_HIGHER 2
|
|
|
|
|
1998-12-30 09:46:35 +03:00
|
|
|
struct nsBorderEdges;
|
1998-12-18 01:58:23 +03:00
|
|
|
|
|
|
|
/** an encapsulation of border edge info */
|
|
|
|
struct nsBorderEdge
|
|
|
|
{
|
1998-12-30 09:46:35 +03:00
|
|
|
/** the thickness of the edge */
|
1998-12-18 01:58:23 +03:00
|
|
|
nscoord mWidth;
|
1998-12-30 09:46:35 +03:00
|
|
|
/** the length of the edge */
|
1998-12-21 09:35:45 +03:00
|
|
|
nscoord mLength;
|
1998-12-18 01:58:23 +03:00
|
|
|
PRUint8 mStyle;
|
|
|
|
nscolor mColor;
|
1998-12-30 09:46:35 +03:00
|
|
|
/** which side does this edge represent? */
|
1998-12-18 01:58:23 +03:00
|
|
|
PRUint8 mSide;
|
1998-12-30 09:46:35 +03:00
|
|
|
/** if this edge is an outside edge, the border infor for the adjacent inside object */
|
|
|
|
nsBorderEdges * mInsideNeighbor;
|
1998-12-18 01:58:23 +03:00
|
|
|
|
|
|
|
nsBorderEdge();
|
|
|
|
};
|
|
|
|
|
|
|
|
inline nsBorderEdge::nsBorderEdge()
|
|
|
|
{
|
|
|
|
mWidth=0;
|
1998-12-21 09:35:45 +03:00
|
|
|
mLength=0;
|
1998-12-18 01:58:23 +03:00
|
|
|
mStyle=NS_STYLE_BORDER_STYLE_NONE;
|
|
|
|
mColor=0;
|
|
|
|
mSide=NS_SIDE_LEFT;
|
1998-12-30 09:46:35 +03:00
|
|
|
mInsideNeighbor = nsnull;
|
1998-12-18 01:58:23 +03:00
|
|
|
};
|
|
|
|
|
1999-08-07 09:09:09 +04:00
|
|
|
/** an encapsulation of a border defined by its edges
|
|
|
|
* owner of this struct is responsible for freeing any data stored in mEdges
|
|
|
|
*/
|
1998-12-18 01:58:23 +03:00
|
|
|
struct nsBorderEdges
|
|
|
|
{
|
2000-06-22 00:44:59 +04:00
|
|
|
nsVoidArray mEdges[4];
|
|
|
|
nsMargin mMaxBorderWidth;
|
|
|
|
PRPackedBool mOutsideEdge;
|
1998-12-18 01:58:23 +03:00
|
|
|
|
|
|
|
nsBorderEdges();
|
|
|
|
};
|
|
|
|
|
|
|
|
inline nsBorderEdges::nsBorderEdges()
|
|
|
|
{
|
|
|
|
mMaxBorderWidth.SizeTo(0,0,0,0);
|
1999-10-05 03:44:44 +04:00
|
|
|
mOutsideEdge = PR_TRUE;
|
1998-12-18 01:58:23 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define NS_ISTYLECONTEXT_IID \
|
|
|
|
{ 0x26a4d970, 0xa342, 0x11d1, \
|
|
|
|
{0x89, 0x74, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
|
|
|
|
|
|
|
class nsIStyleContext : public nsISupports {
|
|
|
|
public:
|
1999-03-03 22:48:57 +03:00
|
|
|
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLECONTEXT_IID; return iid; }
|
1998-12-18 06:43:29 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual PRBool Equals(const nsIStyleContext* aOther) const = 0;
|
|
|
|
virtual PRUint32 HashValue(void) const = 0;
|
|
|
|
|
|
|
|
virtual nsIStyleContext* GetParent(void) const = 0;
|
|
|
|
virtual nsISupportsArray* GetStyleRules(void) const = 0;
|
1998-05-21 00:32:57 +04:00
|
|
|
virtual PRInt32 GetStyleRuleCount(void) const = 0;
|
1998-11-03 23:15:59 +03:00
|
|
|
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-11-03 23:15:59 +03:00
|
|
|
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag,
|
1999-06-02 06:06:32 +04:00
|
|
|
nsISupportsArray* aRules,
|
1998-11-03 23:15:59 +03:00
|
|
|
nsIStyleContext*& aResult) = 0;
|
1998-05-27 03:12:14 +04:00
|
|
|
|
1999-10-16 08:05:59 +04:00
|
|
|
// Fill a style struct with data
|
|
|
|
NS_IMETHOD GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const = 0;
|
|
|
|
|
|
|
|
// compute the effective difference between two contexts
|
2000-06-22 00:44:59 +04:00
|
|
|
NS_IMETHOD CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint, PRBool aStopAtFirst = PR_FALSE) const = 0;
|
1999-10-16 08:05:59 +04:00
|
|
|
|
|
|
|
// debugging
|
|
|
|
virtual void List(FILE* out, PRInt32 aIndent) = 0;
|
|
|
|
|
2000-03-31 11:08:36 +04:00
|
|
|
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) = 0;
|
|
|
|
|
2000-06-22 00:44:59 +04:00
|
|
|
#ifdef SHARE_STYLECONTEXTS
|
|
|
|
// sets aMatches to PR_TRUE if the style data of aStyleContextToMatch matches the
|
|
|
|
// style data of this, PR_FALSE otherwise
|
|
|
|
NS_IMETHOD StyleDataMatches(nsIStyleContext* aStyleContextToMatch, PRBool *aMatches) = 0;
|
|
|
|
NS_IMETHOD GetStyleContextKey(scKey &aKey) const = 0;
|
|
|
|
#endif
|
|
|
|
|
1999-10-16 08:05:59 +04:00
|
|
|
// -------------------------------------------------------------
|
|
|
|
// DEPRECATED METHODS - these are all going away, stop using them
|
1998-04-14 00:24:54 +04:00
|
|
|
// get a style data struct by ID, may return null
|
1999-10-16 08:05:59 +04:00
|
|
|
// Replace calls to this with calls to GetStyle();
|
1998-06-05 09:59:34 +04:00
|
|
|
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID) = 0;
|
|
|
|
|
|
|
|
// get a style data struct by ID, may return null
|
|
|
|
virtual nsStyleStruct* GetMutableStyleData(nsStyleStructID aSID) = 0;
|
|
|
|
|
|
|
|
// call this to prevent context from getting shared
|
|
|
|
virtual void ForceUnique(void) = 0;
|
1998-04-29 03:54:06 +04:00
|
|
|
|
1999-09-29 07:30:47 +04:00
|
|
|
NS_IMETHOD RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse = PR_TRUE) = 0;
|
1998-09-25 03:55:48 +04:00
|
|
|
|
1998-04-29 03:54:06 +04:00
|
|
|
// call if you change style data after creation
|
1998-05-13 02:21:03 +04:00
|
|
|
virtual void RecalcAutomaticData(nsIPresContext* aPresContext) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// this is private to nsStyleSet, don't call it
|
|
|
|
extern NS_LAYOUT nsresult
|
|
|
|
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
|
1998-05-27 03:12:14 +04:00
|
|
|
nsIStyleContext* aParentContext,
|
1998-11-03 23:15:59 +03:00
|
|
|
nsIAtom* aPseudoType,
|
1998-04-14 00:24:54 +04:00
|
|
|
nsISupportsArray* aRules,
|
1998-05-27 03:12:14 +04:00
|
|
|
nsIPresContext* aPresContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
#endif /* nsIStyleContext_h___ */
|