Bug 1427512 - Part 22: Remove nsIDOMStyleSheet. r=xidorn,bz

MozReview-Commit-ID: KO2mWX4P8lI
This commit is contained in:
Cameron McCormack 2018-01-11 16:17:57 +08:00
parent 0ae07fab78
commit e3549b2d1c
21 changed files with 25 additions and 121 deletions

View File

@ -215,7 +215,6 @@
@RESPATH@/components/dom_security.xpt
@RESPATH@/components/dom_sidebar.xpt
@RESPATH@/components/dom_storage.xpt
@RESPATH@/components/dom_stylesheets.xpt
@RESPATH@/components/dom_traversal.xpt
#ifdef MOZ_WEBSPEECH
@RESPATH@/components/dom_webspeechrecognition.xpt

View File

@ -98,7 +98,6 @@
#include "GeckoProfiler.h"
#include "mozilla/Preferences.h"
#include "nsIContentIterator.h"
#include "nsIDOMStyleSheet.h"
#include "nsIStyleSheetService.h"
#include "nsContentPermissionHelper.h"
#include "nsCSSPseudoElements.h" // for CSSPseudoElementType

View File

@ -58,7 +58,6 @@
#include "mozilla/EventStateManager.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMStyleSheet.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsIDOMDOMImplementation.h"

View File

@ -25,7 +25,6 @@
#include "nsIDocument.h"
#include "nsIDOMComment.h"
#include "nsIDOMNode.h"
#include "nsIDOMStyleSheet.h"
#include "nsUnicharUtils.h"
#include "nsCRT.h"
#include "nsXPCOMCIDInternal.h"

View File

@ -20,7 +20,6 @@
#include "nsIContentInlines.h"
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsIDOMStyleSheet.h"
#include "nsINode.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsIURL.h"

View File

@ -7,7 +7,6 @@
#include "mozilla/dom/HTMLStyleElementBinding.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDocument.h"
#include "nsUnicharUtils.h"
#include "nsThreadUtils.h"

View File

@ -40,9 +40,6 @@ class DOMException;
}
%}
// Style Sheets
interface nsIDOMStyleSheet;
// Base
interface nsIDOMWindow;
interface nsIDOMWindowCollection;

View File

@ -1,15 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
XPIDL_SOURCES += [
'nsIDOMStyleSheet.idl',
]
XPIDL_MODULE = 'dom_stylesheets'

View File

@ -1,25 +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"
/**
* The nsIDOMStyleSheet interface is a datatype for a 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(a6cf9080-15b3-11d2-932e-00805f8add32)]
interface nsIDOMStyleSheet : nsISupports
{
readonly attribute DOMString type;
attribute boolean disabled;
readonly attribute nsIDOMNode ownerNode;
readonly attribute nsIDOMStyleSheet parentStyleSheet;
readonly attribute DOMString href;
readonly attribute DOMString title;
};

View File

@ -19,7 +19,6 @@ interfaces = [
'core',
'html',
'events',
'stylesheets',
'sidebar',
'css',
'traversal',

View File

@ -10,7 +10,7 @@
interface StyleSheet {
[Constant]
readonly attribute DOMString type;
[Constant]
[Constant, Throws]
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]

View File

@ -32,7 +32,6 @@
#include "nsIInlineSpellChecker.h"
#include "mozilla/css/Loader.h"
#include "nsIDOMStyleSheet.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
@ -2894,7 +2893,8 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL,
nsCOMPtr<nsIDocument> document = GetDocument();
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
return sheet->SetDisabled(!aEnable);
sheet->SetDisabled(!aEnable);
return NS_OK;
}
bool

View File

@ -433,7 +433,6 @@ CSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
// QueryInterface implementation for CSSStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSStyleSheet)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheet)
if (aIID.Equals(NS_GET_IID(CSSStyleSheet)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else

View File

@ -61,7 +61,6 @@
#include "nsXULPrototypeCache.h"
#endif
#include "nsIDOMStyleSheet.h"
#include "nsError.h"
#include "nsIContentSecurityPolicy.h"
@ -2600,7 +2599,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Loader)
!iter.Done();
iter.Next()) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMStyleSheet*, iter.UserData()));
cb.NoteXPCOMChild(iter.UserData());
}
}
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver>>::ForwardIterator

View File

@ -45,10 +45,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoImportRule,
// 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<nsIDOMStyleSheet*>(tmp->mChildSheet));
cb.NoteXPCOMChild(tmp->mChildSheet);
MOZ_ASSERT_IF(tmp->mRawRule,
Servo_ImportRule_GetSheet(tmp->mRawRule) == tmp->mChildSheet);
cb.NoteXPCOMChild(static_cast<nsIDOMStyleSheet*>(tmp->mChildSheet));
cb.NoteXPCOMChild(tmp->mChildSheet);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mRawRule.stylesheet");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

View File

@ -172,7 +172,6 @@ ServoStyleSheet::LastRelease()
// QueryInterface implementation for ServoStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoStyleSheet)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheet)
if (aIID.Equals(NS_GET_IID(ServoStyleSheet)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else

View File

@ -136,7 +136,7 @@ StyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
StyleSheet* childSheet = GetFirstChild();
while (childSheet) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "child sheet");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMStyleSheet*, childSheet));
cb.NoteXPCOMChild(childSheet);
childSheet = childSheet->mNext;
}
}
@ -145,7 +145,7 @@ StyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
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(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleSheet)
@ -313,68 +313,40 @@ StyleSheet::ChildSheetListBuilder::ReparentChildList(StyleSheet* aPrimarySheet,
}
}
// nsIDOMStyleSheet interface
NS_IMETHODIMP
void
StyleSheet::GetType(nsAString& aType)
{
aType.AssignLiteral("text/css");
return NS_OK;
}
NS_IMETHODIMP
StyleSheet::GetDisabled(bool* aDisabled)
{
*aDisabled = Disabled();
return NS_OK;
}
NS_IMETHODIMP
void
StyleSheet::SetDisabled(bool aDisabled)
{
// DOM method, so handle BeginUpdate/EndUpdate
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
SetEnabled(!aDisabled);
return NS_OK;
}
NS_IMETHODIMP
StyleSheet::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
nsCOMPtr<nsIDOMNode> ownerNode = do_QueryInterface(GetOwnerNode());
ownerNode.forget(aOwnerNode);
return NS_OK;
}
NS_IMETHODIMP
StyleSheet::GetHref(nsAString& aHref)
void
StyleSheet::GetHref(nsAString& aHref, ErrorResult& aRv)
{
if (nsIURI* sheetURI = SheetInfo().mOriginalSheetURI) {
nsAutoCString str;
nsresult rv = sheetURI->GetSpec(str);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
}
CopyUTF8toUTF16(str, aHref);
} else {
SetDOMStringToNull(aHref);
}
return NS_OK;
}
NS_IMETHODIMP
void
StyleSheet::GetTitle(nsAString& aTitle)
{
aTitle.Assign(mTitle);
return NS_OK;
}
// nsIDOMStyleSheet interface
NS_IMETHODIMP
StyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
{
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
NS_IF_ADDREF(*aParentStyleSheet = GetParentStyleSheet());
return NS_OK;
}
void

View File

@ -14,7 +14,6 @@
#include "mozilla/CORSMode.h"
#include "mozilla/ServoUtils.h"
#include "nsICSSLoaderObserver.h"
#include "nsIDOMStyleSheet.h"
#include "nsWrapperCache.h"
class nsIDocument;
@ -45,8 +44,7 @@ class Rule;
/**
* Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
class StyleSheet : public nsIDOMStyleSheet
, public nsICSSLoaderObserver
class StyleSheet : public nsICSSLoaderObserver
, public nsWrapperCache
{
protected:
@ -60,8 +58,7 @@ protected:
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(StyleSheet,
nsIDOMStyleSheet)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StyleSheet)
/**
* The different changes that a stylesheet may go through.
@ -99,7 +96,7 @@ public:
* BeginUpdate() or EndUpdate() on the document -- calling those is
* the caller's responsibility. This allows use of SetEnabled when
* batched updates are desired. If you want updates handled for
* you, see nsIDOMStyleSheet::SetDisabled().
* you, see SetDisabled().
*/
void SetEnabled(bool aEnabled);
@ -205,14 +202,14 @@ public:
#endif
// WebIDL StyleSheet API
// The XPCOM GetType is fine for WebIDL.
// The XPCOM GetHref is fine for WebIDL
void GetType(nsAString& aType);
void GetHref(nsAString& aHref, ErrorResult& aRv);
// GetOwnerNode is defined above.
inline StyleSheet* GetParentStyleSheet() const;
// The XPCOM GetTitle is fine for WebIDL.
void GetTitle(nsAString& aTitle);
dom::MediaList* Media();
bool Disabled() const { return mDisabled; }
// The XPCOM SetDisabled is fine for WebIDL.
void SetDisabled(bool aDisabled);
void GetSourceMapURL(nsAString& aTitle);
void SetSourceMapURL(const nsAString& aSourceMapURL);
void SetSourceMapURLFromComment(const nsAString& aSourceMapURLFromComment);
@ -237,15 +234,6 @@ public:
inline dom::ParentObject GetParentObject() const;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
// nsIDOMStyleSheet interface
NS_IMETHOD GetType(nsAString& aType) final;
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;
// 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.

View File

@ -89,7 +89,7 @@ StyleSheet::GetParentObject() const
if (mOwningNode) {
return dom::ParentObject(mOwningNode);
}
return dom::ParentObject(static_cast<nsIDOMStyleSheet*>(mParent), mParent);
return dom::ParentObject(mParent);
}
nsIPrincipal*

View File

@ -145,7 +145,6 @@
@BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_mobilemessage.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_system.xpt
@BINPATH@/components/dom_traversal.xpt
@BINPATH@/components/dom_tv.xpt

View File

@ -69,7 +69,6 @@
#include "nsIDOMScrollAreaEvent.h"
#include "nsIDOMSerializer.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMSVGElement.h"
#include "nsIDOMSVGLength.h"
#include "nsIDOMText.h"
@ -314,7 +313,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
DEFINE_SHIM(SimpleGestureEvent),
DEFINE_SHIM(StyleSheet),
DEFINE_SHIM(SVGElement),
DEFINE_SHIM(SVGLength),
DEFINE_SHIM(Text),