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
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2017-10-27 20:33:53 +03:00
|
|
|
/* 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/. */
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
#include "mozilla/ComputedStyle.h"
|
|
|
|
#include "mozilla/PresShell.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsLeafBoxFrame.h"
|
|
|
|
#include "nsBoxFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsIContent.h"
|
2014-02-28 03:04:46 +04:00
|
|
|
#include "nsNameSpaceManager.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsBoxLayoutState.h"
|
2000-06-22 04:48:49 +04:00
|
|
|
#include "nsWidgetsCID.h"
|
2013-01-05 07:12:24 +04:00
|
|
|
#include "nsViewManager.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
2000-06-22 04:48:49 +04:00
|
|
|
|
2014-08-24 18:34:51 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
//
|
2005-10-27 01:46:39 +04:00
|
|
|
// NS_NewLeafBoxFrame
|
2000-03-31 11:02:06 +04:00
|
|
|
//
|
2005-10-27 01:46:39 +04:00
|
|
|
// Creates a new Toolbar frame and returns it
|
2000-03-31 11:02:06 +04:00
|
|
|
//
|
2019-04-16 10:24:49 +03:00
|
|
|
nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
|
2019-02-05 19:45:54 +03:00
|
|
|
return new (aPresShell) nsLeafBoxFrame(aStyle, aPresShell->GetPresContext());
|
2009-09-12 20:49:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize us. This is a good time to get the alignment of the box
|
|
|
|
*/
|
2014-05-25 02:20:40 +04:00
|
|
|
void nsLeafBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) {
|
2013-03-20 05:47:48 +04:00
|
|
|
nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2012-04-17 02:32:12 +04:00
|
|
|
if (GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER) {
|
|
|
|
AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
|
|
|
|
}
|
|
|
|
|
2007-06-19 03:22:46 +04:00
|
|
|
UpdateMouseThrough();
|
2001-12-04 02:41:13 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult nsLeafBoxFrame::AttributeChanged(int32_t aNameSpaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType) {
|
2007-06-19 03:22:46 +04:00
|
|
|
nsresult rv =
|
|
|
|
nsLeafFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
if (aAttribute == nsGkAtoms::mousethrough) UpdateMouseThrough();
|
2007-06-19 03:22:46 +04:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsLeafBoxFrame::UpdateMouseThrough() {
|
2017-12-07 21:13:50 +03:00
|
|
|
static Element::AttrValuesArray strings[] = {nsGkAtoms::never,
|
2018-04-03 06:21:06 +03:00
|
|
|
nsGkAtoms::always, nullptr};
|
2017-12-07 21:13:50 +03:00
|
|
|
switch (mContent->AsElement()->FindAttrValueIn(
|
|
|
|
kNameSpaceID_None, nsGkAtoms::mousethrough, strings, eCaseMatters)) {
|
|
|
|
case 0:
|
|
|
|
AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
AddStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
|
|
|
|
break;
|
|
|
|
case 2: {
|
|
|
|
RemoveStateBits(NS_FRAME_MOUSE_THROUGH_ALWAYS);
|
|
|
|
RemoveStateBits(NS_FRAME_MOUSE_THROUGH_NEVER);
|
|
|
|
break;
|
2007-06-19 03:22:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
void nsLeafBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
// REVIEW: GetFrameForPoint used to not report events for the background
|
|
|
|
// layer, whereas this code will put an event receiver for this frame in the
|
|
|
|
// BlockBorderBackground() list. But I don't see any need to preserve
|
|
|
|
// that anomalous behaviour. The important thing I'm preserving is that
|
|
|
|
// leaf boxes continue to receive events in the foreground layer.
|
2013-02-14 15:08:08 +04:00
|
|
|
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2018-12-06 22:40:50 +03:00
|
|
|
if (!aBuilder->IsForEventDelivery() || !IsVisibleForPainting()) return;
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2019-04-01 19:53:11 +03:00
|
|
|
aLists.Content()->AppendNewToTop<nsDisplayEventReceiver>(aBuilder, this);
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord nsLeafBoxFrame::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;
|
2018-09-12 15:35:47 +03:00
|
|
|
DISPLAY_MIN_INLINE_SIZE(this, result);
|
2007-03-31 01:11:41 +04:00
|
|
|
nsBoxLayoutState state(PresContext(), 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
|
|
|
|
2015-03-03 19:38:49 +03:00
|
|
|
WritingMode wm = GetWritingMode();
|
2016-04-21 07:28:31 +03:00
|
|
|
LogicalSize minSize(wm, GetXULMinSize(state));
|
2015-03-03 19:38:49 +03:00
|
|
|
|
2016-04-21 07:28:31 +03:00
|
|
|
// GetXULMinSize returns border-box size, and we want to return content
|
2019-04-11 23:27:37 +03:00
|
|
|
// inline-size. Since Reflow uses the reflow input's border and padding, we
|
2016-04-21 07:28:31 +03:00
|
|
|
// actually just want to subtract what GetXULMinSize added, which is the
|
2016-04-21 07:28:32 +03:00
|
|
|
// result of GetXULBorderAndPadding.
|
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
|
|
|
nsMargin bp;
|
2016-04-21 07:28:32 +03:00
|
|
|
GetXULBorderAndPadding(bp);
|
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
|
|
|
|
2015-03-03 19:38:49 +03:00
|
|
|
result = minSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
|
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;
|
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord nsLeafBoxFrame::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;
|
2018-09-12 15:35:47 +03:00
|
|
|
DISPLAY_PREF_INLINE_SIZE(this, result);
|
2007-03-31 01:11:41 +04:00
|
|
|
nsBoxLayoutState state(PresContext(), aRenderingContext);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2015-03-03 19:38:49 +03:00
|
|
|
WritingMode wm = GetWritingMode();
|
2016-04-21 07:28:31 +03:00
|
|
|
LogicalSize prefSize(wm, GetXULPrefSize(state));
|
2015-03-03 19:38:49 +03:00
|
|
|
|
2016-04-21 07:28:31 +03:00
|
|
|
// GetXULPrefSize returns border-box size, and we want to return content
|
2019-04-11 23:27:37 +03:00
|
|
|
// inline-size. Since Reflow uses the reflow input's border and padding, we
|
2016-04-21 07:28:31 +03:00
|
|
|
// actually just want to subtract what GetXULPrefSize added, which is the
|
2016-04-21 07:28:32 +03:00
|
|
|
// result of GetXULBorderAndPadding.
|
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
|
|
|
nsMargin bp;
|
2016-04-21 07:28:32 +03:00
|
|
|
GetXULBorderAndPadding(bp);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2015-03-03 19:38:49 +03:00
|
|
|
result = prefSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
|
2000-03-31 11:02:06 +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
|
|
|
return result;
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
|
2014-07-24 21:03:26 +04:00
|
|
|
nscoord nsLeafBoxFrame::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
|
|
|
// No intrinsic width
|
|
|
|
return 0;
|
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
LogicalSize nsLeafBoxFrame::ComputeAutoSize(
|
|
|
|
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aAvailableISize, const LogicalSize& aMargin,
|
|
|
|
const LogicalSize& aBorder, const LogicalSize& aPadding,
|
|
|
|
ComputeSizeFlags aFlags) {
|
2008-01-27 23:24:06 +03:00
|
|
|
// Important: NOT calling our direct superclass here!
|
2014-08-24 18:34:51 +04:00
|
|
|
return nsFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
aAvailableISize, aMargin, aBorder, aPadding,
|
|
|
|
aFlags);
|
2008-01-27 23:24:06 +03:00
|
|
|
}
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2000-03-31 11:02:06 +04:00
|
|
|
nsReflowStatus& aStatus) {
|
2002-02-14 03:08:08 +03:00
|
|
|
// This is mostly a copy of nsBoxFrame::Reflow().
|
|
|
|
// We aren't able to share an implementation because of the frame
|
|
|
|
// class hierarchy. If you make changes here, please keep
|
|
|
|
// nsBoxFrame::Reflow in sync.
|
|
|
|
|
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("nsLeafBoxFrame");
|
2016-07-21 13:36:39 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
|
2017-09-13 13:00:25 +03:00
|
|
|
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
2002-02-14 03:08:08 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_ASSERTION(
|
|
|
|
aReflowInput.ComputedWidth() >= 0 && aReflowInput.ComputedHeight() >= 0,
|
|
|
|
"Computed Size < 0");
|
2002-02-14 03:08:08 +03:00
|
|
|
|
|
|
|
#ifdef DO_NOISY_REFLOW
|
|
|
|
printf(
|
|
|
|
"\n-------------Starting LeafBoxFrame Reflow "
|
|
|
|
"----------------------------\n");
|
|
|
|
printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);
|
2016-07-21 13:36:39 +03:00
|
|
|
switch (aReflowInput.reason) {
|
2002-02-14 03:08:08 +03:00
|
|
|
case eReflowReason_Initial:
|
|
|
|
printf("Ini");
|
|
|
|
break;
|
|
|
|
case eReflowReason_Incremental:
|
|
|
|
printf("Inc");
|
|
|
|
break;
|
|
|
|
case eReflowReason_Resize:
|
|
|
|
printf("Rsz");
|
|
|
|
break;
|
|
|
|
case eReflowReason_StyleChange:
|
|
|
|
printf("Sty");
|
|
|
|
break;
|
|
|
|
case eReflowReason_Dirty:
|
|
|
|
printf("Drt ");
|
|
|
|
break;
|
2016-07-21 13:36:39 +03:00
|
|
|
default:
|
|
|
|
printf("<unknown>%d", aReflowInput.reason);
|
|
|
|
break;
|
2002-02-14 03:08:08 +03:00
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
printSize("AW", aReflowInput.AvailableWidth());
|
|
|
|
printSize("AH", aReflowInput.AvailableHeight());
|
|
|
|
printSize("CW", aReflowInput.ComputedWidth());
|
|
|
|
printSize("CH", aReflowInput.ComputedHeight());
|
2002-02-14 03:08:08 +03:00
|
|
|
|
|
|
|
printf(" *\n");
|
|
|
|
|
|
|
|
#endif
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// create the layout state
|
2016-07-21 13:36:39 +03:00
|
|
|
nsBoxLayoutState state(aPresContext, aReflowInput.mRenderingContext);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
nsSize computedSize(aReflowInput.ComputedWidth(),
|
|
|
|
aReflowInput.ComputedHeight());
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
nsMargin m;
|
2016-07-21 13:36:39 +03:00
|
|
|
m = aReflowInput.ComputedPhysicalBorderPadding();
|
2002-02-14 03:08:08 +03:00
|
|
|
|
2016-04-21 07:28:32 +03:00
|
|
|
// GetXULBorderAndPadding(m);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// this happens sometimes. So lets handle it gracefully.
|
2016-07-21 13:36:39 +03:00
|
|
|
if (aReflowInput.ComputedHeight() == 0) {
|
2016-04-21 07:28:31 +03:00
|
|
|
nsSize minSize = GetXULMinSize(state);
|
2000-03-31 11:02:06 +04:00
|
|
|
computedSize.height = minSize.height - m.top - m.bottom;
|
|
|
|
}
|
|
|
|
|
2002-02-14 03:08:08 +03:00
|
|
|
nsSize prefSize(0, 0);
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// if we are told to layout intrinic then get our preferred size.
|
|
|
|
if (computedSize.width == NS_INTRINSICSIZE ||
|
|
|
|
computedSize.height == NS_INTRINSICSIZE) {
|
2016-04-21 07:28:31 +03:00
|
|
|
prefSize = GetXULPrefSize(state);
|
2016-04-21 07:28:31 +03:00
|
|
|
nsSize minSize = GetXULMinSize(state);
|
2016-04-21 07:28:31 +03:00
|
|
|
nsSize maxSize = GetXULMaxSize(state);
|
2008-01-05 08:49:44 +03:00
|
|
|
prefSize = BoundsCheck(minSize, prefSize, maxSize);
|
2002-02-14 03:08:08 +03:00
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2002-02-14 03:08:08 +03:00
|
|
|
// get our desiredSize
|
2016-07-21 13:36:39 +03:00
|
|
|
if (aReflowInput.ComputedWidth() == NS_INTRINSICSIZE) {
|
2002-02-14 03:08:08 +03:00
|
|
|
computedSize.width = prefSize.width;
|
|
|
|
} else {
|
|
|
|
computedSize.width += m.left + m.right;
|
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
if (aReflowInput.ComputedHeight() == NS_INTRINSICSIZE) {
|
2002-02-14 03:08:08 +03:00
|
|
|
computedSize.height = prefSize.height;
|
|
|
|
} else {
|
|
|
|
computedSize.height += m.top + m.bottom;
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
|
2019-04-11 23:27:37 +03:00
|
|
|
// handle reflow input min and max sizes
|
2012-08-27 23:46:23 +04:00
|
|
|
// XXXbz the width handling here seems to be wrong, since
|
|
|
|
// mComputedMin/MaxWidth is a content-box size, whole
|
|
|
|
// computedSize.width is a border-box size...
|
2016-07-21 13:36:39 +03:00
|
|
|
if (computedSize.width > aReflowInput.ComputedMaxWidth())
|
|
|
|
computedSize.width = aReflowInput.ComputedMaxWidth();
|
2002-02-14 03:08:08 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
if (computedSize.width < aReflowInput.ComputedMinWidth())
|
|
|
|
computedSize.width = aReflowInput.ComputedMinWidth();
|
2002-02-14 03:08:08 +03:00
|
|
|
|
2012-08-27 23:46:23 +04:00
|
|
|
// Now adjust computedSize.height for our min and max computed
|
|
|
|
// height. The only problem is that those are content-box sizes,
|
|
|
|
// while computedSize.height is a border-box size. So subtract off
|
|
|
|
// m.TopBottom() before adjusting, then readd it.
|
2013-01-15 16:22:03 +04:00
|
|
|
computedSize.height = std::max(0, computedSize.height - m.TopBottom());
|
2012-08-27 23:46:23 +04:00
|
|
|
computedSize.height =
|
|
|
|
NS_CSS_MINMAX(computedSize.height, aReflowInput.ComputedMinHeight(),
|
2016-07-21 13:36:39 +03:00
|
|
|
aReflowInput.ComputedMaxHeight());
|
2012-08-27 23:46:23 +04:00
|
|
|
computedSize.height += m.TopBottom();
|
2002-02-14 03:08:08 +03:00
|
|
|
|
|
|
|
nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2016-04-21 07:28:32 +03:00
|
|
|
SetXULBounds(state, r);
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// layout our children
|
2016-04-21 07:28:32 +03:00
|
|
|
XULLayout(state);
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// ok our child could have gotten bigger. So lets get its bounds
|
2013-12-27 21:59:52 +04:00
|
|
|
aDesiredSize.Width() = mRect.width;
|
|
|
|
aDesiredSize.Height() = mRect.height;
|
2016-04-21 07:28:32 +03:00
|
|
|
aDesiredSize.SetBlockStartAscent(GetXULBoxAscent(state));
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2016-04-21 07:28:32 +03:00
|
|
|
// the overflow rect is set in SetXULBounds() above
|
2010-10-07 08:25:46 +04:00
|
|
|
aDesiredSize.mOverflowAreas = GetOverflowAreas();
|
2004-07-16 20:56:21 +04:00
|
|
|
|
2002-02-14 03:08:08 +03:00
|
|
|
#ifdef DO_NOISY_REFLOW
|
|
|
|
{
|
2013-12-27 21:59:52 +04:00
|
|
|
printf("%p ** nsLBF(done) W:%d H:%d ", this, aDesiredSize.Width(),
|
|
|
|
aDesiredSize.Height());
|
2002-02-14 03:08:08 +03:00
|
|
|
|
2003-01-09 17:26:32 +03:00
|
|
|
if (maxElementWidth) {
|
2017-07-06 15:00:35 +03:00
|
|
|
printf("MW:%d\n", *maxElementWidth);
|
2002-02-14 03:08:08 +03:00
|
|
|
} else {
|
2017-07-06 15:00:35 +03:00
|
|
|
printf("MW:?\n");
|
2002-02-14 03:08:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsresult nsLeafBoxFrame::GetFrameName(nsAString& aResult) const {
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("LeafBox"), aResult);
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
2001-09-15 04:45:54 +04:00
|
|
|
#endif
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2018-02-27 17:30:27 +03:00
|
|
|
nsresult nsLeafBoxFrame::CharacterDataChanged(
|
|
|
|
const CharacterDataChangeInfo& aInfo) {
|
2014-07-24 21:03:26 +04:00
|
|
|
MarkIntrinsicISizesDirty();
|
2009-08-05 05:38:10 +04:00
|
|
|
return nsLeafFrame::CharacterDataChanged(aInfo);
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsSize nsLeafBoxFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
|
2016-04-21 07:28:31 +03:00
|
|
|
return nsBox::GetXULPrefSize(aState);
|
2004-09-28 22:37:50 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsSize nsLeafBoxFrame::GetXULMinSize(nsBoxLayoutState& aState) {
|
2016-04-21 07:28:31 +03:00
|
|
|
return nsBox::GetXULMinSize(aState);
|
2004-09-28 22:37:50 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsSize nsLeafBoxFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
|
2016-04-21 07:28:31 +03:00
|
|
|
return nsBox::GetXULMaxSize(aState);
|
2004-09-28 22:37:50 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord nsLeafBoxFrame::GetXULFlex() { return nsBox::GetXULFlex(); }
|
2004-09-28 22:37:50 +04:00
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord nsLeafBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aState) {
|
2016-04-21 07:28:32 +03:00
|
|
|
return nsBox::GetXULBoxAscent(aState);
|
2004-09-28 22:37:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2016-04-21 07:28:35 +03:00
|
|
|
nsLeafBoxFrame::DoXULLayout(nsBoxLayoutState& aState) {
|
|
|
|
return nsBox::DoXULLayout(aState);
|
2004-09-28 22:37:50 +04:00
|
|
|
}
|