Bug 823394 Part 1:Merge nsSVGStylableElement/nsSVGElement and nsIDOMSVGStylable/nsIDOMSVGElement r=bz

--HG--
rename : layout/reftests/svg/style-property-not-on-script-element-01.svg => layout/reftests/svg/style-property-on-script-element-01.svg
This commit is contained in:
David Zbarsky 2012-12-23 03:22:22 -05:00
Родитель 8eac1dfb3c
Коммит 7d32181339
31 изменённых файлов: 154 добавлений и 287 удалений

Просмотреть файл

@ -19,7 +19,6 @@
#include "mozilla/css/Loader.h"
#include "nsIDOMMutationEvent.h"
#include "nsXULElement.h"
#include "nsIDOMSVGStylable.h"
#include "nsContentUtils.h"
namespace css = mozilla::css;

Просмотреть файл

@ -74,7 +74,6 @@ CPPSRCS = \
nsSVGPolylineElement.cpp \
nsSVGScriptElement.cpp \
nsSVGString.cpp \
nsSVGStylableElement.cpp \
nsSVGRect.cpp \
nsSVGRectElement.cpp \
nsSVGSVGElement.cpp \

Просмотреть файл

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSVGClass.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSMILValue.h"
#include "SMILStringType.h"
@ -27,7 +27,7 @@ NS_INTERFACE_MAP_END
void
nsSVGClass::SetBaseValue(const nsAString& aValue,
nsSVGStylableElement *aSVGElement,
nsSVGElement *aSVGElement,
bool aDoSetAttr)
{
NS_ASSERTION(aSVGElement, "Null element passed to SetBaseValue");
@ -42,13 +42,13 @@ nsSVGClass::SetBaseValue(const nsAString& aValue,
}
void
nsSVGClass::GetBaseValue(nsAString& aValue, const nsSVGStylableElement *aSVGElement) const
nsSVGClass::GetBaseValue(nsAString& aValue, const nsSVGElement *aSVGElement) const
{
aSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aValue);
}
void
nsSVGClass::GetAnimValue(nsAString& aResult, const nsSVGStylableElement *aSVGElement) const
nsSVGClass::GetAnimValue(nsAString& aResult, const nsSVGElement *aSVGElement) const
{
if (mAnimVal) {
aResult = *mAnimVal;
@ -59,7 +59,7 @@ nsSVGClass::GetAnimValue(nsAString& aResult, const nsSVGStylableElement *aSVGEle
}
void
nsSVGClass::SetAnimValue(const nsAString& aValue, nsSVGStylableElement *aSVGElement)
nsSVGClass::SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement)
{
if (mAnimVal && mAnimVal->Equals(aValue)) {
return;
@ -74,7 +74,7 @@ nsSVGClass::SetAnimValue(const nsAString& aValue, nsSVGStylableElement *aSVGElem
nsresult
nsSVGClass::ToDOMAnimatedString(nsIDOMSVGAnimatedString **aResult,
nsSVGStylableElement *aSVGElement)
nsSVGElement *aSVGElement)
{
*aResult = new DOMAnimatedString(this, aSVGElement);
NS_ADDREF(*aResult);
@ -90,7 +90,7 @@ nsSVGClass::DOMAnimatedString::GetAnimVal(nsAString& aResult)
}
nsISMILAttr*
nsSVGClass::ToSMILAttr(nsSVGStylableElement *aSVGElement)
nsSVGClass::ToSMILAttr(nsSVGElement *aSVGElement)
{
return new SMILString(this, aSVGElement);
}

Просмотреть файл

@ -14,7 +14,7 @@
#include "nsString.h"
#include "mozilla/Attributes.h"
class nsSVGStylableElement;
class nsSVGElement;
class nsSVGClass
{
@ -25,19 +25,19 @@ public:
}
void SetBaseValue(const nsAString& aValue,
nsSVGStylableElement *aSVGElement,
nsSVGElement *aSVGElement,
bool aDoSetAttr);
void GetBaseValue(nsAString& aValue, const nsSVGStylableElement *aSVGElement) const;
void GetBaseValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
void SetAnimValue(const nsAString& aValue, nsSVGStylableElement *aSVGElement);
void GetAnimValue(nsAString& aValue, const nsSVGStylableElement *aSVGElement) const;
void SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement);
void GetAnimValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
bool IsAnimated() const
{ return !!mAnimVal; }
nsresult ToDOMAnimatedString(nsIDOMSVGAnimatedString **aResult,
nsSVGStylableElement *aSVGElement);
nsSVGElement *aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete
nsISMILAttr* ToSMILAttr(nsSVGStylableElement *aSVGElement);
nsISMILAttr* ToSMILAttr(nsSVGElement *aSVGElement);
private:
@ -49,11 +49,11 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString)
DOMAnimatedString(nsSVGClass *aVal, nsSVGStylableElement *aSVGElement)
DOMAnimatedString(nsSVGClass *aVal, nsSVGElement *aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
nsSVGClass* mVal; // kept alive because it belongs to content
nsRefPtr<nsSVGStylableElement> mSVGElement;
nsRefPtr<nsSVGElement> mSVGElement;
NS_IMETHOD GetBaseVal(nsAString& aResult)
{ mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; }
@ -65,14 +65,14 @@ public:
struct SMILString : public nsISMILAttr
{
public:
SMILString(nsSVGClass *aVal, nsSVGStylableElement *aSVGElement)
SMILString(nsSVGClass *aVal, nsSVGElement *aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
// These will stay alive because a nsISMILAttr only lives as long
// as the Compositing step, and DOM elements don't get a chance to
// die during that.
nsSVGClass* mVal;
nsSVGStylableElement* mSVGElement;
nsSVGElement* mSVGElement;
// nsISMILAttr methods
virtual nsresult ValueFromString(const nsAString& aStr,

Просмотреть файл

@ -3,10 +3,10 @@
* 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 "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsIDOMSVGDescElement.h"
typedef nsSVGStylableElement nsSVGDescElementBase;
typedef nsSVGElement nsSVGDescElementBase;
class nsSVGDescElement : public nsSVGDescElementBase,
public nsIDOMSVGDescElement

Просмотреть файл

@ -58,6 +58,7 @@
#include "SVGMotionSMILAttr.h"
#include "nsAttrValueOrString.h"
#include "nsSMILAnimationController.h"
#include "nsDOMCSSDeclaration.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -80,6 +81,59 @@ nsSVGElement::nsSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo)
{
}
//----------------------------------------------------------------------
/* readonly attribute nsIDOMSVGAnimatedString className; */
NS_IMETHODIMP
nsSVGElement::GetClassName(nsIDOMSVGAnimatedString** aClassName)
{
return mClassAttribute.ToDOMAnimatedString(aClassName, this);
}
/* readonly attribute nsIDOMCSSStyleDeclaration style; */
NS_IMETHODIMP
nsSVGElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
nsresult rv;
*aStyle = nsSVGElementBase::GetStyle(&rv);
if (NS_FAILED(rv)) {
return rv;
}
NS_ADDREF(*aStyle);
return NS_OK;
}
/* nsIDOMCSSValue getPresentationAttribute (in DOMString name); */
NS_IMETHODIMP
nsSVGElement::GetPresentationAttribute(const nsAString& aName,
nsIDOMCSSValue** aReturn)
{
// Let's not implement this just yet. The CSSValue interface has been
// deprecated by the CSS WG.
// http://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// nsSVGElement methods
void
nsSVGElement::DidAnimateClass()
{
nsAutoString src;
mClassAttribute.GetAnimValue(src, this);
if (!mClassAnimAttr) {
mClassAnimAttr = new nsAttrValue();
}
mClassAnimAttr->ParseAtomArray(src);
nsIPresShell* shell = OwnerDoc()->GetShell();
if (shell) {
shell->RestyleForAnimation(this, eRestyle_Self);
}
}
nsresult
nsSVGElement::Init()
{
@ -192,6 +246,15 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGElementBase)
//----------------------------------------------------------------------
// nsIContent methods
const nsAttrValue*
nsSVGElement::DoGetClasses() const
{
if (mClassAttribute.IsAnimated()) {
return mClassAnimAttr;
}
return nsSVGElementBase::DoGetClasses();
}
nsresult
nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -272,7 +335,6 @@ nsSVGElement::ParseAttribute(int32_t aNamespaceID,
bool didSetResult = false;
if (aNamespaceID == kNameSpaceID_None) {
// Check for nsSVGLength2 attribute
LengthAttributesInfo lengthInfo = GetLengthInfo();
@ -562,6 +624,12 @@ nsSVGElement::ParseAttribute(int32_t aNamespaceID,
foundMatch = true;
}
}
if (aAttribute == nsGkAtoms::_class) {
mClassAttribute.SetBaseValue(aValue, this, false);
aResult.ParseAtomArray(aValue);
return true;
}
}
if (!foundMatch) {
@ -788,6 +856,11 @@ nsSVGElement::UnsetAttrInternal(int32_t aNamespaceID, nsIAtom* aName,
return;
}
}
if (aName == nsGkAtoms::_class) {
mClassAttribute.Init();
return;
}
}
// Check if this is a string attribute going away
@ -2618,6 +2691,10 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
}
}
}
if (aName == nsGkAtoms::_class) {
return mClassAttribute.ToSMILAttr(this);
}
}
// Strings

Просмотреть файл

@ -20,6 +20,7 @@
#include "mozilla/dom/Element.h"
#include "nsISupportsImpl.h"
#include "nsStyledElement.h"
#include "nsSVGClass.h"
class nsIDOMSVGElement;
class nsIDOMSVGSVGElement;
@ -74,6 +75,9 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
virtual const nsAttrValue* DoGetClasses() const;
void DidAnimateClass();
// nsIContent interface methods
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
@ -114,6 +118,9 @@ public:
NS_IMETHOD SetId(const nsAString & aId);
NS_IMETHOD GetOwnerSVGElement(nsIDOMSVGSVGElement** aOwnerSVGElement);
NS_IMETHOD GetViewportElement(nsIDOMSVGElement** aViewportElement);
NS_IMETHOD GetClassName(nsIDOMSVGAnimatedString** aClassName);
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
NS_IMETHOD GetPresentationAttribute(const nsAString& aName, nsIDOMCSSValue** aReturn);
// Gets the element that establishes the rectangular viewport against which
// we should resolve percentage lengths (our "coordinate context"). Returns
@ -597,6 +604,8 @@ private:
void UnsetAttrInternal(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);
nsSVGClass mClassAttribute;
nsAutoPtr<nsAttrValue> mClassAnimAttr;
nsRefPtr<mozilla::css::StyleRule> mContentStyleRule;
};

Просмотреть файл

@ -14,7 +14,7 @@
#include "nsImageLoadingContent.h"
#include "nsSVGLength2.h"
#include "nsSVGString.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
class nsSVGFilterInstance;
@ -30,7 +30,7 @@ struct nsSVGStringInfo {
nsSVGElement* mElement;
};
typedef nsSVGStylableElement nsSVGFEBase;
typedef nsSVGElement nsSVGFEBase;
#define NS_SVG_FE_CID \
{ 0x60483958, 0xd229, 0x4a77, \

Просмотреть файл

@ -11,7 +11,7 @@
#include "nsIDOMSVGGradientElement.h"
#include "nsIDOMMutationEvent.h"
#include "nsCOMPtr.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsGkAtoms.h"
#include "nsSVGGradientElement.h"

Просмотреть файл

@ -10,7 +10,7 @@
#include "nsIDOMSVGGradientElement.h"
#include "DOMSVGTests.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSVGLength2.h"
#include "nsSVGEnum.h"
#include "nsSVGString.h"
@ -18,7 +18,7 @@
//--------------------- Gradients------------------------
typedef nsSVGStylableElement nsSVGGradientElementBase;
typedef nsSVGElement nsSVGGradientElementBase;
class nsSVGGradientElement : public nsSVGGradientElementBase,
public DOMSVGTests,

Просмотреть файл

@ -9,10 +9,10 @@
#include "gfxMatrix.h"
#include "nsIDOMSVGLocatable.h"
#include "nsIDOMSVGTransformable.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "SVGAnimatedTransformList.h"
typedef nsSVGStylableElement nsSVGGraphicElementBase;
typedef nsSVGElement nsSVGGraphicElementBase;
class nsSVGGraphicElement : public nsSVGGraphicElementBase,
public nsIDOMSVGTransformable // : nsIDOMSVGLocatable

Просмотреть файл

@ -11,11 +11,11 @@
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
//--------------------- Masks ------------------------
typedef nsSVGStylableElement nsSVGMaskElementBase;
typedef nsSVGElement nsSVGMaskElementBase;
class nsSVGMaskElement : public nsSVGMaskElementBase,
public nsIDOMSVGMaskElement,

Просмотреть файл

@ -14,14 +14,14 @@
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "nsSVGString.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSVGViewBox.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedTransformList.h"
//--------------------- Patterns ------------------------
typedef nsSVGStylableElement nsSVGPatternElementBase;
typedef nsSVGElement nsSVGPatternElementBase;
class nsSVGPatternElement : public nsSVGPatternElementBase,
public nsIDOMSVGPatternElement,

Просмотреть файл

@ -15,7 +15,7 @@
#include "nsIDOMSVGZoomAndPan.h"
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSVGViewBox.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGAnimatedPreserveAspectRatio.h"
@ -28,7 +28,7 @@ namespace mozilla {
class SVGFragmentIdentifier;
}
typedef nsSVGStylableElement nsSVGSVGElementBase;
typedef nsSVGElement nsSVGSVGElementBase;
class nsSVGSVGElement;

Просмотреть файл

@ -5,14 +5,14 @@
#include "mozilla/Util.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsIDOMSVGStopElement.h"
#include "nsSVGNumber2.h"
#include "nsGenericHTMLElement.h"
using namespace mozilla;
typedef nsSVGStylableElement nsSVGStopElementBase;
typedef nsSVGElement nsSVGStopElementBase;
class nsSVGStopElement : public nsSVGStopElementBase,
public nsIDOMSVGStopElement

Просмотреть файл

@ -1,127 +0,0 @@
/* -*- Mode: C++; 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/. */
#include "nsSVGStylableElement.h"
#include "nsGkAtoms.h"
#include "nsDOMCSSDeclaration.h"
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGStylableElement, nsSVGStylableElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGStylableElement, nsSVGStylableElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGStylableElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGStylable)
NS_INTERFACE_MAP_END_INHERITING(nsSVGStylableElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGStylableElement::nsSVGStylableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGStylableElementBase(aNodeInfo)
{
}
//----------------------------------------------------------------------
// nsIContent methods
const nsAttrValue*
nsSVGStylableElement::DoGetClasses() const
{
if (mClassAttribute.IsAnimated()) {
return mClassAnimAttr;
}
return nsSVGStylableElementBase::DoGetClasses();
}
bool
nsSVGStylableElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::_class) {
mClassAttribute.SetBaseValue(aValue, this, false);
aResult.ParseAtomArray(aValue);
return true;
}
return nsSVGStylableElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsresult
nsSVGStylableElement::UnsetAttr(int32_t aNamespaceID, nsIAtom* aName,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::_class) {
mClassAttribute.Init();
}
return nsSVGStylableElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
}
//----------------------------------------------------------------------
// nsIDOMSVGStylable methods
/* readonly attribute nsIDOMSVGAnimatedString className; */
NS_IMETHODIMP
nsSVGStylableElement::GetClassName(nsIDOMSVGAnimatedString** aClassName)
{
return mClassAttribute.ToDOMAnimatedString(aClassName, this);
}
/* readonly attribute nsIDOMCSSStyleDeclaration style; */
NS_IMETHODIMP
nsSVGStylableElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
{
nsresult rv;
*aStyle = GetStyle(&rv);
if (NS_FAILED(rv)) {
return rv;
}
NS_ADDREF(*aStyle);
return NS_OK;
}
/* nsIDOMCSSValue getPresentationAttribute (in DOMString name); */
NS_IMETHODIMP
nsSVGStylableElement::GetPresentationAttribute(const nsAString& aName,
nsIDOMCSSValue** aReturn)
{
// Let's not implement this just yet. The CSSValue interface has been
// deprecated by the CSS WG.
// http://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// nsSVGElement methods
void
nsSVGStylableElement::DidAnimateClass()
{
nsAutoString src;
mClassAttribute.GetAnimValue(src, this);
if (!mClassAnimAttr) {
mClassAnimAttr = new nsAttrValue();
}
mClassAnimAttr->ParseAtomArray(src);
nsIPresShell* shell = OwnerDoc()->GetShell();
if (shell) {
shell->RestyleForAnimation(this, eRestyle_Self);
}
}
nsISMILAttr*
nsSVGStylableElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
{
if (aNamespaceID == kNameSpaceID_None &&
aName == nsGkAtoms::_class) {
return mClassAttribute.ToSMILAttr(this);
}
return nsSVGStylableElementBase::GetAnimatedAttr(aNamespaceID, aName);
}

Просмотреть файл

@ -1,49 +0,0 @@
/* -*- Mode: C++; 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/. */
#ifndef __NS_SVGSTYLABLEELEMENT_H__
#define __NS_SVGSTYLABLEELEMENT_H__
#include "nsAutoPtr.h"
#include "nsIDOMSVGStylable.h"
#include "nsSVGClass.h"
#include "nsSVGElement.h"
typedef nsSVGElement nsSVGStylableElementBase;
class nsSVGStylableElement : public nsSVGStylableElementBase,
public nsIDOMSVGStylable
{
protected:
nsSVGStylableElement(already_AddRefed<nsINodeInfo> aNodeInfo);
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGSTYLABLE
// nsIContent
virtual const nsAttrValue* DoGetClasses() const;
nsICSSDeclaration* GetStyle(nsresult* retval)
{
return nsSVGStylableElementBase::GetStyle(retval);
}
virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult);
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);
virtual nsISMILAttr* GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName);
void DidAnimateClass();
protected:
nsSVGClass mClassAttribute;
nsAutoPtr<nsAttrValue> mClassAnimAttr;
};
#endif // __NS_SVGSTYLABLEELEMENT_H__

Просмотреть файл

@ -7,14 +7,14 @@
#include "nsIDOMSVGSymbolElement.h"
#include "DOMSVGTests.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSVGViewBox.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsIDOMSVGFitToViewBox.h"
#include "nsGkAtoms.h"
using namespace mozilla;
typedef nsSVGStylableElement nsSVGSymbolElementBase;
typedef nsSVGElement nsSVGSymbolElementBase;
class nsSVGSymbolElement : public nsSVGSymbolElementBase,
public nsIDOMSVGSymbolElement,

Просмотреть файл

@ -8,10 +8,10 @@
#include "DOMSVGTests.h"
#include "nsIDOMSVGTextContentElement.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsSVGTextContainerFrame.h"
typedef nsSVGStylableElement nsSVGTextContentElementBase;
typedef nsSVGElement nsSVGTextContentElementBase;
/**
* Note that nsSVGTextElement does not inherit nsSVGTextPositioningElement, or

Просмотреть файл

@ -5,7 +5,7 @@
#include "mozilla/Util.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsGkAtoms.h"
#include "nsIDOMSVGTextPathElement.h"
#include "nsIDOMSVGURIReference.h"

Просмотреть файл

@ -3,11 +3,11 @@
* 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 "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "nsIDOMSVGTitleElement.h"
#include "nsStubMutationObserver.h"
typedef nsSVGStylableElement nsSVGTitleElementBase;
typedef nsSVGElement nsSVGTitleElementBase;
class nsSVGTitleElement : public nsSVGTitleElementBase,
public nsIDOMSVGTitleElement,

Просмотреть файл

@ -358,7 +358,6 @@
#include "nsIDOMSVGRectElement.h"
#include "nsIDOMSVGScriptElement.h"
#include "nsIDOMSVGStopElement.h"
#include "nsIDOMSVGStylable.h"
#include "nsIDOMSVGStyleElement.h"
#include "nsIDOMSVGSVGElement.h"
#include "nsIDOMSVGSwitchElement.h"
@ -2999,13 +2998,11 @@ nsDOMClassInfo::Init()
#define DOM_CLASSINFO_SVG_TEXT_CONTENT_ELEMENT_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextContentElement) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable) \
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
#define DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLocatable) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTransformable) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable) \
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
// XXX - the proto chain stuff is sort of hackish, because of the MI in
@ -3104,7 +3101,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGDescElement, nsIDOMSVGDescElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDescElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3117,49 +3113,42 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFEBlendElement, nsIDOMSVGFEBlendElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEBlendElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEColorMatrixElement, nsIDOMSVGFEColorMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEColorMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEComponentTransferElement, nsIDOMSVGFEComponentTransferElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEComponentTransferElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFECompositeElement, nsIDOMSVGFECompositeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFECompositeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEConvolveMatrixElement, nsIDOMSVGFEConvolveMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEConvolveMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEDiffuseLightingElement, nsIDOMSVGFEDiffuseLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDiffuseLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEDisplacementMapElement, nsIDOMSVGFEDisplacementMapElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDisplacementMapElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3171,7 +3160,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFEFloodElement, nsIDOMSVGFEFloodElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEFloodElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3198,7 +3186,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFEGaussianBlurElement, nsIDOMSVGFEGaussianBlurElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEGaussianBlurElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3206,21 +3193,18 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEImageElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEMergeElement, nsIDOMSVGFEMergeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMergeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEMorphologyElement, nsIDOMSVGFEMorphologyElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMorphologyElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3232,7 +3216,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFEOffsetElement, nsIDOMSVGFEOffsetElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEOffsetElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3244,7 +3227,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFESpecularLightingElement, nsIDOMSVGFESpecularLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFESpecularLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3256,14 +3238,12 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGFETileElement, nsIDOMSVGFETileElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETileElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3271,7 +3251,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3300,7 +3279,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLinearGradientElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3313,7 +3291,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGMarkerElement, nsIDOMSVGMarkerElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGMarkerElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3321,7 +3298,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGMaskElement, nsIDOMSVGMaskElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGMaskElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3343,7 +3319,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3367,7 +3342,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGRadialGradientElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3386,7 +3360,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGStopElement, nsIDOMSVGStopElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStopElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3401,7 +3374,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLocatable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGZoomAndPan)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3417,7 +3389,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGSymbolElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTests)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
@ -3435,7 +3406,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGTitleElement, nsIDOMSVGTitleElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTitleElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -60,8 +60,8 @@ DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 6, \
_extra) \
DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra) \
DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 9, _extra)
DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
// have been declared.
#define DOMCI_CASTABLE_NODECL_INTERFACE(_interface, _u1, _u2, _u3) /* Nothing */

Просмотреть файл

@ -65,7 +65,6 @@ XPIDLSRCS = \
nsIDOMSVGSVGElement.idl \
nsIDOMSVGStopElement.idl \
nsIDOMSVGStringList.idl \
nsIDOMSVGStylable.idl \
nsIDOMSVGStyleElement.idl \
nsIDOMSVGSwitchElement.idl \
nsIDOMSVGSymbolElement.idl \

Просмотреть файл

@ -6,12 +6,21 @@
#include "nsIDOMElement.idl"
interface nsIDOMSVGSVGElement;
interface nsIDOMSVGAnimatedString;
interface nsIDOMCSSStyleDeclaration;
interface nsIDOMCSSValue;
[scriptable, uuid(9B16734D-DBFD-4465-8EAF-354694934A1D)]
interface nsIDOMSVGElement : nsIDOMElement
{
[scriptable, uuid(7ccf8faf-29b4-4113-bb23-bc187bac27cf)]
interface nsIDOMSVGElement : nsIDOMElement
{
attribute DOMString id;
// raises DOMException on setting
readonly attribute nsIDOMSVGSVGElement ownerSVGElement;
readonly attribute nsIDOMSVGElement viewportElement;
readonly attribute nsIDOMSVGAnimatedString className;
readonly attribute nsIDOMCSSStyleDeclaration style;
nsIDOMCSSValue getPresentationAttribute(in DOMString name);
};

Просмотреть файл

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMSVGElement.idl"
#include "nsIDOMSVGStylable.idl"
interface nsIDOMSVGAnimatedLength;
interface nsIDOMSVGAnimatedString;

Просмотреть файл

@ -1,19 +0,0 @@
/* -*- 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/. */
#include "domstubs.idl"
interface nsIDOMSVGAnimatedString;
interface nsIDOMCSSStyleDeclaration;
interface nsIDOMCSSValue;
[scriptable, uuid(ea8a6cb1-9176-45db-989d-d0e89f563d7e)]
interface nsIDOMSVGStylable : nsISupports
{
readonly attribute nsIDOMSVGAnimatedString className;
readonly attribute nsIDOMCSSStyleDeclaration style;
nsIDOMCSSValue getPresentationAttribute(in DOMString name);
};

Просмотреть файл

@ -277,7 +277,8 @@ members = [
# dom/interfaces/stylesheets - None.
# dom/interfaces/svg - None.
'nsIDOMSVGStylable.*',
'nsIDOMSVGElement.className',
'nsIDOMSVGElement.style',
# dom/interfaces/traversal
'nsIDOMNodeIterator.nextNode',
@ -377,7 +378,7 @@ customIncludes = [
'nsGenericDOMDataNode.h',
'mozilla/dom/Element.h',
'nsGenericHTMLElement.h',
'nsSVGStylableElement.h',
'nsSVGElement.h',
'nsHTMLDocument.h',
'nsDOMQS.h',
'nsDOMStringMap.h',
@ -469,10 +470,10 @@ customMethodCalls = {
' nsIDOMCSSStyleDeclaration* result = '
'self->GetStyle(&rv);'
},
'nsIDOMSVGStylable_GetStyle': {
'thisType': 'nsSVGStylableElement',
'nsIDOMSVGElement_GetStyle': {
'thisType': 'nsSVGElement',
'code': ' nsICSSDeclaration* result = '
'self->GetStyle(&rv);'
'self->nsSVGElementBase::GetStyle(&rv);'
},
'nsIDOMWindow_GetOnmouseenter' : {
'thisType' : 'nsIDOMWindow',

Просмотреть файл

@ -15,7 +15,7 @@
#include "nsHTMLVideoElement.h"
#include "nsHTMLDocument.h"
#include "nsICSSDeclaration.h"
#include "nsSVGStylableElement.h"
#include "nsSVGElement.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/NodeBinding.h"
#include "mozilla/dom/ElementBinding.h"

Просмотреть файл

@ -242,7 +242,7 @@ random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundin
== script-empty-01.svg pass.svg
== selector-01.svg pass.svg
== stroke-width-percentage-01.svg pass.svg
== style-property-not-on-script-element-01.svg pass.svg
== style-property-on-script-element-01.svg pass.svg
== style-without-type-attribute.svg pass.svg
== svg-in-foreignObject-01.xhtml svg-in-foreignObject-01-ref.xhtml
== svg-in-foreignObject-02.xhtml svg-in-foreignObject-01-ref.xhtml # reuse -01-ref.xhtml

Просмотреть файл

@ -4,16 +4,16 @@
-->
<svg xmlns="http://www.w3.org/2000/svg">
<title>Testcase ensuring 'style' is not a property of SVGScriptElement</title>
<title>Testcase ensuring 'style' is a property of SVGScriptElement</title>
<!-- For https://bugzilla.mozilla.org/show_bug.cgi?id=379178 -->
<rect id="rect" width="100%" height="100%" fill="red"/>
<rect id="rect" width="100%" height="100%" fill="lime"/>
<script id="script" type="application/javascript">
if (typeof document.getElementById('script').style == 'undefined') {
document.getElementById('rect').setAttribute('fill', 'lime');
document.getElementById('rect').setAttribute('fill', 'red');
}
</script>

До

Ширина:  |  Высота:  |  Размер: 579 B

После

Ширина:  |  Высота:  |  Размер: 575 B