DeCOMify nsHTMLCSSStyleSheet. (Bug 239008) r=bzbarsky

This commit is contained in:
L. David Baron 2009-12-31 10:56:33 -05:00
parent abee66d3a1
commit 722b8f18b0
14 changed files with 24 additions and 167 deletions

View File

@ -128,10 +128,6 @@
#define NS_CSSPARSER_CID \
{ 0x2e363d60, 0x872e, 0x11d2, { 0xb5, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {95F46161-D177-11d2-BF86-00105A1B0627}
#define NS_HTML_CSS_STYLESHEET_CID \
{ 0x95f46161, 0xd177, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {A1FDE867-E802-11d4-9885-00C04FA0CF4B}
#define NS_CSS_STYLESHEET_CID \
{ 0xa1fde867, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }

View File

@ -90,7 +90,7 @@ class nsIContentSink;
class nsIScriptEventManager;
class nsICSSLoader;
class nsHTMLStyleSheet;
class nsIHTMLCSSStyleSheet;
class nsHTMLCSSStyleSheet;
class nsILayoutHistoryState;
class nsIVariant;
class nsIDOMUserDataHandler;
@ -559,8 +559,8 @@ public:
* Get this document's inline style sheet. May return null if there
* isn't one
*/
virtual nsIHTMLCSSStyleSheet* GetInlineStyleSheet() const = 0;
virtual nsHTMLCSSStyleSheet* GetInlineStyleSheet() const = 0;
/**
* Get/set the object from which a document can get a script context
* and scope. This is the context within which all scripts (during

View File

@ -1781,7 +1781,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChannel)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStyleAttrStyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mStyleAttrStyleSheet, nsIStyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptEventManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mXPathEvaluatorTearoff)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLayoutHistoryState)
@ -2131,8 +2131,9 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
}
rv = mStyleAttrStyleSheet->Reset(aURI);
} else {
rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mStyleAttrStyleSheet), aURI,
this);
mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet();
NS_ENSURE_TRUE(mStyleAttrStyleSheet, NS_ERROR_OUT_OF_MEMORY);
rv = mStyleAttrStyleSheet->Init(aURI, this);
}
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -99,7 +99,7 @@
// Put these here so all document impls get them automatically
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsHTMLCSSStyleSheet.h"
#include "nsStyleSet.h"
#include "nsXMLEventsManager.h"
@ -715,7 +715,7 @@ public:
* Get this document's inline style sheet. May return null if there
* isn't one
*/
virtual nsIHTMLCSSStyleSheet* GetInlineStyleSheet() const {
virtual nsHTMLCSSStyleSheet* GetInlineStyleSheet() const {
return mStyleAttrStyleSheet;
}
@ -1204,7 +1204,7 @@ protected:
// The channel that got passed to StartDocumentLoad(), if any
nsCOMPtr<nsIChannel> mChannel;
nsRefPtr<nsHTMLStyleSheet> mAttrStyleSheet;
nsCOMPtr<nsIHTMLCSSStyleSheet> mStyleAttrStyleSheet;
nsRefPtr<nsHTMLCSSStyleSheet> mStyleAttrStyleSheet;
nsRefPtr<nsXMLEventsManager> mXMLEventsManager;
nsCOMPtr<nsIScriptEventManager> mScriptEventManager;

View File

@ -47,8 +47,6 @@
#include "nsIDocument.h"
#include "nsIHTMLDocument.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsICSSStyleRule.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsMappedAttributes.h"

View File

@ -64,10 +64,6 @@
#include "nsIXBLDocumentInfo.h"
#include "nsXBLInsertionPoint.h"
#include "nsIStyleSheet.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIStyleRuleProcessor.h"
#include "nsRuleProcessorData.h"
#include "nsIWeakReference.h"

View File

@ -49,8 +49,6 @@
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsHTMLParts.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIComponentManager.h"
#include "nsIDOMComment.h"
#include "nsIDOMElement.h"

View File

@ -41,8 +41,6 @@
#include "nsDocument.h"
#include "nsIDOMXMLDocument.h"
#include "nsIScriptContext.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
class nsIParser;
class nsIDOMNode;

View File

@ -101,10 +101,6 @@
#define NS_PRESSHELL_CID \
{ 0xe6fd9940, 0x899d, 0x11d2, { 0x8e, 0xae, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {95F46161-D177-11d2-BF86-00105A1B0627}
#define NS_HTML_CSS_STYLESHEET_CID \
{ 0x95f46161, 0xd177, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {eaca2576-0d4a-11d3-9d7e-0060088f9ff7}
#define NS_CSS_LOADER_CID \
{ 0xeaca2576, 0x0d4a, 0x11d3, { 0x9d, 0x7e, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7 } }

View File

@ -66,7 +66,6 @@
#include "nsFrameSelection.h"
#include "nsIFrameUtil.h"
#include "nsIGenericFactory.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIFragmentContentSink.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLToTextSink.h"
@ -478,7 +477,6 @@ MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOM
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateCSSStyleSheet, nsICSSStyleSheet, NS_NewCSSStyleSheet)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet)
MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation)
MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
#ifdef MOZ_SVG
@ -977,11 +975,6 @@ static const nsModuleComponentInfo gComponents[] = {
nsnull,
CreateHTMLDocument },
{ "HTML-CSS style sheet",
NS_HTML_CSS_STYLESHEET_CID,
nsnull,
CreateHTMLCSSStyleSheet },
{ "DOM implementation",
NS_DOM_IMPLEMENTATION_CID,
nsnull,

View File

@ -83,7 +83,6 @@ EXPORTS = \
nsICSSStyleRule.h \
nsICSSStyleRuleDOMWrapper.h \
nsICSSStyleSheet.h \
nsIHTMLCSSStyleSheet.h \
nsIStyleRule.h \
nsIStyleRuleProcessor.h \
nsIStyleSheet.h \

View File

@ -57,8 +57,7 @@
#include "nsRuleProcessorData.h"
nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet()
: nsIHTMLCSSStyleSheet(),
mRefCnt(0),
: mRefCnt(0),
mURL(nsnull),
mDocument(nsnull)
{
@ -69,8 +68,7 @@ nsHTMLCSSStyleSheet::~nsHTMLCSSStyleSheet()
NS_RELEASE(mURL);
}
NS_IMPL_ISUPPORTS3(nsHTMLCSSStyleSheet,
nsIHTMLCSSStyleSheet,
NS_IMPL_ISUPPORTS2(nsHTMLCSSStyleSheet,
nsIStyleSheet,
nsIStyleRuleProcessor)
@ -117,7 +115,7 @@ nsHTMLCSSStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData)
}
#endif
NS_IMETHODIMP
nsresult
nsHTMLCSSStyleSheet::Init(nsIURI* aURL, nsIDocument* aDocument)
{
NS_PRECONDITION(aURL && aDocument, "null ptr");
@ -156,7 +154,7 @@ nsHTMLCSSStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsresult
nsHTMLCSSStyleSheet::Reset(nsIURI* aURL)
{
NS_IF_RELEASE(mURL);
@ -267,40 +265,3 @@ void nsHTMLCSSStyleSheet::List(FILE* out, PRInt32 aIndent) const
fputs("\n", out);
}
#endif
// XXX For backwards compatibility and convenience
nsresult
NS_NewHTMLCSSStyleSheet(nsIHTMLCSSStyleSheet** aInstancePtrResult,
nsIURI* aURL, nsIDocument* aDocument)
{
nsresult rv;
nsIHTMLCSSStyleSheet* sheet;
if (NS_FAILED(rv = NS_NewHTMLCSSStyleSheet(&sheet)))
return rv;
if (NS_FAILED(rv = sheet->Init(aURL, aDocument))) {
NS_RELEASE(sheet);
return rv;
}
*aInstancePtrResult = sheet;
return NS_OK;
}
nsresult
NS_NewHTMLCSSStyleSheet(nsIHTMLCSSStyleSheet** aInstancePtrResult)
{
if (aInstancePtrResult == nsnull) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLCSSStyleSheet* it = new nsHTMLCSSStyleSheet();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(it);
*aInstancePtrResult = it;
return NS_OK;
}

View File

@ -42,59 +42,49 @@
#ifndef nsHTMLCSSStyleSheet_h_
#define nsHTMLCSSStyleSheet_h_
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIStyleSheet.h"
#include "nsIStyleRuleProcessor.h"
class nsHTMLCSSStyleSheet : public nsIHTMLCSSStyleSheet,
class nsHTMLCSSStyleSheet : public nsIStyleSheet,
public nsIStyleRuleProcessor {
public:
nsHTMLCSSStyleSheet();
NS_DECL_ISUPPORTS
// basic style sheet data
NS_IMETHOD Init(nsIURI* aURL, nsIDocument* aDocument);
NS_IMETHOD Reset(nsIURI* aURL);
nsresult Init(nsIURI* aURL, nsIDocument* aDocument);
nsresult Reset(nsIURI* aURL);
// nsIStyleSheet
NS_IMETHOD GetSheetURI(nsIURI** aSheetURL) const;
NS_IMETHOD GetBaseURI(nsIURI** aBaseURL) const;
NS_IMETHOD GetTitle(nsString& aTitle) const;
NS_IMETHOD GetType(nsString& aType) const;
NS_IMETHOD_(PRBool) HasRules() const;
NS_IMETHOD GetApplicable(PRBool& aApplicable) const;
NS_IMETHOD SetEnabled(PRBool aEnabled);
NS_IMETHOD GetComplete(PRBool& aComplete) const;
NS_IMETHOD SetComplete();
// style sheet owner info
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const; // will be null
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const;
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument);
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
// nsIStyleRuleProcessor api
// nsIStyleRuleProcessor
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
#endif
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
virtual nsReStyleHint
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
PRBool* aResult);
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
private:
// These are not supported and are not implemented!
nsHTMLCSSStyleSheet(const nsHTMLCSSStyleSheet& aCopy);

View File

@ -1,69 +0,0 @@
/* -*- Mode: C++; 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) 1998
* 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 ***** */
/*
* style sheet and style rule processor representing style attributes
*/
#ifndef nsIHTMLCSSStyleSheet_h___
#define nsIHTMLCSSStyleSheet_h___
#include "nsIStyleSheet.h"
// IID for the nsIHTMLCSSStyleSheet interface {b5cc4ac0-eab6-11d1-8031-006008159b5a}
#define NS_IHTML_CSS_STYLE_SHEET_IID \
{0xb5cc4ac0, 0xeab6, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
class nsIHTMLCSSStyleSheet : public nsIStyleSheet {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTML_CSS_STYLE_SHEET_IID)
NS_IMETHOD Init(nsIURI* aURL, nsIDocument* aDocument) = 0;
NS_IMETHOD Reset(nsIURI* aURL) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCSSStyleSheet, NS_IHTML_CSS_STYLE_SHEET_IID)
// XXX for convenience and backward compatibility
nsresult
NS_NewHTMLCSSStyleSheet(nsIHTMLCSSStyleSheet** aInstancePtrResult,
nsIURI* aURL, nsIDocument* aDocument);
nsresult
NS_NewHTMLCSSStyleSheet(nsIHTMLCSSStyleSheet** aInstancePtrResult);
#endif /* nsIHTMLCSSStyleSheet_h___ */