2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2017-08-17 00:10:56 +03:00
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2006-03-30 09:56:38 +04:00
|
|
|
/* storage of the frame tree and information about it */
|
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
#ifndef _nsFrameManager_h_
|
|
|
|
#define _nsFrameManager_h_
|
|
|
|
|
2018-03-06 11:45:59 +03:00
|
|
|
#include "nsDebug.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
2014-06-12 21:09:31 +04:00
|
|
|
#include "nsFrameList.h"
|
2004-02-24 03:36:35 +03:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
class nsContainerFrame;
|
2018-03-06 11:45:59 +03:00
|
|
|
class nsIFrame;
|
|
|
|
class nsILayoutHistoryState;
|
|
|
|
class nsIPresShell;
|
2014-06-12 21:09:31 +04:00
|
|
|
class nsPlaceholderFrame;
|
2018-02-22 15:19:50 +03:00
|
|
|
class nsWindowSizes;
|
2010-06-18 20:23:05 +04:00
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
/**
|
2017-05-31 22:29:49 +03:00
|
|
|
* Frame manager interface. The frame manager serves one purpose:
|
2004-02-24 00:29:06 +03:00
|
|
|
* <li>handles structural modifications to the frame model. If the frame model
|
|
|
|
* lock can be acquired, then the changes are processed immediately; otherwise,
|
|
|
|
* they're queued and processed later.
|
2004-03-06 07:53:30 +03:00
|
|
|
*
|
2018-03-06 11:45:59 +03:00
|
|
|
* FIXME(emilio): The comment above doesn't make any sense, there's no "frame
|
|
|
|
* model lock" of any sort afaict.
|
2004-02-24 00:29:06 +03:00
|
|
|
*/
|
2018-03-06 11:45:59 +03:00
|
|
|
class nsFrameManager
|
2004-02-24 00:29:06 +03:00
|
|
|
{
|
2014-06-12 21:09:31 +04:00
|
|
|
typedef mozilla::layout::FrameChildListID ChildListID;
|
2010-06-18 20:23:05 +04:00
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
public:
|
2018-03-06 11:45:59 +03:00
|
|
|
explicit nsFrameManager(nsIPresShell* aPresShell)
|
|
|
|
: mPresShell(aPresShell)
|
|
|
|
, mRootFrame(nullptr)
|
|
|
|
{
|
2013-04-01 02:43:04 +04:00
|
|
|
MOZ_ASSERT(mPresShell, "need a pres shell");
|
2004-03-06 07:46:11 +03:00
|
|
|
}
|
2014-06-02 16:08:24 +04:00
|
|
|
~nsFrameManager();
|
2004-03-06 07:46:11 +03:00
|
|
|
|
2018-03-06 11:45:59 +03:00
|
|
|
/*
|
|
|
|
* Gets and sets the root frame (typically the viewport). The lifetime of the
|
|
|
|
* root frame is controlled by the frame manager. When the frame manager is
|
|
|
|
* destroyed, it destroys the entire frame hierarchy.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetRootFrame() const { return mRootFrame; }
|
|
|
|
void SetRootFrame(nsIFrame* aRootFrame)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!mRootFrame, "already have a root frame");
|
|
|
|
mRootFrame = aRootFrame;
|
|
|
|
}
|
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
/*
|
|
|
|
* After Destroy is called, it is an error to call any FrameManager methods.
|
|
|
|
* Destroy should be called when the frame tree managed by the frame
|
|
|
|
* manager is no longer being displayed.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void Destroy();
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
// Functions for manipulating the frame model
|
2014-06-02 16:08:21 +04:00
|
|
|
void AppendFrames(nsContainerFrame* aParentFrame,
|
2017-03-19 14:11:34 +03:00
|
|
|
ChildListID aListID,
|
|
|
|
nsFrameList& aFrameList);
|
2014-05-25 02:20:40 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void InsertFrames(nsContainerFrame* aParentFrame,
|
2017-03-19 14:11:34 +03:00
|
|
|
ChildListID aListID,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Capture/restore frame state for the frame subtree rooted at aFrame.
|
|
|
|
* aState is the document state storage object onto which each frame
|
2012-05-10 05:27:47 +04:00
|
|
|
* stores its state. Callers of CaptureFrameState are responsible for
|
|
|
|
* traversing next continuations of special siblings of aFrame as
|
|
|
|
* needed; this method will only work with actual frametree descendants
|
|
|
|
* of aFrame.
|
2004-02-24 00:29:06 +03:00
|
|
|
*/
|
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add/restore state for one frame
|
|
|
|
*/
|
2017-03-19 14:11:34 +03:00
|
|
|
void CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
|
|
|
|
|
|
|
void RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2018-02-22 15:19:50 +03:00
|
|
|
void AddSizeOfIncludingThis(nsWindowSizes& aSizes) const;
|
|
|
|
|
2014-11-20 21:24:09 +03:00
|
|
|
protected:
|
2018-03-06 11:45:59 +03:00
|
|
|
// weak link, because the pres shell owns us
|
|
|
|
nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
|
|
|
|
nsIFrame* mRootFrame;
|
2004-02-24 00:29:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|