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
|
|
|
#include "nsLeafFrame.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
nsLeafFrame::~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
|
|
|
/* virtual */ nscoord
|
2017-06-09 22:14:53 +03:00
|
|
|
nsLeafFrame::GetMinISize(gfxContext *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 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_MIN_WIDTH(this, result);
|
2014-07-24 21:03:26 +04:00
|
|
|
result = 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 08:38:33 +03:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nscoord
|
2017-06-09 22:14:53 +03:00
|
|
|
nsLeafFrame::GetPrefISize(gfxContext *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 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_PREF_WIDTH(this, result);
|
2014-07-24 21:03:26 +04:00
|
|
|
result = 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 08:38:33 +03:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-08-24 18:34:51 +04:00
|
|
|
/* virtual */
|
|
|
|
LogicalSize
|
2017-06-09 22:14:53 +03:00
|
|
|
nsLeafFrame::ComputeAutoSize(gfxContext* aRenderingContext,
|
2016-11-05 04:57:06 +03:00
|
|
|
WritingMode aWM,
|
|
|
|
const LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const LogicalSize& aMargin,
|
|
|
|
const LogicalSize& aBorder,
|
|
|
|
const LogicalSize& aPadding,
|
|
|
|
ComputeSizeFlags aFlags)
|
2008-01-27 23:24:06 +03:00
|
|
|
{
|
2014-08-24 18:34:51 +04:00
|
|
|
const WritingMode wm = GetWritingMode();
|
|
|
|
LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
|
|
|
|
return result.ConvertTo(aWM, wm);
|
2008-01-27 23:24:06 +03:00
|
|
|
}
|
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
void
|
2004-08-01 03:15:21 +04:00
|
|
|
nsLeafFrame::Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aMetrics,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
1998-11-20 20:13:02 +03:00
|
|
|
nsReflowStatus& aStatus)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2015-03-30 01:38:40 +03:00
|
|
|
MarkInReflow();
|
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
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsLeafFrame");
|
1998-11-17 04:03:59 +03:00
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
|
2016-07-21 13:36:39 +03:00
|
|
|
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
|
1998-11-17 04:03:59 +03:00
|
|
|
|
1998-05-29 00:12:02 +04:00
|
|
|
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
DoReflow(aPresContext, aMetrics, aReflowInput, aStatus);
|
2008-01-21 05:03:08 +03:00
|
|
|
|
2017-05-17 17:47:31 +03:00
|
|
|
FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay);
|
2008-01-21 05:03:08 +03:00
|
|
|
}
|
1998-06-25 20:33:10 +04:00
|
|
|
|
2014-05-13 04:47:53 +04:00
|
|
|
void
|
2008-01-21 05:03:08 +03:00
|
|
|
nsLeafFrame::DoReflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aMetrics,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2008-01-21 05:03:08 +03:00
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_ASSERTION(aReflowInput.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
|
2008-01-27 23:24:06 +03:00
|
|
|
"Shouldn't have unconstrained stuff here "
|
2016-01-28 02:11:00 +03:00
|
|
|
"thanks to the rules of reflow");
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_ASSERTION(NS_INTRINSICSIZE != aReflowInput.ComputedHeight(),
|
2008-01-27 23:24:06 +03:00
|
|
|
"Shouldn't have unconstrained stuff here "
|
2014-07-24 12:30:07 +04:00
|
|
|
"thanks to ComputeAutoSize");
|
|
|
|
|
2016-01-28 02:11:00 +03:00
|
|
|
// XXX how should border&padding effect baseline alignment?
|
|
|
|
// => descent = borderPadding.bottom for example
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
|
|
|
aMetrics.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding());
|
2008-01-27 23:24:06 +03:00
|
|
|
|
2017-02-14 12:55:48 +03:00
|
|
|
aStatus.Reset();
|
1998-11-17 04:03:59 +03:00
|
|
|
|
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
2008-01-21 05:03:08 +03:00
|
|
|
("exit nsLeafFrame::DoReflow: size=%d,%d",
|
2014-07-24 12:30:07 +04:00
|
|
|
aMetrics.ISize(wm), aMetrics.BSize(wm)));
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
|
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
|
|
|
|
2010-10-07 08:25:46 +04:00
|
|
|
aMetrics.SetOverflowAreasToDesiredBounds();
|
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
|
|
|
nscoord
|
2014-07-24 21:03:26 +04:00
|
|
|
nsLeafFrame::GetIntrinsicBSize()
|
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
|
|
|
NS_NOTREACHED("Someone didn't override Reflow or ComputeAutoSize");
|
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 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-07-21 13:36:39 +03:00
|
|
|
nsLeafFrame::SizeToAvailSize(const ReflowInput& aReflowInput,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& 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
|
|
|
{
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
|
|
|
LogicalSize size(wm, aReflowInput.AvailableISize(), // FRAME
|
|
|
|
aReflowInput.AvailableBSize());
|
2014-07-24 12:30:07 +04:00
|
|
|
aDesiredSize.SetSize(wm, size);
|
2010-10-07 08:25:46 +04:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
2017-05-17 17:47:31 +03:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize, aReflowInput.mStyleDisplay);
|
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
|
|
|
}
|