Bug 824481 - Cleanup style attribute getters; r=bz

This commit is contained in:
Ms2ger 2013-01-11 09:42:59 +01:00
parent 3e0e3f785c
commit effe119b3d
10 changed files with 11 additions and 40 deletions

View File

@ -191,7 +191,7 @@ nsStyledElementNotElementCSSInlineStyle::GetInlineStyleRule()
// Others and helpers
nsICSSDeclaration*
nsStyledElementNotElementCSSInlineStyle::GetStyle(nsresult* retval)
nsStyledElementNotElementCSSInlineStyle::Style()
{
Element::nsDOMSlots *slots = DOMSlots();
@ -203,7 +203,6 @@ nsStyledElementNotElementCSSInlineStyle::GetStyle(nsresult* retval)
SetMayHaveStyle();
}
*retval = NS_OK;
return slots->mStyle;
}

View File

@ -50,7 +50,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
const nsAttrValue* aValue, bool aNotify);
nsICSSDeclaration* GetStyle(nsresult* retval);
nsICSSDeclaration* Style();
protected:

View File

@ -233,9 +233,8 @@ class nsGenericHTMLElementTearoff : public nsIDOMElementCSSInlineStyle
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
mozilla::ErrorResult rv;
NS_IF_ADDREF(*aStyle = mElement->GetStyle(rv));
return rv.ErrorCode();
NS_ADDREF(*aStyle = mElement->Style());
return NS_OK;
}
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGenericHTMLElementTearoff,

View File

@ -229,15 +229,6 @@ public:
: NS_LITERAL_STRING("false"),
aError);
}
nsICSSDeclaration* GetStyle(mozilla::ErrorResult& aError)
{
nsresult rv;
nsICSSDeclaration* style = nsMappedAttributeElement::GetStyle(&rv);
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return style;
}
/**
* Determine whether an attribute is an event (onclick, etc.)

View File

@ -102,22 +102,8 @@ nsSVGElement::GetClassName(nsIDOMSVGAnimatedString** aClassName)
NS_IMETHODIMP
nsSVGElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
ErrorResult rv;
NS_ADDREF(*aStyle = GetStyle(rv));
return rv.ErrorCode();
}
nsICSSDeclaration*
nsSVGElement::GetStyle(ErrorResult& rv)
{
nsresult res;
nsICSSDeclaration* style = nsSVGElementBase::GetStyle(&res);
if (NS_FAILED(res)) {
rv.Throw(res);
return nullptr;
}
return style;
NS_ADDREF(*aStyle = Style());
return NS_OK;
}
//----------------------------------------------------------------------

View File

@ -301,7 +301,6 @@ public:
mozilla::dom::SVGSVGElement* GetOwnerSVGElement(mozilla::ErrorResult& rv);
nsSVGElement* GetViewportElement();
already_AddRefed<nsIDOMSVGAnimatedString> ClassName();
nsICSSDeclaration* GetStyle(mozilla::ErrorResult& rv);
already_AddRefed<mozilla::dom::CSSValue> GetPresentationAttribute(const nsAString& aName, mozilla::ErrorResult& rv);
protected:
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap);

View File

@ -136,10 +136,8 @@ public:
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
nsresult rv;
*aStyle = static_cast<nsXULElement*>(mElement.get())->GetStyle(&rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aStyle);
nsXULElement* element = static_cast<nsXULElement*>(mElement.get());
NS_ADDREF(*aStyle = element->Style());
return NS_OK;
}
NS_FORWARD_NSIFRAMELOADEROWNER(static_cast<nsXULElement*>(mElement.get())->)

View File

@ -73,7 +73,7 @@ interface HTMLElement : Element {
//readonly attribute boolean? commandChecked;
// styling
[Throws, Constant]
[Constant]
readonly attribute CSSStyleDeclaration style;
// event handler IDL attributes

View File

@ -18,7 +18,6 @@ interface SVGElement : Element {
attribute DOMString xmlbase; */
readonly attribute SVGAnimatedString className;
[Throws]
readonly attribute CSSStyleDeclaration style;
// The CSSValue interface has been deprecated by the CSS WG.

View File

@ -360,8 +360,8 @@ customMethodCalls = {
' don\'t actually implement GetStyle. */\n'
' if (self->GetNameSpaceID() == kNameSpaceID_MathML)\n'
' return xpc_qsThrow(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n'
' nsIDOMCSSStyleDeclaration* result = '
'self->GetStyle(&rv);'
' nsIDOMCSSStyleDeclaration* result = self->Style();',
'canFail': False
},
'nsIDOMWindow_GetOnmouseenter' : {
'thisType' : 'nsIDOMWindow',