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: */
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsPageFrame final : public nsContainerFrame {
|
2001-11-03 17:59:39 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2015-04-25 18:43:02 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsPageFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
1999-02-19 01:23:36 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2017-07-25 14:02:35 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const 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
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
2011-06-10 14:07:26 +04:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
void PaintHeaderFooter(gfxContext& aRenderingContext,
|
2015-01-05 03:18:11 +03:00
|
|
|
nsPoint aPt, bool aSubpixelAA);
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2017-06-21 18:45:14 +03:00
|
|
|
/**
|
|
|
|
* Return our page content frame.
|
|
|
|
*/
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
|
|
|
|
1999-02-19 01:23:36 +03:00
|
|
|
protected:
|
2018-03-22 21:20:41 +03:00
|
|
|
explicit nsPageFrame(ComputedStyle* aStyle);
|
2001-01-27 17:09:34 +03:00
|
|
|
virtual ~nsPageFrame();
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eHeader,
|
|
|
|
eFooter
|
|
|
|
} nsHeaderFooterEnum;
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord GetXPosition(gfxContext& aRenderingContext,
|
2014-10-24 19:28:14 +04:00
|
|
|
nsFontMetrics& aFontMetrics,
|
2017-07-06 15:00:35 +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);
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
void DrawHeaderFooter(gfxContext& 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);
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
void DrawHeaderFooter(gfxContext& 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;
|
2016-02-23 21:55:00 +03:00
|
|
|
nsMargin mPageContentMargin;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2017-09-16 01:53:31 +03:00
|
|
|
class nsPageBreakFrame final : public nsLeafFrame
|
2009-09-12 20:49:24 +04:00
|
|
|
{
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsPageBreakFrame)
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
explicit nsPageBreakFrame(ComputedStyle* aStyle);
|
2002-03-18 00:35:08 +03:00
|
|
|
~nsPageBreakFrame();
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
|
|
|
const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus& aStatus) override;
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2008-12-29 18:07:36 +03:00
|
|
|
#endif
|
|
|
|
|
2002-03-18 00:35:08 +03:00
|
|
|
protected:
|
|
|
|
|
2015-03-21 19:28:04 +03: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 08:38:33 +03:00
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
bool mHaveReflowed;
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
2002-03-18 00:35:08 +03:00
|
|
|
};
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsPageFrame_h___ */
|
|
|
|
|