2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-13 20:24:54 +00:00
|
|
|
#ifndef nsPageFrame_h___
|
|
|
|
#define nsPageFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-01-27 14:09:34 +00:00
|
|
|
#include "nsContainerFrame.h"
|
2002-03-17 21:35:08 +00:00
|
|
|
#include "nsLeafFrame.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2014-10-24 15:28:14 +00:00
|
|
|
class nsFontMetrics;
|
2001-11-03 14:59:39 +00:00
|
|
|
class nsSharedPageData;
|
|
|
|
|
1998-11-04 23:21:50 +00:00
|
|
|
// Page frame class used by the simple page sequence frame
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsPageFrame final : public nsContainerFrame {
|
2001-11-03 14:59:39 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
public:
|
2015-04-25 15:43:02 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsPageFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-05-24 22:20:40 +00:00
|
|
|
friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext);
|
1999-02-18 22:23:36 +00:00
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aMaxSize,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2001-01-27 14:09:34 +00:00
|
|
|
|
1999-02-14 03:47:33 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 00:06:41 +00:00
|
|
|
* @see nsGkAtoms::pageFrame
|
1999-02-14 03:47:33 +00:00
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
1999-02-14 03:47:33 +00:00
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1999-02-18 22:23:36 +00:00
|
|
|
|
2001-01-27 14:09:34 +00:00
|
|
|
//////////////////
|
|
|
|
// For Printing
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
// Tell the page which page number it is out of how many
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages);
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2002-09-19 21:45:07 +00:00
|
|
|
virtual void SetSharedPageData(nsSharedPageData* aPD);
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2011-06-10 10:07:26 +00:00
|
|
|
// We must allow Print Preview UI to have a background, no matter what the
|
|
|
|
// user's settings
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
2011-06-10 10:07:26 +00:00
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
2015-01-05 00:18:11 +00:00
|
|
|
nsPoint aPt, bool aSubpixelAA);
|
2007-02-07 07:46:44 +00:00
|
|
|
|
1999-02-18 22:23:36 +00:00
|
|
|
protected:
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsPageFrame(nsStyleContext* aContext);
|
2001-01-27 14:09:34 +00:00
|
|
|
virtual ~nsPageFrame();
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eHeader,
|
|
|
|
eFooter
|
|
|
|
} nsHeaderFooterEnum;
|
|
|
|
|
2014-10-24 15:28:14 +00:00
|
|
|
nscoord GetXPosition(nsRenderingContext& aRenderingContext,
|
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-01-27 14:09:34 +00:00
|
|
|
const nsRect& aRect,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aJust,
|
2001-01-27 14:09:34 +00:00
|
|
|
const nsString& aStr);
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2014-10-24 15:28:14 +00:00
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-01-27 14:09:34 +00:00
|
|
|
nsHeaderFooterEnum aHeaderFooter,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aJust,
|
2001-01-27 14:09:34 +00:00
|
|
|
const nsString& sStr,
|
|
|
|
const nsRect& aRect,
|
|
|
|
nscoord aHeight,
|
2001-10-30 22:58:00 +00:00
|
|
|
nscoord aAscent,
|
2001-09-26 14:01:26 +00:00
|
|
|
nscoord aWidth);
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2014-10-24 15:28:14 +00:00
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-09-26 14:01:26 +00:00
|
|
|
nsHeaderFooterEnum aHeaderFooter,
|
2006-07-14 03:02:37 +00:00
|
|
|
const nsString& aStrLeft,
|
|
|
|
const nsString& aStrRight,
|
|
|
|
const nsString& aStrCenter,
|
2001-09-26 14:01:26 +00:00
|
|
|
const nsRect& aRect,
|
2001-10-30 22:58:00 +00:00
|
|
|
nscoord aAscent,
|
2001-09-26 14:01:26 +00:00
|
|
|
nscoord aHeight);
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2001-09-26 14:01:26 +00:00
|
|
|
void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mPageNum;
|
|
|
|
int32_t mTotNumPages;
|
2001-01-27 14:09:34 +00:00
|
|
|
|
2001-11-03 14:59:39 +00:00
|
|
|
nsSharedPageData* mPD;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2002-03-17 21:35:08 +00:00
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
class nsPageBreakFrame : public nsLeafFrame
|
|
|
|
{
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2002-03-17 21:35:08 +00:00
|
|
|
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsPageBreakFrame(nsStyleContext* aContext);
|
2002-03-17 21:35:08 +00:00
|
|
|
~nsPageBreakFrame();
|
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2014-02-18 08:36:33 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2002-03-17 21:35:08 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2002-03-17 21:35:08 +00:00
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2008-12-29 15:07:36 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-17 21:35:08 +00:00
|
|
|
protected:
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nscoord GetIntrinsicISize() override;
|
|
|
|
virtual nscoord GetIntrinsicBSize() override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mHaveReflowed;
|
2002-03-17 21:35:08 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2002-03-17 21:35:08 +00:00
|
|
|
};
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#endif /* nsPageFrame_h___ */
|
|
|
|
|