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/. */
|
2006-03-29 18:29:03 +00:00
|
|
|
|
|
|
|
/* base class for rendering objects that do not have child lists */
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#ifndef nsLeafFrame_h___
|
|
|
|
#define nsLeafFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsFrame.h"
|
2006-09-19 04:26:20 +00:00
|
|
|
#include "nsDisplayList.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract class that provides simple fixed-size layout for leaf objects
|
|
|
|
* (e.g. images, form elements, etc.). Deriviations provide the implementation
|
|
|
|
* of the GetDesiredSize method. The rendering method knows how to render
|
|
|
|
* borders and backgrounds.
|
|
|
|
*/
|
|
|
|
class nsLeafFrame : public nsFrame {
|
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1998-09-25 16:33:38 +00:00
|
|
|
|
|
|
|
// nsIFrame replacements
|
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 {
|
2006-09-19 04:26:20 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
|
2013-02-14 11:08:08 +00:00
|
|
|
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
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
|
|
|
|
|
|
|
/**
|
2014-07-24 17:03:26 +00:00
|
|
|
* Both GetMinISize and GetPrefISize will return whatever GetIntrinsicISize
|
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
|
|
|
* returns.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) 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
|
|
|
|
2008-01-27 20:24:06 +00:00
|
|
|
/**
|
|
|
|
* Our auto size is just intrinsic width and intrinsic height.
|
|
|
|
*/
|
2014-08-24 14:34:51 +00:00
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aShrinkWrap) override;
|
2008-01-27 20:24:06 +00:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Reflow our frame. This will use the computed width plus borderpadding for
|
2014-07-24 17:03:26 +00:00
|
|
|
* the desired width, and use the return value of GetIntrinsicBSize plus
|
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
|
|
|
* borderpadding for the desired height. Ascent will be set to the height,
|
|
|
|
* and descent will be set to 0.
|
|
|
|
*/
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2008-01-21 02:03:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method does most of the work that Reflow() above need done.
|
|
|
|
*/
|
2014-05-13 00:47:53 +00:00
|
|
|
virtual void DoReflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2007-02-24 18:33:33 +00:00
|
|
|
{
|
|
|
|
// We don't actually contain a block, but we do always want a
|
|
|
|
// computed width, so tell a little white lie here.
|
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
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
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
protected:
|
2014-08-07 23:48:38 +00:00
|
|
|
explicit nsLeafFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual ~nsLeafFrame();
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
* Return the intrinsic width of the frame's content area. Note that this
|
|
|
|
* should not include borders or padding and should not depend on the applied
|
|
|
|
* styles.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2014-07-24 17:03:26 +00:00
|
|
|
virtual nscoord GetIntrinsicISize() = 0;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the intrinsic height of the frame's content area. This should not
|
2008-01-27 20:24:06 +00:00
|
|
|
* include border or padding. This will only matter if the specified height
|
|
|
|
* is auto. Note that subclasses must either implement this or override
|
|
|
|
* Reflow and ComputeAutoSize; the default Reflow and ComputeAutoSize impls
|
|
|
|
* call this method.
|
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
|
|
|
*/
|
2014-07-24 17:03:26 +00:00
|
|
|
virtual nscoord GetIntrinsicBSize();
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subroutine to add in borders and padding
|
|
|
|
*/
|
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
|
|
|
void AddBordersAndPadding(const nsHTMLReflowState& aReflowState,
|
2014-07-24 08:30:07 +00:00
|
|
|
mozilla::LogicalSize& aDesiredSize);
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Set aDesiredSize to be the available size
|
|
|
|
*/
|
|
|
|
void SizeToAvailSize(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsLeafFrame_h___ */
|