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