2002-03-22 20:18:42 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2006-03-25 05:47:31 +00:00
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
#ifndef nsComputedDOMStyle_h__
|
|
|
|
#define nsComputedDOMStyle_h__
|
|
|
|
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsCSSProperty.h"
|
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2012-08-06 03:00:56 +00:00
|
|
|
#include "nsStyleContext.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nsStyleStruct.h"
|
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2013-03-17 07:55:15 +00:00
|
|
|
#include "nsIContent.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
}
|
|
|
|
}
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-08-06 03:00:56 +00:00
|
|
|
class nsIFrame;
|
2010-04-10 20:09:38 +00:00
|
|
|
class nsIPresShell;
|
2012-10-01 16:49:41 +00:00
|
|
|
class nsDOMCSSValueList;
|
|
|
|
class nsROCSSPrimitiveValue;
|
2013-03-03 00:31:48 +00:00
|
|
|
class nsStyleContext;
|
2013-08-14 11:33:03 +00:00
|
|
|
class gfx3DMatrix;
|
2010-04-10 20:09:38 +00:00
|
|
|
|
2012-08-24 04:08:08 +00:00
|
|
|
class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration
|
2002-03-22 20:18:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-11-27 17:44:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
|
|
|
|
nsICSSDeclaration)
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2004-06-08 01:32:29 +00:00
|
|
|
NS_DECL_NSICSSDECLARATION
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
|
|
|
|
virtual already_AddRefed<mozilla::dom::CSSValue>
|
|
|
|
GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
|
|
|
|
MOZ_OVERRIDE;
|
2012-12-14 17:40:38 +00:00
|
|
|
using nsICSSDeclaration::GetPropertyCSSValue;
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) MOZ_OVERRIDE;
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
enum StyleType {
|
|
|
|
eDefaultOnly, // Only includes UA and user sheets
|
|
|
|
eAll // Includes all stylesheets
|
|
|
|
};
|
|
|
|
|
2012-07-06 12:28:33 +00:00
|
|
|
nsComputedDOMStyle(mozilla::dom::Element* aElement,
|
|
|
|
const nsAString& aPseudoElt,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType);
|
2002-03-22 20:18:42 +00:00
|
|
|
virtual ~nsComputedDOMStyle();
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
static void Shutdown();
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsINode *GetParentObject() MOZ_OVERRIDE
|
2009-07-13 11:14:57 +00:00
|
|
|
{
|
|
|
|
return mContent;
|
|
|
|
}
|
|
|
|
|
2009-08-10 22:52:29 +00:00
|
|
|
static already_AddRefed<nsStyleContext>
|
2010-04-30 13:12:06 +00:00
|
|
|
GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType = eAll);
|
2009-08-10 22:52:29 +00:00
|
|
|
|
2009-08-20 21:52:47 +00:00
|
|
|
static already_AddRefed<nsStyleContext>
|
2010-04-30 13:12:06 +00:00
|
|
|
GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
|
|
|
|
nsIAtom* aPseudo,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType = eAll);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
static nsIPresShell*
|
|
|
|
GetPresShellForContent(nsIContent* aContent);
|
|
|
|
|
2010-04-03 01:58:25 +00:00
|
|
|
// Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
|
2011-09-29 06:19:26 +00:00
|
|
|
void SetExposeVisitedStyle(bool aExpose) {
|
2010-04-03 01:58:25 +00:00
|
|
|
NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
|
|
|
|
mExposeVisitedStyle = aExpose;
|
|
|
|
}
|
|
|
|
|
2010-07-14 20:58:56 +00:00
|
|
|
// nsDOMCSSDeclaration abstract methods which should never be called
|
|
|
|
// on a nsComputedDOMStyle object, but must be defined to avoid
|
|
|
|
// compile errors.
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual mozilla::css::Declaration* GetCSSDeclaration(bool) MOZ_OVERRIDE;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*) MOZ_OVERRIDE;
|
|
|
|
virtual nsIDocument* DocToUpdate() MOZ_OVERRIDE;
|
|
|
|
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) MOZ_OVERRIDE;
|
2010-07-14 20:58:56 +00:00
|
|
|
|
2013-05-30 00:38:27 +00:00
|
|
|
static nsROCSSPrimitiveValue* MatrixToCSSValue(gfx3DMatrix& aMatrix);
|
2013-05-23 08:41:40 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
private:
|
2009-02-25 00:14:45 +00:00
|
|
|
void AssertFlushedPendingReflows() {
|
|
|
|
NS_ASSERTION(mFlushedPendingReflows,
|
|
|
|
"property getter should have been marked layout-dependent");
|
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-04-04 14:00:07 +00:00
|
|
|
nsMargin GetAdjustedValuesForBoxSizing();
|
|
|
|
|
2013-04-02 01:45:48 +00:00
|
|
|
#define STYLE_STRUCT(name_, checkdata_cb_) \
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyle##name_ * Style##name_() { \
|
|
|
|
return mStyleContextHolder->Style##name_(); \
|
2006-12-19 04:16:09 +00:00
|
|
|
}
|
|
|
|
#include "nsStyleStructList.h"
|
|
|
|
#undef STYLE_STRUCT
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
// All of the property getters below return a pointer to a refcounted object
|
|
|
|
// that has just been created, but the refcount is still 0. Caller must take
|
|
|
|
// ownership.
|
2008-10-01 05:50:52 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
|
|
|
|
uint8_t aFullCorner,
|
|
|
|
bool aIsBorder); // else outline
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetRelativeOffset(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2013-08-16 00:31:32 +00:00
|
|
|
mozilla::dom::CSSValue* GetStickyOffset(mozilla::css::Side aSide);
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetStaticOffset(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetBorderColorFor(mozilla::css::Side aSide);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
|
2011-03-04 17:28:57 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetSVGPaintFor(bool aFill);
|
2010-07-14 20:58:55 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetLineHeightCoord(nscoord& aCoord);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|
|
|
const nscolor& aDefaultColor,
|
|
|
|
bool aIsBoxShadow);
|
2008-07-08 00:56:52 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
|
|
|
|
uint32_t nsStyleBackground::* aCount,
|
|
|
|
const int32_t aTable[]);
|
2009-02-20 05:29:21 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
void GetCSSGradientString(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString);
|
|
|
|
void GetImageRectString(nsIURI* aURI,
|
|
|
|
const nsStyleSides& aCropRect,
|
|
|
|
nsString& aString);
|
2011-04-12 06:18:42 +00:00
|
|
|
void AppendTimingFunction(nsDOMCSSValueList *aValueList,
|
|
|
|
const nsTimingFunction& aTimingFunction);
|
2009-08-01 15:53:40 +00:00
|
|
|
|
2010-07-14 20:58:55 +00:00
|
|
|
/* Properties queryable as CSSValues.
|
|
|
|
* To avoid a name conflict with nsIDOM*CSS2Properties, these are all
|
|
|
|
* DoGetXXX instead of GetXXX.
|
|
|
|
*/
|
2002-04-20 14:30:57 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetAppearance();
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
/* Box properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBoxAlign();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxDirection();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxFlex();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxOrdinalGroup();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxOrient();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxPack();
|
|
|
|
mozilla::dom::CSSValue* DoGetBoxSizing();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetHeight();
|
|
|
|
mozilla::dom::CSSValue* DoGetMaxHeight();
|
|
|
|
mozilla::dom::CSSValue* DoGetMaxWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetMinHeight();
|
|
|
|
mozilla::dom::CSSValue* DoGetMinWidth();
|
2013-08-07 07:59:10 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetMixBlendMode();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetLeft();
|
|
|
|
mozilla::dom::CSSValue* DoGetTop();
|
|
|
|
mozilla::dom::CSSValue* DoGetRight();
|
|
|
|
mozilla::dom::CSSValue* DoGetBottom();
|
|
|
|
mozilla::dom::CSSValue* DoGetStackSizing();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Font properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontFamily();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontFeatureSettings();
|
2013-05-20 02:59:20 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontKerning();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontLanguageOverride();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontSize();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontSizeAdjust();
|
2013-07-29 20:01:14 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetOSXFontSmoothing();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontStretch();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontStyle();
|
2013-05-20 02:59:20 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontSynthesis();
|
2013-05-19 18:23:19 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontVariant();
|
2013-05-20 02:59:20 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantAlternates();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantCaps();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantEastAsian();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantLigatures();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantNumeric();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontVariantPosition();
|
|
|
|
mozilla::dom::CSSValue* DoGetFontWeight();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Background properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundAttachment();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundImage();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundPosition();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundRepeat();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundClip();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundInlinePolicy();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundOrigin();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackgroundSize();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Padding properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetPaddingTop();
|
|
|
|
mozilla::dom::CSSValue* DoGetPaddingBottom();
|
|
|
|
mozilla::dom::CSSValue* DoGetPaddingLeft();
|
|
|
|
mozilla::dom::CSSValue* DoGetPaddingRight();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Table Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBorderCollapse();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderSpacing();
|
|
|
|
mozilla::dom::CSSValue* DoGetCaptionSide();
|
|
|
|
mozilla::dom::CSSValue* DoGetEmptyCells();
|
|
|
|
mozilla::dom::CSSValue* DoGetTableLayout();
|
|
|
|
mozilla::dom::CSSValue* DoGetVerticalAlign();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Border Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderLeftStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderRightStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderLeftWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderRightWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderLeftColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderRightColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomColors();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderLeftColors();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderRightColors();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopColors();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomLeftRadius();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderBottomRightRadius();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopLeftRadius();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderTopRightRadius();
|
|
|
|
mozilla::dom::CSSValue* DoGetFloatEdge();
|
2011-12-22 23:34:45 +00:00
|
|
|
|
|
|
|
/* Border Image */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBorderImageSource();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderImageSlice();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderImageWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderImageOutset();
|
|
|
|
mozilla::dom::CSSValue* DoGetBorderImageRepeat();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2008-07-08 00:56:52 +00:00
|
|
|
/* Box Shadow */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBoxShadow();
|
2008-07-08 00:56:52 +00:00
|
|
|
|
2008-10-14 14:44:25 +00:00
|
|
|
/* Window Shadow */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetWindowShadow();
|
2008-10-14 14:44:25 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
/* Margin Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetMarginTopWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarginBottomWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarginLeftWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarginRightWidth();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Outline Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetOutlineWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineOffset();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineRadiusBottomLeft();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineRadiusBottomRight();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineRadiusTopLeft();
|
|
|
|
mozilla::dom::CSSValue* DoGetOutlineRadiusTopRight();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2005-04-01 23:07:00 +00:00
|
|
|
/* Content Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetContent();
|
|
|
|
mozilla::dom::CSSValue* DoGetCounterIncrement();
|
|
|
|
mozilla::dom::CSSValue* DoGetCounterReset();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarkerOffset();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2007-07-22 17:58:37 +00:00
|
|
|
/* Quotes Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetQuotes();
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
/* z-index */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetZIndex();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* List properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetListStyleImage();
|
|
|
|
mozilla::dom::CSSValue* DoGetListStylePosition();
|
|
|
|
mozilla::dom::CSSValue* DoGetListStyleType();
|
|
|
|
mozilla::dom::CSSValue* DoGetImageRegion();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Text Properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetLineHeight();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextAlign();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextAlignLast();
|
2013-08-19 10:26:44 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetTextCombineHorizontal();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetTextDecoration();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextDecorationColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextDecorationLine();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextDecorationStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextIndent();
|
2013-08-19 10:26:44 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetTextOrientation();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetTextOverflow();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextTransform();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextShadow();
|
|
|
|
mozilla::dom::CSSValue* DoGetLetterSpacing();
|
|
|
|
mozilla::dom::CSSValue* DoGetWordSpacing();
|
|
|
|
mozilla::dom::CSSValue* DoGetWhiteSpace();
|
|
|
|
mozilla::dom::CSSValue* DoGetWordBreak();
|
|
|
|
mozilla::dom::CSSValue* DoGetWordWrap();
|
|
|
|
mozilla::dom::CSSValue* DoGetHyphens();
|
|
|
|
mozilla::dom::CSSValue* DoGetTabSize();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextSizeAdjust();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Visibility properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetOpacity();
|
|
|
|
mozilla::dom::CSSValue* DoGetPointerEvents();
|
|
|
|
mozilla::dom::CSSValue* DoGetVisibility();
|
2013-05-28 16:00:49 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetWritingMode();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Direction properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetDirection();
|
|
|
|
mozilla::dom::CSSValue* DoGetUnicodeBidi();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* Display properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetBinding();
|
|
|
|
mozilla::dom::CSSValue* DoGetClear();
|
2013-03-25 16:24:21 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFloat();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetDisplay();
|
|
|
|
mozilla::dom::CSSValue* DoGetPosition();
|
|
|
|
mozilla::dom::CSSValue* DoGetClip();
|
2013-08-28 22:39:06 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetImageOrientation();
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetOverflow();
|
|
|
|
mozilla::dom::CSSValue* DoGetOverflowX();
|
|
|
|
mozilla::dom::CSSValue* DoGetOverflowY();
|
|
|
|
mozilla::dom::CSSValue* DoGetResize();
|
|
|
|
mozilla::dom::CSSValue* DoGetPageBreakAfter();
|
|
|
|
mozilla::dom::CSSValue* DoGetPageBreakBefore();
|
|
|
|
mozilla::dom::CSSValue* DoGetPageBreakInside();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransform();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransformOrigin();
|
|
|
|
mozilla::dom::CSSValue* DoGetPerspective();
|
|
|
|
mozilla::dom::CSSValue* DoGetBackfaceVisibility();
|
|
|
|
mozilla::dom::CSSValue* DoGetPerspectiveOrigin();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransformStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetOrient();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
|
|
|
/* User interface properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetCursor();
|
|
|
|
mozilla::dom::CSSValue* DoGetForceBrokenImageIcon();
|
|
|
|
mozilla::dom::CSSValue* DoGetIMEMode();
|
|
|
|
mozilla::dom::CSSValue* DoGetUserFocus();
|
|
|
|
mozilla::dom::CSSValue* DoGetUserInput();
|
|
|
|
mozilla::dom::CSSValue* DoGetUserModify();
|
|
|
|
mozilla::dom::CSSValue* DoGetUserSelect();
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2004-06-17 11:57:37 +00:00
|
|
|
/* Column properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetColumnCount();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnFill();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnGap();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnRuleWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnRuleStyle();
|
|
|
|
mozilla::dom::CSSValue* DoGetColumnRuleColor();
|
2004-06-17 11:57:37 +00:00
|
|
|
|
2009-08-20 21:52:47 +00:00
|
|
|
/* CSS Transitions */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetTransitionProperty();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransitionDuration();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransitionDelay();
|
|
|
|
mozilla::dom::CSSValue* DoGetTransitionTimingFunction();
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2011-04-12 06:18:42 +00:00
|
|
|
/* CSS Animations */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetAnimationName();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationDuration();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationDelay();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationTimingFunction();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationDirection();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationFillMode();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationIterationCount();
|
|
|
|
mozilla::dom::CSSValue* DoGetAnimationPlayState();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2012-07-07 00:06:19 +00:00
|
|
|
/* CSS Flexbox properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetAlignItems();
|
|
|
|
mozilla::dom::CSSValue* DoGetAlignSelf();
|
|
|
|
mozilla::dom::CSSValue* DoGetFlexBasis();
|
|
|
|
mozilla::dom::CSSValue* DoGetFlexDirection();
|
|
|
|
mozilla::dom::CSSValue* DoGetFlexGrow();
|
|
|
|
mozilla::dom::CSSValue* DoGetFlexShrink();
|
|
|
|
mozilla::dom::CSSValue* DoGetOrder();
|
|
|
|
mozilla::dom::CSSValue* DoGetJustifyContent();
|
2012-07-07 00:06:19 +00:00
|
|
|
|
2007-07-21 14:20:25 +00:00
|
|
|
/* SVG properties */
|
2012-10-01 16:49:41 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetFill();
|
|
|
|
mozilla::dom::CSSValue* DoGetStroke();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarkerEnd();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarkerMid();
|
|
|
|
mozilla::dom::CSSValue* DoGetMarkerStart();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeDasharray();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeDashoffset();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeWidth();
|
|
|
|
mozilla::dom::CSSValue* DoGetVectorEffect();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetFillOpacity();
|
|
|
|
mozilla::dom::CSSValue* DoGetFloodOpacity();
|
|
|
|
mozilla::dom::CSSValue* DoGetStopOpacity();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeMiterlimit();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeOpacity();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetClipRule();
|
|
|
|
mozilla::dom::CSSValue* DoGetFillRule();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeLinecap();
|
|
|
|
mozilla::dom::CSSValue* DoGetStrokeLinejoin();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextAnchor();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetColorInterpolation();
|
|
|
|
mozilla::dom::CSSValue* DoGetColorInterpolationFilters();
|
|
|
|
mozilla::dom::CSSValue* DoGetDominantBaseline();
|
|
|
|
mozilla::dom::CSSValue* DoGetImageRendering();
|
|
|
|
mozilla::dom::CSSValue* DoGetShapeRendering();
|
|
|
|
mozilla::dom::CSSValue* DoGetTextRendering();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetFloodColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetLightingColor();
|
|
|
|
mozilla::dom::CSSValue* DoGetStopColor();
|
|
|
|
|
|
|
|
mozilla::dom::CSSValue* DoGetClipPath();
|
|
|
|
mozilla::dom::CSSValue* DoGetFilter();
|
|
|
|
mozilla::dom::CSSValue* DoGetMask();
|
2012-12-21 00:15:22 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetMaskType();
|
2013-01-12 23:27:53 +00:00
|
|
|
mozilla::dom::CSSValue* DoGetPaintOrder();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsDOMCSSValueList* GetROCSSValueList(bool aCommaDelimited);
|
2011-03-04 17:28:57 +00:00
|
|
|
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
void SetValueToStyleImage(const nsStyleImage& aStyleImage,
|
|
|
|
nsROCSSPrimitiveValue* aValue);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
/**
|
2011-10-17 14:59:28 +00:00
|
|
|
* A method to get a percentage base for a percentage value. Returns true
|
|
|
|
* if a percentage base value was determined, false otherwise.
|
2007-02-20 18:43:16 +00:00
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
|
2007-02-20 18:43:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to set aValue to aCoord. If aCoord is a percentage value and
|
|
|
|
* aPercentageBaseGetter is not null, aPercentageBaseGetter is called. If it
|
2011-10-17 14:59:28 +00:00
|
|
|
* returns true, the percentage base it outputs in its out param is used
|
|
|
|
* to compute an nscoord value. If the getter is null or returns false,
|
2007-02-20 18:43:16 +00:00
|
|
|
* the percent value of aCoord is set as a percent value on aValue. aTable,
|
|
|
|
* if not null, is the keyword table to handle eStyleUnit_Enumerated. When
|
|
|
|
* calling SetAppUnits on aValue (for coord or percent values), the value
|
2011-10-28 18:33:28 +00:00
|
|
|
* passed in will be clamped to be no less than aMinAppUnits and no more than
|
|
|
|
* aMaxAppUnits.
|
2007-02-20 18:43:16 +00:00
|
|
|
*
|
|
|
|
* XXXbz should caller pass in some sort of bitfield indicating which units
|
|
|
|
* can be expected or something?
|
|
|
|
*/
|
2007-04-23 07:04:33 +00:00
|
|
|
void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
|
|
|
const nsStyleCoord& aCoord,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aClampNegativeCalc,
|
2012-07-30 14:20:58 +00:00
|
|
|
PercentageBaseGetter aPercentageBaseGetter = nullptr,
|
2012-08-22 15:56:38 +00:00
|
|
|
const int32_t aTable[] = nullptr,
|
2007-04-23 07:04:33 +00:00
|
|
|
nscoord aMinAppUnits = nscoord_MIN,
|
|
|
|
nscoord aMaxAppUnits = nscoord_MAX);
|
2007-02-20 18:43:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
|
2007-04-23 07:04:33 +00:00
|
|
|
* eStyleUnit_Percent, attempts to resolve the percentage base and returns
|
|
|
|
* the resulting nscoord. If it's some other unit or a percentge base can't
|
|
|
|
* be determined, returns aDefaultValue.
|
2007-02-20 18:43:16 +00:00
|
|
|
*/
|
2007-04-23 07:04:33 +00:00
|
|
|
nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
2010-09-09 15:21:46 +00:00
|
|
|
nscoord aDefaultValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aClampNegativeCalc);
|
2007-02-20 18:43:16 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetCBContentWidth(nscoord& aWidth);
|
|
|
|
bool GetCBContentHeight(nscoord& aWidth);
|
2013-08-16 00:31:32 +00:00
|
|
|
bool GetScrollFrameContentWidth(nscoord& aWidth);
|
|
|
|
bool GetScrollFrameContentHeight(nscoord& aHeight);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetFrameBoundsWidthForTransform(nscoord &aWidth);
|
|
|
|
bool GetFrameBoundsHeightForTransform(nscoord &aHeight);
|
|
|
|
bool GetFrameBorderRectWidth(nscoord& aWidth);
|
|
|
|
bool GetFrameBorderRectHeight(nscoord& aHeight);
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2013-07-22 22:08:33 +00:00
|
|
|
/* Helper functions for computing the filter property style. */
|
|
|
|
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
|
2013-08-05 07:02:27 +00:00
|
|
|
mozilla::dom::CSSValue* CreatePrimitiveValueForStyleFilter(
|
2013-07-22 22:08:33 +00:00
|
|
|
const nsStyleFilter& aStyleFilter);
|
|
|
|
|
2002-10-08 01:53:31 +00:00
|
|
|
struct ComputedStyleMapEntry
|
|
|
|
{
|
|
|
|
// Create a pointer-to-member-function type.
|
2012-10-01 16:49:41 +00:00
|
|
|
typedef mozilla::dom::CSSValue* (nsComputedDOMStyle::*ComputeMethod)();
|
2002-10-08 01:53:31 +00:00
|
|
|
|
2002-10-08 03:03:56 +00:00
|
|
|
nsCSSProperty mProperty;
|
|
|
|
ComputeMethod mGetter;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mNeedsLayoutFlush;
|
2002-10-08 01:53:31 +00:00
|
|
|
};
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static const ComputedStyleMapEntry* GetQueryablePropertyMap(uint32_t* aLength);
|
2002-10-08 01:53:31 +00:00
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
// We don't really have a good immutable representation of "presentation".
|
|
|
|
// Given the way GetComputedStyle is currently used, we should just grab the
|
|
|
|
// 0th presshell, if any, from the document.
|
|
|
|
nsWeakPtr mDocumentWeak;
|
2002-03-22 20:18:42 +00:00
|
|
|
nsCOMPtr<nsIContent> mContent;
|
|
|
|
|
|
|
|
/*
|
2007-05-05 05:30:10 +00:00
|
|
|
* Strong reference to the style context while we're accessing the data from
|
|
|
|
* it. This can be either a style context we resolved ourselves or a style
|
|
|
|
* context we got from our frame.
|
2002-03-22 20:18:42 +00:00
|
|
|
*/
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> mStyleContextHolder;
|
2002-03-22 20:18:42 +00:00
|
|
|
nsCOMPtr<nsIAtom> mPseudo;
|
|
|
|
|
2006-12-22 06:10:32 +00:00
|
|
|
/*
|
2008-01-29 21:53:09 +00:00
|
|
|
* While computing style data, the primary frame for mContent --- named "outer"
|
|
|
|
* because we should use it to compute positioning data. Null
|
2006-12-22 06:10:32 +00:00
|
|
|
* otherwise.
|
|
|
|
*/
|
2008-01-29 21:53:09 +00:00
|
|
|
nsIFrame* mOuterFrame;
|
|
|
|
/*
|
|
|
|
* While computing style data, the "inner frame" for mContent --- the frame
|
|
|
|
* which we should use to compute margin, border, padding and content data. Null
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
nsIFrame* mInnerFrame;
|
2007-05-05 05:30:10 +00:00
|
|
|
/*
|
|
|
|
* While computing style data, the presshell we're working with. Null
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
nsIPresShell* mPresShell;
|
2006-12-22 06:10:32 +00:00
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
/*
|
|
|
|
* The kind of styles we should be returning.
|
|
|
|
*/
|
|
|
|
StyleType mStyleType;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mExposeVisitedStyle;
|
2010-04-03 01:58:25 +00:00
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
#ifdef DEBUG
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mFlushedPendingReflows;
|
2009-02-25 00:14:45 +00:00
|
|
|
#endif
|
2002-03-22 20:18:42 +00:00
|
|
|
};
|
|
|
|
|
2012-07-06 12:28:33 +00:00
|
|
|
already_AddRefed<nsComputedDOMStyle>
|
|
|
|
NS_NewComputedDOMStyle(mozilla::dom::Element* aElement,
|
|
|
|
const nsAString& aPseudoElt,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
nsComputedDOMStyle::StyleType aStyleType =
|
|
|
|
nsComputedDOMStyle::eAll);
|
2009-07-13 11:14:57 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
#endif /* nsComputedDOMStyle_h__ */
|
|
|
|
|