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,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_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
|
|
|
|
|
|
|
/**
|
|
|
|
* Both GetMinWidth and GetPrefWidth will return whatever GetIntrinsicWidth
|
|
|
|
* returns.
|
|
|
|
*/
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
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.
|
|
|
|
*/
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
2008-01-27 20:24:06 +00:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2011-09-29 06:19:26 +00:00
|
|
|
nsSize aPadding, bool aShrinkWrap);
|
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
|
|
|
|
* the desired width, and use the return value of GetIntrinsicHeight plus
|
|
|
|
* borderpadding for the desired height. Ascent will be set to the height,
|
|
|
|
* and descent will be set to 0.
|
|
|
|
*/
|
2007-02-24 18:33:33 +00:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-01 04:46:11 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 16:10:08 +00:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2008-01-21 02:03:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method does most of the work that Reflow() above need done.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD DoReflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const
|
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:
|
2006-03-26 21:30:36 +00:00
|
|
|
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
|
|
|
*/
|
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
|
|
|
virtual nscoord GetIntrinsicWidth() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
*/
|
|
|
|
virtual nscoord GetIntrinsicHeight();
|
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,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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___ */
|