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/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* base class for rendering objects that do not have child lists */
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsLeafFrame_h___
|
|
|
|
#define nsLeafFrame_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsFrame.h"
|
2006-09-19 08:26:20 +04:00
|
|
|
#include "nsDisplayList.h"
|
1998-04-14 00:24:54 +04: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 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1998-09-25 20:33:38 +04:00
|
|
|
|
|
|
|
// nsIFrame replacements
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {
|
2006-09-19 08:26:20 +04:00
|
|
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
|
2013-02-14 15:08:08 +04:00
|
|
|
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
2006-01-26 05:29:17 +03: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 08:38:33 +03:00
|
|
|
|
|
|
|
/**
|
2014-07-24 21:03:25 +04:00
|
|
|
* Both GetMinISize and GetPrefISize will return whatever GetIntrinsicWidth
|
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
|
|
|
* returns.
|
|
|
|
*/
|
2014-07-24 21:03:25 +04:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) 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
|
|
|
|
2008-01-27 23:24:06 +03:00
|
|
|
/**
|
|
|
|
* Our auto size is just intrinsic width and intrinsic height.
|
|
|
|
*/
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
2008-01-27 23:24:06 +03:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2013-05-14 20:33:23 +04:00
|
|
|
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
|
2008-01-27 23:24:06 +03: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 08:38:33 +03: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.
|
|
|
|
*/
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2008-01-21 05:03:08 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method does most of the work that Reflow() above need done.
|
|
|
|
*/
|
2014-05-13 04:47:53 +04:00
|
|
|
virtual void DoReflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2007-02-24 21:33:33 +03: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 08:38:33 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
2006-03-27 01:30:36 +04:00
|
|
|
nsLeafFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
|
1998-04-14 00:24:54 +04: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 08:38:33 +03: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-14 00:24:54 +04: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 08:38:33 +03:00
|
|
|
virtual nscoord GetIntrinsicWidth() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the intrinsic height of the frame's content area. This should not
|
2008-01-27 23:24:06 +03: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 08:38:33 +03:00
|
|
|
*/
|
|
|
|
virtual nscoord GetIntrinsicHeight();
|
1998-04-14 00:24:54 +04: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 08:38:33 +03:00
|
|
|
void AddBordersAndPadding(const nsHTMLReflowState& aReflowState,
|
2014-07-24 12:30:07 +04: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 08:38:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set aDesiredSize to be the available size
|
|
|
|
*/
|
|
|
|
void SizeToAvailSize(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsLeafFrame_h___ */
|