Bug 658904 - Remove nsIDOMDocumentStyle; r=roc,jst

This commit is contained in:
Ms2ger 2011-05-26 10:18:43 +02:00
Родитель ff1850d58c
Коммит 474738a663
13 изменённых файлов: 103 добавлений и 224 удалений

Просмотреть файл

@ -1688,8 +1688,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3EventTarget)

Просмотреть файл

@ -54,7 +54,6 @@
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
@ -491,7 +490,6 @@ protected:
class nsDocument : public nsIDocument,
public nsIDOMXMLDocument, // inherits nsIDOMDocument
public nsIDOMNSDocument,
public nsIDOMNSDocumentStyle,
public nsIDOMDocumentXBL,
public nsSupportsWeakReference,
public nsIDOMEventTarget,
@ -794,12 +792,6 @@ public:
// nsIDOMNSDocument
NS_DECL_NSIDOMNSDOCUMENT
// nsIDOMDocumentStyle
NS_DECL_NSIDOMDOCUMENTSTYLE
// nsIDOMNSDocumentStyle
NS_DECL_NSIDOMNSDOCUMENTSTYLE
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL

Просмотреть файл

@ -251,7 +251,6 @@
#ifdef MOZ_CSS_ANIMATIONS
#include "nsIDOMAnimationEvent.h"
#endif
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMLinkStyle.h"
@ -2326,8 +2325,6 @@ nsDOMClassInfo::RegisterExternalClasses()
#define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \

Просмотреть файл

@ -25,6 +25,7 @@
* Jonas Sicking <sicking@bigfoot.com>
* Ms2ger <ms2ger@gmail.com>
* Tom Pixley <joki@netscape.com>
* Boris Zbarsky <bzbarsky@mit.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -59,7 +60,7 @@ interface nsIDOMTreeWalker;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(61b2159c-614e-4aff-a626-f34af9bb1759)]
[scriptable, uuid(6e229ccc-ee4a-458b-a298-6ce3146f0904)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -143,4 +144,80 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMEvent createEvent(in DOMString eventType)
raises(DOMException);
readonly attribute nsIDOMStyleSheetList styleSheets;
/**
* 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.
*/
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.
*/
attribute DOMString selectedStyleSheetSet;
/*
* This property must initially have the value null. Its value changes when
* the selectedStyleSheetSet attribute is set.
*/
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.
*/
readonly attribute nsIDOMDOMStringList 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.
*/
void enableStyleSheetsForSet(in DOMString name);
};

Просмотреть файл

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(75f617b4-1c61-4122-9fd7-f4243672848b)]
[scriptable, uuid(8f688a87-637d-40f0-95f9-913de35ac6d7)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

Просмотреть файл

@ -68,7 +68,6 @@ XPIDLSRCS = \
nsIDOMCSSStyleRule.idl \
nsIDOMCSSUnknownRule.idl \
nsIDOMCounter.idl \
nsIDOMDocumentCSS.idl \
nsIDOMRGBColor.idl \
nsIDOMRect.idl \
nsIDOMNSRGBAColor.idl \

Просмотреть файл

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(eb3750ae-d156-4b97-b200-f35276c6510f)]
[scriptable, uuid(a48d2e22-e0e7-49eb-bfd2-71386595cd9a)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString title;

Просмотреть файл

@ -47,7 +47,6 @@ XPIDL_MODULE = dom_stylesheets
GRE_MODULE = 1
SDK_XPIDLSRCS = \
nsIDOMDocumentStyle.idl \
nsIDOMMediaList.idl \
nsIDOMStyleSheet.idl \
nsIDOMStyleSheetList.idl \
@ -55,7 +54,6 @@ SDK_XPIDLSRCS = \
XPIDLSRCS = \
nsIDOMLinkStyle.idl \
nsIDOMNSDocumentStyle.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,54 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
/**
* The nsIDOMDocumentStyle interface is an interface to a document
* object that supports style sheets in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*/
[scriptable, uuid(3d9f4973-dd2e-48f5-b5f7-2634e09eadd9)]
interface nsIDOMDocumentStyle : nsISupports
{
readonly attribute nsIDOMStyleSheetList styleSheets;
};

Просмотреть файл

@ -1,129 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsIDOMNSDocumentStyle interface definition.
*
* The Initial Developer of the Original Code is
* Boris Zbarsky <bzbarsky@mit.edu>
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
#include "nsIDOMDocumentStyle.idl"
/**
* The nsIDOMNSDocumentStyle interface is an extension to the
* nsIDOMDocumentStyle interface. This interface exposes more ways to interact
* with style sheets in the Document Object Model. This interface is currently
* very much experimental.
*
* NOTE: This interface represents the additions to nsIDOMDocumentStyle defined
* by <http://whatwg.org/specs/web-apps/current-work/#alternate-style-sheets>.
* The comments here describe our implementation; if those comments don't match
* that spec, file bugs.
*/
[scriptable, uuid(26311d10-7e24-4c7b-bb3d-17aad86f4d88)]
interface nsIDOMNSDocumentStyle : nsIDOMDocumentStyle
{
/**
* 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.
*/
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.
*/
attribute DOMString selectedStyleSheetSet;
/*
* This property must initially have the value null. Its value changes when
* the selectedStyleSheetSet attribute is set.
*/
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.
*/
readonly attribute nsIDOMDOMStringList 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.
*/
void enableStyleSheetsForSet(in DOMString name);
};

Просмотреть файл

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(2de25143-3fcb-4afc-8900-2c046fb6dc94)]
[scriptable, uuid(27c3e91d-d17d-40bd-ac56-e6b8096a955e)]
interface nsIDOMSVGDocument : nsIDOMDocument
{
readonly attribute DOMString title;

Просмотреть файл

@ -41,7 +41,7 @@
#include "nsIServiceManager.h"
#include "nsVoidArray.h"
#include "nsReadableUtils.h"
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMDocument.h"
#include "nsIDOM3Node.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
@ -120,22 +120,23 @@ inCSSValueSearch::SearchSync()
dom3Node->GetBaseURI(uri);
NS_NewURI(getter_AddRefs(baseURL), uri);
}
nsCOMPtr<nsIDOMDocumentStyle> doc = do_QueryInterface(mDocument);
if (doc) {
nsCOMPtr<nsIDOMStyleSheetList> sheets;
nsresult rv = doc->GetStyleSheets(getter_AddRefs(sheets));
NS_ENSURE_SUCCESS(rv, NS_OK);
PRUint32 length;
sheets->GetLength(&length);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMStyleSheet> sheet;
sheets->Item(i, getter_AddRefs(sheet));
nsCOMPtr<nsIDOMCSSStyleSheet> cssSheet = do_QueryInterface(sheet);
if (cssSheet)
SearchStyleSheet(cssSheet, baseURL);
}
if (!mDocument) {
return NS_OK;
}
nsCOMPtr<nsIDOMStyleSheetList> sheets;
nsresult rv = mDocument->GetStyleSheets(getter_AddRefs(sheets));
NS_ENSURE_SUCCESS(rv, NS_OK);
PRUint32 length;
sheets->GetLength(&length);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMStyleSheet> sheet;
sheets->Item(i, getter_AddRefs(sheet));
nsCOMPtr<nsIDOMCSSStyleSheet> cssSheet = do_QueryInterface(sheet);
if (cssSheet)
SearchStyleSheet(cssSheet, baseURL);
}
// XXX would be nice to search inline style as well.

Просмотреть файл

@ -56,10 +56,10 @@
#include "nsCOMArray.h"
#include "nsString.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsIDOMWindow.h"
#include "nsIDocument.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsIDOMWindow.h"
#include "nsICharsetAlias.h"
#include "nsHashtable.h"
#include "nsIURI.h"
@ -457,7 +457,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<nsIDOMNSDocumentStyle> domDoc(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
if (domDoc) {
domDoc->GetPreferredStyleSheetSet(mPreferredSheet);
}
@ -511,7 +511,7 @@ nsresult
Loader::SetPreferredSheet(const nsAString& aTitle)
{
#ifdef DEBUG
nsCOMPtr<nsIDOMNSDocumentStyle> doc(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(mDocument);
if (doc) {
nsAutoString currentPreferred;
doc->GetLastStyleSheetSet(currentPreferred);