зеркало из https://github.com/mozilla/gecko-dev.git
Bug 558235 part 2: Kill CSS2PropertiesTearoff. r=dbaron
This commit is contained in:
Родитель
fc333cacec
Коммит
e7545a1f5e
|
@ -75,7 +75,7 @@ class nsIDOMAttr;
|
|||
class nsIDOMEventListener;
|
||||
class nsIFrame;
|
||||
class nsIDOMNamedNodeMap;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsICSSDeclaration;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIURI;
|
||||
class nsINodeInfo;
|
||||
|
@ -925,13 +925,13 @@ public:
|
|||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
* @see nsGenericHTMLElement::GetStyle */
|
||||
nsRefPtr<nsDOMCSSDeclaration> mStyle;
|
||||
nsCOMPtr<nsICSSDeclaration> mStyle;
|
||||
|
||||
/**
|
||||
* SMIL Overridde style rules (for SMIL animation of CSS properties)
|
||||
* @see nsIContent::GetSMILOverrideStyle
|
||||
*/
|
||||
nsRefPtr<nsDOMCSSDeclaration> mSMILOverrideStyle;
|
||||
nsCOMPtr<nsICSSDeclaration> mSMILOverrideStyle;
|
||||
|
||||
/**
|
||||
* Holds any SMIL override style rules for this element.
|
||||
|
|
|
@ -173,6 +173,7 @@ members = [
|
|||
# dom/interfaces/css
|
||||
'nsIDOMElementCSSInlineStyle.*',
|
||||
'nsIDOMCSS2Properties.*',
|
||||
'nsIDOMSVGCSS2Properties.*',
|
||||
'nsIDOMNSCSS2Properties.*',
|
||||
'nsIDOMRect.*',
|
||||
'nsIDOMViewCSS.getComputedStyle',
|
||||
|
|
|
@ -165,21 +165,15 @@ DOMCI_DATA(ComputedCSSStyleDeclaration, nsComputedDOMStyle)
|
|||
|
||||
// QueryInterface implementation for nsComputedDOMStyle
|
||||
NS_INTERFACE_TABLE_HEAD(nsComputedDOMStyle)
|
||||
NS_INTERFACE_TABLE5(nsComputedDOMStyle,
|
||||
nsICSSDeclaration,
|
||||
nsIDOMCSSStyleDeclaration,
|
||||
nsIDOMCSS2Properties,
|
||||
nsIDOMSVGCSS2Properties,
|
||||
nsIDOMNSCSS2Properties)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsComputedDOMStyle)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsICSSDeclaration)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle,
|
||||
nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsISupports)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsComputedDOMStyle)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMSVGCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ComputedCSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -413,6 +407,38 @@ nsComputedDOMStyle::GetPresShellForContent(nsIContent* aContent)
|
|||
return currentDoc->GetShell();
|
||||
}
|
||||
|
||||
// nsDOMCSSDeclaration abstract methods which should never be called
|
||||
// on a nsComputedDOMStyle object, but must be defined to avoid
|
||||
// compile errors.
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetCSSDeclaration(nsCSSDeclaration**, PRBool)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::DeclarationChanged()
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::DeclarationChanged");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsComputedDOMStyle::DocToUpdate()
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::DocToUpdate");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetCSSParsingEnvironment(nsIURI**, nsIURI**, nsIPrincipal**,
|
||||
mozilla::css::Loader**)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSParsingEnvironment");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
||||
nsIDOMCSSValue** aReturn)
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#ifndef nsComputedDOMStyle_h__
|
||||
#define nsComputedDOMStyle_h__
|
||||
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
|
||||
#include "nsROCSSPrimitiveValue.h"
|
||||
#include "nsDOMCSSRGBColor.h"
|
||||
|
@ -57,12 +57,13 @@
|
|||
|
||||
class nsIPresShell;
|
||||
|
||||
class nsComputedDOMStyle : public nsICSSDeclaration,
|
||||
class nsComputedDOMStyle : public nsDOMCSSDeclaration,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsComputedDOMStyle)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsComputedDOMStyle,
|
||||
nsICSSDeclaration)
|
||||
|
||||
NS_IMETHOD Init(nsIDOMElement *aElement,
|
||||
const nsAString& aPseudoElt,
|
||||
|
@ -100,6 +101,15 @@ public:
|
|||
mExposeVisitedStyle = aExpose;
|
||||
}
|
||||
|
||||
// nsDOMCSSDeclaration abstract methods which should never be called
|
||||
// on a nsComputedDOMStyle object, but must be defined to avoid
|
||||
// compile errors.
|
||||
virtual nsresult GetCSSDeclaration(nsCSSDeclaration**, PRBool);
|
||||
virtual nsresult DeclarationChanged();
|
||||
virtual nsIDocument* DocToUpdate();
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI**, nsIURI**, nsIPrincipal**,
|
||||
mozilla::css::Loader**);
|
||||
|
||||
private:
|
||||
void AssertFlushedPendingReflows() {
|
||||
NS_ASSERTION(mFlushedPendingReflows,
|
||||
|
|
|
@ -64,7 +64,8 @@ public:
|
|||
~nsDOMCSSAttributeDeclaration();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMCSSAttributeDeclaration)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMCSSAttributeDeclaration,
|
||||
nsICSSDeclaration)
|
||||
|
||||
// If GetCSSDeclaration returns non-null, then the decl it returns
|
||||
// is owned by our current style rule.
|
||||
|
|
|
@ -62,18 +62,13 @@ nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
|
|||
DOMCI_DATA(CSSStyleDeclaration, nsDOMCSSDeclaration)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsDOMCSSDeclaration)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsDOMCSSDeclaration)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsICSSDeclaration)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDOMCSSDeclaration, nsISupports)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMSVGCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties,
|
||||
new CSS2PropertiesTearoff(this))
|
||||
NS_INTERFACE_TABLE5(nsDOMCSSDeclaration,
|
||||
nsICSSDeclaration,
|
||||
nsIDOMCSSStyleDeclaration,
|
||||
nsIDOMCSS2Properties,
|
||||
nsIDOMSVGCSS2Properties,
|
||||
nsIDOMNSCSS2Properties)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -363,31 +358,6 @@ nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
|||
return rv;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSS2PropertiesTearoff::CSS2PropertiesTearoff(nsICSSDeclaration *aOuter)
|
||||
: mOuter(aOuter)
|
||||
{
|
||||
NS_ASSERTION(mOuter, "must have outer");
|
||||
}
|
||||
|
||||
CSS2PropertiesTearoff::~CSS2PropertiesTearoff()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(CSS2PropertiesTearoff, mOuter)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(CSS2PropertiesTearoff)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(CSS2PropertiesTearoff)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(CSS2PropertiesTearoff)
|
||||
NS_INTERFACE_TABLE_INHERITED3(CSS2PropertiesTearoff,
|
||||
nsIDOMCSS2Properties,
|
||||
nsIDOMSVGCSS2Properties,
|
||||
nsIDOMNSCSS2Properties)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(CSS2PropertiesTearoff)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mOuter)
|
||||
|
||||
// nsIDOMCSS2Properties
|
||||
// nsIDOMSVGCSS2Properties
|
||||
// nsIDOMNSCSS2Properties
|
||||
|
@ -395,15 +365,15 @@ NS_INTERFACE_MAP_END_AGGREGATED(mOuter)
|
|||
#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, \
|
||||
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
|
||||
nsDOMCSSDeclaration::Get##method_(nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->GetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
return GetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
|
||||
nsDOMCSSDeclaration::Set##method_(const nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->SetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
return SetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
}
|
||||
|
||||
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
|
@ -412,12 +382,12 @@ NS_INTERFACE_MAP_END_AGGREGATED(mOuter)
|
|||
#include "nsCSSPropList.h"
|
||||
|
||||
// Aliases
|
||||
CSS_PROP(X, opacity, MozOpacity, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline, MozOutline, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_color, MozOutlineColor, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_style, MozOutlineStyle, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_width, MozOutlineWidth, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_offset, MozOutlineOffset, 0, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, opacity, MozOpacity, X, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline, MozOutline, X, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_color, MozOutlineColor, X, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_style, MozOutlineStyle, X, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_width, MozOutlineWidth, X, X, X, X, X, X, X, X)
|
||||
CSS_PROP(X, outline_offset, MozOutlineOffset, X, X, X, X, X, X, X, X)
|
||||
|
||||
#undef CSS_PROP_SHORTHAND
|
||||
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMNSCSS2Properties.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsCSSDeclaration;
|
||||
|
@ -57,24 +56,8 @@ class Loader;
|
|||
}
|
||||
}
|
||||
|
||||
class CSS2PropertiesTearoff : public nsIDOMNSCSS2Properties
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(CSS2PropertiesTearoff)
|
||||
|
||||
NS_DECL_NSIDOMCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMSVGCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
CSS2PropertiesTearoff(nsICSSDeclaration *aOuter);
|
||||
virtual ~CSS2PropertiesTearoff();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsICSSDeclaration> mOuter;
|
||||
};
|
||||
|
||||
class nsDOMCSSDeclaration : public nsICSSDeclaration
|
||||
class nsDOMCSSDeclaration : public nsICSSDeclaration,
|
||||
public nsIDOMNSCSS2Properties
|
||||
{
|
||||
public:
|
||||
// Only implement QueryInterface; subclasses have the responsibility
|
||||
|
@ -101,6 +84,12 @@ public:
|
|||
NS_IMETHOD Item(PRUint32 index, nsAString & _retval);
|
||||
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0;
|
||||
|
||||
// We implement all of these as shims which forward to GetPropertyValue
|
||||
// and SetPropertyValue; subclasses need not.
|
||||
NS_DECL_NSIDOMCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMSVGCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
protected:
|
||||
// Always fills in the out parameter, even on failure, and if the out
|
||||
// parameter is null the nsresult will be the correct thing to
|
||||
|
|
|
@ -97,6 +97,4 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID)
|
|||
NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, \
|
||||
const nsAString& aValue);
|
||||
|
||||
|
||||
|
||||
#endif // nsICSSDeclaration_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче