diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 8dfce90ca76d..ef70929d111c 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -132,8 +132,8 @@ typedef CallbackObjectHolder NodeFilterHolder; } // namespace mozilla #define NS_IDOCUMENT_IID \ -{ 0xd3bf7259, 0xbe90, 0x4de7, \ - { 0x85, 0x77, 0x22, 0xf2, 0x45, 0xf8, 0x16, 0xd5} } +{ 0xc9e11955, 0xaa55, 0x49a1, \ + { 0x94, 0x29, 0x58, 0xe9, 0xbe, 0xf6, 0x79, 0x54 } } // Enum for requesting a particular type of document when creating a doc enum DocumentFlavor { @@ -851,7 +851,6 @@ public: }; virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) = 0; - virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet) = 0; virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) = 0; virtual nsIStyleSheet* FirstAdditionalAuthorSheet() = 0; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 839e4de5d02b..4623b45a48c5 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -4221,34 +4221,22 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR true, getter_AddRefs(sheet)); NS_ENSURE_SUCCESS(rv, rv); + mAdditionalSheets[aType].AppendObject(sheet); sheet->SetOwningDocument(this); MOZ_ASSERT(sheet->IsApplicable()); - return AddAdditionalStyleSheet(aType, sheet); -} - -nsresult -nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet) -{ - if (mAdditionalSheets[aType].Contains(aSheet)) - return NS_ERROR_INVALID_ARG; - - if (!aSheet->IsApplicable()) - return NS_ERROR_INVALID_ARG; - - mAdditionalSheets[aType].AppendObject(aSheet); - BeginUpdate(UPDATE_STYLE); nsCOMPtr shell = GetShell(); if (shell) { nsStyleSet::sheetType type = ConvertAdditionalSheetType(aType); - shell->StyleSet()->AppendStyleSheet(type, aSheet); + shell->StyleSet()->AppendStyleSheet(type, sheet); } // Passing false, so documet.styleSheets.length will not be affected by // these additional sheets. - NotifyStyleSheetAdded(aSheet, false); + NotifyStyleSheetAdded(sheet, false); EndUpdate(UPDATE_STYLE); + return NS_OK; } @@ -11887,10 +11875,6 @@ SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet, MallocSizeOf aMallocSizeOf, void* aData) { - if (!aStyleSheet->GetOwningDocument()) { - // Avoid over-reporting shared sheets. - return 0; - } return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf); } diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index cccee4878071..744bc79ab7da 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -809,7 +809,6 @@ public: bool aApplicable) MOZ_OVERRIDE; virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) MOZ_OVERRIDE; - virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet) MOZ_OVERRIDE; virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) MOZ_OVERRIDE; virtual nsIStyleSheet* FirstAdditionalAuthorSheet() MOZ_OVERRIDE; diff --git a/dom/base/moz.build b/dom/base/moz.build index 38df0a5d1acd..3639bdcdc1e9 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -161,7 +161,6 @@ LOCAL_INCLUDES += [ '/content/base/src', '/content/html/document/src', '/content/xul/document/src', - '/layout/base', '/layout/generic', '/layout/style', '/layout/xul', diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 6b38b091d776..0c5a439e22df 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -90,8 +90,6 @@ #include "GeckoProfiler.h" #include "mozilla/Preferences.h" #include "nsIContentIterator.h" -#include "nsIDOMStyleSheet.h" -#include "nsIStyleSheet.h" #include "nsContentPermissionHelper.h" #ifdef XP_WIN @@ -3369,28 +3367,6 @@ nsDOMWindowUtils::LoadSheet(nsIURI *aSheetURI, uint32_t aSheetType) return doc->LoadAdditionalStyleSheet(type, aSheetURI); } -NS_IMETHODIMP -nsDOMWindowUtils::AddSheet(nsIDOMStyleSheet *aSheet, uint32_t aSheetType) -{ - MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome()); - - NS_ENSURE_ARG_POINTER(aSheet); - NS_ENSURE_ARG(aSheetType == AGENT_SHEET || - aSheetType == USER_SHEET || - aSheetType == AUTHOR_SHEET); - - nsCOMPtr doc = GetDocument(); - NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); - - nsIDocument::additionalSheetType type = convertSheetType(aSheetType); - nsCOMPtr sheet = do_QueryInterface(aSheet); - NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE); - if (sheet->GetOwningDocument()) { - return NS_ERROR_INVALID_ARG; - } - return doc->AddAdditionalStyleSheet(type, sheet); -} - NS_IMETHODIMP nsDOMWindowUtils::RemoveSheet(nsIURI *aSheetURI, uint32_t aSheetType) { diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 80a885c37b18..92a3ef263a05 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -35,7 +35,6 @@ interface nsIDOMNodeList; interface nsIDOMElement; interface nsIDOMHTMLCanvasElement; interface nsIDOMEvent; -interface nsIDOMStyleSheet; interface nsITransferable; interface nsIQueryContentEventResult; interface nsIDOMWindow; @@ -51,7 +50,7 @@ interface nsITranslationNodeList; interface nsIJSRAIIHelper; interface nsIContentPermissionRequest; -[scriptable, uuid(4c4c8c17-5a73-4d7e-a8e7-f67bfebb97f5)] +[scriptable, uuid(ca202fa7-7b8f-4814-acc3-a8545f67320b)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1564,22 +1563,15 @@ interface nsIDOMWindowUtils : nsISupports { * * Sheets added via this API take effect immediately on the document. */ - void loadSheet(in nsIURI sheetURI, in unsigned long type); - - /** - * Adds a style sheet to the list of additional style sheets of the document. - * - * Style sheets can be preloaded with nsIStyleSheetService.preloadSheet. - * - * Sheets added via this API take effect immediately on the document. - */ - void addSheet(in nsIDOMStyleSheet sheet, in unsigned long type); + void loadSheet(in nsIURI sheetURI, + in unsigned long type); /** * Remove the document style sheet at |sheetURI| from the list of additional * style sheets of the document. The removal takes effect immediately. */ - void removeSheet(in nsIURI sheetURI, in unsigned long type); + void removeSheet(in nsIURI sheetURI, + in unsigned long type); /** * Returns true if a user input is being handled. diff --git a/layout/base/nsIStyleSheetService.idl b/layout/base/nsIStyleSheetService.idl index f63fbc2d824a..f9091713da76 100644 --- a/layout/base/nsIStyleSheetService.idl +++ b/layout/base/nsIStyleSheetService.idl @@ -8,14 +8,13 @@ #include "nsISupports.idl" interface nsIURI; -interface nsIDOMStyleSheet; /* * nsIStyleSheetService allows extensions or embeddors to add to the * built-in list of user or agent style sheets. */ -[scriptable, uuid(4c4c8c17-5a73-4d7e-a8e7-f67bfebb97f5)] +[scriptable, uuid(1f42a6a2-ab0a-45d4-8a96-396f58ea6c6d)] interface nsIStyleSheetService : nsISupports { const unsigned long AGENT_SHEET = 0; @@ -47,12 +46,6 @@ interface nsIStyleSheetService : nsISupports */ boolean sheetRegistered(in nsIURI sheetURI, in unsigned long type); - /** - * Synchronously loads a style sheet from |sheetURI| and returns the - * new style sheet object. Can be used with nsIDOMWindowUtils.addSheet. - */ - nsIDOMStyleSheet preloadSheet(in nsIURI sheetURI, in unsigned long type); - /** * Remove the style sheet at |sheetURI| from the list of style sheets * specified by |type|. The removal takes effect immediately, even for diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index a09405ba5541..33fedf8a8457 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -214,27 +214,6 @@ nsStyleSheetService::SheetRegistered(nsIURI *sheetURI, return NS_OK; } -NS_IMETHODIMP -nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType, - nsIDOMStyleSheet **aSheet) -{ - NS_ENSURE_ARG(aSheetType == AGENT_SHEET || - aSheetType == USER_SHEET || - aSheetType == AUTHOR_SHEET); - NS_ENSURE_ARG_POINTER(aSheetURI); - NS_PRECONDITION(aSheet, "Null out param"); - - nsRefPtr loader = new css::Loader(); - - // Allow UA sheets, but not user sheets, to use unsafe rules - nsRefPtr sheet; - nsresult rv = loader->LoadSheetSync(aSheetURI, aSheetType == AGENT_SHEET, - true, getter_AddRefs(sheet)); - NS_ENSURE_SUCCESS(rv, rv); - sheet.forget(aSheet); - return NS_OK; -} - NS_IMETHODIMP nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType) { diff --git a/layout/base/nsStyleSheetService.h b/layout/base/nsStyleSheetService.h index 31346fdea486..967fc7f7e34f 100644 --- a/layout/base/nsStyleSheetService.h +++ b/layout/base/nsStyleSheetService.h @@ -63,7 +63,7 @@ class nsStyleSheetService MOZ_FINAL // Like LoadAndRegisterSheet, but doesn't notify. If successful, the // new sheet will be the last sheet in mSheets[aSheetType]. nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI, - uint32_t aSheetType); + uint32_t aSheetType); nsCOMArray mSheets[3]; };