2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-14 00:24:54 +04:00
|
|
|
#ifndef nsPageFrame_h___
|
|
|
|
#define nsPageFrame_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-01-27 17:09:34 +03:00
|
|
|
#include "nsContainerFrame.h"
|
2002-03-18 00:35:08 +03:00
|
|
|
#include "nsLeafFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2014-10-24 19:28:14 +04:00
|
|
|
class nsFontMetrics;
|
2001-11-03 17:59:39 +03:00
|
|
|
class nsSharedPageData;
|
|
|
|
|
1998-11-05 02:21:50 +03:00
|
|
|
// Page frame class used by the simple page sequence frame
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsPageFrame MOZ_FINAL : public nsContainerFrame {
|
2001-11-03 17:59:39 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext);
|
1999-02-19 01:23:36 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aMaxSize,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2001-01-27 17:09:34 +03:00
|
|
|
|
1999-02-14 06:47:33 +03:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::pageFrame
|
1999-02-14 06:47:33 +03:00
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
1999-02-14 06:47:33 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-02-19 01:23:36 +03:00
|
|
|
|
2001-01-27 17:09:34 +03:00
|
|
|
//////////////////
|
|
|
|
// For Printing
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
// Tell the page which page number it is out of how many
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages);
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2002-09-20 01:45:07 +04:00
|
|
|
virtual void SetSharedPageData(nsSharedPageData* aPD);
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2011-06-10 14:07:26 +04:00
|
|
|
// We must allow Print Preview UI to have a background, no matter what the
|
|
|
|
// user's settings
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
|
2011-06-10 14:07:26 +04:00
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
void PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
2015-01-05 03:18:11 +03:00
|
|
|
nsPoint aPt, bool aSubpixelAA);
|
2007-02-07 10:46:44 +03:00
|
|
|
|
1999-02-19 01:23:36 +03:00
|
|
|
protected:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsPageFrame(nsStyleContext* aContext);
|
2001-01-27 17:09:34 +03:00
|
|
|
virtual ~nsPageFrame();
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eHeader,
|
|
|
|
eFooter
|
|
|
|
} nsHeaderFooterEnum;
|
|
|
|
|
2014-10-24 19:28:14 +04:00
|
|
|
nscoord GetXPosition(nsRenderingContext& aRenderingContext,
|
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-01-27 17:09:34 +03:00
|
|
|
const nsRect& aRect,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aJust,
|
2001-01-27 17:09:34 +03:00
|
|
|
const nsString& aStr);
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2014-10-24 19:28:14 +04:00
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-01-27 17:09:34 +03:00
|
|
|
nsHeaderFooterEnum aHeaderFooter,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aJust,
|
2001-01-27 17:09:34 +03:00
|
|
|
const nsString& sStr,
|
|
|
|
const nsRect& aRect,
|
|
|
|
nscoord aHeight,
|
2001-10-31 01:58:00 +03:00
|
|
|
nscoord aAscent,
|
2001-09-26 18:01:26 +04:00
|
|
|
nscoord aWidth);
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2014-10-24 19:28:14 +04:00
|
|
|
nsFontMetrics& aFontMetrics,
|
2001-09-26 18:01:26 +04:00
|
|
|
nsHeaderFooterEnum aHeaderFooter,
|
2006-07-14 07:02:37 +04:00
|
|
|
const nsString& aStrLeft,
|
|
|
|
const nsString& aStrRight,
|
|
|
|
const nsString& aStrCenter,
|
2001-09-26 18:01:26 +04:00
|
|
|
const nsRect& aRect,
|
2001-10-31 01:58:00 +03:00
|
|
|
nscoord aAscent,
|
2001-09-26 18:01:26 +04:00
|
|
|
nscoord aHeight);
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2001-09-26 18:01:26 +04:00
|
|
|
void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mPageNum;
|
|
|
|
int32_t mTotNumPages;
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
nsSharedPageData* mPD;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
class nsPageBreakFrame : public nsLeafFrame
|
|
|
|
{
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsPageBreakFrame(nsStyleContext* aContext);
|
2002-03-18 00:35:08 +03:00
|
|
|
~nsPageBreakFrame();
|
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2014-02-18 12:36:33 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2008-12-29 18:07:36 +03:00
|
|
|
#endif
|
|
|
|
|
2002-03-18 00:35:08 +03:00
|
|
|
protected:
|
|
|
|
|
2014-07-24 21:03:26 +04:00
|
|
|
virtual nscoord GetIntrinsicISize() MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetIntrinsicBSize() MOZ_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 08:38:33 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHaveReflowed;
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2002-03-18 00:35:08 +03:00
|
|
|
};
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsPageFrame_h___ */
|
|
|
|
|