mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 534226 - Remove support for multiple presshells, r=bz, sr=roc
This commit is contained in:
parent
c1202b1570
commit
63fd91b1fa
@ -113,7 +113,6 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#define UILOCALE_CMD_LINE_ARG "UILocale"
|
||||
|
||||
@ -956,9 +955,8 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow,
|
||||
return NS_OK;
|
||||
|
||||
// Deal with the agent sheets first. Have to do all the style sets by hand.
|
||||
nsPresShellIterator iter(document);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = document->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// Reload only the chrome URL agent style sheets.
|
||||
nsCOMArray<nsIStyleSheet> agentSheets;
|
||||
rv = shell->GetAgentStyleSheets(agentSheets);
|
||||
|
@ -75,7 +75,6 @@ nsCopySupport.h \
|
||||
nsContentCreatorFunctions.h \
|
||||
nsDOMFile.h \
|
||||
nsLineBreaker.h \
|
||||
nsPresShellIterator.h \
|
||||
nsReferencedElement.h \
|
||||
nsXMLNameSpaceMap.h \
|
||||
$(NULL)
|
||||
|
@ -105,8 +105,8 @@ class nsIBoxObject;
|
||||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xd16d73c1, 0xe0f7, 0x415c, \
|
||||
{ 0xbd, 0x68, 0x9c, 0x1f, 0x93, 0xb8, 0x73, 0x7a } }
|
||||
{ 0x1539ada4, 0x753f, 0x48a9, \
|
||||
{ 0x83, 0x11, 0x71, 0xb9, 0xbd, 0xa6, 0x41, 0xc6 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -409,10 +409,15 @@ public:
|
||||
nsIViewManager* aViewManager,
|
||||
nsStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult) = 0;
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell) = 0;
|
||||
virtual nsIPresShell *GetPrimaryShell() const = 0;
|
||||
void SetShellsHidden(PRBool aHide) { mShellsAreHidden = aHide; }
|
||||
PRBool ShellsAreHidden() const { return mShellsAreHidden; }
|
||||
void DeleteShell() { mPresShell = nsnull; }
|
||||
|
||||
nsIPresShell* GetPrimaryShell() const
|
||||
{
|
||||
return mShellIsHidden ? nsnull : mPresShell;
|
||||
}
|
||||
|
||||
void SetShellHidden(PRBool aHide) { mShellIsHidden = aHide; }
|
||||
PRBool ShellIsHidden() const { return mShellIsHidden; }
|
||||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
@ -1247,7 +1252,6 @@ protected:
|
||||
virtual void WillDispatchMutationEvent(nsINode* aTarget) = 0;
|
||||
virtual void MutationEventDispatched(nsINode* aTarget) = 0;
|
||||
friend class mozAutoSubtreeModified;
|
||||
friend class nsPresShellIterator;
|
||||
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIURI> mDocumentBaseURI;
|
||||
@ -1296,7 +1300,7 @@ protected:
|
||||
// document in it.
|
||||
PRPackedBool mIsInitialDocumentInWindow;
|
||||
|
||||
PRPackedBool mShellsAreHidden;
|
||||
PRPackedBool mShellIsHidden;
|
||||
|
||||
PRPackedBool mIsRegularHTML;
|
||||
|
||||
@ -1355,7 +1359,7 @@ protected:
|
||||
// won't be collected
|
||||
PRUint32 mMarkedCCGeneration;
|
||||
|
||||
nsTObserverArray<nsIPresShell*> mPresShells;
|
||||
nsIPresShell* mPresShell;
|
||||
|
||||
nsCOMArray<nsINode> mSubtreeModifiedTargets;
|
||||
PRUint32 mSubtreeModifiedDepth;
|
||||
|
@ -1,73 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsPresShellIterato_h___
|
||||
#define nsPresShellIterato_h___
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
class nsPresShellIterator :
|
||||
private nsTObserverArray<nsIPresShell*>::ForwardIterator
|
||||
{
|
||||
public:
|
||||
nsPresShellIterator(nsIDocument* aDoc)
|
||||
: nsTObserverArray<nsIPresShell*>::ForwardIterator(aDoc->mPresShells),
|
||||
mDoc(aDoc) {}
|
||||
|
||||
already_AddRefed<nsIPresShell> GetNextShell()
|
||||
{
|
||||
nsIPresShell* shell = nsnull;
|
||||
if (!mDoc->ShellsAreHidden() && HasMore()) {
|
||||
shell = GetNext();
|
||||
NS_IF_ADDREF(shell);
|
||||
}
|
||||
return shell;
|
||||
}
|
||||
|
||||
PRBool HasMoreThanOneShell() {
|
||||
return mDoc->mPresShells.Length() > 1;
|
||||
}
|
||||
|
||||
private:
|
||||
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
|
||||
static void operator delete(void*, size_t) {}
|
||||
|
||||
nsCOMPtr<nsIDocument> mDoc;
|
||||
};
|
||||
|
||||
#endif
|
@ -95,7 +95,6 @@
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
@ -1229,9 +1228,8 @@ nsContentSink::ScrollToRef()
|
||||
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
|
||||
NS_ConvertUTF8toUTF16 ref(unescapedRef);
|
||||
|
||||
nsPresShellIterator iter(mDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// Check an empty string which might be caused by the UTF-8 conversion
|
||||
if (!ref.IsEmpty()) {
|
||||
// Note that GoToAnchor will handle flushing layout as needed.
|
||||
@ -1309,24 +1307,13 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
|
||||
mLastNotificationTime = PR_Now();
|
||||
|
||||
mDocument->SetMayStartLayout(PR_TRUE);
|
||||
nsPresShellIterator iter(mDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
// Make sure we don't call InitialReflow() for a shell that has
|
||||
// already called it. This can happen when the layout frame for
|
||||
// an iframe is constructed *between* the Embed() call for the
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
|
||||
if (shell->DidInitialReflow()) {
|
||||
// XXX: The assumption here is that if something already
|
||||
// called InitialReflow() on this shell, it also did some of
|
||||
// the setup below, so we do nothing and just move on to the
|
||||
// next shell in the list.
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
|
||||
// Make sure we don't call InitialReflow() for a shell that has
|
||||
// already called it. This can happen when the layout frame for
|
||||
// an iframe is constructed *between* the Embed() call for the
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
nsRect r = shell->GetPresContext()->GetVisibleArea();
|
||||
nsCOMPtr<nsIPresShell> shellGrip = shell;
|
||||
nsresult rv = shell->InitialReflow(r.width, r.height);
|
||||
|
@ -2084,9 +2084,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
}
|
||||
}
|
||||
@ -2106,9 +2105,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
nsStyleSet::sheetType attrSheetType = GetAttrSheetType();
|
||||
if (mAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(attrSheetType, mAttrStyleSheet);
|
||||
}
|
||||
rv = mAttrStyleSheet->Reset(aURI);
|
||||
@ -2123,9 +2121,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
|
||||
if (mStyleAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->
|
||||
RemoveStyleSheet(nsStyleSet::eStyleAttrSheet, mStyleAttrStyleSheet);
|
||||
}
|
||||
@ -2142,9 +2139,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
mStyleAttrStyleSheet->SetOwningDocument(this);
|
||||
|
||||
// Now set up our style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
FillStyleSet(shell->StyleSet());
|
||||
}
|
||||
|
||||
@ -3045,7 +3041,9 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
||||
{
|
||||
*aInstancePtrResult = nsnull;
|
||||
|
||||
NS_ENSURE_FALSE(mShellsAreHidden, NS_ERROR_FAILURE);
|
||||
NS_ASSERTION(!mPresShell, "We have a presshell already!");
|
||||
|
||||
NS_ENSURE_FALSE(mShellIsHidden, NS_ERROR_FAILURE);
|
||||
|
||||
FillStyleSet(aStyleSet);
|
||||
|
||||
@ -3059,29 +3057,13 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Note: we don't hold a ref to the shell (it holds a ref to us)
|
||||
NS_ENSURE_TRUE(mPresShells.AppendElementUnlessExists(shell),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_WARN_IF_FALSE(mPresShells.Length() == 1, "More than one presshell!");
|
||||
mPresShell = shell;
|
||||
|
||||
shell.swap(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDocument::DeleteShell(nsIPresShell* aShell)
|
||||
{
|
||||
return mPresShells.RemoveElement(aShell);
|
||||
}
|
||||
|
||||
|
||||
nsIPresShell *
|
||||
nsDocument::GetPrimaryShell() const
|
||||
{
|
||||
return mShellsAreHidden ? nsnull : mPresShells.SafeElementAt(0, nsnull);
|
||||
}
|
||||
|
||||
static void
|
||||
SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
@ -3341,9 +3323,8 @@ nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet) const
|
||||
void
|
||||
nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
|
||||
}
|
||||
}
|
||||
@ -3368,9 +3349,8 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
||||
void
|
||||
nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
|
||||
}
|
||||
}
|
||||
@ -3507,9 +3487,8 @@ nsDocument::AddCatalogStyleSheet(nsIStyleSheet* aSheet)
|
||||
|
||||
if (applicable) {
|
||||
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->AppendStyleSheet(nsStyleSet::eAgentSheet, aSheet);
|
||||
}
|
||||
}
|
||||
@ -5083,18 +5062,15 @@ nsDocument::DoNotifyPossibleTitleChange()
|
||||
nsAutoString title;
|
||||
GetTitle(title);
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsCOMPtr<nsISupports> container = shell->GetPresContext()->GetContainer();
|
||||
if (!container)
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
|
||||
if (!docShellWin)
|
||||
continue;
|
||||
|
||||
docShellWin->SetTitle(PromiseFlatString(title).get());
|
||||
if (container) {
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
|
||||
if (docShellWin) {
|
||||
docShellWin->SetTitle(PromiseFlatString(title).get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fire a DOM event for the title change.
|
||||
@ -6361,9 +6337,8 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
mParentDocument->FlushPendingNotifications(parentType);
|
||||
}
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->FlushPendingNotifications(aType);
|
||||
}
|
||||
}
|
||||
@ -6773,10 +6748,8 @@ PRBool
|
||||
nsDocument::IsSafeToFlush() const
|
||||
{
|
||||
PRBool isSafeToFlush = PR_TRUE;
|
||||
nsPresShellIterator iter(const_cast<nsIDocument*>
|
||||
(static_cast<const nsIDocument*>(this)));
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell()) && isSafeToFlush) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->IsSafeToFlush(isSafeToFlush);
|
||||
}
|
||||
return isSafeToFlush;
|
||||
@ -7731,9 +7704,8 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
|
||||
for (PRUint32 i = 0; i < aDocuments.Length(); ++i) {
|
||||
if (!aDocuments[i]->EventHandlingSuppressed()) {
|
||||
fm->FireDelayedEvents(aDocuments[i]);
|
||||
nsPresShellIterator iter(aDocuments[i]);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->FireOrClearDelayedEvents(aFireEvents);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,6 @@
|
||||
#include "pldhash.h"
|
||||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
@ -666,8 +665,6 @@ public:
|
||||
nsIViewManager* aViewManager,
|
||||
nsStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||
virtual nsIPresShell *GetPrimaryShell() const;
|
||||
|
||||
virtual nsresult SetSubDocumentFor(nsIContent *aContent,
|
||||
nsIDocument* aSubDoc);
|
||||
|
@ -71,7 +71,6 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsISHistory.h"
|
||||
@ -722,12 +721,6 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
NS_ASSERTION(ourDoc == ourParentDocument, "Unexpected parent document");
|
||||
NS_ASSERTION(otherDoc == otherParentDocument, "Unexpected parent document");
|
||||
|
||||
nsPresShellIterator iter1(ourDoc);
|
||||
nsPresShellIterator iter2(otherDoc);
|
||||
if (iter1.HasMoreThanOneShell() || iter2.HasMoreThanOneShell()) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIPresShell* ourShell = ourDoc->GetPrimaryShell();
|
||||
nsIPresShell* otherShell = otherDoc->GetPrimaryShell();
|
||||
if (!ourShell || !otherShell) {
|
||||
|
@ -3007,9 +3007,8 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
// be in a document, if we're clearing animation effects on a target node
|
||||
// that's been detached since the previous animation sample.)
|
||||
if (doc) {
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while (shell = iter.GetNextShell()) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
presContext->SMILOverrideStyleChanged(this);
|
||||
}
|
||||
|
@ -77,7 +77,6 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsStyleUtil.h"
|
||||
|
||||
@ -761,9 +760,8 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->RecreateFramesFor(thisContent);
|
||||
}
|
||||
|
||||
@ -1543,10 +1541,8 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||
} else if (aOldType != mType) {
|
||||
// If our state changed, then we already recreated frames
|
||||
// Otherwise, need to do that here
|
||||
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->RecreateFramesFor(thisContent);
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,6 @@
|
||||
#include "nsIProperties.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
@ -2751,13 +2750,11 @@ nsEventStateManager::GetParentScrollingView(nsInputEvent *aEvent,
|
||||
}
|
||||
|
||||
nsIPresShell *pPresShell = nsnull;
|
||||
nsPresShellIterator iter(parentDoc);
|
||||
nsCOMPtr<nsIPresShell> tmpPresShell;
|
||||
while ((tmpPresShell = iter.GetNextShell())) {
|
||||
nsIPresShell *tmpPresShell = parentDoc->GetPrimaryShell();
|
||||
if (tmpPresShell) {
|
||||
NS_ENSURE_TRUE(tmpPresShell->GetPresContext(), NS_ERROR_FAILURE);
|
||||
if (tmpPresShell->GetPresContext()->Type() == aPresContext->Type()) {
|
||||
pPresShell = tmpPresShell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!pPresShell)
|
||||
|
@ -276,15 +276,10 @@ nsresult
|
||||
nsMediaDocument::StartLayout()
|
||||
{
|
||||
mMayStartLayout = PR_TRUE;
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
if (shell->DidInitialReflow()) {
|
||||
// Don't mess with this presshell: someone has already handled
|
||||
// its initial reflow.
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
// Don't mess with the presshell if someone has already handled
|
||||
// its initial reflow.
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
nsRect visibleArea = shell->GetPresContext()->GetVisibleArea();
|
||||
nsresult rv = shell->InitialReflow(visibleArea.width, visibleArea.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
@ -87,15 +86,11 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
aDocument->SetMathMLEnabled();
|
||||
aDocument->EnsureCatalogStyleSheet(kMathMLStyleSheetURI);
|
||||
|
||||
// Rebuild style data for all the presshells, because style system
|
||||
// Rebuild style data for the presshell, because style system
|
||||
// optimizations may have taken place assuming MathML was disabled.
|
||||
// (See nsRuleNode::CheckSpecifiedProperties.)
|
||||
// nsPresShellIterator skips hidden presshells, but that's OK because
|
||||
// if we're changing the document for one of those presshells the whole
|
||||
// presshell will be torn down.
|
||||
nsPresShellIterator iter(aDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell()) != nsnull) {
|
||||
nsCOMPtr<nsIPresShell> shell = aDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->GetPresContext()->PostRebuildAllStyleDataEvent(nsChangeHint(0));
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,6 @@
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
@ -2119,9 +2118,8 @@ nsXULElement::Click()
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetCurrentDoc(); // Strong just in case
|
||||
if (doc) {
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// strong ref to PresContext so events don't destroy it
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
|
@ -70,7 +70,6 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gLog;
|
||||
@ -437,9 +436,8 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsPresShellIterator iter(document);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = document->GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
@ -949,9 +949,8 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
|
||||
// |onbroadcast| event handler
|
||||
nsEvent event(PR_TRUE, NS_XUL_BROADCAST);
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
@ -2018,9 +2017,8 @@ nsXULDocument::Init()
|
||||
nsresult
|
||||
nsXULDocument::StartLayout(void)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
// Resize-reflow this time
|
||||
nsPresContext *cx = shell->GetPresContext();
|
||||
@ -2064,9 +2062,6 @@ nsXULDocument::StartLayout(void)
|
||||
// above can flush reflows, which can cause a parent document to be flushed,
|
||||
// calling ResizeReflow on our document which does SetVisibleArea.
|
||||
nsRect r = cx->GetVisibleArea();
|
||||
// Make sure we're holding a strong ref to |shell| before we call
|
||||
// InitialReflow()
|
||||
nsCOMPtr<nsIPresShell> shellGrip = shell;
|
||||
rv = shell->InitialReflow(r.width, r.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ nsSHEntry::SetContentViewer(nsIContentViewer *aViewer)
|
||||
// the contentviewer
|
||||
mDocument = do_QueryInterface(domDoc);
|
||||
if (mDocument) {
|
||||
mDocument->SetShellsHidden(PR_TRUE);
|
||||
mDocument->SetShellHidden(PR_TRUE);
|
||||
mDocument->AddMutationObserver(this);
|
||||
}
|
||||
}
|
||||
@ -685,7 +685,7 @@ nsSHEntry::DropPresentationState()
|
||||
nsRefPtr<nsSHEntry> kungFuDeathGrip = this;
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->SetShellsHidden(PR_FALSE);
|
||||
mDocument->SetShellHidden(PR_FALSE);
|
||||
mDocument->RemoveMutationObserver(this);
|
||||
mDocument = nsnull;
|
||||
}
|
||||
|
@ -188,7 +188,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
//paint forcing
|
||||
#include "prenv.h"
|
||||
|
@ -1814,7 +1814,8 @@ PresShell::Destroy()
|
||||
// hierarchy is torn down to avoid finding deleted frames through
|
||||
// this presshell while the frames are being torn down
|
||||
if (mDocument) {
|
||||
mDocument->DeleteShell(this);
|
||||
NS_ASSERTION(mDocument->GetPrimaryShell() == this, "Wrong shell?");
|
||||
mDocument->DeleteShell();
|
||||
}
|
||||
|
||||
// Revoke any pending reflow event. We need to do this and cancel
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "gfxContext.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@ -92,23 +91,19 @@ nsSVGMutationObserver::AttributeChanged(nsIDocument *aDocument,
|
||||
return;
|
||||
}
|
||||
|
||||
nsPresShellIterator iter(aDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// is the content a child of a text element
|
||||
nsSVGTextContainerFrame *containerFrame = do_QueryFrame(frame);
|
||||
if (containerFrame) {
|
||||
containerFrame->NotifyGlyphMetricsChange();
|
||||
continue;
|
||||
}
|
||||
// if not, are there text elements amongst its descendents
|
||||
UpdateTextFragmentTrees(frame);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
// is the content a child of a text element
|
||||
nsSVGTextContainerFrame* containerFrame = do_QueryFrame(frame);
|
||||
if (containerFrame) {
|
||||
containerFrame->NotifyGlyphMetricsChange();
|
||||
return;
|
||||
}
|
||||
// if not, are there text elements amongst its descendents
|
||||
UpdateTextFragmentTrees(frame);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user