bug 798567 - convert css values to webidl r=bz

This commit is contained in:
Trevor Saunders 2012-10-01 12:49:41 -04:00
parent 82b1bd116e
commit a78d6c805a
27 changed files with 985 additions and 708 deletions

View File

@ -282,10 +282,8 @@
#include "nsIDOMMozCSSKeyframeRule.h"
#include "nsIDOMMozCSSKeyframesRule.h"
#include "nsIDOMCSSPageRule.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsDOMCSSValueList.h"
#define MOZ_GENERATED_EVENTS_INCLUDES
#include "GeneratedEvents.h"
#undef MOZ_GENERATED_EVENTS_INCLUDES
@ -1017,8 +1015,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSStyleSheet, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ROCSSPrimitiveValue, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
// Range classes
NS_DEFINE_CLASSINFO_DATA(Range, nsDOMGenericSH,
@ -1070,9 +1066,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(CSSRGBColor, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSValueList, nsCSSValueListSH,
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(ContentList, HTMLCollection,
nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -3006,14 +2999,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSStyleSheet)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ROCSSPrimitiveValue,
nsIDOMCSSPrimitiveValue)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSPrimitiveValue)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSValueList, nsIDOMCSSValueList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSValueList)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(CSSRect, nsIDOMRect)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMRect)
@ -10074,17 +10059,6 @@ nsStyleSheetListSH::GetItemAt(nsISupports *aNative, uint32_t aIndex,
}
// CSSValueList helper
nsISupports*
nsCSSValueListSH::GetItemAt(nsISupports *aNative, uint32_t aIndex,
nsWrapperCache **aCache, nsresult *aResult)
{
nsDOMCSSValueList* list = nsDOMCSSValueList::FromSupports(aNative);
return list->GetItemAt(aIndex);
}
// CSSRuleList scriptable helper
nsISupports*

View File

@ -1099,29 +1099,6 @@ public:
};
// CSSValueList helper
class nsCSSValueListSH : public nsArraySH
{
protected:
nsCSSValueListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
{
}
virtual ~nsCSSValueListSH()
{
}
virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex,
nsWrapperCache **aCache, nsresult *aResult);
public:
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsCSSValueListSH(aData);
}
};
// CSSRuleList helper
class nsCSSRuleListSH : public nsArraySH

View File

@ -128,7 +128,6 @@ DOMCI_CLASS(CSSGroupRuleRuleList)
DOMCI_CLASS(MediaList)
DOMCI_CLASS(StyleSheetList)
DOMCI_CLASS(CSSStyleSheet)
DOMCI_CLASS(ROCSSPrimitiveValue)
// Range classes
DOMCI_CLASS(Range)
@ -163,10 +162,6 @@ DOMCI_CLASS(ChromeWindow)
// RGBColor object used by getComputedStyle
DOMCI_CLASS(CSSRGBColor)
// CSSValueList object that represents an nsIDOMCSSValueList, used
// by DOM CSS
DOMCI_CLASS(CSSValueList)
// ContentList object used for various live NodeLists
DOMCI_CLASS(ContentList)

View File

@ -148,10 +148,22 @@ DOMInterfaces = {
'nativeType': 'nsDOMCSSDeclaration'
},
"CSSPrimitiveValue": {
"nativeType": "nsROCSSPrimitiveValue"
},
'CSSStyleDeclaration': {
'nativeType': 'nsICSSDeclaration'
},
"CSSValue": {
"concrete": False
},
"CSSValueList": {
"nativeType": "nsDOMCSSValueList",
},
'DelayNode': [
{
'resultNotAddRefed': [ 'delayTime' ],
@ -758,8 +770,8 @@ addExternalIface('Attr')
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('ClientRect')
addExternalIface("Counter")
addExternalIface('CSSRule')
addExternalIface('CSSValue')
addExternalIface('DocumentType', nativeType='nsIDOMDocumentType')
addExternalIface('DOMRequest')
addExternalIface('DOMStringList', nativeType='nsDOMStringList',
@ -780,6 +792,8 @@ addExternalIface('SVGNumber')
addExternalIface('SVGPathSeg')
addExternalIface('SVGPoint')
addExternalIface('SVGTransform')
addExternalIface("Rect")
addExternalIface("RGBColor")
addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h')
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',

View File

@ -67,7 +67,6 @@ interface nsIDOMHTMLHeadElement;
// CSS
interface nsIDOMCSSValue;
interface nsIDOMCSSValueList;
interface nsIDOMCSSPrimitiveValue;
interface nsIDOMCSSRule;
interface nsIDOMCSSRuleList;

View File

@ -21,7 +21,6 @@ SDK_XPIDLSRCS = \
nsIDOMCSSStyleDeclaration.idl \
nsIDOMCSSStyleSheet.idl \
nsIDOMCSSValue.idl \
nsIDOMCSSValueList.idl \
nsIDOMElementCSSInlineStyle.idl \
$(NULL)

View File

@ -1,20 +0,0 @@
/* 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/. */
#include "nsIDOMCSSValue.idl"
/**
* The nsIDOMCSSValueList interface is a datatype for a list of CSS
* values in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*/
[scriptable, uuid(8f09fa84-39b9-4dca-9b2f-db0eeb186286)]
interface nsIDOMCSSValueList : nsIDOMCSSValue
{
readonly attribute unsigned long length;
nsIDOMCSSValue item(in unsigned long index);
};

View File

@ -0,0 +1,58 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
interface Counter;
interface Rect;
interface RGBColor;
interface CSSPrimitiveValue : CSSValue {
// UnitTypes
const unsigned short CSS_UNKNOWN = 0;
const unsigned short CSS_NUMBER = 1;
const unsigned short CSS_PERCENTAGE = 2;
const unsigned short CSS_EMS = 3;
const unsigned short CSS_EXS = 4;
const unsigned short CSS_PX = 5;
const unsigned short CSS_CM = 6;
const unsigned short CSS_MM = 7;
const unsigned short CSS_IN = 8;
const unsigned short CSS_PT = 9;
const unsigned short CSS_PC = 10;
const unsigned short CSS_DEG = 11;
const unsigned short CSS_RAD = 12;
const unsigned short CSS_GRAD = 13;
const unsigned short CSS_MS = 14;
const unsigned short CSS_S = 15;
const unsigned short CSS_HZ = 16;
const unsigned short CSS_KHZ = 17;
const unsigned short CSS_DIMENSION = 18;
const unsigned short CSS_STRING = 19;
const unsigned short CSS_URI = 20;
const unsigned short CSS_IDENT = 21;
const unsigned short CSS_ATTR = 22;
const unsigned short CSS_COUNTER = 23;
const unsigned short CSS_RECT = 24;
const unsigned short CSS_RGBCOLOR = 25;
readonly attribute unsigned short primitiveType;
[Throws]
void setFloatValue(unsigned short unitType,
float floatValue);
[Throws]
float getFloatValue(unsigned short unitType);
[Throws]
void setStringValue(unsigned short stringType,
DOMString stringValue);
[Throws]
DOMString getStringValue();
[Throws]
Counter getCounterValue();
[Throws]
Rect getRectValue();
[Throws]
RGBColor getRGBColorValue();
};

View File

@ -8,7 +8,6 @@
*/
interface CSSRule;
interface CSSValue;
interface CSSStyleDeclaration {
[SetterThrows]
@ -21,7 +20,7 @@ interface CSSStyleDeclaration {
DOMString getPropertyValue(DOMString property);
// Mozilla extension, sort of
[Throws]
CSSValue getPropertyCSSValue(DOMString property);
CSSValue? getPropertyCSSValue(DOMString property);
DOMString getPropertyPriority(DOMString property);
// This would be nicer if it used a string default value of "".
// See bug 759622.

View File

@ -0,0 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
interface CSSValue {
// UnitTypes
const unsigned short CSS_INHERIT = 0;
const unsigned short CSS_PRIMITIVE_VALUE = 1;
const unsigned short CSS_VALUE_LIST = 2;
const unsigned short CSS_CUSTOM = 3;
[Throws]
attribute DOMString cssText;
readonly attribute unsigned short cssValueType;
};

View File

@ -0,0 +1,10 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
interface CSSValueList : CSSValue {
readonly attribute unsigned long length;
getter CSSValue item(unsigned long index);
};

View File

@ -21,7 +21,10 @@ webidl_files = \
Blob.webidl \
CanvasRenderingContext2D.webidl \
ClientRectList.webidl \
CSSPrimitiveValue.webidl \
CSSStyleDeclaration.webidl \
CSSValue.webidl \
CSSValueList.webidl \
DelayNode.webidl \
DOMImplementation.webidl \
DOMParser.webidl \

39
layout/style/CSSValue.h Normal file
View File

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
/* DOM object representing values in DOM computed style */
#ifndef mozilla_dom_CSSValue_h_
#define mozilla_dom_CSSValue_h_
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
#include "nsString.h"
class nsIDOMCSSValue;
class nsROCSSPrimitiveValue;
namespace mozilla {
namespace dom {
/**
* CSSValue - a DOM object representing values in DOM computed style.
*/
class CSSValue : public nsISupports,
public nsWrapperCache
{
public:
// CSSValue
virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) = 0;
virtual void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) = 0;
virtual uint16_t CssValueType() const = 0;
};
}
}
#endif

View File

@ -19,7 +19,7 @@ MODULE = layout
LIBRARY_NAME = gkstyle_s
LIBXUL_LIBRARY = 1
EXPORTS_NAMESPACES = mozilla/css
EXPORTS_NAMESPACES = mozilla/css mozilla/dom
EXPORTS = \
AnimationCommon.h \
@ -81,6 +81,10 @@ EXPORTS_mozilla/css = \
StyleRule.h \
$(NULL)
EXPORTS_mozilla/dom = \
CSSValue.h \
$(null)
CPPSRCS = \
AnimationCommon.cpp \
nsCSSAnonBoxes.cpp \

View File

@ -38,7 +38,7 @@
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
#include "StyleRule.h"
namespace css = mozilla::css;
using namespace mozilla;
#define IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_) \
/* virtual */ nsIDOMCSSRule* class_::GetDOMRule() \
@ -1619,12 +1619,13 @@ nsCSSFontFaceStyleDecl::GetPropertyValue(const nsAString & propertyName,
}
// nsIDOMCSSValue getPropertyCSSValue (in DOMString propertyName);
NS_IMETHODIMP
already_AddRefed<dom::CSSValue>
nsCSSFontFaceStyleDecl::GetPropertyCSSValue(const nsAString & propertyName,
nsIDOMCSSValue **aResult)
ErrorResult& aRv)
{
// ??? nsDOMCSSDeclaration returns null/NS_OK, but that seems wrong.
return NS_ERROR_NOT_IMPLEMENTED;
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
// DOMString removeProperty (in DOMString propertyName) raises (DOMException);

View File

@ -12,6 +12,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/css/GroupRule.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "nsIDOMCSSConditionRule.h"
#include "nsIDOMCSSFontFaceRule.h"
@ -183,8 +184,12 @@ class nsCSSFontFaceStyleDecl : public nsICSSDeclaration
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMCSSSTYLEDECLARATION
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
NS_DECL_NSICSSDECLARATION
virtual already_AddRefed<mozilla::dom::CSSValue>
GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
MOZ_OVERRIDE;
using nsICSSDeclaration::GetPropertyCSSValue;
nsCSSFontFaceStyleDecl()
{

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,7 @@
#include "mozilla/Attributes.h"
#include "nsDOMCSSDeclaration.h"
#include "nsROCSSPrimitiveValue.h"
#include "nsDOMCSSRGBColor.h"
#include "nsDOMCSSValueList.h"
#include "nsCSSProps.h"
#include "nsIContent.h"
@ -25,6 +23,8 @@
class nsIFrame;
class nsIPresShell;
class nsDOMCSSValueList;
class nsROCSSPrimitiveValue;
class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration
{
@ -35,7 +35,11 @@ public:
NS_DECL_NSICSSDECLARATION
NS_DECL_NSIDOMCSSSTYLEDECLARATION
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
virtual already_AddRefed<mozilla::dom::CSSValue>
GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
MOZ_OVERRIDE;
using nsIDOMCSSStyleDeclaration::GetPropertyCSSValue;
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName);
enum StyleType {
@ -101,41 +105,41 @@ private:
// that has just been created, but the refcount is still 0. Caller must take
// ownership.
nsIDOMCSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
uint8_t aFullCorner,
bool aIsBorder); // else outline
mozilla::dom::CSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
uint8_t aFullCorner,
bool aIsBorder); // else outline
nsIDOMCSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
nsIDOMCSSValue* GetRelativeOffset(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetRelativeOffset(mozilla::css::Side aSide);
nsIDOMCSSValue* GetStaticOffset(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetStaticOffset(mozilla::css::Side aSide);
nsIDOMCSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetBorderColorFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetBorderColorFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
mozilla::dom::CSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetSVGPaintFor(bool aFill);
mozilla::dom::CSSValue* GetSVGPaintFor(bool aFill);
bool GetLineHeightCoord(nscoord& aCoord);
nsIDOMCSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
const nscolor& aDefaultColor,
bool aIsBoxShadow);
mozilla::dom::CSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
const nscolor& aDefaultColor,
bool aIsBoxShadow);
nsIDOMCSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
uint32_t nsStyleBackground::* aCount,
const int32_t aTable[]);
mozilla::dom::CSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
uint32_t nsStyleBackground::* aCount,
const int32_t aTable[]);
void GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString);
@ -150,273 +154,273 @@ private:
* DoGetXXX instead of GetXXX.
*/
nsIDOMCSSValue* DoGetAppearance();
mozilla::dom::CSSValue* DoGetAppearance();
/* Box properties */
nsIDOMCSSValue* DoGetBoxAlign();
nsIDOMCSSValue* DoGetBoxDirection();
nsIDOMCSSValue* DoGetBoxFlex();
nsIDOMCSSValue* DoGetBoxOrdinalGroup();
nsIDOMCSSValue* DoGetBoxOrient();
nsIDOMCSSValue* DoGetBoxPack();
nsIDOMCSSValue* DoGetBoxSizing();
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();
nsIDOMCSSValue* DoGetWidth();
nsIDOMCSSValue* DoGetHeight();
nsIDOMCSSValue* DoGetMaxHeight();
nsIDOMCSSValue* DoGetMaxWidth();
nsIDOMCSSValue* DoGetMinHeight();
nsIDOMCSSValue* DoGetMinWidth();
nsIDOMCSSValue* DoGetLeft();
nsIDOMCSSValue* DoGetTop();
nsIDOMCSSValue* DoGetRight();
nsIDOMCSSValue* DoGetBottom();
nsIDOMCSSValue* DoGetStackSizing();
mozilla::dom::CSSValue* DoGetWidth();
mozilla::dom::CSSValue* DoGetHeight();
mozilla::dom::CSSValue* DoGetMaxHeight();
mozilla::dom::CSSValue* DoGetMaxWidth();
mozilla::dom::CSSValue* DoGetMinHeight();
mozilla::dom::CSSValue* DoGetMinWidth();
mozilla::dom::CSSValue* DoGetLeft();
mozilla::dom::CSSValue* DoGetTop();
mozilla::dom::CSSValue* DoGetRight();
mozilla::dom::CSSValue* DoGetBottom();
mozilla::dom::CSSValue* DoGetStackSizing();
/* Font properties */
nsIDOMCSSValue* DoGetColor();
nsIDOMCSSValue* DoGetFontFamily();
nsIDOMCSSValue* DoGetFontFeatureSettings();
nsIDOMCSSValue* DoGetFontLanguageOverride();
nsIDOMCSSValue* DoGetFontSize();
nsIDOMCSSValue* DoGetFontSizeAdjust();
nsIDOMCSSValue* DoGetFontStretch();
nsIDOMCSSValue* DoGetFontStyle();
nsIDOMCSSValue* DoGetFontWeight();
nsIDOMCSSValue* DoGetFontVariant();
mozilla::dom::CSSValue* DoGetColor();
mozilla::dom::CSSValue* DoGetFontFamily();
mozilla::dom::CSSValue* DoGetFontFeatureSettings();
mozilla::dom::CSSValue* DoGetFontLanguageOverride();
mozilla::dom::CSSValue* DoGetFontSize();
mozilla::dom::CSSValue* DoGetFontSizeAdjust();
mozilla::dom::CSSValue* DoGetFontStretch();
mozilla::dom::CSSValue* DoGetFontStyle();
mozilla::dom::CSSValue* DoGetFontWeight();
mozilla::dom::CSSValue* DoGetFontVariant();
/* Background properties */
nsIDOMCSSValue* DoGetBackgroundAttachment();
nsIDOMCSSValue* DoGetBackgroundColor();
nsIDOMCSSValue* DoGetBackgroundImage();
nsIDOMCSSValue* DoGetBackgroundPosition();
nsIDOMCSSValue* DoGetBackgroundRepeat();
nsIDOMCSSValue* DoGetBackgroundClip();
nsIDOMCSSValue* DoGetBackgroundInlinePolicy();
nsIDOMCSSValue* DoGetBackgroundOrigin();
nsIDOMCSSValue* DoGetBackgroundSize();
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();
/* Padding properties */
nsIDOMCSSValue* DoGetPaddingTop();
nsIDOMCSSValue* DoGetPaddingBottom();
nsIDOMCSSValue* DoGetPaddingLeft();
nsIDOMCSSValue* DoGetPaddingRight();
mozilla::dom::CSSValue* DoGetPaddingTop();
mozilla::dom::CSSValue* DoGetPaddingBottom();
mozilla::dom::CSSValue* DoGetPaddingLeft();
mozilla::dom::CSSValue* DoGetPaddingRight();
/* Table Properties */
nsIDOMCSSValue* DoGetBorderCollapse();
nsIDOMCSSValue* DoGetBorderSpacing();
nsIDOMCSSValue* DoGetCaptionSide();
nsIDOMCSSValue* DoGetEmptyCells();
nsIDOMCSSValue* DoGetTableLayout();
nsIDOMCSSValue* DoGetVerticalAlign();
mozilla::dom::CSSValue* DoGetBorderCollapse();
mozilla::dom::CSSValue* DoGetBorderSpacing();
mozilla::dom::CSSValue* DoGetCaptionSide();
mozilla::dom::CSSValue* DoGetEmptyCells();
mozilla::dom::CSSValue* DoGetTableLayout();
mozilla::dom::CSSValue* DoGetVerticalAlign();
/* Border Properties */
nsIDOMCSSValue* DoGetBorderTopStyle();
nsIDOMCSSValue* DoGetBorderBottomStyle();
nsIDOMCSSValue* DoGetBorderLeftStyle();
nsIDOMCSSValue* DoGetBorderRightStyle();
nsIDOMCSSValue* DoGetBorderTopWidth();
nsIDOMCSSValue* DoGetBorderBottomWidth();
nsIDOMCSSValue* DoGetBorderLeftWidth();
nsIDOMCSSValue* DoGetBorderRightWidth();
nsIDOMCSSValue* DoGetBorderTopColor();
nsIDOMCSSValue* DoGetBorderBottomColor();
nsIDOMCSSValue* DoGetBorderLeftColor();
nsIDOMCSSValue* DoGetBorderRightColor();
nsIDOMCSSValue* DoGetBorderBottomColors();
nsIDOMCSSValue* DoGetBorderLeftColors();
nsIDOMCSSValue* DoGetBorderRightColors();
nsIDOMCSSValue* DoGetBorderTopColors();
nsIDOMCSSValue* DoGetBorderBottomLeftRadius();
nsIDOMCSSValue* DoGetBorderBottomRightRadius();
nsIDOMCSSValue* DoGetBorderTopLeftRadius();
nsIDOMCSSValue* DoGetBorderTopRightRadius();
nsIDOMCSSValue* DoGetFloatEdge();
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();
/* Border Image */
nsIDOMCSSValue* DoGetBorderImageSource();
nsIDOMCSSValue* DoGetBorderImageSlice();
nsIDOMCSSValue* DoGetBorderImageWidth();
nsIDOMCSSValue* DoGetBorderImageOutset();
nsIDOMCSSValue* DoGetBorderImageRepeat();
mozilla::dom::CSSValue* DoGetBorderImageSource();
mozilla::dom::CSSValue* DoGetBorderImageSlice();
mozilla::dom::CSSValue* DoGetBorderImageWidth();
mozilla::dom::CSSValue* DoGetBorderImageOutset();
mozilla::dom::CSSValue* DoGetBorderImageRepeat();
/* Box Shadow */
nsIDOMCSSValue* DoGetBoxShadow();
mozilla::dom::CSSValue* DoGetBoxShadow();
/* Window Shadow */
nsIDOMCSSValue* DoGetWindowShadow();
mozilla::dom::CSSValue* DoGetWindowShadow();
/* Margin Properties */
nsIDOMCSSValue* DoGetMarginTopWidth();
nsIDOMCSSValue* DoGetMarginBottomWidth();
nsIDOMCSSValue* DoGetMarginLeftWidth();
nsIDOMCSSValue* DoGetMarginRightWidth();
mozilla::dom::CSSValue* DoGetMarginTopWidth();
mozilla::dom::CSSValue* DoGetMarginBottomWidth();
mozilla::dom::CSSValue* DoGetMarginLeftWidth();
mozilla::dom::CSSValue* DoGetMarginRightWidth();
/* Outline Properties */
nsIDOMCSSValue* DoGetOutlineWidth();
nsIDOMCSSValue* DoGetOutlineStyle();
nsIDOMCSSValue* DoGetOutlineColor();
nsIDOMCSSValue* DoGetOutlineOffset();
nsIDOMCSSValue* DoGetOutlineRadiusBottomLeft();
nsIDOMCSSValue* DoGetOutlineRadiusBottomRight();
nsIDOMCSSValue* DoGetOutlineRadiusTopLeft();
nsIDOMCSSValue* DoGetOutlineRadiusTopRight();
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();
/* Content Properties */
nsIDOMCSSValue* DoGetContent();
nsIDOMCSSValue* DoGetCounterIncrement();
nsIDOMCSSValue* DoGetCounterReset();
nsIDOMCSSValue* DoGetMarkerOffset();
mozilla::dom::CSSValue* DoGetContent();
mozilla::dom::CSSValue* DoGetCounterIncrement();
mozilla::dom::CSSValue* DoGetCounterReset();
mozilla::dom::CSSValue* DoGetMarkerOffset();
/* Quotes Properties */
nsIDOMCSSValue* DoGetQuotes();
mozilla::dom::CSSValue* DoGetQuotes();
/* z-index */
nsIDOMCSSValue* DoGetZIndex();
mozilla::dom::CSSValue* DoGetZIndex();
/* List properties */
nsIDOMCSSValue* DoGetListStyleImage();
nsIDOMCSSValue* DoGetListStylePosition();
nsIDOMCSSValue* DoGetListStyleType();
nsIDOMCSSValue* DoGetImageRegion();
mozilla::dom::CSSValue* DoGetListStyleImage();
mozilla::dom::CSSValue* DoGetListStylePosition();
mozilla::dom::CSSValue* DoGetListStyleType();
mozilla::dom::CSSValue* DoGetImageRegion();
/* Text Properties */
nsIDOMCSSValue* DoGetLineHeight();
nsIDOMCSSValue* DoGetTextAlign();
nsIDOMCSSValue* DoGetTextAlignLast();
nsIDOMCSSValue* DoGetMozTextBlink();
nsIDOMCSSValue* DoGetTextDecoration();
nsIDOMCSSValue* DoGetTextDecorationColor();
nsIDOMCSSValue* DoGetTextDecorationLine();
nsIDOMCSSValue* DoGetTextDecorationStyle();
nsIDOMCSSValue* DoGetTextIndent();
nsIDOMCSSValue* DoGetTextOverflow();
nsIDOMCSSValue* DoGetTextTransform();
nsIDOMCSSValue* DoGetTextShadow();
nsIDOMCSSValue* DoGetLetterSpacing();
nsIDOMCSSValue* DoGetWordSpacing();
nsIDOMCSSValue* DoGetWhiteSpace();
nsIDOMCSSValue* DoGetWordBreak();
nsIDOMCSSValue* DoGetWordWrap();
nsIDOMCSSValue* DoGetHyphens();
nsIDOMCSSValue* DoGetTabSize();
nsIDOMCSSValue* DoGetTextSizeAdjust();
mozilla::dom::CSSValue* DoGetLineHeight();
mozilla::dom::CSSValue* DoGetTextAlign();
mozilla::dom::CSSValue* DoGetTextAlignLast();
mozilla::dom::CSSValue* DoGetMozTextBlink();
mozilla::dom::CSSValue* DoGetTextDecoration();
mozilla::dom::CSSValue* DoGetTextDecorationColor();
mozilla::dom::CSSValue* DoGetTextDecorationLine();
mozilla::dom::CSSValue* DoGetTextDecorationStyle();
mozilla::dom::CSSValue* DoGetTextIndent();
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();
/* Visibility properties */
nsIDOMCSSValue* DoGetOpacity();
nsIDOMCSSValue* DoGetPointerEvents();
nsIDOMCSSValue* DoGetVisibility();
mozilla::dom::CSSValue* DoGetOpacity();
mozilla::dom::CSSValue* DoGetPointerEvents();
mozilla::dom::CSSValue* DoGetVisibility();
/* Direction properties */
nsIDOMCSSValue* DoGetDirection();
nsIDOMCSSValue* DoGetUnicodeBidi();
mozilla::dom::CSSValue* DoGetDirection();
mozilla::dom::CSSValue* DoGetUnicodeBidi();
/* Display properties */
nsIDOMCSSValue* DoGetBinding();
nsIDOMCSSValue* DoGetClear();
nsIDOMCSSValue* DoGetCssFloat();
nsIDOMCSSValue* DoGetDisplay();
nsIDOMCSSValue* DoGetPosition();
nsIDOMCSSValue* DoGetClip();
nsIDOMCSSValue* DoGetOverflow();
nsIDOMCSSValue* DoGetOverflowX();
nsIDOMCSSValue* DoGetOverflowY();
nsIDOMCSSValue* DoGetResize();
nsIDOMCSSValue* DoGetPageBreakAfter();
nsIDOMCSSValue* DoGetPageBreakBefore();
nsIDOMCSSValue* DoGetPageBreakInside();
nsIDOMCSSValue* DoGetTransform();
nsIDOMCSSValue* DoGetTransformOrigin();
nsIDOMCSSValue* DoGetPerspective();
nsIDOMCSSValue* DoGetBackfaceVisibility();
nsIDOMCSSValue* DoGetPerspectiveOrigin();
nsIDOMCSSValue* DoGetTransformStyle();
nsIDOMCSSValue* DoGetOrient();
mozilla::dom::CSSValue* DoGetBinding();
mozilla::dom::CSSValue* DoGetClear();
mozilla::dom::CSSValue* DoGetCssFloat();
mozilla::dom::CSSValue* DoGetDisplay();
mozilla::dom::CSSValue* DoGetPosition();
mozilla::dom::CSSValue* DoGetClip();
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();
/* User interface properties */
nsIDOMCSSValue* DoGetCursor();
nsIDOMCSSValue* DoGetForceBrokenImageIcon();
nsIDOMCSSValue* DoGetIMEMode();
nsIDOMCSSValue* DoGetUserFocus();
nsIDOMCSSValue* DoGetUserInput();
nsIDOMCSSValue* DoGetUserModify();
nsIDOMCSSValue* DoGetUserSelect();
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();
/* Column properties */
nsIDOMCSSValue* DoGetColumnCount();
nsIDOMCSSValue* DoGetColumnFill();
nsIDOMCSSValue* DoGetColumnWidth();
nsIDOMCSSValue* DoGetColumnGap();
nsIDOMCSSValue* DoGetColumnRuleWidth();
nsIDOMCSSValue* DoGetColumnRuleStyle();
nsIDOMCSSValue* DoGetColumnRuleColor();
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();
/* CSS Transitions */
nsIDOMCSSValue* DoGetTransitionProperty();
nsIDOMCSSValue* DoGetTransitionDuration();
nsIDOMCSSValue* DoGetTransitionDelay();
nsIDOMCSSValue* DoGetTransitionTimingFunction();
mozilla::dom::CSSValue* DoGetTransitionProperty();
mozilla::dom::CSSValue* DoGetTransitionDuration();
mozilla::dom::CSSValue* DoGetTransitionDelay();
mozilla::dom::CSSValue* DoGetTransitionTimingFunction();
/* CSS Animations */
nsIDOMCSSValue* DoGetAnimationName();
nsIDOMCSSValue* DoGetAnimationDuration();
nsIDOMCSSValue* DoGetAnimationDelay();
nsIDOMCSSValue* DoGetAnimationTimingFunction();
nsIDOMCSSValue* DoGetAnimationDirection();
nsIDOMCSSValue* DoGetAnimationFillMode();
nsIDOMCSSValue* DoGetAnimationIterationCount();
nsIDOMCSSValue* DoGetAnimationPlayState();
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();
#ifdef MOZ_FLEXBOX
/* CSS Flexbox properties */
nsIDOMCSSValue* DoGetAlignItems();
nsIDOMCSSValue* DoGetAlignSelf();
nsIDOMCSSValue* DoGetFlexBasis();
nsIDOMCSSValue* DoGetFlexDirection();
nsIDOMCSSValue* DoGetFlexGrow();
nsIDOMCSSValue* DoGetFlexShrink();
nsIDOMCSSValue* DoGetOrder();
nsIDOMCSSValue* DoGetJustifyContent();
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();
#endif // MOZ_FLEXBOX
/* SVG properties */
nsIDOMCSSValue* DoGetFill();
nsIDOMCSSValue* DoGetStroke();
nsIDOMCSSValue* DoGetMarkerEnd();
nsIDOMCSSValue* DoGetMarkerMid();
nsIDOMCSSValue* DoGetMarkerStart();
nsIDOMCSSValue* DoGetStrokeDasharray();
mozilla::dom::CSSValue* DoGetFill();
mozilla::dom::CSSValue* DoGetStroke();
mozilla::dom::CSSValue* DoGetMarkerEnd();
mozilla::dom::CSSValue* DoGetMarkerMid();
mozilla::dom::CSSValue* DoGetMarkerStart();
mozilla::dom::CSSValue* DoGetStrokeDasharray();
nsIDOMCSSValue* DoGetStrokeDashoffset();
nsIDOMCSSValue* DoGetStrokeWidth();
nsIDOMCSSValue* DoGetVectorEffect();
mozilla::dom::CSSValue* DoGetStrokeDashoffset();
mozilla::dom::CSSValue* DoGetStrokeWidth();
mozilla::dom::CSSValue* DoGetVectorEffect();
nsIDOMCSSValue* DoGetFillOpacity();
nsIDOMCSSValue* DoGetFloodOpacity();
nsIDOMCSSValue* DoGetStopOpacity();
nsIDOMCSSValue* DoGetStrokeMiterlimit();
nsIDOMCSSValue* DoGetStrokeOpacity();
mozilla::dom::CSSValue* DoGetFillOpacity();
mozilla::dom::CSSValue* DoGetFloodOpacity();
mozilla::dom::CSSValue* DoGetStopOpacity();
mozilla::dom::CSSValue* DoGetStrokeMiterlimit();
mozilla::dom::CSSValue* DoGetStrokeOpacity();
nsIDOMCSSValue* DoGetClipRule();
nsIDOMCSSValue* DoGetFillRule();
nsIDOMCSSValue* DoGetStrokeLinecap();
nsIDOMCSSValue* DoGetStrokeLinejoin();
nsIDOMCSSValue* DoGetTextAnchor();
mozilla::dom::CSSValue* DoGetClipRule();
mozilla::dom::CSSValue* DoGetFillRule();
mozilla::dom::CSSValue* DoGetStrokeLinecap();
mozilla::dom::CSSValue* DoGetStrokeLinejoin();
mozilla::dom::CSSValue* DoGetTextAnchor();
nsIDOMCSSValue* DoGetColorInterpolation();
nsIDOMCSSValue* DoGetColorInterpolationFilters();
nsIDOMCSSValue* DoGetDominantBaseline();
nsIDOMCSSValue* DoGetImageRendering();
nsIDOMCSSValue* DoGetShapeRendering();
nsIDOMCSSValue* DoGetTextRendering();
mozilla::dom::CSSValue* DoGetColorInterpolation();
mozilla::dom::CSSValue* DoGetColorInterpolationFilters();
mozilla::dom::CSSValue* DoGetDominantBaseline();
mozilla::dom::CSSValue* DoGetImageRendering();
mozilla::dom::CSSValue* DoGetShapeRendering();
mozilla::dom::CSSValue* DoGetTextRendering();
nsIDOMCSSValue* DoGetFloodColor();
nsIDOMCSSValue* DoGetLightingColor();
nsIDOMCSSValue* DoGetStopColor();
mozilla::dom::CSSValue* DoGetFloodColor();
mozilla::dom::CSSValue* DoGetLightingColor();
mozilla::dom::CSSValue* DoGetStopColor();
nsIDOMCSSValue* DoGetClipPath();
nsIDOMCSSValue* DoGetFilter();
nsIDOMCSSValue* DoGetMask();
mozilla::dom::CSSValue* DoGetClipPath();
mozilla::dom::CSSValue* DoGetFilter();
mozilla::dom::CSSValue* DoGetMask();
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
nsDOMCSSValueList* GetROCSSValueList(bool aCommaDelimited);
@ -473,7 +477,7 @@ private:
struct ComputedStyleMapEntry
{
// Create a pointer-to-member-function type.
typedef nsIDOMCSSValue* (nsComputedDOMStyle::*ComputeMethod)();
typedef mozilla::dom::CSSValue* (nsComputedDOMStyle::*ComputeMethod)();
nsCSSProperty mProperty;
ComputeMethod mGetter;

View File

@ -20,7 +20,7 @@
#include "nsIPrincipal.h"
#include "mozAutoDocUpdate.h"
namespace css = mozilla::css;
using namespace mozilla;
nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
{
@ -127,16 +127,12 @@ nsDOMCSSDeclaration::GetLength(uint32_t* aLength)
return NS_OK;
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName,
nsIDOMCSSValue** aReturn)
already_AddRefed<dom::CSSValue>
nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
{
NS_ENSURE_ARG_POINTER(aReturn);
// We don't support CSSValue yet so we'll just return null...
*aReturn = nullptr;
return NS_OK;
return nullptr;
}
void

View File

@ -48,8 +48,10 @@ public:
NS_IMETHOD SetCssText(const nsAString & aCssText) MOZ_OVERRIDE;
NS_IMETHOD GetPropertyValue(const nsAString & propertyName,
nsAString & _retval) MOZ_OVERRIDE;
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName,
nsIDOMCSSValue **_retval) MOZ_OVERRIDE;
virtual already_AddRefed<mozilla::dom::CSSValue>
GetPropertyCSSValue(const nsAString & propertyName,
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
using nsICSSDeclaration::GetPropertyCSSValue;
NS_IMETHOD RemoveProperty(const nsAString & propertyName,
nsAString & _retval);
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName,

View File

@ -6,58 +6,46 @@
#include "nsDOMCSSValueList.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/CSSValueListBinding.h"
#include "nsError.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
using namespace mozilla;
nsDOMCSSValueList::nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly)
: mCommaDelimited(aCommaDelimited), mReadonly(aReadonly)
: CSSValue(), mCommaDelimited(aCommaDelimited), mReadonly(aReadonly)
{
SetIsDOMBinding();
}
nsDOMCSSValueList::~nsDOMCSSValueList()
{
}
NS_IMPL_ADDREF(nsDOMCSSValueList)
NS_IMPL_RELEASE(nsDOMCSSValueList)
DOMCI_DATA(CSSValueList, nsDOMCSSValueList)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSValueList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSValueList)
// QueryInterface implementation for nsDOMCSSValueList
NS_INTERFACE_MAP_BEGIN(nsDOMCSSValueList)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValueList)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSValueList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSValueList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMCSSValueList, mCSSValues)
JSObject*
nsDOMCSSValueList::WrapObject(JSContext *cx, JSObject *scope, bool *tried)
{
return dom::CSSValueListBinding::Wrap(cx, scope, this, tried);
}
void
nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue)
nsDOMCSSValueList::AppendCSSValue(CSSValue* aValue)
{
mCSSValues.AppendElement(aValue);
}
// nsIDOMCSSValueList
NS_IMETHODIMP
nsDOMCSSValueList::GetLength(uint32_t* aLength)
{
*aLength = mCSSValues.Length();
return NS_OK;
}
NS_IMETHODIMP
nsDOMCSSValueList::Item(uint32_t aIndex, nsIDOMCSSValue **aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
NS_IF_ADDREF(*aReturn = GetItemAt(aIndex));
return NS_OK;
}
// nsIDOMCSSValue
NS_IMETHODIMP
@ -75,13 +63,13 @@ nsDOMCSSValueList::GetCssText(nsAString& aCssText)
separator.Assign(PRUnichar(' '));
}
nsCOMPtr<nsIDOMCSSValue> cssValue;
nsAutoString tmpStr;
for (uint32_t i = 0; i < count; ++i) {
cssValue = mCSSValues[i];
CSSValue *cssValue = mCSSValues[i];
NS_ASSERTION(cssValue, "Eek! Someone filled the value list with null CSSValues!");
ErrorResult dummy;
if (cssValue) {
cssValue->GetCssText(tmpStr);
cssValue->GetCssText(tmpStr, dummy);
if (tmpStr.IsEmpty()) {
@ -104,6 +92,12 @@ nsDOMCSSValueList::GetCssText(nsAString& aCssText)
return NS_OK;
}
void
nsDOMCSSValueList::GetCssText(nsString& aText, ErrorResult& aRv)
{
aRv = GetCssText(aText);
}
NS_IMETHODIMP
nsDOMCSSValueList::SetCssText(const nsAString& aCssText)
{
@ -115,6 +109,11 @@ nsDOMCSSValueList::SetCssText(const nsAString& aCssText)
return NS_OK;
}
void
nsDOMCSSValueList::SetCssText(const nsAString& aText, ErrorResult& aRv)
{
aRv = SetCssText(aText);
}
NS_IMETHODIMP
nsDOMCSSValueList::GetCssValueType(uint16_t* aValueType)
@ -124,3 +123,8 @@ nsDOMCSSValueList::GetCssValueType(uint16_t* aValueType)
return NS_OK;
}
uint16_t
nsDOMCSSValueList::CssValueType() const
{
return nsIDOMCSSValue::CSS_VALUE_LIST;
}

View File

@ -8,54 +8,60 @@
#define nsDOMCSSValueList_h___
#include "nsIDOMCSSValue.h"
#include "nsIDOMCSSValueList.h"
#include "CSSValue.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
class nsComputedDOMStyle;
#include "nsCOMPtr.h"
class nsDOMCSSValueList : public nsIDOMCSSValueList
class nsDOMCSSValueList MOZ_FINAL : public mozilla::dom::CSSValue,
public nsIDOMCSSValue
{
public:
NS_DECL_ISUPPORTS
// nsIDOMCSSValueList
NS_DECL_NSIDOMCSSVALUELIST
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue)
// nsIDOMCSSValue
NS_DECL_NSIDOMCSSVALUE
// nsDOMCSSValueList
nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
virtual ~nsDOMCSSValueList();
~nsDOMCSSValueList();
/**
* Adds a value to this list.
*/
void AppendCSSValue(nsIDOMCSSValue* aValue);
void AppendCSSValue(CSSValue* aValue);
nsIDOMCSSValue* GetItemAt(uint32_t aIndex)
virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv)
MOZ_OVERRIDE MOZ_FINAL;
virtual void SetCssText(const nsAString& aText,
mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL;
virtual uint16_t CssValueType() const MOZ_OVERRIDE MOZ_FINAL;
CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const
{
return mCSSValues.SafeElementAt(aIndex, nullptr);
aFound = aIdx <= Length();
return Item(aIdx);
}
static nsDOMCSSValueList* FromSupports(nsISupports* aSupports)
CSSValue* Item(uint32_t aIndex) const
{
#ifdef DEBUG
{
nsCOMPtr<nsIDOMCSSValueList> list_qi = do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMCSSValueList pointer as the nsISupports
// pointer. That must be fixed, or we'll crash...
NS_ASSERTION(list_qi == static_cast<nsIDOMCSSValueList*>(aSupports),
"Uh, fix QI!");
}
#endif
return static_cast<nsDOMCSSValueList*>(aSupports);
return mCSSValues.SafeElementAt(aIndex);
}
uint32_t Length() const
{
return mCSSValues.Length();
}
nsISupports* GetParentObject()
{
return nullptr;
}
virtual JSObject *WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
private:
bool mCommaDelimited; // some value lists use a comma
// as the delimiter, some just use
@ -63,8 +69,7 @@ private:
bool mReadonly; // Are we read-only?
InfallibleTArray<nsCOMPtr<nsIDOMCSSValue> > mCSSValues;
InfallibleTArray<nsRefPtr<CSSValue> > mCSSValues;
};
#endif /* nsDOMCSSValueList_h___ */

View File

@ -21,6 +21,7 @@
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsCSSProperty.h"
#include "CSSValue.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/BindingUtils.h"
#include "nsString.h"
@ -64,8 +65,21 @@ public:
NS_IMETHOD SetCssText(const nsAString& aCssText) = 0;
NS_IMETHOD GetPropertyValue(const nsAString& aPropName,
nsAString& aValue) = 0;
NS_IMETHOD GetPropertyCSSValue(const nsAString& aPropertyName,
nsIDOMCSSValue** aReturn) = 0;
virtual already_AddRefed<mozilla::dom::CSSValue>
GetPropertyCSSValue(const nsAString& aPropertyName,
mozilla::ErrorResult& aRv) = 0;
NS_IMETHOD GetPropertyCSSValue(const nsAString& aProp, nsIDOMCSSValue** aVal)
{
mozilla::ErrorResult error;
nsRefPtr<mozilla::dom::CSSValue> val = GetPropertyCSSValue(aProp, error);
if (error.Failed()) {
return error.ErrorCode();
}
nsCOMPtr<nsIDOMCSSValue> xpVal = do_QueryInterface(val);
xpVal.forget(aVal);
return NS_OK;
}
NS_IMETHOD RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn) = 0;
NS_IMETHOD GetPropertyPriority(const nsAString& aPropertyName,
@ -110,12 +124,6 @@ public:
mozilla::ErrorResult& rv) {
rv = GetPropertyValue(aPropName, aValue);
}
already_AddRefed<nsIDOMCSSValue>
GetPropertyCSSValue(const nsAString& aPropName, mozilla::ErrorResult& rv) {
nsCOMPtr<nsIDOMCSSValue> val;
rv = GetPropertyCSSValue(aPropName, getter_AddRefs(val));
return val.forget();
}
void GetPropertyPriority(const nsAString& aPropName, nsString& aPriority) {
GetPropertyPriority(aPropName, static_cast<nsAString&>(aPriority));
}
@ -148,4 +156,15 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID)
NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, \
const nsAString& aValue);
#define NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER \
NS_IMETHOD GetCssText(nsAString & aCssText); \
NS_IMETHOD SetCssText(const nsAString & aCssText); \
NS_IMETHOD GetPropertyValue(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD RemoveProperty(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority); \
NS_IMETHOD GetLength(uint32_t *aLength); \
NS_IMETHOD Item(uint32_t index, nsAString & _retval); \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule);
#endif // nsICSSDeclaration_h__

View File

@ -7,18 +7,22 @@
#include "nsROCSSPrimitiveValue.h"
#include "nsContentUtils.h"
#include "mozilla/dom/CSSPrimitiveValueBinding.h"
#include "nsPresContext.h"
#include "nsStyleUtil.h"
#include "nsDOMCSSRGBColor.h"
#include "nsIDOMRect.h"
#include "nsDOMClassInfoID.h" // DOMCI_DATA
#include "nsIURI.h"
#include "nsError.h"
using namespace mozilla;
nsROCSSPrimitiveValue::nsROCSSPrimitiveValue()
: mType(CSS_PX)
: CSSValue(), mType(CSS_PX)
{
mValue.mAppUnits = 0;
SetIsDOMBinding();
}
@ -27,20 +31,43 @@ nsROCSSPrimitiveValue::~nsROCSSPrimitiveValue()
Reset();
}
NS_IMPL_ADDREF(nsROCSSPrimitiveValue)
NS_IMPL_RELEASE(nsROCSSPrimitiveValue)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsROCSSPrimitiveValue)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsROCSSPrimitiveValue)
DOMCI_DATA(ROCSSPrimitiveValue, nsROCSSPrimitiveValue)
// QueryInterface implementation for nsROCSSPrimitiveValue
NS_INTERFACE_MAP_BEGIN(nsROCSSPrimitiveValue)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsROCSSPrimitiveValue)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSPrimitiveValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ROCSSPrimitiveValue)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_CLASS(nsROCSSPrimitiveValue)
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsROCSSPrimitiveValue)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsROCSSPrimitiveValue)
if (tmp->mType == CSS_URI) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mURI)
} else if (tmp->mType == CSS_RGBCOLOR) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mColor)
} else if (tmp->mType == CSS_RECT) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mRect)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsROCSSPrimitiveValue)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
tmp->Reset();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
JSObject*
nsROCSSPrimitiveValue::WrapObject(JSContext *cx, JSObject *scope,
bool *triedToWrap)
{
return dom::CSSPrimitiveValueBinding::Wrap(cx, scope, this, triedToWrap);
}
// nsIDOMCSSValue
@ -235,6 +262,11 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
return NS_OK;
}
void
nsROCSSPrimitiveValue::GetCssText(nsString& aText, ErrorResult& aRv)
{
aRv = GetCssText(aText);
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::SetCssText(const nsAString& aCssText)
@ -242,6 +274,12 @@ nsROCSSPrimitiveValue::SetCssText(const nsAString& aCssText)
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
void
nsROCSSPrimitiveValue::SetCssText(const nsAString& aText, ErrorResult& aRv)
{
aRv = SetCssText(aText);
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetCssValueType(uint16_t* aValueType)
@ -251,6 +289,12 @@ nsROCSSPrimitiveValue::GetCssValueType(uint16_t* aValueType)
return NS_OK;
}
uint16_t
nsROCSSPrimitiveValue::CssValueType() const
{
return nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
}
// nsIDOMCSSPrimitiveValue
@ -270,57 +314,68 @@ nsROCSSPrimitiveValue::SetFloatValue(uint16_t aUnitType, float aFloatValue)
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetFloatValue(uint16_t aUnitType, float* aReturn)
void
nsROCSSPrimitiveValue::SetFloatValue(uint16_t aType, float aVal,
ErrorResult& aRv)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = 0;
aRv = SetFloatValue(aType, aVal);
}
float
nsROCSSPrimitiveValue::GetFloatValue(uint16_t aUnitType, ErrorResult& aRv)
{
switch(aUnitType) {
case CSS_PX :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = nsPresContext::AppUnitsToFloatCSSPixels(mValue.mAppUnits);
if (mType == CSS_PX) {
return nsPresContext::AppUnitsToFloatCSSPixels(mValue.mAppUnits);
}
break;
case CSS_CM :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mAppUnits * CM_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
if (mType == CSS_PX) {
return mValue.mAppUnits * CM_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
}
break;
case CSS_MM :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mAppUnits * MM_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
if (mType == CSS_PX) {
return mValue.mAppUnits * MM_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
}
break;
case CSS_IN :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mAppUnits / nsPresContext::AppUnitsPerCSSInch();
if (mType == CSS_PX) {
return mValue.mAppUnits / nsPresContext::AppUnitsPerCSSInch();
}
break;
case CSS_PT :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mAppUnits * POINTS_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
if (mType == CSS_PX) {
return mValue.mAppUnits * POINTS_PER_INCH_FLOAT /
nsPresContext::AppUnitsPerCSSInch();
}
break;
case CSS_PC :
if (mType != CSS_PX)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mAppUnits * 6.0f /
nsPresContext::AppUnitsPerCSSInch();
if (mType == CSS_PX) {
return mValue.mAppUnits * 6.0f /
nsPresContext::AppUnitsPerCSSInch();
}
break;
case CSS_PERCENTAGE :
if (mType != CSS_PERCENTAGE)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mFloat * 100;
if (mType == CSS_PERCENTAGE) {
return mValue.mFloat * 100;
}
break;
case CSS_NUMBER :
if (mType != CSS_NUMBER)
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
*aReturn = mValue.mFloat;
if (mType == CSS_NUMBER) {
return mValue.mFloat;
}
break;
case CSS_UNKNOWN :
case CSS_EMS :
@ -340,10 +395,19 @@ nsROCSSPrimitiveValue::GetFloatValue(uint16_t aUnitType, float* aReturn)
case CSS_COUNTER :
case CSS_RECT :
case CSS_RGBCOLOR :
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
break;
}
return NS_OK;
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return 0;
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetFloatValue(uint16_t aType, float *aVal)
{
ErrorResult rv;
*aVal = GetFloatValue(aType, rv);
return rv.ErrorCode();
}
@ -354,6 +418,13 @@ nsROCSSPrimitiveValue::SetStringValue(uint16_t aStringType,
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
void
nsROCSSPrimitiveValue::SetStringValue(uint16_t aType, const nsAString& aString,
mozilla::ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetStringValue(nsAString& aReturn)
@ -379,6 +450,12 @@ nsROCSSPrimitiveValue::GetStringValue(nsAString& aReturn)
return NS_OK;
}
void
nsROCSSPrimitiveValue::GetStringValue(nsString& aString, ErrorResult& aRv)
{
aRv = GetStringValue(aString);
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetCounterValue(nsIDOMCounter** aReturn)
@ -386,30 +463,52 @@ nsROCSSPrimitiveValue::GetCounterValue(nsIDOMCounter** aReturn)
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetRectValue(nsIDOMRect** aReturn)
already_AddRefed<nsIDOMCounter>
nsROCSSPrimitiveValue::GetCounterValue(ErrorResult& aRv)
{
if (mType != CSS_RECT) {
*aReturn = nullptr;
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
}
NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
NS_ADDREF(*aReturn = mValue.mRect);
return NS_OK;
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
already_AddRefed<nsIDOMRect>
nsROCSSPrimitiveValue::GetRectValue(ErrorResult& aRv)
{
if (mType != CSS_RECT) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return nullptr;
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor** aReturn)
NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
NS_ADDREF(mValue.mRect);
return mValue.mRect;
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetRectValue(nsIDOMRect** aRect)
{
ErrorResult error;
*aRect = GetRectValue(error).get();
return error.ErrorCode();
}
NS_IMETHODIMP
nsROCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor** aColor)
{
ErrorResult error;
*aColor = GetRGBColorValue(error).get();
return error.ErrorCode();
}
already_AddRefed<nsIDOMRGBColor>
nsROCSSPrimitiveValue::GetRGBColorValue(ErrorResult& aRv)
{
if (mType != CSS_RGBCOLOR) {
*aReturn = nullptr;
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return nullptr;
}
NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
NS_ADDREF(*aReturn = mValue.mColor);
return NS_OK;
NS_ADDREF(mValue.mColor);
return mValue.mColor;
}
void

View File

@ -8,21 +8,28 @@
#ifndef nsROCSSPrimitiveValue_h___
#define nsROCSSPrimitiveValue_h___
#include "nsIDOMCSSValue.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsCoord.h"
#include "nsCSSKeywords.h"
#include "CSSValue.h"
#include "nsAutoPtr.h"
#include "nsCoord.h"
#include "nsWrapperCache.h"
class nsIURI;
class nsComputedDOMStyle;
class nsDOMCSSRGBColor;
/**
* Read-only CSS primitive value - a DOM object representing values in DOM
* computed style.
*/
class nsROCSSPrimitiveValue : public nsIDOMCSSPrimitiveValue
class nsROCSSPrimitiveValue MOZ_FINAL : public mozilla::dom::CSSValue,
public nsIDOMCSSPrimitiveValue
{
public:
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsROCSSPrimitiveValue, mozilla::dom::CSSValue)
// nsIDOMCSSPrimitiveValue
NS_DECL_NSIDOMCSSPRIMITIVEVALUE
@ -30,9 +37,29 @@ public:
// nsIDOMCSSValue
NS_DECL_NSIDOMCSSVALUE
// CSSValue
virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL;
virtual void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL;
virtual uint16_t CssValueType() const MOZ_OVERRIDE MOZ_FINAL;
// CSSPrimitiveValue
uint16_t PrimitiveType()
{
return mType;
}
void SetFloatValue(uint16_t aUnitType, float aValue,
mozilla::ErrorResult& aRv);
float GetFloatValue(uint16_t aUnitType, mozilla::ErrorResult& aRv);
void GetStringValue(nsString& aString, mozilla::ErrorResult& aRv);
void SetStringValue(uint16_t aUnitType, const nsAString& aString,
mozilla::ErrorResult& aRv);
already_AddRefed<nsIDOMCounter> GetCounterValue(mozilla::ErrorResult& aRv);
already_AddRefed<nsIDOMRect> GetRectValue(mozilla::ErrorResult& aRv);
already_AddRefed<nsIDOMRGBColor> GetRGBColorValue(mozilla::ErrorResult& aRv);
// nsROCSSPrimitiveValue
nsROCSSPrimitiveValue();
virtual ~nsROCSSPrimitiveValue();
~nsROCSSPrimitiveValue();
void SetNumber(float aValue);
void SetNumber(int32_t aValue);
@ -51,6 +78,13 @@ public:
void SetTime(float aValue);
void Reset();
nsISupports* GetParentObject() const
{
return nullptr;
}
virtual JSObject *WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
private:
uint16_t mType;

View File

@ -87,6 +87,7 @@ MOCHITEST_FILES = test_acid3_test46.html \
file_bug645998-2.css \
test_bug716226.html \
test_bug765590.html \
test_bug798567.html \
test_cascade.html \
test_ch_ex_no_infloops.html \
test_compute_data_with_start_struct.html \

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=798567
-->
<head>
<title>Test for Bug 798567</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="some_div" style="opacity: 0.5">bar</div>
<div style="cursor: crosshair" id="div_cursor">foobar</div>
<script type="application/javascript">
var elm = document.getElementById("some_div");
var cs = getComputedStyle(elm);
var cssValue = cs.getPropertyCSSValue("opacity");
is(cssValue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER), 0.5, "wrong opacity of some_div");
elm = document.getElementById("div_cursor");
cs = getComputedStyle(elm);
cssValue = cs.getPropertyCSSValue("cursor");
ok(cssValue[0], "element with set cursor should have a a computed style");
</script>
</body>
</html>