Bug 1434318 part 11. Remove nsIDOMDocument's stylesheet set APIs. r=mystor

MozReview-Commit-ID: 9ABdbYKZI6k
This commit is contained in:
Boris Zbarsky
2018-01-31 15:18:11 -05:00
parent 2dd62cde3b
commit d0efb8b7e7
5 changed files with 7 additions and 145 deletions

View File

@@ -6140,13 +6140,6 @@ nsDocument::BlockedTrackingNodes() const
return list.forget();
}
NS_IMETHODIMP
nsDocument::GetMozSelectedStyleSheetSet(nsAString& aSheetSet)
{
nsIDocument::GetSelectedStyleSheetSet(aSheetSet);
return NS_OK;
}
void
nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
{
@@ -6176,13 +6169,6 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
}
}
NS_IMETHODIMP
nsDocument::SetMozSelectedStyleSheetSet(const nsAString& aSheetSet)
{
SetSelectedStyleSheetSet(aSheetSet);
return NS_OK;
}
void
nsDocument::SetSelectedStyleSheetSet(const nsAString& aSheetSet)
{
@@ -6196,41 +6182,18 @@ nsDocument::SetSelectedStyleSheetSet(const nsAString& aSheetSet)
EnableStyleSheetsForSetInternal(aSheetSet, true);
}
NS_IMETHODIMP
void
nsDocument::GetLastStyleSheetSet(nsAString& aSheetSet)
{
nsString sheetSet;
GetLastStyleSheetSet(sheetSet);
aSheetSet = sheetSet;
return NS_OK;
}
void
nsDocument::GetLastStyleSheetSet(nsString& aSheetSet)
{
aSheetSet = mLastStyleSheetSet;
}
NS_IMETHODIMP
nsDocument::GetPreferredStyleSheetSet(nsAString& aSheetSet)
{
nsIDocument::GetPreferredStyleSheetSet(aSheetSet);
return NS_OK;
}
void
nsIDocument::GetPreferredStyleSheetSet(nsAString& aSheetSet)
{
GetHeaderData(nsGkAtoms::headerDefaultStyle, aSheetSet);
}
NS_IMETHODIMP
nsDocument::GetStyleSheetSets(nsISupports** aList)
{
NS_ADDREF(*aList = StyleSheetSets());
return NS_OK;
}
DOMStringList*
nsDocument::StyleSheetSets()
{
@@ -6240,13 +6203,6 @@ nsDocument::StyleSheetSets()
return mStyleSheetSetList;
}
NS_IMETHODIMP
nsDocument::MozEnableStyleSheetsForSet(const nsAString& aSheetSet)
{
EnableStyleSheetsForSet(aSheetSet);
return NS_OK;
}
void
nsDocument::EnableStyleSheetsForSet(const nsAString& aSheetSet)
{

View File

@@ -959,7 +959,7 @@ public:
GetImplementation(mozilla::ErrorResult& rv) override;
virtual void SetSelectedStyleSheetSet(const nsAString& aSheetSet) override;
virtual void GetLastStyleSheetSet(nsString& aSheetSet) override;
virtual void GetLastStyleSheetSet(nsAString& aSheetSet) override;
virtual mozilla::dom::DOMStringList* StyleSheetSets() override;
virtual void EnableStyleSheetsForSet(const nsAString& aSheetSet) override;
virtual already_AddRefed<Element> CreateElement(const nsAString& aTagName,

View File

@@ -2951,7 +2951,7 @@ public:
#endif
void GetSelectedStyleSheetSet(nsAString& aSheetSet);
virtual void SetSelectedStyleSheetSet(const nsAString& aSheetSet) = 0;
virtual void GetLastStyleSheetSet(nsString& aSheetSet) = 0;
virtual void GetLastStyleSheetSet(nsAString& aSheetSet) = 0;
void GetPreferredStyleSheetSet(nsAString& aSheetSet);
virtual mozilla::dom::DOMStringList* StyleSheetSets() = 0;
virtual void EnableStyleSheetsForSet(const nsAString& aSheetSet) = 0;

View File

@@ -99,95 +99,6 @@ interface nsIDOMDocument : nsIDOMNode
*/
readonly attribute nsIDOMElement activeElement;
// CSSOM
/**
* This attribute must return the preferred style sheet set as set by the
* author. It is determined from the order of style sheet declarations and
* the Default-Style HTTP headers, as eventually defined elsewhere in the Web
* Apps 1.0 specification. If there is no preferred style sheet set, this
* attribute must return the empty string. The case of this attribute must
* exactly match the case given by the author where the preferred style sheet
* is specified or implied. This attribute must never return null.
*
* @see <http://dev.w3.org/csswg/cssom/#dom-document-preferredStyleSheetSet>
*/
readonly attribute DOMString preferredStyleSheetSet;
/**
* This attribute indicates which style sheet set is in use. This attribute
* is live; changing the disabled attribute on style sheets directly will
* change the value of this attribute.
*
* If all the sheets that are enabled and have a title have the same title
* (by case-sensitive comparisons) then the value of this attribute must be
* exactly equal to the title of the first enabled style sheet with a title
* in the styleSheets list. Otherwise, if style sheets from different sets
* are enabled, then the return value must be null (there is no way to
* determine what the currently selected style sheet set is in those
* conditions). Otherwise, either all style sheets that have a title are
* disabled, or there are no alternate style sheets, and
* selectedStyleSheetSet must return the empty string.
*
* Setting this attribute to the null value must have no effect.
*
* Setting this attribute to a non-null value must call
* enableStyleSheetsForSet() with that value as the function's argument, and
* set lastStyleSheetSet to that value.
*
* From the DOM's perspective, all views have the same
* selectedStyleSheetSet. If a UA supports multiple views with different
* selected alternate style sheets, then this attribute (and the StyleSheet
* interface's disabled attribute) must return and set the value for the
* default view.
*
* @see <http://dev.w3.org/csswg/cssom/#dom-document-selectedStyleSheetSet>
*/
[binaryname(MozSelectedStyleSheetSet)]
attribute DOMString selectedStyleSheetSet;
/*
* This property must initially have the value null. Its value changes when
* the selectedStyleSheetSet attribute is set.
*
* @see <http://dev.w3.org/csswg/cssom/#dom-document-lastStyleSheetSet>
*/
readonly attribute DOMString lastStyleSheetSet;
/**
* This must return the live list of the currently available style sheet
* sets. This list is constructed by enumerating all the style sheets for
* this document available to the implementation, in the order they are
* listed in the styleSheets attribute, adding the title of each style sheet
* with a title to the list, avoiding duplicates by dropping titles that
* match (case-sensitively) titles that have already been added to the
* list.
*
* @see <http://dev.w3.org/csswg/cssom/#dom-document-styleSheetSets>
*/
readonly attribute nsISupports styleSheetSets;
/**
* Calling this method must change the disabled attribute on each StyleSheet
* object with a title attribute with a length greater than 0 in the
* styleSheets attribute, so that all those whose title matches the name
* argument are enabled, and all others are disabled. Title matches must be
* case-sensitive. Calling this method with the empty string disables all
* alternate and preferred style sheets (but does not change the state of
* persistent style sheets, that is those with no title attribute).
*
* Calling this method with a null value must have no effect.
*
* Style sheets that do not have a title are never affected by this
* method. This method does not change the values of the lastStyleSheetSet or
* preferredStyleSheetSet attributes.
*
* @see <http://dev.w3.org/csswg/cssom/#dom-document-enableStyleSheetsForSet>
*/
[binaryname(MozEnableStyleSheetsForSet)]
void enableStyleSheetsForSet(in DOMString name);
// CSSOM-View
/**
* Returns the element from the caller's document at the given point,

View File

@@ -25,7 +25,6 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsIProtocolHandler.h"
@@ -399,10 +398,7 @@ Loader::Loader(nsIDocument* aDocument)
// We can just use the preferred set, since there are no sheets in the
// document yet (if there are, how did they get there? _we_ load the sheets!)
// and hence the selected set makes no sense at this time.
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
if (domDoc) {
domDoc->GetPreferredStyleSheetSet(mPreferredSheet);
}
mDocument->GetPreferredStyleSheetSet(mPreferredSheet);
}
Loader::~Loader()
@@ -432,12 +428,11 @@ nsresult
Loader::SetPreferredSheet(const nsAString& aTitle)
{
#ifdef DEBUG
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(mDocument);
if (doc) {
if (mDocument) {
nsAutoString currentPreferred;
doc->GetLastStyleSheetSet(currentPreferred);
mDocument->GetLastStyleSheetSet(currentPreferred);
if (DOMStringIsNull(currentPreferred)) {
doc->GetPreferredStyleSheetSet(currentPreferred);
mDocument->GetPreferredStyleSheetSet(currentPreferred);
}
NS_ASSERTION(currentPreferred.Equals(aTitle),
"Unexpected argument to SetPreferredSheet");