layout/style/nsComputedDOMStyle.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /* DOM object returned from element.getComputedStyle() */
michael@0 7
michael@0 8 #ifndef nsComputedDOMStyle_h__
michael@0 9 #define nsComputedDOMStyle_h__
michael@0 10
michael@0 11 #include "nsAutoPtr.h"
michael@0 12 #include "mozilla/Attributes.h"
michael@0 13 #include "nsCOMPtr.h"
michael@0 14 #include "nscore.h"
michael@0 15 #include "nsCSSProperty.h"
michael@0 16 #include "nsCSSProps.h"
michael@0 17 #include "nsDOMCSSDeclaration.h"
michael@0 18 #include "nsStyleContext.h"
michael@0 19 #include "nsIWeakReferenceUtils.h"
michael@0 20 #include "mozilla/gfx/Types.h"
michael@0 21 #include "nsCoord.h"
michael@0 22 #include "nsColor.h"
michael@0 23 #include "nsIContent.h"
michael@0 24
michael@0 25 namespace mozilla {
michael@0 26 namespace dom {
michael@0 27 class Element;
michael@0 28 }
michael@0 29 }
michael@0 30
michael@0 31 struct nsComputedStyleMap;
michael@0 32 class nsIFrame;
michael@0 33 class nsIPresShell;
michael@0 34 class nsDOMCSSValueList;
michael@0 35 class nsMargin;
michael@0 36 class nsROCSSPrimitiveValue;
michael@0 37 class nsStyleBackground;
michael@0 38 class nsStyleBorder;
michael@0 39 class nsStyleContent;
michael@0 40 class nsStyleColumn;
michael@0 41 class nsStyleColor;
michael@0 42 class nsStyleCoord;
michael@0 43 class nsStyleCorners;
michael@0 44 class nsStyleDisplay;
michael@0 45 class nsStyleFilter;
michael@0 46 class nsStyleFont;
michael@0 47 class nsStyleGradient;
michael@0 48 class nsStyleImage;
michael@0 49 class nsStyleList;
michael@0 50 class nsStyleMargin;
michael@0 51 class nsStyleOutline;
michael@0 52 class nsStylePadding;
michael@0 53 class nsStylePosition;
michael@0 54 class nsStyleQuotes;
michael@0 55 class nsStyleSides;
michael@0 56 class nsStyleSVG;
michael@0 57 class nsStyleSVGReset;
michael@0 58 class nsStyleTable;
michael@0 59 class nsStyleText;
michael@0 60 class nsStyleTextReset;
michael@0 61 class nsStyleTimingFunction;
michael@0 62 class nsStyleUIReset;
michael@0 63 class nsStyleVisibility;
michael@0 64 class nsStyleXUL;
michael@0 65 class nsTimingFunction;
michael@0 66 class gfx3DMatrix;
michael@0 67
michael@0 68 class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration
michael@0 69 {
michael@0 70 public:
michael@0 71 typedef nsCSSProps::KTableValue KTableValue;
michael@0 72
michael@0 73 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 74 NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
michael@0 75 nsICSSDeclaration)
michael@0 76
michael@0 77 NS_DECL_NSICSSDECLARATION
michael@0 78
michael@0 79 NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
michael@0 80 virtual already_AddRefed<mozilla::dom::CSSValue>
michael@0 81 GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
michael@0 82 MOZ_OVERRIDE;
michael@0 83 using nsICSSDeclaration::GetPropertyCSSValue;
michael@0 84 virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) MOZ_OVERRIDE;
michael@0 85
michael@0 86 enum StyleType {
michael@0 87 eDefaultOnly, // Only includes UA and user sheets
michael@0 88 eAll // Includes all stylesheets
michael@0 89 };
michael@0 90
michael@0 91 nsComputedDOMStyle(mozilla::dom::Element* aElement,
michael@0 92 const nsAString& aPseudoElt,
michael@0 93 nsIPresShell* aPresShell,
michael@0 94 StyleType aStyleType);
michael@0 95 virtual ~nsComputedDOMStyle();
michael@0 96
michael@0 97 static void Shutdown();
michael@0 98
michael@0 99 virtual nsINode *GetParentObject() MOZ_OVERRIDE
michael@0 100 {
michael@0 101 return mContent;
michael@0 102 }
michael@0 103
michael@0 104 static already_AddRefed<nsStyleContext>
michael@0 105 GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
michael@0 106 nsIPresShell* aPresShell,
michael@0 107 StyleType aStyleType = eAll);
michael@0 108
michael@0 109 static already_AddRefed<nsStyleContext>
michael@0 110 GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
michael@0 111 nsIAtom* aPseudo,
michael@0 112 nsIPresShell* aPresShell,
michael@0 113 StyleType aStyleType = eAll);
michael@0 114
michael@0 115 static nsIPresShell*
michael@0 116 GetPresShellForContent(nsIContent* aContent);
michael@0 117
michael@0 118 // Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
michael@0 119 void SetExposeVisitedStyle(bool aExpose) {
michael@0 120 NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
michael@0 121 mExposeVisitedStyle = aExpose;
michael@0 122 }
michael@0 123
michael@0 124 // nsDOMCSSDeclaration abstract methods which should never be called
michael@0 125 // on a nsComputedDOMStyle object, but must be defined to avoid
michael@0 126 // compile errors.
michael@0 127 virtual mozilla::css::Declaration* GetCSSDeclaration(bool) MOZ_OVERRIDE;
michael@0 128 virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*) MOZ_OVERRIDE;
michael@0 129 virtual nsIDocument* DocToUpdate() MOZ_OVERRIDE;
michael@0 130 virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) MOZ_OVERRIDE;
michael@0 131
michael@0 132 static nsROCSSPrimitiveValue* MatrixToCSSValue(gfx3DMatrix& aMatrix);
michael@0 133
michael@0 134 static void RegisterPrefChangeCallbacks();
michael@0 135 static void UnregisterPrefChangeCallbacks();
michael@0 136
michael@0 137 private:
michael@0 138 void AssertFlushedPendingReflows() {
michael@0 139 NS_ASSERTION(mFlushedPendingReflows,
michael@0 140 "property getter should have been marked layout-dependent");
michael@0 141 }
michael@0 142
michael@0 143 nsMargin GetAdjustedValuesForBoxSizing();
michael@0 144
michael@0 145 // Helper method for DoGetTextAlign[Last].
michael@0 146 mozilla::dom::CSSValue* CreateTextAlignValue(uint8_t aAlign,
michael@0 147 bool aAlignTrue,
michael@0 148 const KTableValue aTable[]);
michael@0 149 // This indicates error by leaving mStyleContextHolder null.
michael@0 150 void UpdateCurrentStyleSources(bool aNeedsLayoutFlush);
michael@0 151 void ClearCurrentStyleSources();
michael@0 152
michael@0 153 #define STYLE_STRUCT(name_, checkdata_cb_) \
michael@0 154 const nsStyle##name_ * Style##name_() { \
michael@0 155 return mStyleContextHolder->Style##name_(); \
michael@0 156 }
michael@0 157 #include "nsStyleStructList.h"
michael@0 158 #undef STYLE_STRUCT
michael@0 159
michael@0 160 // All of the property getters below return a pointer to a refcounted object
michael@0 161 // that has just been created, but the refcount is still 0. Caller must take
michael@0 162 // ownership.
michael@0 163
michael@0 164 mozilla::dom::CSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
michael@0 165 uint8_t aFullCorner,
michael@0 166 bool aIsBorder); // else outline
michael@0 167
michael@0 168 mozilla::dom::CSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
michael@0 169
michael@0 170 mozilla::dom::CSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
michael@0 171
michael@0 172 mozilla::dom::CSSValue* GetRelativeOffset(mozilla::css::Side aSide);
michael@0 173
michael@0 174 mozilla::dom::CSSValue* GetStickyOffset(mozilla::css::Side aSide);
michael@0 175
michael@0 176 mozilla::dom::CSSValue* GetStaticOffset(mozilla::css::Side aSide);
michael@0 177
michael@0 178 mozilla::dom::CSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
michael@0 179
michael@0 180 mozilla::dom::CSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
michael@0 181
michael@0 182 mozilla::dom::CSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
michael@0 183
michael@0 184 mozilla::dom::CSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
michael@0 185
michael@0 186 mozilla::dom::CSSValue* GetBorderColorFor(mozilla::css::Side aSide);
michael@0 187
michael@0 188 mozilla::dom::CSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
michael@0 189
michael@0 190 mozilla::dom::CSSValue* GetSVGPaintFor(bool aFill);
michael@0 191
michael@0 192 mozilla::dom::CSSValue* GetGridLineNames(const nsTArray<nsString>& aLineNames);
michael@0 193 mozilla::dom::CSSValue* GetGridTrackSize(const nsStyleCoord& aMinSize,
michael@0 194 const nsStyleCoord& aMaxSize);
michael@0 195 mozilla::dom::CSSValue* GetGridTemplateColumnsRows(const nsStyleGridTemplate& aTrackList);
michael@0 196 mozilla::dom::CSSValue* GetGridLine(const nsStyleGridLine& aGridLine);
michael@0 197
michael@0 198 bool GetLineHeightCoord(nscoord& aCoord);
michael@0 199
michael@0 200 mozilla::dom::CSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
michael@0 201 const nscolor& aDefaultColor,
michael@0 202 bool aIsBoxShadow);
michael@0 203
michael@0 204 mozilla::dom::CSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
michael@0 205 uint32_t nsStyleBackground::* aCount,
michael@0 206 const KTableValue aTable[]);
michael@0 207
michael@0 208 void GetCSSGradientString(const nsStyleGradient* aGradient,
michael@0 209 nsAString& aString);
michael@0 210 void GetImageRectString(nsIURI* aURI,
michael@0 211 const nsStyleSides& aCropRect,
michael@0 212 nsString& aString);
michael@0 213 void AppendTimingFunction(nsDOMCSSValueList *aValueList,
michael@0 214 const nsTimingFunction& aTimingFunction);
michael@0 215
michael@0 216 /* Properties queryable as CSSValues.
michael@0 217 * To avoid a name conflict with nsIDOM*CSS2Properties, these are all
michael@0 218 * DoGetXXX instead of GetXXX.
michael@0 219 */
michael@0 220
michael@0 221 mozilla::dom::CSSValue* DoGetAppearance();
michael@0 222
michael@0 223 /* Box properties */
michael@0 224 mozilla::dom::CSSValue* DoGetBoxAlign();
michael@0 225 mozilla::dom::CSSValue* DoGetBoxDirection();
michael@0 226 mozilla::dom::CSSValue* DoGetBoxFlex();
michael@0 227 mozilla::dom::CSSValue* DoGetBoxOrdinalGroup();
michael@0 228 mozilla::dom::CSSValue* DoGetBoxOrient();
michael@0 229 mozilla::dom::CSSValue* DoGetBoxPack();
michael@0 230 mozilla::dom::CSSValue* DoGetBoxSizing();
michael@0 231
michael@0 232 mozilla::dom::CSSValue* DoGetWidth();
michael@0 233 mozilla::dom::CSSValue* DoGetHeight();
michael@0 234 mozilla::dom::CSSValue* DoGetMaxHeight();
michael@0 235 mozilla::dom::CSSValue* DoGetMaxWidth();
michael@0 236 mozilla::dom::CSSValue* DoGetMinHeight();
michael@0 237 mozilla::dom::CSSValue* DoGetMinWidth();
michael@0 238 mozilla::dom::CSSValue* DoGetMixBlendMode();
michael@0 239 mozilla::dom::CSSValue* DoGetLeft();
michael@0 240 mozilla::dom::CSSValue* DoGetTop();
michael@0 241 mozilla::dom::CSSValue* DoGetRight();
michael@0 242 mozilla::dom::CSSValue* DoGetBottom();
michael@0 243 mozilla::dom::CSSValue* DoGetStackSizing();
michael@0 244
michael@0 245 /* Font properties */
michael@0 246 mozilla::dom::CSSValue* DoGetColor();
michael@0 247 mozilla::dom::CSSValue* DoGetFontFamily();
michael@0 248 mozilla::dom::CSSValue* DoGetFontFeatureSettings();
michael@0 249 mozilla::dom::CSSValue* DoGetFontKerning();
michael@0 250 mozilla::dom::CSSValue* DoGetFontLanguageOverride();
michael@0 251 mozilla::dom::CSSValue* DoGetFontSize();
michael@0 252 mozilla::dom::CSSValue* DoGetFontSizeAdjust();
michael@0 253 mozilla::dom::CSSValue* DoGetOSXFontSmoothing();
michael@0 254 mozilla::dom::CSSValue* DoGetFontStretch();
michael@0 255 mozilla::dom::CSSValue* DoGetFontStyle();
michael@0 256 mozilla::dom::CSSValue* DoGetFontSynthesis();
michael@0 257 mozilla::dom::CSSValue* DoGetFontVariant();
michael@0 258 mozilla::dom::CSSValue* DoGetFontVariantAlternates();
michael@0 259 mozilla::dom::CSSValue* DoGetFontVariantCaps();
michael@0 260 mozilla::dom::CSSValue* DoGetFontVariantEastAsian();
michael@0 261 mozilla::dom::CSSValue* DoGetFontVariantLigatures();
michael@0 262 mozilla::dom::CSSValue* DoGetFontVariantNumeric();
michael@0 263 mozilla::dom::CSSValue* DoGetFontVariantPosition();
michael@0 264 mozilla::dom::CSSValue* DoGetFontWeight();
michael@0 265
michael@0 266 /* Grid properties */
michael@0 267 mozilla::dom::CSSValue* DoGetGridAutoFlow();
michael@0 268 mozilla::dom::CSSValue* DoGetGridAutoColumns();
michael@0 269 mozilla::dom::CSSValue* DoGetGridAutoRows();
michael@0 270 mozilla::dom::CSSValue* DoGetGridAutoPosition();
michael@0 271 mozilla::dom::CSSValue* DoGetGridTemplateAreas();
michael@0 272 mozilla::dom::CSSValue* DoGetGridTemplateColumns();
michael@0 273 mozilla::dom::CSSValue* DoGetGridTemplateRows();
michael@0 274 mozilla::dom::CSSValue* DoGetGridColumnStart();
michael@0 275 mozilla::dom::CSSValue* DoGetGridColumnEnd();
michael@0 276 mozilla::dom::CSSValue* DoGetGridRowStart();
michael@0 277 mozilla::dom::CSSValue* DoGetGridRowEnd();
michael@0 278
michael@0 279 /* Background properties */
michael@0 280 mozilla::dom::CSSValue* DoGetBackgroundAttachment();
michael@0 281 mozilla::dom::CSSValue* DoGetBackgroundColor();
michael@0 282 mozilla::dom::CSSValue* DoGetBackgroundImage();
michael@0 283 mozilla::dom::CSSValue* DoGetBackgroundPosition();
michael@0 284 mozilla::dom::CSSValue* DoGetBackgroundRepeat();
michael@0 285 mozilla::dom::CSSValue* DoGetBackgroundClip();
michael@0 286 mozilla::dom::CSSValue* DoGetBackgroundInlinePolicy();
michael@0 287 mozilla::dom::CSSValue* DoGetBackgroundBlendMode();
michael@0 288 mozilla::dom::CSSValue* DoGetBackgroundOrigin();
michael@0 289 mozilla::dom::CSSValue* DoGetBackgroundSize();
michael@0 290
michael@0 291 /* Padding properties */
michael@0 292 mozilla::dom::CSSValue* DoGetPaddingTop();
michael@0 293 mozilla::dom::CSSValue* DoGetPaddingBottom();
michael@0 294 mozilla::dom::CSSValue* DoGetPaddingLeft();
michael@0 295 mozilla::dom::CSSValue* DoGetPaddingRight();
michael@0 296
michael@0 297 /* Table Properties */
michael@0 298 mozilla::dom::CSSValue* DoGetBorderCollapse();
michael@0 299 mozilla::dom::CSSValue* DoGetBorderSpacing();
michael@0 300 mozilla::dom::CSSValue* DoGetCaptionSide();
michael@0 301 mozilla::dom::CSSValue* DoGetEmptyCells();
michael@0 302 mozilla::dom::CSSValue* DoGetTableLayout();
michael@0 303 mozilla::dom::CSSValue* DoGetVerticalAlign();
michael@0 304
michael@0 305 /* Border Properties */
michael@0 306 mozilla::dom::CSSValue* DoGetBorderTopStyle();
michael@0 307 mozilla::dom::CSSValue* DoGetBorderBottomStyle();
michael@0 308 mozilla::dom::CSSValue* DoGetBorderLeftStyle();
michael@0 309 mozilla::dom::CSSValue* DoGetBorderRightStyle();
michael@0 310 mozilla::dom::CSSValue* DoGetBorderTopWidth();
michael@0 311 mozilla::dom::CSSValue* DoGetBorderBottomWidth();
michael@0 312 mozilla::dom::CSSValue* DoGetBorderLeftWidth();
michael@0 313 mozilla::dom::CSSValue* DoGetBorderRightWidth();
michael@0 314 mozilla::dom::CSSValue* DoGetBorderTopColor();
michael@0 315 mozilla::dom::CSSValue* DoGetBorderBottomColor();
michael@0 316 mozilla::dom::CSSValue* DoGetBorderLeftColor();
michael@0 317 mozilla::dom::CSSValue* DoGetBorderRightColor();
michael@0 318 mozilla::dom::CSSValue* DoGetBorderBottomColors();
michael@0 319 mozilla::dom::CSSValue* DoGetBorderLeftColors();
michael@0 320 mozilla::dom::CSSValue* DoGetBorderRightColors();
michael@0 321 mozilla::dom::CSSValue* DoGetBorderTopColors();
michael@0 322 mozilla::dom::CSSValue* DoGetBorderBottomLeftRadius();
michael@0 323 mozilla::dom::CSSValue* DoGetBorderBottomRightRadius();
michael@0 324 mozilla::dom::CSSValue* DoGetBorderTopLeftRadius();
michael@0 325 mozilla::dom::CSSValue* DoGetBorderTopRightRadius();
michael@0 326 mozilla::dom::CSSValue* DoGetFloatEdge();
michael@0 327
michael@0 328 /* Border Image */
michael@0 329 mozilla::dom::CSSValue* DoGetBorderImageSource();
michael@0 330 mozilla::dom::CSSValue* DoGetBorderImageSlice();
michael@0 331 mozilla::dom::CSSValue* DoGetBorderImageWidth();
michael@0 332 mozilla::dom::CSSValue* DoGetBorderImageOutset();
michael@0 333 mozilla::dom::CSSValue* DoGetBorderImageRepeat();
michael@0 334
michael@0 335 /* Box Shadow */
michael@0 336 mozilla::dom::CSSValue* DoGetBoxShadow();
michael@0 337
michael@0 338 /* Window Shadow */
michael@0 339 mozilla::dom::CSSValue* DoGetWindowShadow();
michael@0 340
michael@0 341 /* Margin Properties */
michael@0 342 mozilla::dom::CSSValue* DoGetMarginTopWidth();
michael@0 343 mozilla::dom::CSSValue* DoGetMarginBottomWidth();
michael@0 344 mozilla::dom::CSSValue* DoGetMarginLeftWidth();
michael@0 345 mozilla::dom::CSSValue* DoGetMarginRightWidth();
michael@0 346
michael@0 347 /* Outline Properties */
michael@0 348 mozilla::dom::CSSValue* DoGetOutlineWidth();
michael@0 349 mozilla::dom::CSSValue* DoGetOutlineStyle();
michael@0 350 mozilla::dom::CSSValue* DoGetOutlineColor();
michael@0 351 mozilla::dom::CSSValue* DoGetOutlineOffset();
michael@0 352 mozilla::dom::CSSValue* DoGetOutlineRadiusBottomLeft();
michael@0 353 mozilla::dom::CSSValue* DoGetOutlineRadiusBottomRight();
michael@0 354 mozilla::dom::CSSValue* DoGetOutlineRadiusTopLeft();
michael@0 355 mozilla::dom::CSSValue* DoGetOutlineRadiusTopRight();
michael@0 356
michael@0 357 /* Content Properties */
michael@0 358 mozilla::dom::CSSValue* DoGetContent();
michael@0 359 mozilla::dom::CSSValue* DoGetCounterIncrement();
michael@0 360 mozilla::dom::CSSValue* DoGetCounterReset();
michael@0 361 mozilla::dom::CSSValue* DoGetMarkerOffset();
michael@0 362
michael@0 363 /* Quotes Properties */
michael@0 364 mozilla::dom::CSSValue* DoGetQuotes();
michael@0 365
michael@0 366 /* z-index */
michael@0 367 mozilla::dom::CSSValue* DoGetZIndex();
michael@0 368
michael@0 369 /* List properties */
michael@0 370 mozilla::dom::CSSValue* DoGetListStyleImage();
michael@0 371 mozilla::dom::CSSValue* DoGetListStylePosition();
michael@0 372 mozilla::dom::CSSValue* DoGetListStyleType();
michael@0 373 mozilla::dom::CSSValue* DoGetImageRegion();
michael@0 374
michael@0 375 /* Text Properties */
michael@0 376 mozilla::dom::CSSValue* DoGetLineHeight();
michael@0 377 mozilla::dom::CSSValue* DoGetTextAlign();
michael@0 378 mozilla::dom::CSSValue* DoGetTextAlignLast();
michael@0 379 mozilla::dom::CSSValue* DoGetTextCombineUpright();
michael@0 380 mozilla::dom::CSSValue* DoGetTextDecoration();
michael@0 381 mozilla::dom::CSSValue* DoGetTextDecorationColor();
michael@0 382 mozilla::dom::CSSValue* DoGetTextDecorationLine();
michael@0 383 mozilla::dom::CSSValue* DoGetTextDecorationStyle();
michael@0 384 mozilla::dom::CSSValue* DoGetTextIndent();
michael@0 385 mozilla::dom::CSSValue* DoGetTextOrientation();
michael@0 386 mozilla::dom::CSSValue* DoGetTextOverflow();
michael@0 387 mozilla::dom::CSSValue* DoGetTextTransform();
michael@0 388 mozilla::dom::CSSValue* DoGetTextShadow();
michael@0 389 mozilla::dom::CSSValue* DoGetLetterSpacing();
michael@0 390 mozilla::dom::CSSValue* DoGetWordSpacing();
michael@0 391 mozilla::dom::CSSValue* DoGetWhiteSpace();
michael@0 392 mozilla::dom::CSSValue* DoGetWordBreak();
michael@0 393 mozilla::dom::CSSValue* DoGetWordWrap();
michael@0 394 mozilla::dom::CSSValue* DoGetHyphens();
michael@0 395 mozilla::dom::CSSValue* DoGetTabSize();
michael@0 396 mozilla::dom::CSSValue* DoGetTextSizeAdjust();
michael@0 397
michael@0 398 /* Visibility properties */
michael@0 399 mozilla::dom::CSSValue* DoGetOpacity();
michael@0 400 mozilla::dom::CSSValue* DoGetPointerEvents();
michael@0 401 mozilla::dom::CSSValue* DoGetVisibility();
michael@0 402 mozilla::dom::CSSValue* DoGetWritingMode();
michael@0 403
michael@0 404 /* Direction properties */
michael@0 405 mozilla::dom::CSSValue* DoGetDirection();
michael@0 406 mozilla::dom::CSSValue* DoGetUnicodeBidi();
michael@0 407
michael@0 408 /* Display properties */
michael@0 409 mozilla::dom::CSSValue* DoGetBinding();
michael@0 410 mozilla::dom::CSSValue* DoGetClear();
michael@0 411 mozilla::dom::CSSValue* DoGetFloat();
michael@0 412 mozilla::dom::CSSValue* DoGetDisplay();
michael@0 413 mozilla::dom::CSSValue* DoGetPosition();
michael@0 414 mozilla::dom::CSSValue* DoGetClip();
michael@0 415 mozilla::dom::CSSValue* DoGetImageOrientation();
michael@0 416 mozilla::dom::CSSValue* DoGetWillChange();
michael@0 417 mozilla::dom::CSSValue* DoGetOverflow();
michael@0 418 mozilla::dom::CSSValue* DoGetOverflowX();
michael@0 419 mozilla::dom::CSSValue* DoGetOverflowY();
michael@0 420 mozilla::dom::CSSValue* DoGetOverflowClipBox();
michael@0 421 mozilla::dom::CSSValue* DoGetResize();
michael@0 422 mozilla::dom::CSSValue* DoGetPageBreakAfter();
michael@0 423 mozilla::dom::CSSValue* DoGetPageBreakBefore();
michael@0 424 mozilla::dom::CSSValue* DoGetPageBreakInside();
michael@0 425 mozilla::dom::CSSValue* DoGetTouchAction();
michael@0 426 mozilla::dom::CSSValue* DoGetTransform();
michael@0 427 mozilla::dom::CSSValue* DoGetTransformOrigin();
michael@0 428 mozilla::dom::CSSValue* DoGetPerspective();
michael@0 429 mozilla::dom::CSSValue* DoGetBackfaceVisibility();
michael@0 430 mozilla::dom::CSSValue* DoGetPerspectiveOrigin();
michael@0 431 mozilla::dom::CSSValue* DoGetTransformStyle();
michael@0 432 mozilla::dom::CSSValue* DoGetOrient();
michael@0 433
michael@0 434 /* User interface properties */
michael@0 435 mozilla::dom::CSSValue* DoGetCursor();
michael@0 436 mozilla::dom::CSSValue* DoGetForceBrokenImageIcon();
michael@0 437 mozilla::dom::CSSValue* DoGetIMEMode();
michael@0 438 mozilla::dom::CSSValue* DoGetUserFocus();
michael@0 439 mozilla::dom::CSSValue* DoGetUserInput();
michael@0 440 mozilla::dom::CSSValue* DoGetUserModify();
michael@0 441 mozilla::dom::CSSValue* DoGetUserSelect();
michael@0 442
michael@0 443 /* Column properties */
michael@0 444 mozilla::dom::CSSValue* DoGetColumnCount();
michael@0 445 mozilla::dom::CSSValue* DoGetColumnFill();
michael@0 446 mozilla::dom::CSSValue* DoGetColumnWidth();
michael@0 447 mozilla::dom::CSSValue* DoGetColumnGap();
michael@0 448 mozilla::dom::CSSValue* DoGetColumnRuleWidth();
michael@0 449 mozilla::dom::CSSValue* DoGetColumnRuleStyle();
michael@0 450 mozilla::dom::CSSValue* DoGetColumnRuleColor();
michael@0 451
michael@0 452 /* CSS Transitions */
michael@0 453 mozilla::dom::CSSValue* DoGetTransitionProperty();
michael@0 454 mozilla::dom::CSSValue* DoGetTransitionDuration();
michael@0 455 mozilla::dom::CSSValue* DoGetTransitionDelay();
michael@0 456 mozilla::dom::CSSValue* DoGetTransitionTimingFunction();
michael@0 457
michael@0 458 /* CSS Animations */
michael@0 459 mozilla::dom::CSSValue* DoGetAnimationName();
michael@0 460 mozilla::dom::CSSValue* DoGetAnimationDuration();
michael@0 461 mozilla::dom::CSSValue* DoGetAnimationDelay();
michael@0 462 mozilla::dom::CSSValue* DoGetAnimationTimingFunction();
michael@0 463 mozilla::dom::CSSValue* DoGetAnimationDirection();
michael@0 464 mozilla::dom::CSSValue* DoGetAnimationFillMode();
michael@0 465 mozilla::dom::CSSValue* DoGetAnimationIterationCount();
michael@0 466 mozilla::dom::CSSValue* DoGetAnimationPlayState();
michael@0 467
michael@0 468 /* CSS Flexbox properties */
michael@0 469 mozilla::dom::CSSValue* DoGetAlignContent();
michael@0 470 mozilla::dom::CSSValue* DoGetAlignItems();
michael@0 471 mozilla::dom::CSSValue* DoGetAlignSelf();
michael@0 472 mozilla::dom::CSSValue* DoGetFlexBasis();
michael@0 473 mozilla::dom::CSSValue* DoGetFlexDirection();
michael@0 474 mozilla::dom::CSSValue* DoGetFlexGrow();
michael@0 475 mozilla::dom::CSSValue* DoGetFlexShrink();
michael@0 476 mozilla::dom::CSSValue* DoGetFlexWrap();
michael@0 477 mozilla::dom::CSSValue* DoGetOrder();
michael@0 478 mozilla::dom::CSSValue* DoGetJustifyContent();
michael@0 479
michael@0 480 /* SVG properties */
michael@0 481 mozilla::dom::CSSValue* DoGetFill();
michael@0 482 mozilla::dom::CSSValue* DoGetStroke();
michael@0 483 mozilla::dom::CSSValue* DoGetMarkerEnd();
michael@0 484 mozilla::dom::CSSValue* DoGetMarkerMid();
michael@0 485 mozilla::dom::CSSValue* DoGetMarkerStart();
michael@0 486 mozilla::dom::CSSValue* DoGetStrokeDasharray();
michael@0 487
michael@0 488 mozilla::dom::CSSValue* DoGetStrokeDashoffset();
michael@0 489 mozilla::dom::CSSValue* DoGetStrokeWidth();
michael@0 490 mozilla::dom::CSSValue* DoGetVectorEffect();
michael@0 491
michael@0 492 mozilla::dom::CSSValue* DoGetFillOpacity();
michael@0 493 mozilla::dom::CSSValue* DoGetFloodOpacity();
michael@0 494 mozilla::dom::CSSValue* DoGetStopOpacity();
michael@0 495 mozilla::dom::CSSValue* DoGetStrokeMiterlimit();
michael@0 496 mozilla::dom::CSSValue* DoGetStrokeOpacity();
michael@0 497
michael@0 498 mozilla::dom::CSSValue* DoGetClipRule();
michael@0 499 mozilla::dom::CSSValue* DoGetFillRule();
michael@0 500 mozilla::dom::CSSValue* DoGetStrokeLinecap();
michael@0 501 mozilla::dom::CSSValue* DoGetStrokeLinejoin();
michael@0 502 mozilla::dom::CSSValue* DoGetTextAnchor();
michael@0 503
michael@0 504 mozilla::dom::CSSValue* DoGetColorInterpolation();
michael@0 505 mozilla::dom::CSSValue* DoGetColorInterpolationFilters();
michael@0 506 mozilla::dom::CSSValue* DoGetDominantBaseline();
michael@0 507 mozilla::dom::CSSValue* DoGetImageRendering();
michael@0 508 mozilla::dom::CSSValue* DoGetShapeRendering();
michael@0 509 mozilla::dom::CSSValue* DoGetTextRendering();
michael@0 510
michael@0 511 mozilla::dom::CSSValue* DoGetFloodColor();
michael@0 512 mozilla::dom::CSSValue* DoGetLightingColor();
michael@0 513 mozilla::dom::CSSValue* DoGetStopColor();
michael@0 514
michael@0 515 mozilla::dom::CSSValue* DoGetClipPath();
michael@0 516 mozilla::dom::CSSValue* DoGetFilter();
michael@0 517 mozilla::dom::CSSValue* DoGetMask();
michael@0 518 mozilla::dom::CSSValue* DoGetMaskType();
michael@0 519 mozilla::dom::CSSValue* DoGetPaintOrder();
michael@0 520
michael@0 521 /* Custom properties */
michael@0 522 mozilla::dom::CSSValue* DoGetCustomProperty(const nsAString& aPropertyName);
michael@0 523
michael@0 524 nsDOMCSSValueList* GetROCSSValueList(bool aCommaDelimited);
michael@0 525 void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
michael@0 526 void SetValueToStyleImage(const nsStyleImage& aStyleImage,
michael@0 527 nsROCSSPrimitiveValue* aValue);
michael@0 528
michael@0 529 /**
michael@0 530 * A method to get a percentage base for a percentage value. Returns true
michael@0 531 * if a percentage base value was determined, false otherwise.
michael@0 532 */
michael@0 533 typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
michael@0 534
michael@0 535 /**
michael@0 536 * Method to set aValue to aCoord. If aCoord is a percentage value and
michael@0 537 * aPercentageBaseGetter is not null, aPercentageBaseGetter is called. If it
michael@0 538 * returns true, the percentage base it outputs in its out param is used
michael@0 539 * to compute an nscoord value. If the getter is null or returns false,
michael@0 540 * the percent value of aCoord is set as a percent value on aValue. aTable,
michael@0 541 * if not null, is the keyword table to handle eStyleUnit_Enumerated. When
michael@0 542 * calling SetAppUnits on aValue (for coord or percent values), the value
michael@0 543 * passed in will be clamped to be no less than aMinAppUnits and no more than
michael@0 544 * aMaxAppUnits.
michael@0 545 *
michael@0 546 * XXXbz should caller pass in some sort of bitfield indicating which units
michael@0 547 * can be expected or something?
michael@0 548 */
michael@0 549 void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
michael@0 550 const nsStyleCoord& aCoord,
michael@0 551 bool aClampNegativeCalc,
michael@0 552 PercentageBaseGetter aPercentageBaseGetter = nullptr,
michael@0 553 const KTableValue aTable[] = nullptr,
michael@0 554 nscoord aMinAppUnits = nscoord_MIN,
michael@0 555 nscoord aMaxAppUnits = nscoord_MAX);
michael@0 556
michael@0 557 /**
michael@0 558 * If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
michael@0 559 * eStyleUnit_Percent, attempts to resolve the percentage base and returns
michael@0 560 * the resulting nscoord. If it's some other unit or a percentge base can't
michael@0 561 * be determined, returns aDefaultValue.
michael@0 562 */
michael@0 563 nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
michael@0 564 PercentageBaseGetter aPercentageBaseGetter,
michael@0 565 nscoord aDefaultValue,
michael@0 566 bool aClampNegativeCalc);
michael@0 567
michael@0 568 bool GetCBContentWidth(nscoord& aWidth);
michael@0 569 bool GetCBContentHeight(nscoord& aWidth);
michael@0 570 bool GetScrollFrameContentWidth(nscoord& aWidth);
michael@0 571 bool GetScrollFrameContentHeight(nscoord& aHeight);
michael@0 572 bool GetFrameBoundsWidthForTransform(nscoord &aWidth);
michael@0 573 bool GetFrameBoundsHeightForTransform(nscoord &aHeight);
michael@0 574 bool GetFrameBorderRectWidth(nscoord& aWidth);
michael@0 575 bool GetFrameBorderRectHeight(nscoord& aHeight);
michael@0 576
michael@0 577 /* Helper functions for computing the filter property style. */
michael@0 578 void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
michael@0 579 mozilla::dom::CSSValue* CreatePrimitiveValueForStyleFilter(
michael@0 580 const nsStyleFilter& aStyleFilter);
michael@0 581
michael@0 582 static nsComputedStyleMap* GetComputedStyleMap();
michael@0 583
michael@0 584 // We don't really have a good immutable representation of "presentation".
michael@0 585 // Given the way GetComputedStyle is currently used, we should just grab the
michael@0 586 // 0th presshell, if any, from the document.
michael@0 587 nsWeakPtr mDocumentWeak;
michael@0 588 nsCOMPtr<nsIContent> mContent;
michael@0 589
michael@0 590 /*
michael@0 591 * Strong reference to the style context while we're accessing the data from
michael@0 592 * it. This can be either a style context we resolved ourselves or a style
michael@0 593 * context we got from our frame.
michael@0 594 */
michael@0 595 nsRefPtr<nsStyleContext> mStyleContextHolder;
michael@0 596 nsCOMPtr<nsIAtom> mPseudo;
michael@0 597
michael@0 598 /*
michael@0 599 * While computing style data, the primary frame for mContent --- named "outer"
michael@0 600 * because we should use it to compute positioning data. Null
michael@0 601 * otherwise.
michael@0 602 */
michael@0 603 nsIFrame* mOuterFrame;
michael@0 604 /*
michael@0 605 * While computing style data, the "inner frame" for mContent --- the frame
michael@0 606 * which we should use to compute margin, border, padding and content data. Null
michael@0 607 * otherwise.
michael@0 608 */
michael@0 609 nsIFrame* mInnerFrame;
michael@0 610 /*
michael@0 611 * While computing style data, the presshell we're working with. Null
michael@0 612 * otherwise.
michael@0 613 */
michael@0 614 nsIPresShell* mPresShell;
michael@0 615
michael@0 616 /*
michael@0 617 * The kind of styles we should be returning.
michael@0 618 */
michael@0 619 StyleType mStyleType;
michael@0 620
michael@0 621 bool mExposeVisitedStyle;
michael@0 622
michael@0 623 #ifdef DEBUG
michael@0 624 bool mFlushedPendingReflows;
michael@0 625 #endif
michael@0 626 };
michael@0 627
michael@0 628 already_AddRefed<nsComputedDOMStyle>
michael@0 629 NS_NewComputedDOMStyle(mozilla::dom::Element* aElement,
michael@0 630 const nsAString& aPseudoElt,
michael@0 631 nsIPresShell* aPresShell,
michael@0 632 nsComputedDOMStyle::StyleType aStyleType =
michael@0 633 nsComputedDOMStyle::eAll);
michael@0 634
michael@0 635 #endif /* nsComputedDOMStyle_h__ */
michael@0 636

mercurial