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 : * Christopher A. Aillon <christopher@aillon.com>
19 : * Portions created by the Initial Developer are Copyright (C) 2002
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Christopher A. Aillon <christopher@aillon.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * 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 :
39 : /* DOM object returned from element.getComputedStyle() */
40 :
41 : #ifndef nsComputedDOMStyle_h__
42 : #define nsComputedDOMStyle_h__
43 :
44 : #include "nsDOMCSSDeclaration.h"
45 :
46 : #include "nsROCSSPrimitiveValue.h"
47 : #include "nsDOMCSSRGBColor.h"
48 : #include "nsDOMCSSValueList.h"
49 : #include "nsCSSProps.h"
50 :
51 : #include "nsIContent.h"
52 : #include "nsIFrame.h"
53 : #include "nsCOMPtr.h"
54 : #include "nsWeakReference.h"
55 : #include "nsAutoPtr.h"
56 : #include "nsStyleStruct.h"
57 :
58 : class nsIPresShell;
59 :
60 : class nsComputedDOMStyle : public nsDOMCSSDeclaration,
61 : public nsWrapperCache
62 : {
63 : public:
64 0 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
65 1464 : NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS_AMBIGUOUS(nsComputedDOMStyle,
66 : nsICSSDeclaration)
67 :
68 : NS_IMETHOD Init(nsIDOMElement *aElement,
69 : const nsAString& aPseudoElt,
70 : nsIPresShell *aPresShell);
71 :
72 : NS_DECL_NSICSSDECLARATION
73 :
74 : NS_DECL_NSIDOMCSSSTYLEDECLARATION
75 :
76 : nsComputedDOMStyle();
77 : virtual ~nsComputedDOMStyle();
78 :
79 : static void Shutdown();
80 :
81 0 : virtual nsINode *GetParentObject()
82 : {
83 0 : return mContent;
84 : }
85 :
86 : static already_AddRefed<nsStyleContext>
87 : GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
88 : nsIPresShell* aPresShell);
89 :
90 : static already_AddRefed<nsStyleContext>
91 : GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
92 : nsIAtom* aPseudo,
93 : nsIPresShell* aPresShell);
94 :
95 : static nsIPresShell*
96 : GetPresShellForContent(nsIContent* aContent);
97 :
98 : // Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
99 0 : void SetExposeVisitedStyle(bool aExpose) {
100 0 : NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
101 0 : mExposeVisitedStyle = aExpose;
102 0 : }
103 :
104 : // nsDOMCSSDeclaration abstract methods which should never be called
105 : // on a nsComputedDOMStyle object, but must be defined to avoid
106 : // compile errors.
107 : virtual mozilla::css::Declaration* GetCSSDeclaration(bool);
108 : virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*);
109 : virtual nsIDocument* DocToUpdate();
110 : virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv);
111 :
112 : private:
113 0 : void AssertFlushedPendingReflows() {
114 0 : NS_ASSERTION(mFlushedPendingReflows,
115 : "property getter should have been marked layout-dependent");
116 0 : }
117 :
118 : #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
119 : const nsStyle##name_ * GetStyle##name_() { \
120 : return mStyleContextHolder->GetStyle##name_(); \
121 : }
122 : #include "nsStyleStructList.h"
123 : #undef STYLE_STRUCT
124 :
125 : // All of the property getters below return a pointer to a refcounted object
126 : // that has just been created, but the refcount is still 0. Caller must take
127 : // ownership.
128 :
129 : nsIDOMCSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
130 : PRUint8 aFullCorner,
131 : bool aIsBorder); // else outline
132 :
133 : nsIDOMCSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
134 :
135 : nsIDOMCSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
136 :
137 : nsIDOMCSSValue* GetRelativeOffset(mozilla::css::Side aSide);
138 :
139 : nsIDOMCSSValue* GetStaticOffset(mozilla::css::Side aSide);
140 :
141 : nsIDOMCSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
142 :
143 : nsIDOMCSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
144 :
145 : nsIDOMCSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
146 :
147 : nsIDOMCSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
148 :
149 : nsIDOMCSSValue* GetBorderColorFor(mozilla::css::Side aSide);
150 :
151 : nsIDOMCSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
152 :
153 : nsIDOMCSSValue* GetSVGPaintFor(bool aFill);
154 :
155 : bool GetLineHeightCoord(nscoord& aCoord);
156 :
157 : nsIDOMCSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
158 : const nscolor& aDefaultColor,
159 : bool aIsBoxShadow);
160 :
161 : nsIDOMCSSValue* GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
162 : PRUint32 nsStyleBackground::* aCount,
163 : const PRInt32 aTable[]);
164 :
165 : void GetCSSGradientString(const nsStyleGradient* aGradient,
166 : nsAString& aString);
167 : void GetImageRectString(nsIURI* aURI,
168 : const nsStyleSides& aCropRect,
169 : nsString& aString);
170 : void AppendTimingFunction(nsDOMCSSValueList *aValueList,
171 : const nsTimingFunction& aTimingFunction);
172 :
173 : /* Properties queryable as CSSValues.
174 : * To avoid a name conflict with nsIDOM*CSS2Properties, these are all
175 : * DoGetXXX instead of GetXXX.
176 : */
177 :
178 : nsIDOMCSSValue* DoGetAppearance();
179 :
180 : /* Box properties */
181 : nsIDOMCSSValue* DoGetBoxAlign();
182 : nsIDOMCSSValue* DoGetBoxDirection();
183 : nsIDOMCSSValue* DoGetBoxFlex();
184 : nsIDOMCSSValue* DoGetBoxOrdinalGroup();
185 : nsIDOMCSSValue* DoGetBoxOrient();
186 : nsIDOMCSSValue* DoGetBoxPack();
187 : nsIDOMCSSValue* DoGetBoxSizing();
188 :
189 : nsIDOMCSSValue* DoGetWidth();
190 : nsIDOMCSSValue* DoGetHeight();
191 : nsIDOMCSSValue* DoGetMaxHeight();
192 : nsIDOMCSSValue* DoGetMaxWidth();
193 : nsIDOMCSSValue* DoGetMinHeight();
194 : nsIDOMCSSValue* DoGetMinWidth();
195 : nsIDOMCSSValue* DoGetLeft();
196 : nsIDOMCSSValue* DoGetTop();
197 : nsIDOMCSSValue* DoGetRight();
198 : nsIDOMCSSValue* DoGetBottom();
199 : nsIDOMCSSValue* DoGetStackSizing();
200 :
201 : /* Font properties */
202 : nsIDOMCSSValue* DoGetColor();
203 : nsIDOMCSSValue* DoGetFontFamily();
204 : nsIDOMCSSValue* DoGetMozFontFeatureSettings();
205 : nsIDOMCSSValue* DoGetMozFontLanguageOverride();
206 : nsIDOMCSSValue* DoGetFontSize();
207 : nsIDOMCSSValue* DoGetFontSizeAdjust();
208 : nsIDOMCSSValue* DoGetFontStretch();
209 : nsIDOMCSSValue* DoGetFontStyle();
210 : nsIDOMCSSValue* DoGetFontWeight();
211 : nsIDOMCSSValue* DoGetFontVariant();
212 :
213 : /* Background properties */
214 : nsIDOMCSSValue* DoGetBackgroundAttachment();
215 : nsIDOMCSSValue* DoGetBackgroundColor();
216 : nsIDOMCSSValue* DoGetBackgroundImage();
217 : nsIDOMCSSValue* DoGetBackgroundPosition();
218 : nsIDOMCSSValue* DoGetBackgroundRepeat();
219 : nsIDOMCSSValue* DoGetBackgroundClip();
220 : nsIDOMCSSValue* DoGetBackgroundInlinePolicy();
221 : nsIDOMCSSValue* DoGetBackgroundOrigin();
222 : nsIDOMCSSValue* DoGetMozBackgroundSize();
223 :
224 : /* Padding properties */
225 : nsIDOMCSSValue* DoGetPadding();
226 : nsIDOMCSSValue* DoGetPaddingTop();
227 : nsIDOMCSSValue* DoGetPaddingBottom();
228 : nsIDOMCSSValue* DoGetPaddingLeft();
229 : nsIDOMCSSValue* DoGetPaddingRight();
230 :
231 : /* Table Properties */
232 : nsIDOMCSSValue* DoGetBorderCollapse();
233 : nsIDOMCSSValue* DoGetBorderSpacing();
234 : nsIDOMCSSValue* DoGetCaptionSide();
235 : nsIDOMCSSValue* DoGetEmptyCells();
236 : nsIDOMCSSValue* DoGetTableLayout();
237 : nsIDOMCSSValue* DoGetVerticalAlign();
238 :
239 : /* Border Properties */
240 : nsIDOMCSSValue* DoGetBorderStyle();
241 : nsIDOMCSSValue* DoGetBorderWidth();
242 : nsIDOMCSSValue* DoGetBorderTopStyle();
243 : nsIDOMCSSValue* DoGetBorderBottomStyle();
244 : nsIDOMCSSValue* DoGetBorderLeftStyle();
245 : nsIDOMCSSValue* DoGetBorderRightStyle();
246 : nsIDOMCSSValue* DoGetBorderTopWidth();
247 : nsIDOMCSSValue* DoGetBorderBottomWidth();
248 : nsIDOMCSSValue* DoGetBorderLeftWidth();
249 : nsIDOMCSSValue* DoGetBorderRightWidth();
250 : nsIDOMCSSValue* DoGetBorderTopColor();
251 : nsIDOMCSSValue* DoGetBorderBottomColor();
252 : nsIDOMCSSValue* DoGetBorderLeftColor();
253 : nsIDOMCSSValue* DoGetBorderRightColor();
254 : nsIDOMCSSValue* DoGetBorderBottomColors();
255 : nsIDOMCSSValue* DoGetBorderLeftColors();
256 : nsIDOMCSSValue* DoGetBorderRightColors();
257 : nsIDOMCSSValue* DoGetBorderTopColors();
258 : nsIDOMCSSValue* DoGetBorderBottomLeftRadius();
259 : nsIDOMCSSValue* DoGetBorderBottomRightRadius();
260 : nsIDOMCSSValue* DoGetBorderTopLeftRadius();
261 : nsIDOMCSSValue* DoGetBorderTopRightRadius();
262 : nsIDOMCSSValue* DoGetFloatEdge();
263 : nsIDOMCSSValue* DoGetBorderImage();
264 :
265 : /* Box Shadow */
266 : nsIDOMCSSValue* DoGetBoxShadow();
267 :
268 : /* Window Shadow */
269 : nsIDOMCSSValue* DoGetWindowShadow();
270 :
271 : /* Margin Properties */
272 : nsIDOMCSSValue* DoGetMarginWidth();
273 : nsIDOMCSSValue* DoGetMarginTopWidth();
274 : nsIDOMCSSValue* DoGetMarginBottomWidth();
275 : nsIDOMCSSValue* DoGetMarginLeftWidth();
276 : nsIDOMCSSValue* DoGetMarginRightWidth();
277 :
278 : /* Outline Properties */
279 : nsIDOMCSSValue* DoGetOutline();
280 : nsIDOMCSSValue* DoGetOutlineWidth();
281 : nsIDOMCSSValue* DoGetOutlineStyle();
282 : nsIDOMCSSValue* DoGetOutlineColor();
283 : nsIDOMCSSValue* DoGetOutlineOffset();
284 : nsIDOMCSSValue* DoGetOutlineRadiusBottomLeft();
285 : nsIDOMCSSValue* DoGetOutlineRadiusBottomRight();
286 : nsIDOMCSSValue* DoGetOutlineRadiusTopLeft();
287 : nsIDOMCSSValue* DoGetOutlineRadiusTopRight();
288 :
289 : /* Content Properties */
290 : nsIDOMCSSValue* DoGetContent();
291 : nsIDOMCSSValue* DoGetCounterIncrement();
292 : nsIDOMCSSValue* DoGetCounterReset();
293 : nsIDOMCSSValue* DoGetMarkerOffset();
294 :
295 : /* Quotes Properties */
296 : nsIDOMCSSValue* DoGetQuotes();
297 :
298 : /* z-index */
299 : nsIDOMCSSValue* DoGetZIndex();
300 :
301 : /* List properties */
302 : nsIDOMCSSValue* DoGetListStyleImage();
303 : nsIDOMCSSValue* DoGetListStylePosition();
304 : nsIDOMCSSValue* DoGetListStyleType();
305 : nsIDOMCSSValue* DoGetImageRegion();
306 :
307 : /* Text Properties */
308 : nsIDOMCSSValue* DoGetLineHeight();
309 : nsIDOMCSSValue* DoGetTextAlign();
310 : nsIDOMCSSValue* DoGetTextAlignLast();
311 : nsIDOMCSSValue* DoGetMozTextBlink();
312 : nsIDOMCSSValue* DoGetTextDecoration();
313 : nsIDOMCSSValue* DoGetMozTextDecorationColor();
314 : nsIDOMCSSValue* DoGetMozTextDecorationLine();
315 : nsIDOMCSSValue* DoGetMozTextDecorationStyle();
316 : nsIDOMCSSValue* DoGetTextIndent();
317 : nsIDOMCSSValue* DoGetTextOverflow();
318 : nsIDOMCSSValue* DoGetTextTransform();
319 : nsIDOMCSSValue* DoGetTextShadow();
320 : nsIDOMCSSValue* DoGetLetterSpacing();
321 : nsIDOMCSSValue* DoGetWordSpacing();
322 : nsIDOMCSSValue* DoGetWhiteSpace();
323 : nsIDOMCSSValue* DoGetWordWrap();
324 : nsIDOMCSSValue* DoGetHyphens();
325 : nsIDOMCSSValue* DoGetMozTabSize();
326 : nsIDOMCSSValue* DoGetTextSizeAdjust();
327 :
328 : /* Visibility properties */
329 : nsIDOMCSSValue* DoGetOpacity();
330 : nsIDOMCSSValue* DoGetPointerEvents();
331 : nsIDOMCSSValue* DoGetVisibility();
332 :
333 : /* Direction properties */
334 : nsIDOMCSSValue* DoGetDirection();
335 : nsIDOMCSSValue* DoGetUnicodeBidi();
336 :
337 : /* Display properties */
338 : nsIDOMCSSValue* DoGetBinding();
339 : nsIDOMCSSValue* DoGetClear();
340 : nsIDOMCSSValue* DoGetCssFloat();
341 : nsIDOMCSSValue* DoGetDisplay();
342 : nsIDOMCSSValue* DoGetPosition();
343 : nsIDOMCSSValue* DoGetClip();
344 : nsIDOMCSSValue* DoGetOverflow();
345 : nsIDOMCSSValue* DoGetOverflowX();
346 : nsIDOMCSSValue* DoGetOverflowY();
347 : nsIDOMCSSValue* DoGetResize();
348 : nsIDOMCSSValue* DoGetPageBreakAfter();
349 : nsIDOMCSSValue* DoGetPageBreakBefore();
350 : nsIDOMCSSValue* DoGetMozTransform();
351 : nsIDOMCSSValue* DoGetMozTransformOrigin();
352 : nsIDOMCSSValue* DoGetMozPerspective();
353 : nsIDOMCSSValue* DoGetMozBackfaceVisibility();
354 : nsIDOMCSSValue* DoGetMozPerspectiveOrigin();
355 : nsIDOMCSSValue* DoGetMozTransformStyle();
356 : nsIDOMCSSValue* DoGetOrient();
357 :
358 : /* User interface properties */
359 : nsIDOMCSSValue* DoGetCursor();
360 : nsIDOMCSSValue* DoGetForceBrokenImageIcon();
361 : nsIDOMCSSValue* DoGetIMEMode();
362 : nsIDOMCSSValue* DoGetUserFocus();
363 : nsIDOMCSSValue* DoGetUserInput();
364 : nsIDOMCSSValue* DoGetUserModify();
365 : nsIDOMCSSValue* DoGetUserSelect();
366 :
367 : /* Column properties */
368 : nsIDOMCSSValue* DoGetColumnCount();
369 : nsIDOMCSSValue* DoGetColumnFill();
370 : nsIDOMCSSValue* DoGetColumnWidth();
371 : nsIDOMCSSValue* DoGetColumnGap();
372 : nsIDOMCSSValue* DoGetColumnRuleWidth();
373 : nsIDOMCSSValue* DoGetColumnRuleStyle();
374 : nsIDOMCSSValue* DoGetColumnRuleColor();
375 :
376 : /* CSS Transitions */
377 : nsIDOMCSSValue* DoGetTransitionProperty();
378 : nsIDOMCSSValue* DoGetTransitionDuration();
379 : nsIDOMCSSValue* DoGetTransitionDelay();
380 : nsIDOMCSSValue* DoGetTransitionTimingFunction();
381 :
382 : /* CSS Animations */
383 : nsIDOMCSSValue* DoGetAnimationName();
384 : nsIDOMCSSValue* DoGetAnimationDuration();
385 : nsIDOMCSSValue* DoGetAnimationDelay();
386 : nsIDOMCSSValue* DoGetAnimationTimingFunction();
387 : nsIDOMCSSValue* DoGetAnimationDirection();
388 : nsIDOMCSSValue* DoGetAnimationFillMode();
389 : nsIDOMCSSValue* DoGetAnimationIterationCount();
390 : nsIDOMCSSValue* DoGetAnimationPlayState();
391 :
392 : /* SVG properties */
393 : nsIDOMCSSValue* DoGetFill();
394 : nsIDOMCSSValue* DoGetStroke();
395 : nsIDOMCSSValue* DoGetMarkerEnd();
396 : nsIDOMCSSValue* DoGetMarkerMid();
397 : nsIDOMCSSValue* DoGetMarkerStart();
398 : nsIDOMCSSValue* DoGetStrokeDasharray();
399 :
400 : nsIDOMCSSValue* DoGetStrokeDashoffset();
401 : nsIDOMCSSValue* DoGetStrokeWidth();
402 :
403 : nsIDOMCSSValue* DoGetFillOpacity();
404 : nsIDOMCSSValue* DoGetFloodOpacity();
405 : nsIDOMCSSValue* DoGetStopOpacity();
406 : nsIDOMCSSValue* DoGetStrokeMiterlimit();
407 : nsIDOMCSSValue* DoGetStrokeOpacity();
408 :
409 : nsIDOMCSSValue* DoGetClipRule();
410 : nsIDOMCSSValue* DoGetFillRule();
411 : nsIDOMCSSValue* DoGetStrokeLinecap();
412 : nsIDOMCSSValue* DoGetStrokeLinejoin();
413 : nsIDOMCSSValue* DoGetTextAnchor();
414 :
415 : nsIDOMCSSValue* DoGetColorInterpolation();
416 : nsIDOMCSSValue* DoGetColorInterpolationFilters();
417 : nsIDOMCSSValue* DoGetDominantBaseline();
418 : nsIDOMCSSValue* DoGetImageRendering();
419 : nsIDOMCSSValue* DoGetShapeRendering();
420 : nsIDOMCSSValue* DoGetTextRendering();
421 :
422 : nsIDOMCSSValue* DoGetFloodColor();
423 : nsIDOMCSSValue* DoGetLightingColor();
424 : nsIDOMCSSValue* DoGetStopColor();
425 :
426 : nsIDOMCSSValue* DoGetClipPath();
427 : nsIDOMCSSValue* DoGetFilter();
428 : nsIDOMCSSValue* DoGetMask();
429 :
430 : nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
431 : nsDOMCSSValueList* GetROCSSValueList(bool aCommaDelimited);
432 : void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
433 : void SetValueToStyleImage(const nsStyleImage& aStyleImage,
434 : nsROCSSPrimitiveValue* aValue);
435 :
436 : /**
437 : * A method to get a percentage base for a percentage value. Returns true
438 : * if a percentage base value was determined, false otherwise.
439 : */
440 : typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
441 :
442 : /**
443 : * Method to set aValue to aCoord. If aCoord is a percentage value and
444 : * aPercentageBaseGetter is not null, aPercentageBaseGetter is called. If it
445 : * returns true, the percentage base it outputs in its out param is used
446 : * to compute an nscoord value. If the getter is null or returns false,
447 : * the percent value of aCoord is set as a percent value on aValue. aTable,
448 : * if not null, is the keyword table to handle eStyleUnit_Enumerated. When
449 : * calling SetAppUnits on aValue (for coord or percent values), the value
450 : * passed in will be clamped to be no less than aMinAppUnits and no more than
451 : * aMaxAppUnits.
452 : *
453 : * XXXbz should caller pass in some sort of bitfield indicating which units
454 : * can be expected or something?
455 : */
456 : void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
457 : const nsStyleCoord& aCoord,
458 : bool aClampNegativeCalc,
459 : PercentageBaseGetter aPercentageBaseGetter = nsnull,
460 : const PRInt32 aTable[] = nsnull,
461 : nscoord aMinAppUnits = nscoord_MIN,
462 : nscoord aMaxAppUnits = nscoord_MAX);
463 :
464 : /**
465 : * If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
466 : * eStyleUnit_Percent, attempts to resolve the percentage base and returns
467 : * the resulting nscoord. If it's some other unit or a percentge base can't
468 : * be determined, returns aDefaultValue.
469 : */
470 : nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
471 : PercentageBaseGetter aPercentageBaseGetter,
472 : nscoord aDefaultValue,
473 : bool aClampNegativeCalc);
474 :
475 : bool GetCBContentWidth(nscoord& aWidth);
476 : bool GetCBContentHeight(nscoord& aWidth);
477 : bool GetFrameBoundsWidthForTransform(nscoord &aWidth);
478 : bool GetFrameBoundsHeightForTransform(nscoord &aHeight);
479 : bool GetFrameBorderRectWidth(nscoord& aWidth);
480 : bool GetFrameBorderRectHeight(nscoord& aHeight);
481 :
482 : struct ComputedStyleMapEntry
483 : {
484 : // Create a pointer-to-member-function type.
485 : typedef nsIDOMCSSValue* (nsComputedDOMStyle::*ComputeMethod)();
486 :
487 : nsCSSProperty mProperty;
488 : ComputeMethod mGetter;
489 : bool mNeedsLayoutFlush;
490 : };
491 :
492 : static const ComputedStyleMapEntry* GetQueryablePropertyMap(PRUint32* aLength);
493 :
494 : // We don't really have a good immutable representation of "presentation".
495 : // Given the way GetComputedStyle is currently used, we should just grab the
496 : // 0th presshell, if any, from the document.
497 : nsWeakPtr mDocumentWeak;
498 : nsCOMPtr<nsIContent> mContent;
499 :
500 : /*
501 : * Strong reference to the style context while we're accessing the data from
502 : * it. This can be either a style context we resolved ourselves or a style
503 : * context we got from our frame.
504 : */
505 : nsRefPtr<nsStyleContext> mStyleContextHolder;
506 : nsCOMPtr<nsIAtom> mPseudo;
507 :
508 : /*
509 : * While computing style data, the primary frame for mContent --- named "outer"
510 : * because we should use it to compute positioning data. Null
511 : * otherwise.
512 : */
513 : nsIFrame* mOuterFrame;
514 : /*
515 : * While computing style data, the "inner frame" for mContent --- the frame
516 : * which we should use to compute margin, border, padding and content data. Null
517 : * otherwise.
518 : */
519 : nsIFrame* mInnerFrame;
520 : /*
521 : * While computing style data, the presshell we're working with. Null
522 : * otherwise.
523 : */
524 : nsIPresShell* mPresShell;
525 :
526 : bool mExposeVisitedStyle;
527 :
528 : #ifdef DEBUG
529 : bool mFlushedPendingReflows;
530 : #endif
531 : };
532 :
533 : nsresult
534 : NS_NewComputedDOMStyle(nsIDOMElement *aElement, const nsAString &aPseudoElt,
535 : nsIPresShell *aPresShell,
536 : nsComputedDOMStyle **aComputedStyle);
537 :
538 : #endif /* nsComputedDOMStyle_h__ */
539 :
|