2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Christopher A. Aillon <christopher@aillon.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Christopher A. Aillon <christopher@aillon.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
|
|
|
#ifndef nsComputedDOMStyle_h__
|
|
|
|
#define nsComputedDOMStyle_h__
|
|
|
|
|
2010-07-14 13:58:56 -07:00
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsROCSSPrimitiveValue.h"
|
|
|
|
#include "nsDOMCSSRGBColor.h"
|
|
|
|
#include "nsDOMCSSValueList.h"
|
|
|
|
#include "nsCSSProps.h"
|
|
|
|
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2009-02-19 21:29:21 -08:00
|
|
|
#include "nsStyleStruct.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-10 13:09:38 -07:00
|
|
|
class nsIPresShell;
|
|
|
|
|
2010-07-14 13:58:56 -07:00
|
|
|
class nsComputedDOMStyle : public nsDOMCSSDeclaration,
|
2009-07-13 04:14:57 -07:00
|
|
|
public nsWrapperCache
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2008-11-27 09:44:26 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2010-07-14 13:58:56 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsComputedDOMStyle,
|
|
|
|
nsICSSDeclaration)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Init(nsIDOMElement *aElement,
|
|
|
|
const nsAString& aPseudoElt,
|
|
|
|
nsIPresShell *aPresShell);
|
|
|
|
|
|
|
|
NS_DECL_NSICSSDECLARATION
|
|
|
|
|
|
|
|
NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
|
|
|
|
|
|
|
nsComputedDOMStyle();
|
|
|
|
virtual ~nsComputedDOMStyle();
|
|
|
|
|
|
|
|
static void Shutdown();
|
|
|
|
|
2009-10-05 16:16:22 -07:00
|
|
|
virtual nsINode *GetParentObject()
|
2009-07-13 04:14:57 -07:00
|
|
|
{
|
|
|
|
return mContent;
|
|
|
|
}
|
|
|
|
|
2009-08-10 15:52:29 -07:00
|
|
|
static already_AddRefed<nsStyleContext>
|
2010-04-30 06:12:06 -07:00
|
|
|
GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
|
2009-08-10 15:52:29 -07:00
|
|
|
nsIPresShell* aPresShell);
|
|
|
|
|
2009-08-20 14:52:47 -07:00
|
|
|
static already_AddRefed<nsStyleContext>
|
2010-04-30 06:12:06 -07:00
|
|
|
GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
|
|
|
|
nsIAtom* aPseudo,
|
2009-08-20 14:52:47 -07:00
|
|
|
nsIPresShell* aPresShell);
|
|
|
|
|
|
|
|
static nsIPresShell*
|
|
|
|
GetPresShellForContent(nsIContent* aContent);
|
|
|
|
|
2010-04-02 18:58:25 -07:00
|
|
|
// Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
|
|
|
|
void SetExposeVisitedStyle(PRBool aExpose) {
|
|
|
|
NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
|
|
|
|
mExposeVisitedStyle = aExpose;
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:58:56 -07:00
|
|
|
// nsDOMCSSDeclaration abstract methods which should never be called
|
|
|
|
// on a nsComputedDOMStyle object, but must be defined to avoid
|
|
|
|
// compile errors.
|
2010-07-23 11:00:34 -07:00
|
|
|
virtual mozilla::css::Declaration* GetCSSDeclaration(PRBool);
|
2010-07-23 11:00:47 -07:00
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*);
|
2010-07-14 13:58:56 -07:00
|
|
|
virtual nsIDocument* DocToUpdate();
|
|
|
|
virtual nsresult GetCSSParsingEnvironment(nsIURI**, nsIURI**, nsIPrincipal**,
|
|
|
|
mozilla::css::Loader**);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2009-02-24 16:14:45 -08:00
|
|
|
void AssertFlushedPendingReflows() {
|
|
|
|
NS_ASSERTION(mFlushedPendingReflows,
|
|
|
|
"property getter should have been marked layout-dependent");
|
|
|
|
}
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
|
|
|
|
const nsStyle##name_ * GetStyle##name_() { \
|
2007-05-04 22:30:10 -07:00
|
|
|
return mStyleContextHolder->GetStyle##name_(); \
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
#include "nsStyleStructList.h"
|
|
|
|
#undef STYLE_STRUCT
|
|
|
|
|
2008-09-30 22:50:52 -07:00
|
|
|
nsresult GetEllipseRadii(const nsStyleCorners& aRadius,
|
|
|
|
PRUint8 aFullCorner,
|
2010-10-06 21:25:47 -07:00
|
|
|
PRBool aIsBorder, // else outline
|
2008-09-30 22:50:52 -07:00
|
|
|
nsIDOMCSSValue** aValue);
|
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetOffsetWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetBorderColorsFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
nsresult GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult GetSVGPaintFor(PRBool aFill, nsIDOMCSSValue** aValue);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool GetLineHeightCoord(nscoord& aCoord);
|
|
|
|
|
2008-07-07 17:56:52 -07:00
|
|
|
nsresult GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|
|
|
const nscolor& aDefaultColor,
|
2009-02-10 00:45:13 -08:00
|
|
|
PRBool aIsBoxShadow,
|
2008-07-07 17:56:52 -07:00
|
|
|
nsIDOMCSSValue** aValue);
|
|
|
|
|
2009-02-19 21:29:21 -08:00
|
|
|
nsresult GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
|
|
|
|
PRUint32 nsStyleBackground::* aCount,
|
|
|
|
const PRInt32 aTable[],
|
|
|
|
nsIDOMCSSValue** aResult);
|
|
|
|
|
2009-08-01 08:53:40 -07:00
|
|
|
nsresult GetCSSGradientString(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString);
|
2009-08-21 13:39:25 -07:00
|
|
|
nsresult GetImageRectString(nsIURI* aURI,
|
|
|
|
const nsStyleSides& aCropRect,
|
|
|
|
nsString& aString);
|
2009-08-01 08:53:40 -07:00
|
|
|
|
2010-07-14 13:58:55 -07:00
|
|
|
/* Properties queryable as CSSValues.
|
|
|
|
* To avoid a name conflict with nsIDOM*CSS2Properties, these are all
|
|
|
|
* DoGetXXX instead of GetXXX.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetAppearance(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Box properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBoxAlign(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxDirection(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxFlex(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxOrdinalGroup(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxOrient(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxPack(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBoxSizing(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetHeight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMaxHeight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMaxWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMinHeight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMinWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetLeft(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTop(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetRight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBottom(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStackSizing(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Font properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontFamily(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontSize(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontSizeAdjust(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontStretch(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontWeight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFontVariant(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Background properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBackgroundAttachment(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundImage(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundPosition(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundRepeat(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundClip(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundInlinePolicy(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBackgroundOrigin(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozBackgroundSize(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Padding properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetPadding(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPaddingTop(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPaddingBottom(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPaddingLeft(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPaddingRight(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Table Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBorderCollapse(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderSpacing(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetCaptionSide(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetEmptyCells(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTableLayout(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetVerticalAlign(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Border Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBorderStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderBottomStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderLeftStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderRightStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderBottomWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderLeftWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderRightWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderBottomColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderLeftColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderRightColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderBottomColors(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderLeftColors(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderRightColors(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopColors(nsIDOMCSSValue** aValue);
|
2010-09-09 08:21:48 -07:00
|
|
|
nsresult DoGetBorderBottomLeftRadius(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderBottomRightRadius(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopLeftRadius(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderTopRightRadius(nsIDOMCSSValue** aValue);
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetFloatEdge(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetBorderImage(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-07-07 17:56:52 -07:00
|
|
|
/* Box Shadow */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBoxShadow(nsIDOMCSSValue** aValue);
|
2008-07-07 17:56:52 -07:00
|
|
|
|
2008-10-14 07:44:25 -07:00
|
|
|
/* Window Shadow */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetWindowShadow(nsIDOMCSSValue** aValue);
|
2008-10-14 07:44:25 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* Margin Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetMarginWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarginTopWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarginBottomWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarginLeftWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarginRightWidth(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Outline Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetOutline(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineOffset(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineRadiusBottomLeft(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineRadiusBottomRight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineRadiusTopLeft(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOutlineRadiusTopRight(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Content Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetContent(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetCounterIncrement(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetCounterReset(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarkerOffset(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-22 10:58:37 -07:00
|
|
|
/* Quotes Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetQuotes(nsIDOMCSSValue** aValue);
|
2007-07-22 10:58:37 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* z-index */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetZIndex(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* List properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetListStyleImage(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetListStylePosition(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetListStyleType(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetImageRegion(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Text Properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetLineHeight(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextAlign(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextDecoration(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextIndent(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextTransform(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextShadow(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetLetterSpacing(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetWordSpacing(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetWhiteSpace(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetWordWrap(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozTabSize(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Visibility properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetOpacity(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPointerEvents(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetVisibility(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Direction properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetDirection(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetUnicodeBidi(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Display properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetBinding(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetClear(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetCssFloat(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetDisplay(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPosition(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetClip(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOverflow(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOverflowX(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetOverflowY(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetResize(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPageBreakAfter(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetPageBreakBefore(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozTransform(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMozTransformOrigin(nsIDOMCSSValue **aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* User interface properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetCursor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetForceBrokenImageIcon(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetIMEMode(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetUserFocus(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetUserInput(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetUserModify(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetUserSelect(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Column properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetColumnCount(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColumnWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColumnGap(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColumnRuleWidth(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColumnRuleStyle(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColumnRuleColor(nsIDOMCSSValue** aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-08-20 14:52:47 -07:00
|
|
|
/* CSS Transitions */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetTransitionProperty(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTransitionDuration(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTransitionDelay(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue);
|
2009-08-20 14:52:47 -07:00
|
|
|
|
2007-07-21 07:20:25 -07:00
|
|
|
/* SVG properties */
|
2010-07-14 13:58:55 -07:00
|
|
|
nsresult DoGetFill(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStroke(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarkerEnd(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarkerMid(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMarkerStart(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeDasharray(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetStrokeDashoffset(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeWidth(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetFillOpacity(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFloodOpacity(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStopOpacity(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeMiterlimit(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeOpacity(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetClipRule(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFillRule(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeLinecap(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStrokeLinejoin(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextAnchor(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetColorInterpolation(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetColorInterpolationFilters(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetDominantBaseline(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetImageRendering(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetShapeRendering(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetTextRendering(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetFloodColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetLightingColor(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetStopColor(nsIDOMCSSValue** aValue);
|
|
|
|
|
|
|
|
nsresult DoGetClipPath(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetFilter(nsIDOMCSSValue** aValue);
|
|
|
|
nsresult DoGetMask(nsIDOMCSSValue** aValue);
|
2007-07-21 07:20:25 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
|
|
|
|
nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited);
|
|
|
|
nsresult SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
2009-08-21 13:39:25 -07:00
|
|
|
nsresult SetValueToStyleImage(const nsStyleImage& aStyleImage,
|
|
|
|
nsROCSSPrimitiveValue* aValue);
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* A method to get a percentage base for a percentage value. Returns PR_TRUE
|
|
|
|
* if a percentage base value was determined, PR_FALSE otherwise.
|
|
|
|
*/
|
|
|
|
typedef PRBool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to set aValue to aCoord. If aCoord is a percentage value and
|
|
|
|
* aPercentageBaseGetter is not null, aPercentageBaseGetter is called. If it
|
|
|
|
* returns PR_TRUE, the percentage base it outputs in its out param is used
|
|
|
|
* to compute an nscoord value. If the getter is null or returns PR_FALSE,
|
|
|
|
* 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
|
2009-09-16 08:01:36 -07:00
|
|
|
* passed in will be NS_MAX of the value in aMinAppUnits and the NS_MIN of
|
2007-04-23 00:04:33 -07:00
|
|
|
* the actual value in aCoord and the value in aMaxAppUnits.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* XXXbz should caller pass in some sort of bitfield indicating which units
|
|
|
|
* can be expected or something?
|
|
|
|
*/
|
2007-04-23 00:04:33 -07:00
|
|
|
void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
|
|
|
const nsStyleCoord& aCoord,
|
2010-09-09 08:21:46 -07:00
|
|
|
PRBool aClampNegativeCalc,
|
2007-03-22 10:30:00 -07:00
|
|
|
PercentageBaseGetter aPercentageBaseGetter = nsnull,
|
|
|
|
const PRInt32 aTable[] = nsnull,
|
2007-04-23 00:04:33 -07:00
|
|
|
nscoord aMinAppUnits = nscoord_MIN,
|
|
|
|
nscoord aMaxAppUnits = nscoord_MAX);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
|
2007-04-23 00:04:33 -07: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-03-22 10:30:00 -07:00
|
|
|
*/
|
2007-04-23 00:04:33 -07:00
|
|
|
nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
2010-09-09 08:21:46 -07:00
|
|
|
nscoord aDefaultValue,
|
|
|
|
PRBool aClampNegativeCalc);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
PRBool GetCBContentWidth(nscoord& aWidth);
|
|
|
|
PRBool GetCBContentHeight(nscoord& aWidth);
|
2008-09-13 02:42:11 -07:00
|
|
|
PRBool GetFrameBoundsWidthForTransform(nscoord &aWidth);
|
|
|
|
PRBool GetFrameBoundsHeightForTransform(nscoord &aHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool GetFrameBorderRectWidth(nscoord& aWidth);
|
2010-10-06 21:25:47 -07:00
|
|
|
PRBool GetFrameBorderRectHeight(nscoord& aHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
struct ComputedStyleMapEntry
|
|
|
|
{
|
|
|
|
// Create a pointer-to-member-function type.
|
|
|
|
typedef nsresult (nsComputedDOMStyle::*ComputeMethod)(nsIDOMCSSValue**);
|
|
|
|
|
|
|
|
nsCSSProperty mProperty;
|
|
|
|
ComputeMethod mGetter;
|
2009-02-24 16:14:45 -08:00
|
|
|
PRBool mNeedsLayoutFlush;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const ComputedStyleMapEntry* GetQueryablePropertyMap(PRUint32* aLength);
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
nsCOMPtr<nsIContent> mContent;
|
|
|
|
|
|
|
|
/*
|
2007-05-04 22:30:10 -07: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.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
nsRefPtr<nsStyleContext> mStyleContextHolder;
|
|
|
|
nsCOMPtr<nsIAtom> mPseudo;
|
|
|
|
|
|
|
|
/*
|
2008-01-29 13:53:09 -08:00
|
|
|
* While computing style data, the primary frame for mContent --- named "outer"
|
|
|
|
* because we should use it to compute positioning data. Null
|
2007-03-22 10:30:00 -07:00
|
|
|
* otherwise.
|
|
|
|
*/
|
2008-01-29 13:53:09 -08: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-04 22:30:10 -07:00
|
|
|
/*
|
|
|
|
* While computing style data, the presshell we're working with. Null
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
nsIPresShell* mPresShell;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-02 18:58:25 -07:00
|
|
|
PRPackedBool mExposeVisitedStyle;
|
|
|
|
|
2009-02-24 16:14:45 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool mFlushedPendingReflows;
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2010-04-27 09:15:01 -07:00
|
|
|
nsresult
|
2009-07-13 04:14:57 -07:00
|
|
|
NS_NewComputedDOMStyle(nsIDOMElement *aElement, const nsAString &aPseudoElt,
|
|
|
|
nsIPresShell *aPresShell,
|
|
|
|
nsComputedDOMStyle **aComputedStyle);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif /* nsComputedDOMStyle_h__ */
|
|
|
|
|