Bug 1427512 - Part 18: Remove nsIDOMCSSStyleSheet. r=xidorn,jryans,bz
MozReview-Commit-ID: CN3VZvQceZB
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1734,17 +1734,17 @@ DebuggerServer.ObjectActorPreviewers.Obj
kind: "ObjectWithText",
text: hooks.createValueGrip(rawObj.selectorText),
};
return true;
},
function ObjectWithURL({obj, hooks}, grip, rawObj) {
if (isWorker || !rawObj || !(obj.class == "CSSImportRule" ||
- rawObj instanceof Ci.nsIDOMCSSStyleSheet ||
+ obj.class == "CSSStyleSheet" ||
obj.class == "Location" ||
rawObj instanceof Ci.nsIDOMWindow)) {
return false;
}
let url;
if (rawObj instanceof Ci.nsIDOMWindow && rawObj.location) {
url = rawObj.location.href;
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -160,18 +160,18 @@ var PageStyleActor = protocol.ActorClass
* @param actor a StyleRuleActor
*/
updateStyleRef: function (oldItem, item, actor) {
this.refMap.delete(oldItem);
this.refMap.set(item, actor);
},
/**
- * Return or create a StyleSheetActor for the given nsIDOMCSSStyleSheet.
- * @param {DOMStyleSheet} sheet
+ * Return or create a StyleSheetActor for the given CSSStyleSheet.
+ * @param {CSSStyleSheet} sheet
* The style sheet to create an actor for.
* @return {StyleSheetActor}
* The actor for this style sheet
*/
_sheetRef: function (sheet) {
let tabActor = this.inspector.tabActor;
let actor = tabActor.createStyleSheetActor(sheet);
return actor;
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -60,17 +60,16 @@ interface nsIDOMEventListener;
interface nsIDOMHTMLElement;
interface nsIDOMHTMLFormElement;
interface nsIDOMHTMLHeadElement;
// CSS
interface nsIDOMCSSValue;
interface nsIDOMCSSPrimitiveValue;
interface nsIDOMCSSRuleList;
-interface nsIDOMCSSStyleSheet;
interface nsIDOMCSSStyleDeclaration;
interface nsIDOMCounter;
interface nsIDOMRect;
// Range
interface nsIDOMRange;
// Crypto
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -7,16 +7,15 @@
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
XPIDL_SOURCES += [
'nsIDOMCounter.idl',
'nsIDOMCSSPrimitiveValue.idl',
'nsIDOMCSSRuleList.idl',
'nsIDOMCSSStyleDeclaration.idl',
- 'nsIDOMCSSStyleSheet.idl',
'nsIDOMCSSValue.idl',
'nsIDOMCSSValueList.idl',
'nsIDOMRect.idl',
]
XPIDL_MODULE = 'dom_css'
deleted file mode 100644
--- a/dom/interfaces/css/nsIDOMCSSStyleSheet.idl
+++ /dev/null
@@ -1,26 +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 "nsIDOMStyleSheet.idl"
-
-/**
- * The nsIDOMCSSStyleSheet interface is a datatype for a CSS style
- * sheet in the Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Style
- */
-
-[uuid(a6cf90c2-15b3-11d2-932e-00805f8add32)]
-interface nsIDOMCSSStyleSheet : nsIDOMStyleSheet
-{
- readonly attribute nsIDOMCSSRuleList cssRules;
-
- unsigned long insertRule(in DOMString rule,
- in unsigned long index)
- raises(DOMException);
- void deleteRule(in unsigned long index)
- raises(DOMException);
-};
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -19,17 +19,16 @@
#include "nsMediaList.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsQueryObject.h"
#include "nsString.h"
#include "nsStyleSet.h"
#include "nsTArray.h"
-#include "nsIDOMCSSStyleSheet.h"
#include "mozilla/dom/CSSRuleList.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMNode.h"
#include "nsError.h"
#include "nsCSSParser.h"
#include "mozilla/css/Loader.h"
#include "nsNameSpaceManager.h"
#include "nsXMLNameSpaceMap.h"
@@ -430,17 +429,17 @@ CSSStyleSheet::TraverseInner(nsCycleColl
}
}
StyleSheet::TraverseInner(cb);
}
// QueryInterface implementation for CSSStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSStyleSheet)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSStyleSheet)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheet)
if (aIID.Equals(NS_GET_IID(CSSStyleSheet)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_INTERFACE_MAP_END_INHERITING(StyleSheet)
NS_IMPL_ADDREF_INHERITED(CSSStyleSheet, StyleSheet)
NS_IMPL_RELEASE_INHERITED(CSSStyleSheet, StyleSheet)
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -2595,17 +2595,17 @@ Loader::StartAlternateLoads()
NS_IMPL_CYCLE_COLLECTION_CLASS(Loader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Loader)
if (tmp->mSheets) {
for (auto iter = tmp->mSheets->mCompleteSheets.Iter();
!iter.Done();
iter.Next()) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
- cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, iter.UserData()));
+ cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMStyleSheet*, iter.UserData()));
}
}
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver>>::ForwardIterator
it(tmp->mObservers);
while (it.HasMore()) {
ImplCycleCollectionTraverse(cb, it.GetNext(),
"mozilla::css::Loader.mObservers");
}
--- a/layout/style/ServoImportRule.cpp
+++ b/layout/style/ServoImportRule.cpp
@@ -40,20 +40,20 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(ServoImpo
NS_IMPL_ADDREF_INHERITED(ServoImportRule, dom::CSSImportRule)
NS_IMPL_RELEASE_INHERITED(ServoImportRule, dom::CSSImportRule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoImportRule,
dom::CSSImportRule)
// Note the child sheet twice, since the Servo rule also holds a strong
// reference to it.
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildSheet");
- cb.NoteXPCOMChild(static_cast<nsIDOMCSSStyleSheet*>(tmp->mChildSheet));
+ cb.NoteXPCOMChild(static_cast<nsIDOMStyleSheet*>(tmp->mChildSheet));
MOZ_ASSERT_IF(tmp->mRawRule,
Servo_ImportRule_GetSheet(tmp->mRawRule) == tmp->mChildSheet);
- cb.NoteXPCOMChild(static_cast<nsIDOMCSSStyleSheet*>(tmp->mChildSheet));
+ cb.NoteXPCOMChild(static_cast<nsIDOMStyleSheet*>(tmp->mChildSheet));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mRawRule.stylesheet");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ServoImportRule)
if (tmp->mChildSheet) {
tmp->mChildSheet->SetOwnerRule(nullptr);
tmp->mChildSheet = nullptr;
}
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -16,17 +16,16 @@
#include "mozilla/css/GroupRule.h"
#include "mozilla/dom/CSSRuleList.h"
#include "mozilla/dom/MediaList.h"
#include "nsIStyleSheetLinkingElement.h"
#include "Loader.h"
#include "mozAutoDocUpdate.h"
-#include "nsIDOMCSSStyleSheet.h"
using namespace mozilla::dom;
namespace mozilla {
// -------------------------------
// CSS Style Sheet Inner Data Container
//
@@ -168,17 +167,17 @@ ServoStyleSheet::~ServoStyleSheet()
void
ServoStyleSheet::LastRelease()
{
DropRuleList();
}
// QueryInterface implementation for ServoStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoStyleSheet)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSStyleSheet)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheet)
if (aIID.Equals(NS_GET_IID(ServoStyleSheet)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_INTERFACE_MAP_END_INHERITING(StyleSheet)
NS_IMPL_ADDREF_INHERITED(ServoStyleSheet, StyleSheet)
NS_IMPL_RELEASE_INHERITED(ServoStyleSheet, StyleSheet)
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -29,17 +29,16 @@
#include "nsCSSAnonBoxes.h"
#include "nsTArray.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "mozAutoDocUpdate.h"
#include "nsRuleProcessorData.h"
class nsIDOMCSSStyleDeclaration;
-class nsIDOMCSSStyleSheet;
using namespace mozilla;
#define NS_IF_CLONE(member_) \
PR_BEGIN_MACRO \
if (member_) { \
result->member_ = member_->Clone(); \
if (!result->member_) { \
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -131,27 +131,26 @@ StyleSheet::TraverseInner(nsCycleCollect
// because otherwise there are no JS wrappers for anything in the inner.
if (mInner->mSheets.Length() != 1) {
return;
}
StyleSheet* childSheet = GetFirstChild();
while (childSheet) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "child sheet");
- cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, childSheet));
+ cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMStyleSheet*, childSheet));
childSheet = childSheet->mNext;
}
}
// QueryInterface implementation for StyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StyleSheet)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsICSSLoaderObserver)
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheet)
- NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleSheet)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleSheet)
// We want to disconnect from our inner as soon as our refcount drops to zero,
// without waiting for async deletion by the cycle collector. Otherwise we
// might end up cloning the inner if someone mutates another sheet that shares
// it with us, even though there is only one such sheet and we're about to go
// away. This situation arises easily with sheet preloading.
@@ -380,44 +379,16 @@ StyleSheet::GetParentStyleSheet(nsIDOMSt
NS_IMETHODIMP
StyleSheet::GetMedia(nsIDOMMediaList** aMedia)
{
NS_ADDREF(*aMedia = Media());
return NS_OK;
}
-NS_IMETHODIMP
-StyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
-{
- ErrorResult rv;
- nsCOMPtr<nsIDOMCSSRuleList> rules =
- GetCssRules(*nsContentUtils::SubjectPrincipal(), rv);
- rules.forget(aCssRules);
- return rv.StealNSResult();
-}
-
-NS_IMETHODIMP
-StyleSheet::InsertRule(const nsAString& aRule, uint32_t aIndex,
- uint32_t* aReturn)
-{
- ErrorResult rv;
- *aReturn =
- InsertRule(aRule, aIndex, *nsContentUtils::SubjectPrincipal(), rv);
- return rv.StealNSResult();
-}
-
-NS_IMETHODIMP
-StyleSheet::DeleteRule(uint32_t aIndex)
-{
- ErrorResult rv;
- DeleteRule(aIndex, *nsContentUtils::SubjectPrincipal(), rv);
- return rv.StealNSResult();
-}
-
void
StyleSheet::WillDirty()
{
if (mInner->mComplete) {
EnsureUniqueInner();
}
}
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -8,19 +8,18 @@
#define mozilla_StyleSheet_h
#include "mozilla/css/SheetParsingMode.h"
#include "mozilla/dom/CSSStyleSheetBinding.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/CORSMode.h"
#include "mozilla/ServoUtils.h"
-
#include "nsICSSLoaderObserver.h"
-#include "nsIDOMCSSStyleSheet.h"
+#include "nsIDOMStyleSheet.h"
#include "nsWrapperCache.h"
class nsIDocument;
class nsINode;
class nsIPrincipal;
class nsCSSRuleProcessor;
namespace mozilla {
@@ -41,33 +40,33 @@ class SRIMetadata;
namespace css {
class GroupRule;
class Rule;
}
/**
* Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
-class StyleSheet : public nsIDOMCSSStyleSheet
+class StyleSheet : public nsIDOMStyleSheet
, public nsICSSLoaderObserver
, public nsWrapperCache
{
protected:
StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode);
StyleSheet(const StyleSheet& aCopy,
StyleSheet* aParentToUse,
dom::CSSImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse);
virtual ~StyleSheet();
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(StyleSheet,
- nsIDOMCSSStyleSheet)
+ nsIDOMStyleSheet)
/**
* The different changes that a stylesheet may go through.
*
* Used by the StyleSets in order to handle more efficiently some kinds of
* changes.
*/
enum class ChangeType {
@@ -243,22 +242,16 @@ public:
NS_IMETHOD GetDisabled(bool* aDisabled) final;
NS_IMETHOD SetDisabled(bool aDisabled) final;
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) final;
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
NS_IMETHOD GetHref(nsAString& aHref) final;
NS_IMETHOD GetTitle(nsAString& aTitle) final;
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
- // nsIDOMCSSStyleSheet
- NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) final;
- NS_IMETHOD InsertRule(const nsAString& aRule, uint32_t aIndex,
- uint32_t* aReturn) final;
- NS_IMETHOD DeleteRule(uint32_t aIndex) final;
-
// Changes to sheets should be inside of a WillDirty-DidDirty pair.
// However, the calls do not need to be matched; it's ok to call
// WillDirty and then make no change and skip the DidDirty call.
void WillDirty();
virtual void DidDirty() {}
// Called when a rule changes from CSSOM.
//
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -84,17 +84,17 @@ StyleSheet::GetParentStyleSheet() const
}
dom::ParentObject
StyleSheet::GetParentObject() const
{
if (mOwningNode) {
return dom::ParentObject(mOwningNode);
}
- return dom::ParentObject(static_cast<nsIDOMCSSStyleSheet*>(mParent), mParent);
+ return dom::ParentObject(static_cast<nsIDOMStyleSheet*>(mParent), mParent);
}
nsIPrincipal*
StyleSheet::Principal() const
{
return SheetInfo().mPrincipal;
}
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -18,17 +18,16 @@
#include "mozilla/css/NameSpaceRule.h"
#include "nsString.h"
#include "nsAtom.h"
#include "nsCSSProps.h"
#include "nsCOMPtr.h"
-#include "nsIDOMCSSStyleSheet.h"
#include "nsMediaList.h"
#include "mozilla/dom/CSSRuleList.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "nsStyleUtil.h"
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -16,17 +16,16 @@
#include "nsIDOMCharacterData.h"
#include "nsIDOMClientRect.h"
#include "nsIDOMClientRectList.h"
#include "nsIDOMClipboardEvent.h"
#include "nsIDOMCommandEvent.h"
#include "nsIDOMComment.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMCSSStyleDeclaration.h"
-#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSValue.h"
#include "nsIDOMCSSValueList.h"
#include "nsIDOMCustomEvent.h"
#ifdef MOZ_WEBRTC
#include "nsIDOMDataChannel.h"
#endif
#include "nsIDOMDataTransfer.h"
#include "nsIDOMDOMCursor.h"
@@ -260,17 +259,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRectList, DOMRectList),
DEFINE_SHIM(ClipboardEvent),
DEFINE_SHIM(CommandEvent),
DEFINE_SHIM(Comment),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIContainerBoxObject, ContainerBoxObject),
DEFINE_SHIM(CSSPrimitiveValue),
DEFINE_SHIM(CSSStyleDeclaration),
- DEFINE_SHIM(CSSStyleSheet),
DEFINE_SHIM(CSSValue),
DEFINE_SHIM(CSSValueList),
DEFINE_SHIM(CustomEvent),
#ifdef MOZ_WEBRTC
DEFINE_SHIM(DataChannel),
#endif
DEFINE_SHIM(DataTransfer),
DEFINE_SHIM(DOMCursor),