Eliminate nsIStyleSet as an XPCOM interface, making the implementation internal to layout. Frame constructor ownership moves to the pres shell, and the style set methods that forward to the frame constructor are gone. Rewrote style set sheet add/remove to reduce code size. For more details, see bug 64116. r+sr=dbaron.

This commit is contained in:
bryner%brianryner.com 2004-01-07 22:30:53 +00:00
Родитель 8906f64716
Коммит e65d2d2fe5
128 изменённых файлов: 2387 добавлений и 4776 удалений

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

@ -82,7 +82,6 @@
#include "nsIHTMLContentContainer.h"
#include "nsIPresShell.h"
#include "nsIDocShell.h"
#include "nsIStyleSet.h"
#include "nsISupportsArray.h"
#include "nsIDocumentObserver.h"
#ifdef MOZ_XUL
@ -1534,44 +1533,37 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
for (PRUint32 k = 0; k < shellCount; k++) {
nsIPresShell *shell = document->GetShellAt(k);
nsCOMPtr<nsIStyleSet> styleSet;
rv = shell->GetStyleSet(getter_AddRefs(styleSet));
if (NS_FAILED(rv)) return rv;
if (styleSet) {
// Reload only the chrome URL agent style sheets.
nsCOMPtr<nsISupportsArray> agents;
rv = NS_NewISupportsArray(getter_AddRefs(agents));
// Reload only the chrome URL agent style sheets.
nsCOMArray<nsIStyleSheet> agentSheets;
rv = shell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMArray<nsIStyleSheet> newAgentSheets;
for (PRInt32 l = 0; l < agentSheets.Count(); ++l) {
nsIStyleSheet *sheet = agentSheets[l];
nsCOMPtr<nsIURI> uri;
rv = sheet->GetURL(*getter_AddRefs(uri));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupportsArray> newAgentSheets;
rv = NS_NewISupportsArray(getter_AddRefs(newAgentSheets));
if (NS_FAILED(rv)) return rv;
PRInt32 bc = styleSet->GetNumberOfAgentStyleSheets();
for (PRInt32 l = 0; l < bc; l++) {
nsCOMPtr<nsIStyleSheet> sheet = getter_AddRefs(styleSet->GetAgentStyleSheetAt(l));
nsCOMPtr<nsIURI> uri;
rv = sheet->GetURL(*getter_AddRefs(uri));
if (IsChromeURI(uri)) {
// Reload the sheet.
nsCOMPtr<nsICSSStyleSheet> newSheet;
rv = LoadStyleSheetWithURL(uri, getter_AddRefs(newSheet));
if (NS_FAILED(rv)) return rv;
if (IsChromeURI(uri)) {
// Reload the sheet.
nsCOMPtr<nsICSSStyleSheet> newSheet;
rv = LoadStyleSheetWithURL(uri, getter_AddRefs(newSheet));
if (NS_FAILED(rv)) return rv;
if (newSheet) {
rv = newAgentSheets->AppendElement(newSheet) ? NS_OK : NS_ERROR_FAILURE;
if (NS_FAILED(rv)) return rv;
}
}
else { // Just use the same sheet.
rv = newAgentSheets->AppendElement(sheet) ? NS_OK : NS_ERROR_FAILURE;
if (newSheet) {
rv = newAgentSheets.AppendObject(newSheet) ? NS_OK : NS_ERROR_FAILURE;
if (NS_FAILED(rv)) return rv;
}
}
styleSet->ReplaceAgentStyleSheets(newAgentSheets);
else { // Just use the same sheet.
rv = newAgentSheets.AppendObject(sheet) ? NS_OK : NS_ERROR_FAILURE;
if (NS_FAILED(rv)) return rv;
}
}
rv = shell->SetAgentStyleSheets(newAgentSheets);
NS_ENSURE_SUCCESS(rv, rv);
}
// The document sheets just need to be done once; the document will notify

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

@ -53,6 +53,7 @@
#include "nsILoadGroup.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include <stdio.h> // for FILE definition
class nsIAtom;
class nsIContent;
@ -61,7 +62,7 @@ class nsIPresShell;
class nsIStreamListener;
class nsIStreamObserver;
class nsIStyleSet;
class nsStyleSet;
class nsIStyleSheet;
class nsIStyleRule;
class nsIViewManager;
@ -253,7 +254,7 @@ public:
*/
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult) = 0;
NS_IMETHOD_(PRBool) DeleteShell(nsIPresShell* aShell) = 0;
NS_IMETHOD_(PRUint32) GetNumberOfShells() const = 0;

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

@ -175,6 +175,10 @@ class nsIStyleRuleProcessor : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_RULE_PROCESSOR_IID)
// Shorthand for:
// nsCOMArray<nsIStyleRuleProcessor>::nsCOMArrayEnumFunc
typedef PRBool (* PR_CALLBACK EnumFunc)(nsIStyleRuleProcessor*, void*);
// populate rule node tree with nsIStyleRule*
// rules are ordered, those with higher precedence are farthest from the root of the tree
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData,

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

@ -10,15 +10,15 @@
{ 0x2d77a45b, 0x4f3a, 0x4203, { 0xa7, 0xd2, 0xf4, 0xb8, 0x4d, 0xc, 0x1e, 0xe4 } }
class nsIContent;
class nsIStyleSet;
class nsStyleSet;
class nsIStyleRuleSupplier : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLERULESUPPLIER_IID)
NS_IMETHOD UseDocumentRules(nsIContent* aContent, PRBool* aResult)=0;
NS_IMETHOD WalkRules(nsIStyleSet* aStyleSet,
nsISupportsArrayEnumFunc aFunc,
NS_IMETHOD WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData)=0;
};

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

@ -60,6 +60,8 @@ REQUIRES = xpcom \
prefetch \
$(NULL)
EXPORTS = nsStyleSet.h
CPPSRCS = \
nsContentSink.cpp \
nsPrintEngine.cpp \
@ -125,3 +127,5 @@ INCLUDES += \
-I$(srcdir)/../../base/src \
-I$(srcdir)/../../../layout/html/base/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -77,7 +77,7 @@
#include "nsIScrollableView.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsContentUtils.h"
#include "nsNodeInfoManager.h"
#include "nsIXBLService.h"
@ -1050,7 +1050,7 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData)
NS_IMETHODIMP
nsDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult)
{
// Don't add anything here. Add it to |doCreateShell| instead.
@ -1062,7 +1062,7 @@ nsDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager,
nsresult
nsDocument::doCreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager, nsIStyleSet* aStyleSet,
nsIViewManager* aViewManager, nsStyleSet* aStyleSet,
nsCompatibility aCompatMode,
nsIPresShell** aInstancePtrResult)
{
@ -1339,13 +1339,8 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
PRInt32 count = mPresShells.Count();
PRInt32 indx;
for (indx = 0; indx < count; ++indx) {
nsCOMPtr<nsIPresShell> shell = (nsIPresShell *)mPresShells.ElementAt(indx);
nsCOMPtr<nsIStyleSet> set;
if (NS_SUCCEEDED(shell->GetStyleSet(getter_AddRefs(set)))) {
if (set) {
set->AddDocStyleSheet(aSheet, this);
}
}
NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(indx))->StyleSet()->
AddDocStyleSheet(aSheet, this);
}
}
@ -1379,13 +1374,8 @@ nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
PRInt32 count = mPresShells.Count();
PRInt32 indx;
for (indx = 0; indx < count; ++indx) {
nsCOMPtr<nsIPresShell> shell = (nsIPresShell *)mPresShells.ElementAt(indx);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (set) {
set->RemoveDocStyleSheet(aSheet);
}
NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(indx))->StyleSet()->
RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
}
}
@ -1527,6 +1517,16 @@ nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet,
} else {
RemoveStyleSheetFromStyleSets(aSheet);
}
} else {
// We still need to notify the style set of the state change, because
// this will invalidate some of the rule processor data.
PRInt32 count = mPresShells.Count();
PRInt32 indx;
for (indx = 0; indx < count; ++indx) {
NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(indx))->StyleSet()->
StyleSheetApplicableStateChanged();
}
}
// We have to always notify, since this will be called for sheets
@ -1647,6 +1647,14 @@ nsDocument::RemoveObserver(nsIDocumentObserver* aObserver)
void
nsDocument::BeginUpdate(nsUpdateType aUpdateType)
{
if (aUpdateType & UPDATE_STYLE) {
PRInt32 shellCount = mPresShells.Count();
for (PRInt32 j = 0; j < shellCount; ++j) {
NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(j))->StyleSet()->
BeginUpdate();
}
}
PRInt32 i;
for (i = mObservers.Count() - 1; i >= 0; --i) {
nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i];
@ -1657,6 +1665,14 @@ nsDocument::BeginUpdate(nsUpdateType aUpdateType)
void
nsDocument::EndUpdate(nsUpdateType aUpdateType)
{
if (aUpdateType & UPDATE_STYLE) {
PRInt32 shellCount = mPresShells.Count();
for (PRInt32 j = 0; j < shellCount; ++j) {
NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(j))->StyleSet()->
EndUpdate();
}
}
PRInt32 i;
for (i = mObservers.Count() - 1; i >= 0; --i) {
nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i];

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

@ -97,6 +97,7 @@ class nsIDTD;
class nsXPathDocumentTearoff;
class nsIRadioVisitor;
class nsIFormControl;
class nsStyleSet;
struct nsRadioGroupStruct;
@ -329,7 +330,7 @@ public:
*/
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult);
NS_IMETHOD_(PRBool) DeleteShell(nsIPresShell* aShell);
NS_IMETHOD_(PRUint32) GetNumberOfShells() const;
@ -540,7 +541,7 @@ protected:
virtual void RetrieveRelevantHeaders(nsIChannel *aChannel);
nsresult doCreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager, nsIStyleSet* aStyleSet,
nsIViewManager* aViewManager, nsStyleSet* aStyleSet,
nsCompatibility aCompatMode,
nsIPresShell** aInstancePtrResult);

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

@ -53,7 +53,7 @@
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIFrame.h"
@ -195,7 +195,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
#include "nsBidiUtils.h"
static NS_DEFINE_CID(kGalleyContextCID, NS_GALLEYCONTEXT_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
#ifdef NS_DEBUG
@ -640,8 +639,8 @@ nsresult
DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
{
// Create the style set...
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = CreateStyleSet(mDocument, getter_AddRefs(styleSet));
nsStyleSet *styleSet;
nsresult rv = CreateStyleSet(mDocument, &styleSet);
NS_ENSURE_SUCCESS(rv, rv);
// Now make the shell for the document
@ -1192,8 +1191,8 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
if (mPresContext) {
// 3) Create a new style set for the document
nsCOMPtr<nsIStyleSet> styleSet;
rv = CreateStyleSet(mDocument, getter_AddRefs(styleSet));
nsStyleSet *styleSet;
rv = CreateStyleSet(mDocument, &styleSet);
if (NS_FAILED(rv))
return rv;
@ -1587,79 +1586,83 @@ DocumentViewerImpl::ForceRefresh()
nsresult
DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
nsIStyleSet** aStyleSet)
nsStyleSet** aStyleSet)
{
// this should eventually get expanded to allow for creating
// different sets for different media
nsresult rv;
if (!mUAStyleSheet) {
NS_WARNING("unable to load UA style sheet");
}
rv = CallCreateInstance(kStyleSetCID, aStyleSet);
if (NS_OK == rv) {
PRInt32 index = aDocument->GetNumberOfStyleSheets(PR_TRUE);
nsStyleSet *styleSet = new nsStyleSet();
if (!styleSet) {
return NS_ERROR_OUT_OF_MEMORY;
}
while (0 < index--) {
nsIStyleSheet *sheet = aDocument->GetStyleSheetAt(index, PR_TRUE);
PRInt32 index = aDocument->GetNumberOfStyleSheets(PR_TRUE);
/*
* GetStyleSheetAt will return all style sheets in the document but
* we're only interested in the ones that are enabled.
*/
styleSet->BeginUpdate();
PRBool styleApplicable;
sheet->GetApplicable(styleApplicable);
while (0 < index--) {
nsIStyleSheet *sheet = aDocument->GetStyleSheetAt(index, PR_TRUE);
if (styleApplicable) {
(*aStyleSet)->AddDocStyleSheet(sheet, aDocument);
}
}
/*
* GetStyleSheetAt will return all style sheets in the document but
* we're only interested in the ones that are enabled.
*/
nsCOMPtr<nsIChromeRegistry> chromeRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1");
PRBool styleApplicable;
sheet->GetApplicable(styleApplicable);
if (chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
// Now handle the user sheets.
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(mContainer));
PRInt32 shellType;
docShell->GetItemType(&shellType);
PRBool isChrome = (shellType == nsIDocShellTreeItem::typeChrome);
sheets = nsnull;
chromeRegistry->GetUserSheets(isChrome, getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
// Insert the user sheets at the front of the user sheet list
// so that they are most significant user sheets.
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->InsertUserStyleSheetBefore(sheet, nsnull);
}
}
// Append chrome sheets (scrollbars + forms).
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(mContainer));
chromeRegistry->GetAgentSheets(ds, getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->AppendAgentStyleSheet(sheet);
}
}
}
if (mUAStyleSheet) {
(*aStyleSet)->AppendAgentStyleSheet(mUAStyleSheet);
if (styleApplicable) {
styleSet->AddDocStyleSheet(sheet, aDocument);
}
}
nsCOMPtr<nsIChromeRegistry> chromeRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1");
if (chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
// Now handle the user sheets.
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(mContainer));
PRInt32 shellType;
docShell->GetItemType(&shellType);
PRBool isChrome = (shellType == nsIDocShellTreeItem::typeChrome);
chromeRegistry->GetUserSheets(isChrome, getter_AddRefs(sheets));
if (sheets) {
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
// Insert the user sheets at the front of the user sheet list
// so that they are most significant user sheets.
for (PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
styleSet->PrependStyleSheet(nsStyleSet::eUserSheet, sheet);
}
}
// Append chrome sheets (scrollbars + forms).
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(mContainer));
chromeRegistry->GetAgentSheets(ds, getter_AddRefs(sheets));
if (sheets) {
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for (PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
styleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, sheet);
}
}
}
if (mUAStyleSheet) {
styleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, mUAStyleSheet);
}
styleSet->EndUpdate();
*aStyleSet = styleSet;
return NS_OK;
}

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

@ -46,7 +46,7 @@ class nsPrintObject;
class nsISelection;
class nsIPresShell;
class nsIDocument;
class nsIStyleSet;
class nsStyleSet;
class nsIContent;
class nsIWebShell;
@ -72,7 +72,7 @@ public:
virtual PRBool GetIsCreatingPrintPreview() = 0;
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsIStyleSet** aStyleSet) = 0;
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsStyleSet** aStyleSet) = 0;
virtual nsresult GetDocumentSelection(nsISelection **aSelection,
nsIPresShell * aPresShell = nsnull) = 0;
@ -97,7 +97,7 @@ public:
virtual void SetIsPrintPreview(PRBool aIsPrintPreview); \
virtual PRBool GetIsPrintPreview(); \
virtual PRBool GetIsCreatingPrintPreview(); \
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsIStyleSet** aStyleSet); \
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsStyleSet** aStyleSet); \
virtual nsresult GetDocumentSelection(nsISelection **aSelection, nsIPresShell * aPresShell = nsnull); \
virtual void IncrementDestroyRefCount(); \
virtual void ReturnToGalleyPresentation(); \

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

@ -2608,7 +2608,8 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
// init it with the DC
(aPO->mPresContext)->Init(mPrt->mPrintDocDC);
mDocViewerPrint->CreateStyleSet(aPO->mDocument, getter_AddRefs(aPO->mStyleSet));
rv = mDocViewerPrint->CreateStyleSet(aPO->mDocument, &aPO->mStyleSet);
NS_ENSURE_SUCCESS(rv, rv);
aPO->mViewManager = do_CreateInstance(kViewManagerCID, &rv);
if (NS_FAILED(rv)) {

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

@ -42,7 +42,7 @@
//-- nsPrintObject Class Impl
//---------------------------------------------------
nsPrintObject::nsPrintObject() :
mFrameType(eFrame),
mFrameType(eFrame), mStyleSet(nsnull),
mRootView(nsnull), mContent(nsnull),
mSeqFrame(nsnull), mPageFrame(nsnull), mPageNum(-1),
mRect(0,0,0,0), mReflowRect(0,0,0,0),

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

@ -39,10 +39,11 @@
// Interfaces
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIContent.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIViewManager.h"
#include "nsIWebShell.h"
#include "nsIDocShell.h"
@ -80,7 +81,7 @@ public:
PrintObjectType mFrameType;
nsCOMPtr<nsIPresContext> mPresContext;
nsCOMPtr<nsIStyleSet> mStyleSet;
nsStyleSet *mStyleSet;
nsCOMPtr<nsIPresShell> mPresShell;
nsCOMPtr<nsIViewManager> mViewManager;
nsCOMPtr<nsIWidget> mWindow;

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

@ -53,6 +53,7 @@
#include "nsITheme.h"
#include "pldhash.h"
#include "nsStyleContext.h"
#include "nsStyleSet.h"
/*
* For storage of an |nsRuleNode|'s children in a linked list.
@ -4330,9 +4331,8 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID,
// this works fine even if |this| is a rule node that has been
// destroyed (leftover from a previous rule tree) but is somehow still
// used.
nsCOMPtr<nsIStyleSet> set;
mPresContext->PresShell()->GetStyleSet(getter_AddRefs(set));
return set->GetDefaultStyleData()->GetStyleData(aSID);
return mPresContext->PresShell()->StyleSet()->
DefaultStyleData()->GetStyleData(aSID);
}
void
@ -4358,7 +4358,7 @@ PRBool
nsRuleNode::Sweep()
{
// If we're not marked, then we have to delete ourself.
if (!(mDependentBits & NS_RULE_NODE_GC_MARK)) {
if (!(mDependentBits & NS_RULE_NODE_GC_MARK) && !IsRoot()) {
Destroy();
return PR_TRUE;
}

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

@ -46,7 +46,7 @@
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIPresShell.h"
#include "nsLayoutAtoms.h"
#include "prenv.h"
@ -94,9 +94,8 @@ nsStyleContext::~nsStyleContext()
nsIPresContext *presContext = mRuleNode->GetPresContext();
nsCOMPtr<nsIStyleSet> set;
presContext->PresShell()->GetStyleSet(getter_AddRefs(set));
set->NotifyStyleContextDestroyed(presContext, this);
presContext->PresShell()->StyleSet()->
NotifyStyleContextDestroyed(presContext, this);
if (mParent) {
mParent->RemoveChild(this);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,245 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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):
* Daniel Glazman <glazman@netscape.com>
* Brian Ryner <bryner@brianryner.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsStyleSet_h_
#define nsStyleSet_h_
#include "nsIStyleRuleProcessor.h"
#include "nsICSSStyleSheet.h"
#include "nsVoidArray.h"
#include "nsIStyleRuleSupplier.h"
#include "nsRuleNode.h"
class nsIURI;
class nsStyleSet
{
public:
nsStyleSet();
// Initialize the object. You must check the return code and not use
// the nsStyleSet if Init() fails.
nsresult Init(nsIPresContext *aPresContext);
// For getting the cached default data in case we hit out-of-memory.
// To be used only by nsRuleNode.
nsCachedStyleData* DefaultStyleData() { return &mDefaultStyleData; }
// clear out all of the computed style data
void ClearStyleData(nsIPresContext *aPresContext);
// notification that a style sheet (of any type) has become enabled
// or disabled
nsresult StyleSheetApplicableStateChanged();
// enable / disable the Quirk style sheet
void EnableQuirkStyleSheet(PRBool aEnable);
// get a style context for a non-pseudo frame.
already_AddRefed<nsStyleContext>
ResolveStyleFor(nsIPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aParentContext);
// Get a style context for a non-element (which no rules will match).
// Eventually, this should go away and we shouldn't even create style
// contexts for such content nodes. However, not doing any rule
// matching for them is a first step.
//
// XXX This is temporary. It should go away when we stop creating
// style contexts for text nodes and placeholder frames. (We also use
// it once to create a style context for the nsFirstLetterFrame that
// represents everything except the first letter.)
//
already_AddRefed<nsStyleContext>
ResolveStyleForNonElement(nsIPresContext* aPresContext,
nsStyleContext* aParentContext);
// get a style context for a pseudo-element (i.e.,
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|;
already_AddRefed<nsStyleContext>
ResolvePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator = nsnull);
// This funtions just like ResolvePseudoStyleFor except that it will
// return nsnull if there are no explicit style rules for that
// pseudo element.
already_AddRefed<nsStyleContext>
ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext);
// Begin ignoring style context destruction, to avoid lots of unnecessary
// work on document teardown.
void BeginShutdown(nsIPresContext* aPresContext);
// Free all of the data associated with this style set.
void Shutdown(nsIPresContext* aPresContext);
// Notification that a style context is being destroyed.
void NotifyStyleContextDestroyed(nsIPresContext* aPresContext,
nsStyleContext* aStyleContext);
// Get a new style context that lives in a different parent
// The new context will be the same as the old if the new parent is the
// same as the old parent.
already_AddRefed<nsStyleContext>
ReParentStyleContext(nsIPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsStyleContext* aNewParentContext);
// Test if style is dependent on content state
PRBool HasStateDependentStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
PRInt32 aStateMask);
// Test if style is dependent on the presence of an attribute.
PRBool HasAttributeDependentStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIAtom* aAttribute,
PRInt32 aModType);
// APIs for registering objects that can supply additional
// rules during processing.
void SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)
{
mStyleRuleSupplier = aSupplier;
}
nsIStyleRuleSupplier* GetStyleRuleSupplier() const
{
return mStyleRuleSupplier;
}
// Free global data at module shutdown
static void FreeGlobals() { NS_IF_RELEASE(gQuirkURI); }
// APIs to manipulate the style sheet lists
enum sheetType {
eAgentSheet,
eUserSheet,
eDocSheet,
eOverrideSheet, // override sheets are ordered most significant first
eSheetTypeCount
};
nsresult AppendStyleSheet(sheetType aType, nsIStyleSheet *aSheet);
nsresult PrependStyleSheet(sheetType aType, nsIStyleSheet *aSheet);
nsresult RemoveStyleSheet(sheetType aType, nsIStyleSheet *aSheet);
nsresult ReplaceSheets(sheetType aType,
const nsCOMArray<nsIStyleSheet> &aNewSheets);
PRInt32 SheetCount(sheetType aType) const {
return mSheets[aType].Count();
}
nsIStyleSheet* StyleSheetAt(sheetType aType, PRInt32 aIndex) const {
return mSheets[aType].ObjectAt(aIndex);
}
nsresult AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument);
void BeginUpdate();
nsresult EndUpdate();
private:
// Not to be implemented
nsStyleSet(const nsStyleSet& aCopy);
nsStyleSet& operator=(const nsStyleSet& aCopy);
// Returns false on out-of-memory.
PRBool BuildDefaultStyleData(nsIPresContext* aPresContext);
// Update the rule processor list after a change to the style sheet list.
nsresult GatherRuleProcessors(PRInt32 aType);
void AddImportantRules(nsRuleNode* aCurrLevelNode,
nsRuleNode* aLastPrevLevelNode);
// Enumerate the rules in a way that cares about the order of the
// rules.
void FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
RuleProcessorData* aData);
// Enumerate all the rules in a way that doesn't care about the order
// of the rules and break out if the enumeration is halted.
void WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData);
already_AddRefed<nsStyleContext> GetContext(nsIPresContext* aPresContext,
nsStyleContext* aParentContext,
nsIAtom* aPseudoTag);
static nsIURI *gQuirkURI;
nsCOMArray<nsIStyleSheet> mSheets[eSheetTypeCount];
nsCOMArray<nsIStyleRuleProcessor> mRuleProcessors[eSheetTypeCount];
// cached instance for enabling/disabling
nsCOMPtr<nsIStyleSheet> mQuirkStyleSheet;
nsCOMPtr<nsIStyleRuleSupplier> mStyleRuleSupplier;
// To be used only in case of emergency, such as being out of memory
// or operating on a deleted rule node. The latter should never
// happen, of course.
nsCachedStyleData mDefaultStyleData;
nsRuleNode* mRuleTree; // This is the root of our rule tree. It is a
// lexicographic tree of matched rules that style
// contexts use to look up properties.
nsRuleWalker* mRuleWalker; // This is an instance of a rule walker that can
// be used to navigate through our tree.
PRInt32 mDestroyedCount; // used to batch style context GC
nsVoidArray mRoots; // style contexts with no parent
unsigned mBatching : 1;
unsigned mInShutdown : 1;
unsigned mDirty : 6; // one dirty bit is used per sheet type
};
#endif

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

@ -63,3 +63,4 @@ LOCAL_INCLUDES = -I$(srcdir)/../../html/base/src \
-I$(srcdir)/../../xul/content/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -133,3 +133,4 @@ INCLUDES += \
-I$(srcdir)/../../base/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -60,7 +60,6 @@
#include "nsIDocShell.h"
#include "nsIFrameManager.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIView.h"
#include "nsLayoutAtoms.h"
#include "nsRuleWalker.h"

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

@ -85,3 +85,5 @@ INCLUDES += \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../content/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -51,7 +51,6 @@
#include "nsHTMLParts.h"
#include "nsIHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIStyleSet.h"
#include "nsHTMLAtoms.h"
#include "nsLayoutAtoms.h"
#include "nsIPresShell.h"
@ -455,7 +454,7 @@ nsHTMLDocument::BaseResetToURI(nsIURI *aURL)
NS_IMETHODIMP
nsHTMLDocument::CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult)
{
return doCreateShell(aContext, aViewManager, aStyleSet, mCompatMode,

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

@ -91,7 +91,7 @@ public:
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult);
NS_IMETHOD StartDocumentLoad(const char* aCommand,

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

@ -119,3 +119,5 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../../../svg/content/src \
-I$(srcdir)/../../../svg/base/src
endif
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -51,7 +51,6 @@
#include "nsStyleConsts.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#define B_BORDER_TOP_STYLE 0x001
#define B_BORDER_LEFT_STYLE 0x002

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

@ -48,7 +48,6 @@
#include "nsICSSMediaRule.h"
#include "nsICSSNameSpaceRule.h"
#include "nsIUnicharInputStream.h"
#include "nsIStyleSet.h"
#include "nsICSSStyleSheet.h"
#include "nsCSSDeclaration.h"
#include "nsStyleConsts.h"

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

@ -50,7 +50,6 @@
#include "nsICSSStyleSheet.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSRule.h"
#include "nsIDOMCSSImportRule.h"

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

@ -50,7 +50,6 @@
#include "nsStyleConsts.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }

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

@ -68,8 +68,6 @@
#include "nsUnicharUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsIStyleSet.h"
#include "nsContentUtils.h"
#include "nsContentErrors.h"

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

@ -96,7 +96,6 @@
#include "nsITextContent.h"
#include "prlog.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsStyleUtil.h"
#include "nsQuickSort.h"
#include "nsContentUtils.h"

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

@ -52,7 +52,6 @@
#include "nsCOMPtr.h"
#include "nsUnicharUtils.h"
#include "nsIStyleSet.h"
#include "nsRuleWalker.h"
MOZ_DECL_CTOR_COUNTER(HTMLAttribute)

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

@ -52,7 +52,6 @@
#include "nsIDocument.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsRuleWalker.h"
/*

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

@ -59,10 +59,6 @@
#include "nsRuleWalker.h"
#include "nsIStyleSet.h"
static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID);
class HTMLColorRule : public nsIStyleRule {
public:
HTMLColorRule(nsIHTMLStyleSheet* aSheet);
@ -687,49 +683,7 @@ HTMLStyleSheetImpl::~HTMLStyleSheetImpl()
PL_DHashTableFinish(&mMappedAttrTable);
}
NS_IMPL_ADDREF(HTMLStyleSheetImpl)
NS_IMPL_RELEASE(HTMLStyleSheetImpl)
nsresult HTMLStyleSheetImpl::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult)
{
NS_PRECONDITION(aInstancePtrResult, "null out param");
if (aIID.Equals(NS_GET_IID(nsIHTMLStyleSheet))) {
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLStyleSheet*, this);
} else if (aIID.Equals(NS_GET_IID(nsIStyleSheet))) {
*aInstancePtrResult = NS_STATIC_CAST(nsIStyleSheet *, this);
} else if (aIID.Equals(NS_GET_IID(nsIStyleRuleProcessor))) {
*aInstancePtrResult = NS_STATIC_CAST(nsIStyleRuleProcessor *, this);
} else if (aIID.Equals(NS_GET_IID(nsIStyleFrameConstruction))) {
// XXX this breaks XPCOM rules since it isn't a proper delegate
// This is a temporary method of connecting the constructor for
// now
nsresult rv;
nsCOMPtr<nsICSSFrameConstructor> constructor =
do_CreateInstance(kCSSFrameConstructorCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = constructor->Init(mDocument);
if (NS_SUCCEEDED(rv)) {
rv = constructor->QueryInterface(aIID, aInstancePtrResult);
}
}
return rv;
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLStyleSheet *, this);
} else {
*aInstancePtrResult = nsnull;
return NS_NOINTERFACE;
}
NS_ADDREF_THIS();
return NS_OK;
}
NS_IMPL_ISUPPORTS3(HTMLStyleSheetImpl, nsIHTMLStyleSheet, nsIStyleSheet, nsIStyleRuleProcessor)
NS_IMETHODIMP
HTMLStyleSheetImpl::GetStyleRuleProcessor(nsIStyleRuleProcessor*& aProcessor,

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

@ -47,7 +47,6 @@
#include "nsStyleCoord.h"
#include "nsStyleConsts.h"
#include "nsChangeHint.h"
#include "nsIStyleSet.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"

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

@ -66,3 +66,5 @@ endif
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -48,7 +48,6 @@
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsLayoutAtoms.h"

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

@ -99,3 +99,5 @@ INCLUDES += \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../../layout/svg/base/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -61,3 +61,4 @@ INCLUDES += \
-I$(srcdir)/../../../base/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -48,6 +48,7 @@
#include "nsISupports.h"
#include "nsISupportsArray.h"
#include "nsIStyleRuleProcessor.h"
class nsIContent;
class nsIDocument;
@ -121,7 +122,7 @@ public:
NS_IMETHOD GetFirstStyleBinding(nsIXBLBinding** aResult) = 0;
NS_IMETHOD InheritsStyle(PRBool* aResult)=0;
NS_IMETHOD WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)=0;
NS_IMETHOD WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)=0;
NS_IMETHOD MarkForDeath()=0;
NS_IMETHOD MarkedForDeath(PRBool* aResult)=0;

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

@ -91,3 +91,4 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../xul/content/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -76,7 +76,6 @@
#include "nsIHTMLContentContainer.h"
#include "nsIStyleRuleProcessor.h"
#include "nsIStyleSet.h"
#include "nsIWeakReference.h"
#include "jsapi.h"
@ -359,8 +358,8 @@ public:
// nsIStyleRuleSupplier
NS_IMETHOD UseDocumentRules(nsIContent* aContent, PRBool* aResult);
NS_IMETHOD WalkRules(nsIStyleSet* aStyleSet,
nsISupportsArrayEnumFunc aFunc,
NS_IMETHOD WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData);
// nsIDocumentObserver
@ -379,7 +378,8 @@ protected:
}
nsIContent* GetOutermostStyleScope(nsIContent* aContent);
void WalkRules(nsISupportsArrayEnumFunc aFunc, RuleProcessorData* aData,
void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
nsIContent* aParent, nsIContent* aCurrContent);
nsresult GetNestedInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult);
@ -1232,7 +1232,7 @@ nsBindingManager::GetOutermostStyleScope(nsIContent* aContent)
}
void
nsBindingManager::WalkRules(nsISupportsArrayEnumFunc aFunc,
nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
nsIContent* aParent, nsIContent* aCurrContent)
{
@ -1250,8 +1250,8 @@ nsBindingManager::WalkRules(nsISupportsArrayEnumFunc aFunc,
}
NS_IMETHODIMP
nsBindingManager::WalkRules(nsIStyleSet* aStyleSet,
nsISupportsArrayEnumFunc aFunc,
nsBindingManager::WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData)
{
nsIContent *content = aData->mContent;
@ -1275,7 +1275,7 @@ nsBindingManager::WalkRules(nsIStyleSet* aStyleSet,
container->GetInlineStyleSheet(getter_AddRefs(inlineSheet));
nsCOMPtr<nsIStyleRuleProcessor> inlineCSS(do_QueryInterface(inlineSheet));
if (inlineCSS)
(*aFunc)((nsISupports*)(inlineCSS.get()), aData);
(*aFunc)(inlineCSS, aData);
}
}

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

@ -1063,7 +1063,7 @@ nsXBLBinding::InheritsStyle(PRBool* aResult)
}
NS_IMETHODIMP
nsXBLBinding::WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)
nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
{
nsresult rv = NS_OK;
if (mNextBinding) {
@ -1072,7 +1072,7 @@ nsXBLBinding::WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)
return rv;
}
nsCOMPtr<nsISupportsArray> rules = mPrototypeBinding->GetRuleProcessors();
nsCOMArray<nsIStyleRuleProcessor> *rules = mPrototypeBinding->GetRuleProcessors();
if (rules)
rules->EnumerateForwards(aFunc, aData);

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

@ -112,7 +112,7 @@ class nsXBLBinding: public nsIXBLBinding
NS_IMETHOD GetFirstStyleBinding(nsIXBLBinding** aResult);
NS_IMETHOD InheritsStyle(PRBool* aResult);
NS_IMETHOD WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData);
NS_IMETHOD WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
NS_IMETHOD MarkForDeath();
NS_IMETHOD MarkedForDeath(PRBool* aResult);

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

@ -927,14 +927,13 @@ nsXBLPrototypeBinding::SetInitialAttributes(nsIContent* aBoundElement, nsIConten
}
}
already_AddRefed<nsISupportsArray>
nsCOMArray<nsIStyleRuleProcessor>*
nsXBLPrototypeBinding::GetRuleProcessors()
{
nsISupportsArray* result;
if (mResources) {
result = mResources->mRuleProcessors;
NS_IF_ADDREF(result);
} else
nsCOMArray<nsIStyleRuleProcessor> *result;
if (mResources)
result = &mResources->mRuleProcessors;
else
result = nsnull;
return result;
}

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

@ -119,7 +119,7 @@ public:
void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
already_AddRefed<nsISupportsArray> GetRuleProcessors();
nsCOMArray<nsIStyleRuleProcessor>* GetRuleProcessors();
already_AddRefed<nsISupportsArray> GetStyleSheets();
PRBool HasInsertionPoints() { return mInsertionPointTable != nsnull; }

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

@ -113,7 +113,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
// We have scoped stylesheets. Reload any chrome stylesheets we
// encounter. (If they aren't skin sheets, it doesn't matter, since
// they'll still be in the chrome cache.
mRuleProcessors->Clear();
mRuleProcessors.Clear();
nsresult rv;
nsCOMPtr<nsICSSLoader> loader = do_CreateInstance(kCSSLoaderCID, &rv);
@ -147,7 +147,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
nsCOMPtr<nsIStyleRuleProcessor> processor;
newSheet->GetStyleRuleProcessor(*getter_AddRefs(processor), prevProcessor);
if (processor != prevProcessor) {
mRuleProcessors->AppendElement(processor);
mRuleProcessors.AppendObject(processor);
prevProcessor = processor;
}
}

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

@ -43,6 +43,8 @@
#include "nsCOMPtr.h"
#include "nsICSSLoaderObserver.h"
#include "nsISupportsArray.h"
#include "nsIStyleRuleProcessor.h"
#include "nsCOMArray.h"
class nsIContent;
class nsIAtom;
@ -69,7 +71,7 @@ public:
// MEMBER VARIABLES
nsXBLResourceLoader* mLoader; // A loader object. Exists only long enough to load resources, and then it dies.
nsCOMPtr<nsISupportsArray> mStyleSheetList; // A list of loaded stylesheets for this binding.
nsCOMPtr<nsISupportsArray> mRuleProcessors; // The list of stylesheets converted to rule processors.
nsCOMArray<nsIStyleRuleProcessor> mRuleProcessors; // The list of stylesheets converted to rule processors.
};
#endif

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

@ -201,7 +201,7 @@ nsXBLResourceLoader::StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aNotify)
if (mPendingSheets == 0) {
// All stylesheets are loaded.
nsCOMPtr<nsIStyleRuleProcessor> prevProcessor;
NS_NewISupportsArray(getter_AddRefs(mResources->mRuleProcessors));
mResources->mRuleProcessors.Clear();
PRUint32 count;
mResources->mStyleSheetList->Count(&count);
for (PRUint32 i = 0; i < count; i++) {
@ -211,7 +211,7 @@ nsXBLResourceLoader::StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aNotify)
nsCOMPtr<nsIStyleRuleProcessor> processor;
sheet->GetStyleRuleProcessor(*getter_AddRefs(processor), prevProcessor);
if (processor != prevProcessor) {
mResources->mRuleProcessors->AppendElement(processor);
mResources->mRuleProcessors.AppendObject(processor);
prevProcessor = processor;
}
}

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

@ -70,3 +70,4 @@ libs::
install::
$(SYSINSTALL) $(IFLAGS1) $(EXPORT_RESOURCE_CONTENT) $(DESTDIR)$(mozappdir)/res/dtd
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -73,3 +73,4 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../xul/content/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -55,7 +55,6 @@
#include "nsHTMLParts.h"
#include "nsIHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIStyleSet.h"
#include "nsIComponentManager.h"
#include "nsIDOMComment.h"
#include "nsIDOMElement.h"

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

@ -72,3 +72,4 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../html/style/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -80,3 +80,4 @@ LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../xml/document/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -82,3 +82,4 @@ LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
-I$(srcdir)/../../content/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -41,7 +41,6 @@
#include "nsIPresShell.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleSet.h"
#include "nsIDocument.h"
#include "nsIDocumentObserver.h"
#include "nsISelectionController.h"
@ -49,7 +48,31 @@
#include "nsStyleSheetTxns.h"
static void
AddStyleSheet(nsIEditor* aEditor, nsIStyleSheet* aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
doc->BeginUpdate(UPDATE_STYLE);
doc->AddStyleSheet(aSheet, 0);
doc->EndUpdate(UPDATE_STYLE);
}
}
static void
RemoveStyleSheet(nsIEditor *aEditor, nsIStyleSheet *aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
doc->BeginUpdate(UPDATE_STYLE);
doc->RemoveStyleSheet(aSheet);
doc->EndUpdate(UPDATE_STYLE);
}
}
AddStyleSheetTxn::AddStyleSheetTxn()
: EditTxn()
@ -83,33 +106,8 @@ AddStyleSheetTxn::DoTransaction()
if (!mEditor || !mSheet)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsISelectionController> selCon;
mEditor->GetSelectionController(getter_AddRefs(selCon));
nsCOMPtr<nsIPresShell> presShell = do_QueryInterface(selCon);
if (!presShell)
return NS_ERROR_UNEXPECTED;
// although we don't need styleSet here; we need it in Undo
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet));
if (NS_FAILED(rv)) return rv;
if (!styleSet) return NS_OK;
nsCOMPtr<nsIStyleSheet> styleSheet = do_QueryInterface(mSheet);
if (styleSheet)
{
nsCOMPtr<nsIDocument> document;
rv = presShell->GetDocument(getter_AddRefs(document));
if (NS_SUCCEEDED(rv) && document) {
document->BeginUpdate(UPDATE_STYLE);
document->AddStyleSheet(styleSheet, 0);
document->EndUpdate(UPDATE_STYLE);
}
}
return rv;
AddStyleSheet(mEditor, mSheet);
return NS_OK;
}
NS_IMETHODIMP
@ -118,34 +116,8 @@ AddStyleSheetTxn::UndoTransaction()
if (!mEditor || !mSheet)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsISelectionController> selCon;
mEditor->GetSelectionController(getter_AddRefs(selCon));
nsCOMPtr<nsIPresShell> presShell = do_QueryInterface(selCon);
if (!presShell)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet));
if (NS_SUCCEEDED(rv) && styleSet)
{
styleSet->RemoveDocStyleSheet(mSheet);
nsCOMPtr<nsIDocumentObserver> observer = do_QueryInterface(presShell);
nsCOMPtr<nsIStyleSheet> styleSheet = do_QueryInterface(mSheet);
nsCOMPtr<nsIDocument> document;
rv = presShell->GetDocument(getter_AddRefs(document));
if (NS_SUCCEEDED(rv) && document && observer && styleSheet) {
observer->BeginUpdate(document, UPDATE_STYLE);
rv = observer->StyleSheetRemoved(document, styleSheet);
observer->EndUpdate(document, UPDATE_STYLE);
}
}
return rv;
RemoveStyleSheet(mEditor, mSheet);
return NS_OK;
}
NS_IMETHODIMP
@ -208,35 +180,9 @@ RemoveStyleSheetTxn::DoTransaction()
{
if (!mEditor || !mSheet)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsISelectionController> selCon;
mEditor->GetSelectionController(getter_AddRefs(selCon));
nsCOMPtr<nsIPresShell> presShell = do_QueryInterface(selCon);
if (!presShell)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet));
if (NS_SUCCEEDED(rv) && styleSet)
{
styleSet->RemoveDocStyleSheet(mSheet);
nsCOMPtr<nsIDocumentObserver> observer = do_QueryInterface(presShell);
nsCOMPtr<nsIStyleSheet> styleSheet = do_QueryInterface(mSheet);
nsCOMPtr<nsIDocument> document;
rv = presShell->GetDocument(getter_AddRefs(document));
if (NS_SUCCEEDED(rv) && document && observer && styleSheet) {
observer->BeginUpdate(document, UPDATE_STYLE);
rv = observer->StyleSheetRemoved(document, styleSheet);
observer->EndUpdate(document, UPDATE_STYLE);
}
}
return rv;
RemoveStyleSheet(mEditor, mSheet);
return NS_OK;
}
NS_IMETHODIMP
@ -244,35 +190,9 @@ RemoveStyleSheetTxn::UndoTransaction()
{
if (!mEditor || !mSheet)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsISelectionController> selCon;
mEditor->GetSelectionController(getter_AddRefs(selCon));
nsCOMPtr<nsIPresShell> presShell = do_QueryInterface(selCon);
if (!presShell)
return NS_ERROR_UNEXPECTED;
// although we don't really use styleSet here, we will in Do above
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet));
if (NS_SUCCEEDED(rv) && styleSet)
{
nsCOMPtr<nsIStyleSheet> styleSheet = do_QueryInterface(mSheet);
if (styleSheet)
{
nsCOMPtr<nsIDocument> document;
rv = presShell->GetDocument(getter_AddRefs(document));
if (NS_SUCCEEDED(rv) && document) {
document->BeginUpdate(UPDATE_STYLE);
document->AddStyleSheet(styleSheet, 0);
document->EndUpdate(UPDATE_STYLE);
}
}
}
return rv;
AddStyleSheet(mEditor, mSheet);
return NS_OK;
}
NS_IMETHODIMP

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

@ -68,7 +68,6 @@
#include "nsICSSLoader.h"
#include "nsICSSStyleSheet.h"
#include "nsIHTMLContentContainer.h"
#include "nsIStyleSet.h"
#include "nsIDocumentObserver.h"
#include "nsIDocumentStateListener.h"

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

@ -123,7 +123,6 @@
// Misc
#include "TextEditorTest.h"
#include "nsEditorUtils.h"
#include "nsIStyleSet.h"
#include "nsIPref.h"
#include "nsITextContent.h"
#include "nsWSRunObject.h"
@ -3675,37 +3674,21 @@ nsHTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
if (!sheet)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIStyleSheet> styleSheet;
styleSheet = do_QueryInterface(sheet);
nsCOMPtr<nsIStyleSet> styleSet;
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
if (!ps)
return NS_ERROR_NOT_INITIALIZED;
rv = ps->GetStyleSet(getter_AddRefs(styleSet));
NS_ENSURE_SUCCESS(rv, rv);
if (!styleSet)
return NS_ERROR_NULL_POINTER;
// Add the override style sheet
// (This checks if already exists)
styleSet->AppendOverrideStyleSheet(styleSheet);
ps->AddOverrideStyleSheet(sheet);
// Save doc pointer to be able to use nsIStyleSheet::SetEnabled()
nsCOMPtr<nsIDocument> document;
rv = ps->GetDocument(getter_AddRefs(document));
if (NS_FAILED(rv))
return rv;
nsIDocument *document = ps->GetDocument();
if (!document)
return NS_ERROR_NULL_POINTER;
styleSheet->SetOwningDocument(document);
sheet->SetOwningDocument(document);
// This notifies document observers to recompute style data
// (this doesn't affect style sheet because it is not a doc sheet)
// XXXbz this is a major misuse of the API....
document->BeginUpdate(UPDATE_STYLE);
document->SetStyleSheetApplicableState(styleSheet, PR_TRUE);
document->EndUpdate(UPDATE_STYLE);
ps->ReconstructStyleData();
// Save as the last-loaded sheet
mLastOverrideStyleSheetURL = aURL;
@ -3747,27 +3730,8 @@ nsHTMLEditor::RemoveOverrideStyleSheet(const nsAString &aURL)
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
if (!ps) return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDocument> document;
rv = ps->GetDocument(getter_AddRefs(document));
NS_ENSURE_SUCCESS(rv, rv);;
if (!document) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIStyleSet> styleSet;
rv = ps->GetStyleSet(getter_AddRefs(styleSet));
NS_ENSURE_SUCCESS(rv, rv);
if (!styleSet) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIStyleSheet> styleSheet = do_QueryInterface(sheet);
if (!styleSheet) return NS_ERROR_NULL_POINTER;
styleSet->RemoveOverrideStyleSheet(styleSheet);
// This notifies document observers to recompute style data
// (this doesn't affect style sheet because it is not a doc sheet)
// XXXbz this is a major misuse of the API....
document->BeginUpdate(UPDATE_STYLE);
document->SetStyleSheetApplicableState(styleSheet, PR_FALSE);
document->EndUpdate(UPDATE_STYLE);
ps->RemoveOverrideStyleSheet(sheet);
ps->ReconstructStyleData();
// Remove it from our internal list
return RemoveStyleSheetFromList(aURL);

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

@ -39,6 +39,7 @@ REQUIRES = xpcom \
necko \
docshell \
view \
webshell \
$(NULL)
CPPSRCS= \

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

@ -57,7 +57,6 @@
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIStyleSet.h"
#include "nsIFrame.h"
#include "nsIFrameDebug.h"
@ -127,18 +126,6 @@ document(nsIDocShell *aDocShell)
return result;
}
static already_AddRefed<nsIStyleSet>
style_set(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
if (!shell)
return nsnull;
nsIStyleSet *result = nsnull;
shell->GetStyleSet(&result);
return result;
}
nsLayoutDebuggingTools::nsLayoutDebuggingTools()
: mPaintFlashing(PR_FALSE),
mPaintDumping(PR_FALSE),
@ -522,11 +509,11 @@ nsLayoutDebuggingTools::DumpStyleSheets()
{
#ifdef DEBUG
FILE *out = stdout;
nsCOMPtr<nsIStyleSet> styleSet(style_set(mDocShell));
if (styleSet)
styleSet->List(out);
nsCOMPtr<nsIPresShell> shell(pres_shell(mDocShell));
if (shell)
shell->ListStyleSheets(out);
else
fputs("null style set\n", out);
fputs("null pres shell\n", out);
#endif
return NS_OK;
}
@ -538,18 +525,12 @@ nsLayoutDebuggingTools::DumpStyleContexts()
FILE *out = stdout;
nsCOMPtr<nsIPresShell> shell(pres_shell(mDocShell));
if (shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
if (!styleSet) {
fputs("null style set\n", out);
nsIFrame* root;
shell->GetRootFrame(&root);
if (!root) {
fputs("null root frame\n", out);
} else {
nsIFrame* root;
shell->GetRootFrame(&root);
if (!root) {
fputs("null root frame\n", out);
} else {
styleSet->ListContexts(root, out);
}
shell->ListStyleContexts(root, out);
}
} else {
fputs("null pres shell\n", out);

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

@ -66,7 +66,6 @@
#include "nsIPrefService.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsIStyleSet.h"

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

@ -61,7 +61,7 @@
#include "nsIStyleFrameConstruction.h"
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIViewManager.h"
#include "nsIScrollableView.h"
#include "nsStyleConsts.h"
@ -1228,25 +1228,8 @@ GetChildListNameFor(nsIPresContext* aPresContext,
//----------------------------------------------------------------------
nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCSSFrameConstructor *c = new nsCSSFrameConstructor();
if (!c)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(c);
nsresult rv = CallQueryInterface(c, aResult);
NS_RELEASE(c);
return rv;
}
nsCSSFrameConstructor::nsCSSFrameConstructor(void)
: nsIStyleFrameConstruction(),
mDocument(nsnull),
: mDocument(nsnull),
mInitialContainingBlock(nsnull),
mFixedContainingBlock(nsnull),
mDocElementContainingBlock(nsnull),
@ -3556,9 +3539,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
nsIBindingManager *bindingManager = mDocument->GetBindingManager();
if (bindingManager) {
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
nsCOMPtr<nsIStyleSet> set;
aPresShell->GetStyleSet(getter_AddRefs(set));
set->SetStyleRuleSupplier(ruleSupplier);
aPresShell->StyleSet()->SetStyleRuleSupplier(ruleSupplier);
}
// --------- BUILD VIEWPORT -----------
@ -9973,134 +9954,129 @@ nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
NS_ASSERTION(shell, "couldn't get pres shell");
if (shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
nsStyleSet *styleSet = shell->StyleSet();
NS_ASSERTION(styleSet, "couldn't get style set");
if (styleSet) { // test if any style rules exist which are dependent on content state
// Detect if one is the ancestor of the other, and skip if so.
if (aContent1 && aContent2) {
if (aContent1 == aContent2)
aContent2 = nsnull;
else if (IsAncestorOf(aContent1, aContent2))
aContent2 = nsnull;
else if (IsAncestorOf(aContent2, aContent1)) {
// test if any style rules exist which are dependent on content state
// Detect if one is the ancestor of the other, and skip if so.
if (aContent1 && aContent2) {
if (aContent1 == aContent2)
aContent2 = nsnull;
else if (IsAncestorOf(aContent1, aContent2))
aContent2 = nsnull;
else if (IsAncestorOf(aContent2, aContent1)) {
aContent1 = nsnull;
}
}
nsIFrame* primaryFrame1 = nsnull;
nsIFrame* primaryFrame2 = nsnull;
PRUint8 app1 = 0;
PRUint8 app2 = 0;
if (aContent1) {
shell->GetPrimaryFrameFor(aContent1, &primaryFrame1);
if (primaryFrame1) {
app1 = primaryFrame1->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app1 here when you could just do the code
// below |if (app1)| above and avoid the extra style reresolution?
if (!app1) {
if (!styleSet->HasStateDependentStyle(aPresContext, aContent1,
aStateMask))
{
primaryFrame1 = nsnull;
aContent1 = nsnull;
}
}
}
nsIFrame* primaryFrame1 = nsnull;
nsIFrame* primaryFrame2 = nsnull;
PRUint8 app1 = 0;
PRUint8 app2 = 0;
if (aContent1) {
shell->GetPrimaryFrameFor(aContent1, &primaryFrame1);
if (primaryFrame1) {
app1 = primaryFrame1->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app1 here when you could just do the code
// below |if (app1)| above and avoid the extra style reresolution?
if (!app1) {
PRBool depends = PR_FALSE;
styleSet->HasStateDependentStyle(aPresContext, aContent1,
aStateMask, &depends);
if (!depends) {
primaryFrame1 = nsnull;
aContent1 = nsnull;
}
}
}
if (aContent2) {
shell->GetPrimaryFrameFor(aContent2, &primaryFrame2);
if (primaryFrame2) {
app2 = primaryFrame2->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app2 here when you could just do the code
// below |if (app2)| above and avoid the extra style reresolution?
if (!app2) {
PRBool depends = PR_FALSE;
styleSet->HasStateDependentStyle(aPresContext, aContent2,
aStateMask, &depends);
if (!depends) {
primaryFrame2 = nsnull;
aContent2 = nsnull;
}
}
}
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (primaryFrame1) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame1,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE,
frameChange);
if (app1) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame1, app1))
theme->WidgetStateChanged(primaryFrame1, app1, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame1, nsnull, nsChangeHint_RepaintFrame);
}
if (frameChange & nsChangeHint_ReconstructDoc) {
return ReconstructDocElementHierarchy(aPresContext);
// No need to worry about anything else.
}
else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent1);
changeList.Clear();
} else {
ProcessRestyledFrames(changeList, aPresContext);
}
}
if (aContent2) {
shell->GetPrimaryFrameFor(aContent2, &primaryFrame2);
if (primaryFrame2) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame2,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE, frameChange);
if (app2) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame2, app2))
theme->WidgetStateChanged(primaryFrame2, app2, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame2, nsnull, nsChangeHint_RepaintFrame);
}
app2 = primaryFrame2->GetStyleDisplay()->mAppearance;
}
// max change needed for top level frames
if (frameChange & nsChangeHint_ReconstructDoc) {
result = ReconstructDocElementHierarchy(aPresContext);
changeList.Clear();
} else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent2);
changeList.Clear();
} else {
// process any children that need it
ProcessRestyledFrames(changeList, aPresContext);
// XXXldb Why check app2 here when you could just do the code
// below |if (app2)| above and avoid the extra style reresolution?
if (!app2) {
if (!styleSet->HasStateDependentStyle(aPresContext, aContent2,
aStateMask))
{
primaryFrame2 = nsnull;
aContent2 = nsnull;
}
}
// no frames, reconstruct for content
if (!primaryFrame1 && aContent1) {
result = MaybeRecreateFramesForContent(aPresContext, aContent1);
}
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (primaryFrame1) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame1,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE,
frameChange);
if (app1) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame1, app1))
theme->WidgetStateChanged(primaryFrame1, app1, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame1, nsnull, nsChangeHint_RepaintFrame);
}
if (!primaryFrame2 && aContent2) {
result = MaybeRecreateFramesForContent(aPresContext, aContent2);
if (frameChange & nsChangeHint_ReconstructDoc) {
return ReconstructDocElementHierarchy(aPresContext);
// No need to worry about anything else.
}
else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent1);
changeList.Clear();
} else {
ProcessRestyledFrames(changeList, aPresContext);
}
}
if (primaryFrame2) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame2,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE, frameChange);
if (app2) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame2, app2))
theme->WidgetStateChanged(primaryFrame2, app2, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame2, nsnull, nsChangeHint_RepaintFrame);
}
// max change needed for top level frames
if (frameChange & nsChangeHint_ReconstructDoc) {
result = ReconstructDocElementHierarchy(aPresContext);
changeList.Clear();
} else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent2);
changeList.Clear();
} else {
// process any children that need it
ProcessRestyledFrames(changeList, aPresContext);
}
}
// no frames, reconstruct for content
if (!primaryFrame1 && aContent1) {
result = MaybeRecreateFramesForContent(aPresContext, aContent1);
}
if (!primaryFrame2 && aContent2) {
result = MaybeRecreateFramesForContent(aPresContext, aContent2);
}
}
return result;
@ -10615,7 +10591,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
}
nsresult
nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -10644,7 +10620,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIFrame* continuingTableFrame;
// It's the inner table frame, so create a continuing frame
CreateContinuingFrame(aPresShell, aPresContext, childFrame, newFrame, &continuingTableFrame);
CreateContinuingFrame(aPresContext, childFrame, newFrame, &continuingTableFrame);
newChildFrames.AddChild(continuingTableFrame);
} else {
// XXX remove this code and the above checks. We don't want to replicate
@ -10766,12 +10742,12 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
}
NS_IMETHODIMP
nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame)
{
nsIPresShell* shell = aPresContext->PresShell();
nsStyleContext* styleContext = aFrame->GetStyleContext();
nsIFrame* newFrame = nsnull;
nsresult rv = NS_OK;
@ -10781,7 +10757,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIContent* content = aFrame->GetContent();
if (nsLayoutAtoms::textFrame == frameType) {
rv = NS_NewContinuingTextFrame(aPresShell, &newFrame);
rv = NS_NewContinuingTextFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10789,7 +10765,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::inlineFrame == frameType) {
rv = NS_NewInlineFrame(aPresShell, &newFrame);
rv = NS_NewInlineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10797,7 +10773,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::blockFrame == frameType) {
rv = NS_NewBlockFrame(aPresShell, &newFrame);
rv = NS_NewBlockFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10805,7 +10781,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::areaFrame == frameType) {
rv = NS_NewAreaFrame(aPresShell, &newFrame, 0);
rv = NS_NewAreaFrame(shell, &newFrame, 0);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext,
aFrame);
@ -10814,7 +10790,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::positionedInlineFrame == frameType) {
rv = NS_NewPositionedInlineFrame(aPresShell, &newFrame);
rv = NS_NewPositionedInlineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10823,18 +10799,18 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
} else if (nsLayoutAtoms::pageFrame == frameType) {
nsIFrame* pageContentFrame;
rv = ConstructPageFrame(aPresShell, aPresContext, aParentFrame, aFrame,
rv = ConstructPageFrame(shell, aPresContext, aParentFrame, aFrame,
newFrame, pageContentFrame);
} else if (nsLayoutAtoms::tableOuterFrame == frameType) {
rv = CreateContinuingOuterTableFrame(aPresShell, aPresContext, aFrame, aParentFrame,
rv = CreateContinuingOuterTableFrame(shell, aPresContext, aFrame, aParentFrame,
content, styleContext, &newFrame);
} else if (nsLayoutAtoms::tableFrame == frameType) {
rv = CreateContinuingTableFrame(aPresShell, aPresContext, aFrame, aParentFrame,
rv = CreateContinuingTableFrame(shell, aPresContext, aFrame, aParentFrame,
content, styleContext, &newFrame);
} else if (nsLayoutAtoms::tableRowGroupFrame == frameType) {
rv = NS_NewTableRowGroupFrame(aPresShell, &newFrame);
rv = NS_NewTableRowGroupFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10842,7 +10818,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::tableRowFrame == frameType) {
rv = NS_NewTableRowFrame(aPresShell, &newFrame);
rv = NS_NewTableRowFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10858,7 +10834,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
if (IS_TABLE_CELL(cellFrame->GetType())) {
nsIFrame* continuingCellFrame;
CreateContinuingFrame(aPresShell, aPresContext, cellFrame, newFrame, &continuingCellFrame);
CreateContinuingFrame(aPresContext, cellFrame, newFrame, &continuingCellFrame);
newChildList.AddChild(continuingCellFrame);
}
cellFrame = cellFrame->GetNextSibling();
@ -10869,7 +10845,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (IS_TABLE_CELL(frameType)) {
rv = NS_NewTableCellFrame(aPresShell, IsBorderCollapse(aParentFrame), &newFrame);
rv = NS_NewTableCellFrame(shell, IsBorderCollapse(aParentFrame), &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10879,14 +10855,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIFrame* areaFrame;
nsIFrame* continuingAreaFrame;
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
CreateContinuingFrame(aPresShell, aPresContext, areaFrame, newFrame, &continuingAreaFrame);
CreateContinuingFrame(aPresContext, areaFrame, newFrame, &continuingAreaFrame);
// Set the table cell's initial child list
newFrame->SetInitialChildList(aPresContext, nsnull, continuingAreaFrame);
}
} else if (nsLayoutAtoms::lineFrame == frameType) {
rv = NS_NewFirstLineFrame(aPresShell, &newFrame);
rv = NS_NewFirstLineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10894,7 +10870,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::letterFrame == frameType) {
rv = NS_NewFirstLetterFrame(aPresShell, &newFrame);
rv = NS_NewFirstLetterFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10902,7 +10878,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::imageFrame == frameType) {
rv = NS_NewImageFrame(aPresShell, &newFrame);
rv = NS_NewImageFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
}
@ -10910,14 +10886,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// create a continuing out of flow frame
nsIFrame* oofFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
nsIFrame* oofContFrame;
CreateContinuingFrame(aPresShell, aPresContext, oofFrame, aParentFrame, &oofContFrame);
CreateContinuingFrame(aPresContext, oofFrame, aParentFrame, &oofContFrame);
if (!oofContFrame)
return NS_ERROR_NULL_POINTER;
// create a continuing placeholder frame
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
shell->GetFrameManager(getter_AddRefs(frameManager));
NS_ASSERTION(frameManager, "no frame manager");
CreatePlaceholderFrameFor(aPresShell, aPresContext, frameManager, content,
CreatePlaceholderFrameFor(shell, aPresContext, frameManager, content,
oofContFrame, styleContext, aParentFrame, &newFrame);
if (!newFrame)
return NS_ERROR_NULL_POINTER;
@ -10982,7 +10958,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Iterate the fixed frames and replicate each
for (nsIFrame* fixed = firstFixed; fixed; fixed = fixed->GetNextSibling()) {
rv = ConstructFrame(aPresShell, aPresContext, state, fixed->GetContent(),
rv = ConstructFrame(shell, aPresContext, state, fixed->GetContent(),
newFrame, fixedPlaceholders);
if (NS_FAILED(rv))
return rv;
@ -12071,7 +12047,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
nsIFrame* nextTextFrame = nsnull;
if (NeedFirstLetterContinuation(aTextContent)) {
// Create continuation
CreateContinuingFrame(aPresShell, aPresContext, aTextFrame, aParentFrame,
CreateContinuingFrame(aPresContext, aTextFrame, aParentFrame,
&nextTextFrame);
// Repair the continuations style context

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

@ -149,8 +149,7 @@ public:
nsIFrame* aFrame);
// Request to create a continuing frame
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame);

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

@ -53,7 +53,7 @@
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIFrame.h"
@ -195,7 +195,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
#include "nsBidiUtils.h"
static NS_DEFINE_CID(kGalleyContextCID, NS_GALLEYCONTEXT_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
#ifdef NS_DEBUG
@ -640,8 +639,8 @@ nsresult
DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
{
// Create the style set...
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = CreateStyleSet(mDocument, getter_AddRefs(styleSet));
nsStyleSet *styleSet;
nsresult rv = CreateStyleSet(mDocument, &styleSet);
NS_ENSURE_SUCCESS(rv, rv);
// Now make the shell for the document
@ -1192,8 +1191,8 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
if (mPresContext) {
// 3) Create a new style set for the document
nsCOMPtr<nsIStyleSet> styleSet;
rv = CreateStyleSet(mDocument, getter_AddRefs(styleSet));
nsStyleSet *styleSet;
rv = CreateStyleSet(mDocument, &styleSet);
if (NS_FAILED(rv))
return rv;
@ -1587,79 +1586,83 @@ DocumentViewerImpl::ForceRefresh()
nsresult
DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
nsIStyleSet** aStyleSet)
nsStyleSet** aStyleSet)
{
// this should eventually get expanded to allow for creating
// different sets for different media
nsresult rv;
if (!mUAStyleSheet) {
NS_WARNING("unable to load UA style sheet");
}
rv = CallCreateInstance(kStyleSetCID, aStyleSet);
if (NS_OK == rv) {
PRInt32 index = aDocument->GetNumberOfStyleSheets(PR_TRUE);
nsStyleSet *styleSet = new nsStyleSet();
if (!styleSet) {
return NS_ERROR_OUT_OF_MEMORY;
}
while (0 < index--) {
nsIStyleSheet *sheet = aDocument->GetStyleSheetAt(index, PR_TRUE);
PRInt32 index = aDocument->GetNumberOfStyleSheets(PR_TRUE);
/*
* GetStyleSheetAt will return all style sheets in the document but
* we're only interested in the ones that are enabled.
*/
styleSet->BeginUpdate();
PRBool styleApplicable;
sheet->GetApplicable(styleApplicable);
while (0 < index--) {
nsIStyleSheet *sheet = aDocument->GetStyleSheetAt(index, PR_TRUE);
if (styleApplicable) {
(*aStyleSet)->AddDocStyleSheet(sheet, aDocument);
}
}
/*
* GetStyleSheetAt will return all style sheets in the document but
* we're only interested in the ones that are enabled.
*/
nsCOMPtr<nsIChromeRegistry> chromeRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1");
PRBool styleApplicable;
sheet->GetApplicable(styleApplicable);
if (chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
// Now handle the user sheets.
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(mContainer));
PRInt32 shellType;
docShell->GetItemType(&shellType);
PRBool isChrome = (shellType == nsIDocShellTreeItem::typeChrome);
sheets = nsnull;
chromeRegistry->GetUserSheets(isChrome, getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
// Insert the user sheets at the front of the user sheet list
// so that they are most significant user sheets.
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->InsertUserStyleSheetBefore(sheet, nsnull);
}
}
// Append chrome sheets (scrollbars + forms).
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(mContainer));
chromeRegistry->GetAgentSheets(ds, getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->AppendAgentStyleSheet(sheet);
}
}
}
if (mUAStyleSheet) {
(*aStyleSet)->AppendAgentStyleSheet(mUAStyleSheet);
if (styleApplicable) {
styleSet->AddDocStyleSheet(sheet, aDocument);
}
}
nsCOMPtr<nsIChromeRegistry> chromeRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1");
if (chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
// Now handle the user sheets.
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(mContainer));
PRInt32 shellType;
docShell->GetItemType(&shellType);
PRBool isChrome = (shellType == nsIDocShellTreeItem::typeChrome);
chromeRegistry->GetUserSheets(isChrome, getter_AddRefs(sheets));
if (sheets) {
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
// Insert the user sheets at the front of the user sheet list
// so that they are most significant user sheets.
for (PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
styleSet->PrependStyleSheet(nsStyleSet::eUserSheet, sheet);
}
}
// Append chrome sheets (scrollbars + forms).
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(mContainer));
chromeRegistry->GetAgentSheets(ds, getter_AddRefs(sheets));
if (sheets) {
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for (PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
styleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, sheet);
}
}
}
if (mUAStyleSheet) {
styleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, mUAStyleSheet);
}
styleSet->EndUpdate();
*aStyleSet = styleSet;
return NS_OK;
}

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

@ -33,7 +33,8 @@
#include "nsIFrame.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIStyleFrameConstruction.h"
#include "nsStyleContext.h"
#include "nsStyleChangeList.h"
#include "nsIEventQueueService.h"
@ -273,7 +274,7 @@ public:
NS_DECL_ISUPPORTS
// nsIFrameManager
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet);
NS_IMETHOD Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet);
NS_IMETHOD Destroy();
// Gets and sets the root frame
@ -392,10 +393,9 @@ private:
nsIPresContext* GetPresContext() const {
return mPresShell->GetPresContext();
}
nsIStyleSet* GetStyleSet() const { return mStyleSet; }
nsIPresShell* mPresShell; // weak link, because the pres shell owns us
nsIStyleSet* mStyleSet; // weak link. pres shell holds a reference
nsStyleSet* mStyleSet; // weak link. pres shell holds a reference
nsIFrame* mRootFrame;
PLDHashTable mPrimaryFrameMap;
PLDHashTable mPlaceholderMap;
@ -454,7 +454,7 @@ NS_IMPL_ISUPPORTS1(FrameManager, nsIFrameManager)
NS_IMETHODIMP
FrameManager::Init(nsIPresShell* aPresShell,
nsIStyleSet* aStyleSet)
nsStyleSet* aStyleSet)
{
NS_ASSERTION(aPresShell, "null aPresShell");
NS_ASSERTION(aStyleSet, "null aStyleSet");
@ -596,16 +596,13 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
// very fast in the embedded hash table.
// This would almost completely remove the lookup penalty for things
// like <SCRIPT> and comments in very large documents.
nsCOMPtr<nsIStyleSet> styleSet;
nsCOMPtr<nsIPresContext> presContext;
// Give the frame construction code the opportunity to return the
// frame that maps the content object
mPresShell->GetStyleSet(getter_AddRefs(styleSet));
NS_ASSERTION(styleSet, "bad style set");
mPresShell->GetPresContext(getter_AddRefs(presContext));
NS_ASSERTION(presContext, "bad presContext");
if (!styleSet || !presContext) {
if (!presContext) {
return NS_ERROR_NULL_POINTER;
}
@ -641,8 +638,9 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
// walk the frame tree to find the frame that maps aContent.
// Use the hint if we have it.
styleSet->FindPrimaryFrameFor(presContext, this, aContent, aResult,
hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);
mPresShell->FrameConstructor()->
FindPrimaryFrameFor(presContext, this, aContent, aResult,
hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);
}
}
@ -1140,8 +1138,10 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent)
// are generated
nsCOMPtr<nsIPresContext> presContext;
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
frameManager->mStyleSet->CantRenderReplacedElement(presContext,
aEvent->mFrame);
frameManager->mPresShell->FrameConstructor()->
CantRenderReplacedElement(frameManager->mPresShell, presContext,
aEvent->mFrame);
#ifdef NOISY_EVENTS
printf("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner);
#endif
@ -2016,9 +2016,9 @@ FrameManager::HasAttributeDependentStyle(nsIContent *aContent,
return NS_OK;
}
return mStyleSet->HasAttributeDependentStyle(GetPresContext(), aContent,
aAttribute, aModType,
aResult);
*aResult = mStyleSet->HasAttributeDependentStyle(GetPresContext(), aContent,
aAttribute, aModType);
return NS_OK;
}
// Capture state for a given frame.

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

@ -46,7 +46,7 @@ class nsPrintObject;
class nsISelection;
class nsIPresShell;
class nsIDocument;
class nsIStyleSet;
class nsStyleSet;
class nsIContent;
class nsIWebShell;
@ -72,7 +72,7 @@ public:
virtual PRBool GetIsCreatingPrintPreview() = 0;
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsIStyleSet** aStyleSet) = 0;
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsStyleSet** aStyleSet) = 0;
virtual nsresult GetDocumentSelection(nsISelection **aSelection,
nsIPresShell * aPresShell = nsnull) = 0;
@ -97,7 +97,7 @@ public:
virtual void SetIsPrintPreview(PRBool aIsPrintPreview); \
virtual PRBool GetIsPrintPreview(); \
virtual PRBool GetIsCreatingPrintPreview(); \
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsIStyleSet** aStyleSet); \
virtual nsresult CreateStyleSet(nsIDocument* aDocument, nsStyleSet** aStyleSet); \
virtual nsresult GetDocumentSelection(nsISelection **aSelection, nsIPresShell * aPresShell = nsnull); \
virtual void IncrementDestroyRefCount(); \
virtual void ReturnToGalleyPresentation(); \

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

@ -42,6 +42,8 @@
#include "nsEvent.h"
#include "nsReflowType.h"
#include "nsCompatibility.h"
#include "nsCOMArray.h"
#include <stdio.h> // for FILE definition
class nsIAtom;
class nsIContent;
@ -50,7 +52,7 @@ class nsIDocument;
class nsIDocumentObserver;
class nsIFrame;
class nsIPresContext;
class nsIStyleSet;
class nsStyleSet;
class nsIViewManager;
class nsIDeviceContext;
class nsIRenderingContext;
@ -67,6 +69,8 @@ class nsIReflowCallback;
class nsISupportsArray;
class nsIDOMNode;
class nsHTMLReflowCommand;
class nsIStyleFrameConstruction;
class nsIStyleSheet;
#define NS_IPRESSHELL_IID \
{ 0x76e79c60, 0x944e, 0x11d1, \
@ -119,7 +123,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode) = 0;
/**
@ -151,8 +155,14 @@ public:
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult) = 0;
nsIStyleSet* GetStyleSet() { return mStyleSet; }
#ifdef _IMPL_NS_LAYOUT
nsStyleSet* StyleSet() { return mStyleSet; }
#endif
nsIStyleFrameConstruction* FrameConstructor()
{
return mFrameConstructor;
}
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
nsIFrameManager* GetFrameManager() { return mFrameManager; }
@ -551,6 +561,26 @@ public:
*/
virtual PRBool IsThemeSupportEnabled() = 0;
/**
* Get the set of agent style sheets for this presentation
*/
virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets) = 0;
/**
* Replace the set of agent style sheets
*/
virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets) = 0;
/**
* Add an override style sheet for this presentation
*/
virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
/**
* Remove an override style sheet
*/
virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
/**
* See if reflow verification is enabled. To enable reflow verification add
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
@ -569,7 +599,6 @@ public:
*/
static PRInt32 GetVerifyReflowFlags();
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD DumpReflows() = 0;
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
@ -603,6 +632,14 @@ public:
NS_IMETHOD BidiStyleChangeReflow(void) = 0;
#endif
#ifdef DEBUG
// Debugging hooks
virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
PRInt32 aIndent = 0) = 0;
virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0) = 0;
#endif
protected:
// IMPORTANT: The ownership implicit in the following member variables
// has been explicitly checked. If you add any members to this class,
@ -612,7 +649,8 @@ protected:
// we must share ownership.
nsIDocument* mDocument; // [STRONG]
nsIPresContext* mPresContext; // [STRONG]
nsIStyleSet* mStyleSet; // [STRONG]
nsStyleSet* mStyleSet; // [STRONG]
nsIStyleFrameConstruction* mFrameConstructor; // [STRONG]
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsIFrameManager* mFrameManager; // [STRONG]
};

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

@ -40,7 +40,7 @@
#include "nsIPref.h"
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsImageLoader.h"
#include "nsIContent.h"
@ -587,9 +587,7 @@ nsPresContext::ClearStyleDataAndReflow()
{
if (mShell) {
// Clear out all our style data.
nsCOMPtr<nsIStyleSet> set;
mShell->GetStyleSet(getter_AddRefs(set));
set->ClearStyleData(this);
mShell->StyleSet()->ClearStyleData(this);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
@ -767,11 +765,8 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
return;
// enable/disable the QuirkSheet
nsCOMPtr<nsIStyleSet> set;
mShell->GetStyleSet(getter_AddRefs(set));
if (set) {
set->EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
}
mShell->StyleSet()->
EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
}
// Helper function for setting Anim Mode on image
@ -895,27 +890,13 @@ already_AddRefed<nsStyleContext>
nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return the addref'd style context
return set->ResolveStyleFor(this, aContent, aParentContext);
}
return nsnull;
return mShell->StyleSet()->ResolveStyleFor(this, aContent, aParentContext);
}
already_AddRefed<nsStyleContext>
nsPresContext::ResolveStyleContextForNonElement(nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ResolveStyleForNonElement(this, aParentContext);
}
return nsnull;
return mShell->StyleSet()->ResolveStyleForNonElement(this, aParentContext);
}
already_AddRefed<nsStyleContext>
@ -933,15 +914,9 @@ nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aComparator);
}
return nsnull;
return mShell->StyleSet()->ResolvePseudoStyleFor(this, aParentContent,
aPseudoTag, aParentContext,
aComparator);
}
already_AddRefed<nsStyleContext>
@ -949,15 +924,8 @@ nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ProbePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext);
}
return nsnull;
return mShell->StyleSet()->ProbePseudoStyleFor(this, aParentContent,
aPseudoTag, aParentContext);
}
NS_IMETHODIMP

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

@ -142,7 +142,6 @@ public:
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
nsIStyleSet* GetStyleSet() { return GetPresShell()->GetStyleSet(); }
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }

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

@ -44,7 +44,7 @@
#include "nsIDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDocumentObserver.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsICSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please?
#include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
@ -112,9 +112,6 @@
#include "nsLayoutErrors.h"
#include "nsLayoutUtils.h"
#include "nsCSSRendering.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
#endif
#ifdef NS_DEBUG
#include "nsIFrameDebug.h"
#endif
@ -163,7 +160,7 @@
// For style data reconstruction
#include "nsStyleChangeList.h"
#include "nsIStyleFrameConstruction.h"
#include "nsCSSFrameConstructor.h"
#include "nsIBindingManager.h"
#ifdef MOZ_XUL
#include "nsIMenuFrame.h"
@ -185,7 +182,6 @@
#include "nsContentCID.h"
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
@ -193,22 +189,6 @@ static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
// * - initially created for bugs 31816, 20760, 22963
static void ColorToString(nscolor aColor, nsAutoString &aString);
#ifdef MOZ_PERF_METRICS
// local management of the style watch:
// aCtlValue should be set to all actions desired (bitwise OR'd together)
// aStyleSet cannot be null
// NOTE: implementation is noop unless MOZ_PERF_METRICS is defined
static void CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet);
#define kStyleWatchEnable 1
#define kStyleWatchDisable 2
#define kStyleWatchPrint 4
#define kStyleWatchStart 8
#define kStyleWatchStop 16
#define kStyleWatchReset 32
#else /* !defined(MOZ_PERF_METRICS */
#define CtlStyleWatch(ctlvalue_,styleset_) /* nothing */
#endif /* !defined(MOZ_PERF_METRICS */
// Class ID's
static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -1023,7 +1003,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode);
NS_IMETHOD Destroy();
@ -1039,7 +1019,6 @@ public:
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult);
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
@ -1151,6 +1130,12 @@ public:
NS_IMETHOD DisableThemeSupport();
virtual PRBool IsThemeSupportEnabled();
virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets);
virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets);
virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet);
virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet);
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent, PRUint32 aFlags, nsEventStatus* aStatus);
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame);
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
@ -1218,6 +1203,13 @@ public:
#endif
#ifdef DEBUG
virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
PRInt32 aIndent = 0);
virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0);
#endif
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
@ -1245,7 +1237,6 @@ protected:
nsresult RemoveDummyLayoutRequest(void);
nsresult ReconstructFrames(void);
nsresult CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult);
nsresult WillCauseReflow();
nsresult DidCauseReflow();
nsresult ProcessReflowCommands(PRBool aInterruptible);
@ -1265,6 +1256,7 @@ protected:
nsCOMPtr<nsIBidiKeyboard> mBidiKeyboard;
#endif // IBMBIDI
#ifdef NS_DEBUG
nsresult CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult);
PRBool VerifyIncrementalReflow();
PRBool mInVerifyReflow;
#endif
@ -1605,7 +1597,7 @@ NS_IMETHODIMP
PresShell::Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode)
{
NS_PRECONDITION(nsnull != aDocument, "null ptr");
@ -1624,6 +1616,12 @@ PresShell::Init(nsIDocument* aDocument,
NS_ADDREF(mDocument);
mViewManager = aViewManager;
// Create our frame constructor.
nsCSSFrameConstructor* fc = new nsCSSFrameConstructor();
NS_ENSURE_TRUE(fc, NS_ERROR_OUT_OF_MEMORY);
fc->Init(mDocument);
CallQueryInterface(fc, &mFrameConstructor);
// The document viewer owns both view manager and pres shell.
mViewManager->SetViewObserver(this);
@ -1632,8 +1630,11 @@ PresShell::Init(nsIDocument* aDocument,
NS_ADDREF(mPresContext);
aPresContext->SetShell(this);
// Now we can initialize the style set.
nsresult result = aStyleSet->Init(aPresContext);
NS_ENSURE_SUCCESS(result, result);
mStyleSet = aStyleSet;
NS_IF_ADDREF(mStyleSet);
// Set the compatibility mode after attaching the pres context and
// style set, but before creating any frames.
@ -1643,9 +1644,9 @@ PresShell::Init(nsIDocument* aDocument,
// before creating any frames.
SetPreferenceStyleRules(PR_FALSE);
nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection));
result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection));
if (NS_FAILED(result))
return result;
@ -1822,7 +1823,10 @@ PresShell::Destroy()
// Let the style set do its cleanup.
mStyleSet->Shutdown(mPresContext);
NS_RELEASE(mStyleSet);
delete mStyleSet;
mStyleSet = nsnull;
NS_RELEASE(mFrameConstructor);
// We hold a reference to the pres context, and it holds a weak link back
// to us. To avoid the pres context having a dangling reference, set its
@ -1941,27 +1945,16 @@ PresShell::GetViewManager(nsIViewManager** aResult)
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetStyleSet(nsIStyleSet** aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = mStyleSet;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
{ // first non-html sheet in style set that has title
if (mStyleSet) {
PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets();
PRInt32 count = mStyleSet->SheetCount(nsStyleSet::eDocSheet);
PRInt32 index;
NS_NAMED_LITERAL_STRING(textHtml, "text/html");
for (index = 0; index < count; index++) {
nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index);
nsIStyleSheet* sheet = mStyleSet->StyleSheetAt(nsStyleSet::eDocSheet,
index);
if (nsnull != sheet) {
nsAutoString type;
sheet->GetType(type);
@ -1973,7 +1966,6 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
index = count; // stop looking
}
}
NS_RELEASE(sheet);
}
}
}
@ -1984,6 +1976,7 @@ NS_IMETHODIMP
PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
{
if (mDocument && mStyleSet) {
mStyleSet->BeginUpdate();
PRInt32 count = mDocument->GetNumberOfStyleSheets(PR_FALSE);
PRInt32 index;
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
@ -2002,13 +1995,14 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
mStyleSet->AddDocStyleSheet(sheet, mDocument);
}
else {
mStyleSet->RemoveDocStyleSheet(sheet);
mStyleSet->RemoveStyleSheet(nsStyleSet::eDocSheet, sheet);
}
}
}
}
}
mStyleSet->EndUpdate();
return ReconstructStyleData();
}
return NS_OK;
@ -2158,13 +2152,6 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
if (NS_SUCCEEDED(result)) {
result = SetPrefNoScriptRule();
}
// update the styleset now that we are done inserting our rules
if (NS_SUCCEEDED(result)) {
if (mStyleSet) {
mStyleSet->NotifyStyleSheetStateChanged(PR_TRUE);
}
}
}
#ifdef DEBUG_attinasi
printf( "Preference Style Rules set: error=%ld\n", (long)result);
@ -2189,10 +2176,10 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
// remove the sheet from the styleset:
// - note that we have to check for success by comparing the count before and after...
#ifdef NS_DEBUG
PRInt32 numBefore = mStyleSet->GetNumberOfUserStyleSheets();
PRInt32 numBefore = mStyleSet->SheetCount(nsStyleSet::eUserSheet);
NS_ASSERTION(numBefore > 0, "no user stylesheets in styleset, but we have one!");
#endif
mStyleSet->RemoveUserStyleSheet(mPrefStyleSheet);
mStyleSet->RemoveStyleSheet(nsStyleSet::eUserSheet, mPrefStyleSheet);
#ifdef DEBUG_attinasi
NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfUserStyleSheets(),
@ -2226,7 +2213,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
0, &index);
NS_ENSURE_SUCCESS(result, result);
}
mStyleSet->AppendUserStyleSheet(mPrefStyleSheet);
mStyleSet->AppendStyleSheet(nsStyleSet::eUserSheet, mPrefStyleSheet);
}
}
} else {
@ -2737,23 +2724,23 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
(void*)this));
MOZ_TIMER_RESET(mFrameCreationWatch);
MOZ_TIMER_START(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchEnable,mStyleSet);
if (!rootFrame) {
// Have style sheet processor construct a frame for the
// precursors to the root content object's frame
mStyleSet->ConstructRootFrame(mPresContext, root, rootFrame);
mFrameConstructor->ConstructRootFrame(this, mPresContext,
root, rootFrame);
mFrameManager->SetRootFrame(rootFrame);
}
// Have the style sheet processor construct frame for the root
// content object down
mStyleSet->ContentInserted(mPresContext, nsnull, root, 0);
mFrameConstructor->ContentInserted(mPresContext, nsnull, nsnull, root, 0,
nsnull, PR_FALSE);
VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n",
(void*)this));
MOZ_TIMER_STOP(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchDisable,mStyleSet);
}
if (rootFrame) {
@ -3565,10 +3552,8 @@ PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
--mUpdateCount;
#endif
if (mStylesHaveChanged && (aUpdateType & UPDATE_STYLE)) {
mStylesHaveChanged = PR_FALSE;
if (mStylesHaveChanged && (aUpdateType & UPDATE_STYLE))
return ReconstructStyleData();
}
return NS_OK;
}
@ -3579,7 +3564,6 @@ PresShell::BeginLoad(nsIDocument *aDocument)
#ifdef MOZ_PERF_METRICS
// Reset style resolution stopwatch maintained by style set
MOZ_TIMER_DEBUGLOG(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", (void*)this));
CtlStyleWatch(kStyleWatchReset,mStyleSet);
#endif
mDocumentLoading = PR_TRUE;
return NS_OK;
@ -3626,9 +3610,6 @@ PresShell::EndLoad(nsIDocument *aDocument)
// Print style resolution stopwatch maintained by style set
MOZ_TIMER_DEBUGLOG(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
CtlStyleWatch(kStyleWatchStop|kStyleWatchDisable, mStyleSet);
MOZ_TIMER_LOG(("Style resolution time (this=%p): ", this));
CtlStyleWatch(kStyleWatchPrint, mStyleSet);
#endif
mDocumentLoading = PR_FALSE;
return NS_OK;
@ -3833,20 +3814,12 @@ PresShell::RecreateFramesFor(nsIContent* aContent)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = GetStyleSet(getter_AddRefs(styleSet));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStyleFrameConstruction> frameConstruction;
rv = styleSet->GetStyleFrameConstruction(getter_AddRefs(frameConstruction));
NS_ENSURE_SUCCESS(rv, rv);
// Don't call RecreateFramesForContent since that is not exported and we want
// to keep the number of entrypoints down.
nsStyleChangeList changeList;
changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame);
return frameConstruction->ProcessRestyledFrames(changeList, mPresContext);
return mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
}
NS_IMETHODIMP
@ -5201,7 +5174,8 @@ PresShell::ContentChanged(nsIDocument *aDocument,
nsISupports* aSubContent)
{
WillCauseReflow();
nsresult rv = mStyleSet->ContentChanged(mPresContext, aContent, aSubContent);
nsresult rv = mFrameConstructor->ContentChanged(mPresContext,
aContent, aSubContent);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5215,8 +5189,9 @@ PresShell::ContentStatesChanged(nsIDocument* aDocument,
PRInt32 aStateMask)
{
WillCauseReflow();
nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1,
aContent2, aStateMask);
nsresult rv = mFrameConstructor->ContentStatesChanged(mPresContext,
aContent1,
aContent2, aStateMask);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5237,7 +5212,9 @@ PresShell::AttributeChanged(nsIDocument *aDocument,
// squelch any other inappropriate notifications as well.
if (mDidInitialReflow) {
WillCauseReflow();
rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType);
rv = mFrameConstructor->AttributeChanged(mPresContext, aContent,
aNameSpaceID, aAttribute,
aModType);
VERIFY_STYLE_TREE;
DidCauseReflow();
}
@ -5256,14 +5233,13 @@ PresShell::ContentAppended(nsIDocument *aDocument,
WillCauseReflow();
MOZ_TIMER_DEBUGLOG(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_START(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchEnable,mStyleSet);
nsresult rv = mStyleSet->ContentAppended(mPresContext, aContainer, aNewIndexInContainer);
nsresult rv = mFrameConstructor->ContentAppended(mPresContext, aContainer,
aNewIndexInContainer);
VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchDisable,mStyleSet);
DidCauseReflow();
return rv;
}
@ -5279,7 +5255,10 @@ PresShell::ContentInserted(nsIDocument* aDocument,
}
WillCauseReflow();
nsresult rv = mStyleSet->ContentInserted(mPresContext, aContainer, aChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentInserted(mPresContext, aContainer,
nsnull, aChild,
aIndexInContainer, nsnull,
PR_FALSE);
VERIFY_STYLE_TREE;
DidCauseReflow();
return rv;
@ -5300,8 +5279,9 @@ PresShell::ContentReplaced(nsIDocument* aDocument,
esm->ContentRemoved(aOldChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentReplaced(mPresContext, aContainer, aOldChild,
aNewChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentReplaced(mPresContext, aContainer,
aOldChild, aNewChild,
aIndexInContainer);
VERIFY_STYLE_TREE;
DidCauseReflow();
return rv;
@ -5321,8 +5301,9 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
esm->ContentRemoved(aChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentRemoved(mPresContext, aContainer,
aChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentRemoved(mPresContext, aContainer,
aChild, aIndexInContainer,
PR_FALSE);
// If we have no root content node at this point, be sure to reset
// mDidInitialReflow to PR_FALSE, this will allow InitialReflow()
@ -5343,7 +5324,7 @@ PresShell::ReconstructFrames(void)
nsresult rv = NS_OK;
WillCauseReflow();
rv = mStyleSet->ReconstructDocElementHierarchy(mPresContext);
rv = mFrameConstructor->ReconstructDocElementHierarchy(mPresContext);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5353,21 +5334,13 @@ PresShell::ReconstructFrames(void)
NS_IMETHODIMP
PresShell::ReconstructStyleData()
{
mStylesHaveChanged = PR_FALSE;
nsIFrame* rootFrame;
GetRootFrame(&rootFrame);
if (!rootFrame)
return NS_OK;
nsCOMPtr<nsIStyleSet> set;
GetStyleSet(getter_AddRefs(set));
if (!set)
return NS_OK;
nsCOMPtr<nsIStyleFrameConstruction> cssFrameConstructor;
set->GetStyleFrameConstruction(getter_AddRefs(cssFrameConstructor));
if (!cssFrameConstructor)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
GetFrameManager(getter_AddRefs(frameManager));
@ -5378,9 +5351,9 @@ PresShell::ReconstructStyleData()
frameChange);
if (frameChange & nsChangeHint_ReconstructDoc)
set->ReconstructDocElementHierarchy(mPresContext);
mFrameConstructor->ReconstructDocElementHierarchy(mPresContext);
else
cssFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
VERIFY_STYLE_TREE;
@ -5423,13 +5396,6 @@ PresShell::StyleSheetApplicableStateChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aApplicable)
{
// first notify the style set that a sheet's state has changed
if (mStyleSet) {
nsresult rv = mStyleSet->NotifyStyleSheetStateChanged(aApplicable);
if (NS_FAILED(rv))
return rv;
}
if (aStyleSheet->HasRules()) {
mStylesHaveChanged = PR_TRUE;
}
@ -6230,6 +6196,39 @@ PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight)
return ResizeReflow(aWidth, aHeight);
}
nsresult
PresShell::GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets)
{
aSheets.Clear();
PRInt32 sheetCount = mStyleSet->SheetCount(nsStyleSet::eAgentSheet);
for (PRInt32 i = 0; i < sheetCount; ++i) {
nsIStyleSheet *sheet = mStyleSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
if (!aSheets.AppendObject(sheet))
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
nsresult
PresShell::SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets)
{
return mStyleSet->ReplaceSheets(nsStyleSet::eAgentSheet, aSheets);
}
nsresult
PresShell::AddOverrideStyleSheet(nsIStyleSheet *aSheet)
{
return mStyleSet->AppendStyleSheet(nsStyleSet::eOverrideSheet, aSheet);
}
nsresult
PresShell::RemoveOverrideStyleSheet(nsIStyleSheet *aSheet)
{
return mStyleSet->RemoveStyleSheet(nsStyleSet::eOverrideSheet, aSheet);
}
//--------------------------------------------------------
// Start of protected and private methods on the PresShell
//--------------------------------------------------------
@ -6505,60 +6504,6 @@ PresShell::ClearReflowEventStatus()
return NS_OK;
}
nsresult
PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
{
nsresult rv;
nsCOMPtr<nsIStyleSet> clone(do_CreateInstance(kStyleSetCID,&rv));
if (NS_FAILED(rv)) {
return rv;
}
PRInt32 i, n;
n = aSet->GetNumberOfOverrideStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetOverrideStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendOverrideStyleSheet(ss);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfDocStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetDocStyleSheetAt(i);
if (nsnull != ss) {
clone->AddDocStyleSheet(ss, mDocument);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfUserStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetUserStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendUserStyleSheet(ss);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfAgentStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetAgentStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendAgentStyleSheet(ss);
NS_RELEASE(ss);
}
}
*aResult = clone.get();
NS_ADDREF(*aResult);
return NS_OK;
}
nsresult
PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC)
{
@ -7027,6 +6972,45 @@ FindTopFrame(nsIFrame* aRoot)
#ifdef DEBUG
nsresult
PresShell::CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult)
{
nsStyleSet *clone = new nsStyleSet();
if (!clone) {
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 i, n = aSet->SheetCount(nsStyleSet::eOverrideSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eOverrideSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eOverrideSheet, ss);
}
n = aSet->SheetCount(nsStyleSet::eDocSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eDocSheet, i);
if (ss)
clone->AddDocStyleSheet(ss, mDocument);
}
n = aSet->SheetCount(nsStyleSet::eUserSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eUserSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eUserSheet, ss);
}
n = aSet->SheetCount(nsStyleSet::eAgentSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eAgentSheet, ss);
}
*aResult = clone;
return NS_OK;
}
// After an incremental reflow, we verify the correctness by doing a
// full reflow into a fresh frame tree.
PRBool
@ -7121,8 +7105,8 @@ PresShell::VerifyIncrementalReflow()
// Create a new presentation shell to view the document. Use the
// exact same style information that this document has.
nsCOMPtr<nsIStyleSet> newSet;
rv = CloneStyleSet(mStyleSet, getter_AddRefs(newSet));
nsStyleSet *newSet;
rv = CloneStyleSet(mStyleSet, &newSet);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to clone style set");
rv = mDocument->CreateShell(cx, vm, newSet, &sh);
sh->SetVerifyReflowEnable(PR_FALSE); // turn off verify reflow while we're reflowing the test frame tree
@ -7167,6 +7151,26 @@ PresShell::VerifyIncrementalReflow()
return ok;
}
// Layout debugging hooks
void
PresShell::ListStyleContexts(nsIFrame *aRootFrame, FILE *out, PRInt32 aIndent)
{
nsStyleContext *sc = aRootFrame->GetStyleContext();
if (sc)
sc->List(out, aIndent);
}
void
PresShell::ListStyleSheets(FILE *out, PRInt32 aIndent)
{
PRInt32 sheetCount = mStyleSet->SheetCount(nsStyleSet::eDocSheet);
for (PRInt32 i = 0; i < sheetCount; ++i) {
mStyleSet->StyleSheetAt(nsStyleSet::eDocSheet, i)->List(out, aIndent);
fputs("\n", out);
}
}
#endif
// PresShellViewEventListener
@ -7287,39 +7291,6 @@ PresShellViewEventListener::DidRefreshRect(nsIViewManager *aViewManager,
return RestoreCaretVisibility();
}
#ifdef MOZ_PERF_METRICS
// Enable, Disable and Print, Start, Stop and/or Reset the StyleSet watch
/*static*/
void CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet)
{
NS_ASSERTION(aStyleSet!=nsnull,"aStyleSet cannot be null in CtlStyleWatch");
nsresult rv = NS_OK;
if (aStyleSet != nsnull){
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(aStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
if (aCtlValue & kStyleWatchEnable){
watch->EnableTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchDisable){
watch->DisableTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchPrint){
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchStart){
watch->StartTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchStop){
watch->StopTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchReset){
watch->ResetTimer(NS_TIMER_STYLE_RESOLUTION);
}
}
}
}
#endif
//=============================================================
//=============================================================

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

@ -66,7 +66,6 @@ nsIScrollableFrame.h \
nsIScrollableViewProvider.h \
nsIStatefulFrame.h \
nsIStyleFrameConstruction.h \
nsIStyleSet.h \
nsLayoutErrors.h \
nsLayoutUtils.h \
nsReflowType.h \

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

@ -47,7 +47,7 @@ class nsIAtom;
class nsIContent;
class nsIPresContext;
class nsIPresShell;
class nsIStyleSet;
class nsStyleSet;
class nsStyleContext;
class nsILayoutHistoryState;
class nsStyleChangeList;
@ -73,7 +73,7 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMEMANAGER_IID)
// Initialization
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet) = 0;
NS_IMETHOD Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet) = 0;
/**
* After Destroy is called, all methods should return

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

@ -142,7 +142,6 @@ public:
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
nsIStyleSet* GetStyleSet() { return GetPresShell()->GetStyleSet(); }
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }

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

@ -42,6 +42,8 @@
#include "nsEvent.h"
#include "nsReflowType.h"
#include "nsCompatibility.h"
#include "nsCOMArray.h"
#include <stdio.h> // for FILE definition
class nsIAtom;
class nsIContent;
@ -50,7 +52,7 @@ class nsIDocument;
class nsIDocumentObserver;
class nsIFrame;
class nsIPresContext;
class nsIStyleSet;
class nsStyleSet;
class nsIViewManager;
class nsIDeviceContext;
class nsIRenderingContext;
@ -67,6 +69,8 @@ class nsIReflowCallback;
class nsISupportsArray;
class nsIDOMNode;
class nsHTMLReflowCommand;
class nsIStyleFrameConstruction;
class nsIStyleSheet;
#define NS_IPRESSHELL_IID \
{ 0x76e79c60, 0x944e, 0x11d1, \
@ -119,7 +123,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode) = 0;
/**
@ -151,8 +155,14 @@ public:
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult) = 0;
nsIStyleSet* GetStyleSet() { return mStyleSet; }
#ifdef _IMPL_NS_LAYOUT
nsStyleSet* StyleSet() { return mStyleSet; }
#endif
nsIStyleFrameConstruction* FrameConstructor()
{
return mFrameConstructor;
}
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
nsIFrameManager* GetFrameManager() { return mFrameManager; }
@ -551,6 +561,26 @@ public:
*/
virtual PRBool IsThemeSupportEnabled() = 0;
/**
* Get the set of agent style sheets for this presentation
*/
virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets) = 0;
/**
* Replace the set of agent style sheets
*/
virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets) = 0;
/**
* Add an override style sheet for this presentation
*/
virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
/**
* Remove an override style sheet
*/
virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
/**
* See if reflow verification is enabled. To enable reflow verification add
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
@ -569,7 +599,6 @@ public:
*/
static PRInt32 GetVerifyReflowFlags();
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD DumpReflows() = 0;
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
@ -603,6 +632,14 @@ public:
NS_IMETHOD BidiStyleChangeReflow(void) = 0;
#endif
#ifdef DEBUG
// Debugging hooks
virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
PRInt32 aIndent = 0) = 0;
virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0) = 0;
#endif
protected:
// IMPORTANT: The ownership implicit in the following member variables
// has been explicitly checked. If you add any members to this class,
@ -612,7 +649,8 @@ protected:
// we must share ownership.
nsIDocument* mDocument; // [STRONG]
nsIPresContext* mPresContext; // [STRONG]
nsIStyleSet* mStyleSet; // [STRONG]
nsStyleSet* mStyleSet; // [STRONG]
nsIStyleFrameConstruction* mFrameConstructor; // [STRONG]
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsIFrameManager* mFrameManager; // [STRONG]
};

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

@ -38,7 +38,6 @@
#define nsIStyleFrameConstruction_h___
#include "nsISupports.h"
#include "nsIStyleSet.h"
#include "nsChangeHint.h"
class nsIPresShell;
@ -52,10 +51,22 @@ class nsStyleChangeList;
class nsIFrameManager;
class nsILayoutHistoryState;
// IID for the nsIStyleSet interface {a6cf9066-15b3-11d2-932e-00805f8add32}
// IID for the nsIStyleFrameConstruction interface {a6cf9066-15b3-11d2-932e-00805f8add32}
#define NS_ISTYLE_FRAME_CONSTRUCTION_IID \
{0xa6cf9066, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/** a simple struct (that may someday be expanded)
* that contains data supplied by the caller to help
* the style set find a frame for a content node
*/
struct nsFindFrameHint
{
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
nsFindFrameHint() {
mPrimaryFrameForPrevSibling = nsnull;
};
};
/** Interface for objects that handle frame construction based on style.
* All frame construction goes through an object that implements this interface.
* Frames are built based on the state of the content model and the style model.
@ -275,8 +286,7 @@ public:
*
* @return NS_OK
*/
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame) = 0;

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

@ -1,378 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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):
* Daniel Glazman <glazman@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsStyleSet_h___
#define nsStyleSet_h___
#include <stdio.h>
#include "nsISupports.h"
#include "nsChangeHint.h"
#include "nsCOMPtr.h"
class nsIAtom;
class nsIStyleRule;
class nsIStyleSheet;
class nsStyleContext;
class nsIStyleRuleSupplier;
class nsIStyleFrameConstruction;
class nsIPresContext;
class nsIPresShell;
class nsIContent;
class nsIFrame;
class nsIDocument;
class nsIFrameManager;
class nsISupportsArray;
class nsRuleNode;
struct nsFindFrameHint;
struct nsCachedStyleData;
#include "nsVoidArray.h"
class nsICSSPseudoComparator;
// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a}
#define NS_ISTYLE_SET_IID \
{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
class nsIStyleSet : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_SET_IID)
// Style sheets are ordered, most significant first
// NOTE: this is the reverse of the way documents store the sheets
virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet,
nsIStyleSheet* aAfterSheet) = 0;
virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet,
nsIStyleSheet* aBeforeSheet) = 0;
virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0;
virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0;
// the ordering of document style sheets is given by the document
virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0;
virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual PRInt32 GetNumberOfDocStyleSheets() = 0;
virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0;
virtual void AppendUserStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual void InsertUserStyleSheetAfter(nsIStyleSheet* aSheet,
nsIStyleSheet* aAfterSheet) = 0;
virtual void InsertUserStyleSheetBefore(nsIStyleSheet* aSheet,
nsIStyleSheet* aBeforeSheet) = 0;
virtual void RemoveUserStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual PRInt32 GetNumberOfUserStyleSheets() = 0;
virtual nsIStyleSheet* GetUserStyleSheetAt(PRInt32 aIndex) = 0;
virtual void ReplaceUserStyleSheets(nsISupportsArray* aNewSheets) = 0;
virtual void AppendAgentStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual void InsertAgentStyleSheetAfter(nsIStyleSheet* aSheet,
nsIStyleSheet* aAfterSheet) = 0;
virtual void InsertAgentStyleSheetBefore(nsIStyleSheet* aSheet,
nsIStyleSheet* aBeforeSheet) = 0;
virtual void RemoveAgentStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual PRInt32 GetNumberOfAgentStyleSheets() = 0;
virtual nsIStyleSheet* GetAgentStyleSheetAt(PRInt32 aIndex) = 0;
virtual void ReplaceAgentStyleSheets(nsISupportsArray* aNewSheets) = 0;
virtual nsresult GetRuleTree(nsRuleNode** aResult) = 0;
// For getting the cached default data in case we hit out-of-memory.
// To be used only by nsRuleNode.
virtual nsCachedStyleData* GetDefaultStyleData() = 0;
virtual nsresult GetStyleFrameConstruction(nsIStyleFrameConstruction** aResult) = 0;
// Clear all style data cached in the style context tree and rule tree.
virtual nsresult ClearStyleData(nsIPresContext* aPresContext) = 0;
// enable / disable the Quirk style sheet:
// returns NS_FAILURE if none is found, otherwise NS_OK
NS_IMETHOD EnableQuirkStyleSheet(PRBool aEnable) = 0;
NS_IMETHOD NotifyStyleSheetStateChanged(PRBool aApplicable) = 0;
// get a style context for a non-pseudo frame.
virtual already_AddRefed<nsStyleContext>
ResolveStyleFor(nsIPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aParentContext) = 0;
// Get a style context for a non-element (which no rules will match).
// Eventually, this should go away and we shouldn't even create style
// contexts for such content nodes. However, not doing any rule
// matching for them is a first step.
//
// XXX This is temporary. It should go away when we stop creating
// style contexts for text nodes and placeholder frames. (We also use
// it once to create a style context for the nsFirstLetterFrame that
// represents everything except the first letter.)
//
virtual already_AddRefed<nsStyleContext>
ResolveStyleForNonElement(nsIPresContext* aPresContext,
nsStyleContext* aParentContext) = 0;
// get a style context for a pseudo-element (i.e.,
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|;
virtual already_AddRefed<nsStyleContext>
ResolvePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator = nsnull) = 0;
// This funtions just like ResolvePseudoStyleFor except that it will
// return nsnull if there are no explicit style rules for that
// pseudo element.
virtual already_AddRefed<nsStyleContext>
ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext) = 0;
NS_IMETHOD BeginShutdown(nsIPresContext* aPresContext) = 0;
NS_IMETHOD Shutdown(nsIPresContext* aPresContext) = 0;
NS_IMETHOD NotifyStyleContextDestroyed(nsIPresContext* aPresContext,
nsStyleContext* aStyleContext) = 0;
// Get a new style context that lives in a different parent
// The new context will be the same as the old if the new parent == the old parent
virtual already_AddRefed<nsStyleContext>
ReParentStyleContext(nsIPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsStyleContext* aNewParentContext) = 0;
// Test if style is dependent on content state
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
PRInt32 aStateMask,
PRBool* aResult) = 0;
// Test if style is dependent on the presence of an attribute.
NS_IMETHOD HasAttributeDependentStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIAtom* aAttribute,
PRInt32 aModType,
PRBool* aResult) = 0;
// Create frames for the root content element and its child content
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame*& aFrameSubTree) = 0;
// Causes reconstruction of a frame hierarchy rooted by the
// frame document element frame. This is often called when radical style
// change precludes incremental reflow.
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
// Notifications of changes to the content mpodel
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer) = 0;
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) = 0;
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer) = 0;
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) = 0;
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aContent,
nsISupports* aSubContent) = 0;
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1,
nsIContent* aContent2,
PRInt32 aStateMask) = 0;
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType) = 0;
// Notification that we were unable to render a replaced element.
// Called when the replaced element can not be rendered, and we should
// instead render the element's contents.
// The content object associated with aFrame should either be a IMG
// element or an OBJECT element.
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
nsIFrame* aFrame) = 0;
// Request to create a continuing frame
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame) = 0;
/** Request to find the primary frame associated with a given content object.
* This is typically called by the pres shell when there is no mapping in
* the pres shell hash table.
* @param aPresContext the pres context
* @param aFrameManager the frame manager
* @param aContent the content we need to find a frame for
* @param aFrame [OUT] the resulting frame
* @param aHint optional performance hint, may be null
*
* @return NS_OK. aFrame will be null if no frame could be found
*/
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame** aFrame,
nsFindFrameHint* aHint=0) = 0;
/**
* Return the point in the frame hierarchy where the frame that
* will be constructed for |aChildContent| ought be inserted.
*
* @param aPresShell the presentation shell
* @param aParentFrame the frame that will parent the frame that is
* created for aChildContent
* @param aChildContent the child content for which a frame is to be
* created
* @param aInsertionPoint [OUT] the frame that should parent the frame
* for |aChildContent|.
*/
NS_IMETHOD GetInsertionPoint(nsIPresShell* aPresShell,
nsIFrame* aParentFrame,
nsIContent* aChildContent,
nsIFrame** aInsertionPoint) = 0;
// APIs for registering objects that can supply additional
// rules during processing.
NS_IMETHOD SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)=0;
NS_IMETHOD GetStyleRuleSupplier(nsIStyleRuleSupplier** aSupplier)=0;
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0;
virtual void ListContexts(nsIFrame* aRootFrame, FILE* out = stdout, PRInt32 aIndent = 0) = 0;
#endif
virtual void ResetUniqueStyleItems(void) = 0;
};
nsresult
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult);
class nsUniqueStyleItems : private nsVoidArray
{
public :
// return a singleton instance of the nsUniqueStyleItems object
static nsUniqueStyleItems *GetUniqueStyleItems( void ){
if(mInstance == nsnull){
#ifdef DEBUG
nsUniqueStyleItems *pInstance =
#endif
new nsUniqueStyleItems;
NS_ASSERTION(pInstance == mInstance, "Singleton?");
// the ctor sets the mInstance static member variable...
// if it is null, then we just end up returning null...
}
return mInstance;
}
void *GetItem(void *aPtr){
PRInt32 index = nsVoidArray::IndexOf(aPtr);
if( index != -1){
return nsVoidArray::ElementAt(index);
} else {
return nsnull;
}
}
PRBool AddItem(void *aPtr){
if(nsVoidArray::IndexOf(aPtr) == -1){
return nsVoidArray::AppendElement(aPtr);
} else {
return PR_FALSE;
}
}
PRBool RemoveItem(void *aPtr){
return nsVoidArray::RemoveElement(aPtr);
}
PRInt32 Count(void){
return nsVoidArray::Count();
}
void Clear(void){
nsVoidArray::Clear();
}
protected:
// disallow these:
nsUniqueStyleItems( const nsUniqueStyleItems& src);
nsUniqueStyleItems& operator =(const nsUniqueStyleItems& src);
// make this accessable to factory only
nsUniqueStyleItems(void) : nsVoidArray(){
NS_ASSERTION(mInstance == nsnull, "singleton?");
mInstance=this;
}
static nsUniqueStyleItems *mInstance;
};
#define UNIQUE_STYLE_ITEMS(__ptr) \
nsUniqueStyleItems* __ptr = nsUniqueStyleItems::GetUniqueStyleItems(); \
NS_ASSERTION(__ptr != nsnull, "UniqueItems cannot be null: error in nsUniqueStyleItems factory");
/** a simple struct (that may someday be expanded)
* that contains data supplied by the caller to help
* the style set find a frame for a content node
*/
struct nsFindFrameHint
{
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
nsFindFrameHint() {
mPrimaryFrameForPrevSibling = nsnull;
};
};
#endif /* nsIStyleSet_h___ */

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

@ -142,7 +142,6 @@ public:
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
nsIStyleSet* GetStyleSet() { return GetPresShell()->GetStyleSet(); }
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }

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

@ -40,7 +40,7 @@
#include "nsIPref.h"
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsImageLoader.h"
#include "nsIContent.h"
@ -587,9 +587,7 @@ nsPresContext::ClearStyleDataAndReflow()
{
if (mShell) {
// Clear out all our style data.
nsCOMPtr<nsIStyleSet> set;
mShell->GetStyleSet(getter_AddRefs(set));
set->ClearStyleData(this);
mShell->StyleSet()->ClearStyleData(this);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
@ -767,11 +765,8 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
return;
// enable/disable the QuirkSheet
nsCOMPtr<nsIStyleSet> set;
mShell->GetStyleSet(getter_AddRefs(set));
if (set) {
set->EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
}
mShell->StyleSet()->
EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
}
// Helper function for setting Anim Mode on image
@ -895,27 +890,13 @@ already_AddRefed<nsStyleContext>
nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return the addref'd style context
return set->ResolveStyleFor(this, aContent, aParentContext);
}
return nsnull;
return mShell->StyleSet()->ResolveStyleFor(this, aContent, aParentContext);
}
already_AddRefed<nsStyleContext>
nsPresContext::ResolveStyleContextForNonElement(nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ResolveStyleForNonElement(this, aParentContext);
}
return nsnull;
return mShell->StyleSet()->ResolveStyleForNonElement(this, aParentContext);
}
already_AddRefed<nsStyleContext>
@ -933,15 +914,9 @@ nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aComparator);
}
return nsnull;
return mShell->StyleSet()->ResolvePseudoStyleFor(this, aParentContent,
aPseudoTag, aParentContext,
aComparator);
}
already_AddRefed<nsStyleContext>
@ -949,15 +924,8 @@ nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext)
{
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv) && set) {
// return addrefed style context
return set->ProbePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext);
}
return nsnull;
return mShell->StyleSet()->ProbePseudoStyleFor(this, aParentContent,
aPseudoTag, aParentContext);
}
NS_IMETHODIMP

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

@ -53,3 +53,4 @@ LIBS += \
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -42,10 +42,6 @@
#include "nsIFactory.h"
#include "nsIComponentManager.h"
// {1691E1F5-EE41-11d4-9885-00C04FA0CF4B}
#define NS_CSSFRAMECONSTRUCTOR_CID \
{ 0x1691e1f5, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {1691E1F4-EE41-11d4-9885-00C04FA0CF4B}
#define NS_FRAMETRAVERSAL_CID \
{ 0x1691e1f4, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }

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

@ -131,6 +131,7 @@
#include "nsXULAtoms.h"
#include "nsLayoutCID.h"
#include "nsImageLoadingContent.h"
#include "nsStyleSet.h"
// view stuff
#include "nsViewsCID.h"
@ -357,6 +358,7 @@ Shutdown(nsIModule* aSelf)
nsContentUtils::Shutdown();
NS_NameSpaceManagerShutdown();
nsImageLoadingContent::Shutdown();
nsStyleSet::FreeGlobals();
}
#ifdef NS_DEBUG
@ -378,7 +380,6 @@ nsresult NS_NewXULElementFactory(nsIElementFactory** aResult);
#endif
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor** aResult);
nsresult NS_NewLayoutHistoryState(nsILayoutHistoryState** aResult);
nsresult NS_NewAutoCopyService(nsIAutoCopyService** aResult);
nsresult NS_NewSelectionImageService(nsISelectionImageService** aResult);
@ -437,7 +438,6 @@ MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFra
MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
#endif
MAKE_CTOR(CreateNewCSSFrameConstructor, nsICSSFrameConstructor, NS_CreateCSSFrameConstructor)
MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
MAKE_CTOR(CreateNewLayoutHistoryState, nsILayoutHistoryState, NS_NewLayoutHistoryState)
MAKE_CTOR(CreateNewPresShell, nsIPresShell, NS_NewPresShell)
@ -466,7 +466,6 @@ MAKE_CTOR(CreateEventStateManager, nsIEventStateManager, NS_NewEve
MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOMEventGroup)
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateHTMLStyleSheet, nsIHTMLStyleSheet, NS_NewHTMLStyleSheet)
MAKE_CTOR(CreateStyleSet, nsIStyleSet, NS_NewStyleSet)
MAKE_CTOR(CreateCSSStyleSheet, nsICSSStyleSheet, NS_NewCSSStyleSheet)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet)
@ -677,11 +676,6 @@ static const nsModuleComponentInfo gComponents[] = {
CreateNewLayoutDebugger },
#endif
{ "CSS Frame Constructor",
NS_CSSFRAMECONSTRUCTOR_CID,
nsnull,
CreateNewCSSFrameConstructor },
{ "Frame Traversal",
NS_FRAMETRAVERSAL_CID,
nsnull,
@ -811,11 +805,6 @@ static const nsModuleComponentInfo gComponents[] = {
nsnull,
CreateHTMLStyleSheet },
{ "Style Set",
NS_STYLESET_CID,
nsnull,
CreateStyleSet },
{ "CSS Style Sheet",
NS_CSS_STYLESHEET_CID,
nsnull,

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

@ -59,11 +59,11 @@
#include "nsIDOMEvent.h"
#include "nsIScrollableView.h"
#include "nsWidgetsCID.h"
#include "nsIStyleSet.h"
#include "nsCOMPtr.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include "nsReflowPath.h"
#include "nsIStyleFrameConstruction.h"
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
@ -321,7 +321,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext* aPresContext,
// into our lines child list.
nsIFrame* nextFrame = aFrame->GetNextSibling();
aPresContext->PresShell()->GetStyleSet()->
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, aFrame, aOuterFrame, &nextInFlow);
if (nsnull == nextInFlow) {

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

@ -71,7 +71,6 @@
#include "nsINameSpaceManager.h"
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIStyleSet.h"
#include "nsLayoutAtoms.h"
#include "nsImageMapUtils.h"
#include "nsIFrameManager.h"

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

@ -41,7 +41,6 @@
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIDeviceContext.h"
#include "nsReadableUtils.h"

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

@ -42,8 +42,8 @@
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIStyleFrameConstruction.h"
#include "nsIDeviceContext.h"
#include "nsReadableUtils.h"
#include "nsIPrintPreviewContext.h"
@ -163,11 +163,12 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* prevLastChild = prevContentPage->mFrames.LastChild();
// Create a continuing child of the previous page's last child
nsCOMPtr<nsIStyleSet> styleSet;
nsIFrame* newFrame;
aPresContext->PresShell()->GetStyleSet(getter_AddRefs(styleSet));
styleSet->CreateContinuingFrame(aPresContext, prevLastChild, contentPage, &newFrame);
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, prevLastChild,
contentPage, &newFrame);
// Make the new area frame the 1st child of the page content frame. There may already be
// children placeholders which don't get reflowed but must not be destroyed until the
// page content frame is destroyed.

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

@ -43,7 +43,6 @@
#include "nsIDeviceContext.h"
#include "nsIViewManager.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsIFontMetrics.h"
#include "nsIPrintSettings.h"
#include "nsPageFrame.h"
@ -52,6 +51,7 @@
#include "nsStyleConsts.h"
#include "nsRegion.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleFrameConstruction.h"
// for header/footer gap & ExtraMargin for Print Preview
#include "nsIPrefBranch.h"
@ -204,7 +204,7 @@ nsSimplePageSequenceFrame::CreateContinuingPageFrame(nsIPresContext* aPresContex
nsIFrame** aContinuingPage)
{
// Create the continuing frame
return aPresContext->PresShell()->GetStyleSet()->
return aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, aPageFrame, this, aContinuingPage);
}

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

@ -33,7 +33,8 @@
#include "nsIFrame.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIStyleFrameConstruction.h"
#include "nsStyleContext.h"
#include "nsStyleChangeList.h"
#include "nsIEventQueueService.h"
@ -273,7 +274,7 @@ public:
NS_DECL_ISUPPORTS
// nsIFrameManager
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet);
NS_IMETHOD Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet);
NS_IMETHOD Destroy();
// Gets and sets the root frame
@ -392,10 +393,9 @@ private:
nsIPresContext* GetPresContext() const {
return mPresShell->GetPresContext();
}
nsIStyleSet* GetStyleSet() const { return mStyleSet; }
nsIPresShell* mPresShell; // weak link, because the pres shell owns us
nsIStyleSet* mStyleSet; // weak link. pres shell holds a reference
nsStyleSet* mStyleSet; // weak link. pres shell holds a reference
nsIFrame* mRootFrame;
PLDHashTable mPrimaryFrameMap;
PLDHashTable mPlaceholderMap;
@ -454,7 +454,7 @@ NS_IMPL_ISUPPORTS1(FrameManager, nsIFrameManager)
NS_IMETHODIMP
FrameManager::Init(nsIPresShell* aPresShell,
nsIStyleSet* aStyleSet)
nsStyleSet* aStyleSet)
{
NS_ASSERTION(aPresShell, "null aPresShell");
NS_ASSERTION(aStyleSet, "null aStyleSet");
@ -596,16 +596,13 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
// very fast in the embedded hash table.
// This would almost completely remove the lookup penalty for things
// like <SCRIPT> and comments in very large documents.
nsCOMPtr<nsIStyleSet> styleSet;
nsCOMPtr<nsIPresContext> presContext;
// Give the frame construction code the opportunity to return the
// frame that maps the content object
mPresShell->GetStyleSet(getter_AddRefs(styleSet));
NS_ASSERTION(styleSet, "bad style set");
mPresShell->GetPresContext(getter_AddRefs(presContext));
NS_ASSERTION(presContext, "bad presContext");
if (!styleSet || !presContext) {
if (!presContext) {
return NS_ERROR_NULL_POINTER;
}
@ -641,8 +638,9 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
// walk the frame tree to find the frame that maps aContent.
// Use the hint if we have it.
styleSet->FindPrimaryFrameFor(presContext, this, aContent, aResult,
hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);
mPresShell->FrameConstructor()->
FindPrimaryFrameFor(presContext, this, aContent, aResult,
hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);
}
}
@ -1140,8 +1138,10 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent)
// are generated
nsCOMPtr<nsIPresContext> presContext;
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
frameManager->mStyleSet->CantRenderReplacedElement(presContext,
aEvent->mFrame);
frameManager->mPresShell->FrameConstructor()->
CantRenderReplacedElement(frameManager->mPresShell, presContext,
aEvent->mFrame);
#ifdef NOISY_EVENTS
printf("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner);
#endif
@ -2016,9 +2016,9 @@ FrameManager::HasAttributeDependentStyle(nsIContent *aContent,
return NS_OK;
}
return mStyleSet->HasAttributeDependentStyle(GetPresContext(), aContent,
aAttribute, aModType,
aResult);
*aResult = mStyleSet->HasAttributeDependentStyle(GetPresContext(), aContent,
aAttribute, aModType);
return NS_OK;
}
// Capture state for a given frame.

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

@ -59,11 +59,11 @@
#include "nsIDOMEvent.h"
#include "nsIScrollableView.h"
#include "nsWidgetsCID.h"
#include "nsIStyleSet.h"
#include "nsCOMPtr.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include "nsReflowPath.h"
#include "nsIStyleFrameConstruction.h"
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
@ -321,7 +321,7 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext* aPresContext,
// into our lines child list.
nsIFrame* nextFrame = aFrame->GetNextSibling();
aPresContext->PresShell()->GetStyleSet()->
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, aFrame, aOuterFrame, &nextInFlow);
if (nsnull == nextInFlow) {

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

@ -71,7 +71,6 @@
#include "nsINameSpaceManager.h"
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIStyleSet.h"
#include "nsLayoutAtoms.h"
#include "nsImageMapUtils.h"
#include "nsIFrameManager.h"

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

@ -41,7 +41,6 @@
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIDeviceContext.h"
#include "nsReadableUtils.h"

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

@ -42,8 +42,8 @@
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIStyleFrameConstruction.h"
#include "nsIDeviceContext.h"
#include "nsReadableUtils.h"
#include "nsIPrintPreviewContext.h"
@ -163,11 +163,12 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* prevLastChild = prevContentPage->mFrames.LastChild();
// Create a continuing child of the previous page's last child
nsCOMPtr<nsIStyleSet> styleSet;
nsIFrame* newFrame;
aPresContext->PresShell()->GetStyleSet(getter_AddRefs(styleSet));
styleSet->CreateContinuingFrame(aPresContext, prevLastChild, contentPage, &newFrame);
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, prevLastChild,
contentPage, &newFrame);
// Make the new area frame the 1st child of the page content frame. There may already be
// children placeholders which don't get reflowed but must not be destroyed until the
// page content frame is destroyed.

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

@ -44,7 +44,7 @@
#include "nsIDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDocumentObserver.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsICSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please?
#include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
@ -112,9 +112,6 @@
#include "nsLayoutErrors.h"
#include "nsLayoutUtils.h"
#include "nsCSSRendering.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
#endif
#ifdef NS_DEBUG
#include "nsIFrameDebug.h"
#endif
@ -163,7 +160,7 @@
// For style data reconstruction
#include "nsStyleChangeList.h"
#include "nsIStyleFrameConstruction.h"
#include "nsCSSFrameConstructor.h"
#include "nsIBindingManager.h"
#ifdef MOZ_XUL
#include "nsIMenuFrame.h"
@ -185,7 +182,6 @@
#include "nsContentCID.h"
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
@ -193,22 +189,6 @@ static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
// * - initially created for bugs 31816, 20760, 22963
static void ColorToString(nscolor aColor, nsAutoString &aString);
#ifdef MOZ_PERF_METRICS
// local management of the style watch:
// aCtlValue should be set to all actions desired (bitwise OR'd together)
// aStyleSet cannot be null
// NOTE: implementation is noop unless MOZ_PERF_METRICS is defined
static void CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet);
#define kStyleWatchEnable 1
#define kStyleWatchDisable 2
#define kStyleWatchPrint 4
#define kStyleWatchStart 8
#define kStyleWatchStop 16
#define kStyleWatchReset 32
#else /* !defined(MOZ_PERF_METRICS */
#define CtlStyleWatch(ctlvalue_,styleset_) /* nothing */
#endif /* !defined(MOZ_PERF_METRICS */
// Class ID's
static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -1023,7 +1003,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode);
NS_IMETHOD Destroy();
@ -1039,7 +1019,6 @@ public:
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult);
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
@ -1151,6 +1130,12 @@ public:
NS_IMETHOD DisableThemeSupport();
virtual PRBool IsThemeSupportEnabled();
virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets);
virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets);
virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet);
virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet);
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent, PRUint32 aFlags, nsEventStatus* aStatus);
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame);
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
@ -1218,6 +1203,13 @@ public:
#endif
#ifdef DEBUG
virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
PRInt32 aIndent = 0);
virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0);
#endif
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
@ -1245,7 +1237,6 @@ protected:
nsresult RemoveDummyLayoutRequest(void);
nsresult ReconstructFrames(void);
nsresult CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult);
nsresult WillCauseReflow();
nsresult DidCauseReflow();
nsresult ProcessReflowCommands(PRBool aInterruptible);
@ -1265,6 +1256,7 @@ protected:
nsCOMPtr<nsIBidiKeyboard> mBidiKeyboard;
#endif // IBMBIDI
#ifdef NS_DEBUG
nsresult CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult);
PRBool VerifyIncrementalReflow();
PRBool mInVerifyReflow;
#endif
@ -1605,7 +1597,7 @@ NS_IMETHODIMP
PresShell::Init(nsIDocument* aDocument,
nsIPresContext* aPresContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsStyleSet* aStyleSet,
nsCompatibility aCompatMode)
{
NS_PRECONDITION(nsnull != aDocument, "null ptr");
@ -1624,6 +1616,12 @@ PresShell::Init(nsIDocument* aDocument,
NS_ADDREF(mDocument);
mViewManager = aViewManager;
// Create our frame constructor.
nsCSSFrameConstructor* fc = new nsCSSFrameConstructor();
NS_ENSURE_TRUE(fc, NS_ERROR_OUT_OF_MEMORY);
fc->Init(mDocument);
CallQueryInterface(fc, &mFrameConstructor);
// The document viewer owns both view manager and pres shell.
mViewManager->SetViewObserver(this);
@ -1632,8 +1630,11 @@ PresShell::Init(nsIDocument* aDocument,
NS_ADDREF(mPresContext);
aPresContext->SetShell(this);
// Now we can initialize the style set.
nsresult result = aStyleSet->Init(aPresContext);
NS_ENSURE_SUCCESS(result, result);
mStyleSet = aStyleSet;
NS_IF_ADDREF(mStyleSet);
// Set the compatibility mode after attaching the pres context and
// style set, but before creating any frames.
@ -1643,9 +1644,9 @@ PresShell::Init(nsIDocument* aDocument,
// before creating any frames.
SetPreferenceStyleRules(PR_FALSE);
nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection));
result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection));
if (NS_FAILED(result))
return result;
@ -1822,7 +1823,10 @@ PresShell::Destroy()
// Let the style set do its cleanup.
mStyleSet->Shutdown(mPresContext);
NS_RELEASE(mStyleSet);
delete mStyleSet;
mStyleSet = nsnull;
NS_RELEASE(mFrameConstructor);
// We hold a reference to the pres context, and it holds a weak link back
// to us. To avoid the pres context having a dangling reference, set its
@ -1941,27 +1945,16 @@ PresShell::GetViewManager(nsIViewManager** aResult)
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetStyleSet(nsIStyleSet** aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = mStyleSet;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
{ // first non-html sheet in style set that has title
if (mStyleSet) {
PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets();
PRInt32 count = mStyleSet->SheetCount(nsStyleSet::eDocSheet);
PRInt32 index;
NS_NAMED_LITERAL_STRING(textHtml, "text/html");
for (index = 0; index < count; index++) {
nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index);
nsIStyleSheet* sheet = mStyleSet->StyleSheetAt(nsStyleSet::eDocSheet,
index);
if (nsnull != sheet) {
nsAutoString type;
sheet->GetType(type);
@ -1973,7 +1966,6 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
index = count; // stop looking
}
}
NS_RELEASE(sheet);
}
}
}
@ -1984,6 +1976,7 @@ NS_IMETHODIMP
PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
{
if (mDocument && mStyleSet) {
mStyleSet->BeginUpdate();
PRInt32 count = mDocument->GetNumberOfStyleSheets(PR_FALSE);
PRInt32 index;
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
@ -2002,13 +1995,14 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
mStyleSet->AddDocStyleSheet(sheet, mDocument);
}
else {
mStyleSet->RemoveDocStyleSheet(sheet);
mStyleSet->RemoveStyleSheet(nsStyleSet::eDocSheet, sheet);
}
}
}
}
}
mStyleSet->EndUpdate();
return ReconstructStyleData();
}
return NS_OK;
@ -2158,13 +2152,6 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
if (NS_SUCCEEDED(result)) {
result = SetPrefNoScriptRule();
}
// update the styleset now that we are done inserting our rules
if (NS_SUCCEEDED(result)) {
if (mStyleSet) {
mStyleSet->NotifyStyleSheetStateChanged(PR_TRUE);
}
}
}
#ifdef DEBUG_attinasi
printf( "Preference Style Rules set: error=%ld\n", (long)result);
@ -2189,10 +2176,10 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
// remove the sheet from the styleset:
// - note that we have to check for success by comparing the count before and after...
#ifdef NS_DEBUG
PRInt32 numBefore = mStyleSet->GetNumberOfUserStyleSheets();
PRInt32 numBefore = mStyleSet->SheetCount(nsStyleSet::eUserSheet);
NS_ASSERTION(numBefore > 0, "no user stylesheets in styleset, but we have one!");
#endif
mStyleSet->RemoveUserStyleSheet(mPrefStyleSheet);
mStyleSet->RemoveStyleSheet(nsStyleSet::eUserSheet, mPrefStyleSheet);
#ifdef DEBUG_attinasi
NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfUserStyleSheets(),
@ -2226,7 +2213,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
0, &index);
NS_ENSURE_SUCCESS(result, result);
}
mStyleSet->AppendUserStyleSheet(mPrefStyleSheet);
mStyleSet->AppendStyleSheet(nsStyleSet::eUserSheet, mPrefStyleSheet);
}
}
} else {
@ -2737,23 +2724,23 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
(void*)this));
MOZ_TIMER_RESET(mFrameCreationWatch);
MOZ_TIMER_START(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchEnable,mStyleSet);
if (!rootFrame) {
// Have style sheet processor construct a frame for the
// precursors to the root content object's frame
mStyleSet->ConstructRootFrame(mPresContext, root, rootFrame);
mFrameConstructor->ConstructRootFrame(this, mPresContext,
root, rootFrame);
mFrameManager->SetRootFrame(rootFrame);
}
// Have the style sheet processor construct frame for the root
// content object down
mStyleSet->ContentInserted(mPresContext, nsnull, root, 0);
mFrameConstructor->ContentInserted(mPresContext, nsnull, nsnull, root, 0,
nsnull, PR_FALSE);
VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n",
(void*)this));
MOZ_TIMER_STOP(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchDisable,mStyleSet);
}
if (rootFrame) {
@ -3565,10 +3552,8 @@ PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
--mUpdateCount;
#endif
if (mStylesHaveChanged && (aUpdateType & UPDATE_STYLE)) {
mStylesHaveChanged = PR_FALSE;
if (mStylesHaveChanged && (aUpdateType & UPDATE_STYLE))
return ReconstructStyleData();
}
return NS_OK;
}
@ -3579,7 +3564,6 @@ PresShell::BeginLoad(nsIDocument *aDocument)
#ifdef MOZ_PERF_METRICS
// Reset style resolution stopwatch maintained by style set
MOZ_TIMER_DEBUGLOG(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", (void*)this));
CtlStyleWatch(kStyleWatchReset,mStyleSet);
#endif
mDocumentLoading = PR_TRUE;
return NS_OK;
@ -3626,9 +3610,6 @@ PresShell::EndLoad(nsIDocument *aDocument)
// Print style resolution stopwatch maintained by style set
MOZ_TIMER_DEBUGLOG(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
CtlStyleWatch(kStyleWatchStop|kStyleWatchDisable, mStyleSet);
MOZ_TIMER_LOG(("Style resolution time (this=%p): ", this));
CtlStyleWatch(kStyleWatchPrint, mStyleSet);
#endif
mDocumentLoading = PR_FALSE;
return NS_OK;
@ -3833,20 +3814,12 @@ PresShell::RecreateFramesFor(nsIContent* aContent)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
nsCOMPtr<nsIStyleSet> styleSet;
nsresult rv = GetStyleSet(getter_AddRefs(styleSet));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStyleFrameConstruction> frameConstruction;
rv = styleSet->GetStyleFrameConstruction(getter_AddRefs(frameConstruction));
NS_ENSURE_SUCCESS(rv, rv);
// Don't call RecreateFramesForContent since that is not exported and we want
// to keep the number of entrypoints down.
nsStyleChangeList changeList;
changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame);
return frameConstruction->ProcessRestyledFrames(changeList, mPresContext);
return mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
}
NS_IMETHODIMP
@ -5201,7 +5174,8 @@ PresShell::ContentChanged(nsIDocument *aDocument,
nsISupports* aSubContent)
{
WillCauseReflow();
nsresult rv = mStyleSet->ContentChanged(mPresContext, aContent, aSubContent);
nsresult rv = mFrameConstructor->ContentChanged(mPresContext,
aContent, aSubContent);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5215,8 +5189,9 @@ PresShell::ContentStatesChanged(nsIDocument* aDocument,
PRInt32 aStateMask)
{
WillCauseReflow();
nsresult rv = mStyleSet->ContentStatesChanged(mPresContext, aContent1,
aContent2, aStateMask);
nsresult rv = mFrameConstructor->ContentStatesChanged(mPresContext,
aContent1,
aContent2, aStateMask);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5237,7 +5212,9 @@ PresShell::AttributeChanged(nsIDocument *aDocument,
// squelch any other inappropriate notifications as well.
if (mDidInitialReflow) {
WillCauseReflow();
rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType);
rv = mFrameConstructor->AttributeChanged(mPresContext, aContent,
aNameSpaceID, aAttribute,
aModType);
VERIFY_STYLE_TREE;
DidCauseReflow();
}
@ -5256,14 +5233,13 @@ PresShell::ContentAppended(nsIDocument *aDocument,
WillCauseReflow();
MOZ_TIMER_DEBUGLOG(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_START(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchEnable,mStyleSet);
nsresult rv = mStyleSet->ContentAppended(mPresContext, aContainer, aNewIndexInContainer);
nsresult rv = mFrameConstructor->ContentAppended(mPresContext, aContainer,
aNewIndexInContainer);
VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
CtlStyleWatch(kStyleWatchDisable,mStyleSet);
DidCauseReflow();
return rv;
}
@ -5279,7 +5255,10 @@ PresShell::ContentInserted(nsIDocument* aDocument,
}
WillCauseReflow();
nsresult rv = mStyleSet->ContentInserted(mPresContext, aContainer, aChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentInserted(mPresContext, aContainer,
nsnull, aChild,
aIndexInContainer, nsnull,
PR_FALSE);
VERIFY_STYLE_TREE;
DidCauseReflow();
return rv;
@ -5300,8 +5279,9 @@ PresShell::ContentReplaced(nsIDocument* aDocument,
esm->ContentRemoved(aOldChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentReplaced(mPresContext, aContainer, aOldChild,
aNewChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentReplaced(mPresContext, aContainer,
aOldChild, aNewChild,
aIndexInContainer);
VERIFY_STYLE_TREE;
DidCauseReflow();
return rv;
@ -5321,8 +5301,9 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
esm->ContentRemoved(aChild);
WillCauseReflow();
nsresult rv = mStyleSet->ContentRemoved(mPresContext, aContainer,
aChild, aIndexInContainer);
nsresult rv = mFrameConstructor->ContentRemoved(mPresContext, aContainer,
aChild, aIndexInContainer,
PR_FALSE);
// If we have no root content node at this point, be sure to reset
// mDidInitialReflow to PR_FALSE, this will allow InitialReflow()
@ -5343,7 +5324,7 @@ PresShell::ReconstructFrames(void)
nsresult rv = NS_OK;
WillCauseReflow();
rv = mStyleSet->ReconstructDocElementHierarchy(mPresContext);
rv = mFrameConstructor->ReconstructDocElementHierarchy(mPresContext);
VERIFY_STYLE_TREE;
DidCauseReflow();
@ -5353,21 +5334,13 @@ PresShell::ReconstructFrames(void)
NS_IMETHODIMP
PresShell::ReconstructStyleData()
{
mStylesHaveChanged = PR_FALSE;
nsIFrame* rootFrame;
GetRootFrame(&rootFrame);
if (!rootFrame)
return NS_OK;
nsCOMPtr<nsIStyleSet> set;
GetStyleSet(getter_AddRefs(set));
if (!set)
return NS_OK;
nsCOMPtr<nsIStyleFrameConstruction> cssFrameConstructor;
set->GetStyleFrameConstruction(getter_AddRefs(cssFrameConstructor));
if (!cssFrameConstructor)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
GetFrameManager(getter_AddRefs(frameManager));
@ -5378,9 +5351,9 @@ PresShell::ReconstructStyleData()
frameChange);
if (frameChange & nsChangeHint_ReconstructDoc)
set->ReconstructDocElementHierarchy(mPresContext);
mFrameConstructor->ReconstructDocElementHierarchy(mPresContext);
else
cssFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
VERIFY_STYLE_TREE;
@ -5423,13 +5396,6 @@ PresShell::StyleSheetApplicableStateChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aApplicable)
{
// first notify the style set that a sheet's state has changed
if (mStyleSet) {
nsresult rv = mStyleSet->NotifyStyleSheetStateChanged(aApplicable);
if (NS_FAILED(rv))
return rv;
}
if (aStyleSheet->HasRules()) {
mStylesHaveChanged = PR_TRUE;
}
@ -6230,6 +6196,39 @@ PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight)
return ResizeReflow(aWidth, aHeight);
}
nsresult
PresShell::GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets)
{
aSheets.Clear();
PRInt32 sheetCount = mStyleSet->SheetCount(nsStyleSet::eAgentSheet);
for (PRInt32 i = 0; i < sheetCount; ++i) {
nsIStyleSheet *sheet = mStyleSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
if (!aSheets.AppendObject(sheet))
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
nsresult
PresShell::SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets)
{
return mStyleSet->ReplaceSheets(nsStyleSet::eAgentSheet, aSheets);
}
nsresult
PresShell::AddOverrideStyleSheet(nsIStyleSheet *aSheet)
{
return mStyleSet->AppendStyleSheet(nsStyleSet::eOverrideSheet, aSheet);
}
nsresult
PresShell::RemoveOverrideStyleSheet(nsIStyleSheet *aSheet)
{
return mStyleSet->RemoveStyleSheet(nsStyleSet::eOverrideSheet, aSheet);
}
//--------------------------------------------------------
// Start of protected and private methods on the PresShell
//--------------------------------------------------------
@ -6505,60 +6504,6 @@ PresShell::ClearReflowEventStatus()
return NS_OK;
}
nsresult
PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
{
nsresult rv;
nsCOMPtr<nsIStyleSet> clone(do_CreateInstance(kStyleSetCID,&rv));
if (NS_FAILED(rv)) {
return rv;
}
PRInt32 i, n;
n = aSet->GetNumberOfOverrideStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetOverrideStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendOverrideStyleSheet(ss);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfDocStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetDocStyleSheetAt(i);
if (nsnull != ss) {
clone->AddDocStyleSheet(ss, mDocument);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfUserStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetUserStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendUserStyleSheet(ss);
NS_RELEASE(ss);
}
}
n = aSet->GetNumberOfAgentStyleSheets();
for (i = 0; i < n; i++) {
nsIStyleSheet* ss;
ss = aSet->GetAgentStyleSheetAt(i);
if (nsnull != ss) {
clone->AppendAgentStyleSheet(ss);
NS_RELEASE(ss);
}
}
*aResult = clone.get();
NS_ADDREF(*aResult);
return NS_OK;
}
nsresult
PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC)
{
@ -7027,6 +6972,45 @@ FindTopFrame(nsIFrame* aRoot)
#ifdef DEBUG
nsresult
PresShell::CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult)
{
nsStyleSet *clone = new nsStyleSet();
if (!clone) {
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 i, n = aSet->SheetCount(nsStyleSet::eOverrideSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eOverrideSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eOverrideSheet, ss);
}
n = aSet->SheetCount(nsStyleSet::eDocSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eDocSheet, i);
if (ss)
clone->AddDocStyleSheet(ss, mDocument);
}
n = aSet->SheetCount(nsStyleSet::eUserSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eUserSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eUserSheet, ss);
}
n = aSet->SheetCount(nsStyleSet::eAgentSheet);
for (i = 0; i < n; i++) {
nsIStyleSheet* ss = aSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
if (ss)
clone->AppendStyleSheet(nsStyleSet::eAgentSheet, ss);
}
*aResult = clone;
return NS_OK;
}
// After an incremental reflow, we verify the correctness by doing a
// full reflow into a fresh frame tree.
PRBool
@ -7121,8 +7105,8 @@ PresShell::VerifyIncrementalReflow()
// Create a new presentation shell to view the document. Use the
// exact same style information that this document has.
nsCOMPtr<nsIStyleSet> newSet;
rv = CloneStyleSet(mStyleSet, getter_AddRefs(newSet));
nsStyleSet *newSet;
rv = CloneStyleSet(mStyleSet, &newSet);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to clone style set");
rv = mDocument->CreateShell(cx, vm, newSet, &sh);
sh->SetVerifyReflowEnable(PR_FALSE); // turn off verify reflow while we're reflowing the test frame tree
@ -7167,6 +7151,26 @@ PresShell::VerifyIncrementalReflow()
return ok;
}
// Layout debugging hooks
void
PresShell::ListStyleContexts(nsIFrame *aRootFrame, FILE *out, PRInt32 aIndent)
{
nsStyleContext *sc = aRootFrame->GetStyleContext();
if (sc)
sc->List(out, aIndent);
}
void
PresShell::ListStyleSheets(FILE *out, PRInt32 aIndent)
{
PRInt32 sheetCount = mStyleSet->SheetCount(nsStyleSet::eDocSheet);
for (PRInt32 i = 0; i < sheetCount; ++i) {
mStyleSet->StyleSheetAt(nsStyleSet::eDocSheet, i)->List(out, aIndent);
fputs("\n", out);
}
}
#endif
// PresShellViewEventListener
@ -7287,39 +7291,6 @@ PresShellViewEventListener::DidRefreshRect(nsIViewManager *aViewManager,
return RestoreCaretVisibility();
}
#ifdef MOZ_PERF_METRICS
// Enable, Disable and Print, Start, Stop and/or Reset the StyleSet watch
/*static*/
void CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet)
{
NS_ASSERTION(aStyleSet!=nsnull,"aStyleSet cannot be null in CtlStyleWatch");
nsresult rv = NS_OK;
if (aStyleSet != nsnull){
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(aStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
if (aCtlValue & kStyleWatchEnable){
watch->EnableTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchDisable){
watch->DisableTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchPrint){
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchStart){
watch->StartTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchStop){
watch->StopTimer(NS_TIMER_STYLE_RESOLUTION);
}
if (aCtlValue & kStyleWatchReset){
watch->ResetTimer(NS_TIMER_STYLE_RESOLUTION);
}
}
}
}
#endif
//=============================================================
//=============================================================

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

@ -43,7 +43,6 @@
#include "nsIDeviceContext.h"
#include "nsIViewManager.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsIFontMetrics.h"
#include "nsIPrintSettings.h"
#include "nsPageFrame.h"
@ -52,6 +51,7 @@
#include "nsStyleConsts.h"
#include "nsRegion.h"
#include "nsLayoutAtoms.h"
#include "nsIStyleFrameConstruction.h"
// for header/footer gap & ExtraMargin for Print Preview
#include "nsIPrefBranch.h"
@ -204,7 +204,7 @@ nsSimplePageSequenceFrame::CreateContinuingPageFrame(nsIPresContext* aPresContex
nsIFrame** aContinuingPage)
{
// Create the continuing frame
return aPresContext->PresShell()->GetStyleSet()->
return aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, aPageFrame, this, aContinuingPage);
}

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

@ -61,7 +61,7 @@
#include "nsIStyleFrameConstruction.h"
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIViewManager.h"
#include "nsIScrollableView.h"
#include "nsStyleConsts.h"
@ -1228,25 +1228,8 @@ GetChildListNameFor(nsIPresContext* aPresContext,
//----------------------------------------------------------------------
nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsCSSFrameConstructor *c = new nsCSSFrameConstructor();
if (!c)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(c);
nsresult rv = CallQueryInterface(c, aResult);
NS_RELEASE(c);
return rv;
}
nsCSSFrameConstructor::nsCSSFrameConstructor(void)
: nsIStyleFrameConstruction(),
mDocument(nsnull),
: mDocument(nsnull),
mInitialContainingBlock(nsnull),
mFixedContainingBlock(nsnull),
mDocElementContainingBlock(nsnull),
@ -3556,9 +3539,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
nsIBindingManager *bindingManager = mDocument->GetBindingManager();
if (bindingManager) {
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
nsCOMPtr<nsIStyleSet> set;
aPresShell->GetStyleSet(getter_AddRefs(set));
set->SetStyleRuleSupplier(ruleSupplier);
aPresShell->StyleSet()->SetStyleRuleSupplier(ruleSupplier);
}
// --------- BUILD VIEWPORT -----------
@ -9973,134 +9954,129 @@ nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
NS_ASSERTION(shell, "couldn't get pres shell");
if (shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
nsStyleSet *styleSet = shell->StyleSet();
NS_ASSERTION(styleSet, "couldn't get style set");
if (styleSet) { // test if any style rules exist which are dependent on content state
// Detect if one is the ancestor of the other, and skip if so.
if (aContent1 && aContent2) {
if (aContent1 == aContent2)
aContent2 = nsnull;
else if (IsAncestorOf(aContent1, aContent2))
aContent2 = nsnull;
else if (IsAncestorOf(aContent2, aContent1)) {
// test if any style rules exist which are dependent on content state
// Detect if one is the ancestor of the other, and skip if so.
if (aContent1 && aContent2) {
if (aContent1 == aContent2)
aContent2 = nsnull;
else if (IsAncestorOf(aContent1, aContent2))
aContent2 = nsnull;
else if (IsAncestorOf(aContent2, aContent1)) {
aContent1 = nsnull;
}
}
nsIFrame* primaryFrame1 = nsnull;
nsIFrame* primaryFrame2 = nsnull;
PRUint8 app1 = 0;
PRUint8 app2 = 0;
if (aContent1) {
shell->GetPrimaryFrameFor(aContent1, &primaryFrame1);
if (primaryFrame1) {
app1 = primaryFrame1->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app1 here when you could just do the code
// below |if (app1)| above and avoid the extra style reresolution?
if (!app1) {
if (!styleSet->HasStateDependentStyle(aPresContext, aContent1,
aStateMask))
{
primaryFrame1 = nsnull;
aContent1 = nsnull;
}
}
}
nsIFrame* primaryFrame1 = nsnull;
nsIFrame* primaryFrame2 = nsnull;
PRUint8 app1 = 0;
PRUint8 app2 = 0;
if (aContent1) {
shell->GetPrimaryFrameFor(aContent1, &primaryFrame1);
if (primaryFrame1) {
app1 = primaryFrame1->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app1 here when you could just do the code
// below |if (app1)| above and avoid the extra style reresolution?
if (!app1) {
PRBool depends = PR_FALSE;
styleSet->HasStateDependentStyle(aPresContext, aContent1,
aStateMask, &depends);
if (!depends) {
primaryFrame1 = nsnull;
aContent1 = nsnull;
}
}
}
if (aContent2) {
shell->GetPrimaryFrameFor(aContent2, &primaryFrame2);
if (primaryFrame2) {
app2 = primaryFrame2->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app2 here when you could just do the code
// below |if (app2)| above and avoid the extra style reresolution?
if (!app2) {
PRBool depends = PR_FALSE;
styleSet->HasStateDependentStyle(aPresContext, aContent2,
aStateMask, &depends);
if (!depends) {
primaryFrame2 = nsnull;
aContent2 = nsnull;
}
}
}
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (primaryFrame1) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame1,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE,
frameChange);
if (app1) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame1, app1))
theme->WidgetStateChanged(primaryFrame1, app1, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame1, nsnull, nsChangeHint_RepaintFrame);
}
if (frameChange & nsChangeHint_ReconstructDoc) {
return ReconstructDocElementHierarchy(aPresContext);
// No need to worry about anything else.
}
else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent1);
changeList.Clear();
} else {
ProcessRestyledFrames(changeList, aPresContext);
}
}
if (aContent2) {
shell->GetPrimaryFrameFor(aContent2, &primaryFrame2);
if (primaryFrame2) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame2,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE, frameChange);
if (app2) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame2, app2))
theme->WidgetStateChanged(primaryFrame2, app2, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame2, nsnull, nsChangeHint_RepaintFrame);
}
app2 = primaryFrame2->GetStyleDisplay()->mAppearance;
}
// max change needed for top level frames
if (frameChange & nsChangeHint_ReconstructDoc) {
result = ReconstructDocElementHierarchy(aPresContext);
changeList.Clear();
} else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent2);
changeList.Clear();
} else {
// process any children that need it
ProcessRestyledFrames(changeList, aPresContext);
// XXXldb Why check app2 here when you could just do the code
// below |if (app2)| above and avoid the extra style reresolution?
if (!app2) {
if (!styleSet->HasStateDependentStyle(aPresContext, aContent2,
aStateMask))
{
primaryFrame2 = nsnull;
aContent2 = nsnull;
}
}
// no frames, reconstruct for content
if (!primaryFrame1 && aContent1) {
result = MaybeRecreateFramesForContent(aPresContext, aContent1);
}
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (primaryFrame1) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame1,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE,
frameChange);
if (app1) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame1, app1))
theme->WidgetStateChanged(primaryFrame1, app1, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame1, nsnull, nsChangeHint_RepaintFrame);
}
if (!primaryFrame2 && aContent2) {
result = MaybeRecreateFramesForContent(aPresContext, aContent2);
if (frameChange & nsChangeHint_ReconstructDoc) {
return ReconstructDocElementHierarchy(aPresContext);
// No need to worry about anything else.
}
else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent1);
changeList.Clear();
} else {
ProcessRestyledFrames(changeList, aPresContext);
}
}
if (primaryFrame2) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(primaryFrame2,
kNameSpaceID_Unknown, nsnull,
changeList, NS_STYLE_HINT_NONE, frameChange);
if (app2) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
PRBool repaint = PR_FALSE;
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame2, app2))
theme->WidgetStateChanged(primaryFrame2, app2, nsnull, &repaint);
if (repaint)
ApplyRenderingChangeToTree(aPresContext, primaryFrame2, nsnull, nsChangeHint_RepaintFrame);
}
// max change needed for top level frames
if (frameChange & nsChangeHint_ReconstructDoc) {
result = ReconstructDocElementHierarchy(aPresContext);
changeList.Clear();
} else if (frameChange & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent2);
changeList.Clear();
} else {
// process any children that need it
ProcessRestyledFrames(changeList, aPresContext);
}
}
// no frames, reconstruct for content
if (!primaryFrame1 && aContent1) {
result = MaybeRecreateFramesForContent(aPresContext, aContent1);
}
if (!primaryFrame2 && aContent2) {
result = MaybeRecreateFramesForContent(aPresContext, aContent2);
}
}
return result;
@ -10615,7 +10591,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
}
nsresult
nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -10644,7 +10620,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIFrame* continuingTableFrame;
// It's the inner table frame, so create a continuing frame
CreateContinuingFrame(aPresShell, aPresContext, childFrame, newFrame, &continuingTableFrame);
CreateContinuingFrame(aPresContext, childFrame, newFrame, &continuingTableFrame);
newChildFrames.AddChild(continuingTableFrame);
} else {
// XXX remove this code and the above checks. We don't want to replicate
@ -10766,12 +10742,12 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
}
NS_IMETHODIMP
nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame)
{
nsIPresShell* shell = aPresContext->PresShell();
nsStyleContext* styleContext = aFrame->GetStyleContext();
nsIFrame* newFrame = nsnull;
nsresult rv = NS_OK;
@ -10781,7 +10757,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIContent* content = aFrame->GetContent();
if (nsLayoutAtoms::textFrame == frameType) {
rv = NS_NewContinuingTextFrame(aPresShell, &newFrame);
rv = NS_NewContinuingTextFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10789,7 +10765,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::inlineFrame == frameType) {
rv = NS_NewInlineFrame(aPresShell, &newFrame);
rv = NS_NewInlineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10797,7 +10773,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::blockFrame == frameType) {
rv = NS_NewBlockFrame(aPresShell, &newFrame);
rv = NS_NewBlockFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10805,7 +10781,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::areaFrame == frameType) {
rv = NS_NewAreaFrame(aPresShell, &newFrame, 0);
rv = NS_NewAreaFrame(shell, &newFrame, 0);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext,
aFrame);
@ -10814,7 +10790,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::positionedInlineFrame == frameType) {
rv = NS_NewPositionedInlineFrame(aPresShell, &newFrame);
rv = NS_NewPositionedInlineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10823,18 +10799,18 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
} else if (nsLayoutAtoms::pageFrame == frameType) {
nsIFrame* pageContentFrame;
rv = ConstructPageFrame(aPresShell, aPresContext, aParentFrame, aFrame,
rv = ConstructPageFrame(shell, aPresContext, aParentFrame, aFrame,
newFrame, pageContentFrame);
} else if (nsLayoutAtoms::tableOuterFrame == frameType) {
rv = CreateContinuingOuterTableFrame(aPresShell, aPresContext, aFrame, aParentFrame,
rv = CreateContinuingOuterTableFrame(shell, aPresContext, aFrame, aParentFrame,
content, styleContext, &newFrame);
} else if (nsLayoutAtoms::tableFrame == frameType) {
rv = CreateContinuingTableFrame(aPresShell, aPresContext, aFrame, aParentFrame,
rv = CreateContinuingTableFrame(shell, aPresContext, aFrame, aParentFrame,
content, styleContext, &newFrame);
} else if (nsLayoutAtoms::tableRowGroupFrame == frameType) {
rv = NS_NewTableRowGroupFrame(aPresShell, &newFrame);
rv = NS_NewTableRowGroupFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10842,7 +10818,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::tableRowFrame == frameType) {
rv = NS_NewTableRowFrame(aPresShell, &newFrame);
rv = NS_NewTableRowFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10858,7 +10834,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
if (IS_TABLE_CELL(cellFrame->GetType())) {
nsIFrame* continuingCellFrame;
CreateContinuingFrame(aPresShell, aPresContext, cellFrame, newFrame, &continuingCellFrame);
CreateContinuingFrame(aPresContext, cellFrame, newFrame, &continuingCellFrame);
newChildList.AddChild(continuingCellFrame);
}
cellFrame = cellFrame->GetNextSibling();
@ -10869,7 +10845,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (IS_TABLE_CELL(frameType)) {
rv = NS_NewTableCellFrame(aPresShell, IsBorderCollapse(aParentFrame), &newFrame);
rv = NS_NewTableCellFrame(shell, IsBorderCollapse(aParentFrame), &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10879,14 +10855,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIFrame* areaFrame;
nsIFrame* continuingAreaFrame;
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
CreateContinuingFrame(aPresShell, aPresContext, areaFrame, newFrame, &continuingAreaFrame);
CreateContinuingFrame(aPresContext, areaFrame, newFrame, &continuingAreaFrame);
// Set the table cell's initial child list
newFrame->SetInitialChildList(aPresContext, nsnull, continuingAreaFrame);
}
} else if (nsLayoutAtoms::lineFrame == frameType) {
rv = NS_NewFirstLineFrame(aPresShell, &newFrame);
rv = NS_NewFirstLineFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10894,7 +10870,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::letterFrame == frameType) {
rv = NS_NewFirstLetterFrame(aPresShell, &newFrame);
rv = NS_NewFirstLetterFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
// XXXbz should we be passing in a non-null aContentParentFrame?
@ -10902,7 +10878,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
}
} else if (nsLayoutAtoms::imageFrame == frameType) {
rv = NS_NewImageFrame(aPresShell, &newFrame);
rv = NS_NewImageFrame(shell, &newFrame);
if (NS_SUCCEEDED(rv)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
}
@ -10910,14 +10886,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// create a continuing out of flow frame
nsIFrame* oofFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
nsIFrame* oofContFrame;
CreateContinuingFrame(aPresShell, aPresContext, oofFrame, aParentFrame, &oofContFrame);
CreateContinuingFrame(aPresContext, oofFrame, aParentFrame, &oofContFrame);
if (!oofContFrame)
return NS_ERROR_NULL_POINTER;
// create a continuing placeholder frame
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
shell->GetFrameManager(getter_AddRefs(frameManager));
NS_ASSERTION(frameManager, "no frame manager");
CreatePlaceholderFrameFor(aPresShell, aPresContext, frameManager, content,
CreatePlaceholderFrameFor(shell, aPresContext, frameManager, content,
oofContFrame, styleContext, aParentFrame, &newFrame);
if (!newFrame)
return NS_ERROR_NULL_POINTER;
@ -10982,7 +10958,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Iterate the fixed frames and replicate each
for (nsIFrame* fixed = firstFixed; fixed; fixed = fixed->GetNextSibling()) {
rv = ConstructFrame(aPresShell, aPresContext, state, fixed->GetContent(),
rv = ConstructFrame(shell, aPresContext, state, fixed->GetContent(),
newFrame, fixedPlaceholders);
if (NS_FAILED(rv))
return rv;
@ -12071,7 +12047,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
nsIFrame* nextTextFrame = nsnull;
if (NeedFirstLetterContinuation(aTextContent)) {
// Create continuation
CreateContinuingFrame(aPresShell, aPresContext, aTextFrame, aParentFrame,
CreateContinuingFrame(aPresContext, aTextFrame, aParentFrame,
&nextTextFrame);
// Repair the continuations style context

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

@ -149,8 +149,7 @@ public:
nsIFrame* aFrame);
// Request to create a continuing frame
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame);

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

@ -65,7 +65,6 @@
#include "nsHTMLReflowCommand.h"
#include "nsLayoutAtoms.h"
#include "nsIDeviceContext.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
@ -76,6 +75,7 @@
#include "nsCSSRendering.h"
#include "nsLayoutErrors.h"
#include "nsAutoPtr.h"
#include "nsIStyleFrameConstruction.h"
/********************************************************************************
@ -3260,8 +3260,8 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
// The child doesn't have a next-in-flow so create a continuing
// frame. This hooks the child into the flow
nsIFrame* continuingFrame;
aPresContext->PresShell()->GetStyleSet()->
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, kidFrame, this,
&continuingFrame);

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

@ -48,11 +48,11 @@
#include "nsReflowPath.h"
#include "nsIDeviceContext.h"
#include "nsHTMLAtoms.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsLayoutAtoms.h"
#include "nsCSSRendering.h"
#include "nsHTMLParts.h"
#include "nsIStyleFrameConstruction.h"
#include "nsCellMap.h"//table cell navigation
@ -890,14 +890,14 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresCont
// and the frames that follow
void
nsTableRowGroupFrame::CreateContinuingRowFrame(nsIPresContext& aPresContext,
nsIStyleSet& aStyleSet,
nsIFrame& aRowFrame,
nsIFrame** aContRowFrame)
{
// XXX what is the row index?
if (!aContRowFrame) {NS_ASSERTION(PR_FALSE, "bad call"); return;}
// create the continuing frame which will create continuing cell frames
aStyleSet.CreateContinuingFrame(&aPresContext, &aRowFrame, this, aContRowFrame);
aPresContext.PresShell()->FrameConstructor()->
CreateContinuingFrame(&aPresContext, &aRowFrame, this, aContRowFrame);
if (!*aContRowFrame) return;
// Add the continuing row frame to the child list
@ -916,7 +916,6 @@ nsTableRowGroupFrame::CreateContinuingRowFrame(nsIPresContext& aPresContext,
void
nsTableRowGroupFrame::SplitSpanningCells(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsIStyleSet& aStyleSet,
nsTableFrame& aTable,
nsTableRowFrame& aFirstRow,
nsTableRowFrame& aLastRow,
@ -961,14 +960,16 @@ nsTableRowGroupFrame::SplitSpanningCells(nsIPresContext& aPresContext,
}
else {
if (!aContRow) {
CreateContinuingRowFrame(aPresContext, aStyleSet, aLastRow, (nsIFrame**)&aContRow);
CreateContinuingRowFrame(aPresContext, aLastRow, (nsIFrame**)&aContRow);
}
if (aContRow) {
if (row != &aLastRow) {
// aContRow needs a continuation for cell, since cell spanned into aLastRow
// but does not originate there
nsTableCellFrame* contCell = nsnull;
aStyleSet.CreateContinuingFrame(&aPresContext, cell, &aLastRow, (nsIFrame**)&contCell);
aPresContext.PresShell()->FrameConstructor()->
CreateContinuingFrame(&aPresContext, cell, &aLastRow,
(nsIFrame**)&contCell);
PRInt32 colIndex;
cell->GetColIndex(colIndex);
aContRow->InsertCellFrame(contCell, colIndex);
@ -1028,10 +1029,6 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
nsTableRowFrame* prevRowFrame = nsnull;
aDesiredSize.height = 0;
// get the style set
nsCOMPtr<nsIStyleSet> styleSet;
aPresContext->PresShell()->GetStyleSet(getter_AddRefs(styleSet));
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
nscoord availWidth = nsTableFrame::RoundToPixel(aReflowState.availableWidth, p2t);
nscoord availHeight = nsTableFrame::RoundToPixel(aReflowState.availableHeight, p2t);
@ -1086,7 +1083,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
// If top of page and the height exceeded the avail height, then there will be data loss
NS_WARN_IF_FALSE(rowMetrics.height <= rowReflowState.availableHeight,
"data loss - incomplete row needed more height than available, on top of page");
CreateContinuingRowFrame(*aPresContext, *styleSet.get(), *rowFrame, (nsIFrame**)&contRow);
CreateContinuingRowFrame(*aPresContext, *rowFrame, (nsIFrame**)&contRow);
if (contRow) {
aDesiredSize.height += rowMetrics.height;
if (prevRowFrame)
@ -1149,7 +1146,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
nsTableRowFrame* firstTruncatedRow;
nscoord yMost;
SplitSpanningCells(*aPresContext, aReflowState, *styleSet, *aTableFrame, *firstRowThisPage,
SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame, *firstRowThisPage,
*lastRowThisPage, aReflowState.mFlags.mIsTopOfPage, availHeight, contRow,
firstTruncatedRow, yMost);
if (firstTruncatedRow) {
@ -1176,7 +1173,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
aStatus = NS_FRAME_NOT_COMPLETE;
// Call SplitSpanningCells again with rowBefore as the last row on the page
SplitSpanningCells(*aPresContext, aReflowState, *styleSet, *aTableFrame,
SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame,
*firstRowThisPage, *rowBefore, aReflowState.mFlags.mIsTopOfPage,
availHeight, contRow, firstTruncatedRow, aDesiredSize.height);
if (firstTruncatedRow) {
@ -1184,7 +1181,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
// We were better off with the 1st call to SplitSpanningCells, do it again
UndoContinuedRow(aPresContext, contRow);
lastRowThisPage = oldLastRowThisPage;
SplitSpanningCells(*aPresContext, aReflowState, *styleSet, *aTableFrame, *firstRowThisPage,
SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame, *firstRowThisPage,
*lastRowThisPage, aReflowState.mFlags.mIsTopOfPage, availHeight, contRow,
firstTruncatedRow, aDesiredSize.height);
NS_WARNING("data loss in a row spanned cell");

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

@ -336,7 +336,6 @@ protected:
void SplitSpanningCells(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsIStyleSet& aStyleSet,
nsTableFrame& aTableFrame,
nsTableRowFrame& aFirstRow,
nsTableRowFrame& aLastRow,
@ -347,7 +346,6 @@ protected:
nscoord& aDesiredHeight);
void CreateContinuingRowFrame(nsIPresContext& aPresContext,
nsIStyleSet& aStyleSet,
nsIFrame& aRowFrame,
nsIFrame** aContRowFrame);

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

@ -26,7 +26,7 @@
// used to map attributes into CSS rules
#include "nsIDocument.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIDOMCSSStyleSheet.h"
@ -505,13 +505,13 @@ GetMathMLAttributeStyleSheet(nsIPresContext* aPresContext,
*aSheet = nsnull;
// first, look if the attribute stylesheet is already there
nsCOMPtr<nsIStyleSet> styleSet;
aPresContext->PresShell()->GetStyleSet(getter_AddRefs(styleSet));
if (!styleSet)
return;
nsStyleSet *styleSet = aPresContext->PresShell()->StyleSet();
NS_ASSERTION(styleSet, "no style set");
nsAutoString title;
for (PRInt32 i = styleSet->GetNumberOfAgentStyleSheets() - 1; i >= 0; --i) {
nsCOMPtr<nsIStyleSheet> sheet = getter_AddRefs(styleSet->GetAgentStyleSheetAt(i));
for (PRInt32 i = styleSet->SheetCount(nsStyleSet::eAgentSheet) - 1;
i >= 0; --i) {
nsIStyleSheet *sheet = styleSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
nsCOMPtr<nsICSSStyleSheet> cssSheet(do_QueryInterface(sheet));
if (cssSheet) {
cssSheet->GetTitle(title);
@ -539,14 +539,13 @@ GetMathMLAttributeStyleSheet(nsIPresContext* aPresContext,
0, &index);
}
cssSheet->SetTitle(NS_ConvertASCIItoUCS2(kTitle));
nsCOMPtr<nsIStyleSheet> sheet(do_QueryInterface(cssSheet));
// all done, no further activity from the net involved, so we better do this
sheet->SetComplete();
cssSheet->SetComplete();
// insert the stylesheet into the styleset without notifying observers
styleSet->AppendAgentStyleSheet(sheet);
*aSheet = sheet;
styleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, cssSheet);
*aSheet = cssSheet;
NS_ADDREF(*aSheet);
}

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

@ -2608,7 +2608,8 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
// init it with the DC
(aPO->mPresContext)->Init(mPrt->mPrintDocDC);
mDocViewerPrint->CreateStyleSet(aPO->mDocument, getter_AddRefs(aPO->mStyleSet));
rv = mDocViewerPrint->CreateStyleSet(aPO->mDocument, &aPO->mStyleSet);
NS_ENSURE_SUCCESS(rv, rv);
aPO->mViewManager = do_CreateInstance(kViewManagerCID, &rv);
if (NS_FAILED(rv)) {

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

@ -42,7 +42,7 @@
//-- nsPrintObject Class Impl
//---------------------------------------------------
nsPrintObject::nsPrintObject() :
mFrameType(eFrame),
mFrameType(eFrame), mStyleSet(nsnull),
mRootView(nsnull), mContent(nsnull),
mSeqFrame(nsnull), mPageFrame(nsnull), mPageNum(-1),
mRect(0,0,0,0), mReflowRect(0,0,0,0),

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

@ -39,10 +39,11 @@
// Interfaces
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIContent.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsStyleSet.h"
#include "nsIViewManager.h"
#include "nsIWebShell.h"
#include "nsIDocShell.h"
@ -80,7 +81,7 @@ public:
PrintObjectType mFrameType;
nsCOMPtr<nsIPresContext> mPresContext;
nsCOMPtr<nsIStyleSet> mStyleSet;
nsStyleSet *mStyleSet;
nsCOMPtr<nsIPresShell> mPresShell;
nsCOMPtr<nsIViewManager> mViewManager;
nsCOMPtr<nsIWidget> mWindow;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше