PageRenderTime 26ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/mozilla/mozilla/dist/include/layout/nsCSSStruct.h

http://kmbrasil.codeplex.com
C++ Header | 610 lines | 455 code | 100 blank | 55 comment | 16 complexity | 04d95e7d8d5637538abf4776087f8c43 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. * Daniel Glazman <glazman@netscape.com>
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either of the GNU General Public License Version 2 or later (the "GPL"),
  27. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. #ifndef nsCSSStruct_h___
  39. #define nsCSSStruct_h___
  40. #include "nsCSSValue.h"
  41. #include <stdio.h>
  42. struct nsCSSStruct {
  43. // EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
  44. };
  45. // We use the nsCSS* structures for storing nsCSSDeclaration's
  46. // *temporary* data during parsing and modification. (They are too big
  47. // for permanent storage.) We also use them for nsRuleData, with some
  48. // additions of things that the style system must cascade, but that
  49. // aren't CSS properties. Thus we use typedefs and inheritance
  50. // (forwards, when the rule data needs extra data) to make the rule data
  51. // structs from the declaration structs.
  52. // NOTE: For compilation speed, this typedef also appears in nsRuleNode.h
  53. typedef nsCSSStruct nsRuleDataStruct;
  54. struct nsCSSFont : public nsCSSStruct {
  55. nsCSSFont(void);
  56. nsCSSFont(const nsCSSFont& aCopy);
  57. ~nsCSSFont(void);
  58. #ifdef DEBUG
  59. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  60. #endif
  61. nsCSSValue mFamily;
  62. nsCSSValue mStyle;
  63. nsCSSValue mVariant;
  64. nsCSSValue mWeight;
  65. nsCSSValue mSize;
  66. nsCSSValue mSizeAdjust; // NEW
  67. nsCSSValue mStretch; // NEW
  68. };
  69. struct nsRuleDataFont : public nsCSSFont {
  70. PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
  71. };
  72. // Prefer nsCSSValue::Array for lists of fixed size.
  73. struct nsCSSValueList {
  74. nsCSSValueList(void);
  75. nsCSSValueList(const nsCSSValueList& aCopy);
  76. ~nsCSSValueList(void);
  77. static PRBool Equal(nsCSSValueList* aList1, nsCSSValueList* aList2);
  78. nsCSSValue mValue;
  79. nsCSSValueList* mNext;
  80. };
  81. struct nsCSSColor : public nsCSSStruct {
  82. nsCSSColor(void);
  83. nsCSSColor(const nsCSSColor& aCopy);
  84. ~nsCSSColor(void);
  85. #ifdef DEBUG
  86. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  87. #endif
  88. nsCSSValue mColor;
  89. nsCSSValue mBackColor;
  90. nsCSSValue mBackImage;
  91. nsCSSValue mBackRepeat;
  92. nsCSSValue mBackAttachment;
  93. nsCSSValue mBackPositionX;
  94. nsCSSValue mBackPositionY;
  95. nsCSSValue mBackClip;
  96. nsCSSValue mBackOrigin;
  97. nsCSSValue mBackInlinePolicy;
  98. };
  99. struct nsRuleDataColor : public nsCSSColor {
  100. };
  101. // Should be replaced with nsCSSValueList and nsCSSValue::Array.
  102. struct nsCSSShadow {
  103. nsCSSShadow(void);
  104. nsCSSShadow(const nsCSSShadow& aCopy);
  105. ~nsCSSShadow(void);
  106. static PRBool Equal(nsCSSShadow* aList1, nsCSSShadow* aList2);
  107. nsCSSValue mColor;
  108. nsCSSValue mXOffset;
  109. nsCSSValue mYOffset;
  110. nsCSSValue mRadius;
  111. nsCSSShadow* mNext;
  112. };
  113. struct nsCSSText : public nsCSSStruct {
  114. nsCSSText(void);
  115. nsCSSText(const nsCSSText& aCopy);
  116. ~nsCSSText(void);
  117. #ifdef DEBUG
  118. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  119. #endif
  120. nsCSSValue mWordSpacing;
  121. nsCSSValue mLetterSpacing;
  122. nsCSSValue mVerticalAlign;
  123. nsCSSValue mTextTransform;
  124. nsCSSValue mTextAlign;
  125. nsCSSValue mTextIndent;
  126. nsCSSValue mDecoration;
  127. nsCSSShadow* mTextShadow; // NEW
  128. nsCSSValue mUnicodeBidi; // NEW
  129. nsCSSValue mLineHeight;
  130. nsCSSValue mWhiteSpace;
  131. };
  132. struct nsRuleDataText : public nsCSSText {
  133. };
  134. struct nsCSSRect {
  135. nsCSSRect(void);
  136. nsCSSRect(const nsCSSRect& aCopy);
  137. ~nsCSSRect();
  138. #ifdef DEBUG
  139. void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
  140. void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
  141. #endif
  142. PRBool operator==(const nsCSSRect& aOther) const {
  143. return mTop == aOther.mTop &&
  144. mRight == aOther.mRight &&
  145. mBottom == aOther.mBottom &&
  146. mLeft == aOther.mLeft;
  147. }
  148. PRBool operator!=(const nsCSSRect& aOther) const {
  149. return mTop != aOther.mTop ||
  150. mRight != aOther.mRight ||
  151. mBottom != aOther.mBottom ||
  152. mLeft != aOther.mLeft;
  153. }
  154. void SetAllSidesTo(const nsCSSValue& aValue);
  155. void Reset() {
  156. mTop.Reset();
  157. mRight.Reset();
  158. mBottom.Reset();
  159. mLeft.Reset();
  160. }
  161. PRBool HasValue() const {
  162. return
  163. mTop.GetUnit() != eCSSUnit_Null ||
  164. mRight.GetUnit() != eCSSUnit_Null ||
  165. mBottom.GetUnit() != eCSSUnit_Null ||
  166. mLeft.GetUnit() != eCSSUnit_Null;
  167. }
  168. nsCSSValue mTop;
  169. nsCSSValue mRight;
  170. nsCSSValue mBottom;
  171. nsCSSValue mLeft;
  172. typedef nsCSSValue nsCSSRect::*side_type;
  173. static const side_type sides[4];
  174. };
  175. MOZ_DECL_CTOR_COUNTER(nsCSSValuePair)
  176. struct nsCSSValuePair {
  177. nsCSSValuePair()
  178. {
  179. MOZ_COUNT_CTOR(nsCSSValuePair);
  180. }
  181. nsCSSValuePair(const nsCSSValuePair& aCopy)
  182. : mXValue(aCopy.mXValue),
  183. mYValue(aCopy.mYValue)
  184. {
  185. MOZ_COUNT_CTOR(nsCSSValuePair);
  186. }
  187. ~nsCSSValuePair()
  188. {
  189. MOZ_COUNT_DTOR(nsCSSValuePair);
  190. }
  191. PRBool operator==(const nsCSSValuePair& aOther) const {
  192. return mXValue == aOther.mXValue &&
  193. mYValue == aOther.mYValue;
  194. }
  195. PRBool operator!=(const nsCSSValuePair& aOther) const {
  196. return mXValue != aOther.mXValue ||
  197. mYValue != aOther.mYValue;
  198. }
  199. void SetBothValuesTo(const nsCSSValue& aValue) {
  200. mXValue = aValue;
  201. mYValue = aValue;
  202. }
  203. #ifdef DEBUG
  204. void AppendToString(nsAString& aString, nsCSSProperty aPropName) const;
  205. #endif
  206. nsCSSValue mXValue;
  207. nsCSSValue mYValue;
  208. };
  209. struct nsCSSValueListRect {
  210. nsCSSValueListRect(void);
  211. nsCSSValueListRect(const nsCSSValueListRect& aCopy);
  212. ~nsCSSValueListRect();
  213. #ifdef DEBUG
  214. void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
  215. void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
  216. #endif
  217. nsCSSValueList* mTop;
  218. nsCSSValueList* mRight;
  219. nsCSSValueList* mBottom;
  220. nsCSSValueList* mLeft;
  221. typedef nsCSSValueList* nsCSSValueListRect::*side_type;
  222. static const side_type sides[4];
  223. };
  224. struct nsCSSDisplay : public nsCSSStruct {
  225. nsCSSDisplay(void);
  226. nsCSSDisplay(const nsCSSDisplay& aCopy);
  227. ~nsCSSDisplay(void);
  228. #ifdef DEBUG
  229. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  230. #endif
  231. nsCSSValue mDirection;
  232. nsCSSValue mDisplay;
  233. nsCSSValue mBinding;
  234. nsCSSValue mAppearance;
  235. nsCSSValue mPosition;
  236. nsCSSValue mFloat;
  237. nsCSSValue mClear;
  238. nsCSSRect mClip;
  239. nsCSSValue mOverflowX;
  240. nsCSSValue mOverflowY;
  241. nsCSSValue mVisibility;
  242. nsCSSValue mOpacity;
  243. // temp fix for bug 24000
  244. nsCSSValue mBreakBefore;
  245. nsCSSValue mBreakAfter;
  246. // end temp fix
  247. };
  248. struct nsRuleDataDisplay : public nsCSSDisplay {
  249. nsCSSValue mLang;
  250. };
  251. struct nsCSSMargin : public nsCSSStruct {
  252. nsCSSMargin(void);
  253. nsCSSMargin(const nsCSSMargin& aCopy);
  254. ~nsCSSMargin(void);
  255. #ifdef DEBUG
  256. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  257. #endif
  258. nsCSSRect mMargin;
  259. nsCSSValue mMarginStart;
  260. nsCSSValue mMarginEnd;
  261. nsCSSValue mMarginLeftLTRSource;
  262. nsCSSValue mMarginLeftRTLSource;
  263. nsCSSValue mMarginRightLTRSource;
  264. nsCSSValue mMarginRightRTLSource;
  265. nsCSSRect mPadding;
  266. nsCSSValue mPaddingStart;
  267. nsCSSValue mPaddingEnd;
  268. nsCSSValue mPaddingLeftLTRSource;
  269. nsCSSValue mPaddingLeftRTLSource;
  270. nsCSSValue mPaddingRightLTRSource;
  271. nsCSSValue mPaddingRightRTLSource;
  272. nsCSSRect mBorderWidth;
  273. nsCSSRect mBorderColor;
  274. nsCSSValueListRect mBorderColors;
  275. nsCSSRect mBorderStyle;
  276. nsCSSRect mBorderRadius; // (extension)
  277. nsCSSValue mOutlineWidth;
  278. nsCSSValue mOutlineColor;
  279. nsCSSValue mOutlineStyle;
  280. nsCSSValue mOutlineOffset;
  281. nsCSSRect mOutlineRadius; // (extension)
  282. nsCSSValue mFloatEdge; // NEW
  283. };
  284. struct nsRuleDataMargin : public nsCSSMargin {
  285. };
  286. struct nsCSSPosition : public nsCSSStruct {
  287. nsCSSPosition(void);
  288. nsCSSPosition(const nsCSSPosition& aCopy);
  289. ~nsCSSPosition(void);
  290. #ifdef DEBUG
  291. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  292. #endif
  293. nsCSSValue mWidth;
  294. nsCSSValue mMinWidth;
  295. nsCSSValue mMaxWidth;
  296. nsCSSValue mHeight;
  297. nsCSSValue mMinHeight;
  298. nsCSSValue mMaxHeight;
  299. nsCSSValue mBoxSizing; // NEW
  300. nsCSSRect mOffset;
  301. nsCSSValue mZIndex;
  302. };
  303. struct nsRuleDataPosition : public nsCSSPosition {
  304. };
  305. struct nsCSSList : public nsCSSStruct {
  306. nsCSSList(void);
  307. nsCSSList(const nsCSSList& aCopy);
  308. ~nsCSSList(void);
  309. #ifdef DEBUG
  310. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  311. #endif
  312. nsCSSValue mType;
  313. nsCSSValue mImage;
  314. nsCSSValue mPosition;
  315. nsCSSRect mImageRegion;
  316. };
  317. struct nsRuleDataList : public nsCSSList {
  318. };
  319. struct nsCSSTable : public nsCSSStruct { // NEW
  320. nsCSSTable(void);
  321. nsCSSTable(const nsCSSTable& aCopy);
  322. ~nsCSSTable(void);
  323. #ifdef DEBUG
  324. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  325. #endif
  326. nsCSSValue mBorderCollapse;
  327. nsCSSValuePair mBorderSpacing;
  328. nsCSSValue mCaptionSide;
  329. nsCSSValue mEmptyCells;
  330. nsCSSValue mLayout;
  331. nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
  332. nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
  333. nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
  334. nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
  335. };
  336. struct nsRuleDataTable : public nsCSSTable {
  337. };
  338. struct nsCSSBreaks : public nsCSSStruct { // NEW
  339. nsCSSBreaks(void);
  340. nsCSSBreaks(const nsCSSBreaks& aCopy);
  341. ~nsCSSBreaks(void);
  342. #ifdef DEBUG
  343. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  344. #endif
  345. nsCSSValue mOrphans;
  346. nsCSSValue mWidows;
  347. nsCSSValue mPage;
  348. // temp fix for bug 24000
  349. //nsCSSValue mPageBreakAfter;
  350. //nsCSSValue mPageBreakBefore;
  351. nsCSSValue mPageBreakInside;
  352. };
  353. struct nsRuleDataBreaks : public nsCSSBreaks {
  354. };
  355. struct nsCSSPage : public nsCSSStruct { // NEW
  356. nsCSSPage(void);
  357. nsCSSPage(const nsCSSPage& aCopy);
  358. ~nsCSSPage(void);
  359. #ifdef DEBUG
  360. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  361. #endif
  362. nsCSSValue mMarks;
  363. nsCSSValuePair mSize;
  364. };
  365. struct nsRuleDataPage : public nsCSSPage {
  366. };
  367. // Should be replaced with nsCSSValueList and nsCSSValue::Array.
  368. struct nsCSSCounterData {
  369. nsCSSCounterData(void);
  370. nsCSSCounterData(const nsCSSCounterData& aCopy);
  371. ~nsCSSCounterData(void);
  372. static PRBool Equal(nsCSSCounterData* aList1, nsCSSCounterData* aList2);
  373. nsCSSValue mCounter;
  374. nsCSSValue mValue;
  375. nsCSSCounterData* mNext;
  376. };
  377. // Should be replaced with nsCSSValueList and nsCSSValue::Array.
  378. struct nsCSSQuotes {
  379. nsCSSQuotes(void);
  380. nsCSSQuotes(const nsCSSQuotes& aCopy);
  381. ~nsCSSQuotes(void);
  382. static PRBool Equal(nsCSSQuotes* aList1, nsCSSQuotes* aList2);
  383. nsCSSValue mOpen;
  384. nsCSSValue mClose;
  385. nsCSSQuotes* mNext;
  386. };
  387. struct nsCSSContent : public nsCSSStruct {
  388. nsCSSContent(void);
  389. nsCSSContent(const nsCSSContent& aCopy);
  390. ~nsCSSContent(void);
  391. #ifdef DEBUG
  392. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  393. #endif
  394. nsCSSValueList* mContent;
  395. nsCSSCounterData* mCounterIncrement;
  396. nsCSSCounterData* mCounterReset;
  397. nsCSSValue mMarkerOffset;
  398. nsCSSQuotes* mQuotes;
  399. };
  400. struct nsRuleDataContent : public nsCSSContent {
  401. };
  402. struct nsCSSUserInterface : public nsCSSStruct { // NEW
  403. nsCSSUserInterface(void);
  404. nsCSSUserInterface(const nsCSSUserInterface& aCopy);
  405. ~nsCSSUserInterface(void);
  406. #ifdef DEBUG
  407. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  408. #endif
  409. nsCSSValue mUserInput;
  410. nsCSSValue mUserModify;
  411. nsCSSValue mUserSelect;
  412. nsCSSValue mUserFocus;
  413. nsCSSValueList* mCursor;
  414. nsCSSValue mForceBrokenImageIcon;
  415. };
  416. struct nsRuleDataUserInterface : public nsCSSUserInterface {
  417. };
  418. struct nsCSSAural : public nsCSSStruct { // NEW
  419. nsCSSAural(void);
  420. nsCSSAural(const nsCSSAural& aCopy);
  421. ~nsCSSAural(void);
  422. #ifdef DEBUG
  423. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  424. #endif
  425. nsCSSValue mAzimuth;
  426. nsCSSValue mElevation;
  427. nsCSSValue mCueAfter;
  428. nsCSSValue mCueBefore;
  429. nsCSSValue mPauseAfter;
  430. nsCSSValue mPauseBefore;
  431. nsCSSValue mPitch;
  432. nsCSSValue mPitchRange;
  433. nsCSSValuePair mPlayDuring; // mXValue is URI, mYValue are flags
  434. nsCSSValue mRichness;
  435. nsCSSValue mSpeak;
  436. nsCSSValue mSpeakHeader;
  437. nsCSSValue mSpeakNumeral;
  438. nsCSSValue mSpeakPunctuation;
  439. nsCSSValue mSpeechRate;
  440. nsCSSValue mStress;
  441. nsCSSValue mVoiceFamily;
  442. nsCSSValue mVolume;
  443. };
  444. struct nsRuleDataAural : public nsCSSAural {
  445. };
  446. struct nsCSSXUL : public nsCSSStruct {
  447. nsCSSXUL(void);
  448. nsCSSXUL(const nsCSSXUL& aCopy);
  449. ~nsCSSXUL(void);
  450. #ifdef DEBUG
  451. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  452. #endif
  453. nsCSSValue mBoxAlign;
  454. nsCSSValue mBoxDirection;
  455. nsCSSValue mBoxFlex;
  456. nsCSSValue mBoxOrient;
  457. nsCSSValue mBoxPack;
  458. nsCSSValue mBoxOrdinal;
  459. };
  460. struct nsRuleDataXUL : public nsCSSXUL {
  461. };
  462. struct nsCSSColumn : public nsCSSStruct {
  463. nsCSSColumn(void);
  464. nsCSSColumn(const nsCSSColumn& aCopy);
  465. ~nsCSSColumn(void);
  466. #ifdef DEBUG
  467. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  468. #endif
  469. nsCSSValue mColumnCount;
  470. nsCSSValue mColumnWidth;
  471. nsCSSValue mColumnGap;
  472. };
  473. struct nsRuleDataColumn : public nsCSSColumn {
  474. };
  475. #ifdef MOZ_SVG
  476. struct nsCSSSVG : public nsCSSStruct {
  477. nsCSSSVG(void);
  478. nsCSSSVG(const nsCSSSVG& aCopy);
  479. ~nsCSSSVG(void);
  480. #ifdef DEBUG
  481. void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
  482. #endif
  483. nsCSSValue mClipPath;
  484. nsCSSValue mClipRule;
  485. nsCSSValue mDominantBaseline;
  486. nsCSSValue mFill;
  487. nsCSSValue mFillOpacity;
  488. nsCSSValue mFillRule;
  489. nsCSSValue mMarkerEnd;
  490. nsCSSValue mMarkerMid;
  491. nsCSSValue mMarkerStart;
  492. nsCSSValue mPointerEvents;
  493. nsCSSValue mShapeRendering;
  494. nsCSSValue mStopColor;
  495. nsCSSValue mStopOpacity;
  496. nsCSSValue mStroke;
  497. nsCSSValueList *mStrokeDasharray;
  498. nsCSSValue mStrokeDashoffset;
  499. nsCSSValue mStrokeLinecap;
  500. nsCSSValue mStrokeLinejoin;
  501. nsCSSValue mStrokeMiterlimit;
  502. nsCSSValue mStrokeOpacity;
  503. nsCSSValue mStrokeWidth;
  504. nsCSSValue mTextAnchor;
  505. nsCSSValue mTextRendering;
  506. };
  507. struct nsRuleDataSVG : public nsCSSSVG {
  508. };
  509. #endif
  510. #endif /* nsCSSStruct_h___ */