Bug 846972 part 2. Add the WebIDL APIs for StyleSheet and CSSStyleSheet. r=peterv

This commit is contained in:
Boris Zbarsky 2013-03-17 10:42:59 -04:00
parent 709b9d376a
commit f257517c68
18 changed files with 239 additions and 170 deletions

View File

@ -16,6 +16,7 @@ class nsIURI;
{ 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } }
class nsIStyleSheet;
class nsCSSStyleSheet;
class nsIStyleSheetLinkingElement : public nsISupports {
public:
@ -28,7 +29,7 @@ public:
* @param aStyleSheet the style sheet associated with this
* element.
*/
NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet) = 0;
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) = 0;
/**
* Used to obtain the style sheet linked in by this element.

View File

@ -56,21 +56,17 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
}
NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(nsIStyleSheet* aStyleSheet)
nsStyleLinkElement::SetStyleSheet(nsCSSStyleSheet* aStyleSheet)
{
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(mStyleSheet);
if (cssSheet) {
cssSheet->SetOwningNode(nullptr);
if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr);
}
mStyleSheet = aStyleSheet;
cssSheet = do_QueryObject(mStyleSheet);
if (cssSheet) {
nsCOMPtr<nsIDOMNode> node;
CallQueryInterface(this,
static_cast<nsIDOMNode**>(getter_AddRefs(node)));
if (mStyleSheet) {
nsCOMPtr<nsINode> node = do_QueryObject(this);
if (node) {
cssSheet->SetOwningNode(node);
mStyleSheet->SetOwningNode(node);
}
}
@ -97,15 +93,7 @@ nsStyleLinkElement::InitStyleLinkElement(bool aDontLoadStyle)
NS_IMETHODIMP
nsStyleLinkElement::GetSheet(nsIDOMStyleSheet** aSheet)
{
NS_ENSURE_ARG_POINTER(aSheet);
*aSheet = nullptr;
if (mStyleSheet) {
CallQueryInterface(mStyleSheet, aSheet);
}
// Always return NS_OK to avoid throwing JS exceptions if mStyleSheet
// is not a nsIDOMStyleSheet
NS_IF_ADDREF(*aSheet = mStyleSheet);
return NS_OK;
}
@ -416,14 +404,10 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
return;
}
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(mStyleSheet);
NS_ASSERTION(cssStyleSheet, "should only call UpdateStyleSheetScope for "
"an nsCSSStyleSheet");
nsCOMPtr<nsIContent> thisContent;
CallQueryInterface(this, getter_AddRefs(thisContent));
Element* oldScopeElement = cssStyleSheet->GetScopeElement();
Element* oldScopeElement = mStyleSheet->GetScopeElement();
Element* newScopeElement = aIsNowScoped ?
thisContent->GetParentElement() :
nullptr;
@ -437,7 +421,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
document->BeginUpdate(UPDATE_STYLE);
document->RemoveStyleSheet(mStyleSheet);
cssStyleSheet->SetScopeElement(newScopeElement);
mStyleSheet->SetScopeElement(newScopeElement);
document->AddStyleSheet(mStyleSheet);
document->EndUpdate(UPDATE_STYLE);

View File

@ -16,7 +16,7 @@
#include "nsCOMPtr.h"
#include "nsIDOMLinkStyle.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsIStyleSheet.h"
#include "nsCSSStyleSheet.h"
#include "nsIURI.h"
#include "nsTArray.h"
#include "mozilla/CORSMode.h"
@ -41,10 +41,10 @@ public:
// nsIDOMLinkStyle
NS_DECL_NSIDOMLINKSTYLE
nsIStyleSheet* GetSheet() { return mStyleSheet; }
nsCSSStyleSheet* GetSheet() const { return mStyleSheet; }
// nsIStyleSheetLinkingElement
NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet);
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet);
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet);
NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle);
NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
@ -105,7 +105,7 @@ private:
bool* aIsAlternate,
bool aForceUpdate);
nsCOMPtr<nsIStyleSheet> mStyleSheet;
nsRefPtr<nsCSSStyleSheet> mStyleSheet;
protected:
bool mDontLoadStyle;
bool mUpdatesEnabled;

View File

@ -69,43 +69,34 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
bool
HTMLLinkElement::GetDisabled(ErrorResult& aRv)
HTMLLinkElement::Disabled()
{
nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
if (!ss) {
return false;
}
bool disabled = false;
aRv = ss->GetDisabled(&disabled);
return disabled;
nsCSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled();
}
NS_IMETHODIMP
HTMLLinkElement::GetDisabled(bool* aDisabled)
HTMLLinkElement::GetMozDisabled(bool* aDisabled)
{
ErrorResult rv;
*aDisabled = GetDisabled(rv);
return rv.ErrorCode();
*aDisabled = Disabled();
return NS_OK;
}
void
HTMLLinkElement::SetDisabled(bool aDisabled, ErrorResult& aRv)
HTMLLinkElement::SetDisabled(bool aDisabled)
{
nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
if (!ss) {
return;
nsCSSStyleSheet* ss = GetSheet();
if (ss) {
ss->SetDisabled(aDisabled);
}
aRv = ss->SetDisabled(aDisabled);
}
NS_IMETHODIMP
HTMLLinkElement::SetDisabled(bool aDisabled)
HTMLLinkElement::SetMozDisabled(bool aDisabled)
{
ErrorResult rv;
SetDisabled(aDisabled, rv);
return rv.ErrorCode();
SetDisabled(aDisabled);
return NS_OK;
}

View File

@ -92,8 +92,8 @@ public:
void CreateAndDispatchEvent(nsIDocument* aDoc, const nsAString& aEventName);
// WebIDL
bool GetDisabled(ErrorResult& aRv);
void SetDisabled(bool aDisabled, ErrorResult& aRv);
bool Disabled();
void SetDisabled(bool aDisabled);
// XPCOM GetHref is fine.
void SetHref(const nsAString& aHref, ErrorResult& aRv)
{

View File

@ -61,7 +61,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLStyleElement)
NS_IMETHODIMP
HTMLStyleElement::GetDisabled(bool* aDisabled)
HTMLStyleElement::GetMozDisabled(bool* aDisabled)
{
NS_ENSURE_ARG_POINTER(aDisabled);
@ -72,36 +72,23 @@ HTMLStyleElement::GetDisabled(bool* aDisabled)
bool
HTMLStyleElement::Disabled()
{
nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
if (!ss) {
return false;
}
bool disabled = false;
ss->GetDisabled(&disabled);
return disabled;
nsCSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled();
}
NS_IMETHODIMP
HTMLStyleElement::SetDisabled(bool aDisabled)
HTMLStyleElement::SetMozDisabled(bool aDisabled)
{
ErrorResult error;
SetDisabled(aDisabled, error);
return error.ErrorCode();
SetDisabled(aDisabled);
return NS_OK;
}
void
HTMLStyleElement::SetDisabled(bool aDisabled, ErrorResult& aError)
HTMLStyleElement::SetDisabled(bool aDisabled)
{
nsCOMPtr<nsIDOMStyleSheet> ss = do_QueryInterface(GetSheet());
if (!ss) {
return;
}
nsresult result = ss->SetDisabled(aDisabled);
if (NS_FAILED(result)) {
aError.Throw(result);
nsCSSStyleSheet* ss = GetSheet();
if (ss) {
ss->SetDisabled(aDisabled);
}
}

View File

@ -74,7 +74,7 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
bool Disabled();
void SetDisabled(bool aDisabled, ErrorResult& aError);
void SetDisabled(bool aDisabled);
void SetMedia(const nsAString& aMedia, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::media, aMedia, aError);

View File

@ -21,6 +21,12 @@
#include "nsStringBuffer.h"
#include "nsTArray.h"
class nsWrapperCache;
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't
// try to use it without fixing that first.
class nsGlobalWindow;
namespace mozilla {
namespace dom {
@ -379,6 +385,52 @@ private:
JSContext* mCx;
};
inline nsWrapperCache*
GetWrapperCache(nsWrapperCache* cache)
{
return cache;
}
inline nsWrapperCache*
GetWrapperCache(nsGlobalWindow* not_allowed);
inline nsWrapperCache*
GetWrapperCache(void* p)
{
return NULL;
}
// Helper template for smart pointers to resolve ambiguity between
// GetWrappeCache(void*) and GetWrapperCache(const ParentObject&).
template <template <typename> class SmartPtr, typename T>
inline nsWrapperCache*
GetWrapperCache(const SmartPtr<T>& aObject)
{
return GetWrapperCache(aObject.get());
}
struct ParentObject {
template<class T>
ParentObject(T* aObject) :
mObject(aObject),
mWrapperCache(GetWrapperCache(aObject))
{}
template<class T, template<typename> class SmartPtr>
ParentObject(const SmartPtr<T>& aObject) :
mObject(aObject.get()),
mWrapperCache(GetWrapperCache(aObject.get()))
{}
ParentObject(nsISupports* aObject, nsWrapperCache* aCache) :
mObject(aObject),
mWrapperCache(aCache)
{}
nsISupports* const mObject;
nsWrapperCache* const mWrapperCache;
};
} // namespace dom
} // namespace mozilla

View File

@ -25,10 +25,6 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackObject.h"
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't
// try to use it without fixing that first.
class nsGlobalWindow;
namespace mozilla {
namespace dom {
@ -682,30 +678,6 @@ NativeInterface2JSObjectAndThrowIfFailed(JSContext* aCx,
const nsIID* aIID,
bool aAllowNativeWrapper);
inline nsWrapperCache*
GetWrapperCache(nsWrapperCache* cache)
{
return cache;
}
inline nsWrapperCache*
GetWrapperCache(nsGlobalWindow* not_allowed);
inline nsWrapperCache*
GetWrapperCache(void* p)
{
return NULL;
}
// Helper template for smart pointers to resolve ambiguity between
// GetWrappeCache(void*) and GetWrapperCache(const ParentObject&).
template <template <typename> class SmartPtr, typename T>
inline nsWrapperCache*
GetWrapperCache(const SmartPtr<T>& aObject)
{
return GetWrapperCache(aObject.get());
}
/**
* A method to handle new-binding wrap failure, by possibly falling back to
* wrapping as a non-new-binding object.
@ -827,28 +799,6 @@ FindEnumStringIndex(JSContext* cx, JS::Value v, const EnumEntry* values,
return -1;
}
struct ParentObject {
template<class T>
ParentObject(T* aObject) :
mObject(aObject),
mWrapperCache(GetWrapperCache(aObject))
{}
template<class T, template<typename> class SmartPtr>
ParentObject(const SmartPtr<T>& aObject) :
mObject(aObject.get()),
mWrapperCache(GetWrapperCache(aObject.get()))
{}
ParentObject(nsISupports* aObject, nsWrapperCache* aCache) :
mObject(aObject),
mWrapperCache(aCache)
{}
nsISupports* const mObject;
nsWrapperCache* const mWrapperCache;
};
inline nsWrapperCache*
GetWrapperCache(const ParentObject& aParentObject)
{

View File

@ -19,6 +19,7 @@
[scriptable, uuid(ca856a0b-6786-4123-90fe-dc9c7600274e)]
interface nsIDOMHTMLLinkElement : nsIDOMHTMLElement
{
[binaryname(MozDisabled)]
attribute boolean disabled;
attribute DOMString charset;
attribute DOMString href;

View File

@ -19,6 +19,7 @@
[scriptable, uuid(5e6c9cac-5594-4006-ae3f-ad82fb28cee9)]
interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement
{
[binaryname(MozDisabled)]
attribute boolean disabled;
attribute DOMString media;
attribute DOMString type;

View File

@ -0,0 +1,22 @@
/* -*- 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/.
*
* The origin of this IDL file is
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRuleList;
interface CSSRule;
interface CSSStyleSheet : StyleSheet {
[Pure]
readonly attribute CSSRule? ownerRule;
[Throws]
readonly attribute CSSRuleList cssRules;
[Throws]
unsigned long insertRule(DOMString rule, unsigned long index);
[Throws]
void deleteRule(unsigned long index);
};

View File

@ -13,7 +13,7 @@
// http://www.whatwg.org/specs/web-apps/current-work/#the-link-element
interface HTMLLinkElement : HTMLElement {
[Throws]
[Pure]
attribute boolean disabled;
[SetterThrows, Pure]
attribute DOMString href;

View File

@ -9,13 +9,13 @@
*/
interface HTMLStyleElement : HTMLElement {
[SetterThrows]
[Pure]
attribute boolean disabled;
[SetterThrows]
[SetterThrows, Pure]
attribute DOMString media;
[SetterThrows]
[SetterThrows, Pure]
attribute DOMString type;
[SetterThrows]
[SetterThrows, Pure]
attribute boolean scoped;
};
HTMLStyleElement implements LinkStyle;

View File

@ -0,0 +1,30 @@
/* -*- 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/.
*
* The origin of this IDL file is
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
interface MediaList;
interface StyleSheet {
[Constant]
readonly attribute DOMString type;
[Constant]
readonly attribute DOMString? href;
// Spec says "Node", but it can go null when the node gets a new
// sheet. That's also why it's not [Constant]
[Pure]
readonly attribute Node? ownerNode;
[Pure]
readonly attribute StyleSheet? parentStyleSheet;
[Pure]
readonly attribute DOMString? title;
[Constant]
readonly attribute MediaList media;
[Pure]
attribute boolean disabled;
};

View File

@ -2424,7 +2424,7 @@ CountSheetMemory(URIPrincipalAndCORSModeHashKey* /* unused */,
// have to worry about it here.
// Likewise, if aSheet has an owning node, then the document that
// node is in will report it.
if (aSheet->GetOwningNode() || aSheet->GetParentSheet()) {
if (aSheet->GetOwnerNode() || aSheet->GetParentSheet()) {
return 0;
}
return aSheet->SizeOfIncludingThis(aMallocSizeOf);

View File

@ -554,12 +554,7 @@ nsMediaList::SetText(const nsAString& aMediaText)
{
nsCSSParser parser;
bool htmlMode = false;
if (mStyleSheet) {
nsCOMPtr<nsIDOMNode> node;
mStyleSheet->GetOwnerNode(getter_AddRefs(node));
htmlMode = !!node;
}
bool htmlMode = mStyleSheet && mStyleSheet->GetOwnerNode();
return parser.ParseMediaList(aMediaText, nullptr, 0,
this, htmlMode);
@ -1044,7 +1039,7 @@ nsCSSStyleSheet::nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
nsCSSStyleSheet* aParentToUse,
css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsIDOMNode* aOwningNodeToUse)
nsINode* aOwningNodeToUse)
: mTitle(aCopy.mTitle),
mParent(aParentToUse),
mOwnerRule(aOwnerRuleToUse),
@ -1383,8 +1378,7 @@ nsCSSStyleSheet::FindOwningWindowInnerID() const
}
if (windowID == 0 && mOwningNode) {
nsCOMPtr<nsINode> node = do_QueryInterface(mOwningNode);
windowID = node->OwnerDoc()->InnerWindowID();
windowID = mOwningNode->OwnerDoc()->InnerWindowID();
}
if (windowID == 0 && mOwnerRule) {
@ -1582,7 +1576,7 @@ already_AddRefed<nsCSSStyleSheet>
nsCSSStyleSheet::Clone(nsCSSStyleSheet* aCloneParent,
css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsIDOMNode* aCloneOwningNode) const
nsINode* aCloneOwningNode) const
{
nsCSSStyleSheet* clone = new nsCSSStyleSheet(*this,
aCloneParent,
@ -1757,7 +1751,7 @@ nsCSSStyleSheet::GetType(nsAString& aType)
NS_IMETHODIMP
nsCSSStyleSheet::GetDisabled(bool* aDisabled)
{
*aDisabled = mDisabled;
*aDisabled = Disabled();
return NS_OK;
}
@ -1773,8 +1767,8 @@ nsCSSStyleSheet::SetDisabled(bool aDisabled)
NS_IMETHODIMP
nsCSSStyleSheet::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
*aOwnerNode = mOwningNode;
NS_IF_ADDREF(*aOwnerNode);
nsCOMPtr<nsIDOMNode> ownerNode = do_QueryInterface(GetOwnerNode());
ownerNode.forget(aOwnerNode);
return NS_OK;
}
@ -1818,53 +1812,66 @@ nsCSSStyleSheet::GetTitle(nsAString& aTitle)
NS_IMETHODIMP
nsCSSStyleSheet::GetMedia(nsIDOMMediaList** aMedia)
{
NS_ENSURE_ARG_POINTER(aMedia);
*aMedia = nullptr;
NS_ADDREF(*aMedia = Media());
return NS_OK;
}
nsIDOMMediaList*
nsCSSStyleSheet::Media()
{
if (!mMedia) {
mMedia = new nsMediaList();
NS_ENSURE_TRUE(mMedia, NS_ERROR_OUT_OF_MEMORY);
mMedia->SetStyleSheet(this);
}
*aMedia = mMedia;
NS_ADDREF(*aMedia);
return NS_OK;
return mMedia;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
{
if (mOwnerRule) {
NS_IF_ADDREF(*aOwnerRule = mOwnerRule->GetDOMRule());
} else {
*aOwnerRule = nullptr;
}
NS_IF_ADDREF(*aOwnerRule = GetOwnerRule());
return NS_OK;
}
nsIDOMCSSRule*
nsCSSStyleSheet::GetDOMOwnerRule() const
{
return mOwnerRule ? mOwnerRule->GetDOMRule() : nullptr;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
{
ErrorResult rv;
nsCOMPtr<nsIDOMCSSRuleList> rules = GetCssRules(rv);
rules.forget(aCssRules);
return rv.ErrorCode();
}
nsIDOMCSSRuleList*
nsCSSStyleSheet::GetCssRules(ErrorResult& aRv)
{
// No doing this on incomplete sheets!
if (!mInner->mComplete) {
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return nullptr;
}
//-- Security check: Only scripts whose principal subsumes that of the
// style sheet can access rule collections.
nsresult rv = SubjectSubsumesInnerPrincipal();
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
// OK, security check passed, so get the rule collection
if (nullptr == mRuleCollection) {
if (!mRuleCollection) {
mRuleCollection = new CSSRuleListImpl(this);
}
NS_ADDREF(*aCssRules = mRuleCollection);
return NS_OK;
return mRuleCollection;
}
NS_IMETHODIMP

View File

@ -176,8 +176,7 @@ public:
void SetTitle(const nsAString& aTitle) { mTitle = aTitle; }
void SetMedia(nsMediaList* aMedia);
void SetOwningNode(nsIDOMNode* aOwningNode) { mOwningNode = aOwningNode; /* Not ref counted */ }
nsIDOMNode* GetOwningNode() const { return mOwningNode; }
void SetOwningNode(nsINode* aOwningNode) { mOwningNode = aOwningNode; /* Not ref counted */ }
void SetOwnerRule(mozilla::css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
mozilla::css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
@ -187,7 +186,7 @@ public:
already_AddRefed<nsCSSStyleSheet> Clone(nsCSSStyleSheet* aCloneParent,
mozilla::css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsIDOMNode* aCloneOwningNode) const;
nsINode* aCloneOwningNode) const;
bool IsModified() const { return mDirty; }
@ -255,12 +254,56 @@ public:
mScopeElement = aScopeElement;
}
// WebIDL StyleSheet API
// Our nsIStyleSheet::GetType is a const method, so it ends up
// ambiguous with with the XPCOM version. Just disambiguate.
void GetType(nsString& aType) {
const_cast<const nsCSSStyleSheet*>(this)->GetType(aType);
}
// Our XPCOM GetHref is fine for WebIDL
nsINode* GetOwnerNode() const { return mOwningNode; }
nsCSSStyleSheet* GetParentStyleSheet() const { return mParent; }
// Our nsIStyleSheet::GetTitle is a const method, so it ends up
// ambiguous with with the XPCOM version. Just disambiguate.
void GetTitle(nsString& aTitle) {
const_cast<const nsCSSStyleSheet*>(this)->GetTitle(aTitle);
}
nsIDOMMediaList* Media();
bool Disabled() const { return mDisabled; }
// The XPCOM SetDisabled is fine for WebIDL
// WebIDL CSSStyleSheet API
// Can't be inline because we can't include ImportRule here. And can't be
// called GetOwnerRule because that would be ambiguous with the ImportRule
// version.
nsIDOMCSSRule* GetDOMOwnerRule() const;
nsIDOMCSSRuleList* GetCssRules(mozilla::ErrorResult& aRv);
uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
mozilla::ErrorResult& aRv) {
uint32_t retval;
aRv = InsertRule(aRule, aIndex, &retval);
return retval;
}
void DeleteRule(uint32_t aIndex, mozilla::ErrorResult& aRv) {
aRv = DeleteRule(aIndex);
}
// WebIDL miscellaneous bits
mozilla::dom::ParentObject GetParentObject() const {
if (mOwningNode) {
return mozilla::dom::ParentObject(mOwningNode);
}
return mozilla::dom::ParentObject(static_cast<nsIStyleSheet*>(mParent),
mParent);
}
private:
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
nsCSSStyleSheet* aParentToUse,
mozilla::css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsIDOMNode* aOwningNodeToUse);
nsINode* aOwningNodeToUse);
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
nsCSSStyleSheet& operator=(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
@ -302,7 +345,7 @@ protected:
nsRefPtr<CSSRuleListImpl> mRuleCollection;
nsIDocument* mDocument; // weak ref; parents maintain this for their children
nsIDOMNode* mOwningNode; // weak ref
nsINode* mOwningNode; // weak ref
bool mDisabled;
bool mDirty; // has been modified
nsRefPtr<mozilla::dom::Element> mScopeElement;