Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin

And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
This commit is contained in:
Emilio Cobos Álvarez 2023-03-29 21:23:55 +00:00
parent 14cbd2dfca
commit 2d0e69f4a1
99 changed files with 129 additions and 3494 deletions

View file

@ -1317,8 +1317,7 @@ LocalAccessible* nsAccessibilityService::CreateAccessible(
content->GetParent() == aContext->GetContent()) {
LayoutFrameType frameType = frame->Type();
// FIXME(emilio): Why only these frame types?
if (frameType == LayoutFrameType::Box ||
frameType == LayoutFrameType::FlexContainer ||
if (frameType == LayoutFrameType::FlexContainer ||
frameType == LayoutFrameType::Scroll) {
newAcc = new XULTabpanelAccessible(content, document);
}

View file

@ -407,22 +407,8 @@ uint64_t LocalAccessible::NativeState() const {
state |= VisibilityState();
nsIFrame* frame = GetFrame();
if (frame) {
if (frame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) state |= states::FLOATING;
// XXX we should look at layout for non XUL box frames, but need to decide
// how that interacts with ARIA.
if (HasOwnContent() && mContent->IsXULElement() && frame->IsXULBoxFrame()) {
const nsStyleXUL* xulStyle = frame->StyleXUL();
if (xulStyle && frame->IsXULBoxFrame()) {
// In XUL all boxes are either vertical or horizontal
if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical) {
state |= states::VERTICAL;
} else {
state |= states::HORIZONTAL;
}
}
}
if (frame && frame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
state |= states::FLOATING;
}
// Check if a XUL element has the popup attribute (an attached popup menu).

View file

@ -184,8 +184,7 @@ bool TableAccessible::IsProbablyLayoutTable() {
RETURN_LAYOUT_ANSWER(false, "table's first cell has no frame!");
}
nsMargin border;
cellFrame->GetXULBorder(border);
nsMargin border = cellFrame->StyleBorder()->GetComputedBorder();
if (border.top && border.bottom && border.left && border.right) {
RETURN_LAYOUT_ANSWER(false, "Has nonzero border-width on table cell");
}

View file

@ -7,7 +7,6 @@ support-files =
[test_listbox.html]
[test_obj.html]
[test_obj_css.html]
[test_obj_css.xhtml]
[test_obj_group.html]
[test_obj_group.xhtml]
[test_obj_group_tree.xhtml]

View file

@ -1,53 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility CSS-based Object Attributes Test.">
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="../common.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript"
src="../attributes.js" />
<script type="application/javascript">
<![CDATA[
function doTest()
{
// CSS display
testCSSAttrs("display_mozbox");
testCSSAttrs("display_mozinlinebox");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=714579"
title="Don't use GetComputedStyle for object attribute calculation">
Mozilla Bug 714579
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="display_mozbox" style="display: -moz-box;" role="img"/>
<vbox id="display_mozinlinebox" style="display: -moz-inline-box;" role="img"/>
</hbox>
</window>

View file

@ -248,7 +248,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"page-orientation",
"math-depth",
"-moz-box-collapse",
"-moz-box-layout",
"-moz-top-layer",
"scroll-timeline-axis",
"scroll-timeline-name",

View file

@ -3119,8 +3119,7 @@ void EventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent,
}
// Special check for trees
nsTreeBodyFrame* treeFrame = do_QueryFrame(current);
if (treeFrame) {
if (nsTreeBodyFrame* treeFrame = do_QueryFrame(current)) {
if (treeFrame->GetHorizontalOverflow()) {
panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
}
@ -3131,39 +3130,19 @@ void EventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent,
}
if (nsIScrollableFrame* scrollableFrame = do_QueryFrame(current)) {
if (current->IsFrameOfType(nsIFrame::eXULBox)) {
layers::ScrollDirections scrollbarVisibility =
scrollableFrame->GetScrollbarVisibility();
// Check if we have visible scrollbars
if (scrollbarVisibility.contains(layers::ScrollDirection::eVertical)) {
panDirection = WidgetGestureNotifyEvent::ePanVertical;
displayPanFeedback = true;
break;
}
nsRect scrollRange = scrollableFrame->GetScrollRange();
bool canScrollHorizontally = scrollRange.width > 0;
// Vertical panning has priority over horizontal panning, so
// when vertical movement is possible we can just finish the loop.
if (scrollRange.height > 0) {
panDirection = WidgetGestureNotifyEvent::ePanVertical;
break;
}
if (canScrollHorizontally) {
panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
displayPanFeedback = false;
}
} else { // Not a XUL box
layers::ScrollDirections scrollbarVisibility =
scrollableFrame->GetScrollbarVisibility();
// Check if we have visible scrollbars
if (scrollbarVisibility.contains(layers::ScrollDirection::eVertical)) {
panDirection = WidgetGestureNotifyEvent::ePanVertical;
displayPanFeedback = true;
break;
}
if (scrollbarVisibility.contains(
layers::ScrollDirection::eHorizontal)) {
panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
displayPanFeedback = true;
}
if (scrollbarVisibility.contains(layers::ScrollDirection::eHorizontal)) {
panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
displayPanFeedback = true;
}
} // scrollableFrame
} // ancestor chain

View file

@ -46,7 +46,6 @@
#include "mozilla/Unused.h"
#include "mozilla/ViewportUtils.h"
#include "mozilla/gfx/Types.h"
#include "nsBoxLayoutState.h"
#include <algorithm>
#ifdef XP_WIN

View file

@ -245,10 +245,9 @@ static void AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
const nsIFrame* aParent) {
MOZ_ASSERT(IsAnonymousItem(aChild), "expected an anonymous item child frame");
MOZ_ASSERT(aParent, "expected a parent frame");
MOZ_ASSERT(aParent->IsFlexContainerFrame() ||
aParent->IsGridContainerFrame() || aParent->IsXULBoxFrame(),
"anonymous items should only exist as children of "
"flex/grid/-moz-box container frames");
MOZ_ASSERT(aParent->IsFlexOrGridContainer(),
"anonymous items should only exist as children of flex/grid "
"container frames");
}
#else
# define AssertAnonymousFlexOrGridItemParent(x, y) PR_BEGIN_MACRO PR_END_MACRO
@ -304,7 +303,7 @@ static bool IsLastContinuationForColumnContent(const nsIFrame* aFrame) {
* lower-level descendents inside them, of course).
*/
static bool ShouldSuppressFloatingOfDescendants(nsIFrame* aFrame) {
return aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame() ||
return aFrame->IsFlexOrGridContainer() ||
aFrame->IsFrameOfType(nsIFrame::eMathML);
}
@ -2317,8 +2316,7 @@ static inline bool NeedFrameFor(const nsFrameConstructorState& aState,
// white-space, where we know we'll be dropping them all anyway, and involve
// an extra walk down the frame construction item list.
auto excludesIgnorableWhitespace = [](nsIFrame* aParentFrame) {
return aParentFrame->IsFrameOfType(nsIFrame::eXULBox) ||
aParentFrame->IsFrameOfType(nsIFrame::eMathML);
return aParentFrame->IsFrameOfType(nsIFrame::eMathML);
};
if (!aParentFrame || !excludesIgnorableWhitespace(aParentFrame) ||
aParentFrame->IsGeneratedContentFrame() || !aChildContent->IsText()) {
@ -2505,8 +2503,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
state, item, mDocElementContainingBlock, display, frameList));
} else if (display->mDisplay == StyleDisplay::Flex ||
display->mDisplay == StyleDisplay::WebkitBox ||
display->mDisplay == StyleDisplay::Grid ||
display->mDisplay == StyleDisplay::MozBox) {
display->mDisplay == StyleDisplay::Grid) {
auto func = [&] {
if (display->mDisplay == StyleDisplay::Grid) {
return NS_NewGridContainerFrame;
@ -4333,7 +4330,6 @@ void nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState,
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
const StyleMozBoxLayout aMozBoxLayout,
const Element& aElement) {
static_assert(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET)),
"Check eParentTypeCount should not overflow");
@ -4342,8 +4338,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
// block-level.
NS_ASSERTION(
!(aDisplay.IsFloatingStyle() || aDisplay.IsAbsolutelyPositionedStyle()) ||
aDisplay.IsBlockOutsideStyle() ||
aDisplay.DisplayOutside() == StyleDisplayOutside::XUL,
aDisplay.IsBlockOutsideStyle(),
"Style system did not apply CSS2.1 section 9.7 fixups");
// If this is "body", try propagating its scroll style to the viewport
@ -4474,14 +4469,6 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
FCDATA_IS_TABLE_PART | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow));
return &data;
}
case StyleDisplayInside::MozBox: {
if (!aElement.IsInNativeAnonymousSubtree() &&
aElement.OwnerDoc()->IsContentDocument()) {
aElement.OwnerDoc()->WarnOnceAbout(
DeprecatedOperations::eMozBoxOrInlineBoxDisplay);
}
[[fallthrough]];
}
case StyleDisplayInside::Flex:
case StyleDisplayInside::WebkitBox: {
static constexpr FrameConstructionData nonScrollableData(
@ -5269,7 +5256,6 @@ nsCSSFrameConstructor::FindElementData(const Element& aElement,
return &sImgData;
}
const auto boxLayout = aStyle.StyleVisibility()->mMozBoxLayout;
const bool shouldBlockify = aFlags.contains(ItemFlag::IsForRenderedLegend) ||
aFlags.contains(ItemFlag::IsForOutsideMarker);
if (shouldBlockify && !aStyle.StyleDisplay()->IsBlockOutsideStyle()) {
@ -5279,11 +5265,11 @@ nsCSSFrameConstructor::FindElementData(const Element& aElement,
uint16_t rawDisplayValue =
Servo_ComputedValues_BlockifiedDisplay(&aStyle, isRootElement);
display.mDisplay = StyleDisplay(rawDisplayValue);
return FindDisplayData(display, boxLayout, aElement);
return FindDisplayData(display, aElement);
}
const auto& display = *aStyle.StyleDisplay();
return FindDisplayData(display, boxLayout, aElement);
return FindDisplayData(display, aElement);
}
const nsCSSFrameConstructor::FrameConstructionData*
@ -8704,8 +8690,7 @@ void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
return;
}
if (!aParentFrame->IsFlexOrGridContainer() &&
!aParentFrame->IsXULBoxFrame()) {
if (!aParentFrame->IsFlexOrGridContainer()) {
return;
}
@ -9332,8 +9317,7 @@ void nsCSSFrameConstructor::CreateNeededPseudoSiblings(
*/
static bool FrameWantsToBeInAnonymousItem(const nsIFrame* aContainerFrame,
const nsIFrame* aFrame) {
MOZ_ASSERT(aContainerFrame->IsFlexOrGridContainer() ||
aContainerFrame->IsXULBoxFrame());
MOZ_ASSERT(aContainerFrame->IsFlexOrGridContainer());
// Any line-participant frames (e.g. text) definitely want to be wrapped in
// an anonymous flex/grid item.
@ -9355,8 +9339,7 @@ static bool FrameWantsToBeInAnonymousItem(const nsIFrame* aContainerFrame,
static void VerifyGridFlexContainerChildren(nsIFrame* aParentFrame,
const nsFrameList& aChildren) {
#ifdef DEBUG
if (!aParentFrame->IsFlexOrGridContainer() &&
!aParentFrame->IsXULBoxFrame()) {
if (!aParentFrame->IsFlexOrGridContainer()) {
return;
}
@ -9803,9 +9786,6 @@ void nsCSSFrameConstructor::ProcessChildren(
/* aParentIsWrapperAnonBox = */ false,
aFrameList);
NS_ASSERTION(!allowFirstPseudos || !aFrame->IsXULBoxFrame(),
"can't be both block and box");
if (listItem) {
if (auto* markerFrame = nsLayoutUtils::GetMarkerFrame(aContent)) {
for (auto* childFrame : aFrameList) {
@ -11358,10 +11338,10 @@ bool nsCSSFrameConstructor::WipeContainingBlock(
nsIFrame* nextSibling = ::GetInsertNextSibling(aFrame, aPrevSibling);
// Situation #2 is a flex / grid / XUL box container frame into which we're
// inserting new inline non-replaced children, adjacent to an existing
// anonymous flex or grid item.
if (aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame()) {
// Situation #2 is a flex / grid container frame into which we're inserting
// new inline non-replaced children, adjacent to an existing anonymous flex or
// grid item.
if (aFrame->IsFlexOrGridContainer()) {
FCItemIterator iter(aItems);
// Check if we're adding to-be-wrapped content right *after* an existing

View file

@ -1569,7 +1569,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// Not static because it does PropagateScrollToViewport. If this
// changes, make this static.
const FrameConstructionData* FindDisplayData(const nsStyleDisplay&,
mozilla::StyleMozBoxLayout,
const Element&);
/**

View file

@ -628,7 +628,6 @@ LogicalSize nsTextControlFrame::ComputeAutoSize(
LogicalSize ancestorAutoSize = nsContainerFrame::ComputeAutoSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
aBorderPadding, aSizeOverrides, aFlags);
// Disabled when there's inflation; see comment in GetXULPrefSize.
MOZ_ASSERT(inflation != 1.0f ||
ancestorAutoSize.ISize(aWM) == autoSize.ISize(aWM),
"Incorrect size computed by ComputeAutoSize?");
@ -817,16 +816,6 @@ void nsTextControlFrame::ReflowTextControlChild(
aParentDesiredSize.mOverflowAreas.UnionWith(desiredSize.mOverflowAreas);
}
nsSize nsTextControlFrame::GetXULMinSize(nsBoxLayoutState& aState) {
// XXXbz why? Why not the nsBoxFrame sizes?
return nsIFrame::GetUncachedXULMinSize(aState);
}
bool nsTextControlFrame::IsXULCollapsed() {
// We're never collapsed in the box sense.
return false;
}
// IMPLEMENTING NS_IFORMCONTROLFRAME
void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint) {
TextControlElement* textControlElement =

View file

@ -100,9 +100,6 @@ class nsTextControlFrame : public nsContainerFrame,
: aFrame->BSize(aWM) - aFirstBaseline);
}
nsSize GetXULMinSize(nsBoxLayoutState&) override;
bool IsXULCollapsed() override;
#ifdef ACCESSIBILITY
mozilla::a11y::AccType AccessibleType() override;
#endif

View file

@ -10,7 +10,7 @@
#include "nsIFrameInlines.h"
static bool CanUse(const nsIFrame* aFrame) {
return aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame() ||
return aFrame->IsFlexOrGridContainer() ||
(aFrame->GetContent() && aFrame->GetContent()->IsAnyOfXULElements(
nsGkAtoms::treecols, nsGkAtoms::treecol));
}

View file

@ -10,8 +10,6 @@ FRAME_CLASSES = [
Frame("nsBCTableCellFrame", "TableCell", NOT_LEAF),
Frame("nsBackdropFrame", "Backdrop", LEAF),
Frame("nsBlockFrame", "Block", NOT_LEAF),
Frame("nsBox", "None", NOT_LEAF),
Frame("nsButtonBoxFrame", "Box", NOT_LEAF),
Frame("nsCanvasFrame", "Canvas", NOT_LEAF),
Frame("nsCheckboxRadioFrame", "CheckboxRadio", LEAF),
Frame("nsColorControlFrame", "ColorControl", LEAF),
@ -39,7 +37,6 @@ FRAME_CLASSES = [
Frame("nsImageControlFrame", "ImageControl", LEAF),
Frame("nsImageFrame", "Image", DYNAMIC_LEAF),
Frame("nsInlineFrame", "Inline", NOT_LEAF),
Frame("nsLeafBoxFrame", "LeafBox", LEAF),
Frame("nsListControlFrame", "ListControl", NOT_LEAF),
Frame("nsMathMLFrame", "None", NOT_LEAF),
Frame("nsMathMLmactionFrame", "None", NOT_LEAF),
@ -83,7 +80,7 @@ FRAME_CLASSES = [
Frame("nsSelectsAreaFrame", "Block", NOT_LEAF),
Frame("nsPageSequenceFrame", "PageSequence", NOT_LEAF),
Frame("nsSliderFrame", "Slider", NOT_LEAF),
Frame("nsSplitterFrame", "Box", NOT_LEAF),
Frame("nsSplitterFrame", "SimpleXULLeaf", NOT_LEAF),
Frame("nsSubDocumentFrame", "SubDocument", LEAF),
Frame("PrintedSheetFrame", "PrintedSheet", NOT_LEAF),
Frame("SVGAFrame", "SVGA", NOT_LEAF),
@ -126,7 +123,7 @@ FRAME_CLASSES = [
Frame("nsTableRowGroupFrame", "TableRowGroup", NOT_LEAF),
Frame("nsTextControlFrame", "TextInput", LEAF),
Frame("nsTextFrame", "Text", LEAF),
Frame("nsTreeBodyFrame", "LeafBox", LEAF),
Frame("nsTreeBodyFrame", "SimpleXULLeaf", LEAF),
Frame("nsVideoFrame", "HTMLVideo", NOT_LEAF),
Frame("ViewportFrame", "Viewport", NOT_LEAF),
Frame("WBRFrame", "Wbr", LEAF),

View file

@ -697,8 +697,7 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext,
mStylePosition->MinBSizeDependsOnContainer(wm) ||
mStylePosition->MaxBSizeDependsOnContainer(wm) ||
mStylePosition->mOffset.GetBStart(wm).HasPercent() ||
!mStylePosition->mOffset.GetBEnd(wm).IsAuto() ||
mFrame->IsXULBoxFrame();
!mStylePosition->mOffset.GetBEnd(wm).IsAuto();
// If mFrame is a flex item, and mFrame's block axis is the flex container's
// main axis (e.g. in a column-oriented flex container with same
@ -1041,12 +1040,6 @@ void ReflowInput::ApplyRelativePositioning(
mozilla::LogicalPoint(aWritingMode, pos, aContainerSize - frameSize);
}
// Returns true if aFrame is non-null, a XUL frame, and "XUL-collapsed" (which
// only becomes a valid question to ask if we know it's a XUL frame).
static bool IsXULCollapsedXULFrame(nsIFrame* aFrame) {
return aFrame && aFrame->IsXULBoxFrame() && aFrame->IsXULCollapsed();
}
nsIFrame* ReflowInput::GetHypotheticalBoxContainer(nsIFrame* aFrame,
nscoord& aCBIStartEdge,
LogicalSize& aCBSize) const {
@ -1081,21 +1074,10 @@ nsIFrame* ReflowInput::GetHypotheticalBoxContainer(nsIFrame* aFrame,
"aFrame shouldn't be in reflow; we'll lie if it is");
WritingMode wm = aFrame->GetWritingMode();
// Compute CB's offset & content-box size by subtracting borderpadding from
// frame size. Exception: if the CB is 0-sized, it *might* be a child of a
// XUL-collapsed frame and might have nonzero borderpadding that was simply
// discarded during its layout. (See the child-zero-sizing in
// nsSprocketLayout::XULLayout()). In that case, we ignore the
// borderpadding here (just like we did when laying it out), or else we'd
// produce a bogus negative content-box size.
aCBIStartEdge = 0;
aCBSize = aFrame->GetLogicalSize(wm);
if (!aCBSize.IsAllZero() || !IsXULCollapsedXULFrame(aFrame->GetParent())) {
// aFrame is not XUL-collapsed (nor is it a child of a XUL-collapsed
// frame), so we can go ahead and subtract out border padding.
LogicalMargin borderPadding = aFrame->GetLogicalUsedBorderAndPadding(wm);
aCBIStartEdge += borderPadding.IStart(wm);
aCBSize -= borderPadding.Size(wm);
}
// frame size.
const auto& bp = aFrame->GetLogicalUsedBorderAndPadding(wm);
aCBIStartEdge = bp.IStart(wm);
aCBSize = aFrame->GetLogicalSize(wm) - bp.Size(wm);
}
return aFrame;
@ -2152,11 +2134,6 @@ void ReflowInput::InitConstraints(
nsPresContext* aPresContext, const Maybe<LogicalSize>& aContainingBlockSize,
const Maybe<LogicalMargin>& aBorder, const Maybe<LogicalMargin>& aPadding,
LayoutFrameType aFrameType) {
MOZ_ASSERT(!mStyleDisplay->IsFloating(mFrame) ||
(mStyleDisplay->mDisplay != StyleDisplay::MozBox &&
mStyleDisplay->mDisplay != StyleDisplay::MozInlineBox),
"Please don't try to float a -moz-box or a -moz-inline-box");
WritingMode wm = GetWritingMode();
LogicalSize cbSize = aContainingBlockSize.valueOr(
LogicalSize(mWritingMode, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE));

View file

@ -35,7 +35,6 @@
#include "nsError.h"
#include "nsDisplayList.h"
#include "nsIBaseWindow.h"
#include "nsBoxLayoutState.h"
#include "nsCSSFrameConstructor.h"
#include "nsBlockFrame.h"
#include "nsPlaceholderFrame.h"

View file

@ -54,7 +54,6 @@ static bool IsLegacyBox(const nsIFrame* aFlexContainer) {
MOZ_ASSERT(aFlexContainer->IsFlexContainerFrame(),
"only flex containers may be passed to this function");
return aFlexContainer->HasAnyStateBits(
NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX |
NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
}
@ -2747,9 +2746,7 @@ void nsFlexContainerFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
// Figure out if we should set a frame state bit to indicate that this frame
// represents a legacy -moz-{inline-}box or -webkit-{inline-}box container.
if (displayInside == StyleDisplayInside::MozBox) {
AddStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX);
} else if (displayInside == StyleDisplayInside::WebkitBox) {
if (displayInside == StyleDisplayInside::WebkitBox) {
AddStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
}
}
@ -3850,7 +3847,7 @@ void FlexboxAxisInfo::InitAxesFromLegacyProps(const nsIFrame* aFlexContainer) {
const nsStyleXUL* styleXUL = aFlexContainer->StyleXUL();
const bool boxOrientIsVertical =
(styleXUL->mBoxOrient == StyleBoxOrient::Vertical);
styleXUL->mBoxOrient == StyleBoxOrient::Vertical;
const bool wmIsVertical = aFlexContainer->GetWritingMode().IsVertical();
// If box-orient agrees with our writing-mode, then we're "row-oriented"
@ -4932,7 +4929,7 @@ bool nsFlexContainerFrame::IsItemInlineAxisMainAxis(nsIFrame* aFrame) {
// just directly check if that's vertical, and compare that to whether the
// item's WM is also vertical:
bool boxOrientIsVertical =
(flexContainer->StyleXUL()->mBoxOrient == StyleBoxOrient::Vertical);
flexContainer->StyleXUL()->mBoxOrient == StyleBoxOrient::Vertical;
return flexItemWM.IsVertical() == boxOrientIsVertical;
}

View file

@ -322,25 +322,21 @@ FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame)
FRAME_STATE_BIT(FlexContainer, 20,
NS_STATE_FLEX_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER)
// Set for a flex container that is emulating a legacy
// 'display:-moz-{inline-}box' container.
FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX)
// Set for a flex container that is emulating a legacy
// 'display:-webkit-{inline-}box'.
FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX)
FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX)
// True if the container has no flex items; may lie if there is a pending reflow
FRAME_STATE_BIT(FlexContainer, 23, NS_STATE_FLEX_SYNTHESIZE_BASELINE)
FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_SYNTHESIZE_BASELINE)
// True iff some first-in-flow in-flow children were pushed.
// Note that those child frames may have been removed without this bit
// being updated for performance reasons, so code shouldn't depend on
// actually finding any pushed items when this bit is set.
FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_DID_PUSH_ITEMS)
FRAME_STATE_BIT(FlexContainer, 23, NS_STATE_FLEX_DID_PUSH_ITEMS)
// We've merged some OverflowList children since last reflow.
FRAME_STATE_BIT(FlexContainer, 25, NS_STATE_FLEX_HAS_CHILD_NIFS)
FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_HAS_CHILD_NIFS)
// == Frame state bits that apply to grid container frames ====================

View file

@ -24,7 +24,6 @@
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/gfx/gfxVars.h"
#include "nsFontMetrics.h"
#include "nsBoxLayoutState.h"
#include "mozilla/dom/NodeInfo.h"
#include "nsScrollbarFrame.h"
#include "nsINode.h"
@ -535,8 +534,7 @@ ScrollReflowInput::ScrollReflowInput(nsHTMLScrollFrame* aFrame,
// we'll always try to place the scrollbar, even if it will ultimately not
// fit, see bug 1809630. XUL collapsing is the exception because the
// front-end uses it.
MOZ_ASSERT(scrollbar->IsXULCollapsed() ||
(mHScrollbarPrefSize.width && mHScrollbarPrefSize.height),
MOZ_ASSERT(mHScrollbarPrefSize.width && mHScrollbarPrefSize.height,
"Shouldn't have a zero horizontal scrollbar-size");
} else {
mHScrollbar = ShowScrollbar::Never;
@ -546,8 +544,7 @@ ScrollReflowInput::ScrollReflowInput(nsHTMLScrollFrame* aFrame,
scrollbar->SetScrollbarMediatorContent(mReflowInput.mFrame->GetContent());
mVScrollbarPrefSize = scrollbar->ScrollbarMinSize();
// See above.
MOZ_ASSERT(scrollbar->IsXULCollapsed() ||
(mVScrollbarPrefSize.width && mVScrollbarPrefSize.height),
MOZ_ASSERT(mVScrollbarPrefSize.width && mVScrollbarPrefSize.height,
"Shouldn't have a zero vertical scrollbar-size");
} else {
mVScrollbar = ShowScrollbar::Never;
@ -1284,19 +1281,6 @@ nscoord nsHTMLScrollFrame::GetPrefISize(gfxContext* aRenderingContext) {
result, IntrinsicScrollbarGutterSizeAtInlineEdges(aRenderingContext));
}
nsresult nsHTMLScrollFrame::GetXULPadding(nsMargin& aMargin) {
// Our padding hangs out on the inside of the scrollframe, but XUL doesn't
// realize that.
// TODO: Remove as more XUL layout is removed.
aMargin.SizeTo(0, 0, 0, 0);
return NS_OK;
}
bool nsHTMLScrollFrame::IsXULCollapsed() {
// We're never collapsed in the box sense.
return false;
}
// When we have perspective set on the outer scroll frame, and transformed
// children (possibly with preserve-3d) then the effective transform on the
// child depends on the offset to the scroll frame, which changes as we scroll.

View file

@ -17,7 +17,6 @@
#include "nsIStatefulFrame.h"
#include "nsThreadUtils.h"
#include "nsIReflowCallback.h"
#include "nsBoxLayoutState.h"
#include "nsQueryFrame.h"
#include "nsExpirationTracker.h"
#include "TextOverflow.h"
@ -117,8 +116,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
nsresult GetXULPadding(nsMargin& aPadding) final;
bool IsXULCollapsed() final;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
@ -163,8 +160,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
return GetScrolledFrame()->GetContentInsertionFrame();
}
bool DoesClipChildrenInBothAxes() final { return true; }
nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) final {
nsPoint pt = aChild->GetPosition();
if (aChild == GetScrolledFrame()) {

View file

@ -27,7 +27,6 @@
#include "mozilla/PresShell.h"
#include "nsAbsoluteContainingBlock.h"
#include "nsAlgorithm.h" // for clamped()
#include "nsBoxLayoutState.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSFrameConstructor.h"
#include "nsTHashMap.h"

View file

@ -98,7 +98,6 @@
#include "imgIRequest.h"
#include "nsError.h"
#include "nsContainerFrame.h"
#include "nsBoxLayoutState.h"
#include "nsBlockFrame.h"
#include "nsDisplayList.h"
#include "nsChangeHint.h"
@ -189,21 +188,6 @@ std::ostream& operator<<(std::ostream& aStream, const nsDirection& aDirection) {
return aStream << (aDirection == eDirNext ? "eDirNext" : "eDirPrevious");
}
// Struct containing cached metrics for box-wrapped frames.
struct nsBoxLayoutMetrics {
nsSize mPrefSize;
nsSize mMinSize;
nsSize mMaxSize;
nsSize mBlockMinSize;
nsSize mBlockPrefSize;
nscoord mBlockAscent;
nscoord mAscent;
nsSize mLastSize;
};
struct nsContentAndOffset {
nsIContent* mContent = nullptr;
int32_t mOffset = 0;
@ -217,21 +201,6 @@ struct nsContentAndOffset {
#include "nsILineIterator.h"
#include "prenv.h"
NS_DECLARE_FRAME_PROPERTY_DELETABLE(BoxMetricsProperty, nsBoxLayoutMetrics)
static void InitBoxMetrics(nsIFrame* aFrame, bool aClear) {
if (aClear) {
aFrame->RemoveProperty(BoxMetricsProperty());
}
nsBoxLayoutMetrics* metrics = new nsBoxLayoutMetrics();
aFrame->SetProperty(BoxMetricsProperty(), metrics);
aFrame->nsIFrame::MarkIntrinsicISizesDirty();
metrics->mBlockAscent = 0;
metrics->mLastSize.SizeTo(0, 0);
}
// Utility function to set a nsRect-valued property table entry on aFrame,
// reusing the existing storage if the property happens to be already set.
template <typename T>
@ -248,11 +217,6 @@ static void SetOrUpdateRectValuedProperty(
}
}
static bool IsXULBoxWrapped(const nsIFrame* aFrame) {
return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame() &&
!aFrame->IsXULBoxFrame();
}
/* static */
void nsIFrame::DestroyAnonymousContent(
nsPresContext* aPresContext, already_AddRefed<nsIContent>&& aContent) {
@ -567,8 +531,7 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
// Form controls shouldn't become inflation containers.
(content->IsAnyOfHTMLElements(
nsGkAtoms::option, nsGkAtoms::optgroup, nsGkAtoms::select,
nsGkAtoms::input, nsGkAtoms::button, nsGkAtoms::textarea)))) &&
!(aFrame->IsXULBoxFrame() && aFrame->GetParent()->IsXULBoxFrame());
nsGkAtoms::input, nsGkAtoms::button, nsGkAtoms::textarea))));
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) || isInline ||
// br frames and mathml frames report being line
// participants even when their position or display is
@ -774,8 +737,6 @@ void nsIFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
DidSetComputedStyle(nullptr);
if (::IsXULBoxWrapped(this)) ::InitBoxMetrics(this, false);
// For a newly created frame, we need to update this frame's visibility state.
// Usually we update the state when the frame is restyled and has a
// VisibilityChange change hint but we don't generate any change hints for
@ -2490,8 +2451,7 @@ bool nsIFrame::CanBeDynamicReflowRoot() const {
if (IsFrameOfType(nsIFrame::eLineParticipant) ||
nsStyleDisplay::IsRubyDisplayType(display.mDisplay) ||
display.DisplayOutside() == StyleDisplayOutside::InternalTable ||
display.DisplayInside() == StyleDisplayInside::Table ||
(GetParent() && GetParent()->IsXULBoxFrame())) {
display.DisplayInside() == StyleDisplayInside::Table) {
// We have a display type where 'width' and 'height' don't actually set the
// width or height (i.e., the size depends on content).
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_DYNAMIC_REFLOW_ROOT),
@ -5888,19 +5848,6 @@ Maybe<nsIFrame::Cursor> nsIFrame::GetCursor(const nsPoint&) {
/* virtual */
void nsIFrame::MarkIntrinsicISizesDirty() {
// This version is meant only for what used to be box-to-block adaptors.
// It should not be called by other derived classes.
if (::IsXULBoxWrapped(this)) {
nsBoxLayoutMetrics* metrics = BoxMetrics();
XULSizeNeedsRecalc(metrics->mPrefSize);
XULSizeNeedsRecalc(metrics->mMinSize);
XULSizeNeedsRecalc(metrics->mMaxSize);
XULSizeNeedsRecalc(metrics->mBlockPrefSize);
XULSizeNeedsRecalc(metrics->mBlockMinSize);
XULCoordNeedsRecalc(metrics->mAscent);
}
// If we're a flex item, clear our flex-item-specific cached measurements
// (which likely depended on our now-stale intrinsic isize).
if (IsFlexItem()) {
@ -5935,8 +5882,7 @@ void nsIFrame::MarkSubtreeDirty() {
}
while (!stack.IsEmpty()) {
nsIFrame* f = stack.PopLastElement();
if (f->HasAnyStateBits(NS_FRAME_IS_DIRTY) || f->IsTableColGroupFrame() ||
f->IsXULBoxFrame()) {
if (f->HasAnyStateBits(NS_FRAME_IS_DIRTY) || f->IsTableColGroupFrame()) {
continue;
}
@ -6349,8 +6295,7 @@ nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
}
const bool isFlexItem =
IsFlexItem() && !parentFrame->HasAnyStateBits(
NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX |
NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX);
NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
// This variable only gets set (and used) if isFlexItem is true. It
// indicates which axis (in this frame's own WM) corresponds to its
// flex container's main axis.
@ -7943,14 +7888,10 @@ bool nsIFrame::UpdateOverflow() {
UnionChildOverflow(overflowAreas);
if (FinishAndStoreOverflow(overflowAreas, GetSize())) {
nsView* view = GetView();
if (view) {
ReflowChildFlags flags = GetXULLayoutFlags();
if (!(flags & ReflowChildFlags::NoSizeView)) {
// Make sure the frame's view is properly sized.
nsViewManager* vm = view->GetViewManager();
vm->ResizeView(view, overflowAreas.InkOverflow(), true);
}
if (nsView* view = GetView()) {
// Make sure the frame's view is properly sized.
nsViewManager* vm = view->GetViewManager();
vm->ResizeView(view, overflowAreas.InkOverflow(), true);
}
return true;
@ -7969,10 +7910,16 @@ bool nsIFrame::ComputeCustomOverflow(OverflowAreas& aOverflowAreas) {
return true;
}
bool nsIFrame::DoesClipChildrenInBothAxes() const {
nsIScrollableFrame* sf = do_QueryFrame(this);
const nsStyleDisplay* display = StyleDisplay();
return sf || (display->mOverflowX == StyleOverflow::Clip &&
display->mOverflowY == StyleOverflow::Clip);
}
/* virtual */
void nsIFrame::UnionChildOverflow(OverflowAreas& aOverflowAreas) {
if (!DoesClipChildrenInBothAxes() &&
!(IsXULCollapsed() && (IsXULBoxFrame() || ::IsXULBoxWrapped(this)))) {
if (!DoesClipChildrenInBothAxes()) {
nsLayoutUtils::UnionChildOverflow(this, aOverflowAreas);
}
}
@ -10088,19 +10035,6 @@ bool nsIFrame::FinishAndStoreOverflow(OverflowAreas& aOverflowAreas,
OverflowClipMargin(overflowClipAxes));
}
// Note that StyleOverflow::Clip doesn't clip the frame
// background, so we add theme background overflow here so it's not clipped.
if (!::IsXULBoxWrapped(this) && IsThemed(disp)) {
nsRect r(bounds);
nsPresContext* presContext = PresContext();
if (presContext->Theme()->GetWidgetOverflow(
presContext->DeviceContext(), this, disp->EffectiveAppearance(),
&r)) {
nsRect& vo = aOverflowAreas.InkOverflow();
vo = vo.UnionEdges(r);
}
}
ComputeAndIncludeOutlineArea(this, aOverflowAreas, aNewSize);
// Nothing in here should affect scrollable overflow.
@ -10701,500 +10635,6 @@ Maybe<StyleVerticalAlignKeyword> nsIFrame::VerticalAlignEnum() const {
return Nothing();
}
NS_IMETHODIMP
nsIFrame::RefreshSizeCache(nsBoxLayoutState& aState) {
// XXXbz this comment needs some rewriting to make sense in the
// post-reflow-branch world.
// Ok we need to compute our minimum, preferred, and maximum sizes.
// 1) Maximum size. This is easy. Its infinite unless it is overloaded by CSS.
// 2) Preferred size. This is a little harder. This is the size the
// block would be if it were laid out on an infinite canvas. So we can
// get this by reflowing the block with and INTRINSIC width and height. We
// can also do a nice optimization for incremental reflow. If the reflow is
// incremental then we can pass a flag to have the block compute the
// preferred width for us! Preferred height can just be the minimum height;
// 3) Minimum size. This is a toughy. We can pass the block a flag asking for
// the max element size. That would give us the width. Unfortunately you
// can only ask for a maxElementSize during an incremental reflow. So on
// other reflows we will just have to use 0. The min height on the other
// hand is fairly easy we need to get the largest line height. This can be
// done with the line iterator.
// if we do have a rendering context
gfxContext* rendContext = aState.GetRenderingContext();
if (rendContext) {
nsPresContext* presContext = aState.PresContext();
// If we don't have any HTML constraints and it's a resize, then nothing in
// the block could have changed, so no refresh is necessary.
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (!XULNeedsRecalc(metrics->mBlockPrefSize)) {
return NS_OK;
}
// the rect we plan to size to.
nsRect rect = GetRect();
nsMargin bp(0, 0, 0, 0);
GetXULBorderAndPadding(bp);
{
// If we're a container for font size inflation, then shrink
// wrapping inside of us should not apply font size inflation.
AutoMaybeDisableFontInflation an(this);
metrics->mBlockPrefSize.width =
GetPrefISize(rendContext) + bp.LeftRight();
metrics->mBlockMinSize.width = GetMinISize(rendContext) + bp.LeftRight();
}
// do the nasty.
const WritingMode wm = aState.OuterReflowInput()
? aState.OuterReflowInput()->GetWritingMode()
: GetWritingMode();
ReflowOutput desiredSize(wm);
BoxReflow(aState, presContext, desiredSize, rendContext, rect.x, rect.y,
metrics->mBlockPrefSize.width, NS_UNCONSTRAINEDSIZE);
metrics->mBlockMinSize.height = 0;
// ok we need the max ascent of the items on the line. So to do this
// ask the block for its line iterator. Get the max ascent.
AutoAssertNoDomMutations guard;
if (IsBlockFrameOrSubclass()) {
nsILineIterator* lines = GetLineIterator();
MOZ_ASSERT(lines);
metrics->mBlockMinSize.height = 0;
int32_t lineCount = lines->GetNumLines();
for (int32_t i = 0; i < lineCount; ++i) {
auto line = lines->GetLine(i).unwrap();
if (line.mLineBounds.height > metrics->mBlockMinSize.height) {
metrics->mBlockMinSize.height = line.mLineBounds.height;
}
}
} else {
metrics->mBlockMinSize.height = desiredSize.Height();
}
metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height;
if (desiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
if (!nsLayoutUtils::GetFirstLineBaseline(wm, this,
&metrics->mBlockAscent))
metrics->mBlockAscent = GetLogicalBaseline(wm);
} else {
metrics->mBlockAscent = desiredSize.BlockStartAscent();
}
#ifdef DEBUG_adaptor
printf("min=(%d,%d), pref=(%d,%d), ascent=%d\n",
metrics->mBlockMinSize.width, metrics->mBlockMinSize.height,
metrics->mBlockPrefSize.width, metrics->mBlockPrefSize.height,
metrics->mBlockAscent);
#endif
}
return NS_OK;
}
nsSize nsIFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
nsSize size(0, 0);
DISPLAY_PREF_SIZE(this, size);
// If the size is cached, and there are no HTML constraints that we might
// be depending on, then we just return the cached size.
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (!XULNeedsRecalc(metrics->mPrefSize)) {
size = metrics->mPrefSize;
return size;
}
if (IsXULCollapsed()) return size;
// get our size in CSS.
bool widthSet, heightSet;
bool completelyRedefined =
nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet);
// Refresh our caches with new sizes.
if (!completelyRedefined) {
RefreshSizeCache(aState);
nsSize blockSize = metrics->mBlockPrefSize;
// notice we don't need to add our borders or padding
// in. That's because the block did it for us.
if (!widthSet) size.width = blockSize.width;
if (!heightSet) size.height = blockSize.height;
}
metrics->mPrefSize = size;
return size;
}
nsSize nsIFrame::GetXULMinSize(nsBoxLayoutState& aState) {
nsSize size(0, 0);
DISPLAY_MIN_SIZE(this, size);
// Don't use the cache if we have HTMLReflowInput constraints --- they might
// have changed
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (!XULNeedsRecalc(metrics->mMinSize)) {
size = metrics->mMinSize;
return size;
}
if (IsXULCollapsed()) return size;
// get our size in CSS.
bool widthSet, heightSet;
bool completelyRedefined =
nsIFrame::AddXULMinSize(this, size, widthSet, heightSet);
// Refresh our caches with new sizes.
if (!completelyRedefined) {
RefreshSizeCache(aState);
nsSize blockSize = metrics->mBlockMinSize;
if (!widthSet) size.width = blockSize.width;
if (!heightSet) size.height = blockSize.height;
}
metrics->mMinSize = size;
return size;
}
nsSize nsIFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
nsSize size(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
DISPLAY_MAX_SIZE(this, size);
// Don't use the cache if we have HTMLReflowInput constraints --- they might
// have changed
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (!XULNeedsRecalc(metrics->mMaxSize)) {
size = metrics->mMaxSize;
return size;
}
if (IsXULCollapsed()) return size;
size = nsIFrame::GetUncachedXULMaxSize(aState);
metrics->mMaxSize = size;
return size;
}
int32_t nsIFrame::GetXULFlex() const {
return clamped(int32_t(StyleXUL()->mBoxFlex), 0, nscoord_MAX - 1);
}
nscoord nsIFrame::GetXULBoxAscent(nsBoxLayoutState& aState) {
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (!XULNeedsRecalc(metrics->mAscent)) {
return metrics->mAscent;
}
if (IsXULCollapsed()) {
metrics->mAscent = 0;
} else {
// Refresh our caches with new sizes.
RefreshSizeCache(aState);
metrics->mAscent = metrics->mBlockAscent;
}
return metrics->mAscent;
}
nsresult nsIFrame::DoXULLayout(nsBoxLayoutState& aState) {
nsRect ourRect(mRect);
gfxContext* rendContext = aState.GetRenderingContext();
nsPresContext* presContext = aState.PresContext();
WritingMode ourWM = GetWritingMode();
const WritingMode outerWM = aState.OuterReflowInput()
? aState.OuterReflowInput()->GetWritingMode()
: ourWM;
ReflowOutput desiredSize(outerWM);
LogicalSize ourSize = GetLogicalSize(outerWM);
if (rendContext) {
BoxReflow(aState, presContext, desiredSize, rendContext, ourRect.x,
ourRect.y, ourRect.width, ourRect.height);
if (IsXULCollapsed()) {
SetSize(nsSize(0, 0));
} else {
// if our child needs to be bigger. This might happend with
// wrapping text. There is no way to predict its height until we
// reflow it. Now that we know the height reshuffle upward.
if (desiredSize.ISize(outerWM) > ourSize.ISize(outerWM) ||
desiredSize.BSize(outerWM) > ourSize.BSize(outerWM)) {
#ifdef DEBUG_GROW
XULDumpBox(stdout);
printf(" GREW from (%d,%d) -> (%d,%d)\n", ourSize.ISize(outerWM),
ourSize.BSize(outerWM), desiredSize.ISize(outerWM),
desiredSize.BSize(outerWM));
#endif
if (desiredSize.ISize(outerWM) > ourSize.ISize(outerWM)) {
ourSize.ISize(outerWM) = desiredSize.ISize(outerWM);
}
if (desiredSize.BSize(outerWM) > ourSize.BSize(outerWM)) {
ourSize.BSize(outerWM) = desiredSize.BSize(outerWM);
}
}
// ensure our size is what we think is should be. Someone could have
// reset the frame to be smaller or something dumb like that.
SetSize(ourSize.ConvertTo(ourWM, outerWM));
}
}
// Should we do this if IsXULCollapsed() is true?
LogicalSize size(GetLogicalSize(outerWM));
desiredSize.ISize(outerWM) = size.ISize(outerWM);
desiredSize.BSize(outerWM) = size.BSize(outerWM);
desiredSize.UnionOverflowAreasWithDesiredBounds();
if (HasAbsolutelyPositionedChildren()) {
// Set up a |reflowInput| to pass into ReflowAbsoluteFrames
ReflowInput reflowInput(aState.PresContext(), this,
aState.GetRenderingContext(),
LogicalSize(ourWM, ISize(), NS_UNCONSTRAINEDSIZE),
ReflowInput::InitFlag::DummyParentReflowInput);
AddStateBits(NS_FRAME_IN_REFLOW);
// Set up a |reflowStatus| to pass into ReflowAbsoluteFrames
// (just a dummy value; hopefully that's OK)
nsReflowStatus reflowStatus;
ReflowAbsoluteFrames(aState.PresContext(), desiredSize, reflowInput,
reflowStatus);
RemoveStateBits(NS_FRAME_IN_REFLOW);
}
nsSize oldSize(ourRect.Size());
FinishAndStoreOverflow(desiredSize.mOverflowAreas,
size.GetPhysicalSize(outerWM), &oldSize);
SyncXULLayout(aState);
return NS_OK;
}
void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
gfxContext* aRenderingContext, nscoord aX, nscoord aY,
nscoord aWidth, nscoord aHeight, bool aMoveFrame) {
DO_GLOBAL_REFLOW_COUNT("nsBoxToBlockAdaptor");
nsBoxLayoutMetrics* metrics = BoxMetrics();
if (MOZ_UNLIKELY(!metrics)) {
// Can't proceed without BoxMetrics. This should only happen if something
// is seriously broken, e.g. if we try to do XUL layout on a non-XUL frame.
// (If this is a content process, we'll abort even in release builds,
// because XUL layout mixup is extra surprising in content, and aborts are
// less catastrophic in content vs. in chrome.)
MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(),
"Starting XUL BoxReflow w/o BoxMetrics (in content)?");
MOZ_ASSERT_UNREACHABLE("Starting XUL BoxReflow w/o BoxMetrics?");
return;
}
nsReflowStatus status;
bool needsReflow = IsSubtreeDirty();
// if we don't need a reflow then
// lets see if we are already that size. Yes? then don't even reflow. We are
// done.
if (!needsReflow) {
if (aWidth != NS_UNCONSTRAINEDSIZE && aHeight != NS_UNCONSTRAINEDSIZE) {
// if the new calculated size has a 0 width or a 0 height
if ((metrics->mLastSize.width == 0 || metrics->mLastSize.height == 0) &&
(aWidth == 0 || aHeight == 0)) {
needsReflow = false;
aDesiredSize.Width() = aWidth;
aDesiredSize.Height() = aHeight;
SetSize(aDesiredSize.Size(GetWritingMode()));
} else {
aDesiredSize.Width() = metrics->mLastSize.width;
aDesiredSize.Height() = metrics->mLastSize.height;
// remove the margin. The rect of our child does not include it but our
// calculated size does. don't reflow if we are already the right size
if (metrics->mLastSize.width == aWidth &&
metrics->mLastSize.height == aHeight)
needsReflow = false;
else
needsReflow = true;
}
} else {
// if the width or height are intrinsic alway reflow because
// we don't know what it should be.
needsReflow = true;
}
}
// ok now reflow the child into the spacers calculated space
if (needsReflow) {
aDesiredSize.ClearSize();
// create a reflow input to tell our child to flow at the given size.
// Construct a bogus parent reflow input so that there's a usable reflow
// input for the containing block.
nsMargin margin(0, 0, 0, 0);
GetXULMargin(margin);
nsSize parentSize(aWidth, aHeight);
if (parentSize.height != NS_UNCONSTRAINEDSIZE)
parentSize.height += margin.TopBottom();
if (parentSize.width != NS_UNCONSTRAINEDSIZE)
parentSize.width += margin.LeftRight();
nsIFrame* parentFrame = GetParent();
WritingMode parentWM = parentFrame->GetWritingMode();
ReflowInput parentReflowInput(
aPresContext, parentFrame, aRenderingContext,
LogicalSize(parentWM, parentSize),
ReflowInput::InitFlag::DummyParentReflowInput);
// This may not do very much useful, but it's probably worth trying.
if (parentSize.width != NS_UNCONSTRAINEDSIZE)
parentReflowInput.SetComputedWidth(std::max(parentSize.width, 0));
if (parentSize.height != NS_UNCONSTRAINEDSIZE)
parentReflowInput.SetComputedHeight(std::max(parentSize.height, 0));
parentReflowInput.SetComputedLogicalMargin(parentWM,
LogicalMargin(parentWM));
// XXX use box methods
nsMargin padding;
parentFrame->GetXULPadding(padding);
parentReflowInput.SetComputedLogicalPadding(
parentWM, LogicalMargin(parentWM, padding));
nsMargin border;
parentFrame->GetXULBorder(border);
parentReflowInput.SetComputedLogicalBorderPadding(
parentWM, LogicalMargin(parentWM, border + padding));
// Construct the parent chain manually since constructing it normally
// messes up dimensions.
const ReflowInput* outerReflowInput = aState.OuterReflowInput();
NS_ASSERTION(!outerReflowInput || outerReflowInput->mFrame != this,
"in and out of XUL on a single frame?");
const ReflowInput* parentRI;
if (outerReflowInput && outerReflowInput->mFrame == parentFrame) {
// We're a frame (such as a text control frame) that jumps into
// box reflow and then straight out of it on the child frame.
// This means we actually have a real parent reflow input.
// nsLayoutUtils::InflationMinFontSizeFor used to need this to be
// linked up correctly for text control frames, so do so here).
parentRI = outerReflowInput;
} else {
parentRI = &parentReflowInput;
}
// XXX Is it OK that this reflow input has only one ancestor?
// (It used to have a bogus parent, skipping all the boxes).
WritingMode wm = GetWritingMode();
LogicalSize logicalSize(wm, nsSize(aWidth, aHeight));
logicalSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput reflowInput(aPresContext, *parentRI, this, logicalSize,
Nothing(),
ReflowInput::InitFlag::DummyParentReflowInput);
// XXX_jwir3: This is somewhat fishy. If this is actually changing the value
// here (which it might be), then we should make sure that it's
// correct the first time around, rather than changing it later.
reflowInput.mCBReflowInput = parentRI;
reflowInput.mReflowDepth = aState.GetReflowDepth();
// mComputedWidth and mComputedHeight are content-box, not
// border-box
if (aWidth != NS_UNCONSTRAINEDSIZE) {
nscoord computedWidth =
aWidth - reflowInput.ComputedPhysicalBorderPadding().LeftRight();
computedWidth = std::max(computedWidth, 0);
reflowInput.SetComputedWidth(computedWidth);
}
// Most child frames of box frames (e.g. subdocument or scroll frames)
// need to be constrained to the provided size and overflow as necessary.
// The one exception are block frames, because we need to know their
// natural height excluding any overflow area which may be caused by
// various CSS effects such as shadow or outline.
if (!IsBlockFrameOrSubclass()) {
if (aHeight != NS_UNCONSTRAINEDSIZE) {
nscoord computedHeight =
aHeight - reflowInput.ComputedPhysicalBorderPadding().TopBottom();
computedHeight = std::max(computedHeight, 0);
reflowInput.SetComputedHeight(computedHeight);
} else {
reflowInput.SetComputedHeight(
ComputeSize(
aRenderingContext, wm, logicalSize, logicalSize.ISize(wm),
reflowInput.ComputedLogicalMargin(wm).Size(wm),
reflowInput.ComputedLogicalBorderPadding(wm).Size(wm), {}, {})
.mLogicalSize.Height(wm));
}
}
// Box layout calls SetRect before XULLayout, whereas non-box layout
// calls SetRect after Reflow.
// XXX Perhaps we should be doing this by twiddling the rect back to
// mLastSize before calling Reflow and then switching it back, but
// However, mLastSize can also be the size passed to BoxReflow by
// RefreshSizeCache, so that doesn't really make sense.
if (metrics->mLastSize.width != aWidth) {
reflowInput.SetHResize(true);
// When font size inflation is enabled, a horizontal resize
// requires a full reflow. See ReflowInput::InitResizeFlags
// for more details.
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
this->MarkSubtreeDirty();
}
}
if (metrics->mLastSize.height != aHeight) {
reflowInput.SetVResize(true);
}
// place the child and reflow
Reflow(aPresContext, aDesiredSize, reflowInput, status);
NS_ASSERTION(status.IsComplete(), "bad status");
ReflowChildFlags layoutFlags = aState.LayoutFlags();
nsContainerFrame::FinishReflowChild(
this, aPresContext, aDesiredSize, &reflowInput, aX, aY,
layoutFlags | ReflowChildFlags::NoMoveFrame);
// Save the ascent. (bug 103925)
if (IsXULCollapsed()) {
metrics->mAscent = 0;
} else {
if (aDesiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
if (!nsLayoutUtils::GetFirstLineBaseline(wm, this, &metrics->mAscent))
metrics->mAscent = GetLogicalBaseline(wm);
} else
metrics->mAscent = aDesiredSize.BlockStartAscent();
}
} else {
aDesiredSize.SetBlockStartAscent(metrics->mBlockAscent);
}
metrics->mLastSize.width = aDesiredSize.Width();
metrics->mLastSize.height = aDesiredSize.Height();
}
nsBoxLayoutMetrics* nsIFrame::BoxMetrics() const {
nsBoxLayoutMetrics* metrics = GetProperty(BoxMetricsProperty());
NS_ASSERTION(
metrics,
"A box layout method was called but InitBoxMetrics was never called");
return metrics;
}
void nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
ServoRestyleState& aRestyleState) {
#ifdef DEBUG
@ -11347,14 +10787,6 @@ void nsIFrame::SetParent(nsContainerFrame* aParent) {
// Note that the current mParent may already be destroyed at this point.
mParent = aParent;
MOZ_DIAGNOSTIC_ASSERT(!mParent || PresShell() == mParent->PresShell());
if (::IsXULBoxWrapped(this)) {
::InitBoxMetrics(this, true);
} else {
// We could call Properties().Delete(BoxMetricsProperty()); here but
// that's kind of slow and re-parenting in such a way that we were
// IsXULBoxWrapped() before but not now should be very rare, so we'll just
// keep this unused frame property until this frame dies instead.
}
if (HasAnyStateBits(NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW)) {
for (nsIFrame* f = aParent;
@ -12475,7 +11907,6 @@ void DR_State::InitFrameTypeTable() {
AddFrameTypeInfo(LayoutFrameType::TextInput, "textCtl", "textInput");
AddFrameTypeInfo(LayoutFrameType::Text, "text", "text");
AddFrameTypeInfo(LayoutFrameType::Viewport, "VP", "viewport");
AddFrameTypeInfo(LayoutFrameType::Box, "Box", "Box");
AddFrameTypeInfo(LayoutFrameType::Slider, "Slider", "Slider");
AddFrameTypeInfo(LayoutFrameType::None, "unknown", "unknown");
}

View file

@ -111,8 +111,6 @@ class nsFrameSelection;
class nsIWidget;
class nsIScrollableFrame;
class nsISelectionController;
class nsBoxLayoutState;
class nsBoxLayout;
class nsILineIterator;
class gfxSkipChars;
class gfxSkipCharsIterator;
@ -125,7 +123,6 @@ class nsStyleChangeList;
class nsViewManager;
class nsWindowSizes;
struct nsBoxLayoutMetrics;
struct CharacterDataChangeInfo;
namespace mozilla {
@ -2403,13 +2400,10 @@ class nsIFrame : public nsQueryFrame {
*/
virtual void MarkIntrinsicISizesDirty();
private:
nsBoxLayoutMetrics* BoxMetrics() const;
public:
/**
* Make this frame and all descendants dirty (if not already).
* Exceptions: XULBoxFrame and TableColGroupFrame children.
* Exceptions: TableColGroupFrame children.
*/
void MarkSubtreeDirty();
@ -3294,23 +3288,22 @@ class nsIFrame : public nsQueryFrame {
// A frame that participates in inline reflow, i.e., one that
// requires ReflowInput::mLineLayout.
eLineParticipant = 1 << 6,
eXULBox = 1 << 7,
eCanContainOverflowContainers = 1 << 8,
eTablePart = 1 << 9,
eSupportsCSSTransforms = 1 << 10,
eCanContainOverflowContainers = 1 << 7,
eTablePart = 1 << 8,
eSupportsCSSTransforms = 1 << 9,
// A replaced element that has replaced-element sizing
// characteristics (i.e., like images or iframes), as opposed to
// inline-block sizing characteristics (like form controls).
eReplacedSizing = 1 << 11,
eReplacedSizing = 1 << 10,
// Does this frame class support 'contain: layout' and
// 'contain:paint' (supporting one is equivalent to supporting the
// other).
eSupportsContainLayoutAndPaint = 1 << 12,
eSupportsContainLayoutAndPaint = 1 << 11,
// Does this frame class support `aspect-ratio` property.
eSupportsAspectRatio = 1 << 13,
eSupportsAspectRatio = 1 << 12,
// These are to allow nsIFrame::Init to assert that IsFrameOfType
// implementations all call the base class method. They are only
@ -4267,125 +4260,15 @@ class nsIFrame : public nsQueryFrame {
[[nodiscard]] Focusable IsFocusable(bool aWithMouse = false,
bool aCheckVisibility = true);
// BOX LAYOUT METHODS
// These methods have been migrated from nsIBox and are in the process of
// being refactored. DO NOT USE OUTSIDE OF XUL.
bool IsXULBoxFrame() const { return IsFrameOfType(nsIFrame::eXULBox); }
enum Halignment { hAlign_Left, hAlign_Right, hAlign_Center };
enum Valignment { vAlign_Top, vAlign_Middle, vAlign_BaseLine, vAlign_Bottom };
/**
* This calculates the minimum size required for a box based on its state
* @param[in] aBoxLayoutState The desired state to calculate for
* @return The minimum size
*/
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState);
/**
* This calculates the preferred size of a box based on its state
* @param[in] aBoxLayoutState The desired state to calculate for
* @return The preferred size
*/
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState);
/**
* This calculates the maximum size for a box based on its state
* @param[in] aBoxLayoutState The desired state to calculate for
* @return The maximum size
*/
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState);
int32_t GetXULFlex() const;
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState);
virtual bool IsXULCollapsed();
// This does not alter the overflow area. If the caller is changing
// the box size, the caller is responsible for updating the overflow
// area. It's enough to just call XULLayout or SyncXULLayout on the
// box. You can pass true to aRemoveOverflowArea as a
// convenience.
virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState,
const nsRect& aRect,
bool aRemoveOverflowAreas = false);
nsresult XULLayout(nsBoxLayoutState& aBoxLayoutState);
// Box methods. Note that these do NOT just get the CSS border, padding,
// etc. They also talk to nsITheme.
virtual nsresult GetXULBorderAndPadding(nsMargin& aBorderAndPadding);
virtual nsresult GetXULBorder(nsMargin& aBorder);
virtual nsresult GetXULPadding(nsMargin& aBorderAndPadding);
virtual nsresult GetXULMargin(nsMargin& aMargin);
virtual void SetXULLayoutManager(nsBoxLayout* aLayout) {}
virtual nsBoxLayout* GetXULLayoutManager() { return nullptr; }
nsresult GetXULClientRect(nsRect& aContentRect);
virtual ReflowChildFlags GetXULLayoutFlags() {
return ReflowChildFlags::Default;
}
// For nsSprocketLayout
virtual Valignment GetXULVAlign() const { return vAlign_Top; }
virtual Halignment GetXULHAlign() const { return hAlign_Left; }
nsresult XULRedraw(nsBoxLayoutState& aState);
static bool AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
bool& aHeightSet);
static bool AddXULMinSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
bool& aHeightSet);
static bool AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
bool& aHeightSet);
static int32_t ComputeXULFlex(nsIFrame* aBox);
void AddXULBorderAndPadding(nsSize& aSize);
static void AddXULBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
static void AddXULMargin(nsIFrame* aChild, nsSize& aSize);
static void AddXULMargin(nsSize& aSize, const nsMargin& aMargin);
static nsSize XULBoundsCheckMinMax(const nsSize& aMinSize,
const nsSize& aMaxSize);
static nsSize XULBoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
const nsSize& aMaxSize);
static nscoord XULBoundsCheck(nscoord aMinSize, nscoord aPrefSize,
nscoord aMaxSize);
static nsIFrame* GetChildXULBox(const nsIFrame* aFrame);
static nsIFrame* GetNextXULBox(const nsIFrame* aFrame);
static nsIFrame* GetParentXULBox(const nsIFrame* aFrame);
protected:
// Helper for IsFocusable.
bool IsFocusableDueToScrollFrame();
/**
* Returns true if this box clips its children, e.g., if this box is an
* scrollbox.
* scrollbox or has overflow: clip in both axes.
*/
virtual bool DoesClipChildrenInBothAxes();
// We compute and store the HTML content's overflow area. So don't
// try to compute it in the box code.
virtual bool XULComputesOwnOverflowArea() { return true; }
nsresult SyncXULLayout(nsBoxLayoutState& aBoxLayoutState);
bool XULNeedsRecalc(const nsSize& aSize);
bool XULNeedsRecalc(nscoord aCoord);
void XULSizeNeedsRecalc(nsSize& aSize);
void XULCoordNeedsRecalc(nscoord& aCoord);
nsresult BeginXULLayout(nsBoxLayoutState& aState);
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
nsresult EndXULLayout(nsBoxLayoutState& aState);
nsSize GetUncachedXULMinSize(nsBoxLayoutState& aBoxLayoutState);
nsSize GetUncachedXULPrefSize(nsBoxLayoutState& aBoxLayoutState);
nsSize GetUncachedXULMaxSize(nsBoxLayoutState& aBoxLayoutState);
// END OF BOX LAYOUT METHODS
// The above methods have been migrated from nsIBox and are in the process of
// being refactored. DO NOT USE OUTSIDE OF XUL.
bool DoesClipChildrenInBothAxes() const;
/**
* NOTE: aStatus is assumed to be already-initialized. The reflow statuses of
@ -4399,13 +4282,6 @@ class nsIFrame : public nsQueryFrame {
bool aConstrainBSize = true);
private:
void BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
ReflowOutput& aDesiredSize, gfxContext* aRenderingContext,
nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
bool aMoveFrame = true);
NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
Maybe<nscoord> ComputeInlineSizeFromAspectRatio(
mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize,
const mozilla::LogicalSize& aContentEdgeToBoxSizing,

View file

@ -24,7 +24,6 @@
#include "FrameMetrics.h"
class gfxContext;
class nsBoxLayoutState;
class nsIScrollPositionListener;
class nsIFrame;
class nsPresContext;

View file

@ -45,27 +45,6 @@ NS_QUERYFRAME_HEAD(nsPlaceholderFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsIFrame)
#endif
/* virtual */
nsSize nsPlaceholderFrame::GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) {
nsSize size(0, 0);
DISPLAY_MIN_SIZE(this, size);
return size;
}
/* virtual */
nsSize nsPlaceholderFrame::GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) {
nsSize size(0, 0);
DISPLAY_PREF_SIZE(this, size);
return size;
}
/* virtual */
nsSize nsPlaceholderFrame::GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) {
nsSize size(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
DISPLAY_MAX_SIZE(this, size);
return size;
}
/* virtual */
void nsPlaceholderFrame::AddInlineMinISize(
gfxContext* aRenderingContext, nsIFrame::InlineMinISizeData* aData) {

View file

@ -93,38 +93,33 @@ class nsPlaceholderFrame final : public nsIFrame {
}
// nsIFrame overrides
// We need to override GetXULMinSize and GetXULPrefSize because XUL uses
// placeholders not within lines.
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) override;
void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override;
void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override;
#if defined(DEBUG) || (defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF))
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
#ifdef DEBUG_FRAME_DUMP
void List(FILE* out = stderr, const char* aPrefix = "",
ListFlags aFlags = ListFlags()) const override;
virtual nsresult GetFrameName(nsAString& aResult) const override;
nsresult GetFrameName(nsAString& aResult) const override;
#endif // DEBUG
virtual bool IsEmpty() override { return true; }
virtual bool IsSelfEmpty() override { return true; }
bool IsEmpty() override { return true; }
bool IsSelfEmpty() override { return true; }
virtual bool CanContinueTextRun() const override;
bool CanContinueTextRun() const override;
void SetLineIsEmptySoFar(bool aValue) {
AddOrRemoveStateBits(PLACEHOLDER_LINE_IS_EMPTY_SO_FAR, aValue);
@ -142,7 +137,7 @@ class nsPlaceholderFrame final : public nsIFrame {
}
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override {
mozilla::a11y::AccType AccessibleType() override {
nsIFrame* realFrame = GetRealFrameForPlaceholder(this);
return realFrame ? realFrame->AccessibleType() : nsIFrame::AccessibleType();
}

View file

@ -20,7 +20,6 @@
#include "nsGenericHTMLElement.h"
#include "nsPresContext.h"
#include "nsContentCreatorFunctions.h"
#include "nsBoxLayoutState.h"
#include "nsIContentInlines.h"
#include "nsImageFrame.h"
#include "nsIImageLoadingContent.h"
@ -748,8 +747,7 @@ void nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// but only want to draw mPosterImage conditionally. Others we
// always add to the display list.
for (nsIFrame* child : mFrames) {
if (child->GetContent() != mPosterImage || shouldDisplayPoster ||
child->IsBoxFrame()) {
if (child->GetContent() != mPosterImage || shouldDisplayPoster) {
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, child,
aBuilder->GetVisibleRect() - child->GetOffsetTo(this),

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var c = document.getElementById("C");
getComputedStyle(c, "").width; // flush
c.style.order = "2";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="A" value="A" />
<label id="C" value="C" />
<label id="B" value="B" />
</window>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var c = document.getElementById("C");
getComputedStyle(c, "").width; // flush
c.style.order = "2";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="B" value="B" style="order: 2" />
<label id="C" value="C" />
<label id="A" value="A" />
</window>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var b = document.getElementById("B");
getComputedStyle(b, "").width; // flush
b.style.order = "2";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="B" value="B" />
<label id="C" value="C" style="order: 2" />
<label id="A" value="A" />
</window>

View file

@ -1,7 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label id="A" value="A" />
<label id="B" value="B" />
<label id="C" value="C" />
</window>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var b = document.getElementById("B");
getComputedStyle(b, "").width; // flush
b.style.order = "";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="A" value="A" />
<label id="B" value="B" style="order: 2" />
<label id="C" value="C" />
</window>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var b = document.getElementById("B");
getComputedStyle(b, "").width; // flush
b.style.order = "";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="C" value="C" style="order: 2" />
<label id="A" value="A" />
<label id="B" value="B" style="order: 2" />
</window>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
<script type="application/javascript"><![CDATA[
function run() {
var a = document.getElementById("A");
getComputedStyle(a, "").width; // flush
a.style.order = "";
document.documentElement.removeAttribute("class");
}
]]></script>
<label id="C" value="C" style="order: 2" />
<label id="A" value="A" style="order: 2" />
<label id="B" value="B" />
</window>

View file

@ -1,6 +0,0 @@
== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-none-grouped.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
== chrome://reftest/content/box-ordinal/dynamic-1-add-to-one-grouped.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-one-grouped-1.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-one-grouped-2.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
== chrome://reftest/content/box-ordinal/dynamic-1-add-to-two-grouped-1.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
== chrome://reftest/content/box-ordinal/dynamic-1-add-to-two-grouped-2.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml

View file

@ -1,41 +0,0 @@
<!DOCTYPE html>
<title>Reference for bug 1580302</title>
<style>
.grid, .flex {
width: 60px;
height: 60px;
border: 1px solid black;
}
.grid { display: grid; }
.flex { display: flex; }
.fCol { flex-direction: column; }
.item {
background: lightblue;
}
.flexible {
flex: 1;
}
</style>
<body>
<!-- The item should fill the grid here (by virtue of the default-stretchy
behavior of justify-items and align-items): -->
<div class="grid">
<div class="item">e</div>
</div>
<!-- For the rest, the item should fill the flex container in the cross axis,
and if it's flexible, also fill the container in the main axis. -->
<div class="flex">
<div class="item">e</div>
</div>
<div class="flex">
<div class="item flexible">e</div>
</div>
<div class="flex fCol">
<div class="item">e</div>
</div>
<div class="flex fCol">
<div class="item flexible">e</div>
</div>
</body>

View file

@ -1,42 +0,0 @@
<!DOCTYPE html>
<title>Test for bug 1580302</title>
<style>
.grid, .flex {
width: 60px;
height: 60px;
border: 1px solid black;
}
.grid { display: grid; }
.flex { display: flex; }
.fCol { flex-direction: column; }
.item {
display: -moz-box;
background: lightblue;
}
.flexible {
flex: 1;
}
</style>
<body>
<!-- The item should fill the grid here (by virtue of justify-items/align-items
default behavior): -->
<div class="grid">
<div class="item">e</div>
</div>
<!-- For the rest, the item should fill the flex container in the cross axis,
and if it's flexible, also fill the container in the main axis. -->
<div class="flex">
<div class="item">e</div>
</div>
<div class="flex">
<div class="item flexible">e</div>
</div>
<div class="flex fCol">
<div class="item">e</div>
</div>
<div class="flex fCol">
<div class="item flexible">e</div>
</div>
</body>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root {
-moz-box-layout: flex;
}
hbox {
width: 100px;
}
</style>
</head>
<body>
<xul:hbox>
<xul:description>X</xul:description>
<xul:description flex="1" style="background: blue">X</xul:description>
</xul:hbox>
</body>
</html>

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: legacy; }
hbox {
width: 100px;
}
</style>
</head>
<body>
<xul:hbox>
<xul:description>X</xul:description>
<xul:description flex="1" style="background: blue">X</xul:description>
</xul:hbox>
</body>
</html>

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: flex; }
hbox {
width: 700px;
}
input {
-moz-box-flex: 1;
}
</style>
</head>
<body>
<xul:hbox>
<xul:description>X</xul:description>
<html:input flex="1" style="background: blue" value="X"/>
</xul:hbox>
</body>
</html>

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: legacy; }
hbox {
width: 700px;
}
input {
-moz-box-flex: 1;
}
</style>
</head>
<body>
<xul:hbox>
<xul:description>X</xul:description>
<html:input flex="1" style="background: blue" value="X"/>
</xul:hbox>
</body>
</html>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: flex; }
vbox {
height: 100px;
}
browser {
background-color: green;
}
</style>
</head>
<body>
<xul:vbox>
<xul:browser></xul:browser>
</xul:vbox>
</body>
</html>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: legacy; }
vbox {
height: 100px;
}
browser {
background-color: green;
}
</style>
</head>
<body>
<xul:vbox>
<xul:browser></xul:browser>
</xul:vbox>
</body>
</html>

View file

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: legacy; }
.scroll {
height: 100px;
width: 100px;
overflow: auto;
}
.scroll > vbox {
width: 100px;
height: 100px;
background: green;
}
.scroll > vbox[collapsed] {
border: 3px solid;
padding: 6px;
margin: 9px;
}
</style>
</head>
<body>
<xul:vbox class="scroll">
<xul:vbox/>
<xul:vbox collapsed="true"/>
</xul:vbox>
</body>
</html>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: legacy; }
.scroll {
height: 100px;
width: 100px;
background: green;
}
</style>
</head>
<body>
<xul:vbox class="scroll"/>
</body>
</html>

View file

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<style>
:root { -moz-box-layout: flex }
.scroll {
height: 100px;
width: 100px;
overflow: auto;
}
.scroll > vbox {
width: 100px;
height: 100px;
background: green;
}
.scroll > vbox[collapsed] {
border: 3px solid;
padding: 6px;
margin: 9px;
}
</style>
</head>
<body>
<xul:vbox class="scroll">
<xul:vbox/>
<xul:vbox collapsed="true"/>
</xul:vbox>
</body>
</html>

View file

@ -1,27 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<style>
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</body>
</html>

View file

@ -1,30 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase has a relatively-positioned -moz-box element, which should
form a containing block for its absolutely positioned child. -->
<html>
<head>
<style>
.box { display: -moz-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="box relpos_parent">
<div class="abspos_child"></div>
</div>
</body>
</html>

View file

@ -1,29 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase is the same as the -1a version, but with -moz-inline-box. -->
<html>
<head>
<style>
.box { display: -moz-inline-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="box relpos_parent">
<div class="abspos_child"></div>
</div>
</body>
</html>

View file

@ -1,33 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase is the same as the -1a version, but with an additional
-moz-box wrapper, so that our relatively positioned box will never get a
call to Reflow. -->
<html>
<head>
<style>
.box { display: -moz-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="box">
<div class="box relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase is the same as the -1c version, but with -moz-inline-box. -->
<html>
<head>
<style>
.box { display: -moz-inline-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="box">
<div class="box relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,27 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<style>
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
top: 10px;
width: 20px;
height: 150px;
background: purple;
}
</style>
</head>
<body>
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase has a relatively-positioned -moz-box element, which should
form a containing block for its absolutely positioned child. Also: in
this case, the child is taller than its container. -->
<html>
<head>
<style>
.box { display: -moz-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
top: 10px;
width: 20px;
height: 150px;
background: purple;
}
</style>
</head>
<body>
<div class="box relpos_parent">
<div class="abspos_child"></div>
</div>
</body>
</html>

View file

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: horizontal;
}
div > div {
display: -moz-box;
-moz-box-flex: 1;
border: 1px solid blue;
}
]]>
</style>
</head>
<body>
<div>
<div>width</div>
<div>height</div>
<div>minwidth</div>
<div>minheight</div>
<div>maxwidth</div>
<div>maxheight</div>
<div>flex</div>
</div>
</body>
</html>

View file

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: horizontal;
}
div > div {
display: -moz-box;
-moz-box-flex: 1;
border: 1px solid blue;
}
]]>
</style>
</head>
<body>
<div>
<div width="100">width</div>
<div height="100">height</div>
<div minwidth="100">minwidth</div>
<div minheight="100">minheight</div>
<div maxwidth="50">maxwidth</div>
<div maxheight="15">maxheight</div>
<div style="-moz-box-flex: 100">flex</div>
</div>
</body>
</html>

View file

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: vertical;
}
div > div {
display: -moz-box;
-moz-box-flex: 1;
border: 1px solid blue;
}
]]>
</style>
</head>
<body>
<div>
<div>width</div>
<div>height</div>
<div>minwidth</div>
<div>minheight</div>
<div>maxwidth</div>
<div>maxheight</div>
<div>flex</div>
</div>
</body>
</html>

View file

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: vertical;
}
div > div {
display: -moz-box;
-moz-box-flex: 1;
border: 1px solid blue;
}
]]>
</style>
</head>
<body>
<div>
<div width="100">width</div>
<div height="100">height</div>
<div minwidth="100">minwidth</div>
<div minheight="100">minheight</div>
<div maxwidth="50">maxwidth</div>
<div maxheight="15">maxheight</div>
<div style="-moz-box-flex: 100">flex</div>
</div>
</body>
</html>

View file

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
pointer-events: none;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: horizontal;
}
]]>
</style>
</head>
<body>
<div>
<input type="text" value="width" />
<input type="text" value="height" />
<input type="text" value="minwidth" />
<input type="text" value="minheight" />
<input type="text" value="maxwidth" />
<input type="text" value="maxheight" />
<input type="text" value="flex" />
</div>
</body>
</html>

View file

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
/* Disable pointer-events so we don't get weird hover artifacts */
pointer-events: none;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: horizontal;
}
]]>
</style>
</head>
<body>
<div>
<input type="text" width="100" value="width" />
<input type="text" height="100" value="height" />
<input type="text" minwidth="100" value="minwidth" />
<input type="text" minheight="100" value="minheight" />
<input type="text" maxwidth="50" value="maxwidth" />
<input type="text" maxheight="15" value="maxheight" />
<input type="text" style="-moz-box-flex: 100" value="flex" />
</div>
</body>
</html>

View file

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: vertical;
}
]]>
</style>
</head>
<body>
<div>
<input type="text" value="width" />
<input type="text" value="height" />
<input type="text" value="minwidth" />
<input type="text" value="minheight" />
<input type="text" value="maxwidth" />
<input type="text" value="maxheight" />
<input type="text" value="flex" />
</div>
</body>
</html>

View file

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test that XUL attributes are not supported on non-XUL elements</title>
<style type="text/css">
<![CDATA[
html, body {
display: -moz-box;
margin: 0; padding: 0;
width: 100%; height: 100%;
}
body > div {
display: -moz-box;
background: yellow;
-moz-box-flex: 1;
-moz-box-orient: vertical;
}
]]>
</style>
</head>
<body>
<div>
<input type="text" width="100" value="width" />
<input type="text" height="100" value="height" />
<input type="text" minwidth="100" value="minwidth" />
<input type="text" minheight="100" value="minheight" />
<input type="text" maxwidth="50" value="maxwidth" />
<input type="text" maxheight="5" value="maxheight" />
<input type="text" style="-moz-box-flex: 100" value="flex" />
</div>
</body>
</html>

View file

@ -1,29 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<style>
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div>
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,32 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase has a -moz-box element with a block as its only child, which
forms a containing block for an absolutely positioned grandchild. -->
<html>
<head>
<style>
.box { display: -moz-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 20px;
background: purple;
}
</style>
</head>
<body>
<div class="box">
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,30 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<style>
body { margin-top: 50px }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 130px;
background: purple;
}
</style>
</head>
<body>
<div>
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,34 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This testcase has a -moz-box element with a block as its only child, which
forms a containing block for an absolutely positioned grandchild. Also, in
this case, the grandchild is taller than its parent and grandparent. -->
<html>
<head>
<style>
body { margin-top: 50px }
.box { display: -moz-box }
.relpos_parent {
position: relative;
width: 100px;
height: 100px;
background: lightblue;
}
.abspos_child {
position: absolute;
left: 30px;
bottom: 10px;
width: 20px;
height: 130px;
background: purple;
}
</style>
</head>
<body>
<div class="box">
<div class="relpos_parent">
<div class="abspos_child"></div>
</div>
</div>
</body>
</html>

View file

@ -1,18 +0,0 @@
== chrome://reftest/content/box/box-as-grid-or-flex-item-1.html chrome://reftest/content/box/box-as-grid-or-flex-item-1-ref.html
== chrome://reftest/content/box/flex-emulation-1.xhtml chrome://reftest/content/box/flex-emulation-1-ref.xhtml
== chrome://reftest/content/box/flex-emulation-2.xhtml chrome://reftest/content/box/flex-emulation-2-ref.xhtml
== chrome://reftest/content/box/flex-emulation-4.xhtml chrome://reftest/content/box/flex-emulation-4-ref.xhtml
== chrome://reftest/content/box/flex-emulation-5.xhtml chrome://reftest/content/box/flex-emulation-5-ref.xhtml
== chrome://reftest/content/box/flex-emulation-5.xhtml chrome://reftest/content/box/flex-emulation-5-ref2.xhtml
== flexbox-abspos-container-1a.html flexbox-abspos-container-1-ref.html
== flexbox-abspos-container-1b.html flexbox-abspos-container-1-ref.html
== flexbox-abspos-container-1c.html flexbox-abspos-container-1-ref.html
== flexbox-abspos-container-1d.html flexbox-abspos-container-1-ref.html
== flexbox-abspos-container-2.html flexbox-abspos-container-2-ref.html
== flexbox-attributes-no-box-horizontal.xhtml flexbox-attributes-no-box-horizontal-ref.xhtml
== flexbox-attributes-no-box-vertical.xhtml flexbox-attributes-no-box-vertical-ref.xhtml
== flexbox-attributes-no-input-horizontal.xhtml flexbox-attributes-no-input-horizontal-ref.xhtml
== flexbox-attributes-no-input-vertical.xhtml flexbox-attributes-no-input-vertical-ref.xhtml
== flexbox-child-is-abspos-container-1.html flexbox-child-is-abspos-container-1-ref.html
== flexbox-child-is-abspos-container-2.html flexbox-child-is-abspos-container-2-ref.html

View file

@ -1,16 +0,0 @@
<html>
<head>
</head>
<body>
There should be floating text here! Look at the source!
This&nbsp;text&nbsp;should&nbsp;show&nbsp;up
<!-- using non-breaking spaces here because the box in the testcase
will always wrap (or not) as a complete unit, depending on
font size and window width -->
</body>
</html>

View file

@ -1,14 +0,0 @@
<html>
<head>
</head>
<body>
There should be floating text here! Look at the source!
<div style="display: -moz-inline-box;"><div style="float: left;">This&nbsp;text&nbsp;should&nbsp;show&nbsp;up</div></div>
<!-- using non-breaking spaces here to match the reference -->
</body>
</html>

View file

@ -1,10 +0,0 @@
<html><head>
<title>Testcase 3 for bug 413027 - Marquee height is sized too small, clipping text vertically</title>
</head>
<body>
<div style="background-color: lime; width: 600px; float:left;">
<div style="margin: 100px 0px;">text</div>
</div>
</body></html>

View file

@ -1,12 +0,0 @@
<html><head>
<title>Testcase 3 for bug 413027 - Marquee height is sized too small, clipping text vertically</title>
</head>
<body>
<div style="display: -moz-box; background-color: lime; width: 600px;">
<div>
<div style="margin: 100px 0px;">text</div>
</div>
</div>
</body></html>

View file

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body { padding-right: 100px; }
div.x1 { border: 1px solid purple; overflow-x: scroll; overflow-y: hidden; width: 300px; margin: 0 50px 0 0; padding: 0; }
div.x2 { height: 50px; }
span { display: inline-block; height: 50px; margin: 0; }
</style>
</head>
<body dir="rtl">
<div class="x1">
<span style="background: green; width: 50px; position: fixed; margin-inline-start: -50px"></span>
<div class="x2">
<span style="background: yellow; width: 400px; overflow: hidden"></span>
</div>
</div>
</body>
</html>

View file

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body { padding-right: 100px; }
div { border: 1px solid purple; overflow-x: scroll; overflow-y: hidden; width: 300px; margin: 0 50px 0 0; padding: 0; }
span { display: inline-block; height: 50px; margin: 0; }
</style>
</head>
<body dir="rtl">
<div style="display: -moz-box;">
<span style="background: green; width: 50px; position: fixed; margin-inline-start: -50px"></span>
<span style="background: yellow; width: 400px; overflow: hidden"></span>
</div>
</body>
</html>

View file

@ -1,7 +0,0 @@
<!DOCTYPE HTML>
<style type="text/css">
html, body { margin: 0; padding: 0; border: none; }
</style>
<div style="position: absolute; width: 200px; height: 400px; top: 100px; left: 100px; box-shadow: 0 0 14px blue">A</div>
<div style="position: absolute; width: 100px; height: 400px; top: 100px; left: 400px; box-shadow: 0 0 14px blue">B</div>

View file

@ -1,12 +0,0 @@
<!DOCTYPE HTML>
<style type="text/css">
html, body { margin: 0; padding: 0; border: none; }
</style>
<div style="margin: 100px; height: 400px; width: 400px; display: -moz-box; -moz-box-orient: horizontal">
<div style="width: 200px; box-shadow: 0 0 14px blue">A</div>
<div style="width: 100px"></div>
<div style="-moz-box-flex: 1; box-shadow: 0 0 14px blue">B</div>
</div>

View file

@ -4,12 +4,11 @@
<style>
body {
margin: 0;
display: -moz-box;
-moz-box-orient: horizontal;
display: flex;
width: 400px;
}
canvas {
-moz-box-flex: 1;
flex: 1;
opacity: 0.999;
border: 1px solid black;
}

View file

@ -425,7 +425,6 @@ fuzzy(0-1,0-1) == 315920-20.svg 315920-20-ref.svg
== chrome://reftest/content/bugs/321402-5.xhtml chrome://reftest/content/bugs/321402-5-ref.xhtml
== chrome://reftest/content/bugs/321402-6.xhtml chrome://reftest/content/bugs/321402-6-ref.xhtml
== 321738-1.html 321738-1-ref.html
== chrome://reftest/content/bugs/322436-1.html chrome://reftest/content/bugs/322436-1-ref.html
== 322461-1.xml 322461-1-ref.html
== 323656-1.html 323656-1-ref.html
== 323656-2.html 323656-2-ref.html
@ -934,7 +933,6 @@ fails == 411585-3.html 411585-3-ref.html # bug 426909
== 412607-1b.html 412607-1-ref.html
== 412679-1.html 412679-1-ref.html
fuzzy(0-1,0-17) == 412679-2.html 412679-2-ref.html
== chrome://reftest/content/bugs/413027-1.html chrome://reftest/content/bugs/413027-1-ref.html
fails == 413027-2.html 413027-2-ref.html
fails == 413027-3.html 413027-3-ref.html
== 413286-1a.html 413286-1-ref.html
@ -1364,7 +1362,6 @@ fuzzy-if(Android,0-5,0-2800) == 506481-1.html 506481-1-ref.html
== 507762-2.html 507762-2-ref.html
== 507762-3.html 507762-1-ref.html
== 507762-4.html 507762-2-ref.html
== chrome://reftest/content/bugs/508816-2.html chrome://reftest/content/bugs/508816-2-ref.html
== 508919-1.xhtml 508919-1-ref.xhtml
== 509155-1.xhtml 509155-1-ref.xhtml
fuzzy(0-1,0-1200) == 512410.html 512410-ref.html
@ -1403,7 +1400,6 @@ fuzzy(0-5,0-50) == 526463-1.html 526463-1-ref.html
== 528038-2.html 528038-2-ref.html
== 528096-1.html 528096-1-ref.html
== 530686-1.html 530686-1-ref.html
== chrome://reftest/content/bugs/531098-1.html chrome://reftest/content/bugs/531098-1-ref.html
fuzzy-if(Android,0-2,0-48) fuzzy-if(cocoaWidget&&swgl,0-1,0-3) == 531200-1.html 531200-1-ref.html
== 531371-1.html 531371-1-ref.html
== 534526-1a.html 534526-1-ref.html
@ -1513,7 +1509,7 @@ random-if(!winWidget) == 574907-2.html 574907-2-ref.html
random-if(!winWidget) != 574907-3.html 574907-3-notref.html
== 577838-1.html 577838-1-ref.html
== 577838-2.html 577838-2-ref.html
pref(layout.css.moz-box-flexbox-emulation.enabled,true) == chrome://reftest/content/bugs/579323-1.html chrome://reftest/content/bugs/579323-1-ref.html
== chrome://reftest/content/bugs/579323-1.html chrome://reftest/content/bugs/579323-1-ref.html
== 579349-1.html 579349-1-ref.html
== 579655-1.html 579655-1-ref.html
fails-if(Android) random-if(layersGPUAccelerated) fuzzy(0-1,0-10000) == 579985-1.html 579985-1-ref.html # this bug was only for a regression in BasicLayers anyway

View file

@ -35,12 +35,6 @@ include border-image/reftest.list
# border-radius/
include border-radius/reftest.list
# -moz-box tests
include box/reftest.list
# box-ordinal/
include box-ordinal/reftest.list
# box-properties/
include box-properties/reftest.list

View file

@ -85,12 +85,6 @@ enum class StyleDisplay : uint16_t {
StyleDisplayInside::RubyText),
RubyTextContainer = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
StyleDisplayInside::RubyTextContainer),
/// XUL boxes.
MozBox =
StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox),
MozInlineBox =
StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox),
};
// The order of the StyleDisplay values isn't meaningful.
bool operator<(const StyleDisplay&, const StyleDisplay&) = delete;
@ -513,12 +507,6 @@ enum class StyleTextOrientation : uint8_t {
Sideways,
};
// Whether to emulate -moz-box with flex. See nsStyleVisibility
enum class StyleMozBoxLayout : uint8_t {
Flex,
Legacy,
};
// Whether flexbox visibility: collapse items use legacy -moz-box behavior or
// not.
enum class StyleMozBoxCollapse : uint8_t {

View file

@ -2695,7 +2695,6 @@ nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
mImageRendering(StyleImageRendering::Auto),
mWritingMode(StyleWritingModeProperty::HorizontalTb),
mTextOrientation(StyleTextOrientation::Mixed),
mMozBoxLayout(StyleMozBoxLayout::Flex),
mMozBoxCollapse(StyleMozBoxCollapse::Flex),
mPrintColorAdjust(StylePrintColorAdjust::Economy),
mImageOrientation(StyleImageOrientation::FromImage) {
@ -2708,7 +2707,6 @@ nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
mImageRendering(aSource.mImageRendering),
mWritingMode(aSource.mWritingMode),
mTextOrientation(aSource.mTextOrientation),
mMozBoxLayout(aSource.mMozBoxLayout),
mMozBoxCollapse(aSource.mMozBoxCollapse),
mPrintColorAdjust(aSource.mPrintColorAdjust),
mImageOrientation(aSource.mImageOrientation) {
@ -2720,8 +2718,7 @@ nsChangeHint nsStyleVisibility::CalcDifference(
nsChangeHint hint = nsChangeHint(0);
if (mDirection != aNewData.mDirection ||
mWritingMode != aNewData.mWritingMode ||
mMozBoxLayout != aNewData.mMozBoxLayout) {
mWritingMode != aNewData.mWritingMode) {
// It's important that a change in mWritingMode results in frame
// reconstruction, because it may affect intrinsic size (see
// nsSubDocumentFrame::GetIntrinsicISize/BSize).

View file

@ -1077,10 +1077,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
mVisible == mozilla::StyleVisibility::Collapse;
}
bool EmulateMozBoxWithFlex() const {
return mMozBoxLayout == mozilla::StyleMozBoxLayout::Flex;
}
bool UseLegacyCollapseBehavior() const {
return mMozBoxCollapse == mozilla::StyleMozBoxCollapse::Legacy;
}
@ -1116,7 +1112,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
mozilla::StyleImageRendering mImageRendering;
mozilla::StyleWritingModeProperty mWritingMode;
mozilla::StyleTextOrientation mTextOrientation;
mozilla::StyleMozBoxLayout mMozBoxLayout;
mozilla::StyleMozBoxCollapse mMozBoxCollapse;
mozilla::StylePrintColorAdjust mPrintColorAdjust;
@ -1494,8 +1489,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
if (outside == mozilla::StyleDisplayOutside::Block) {
return false;
}
return mozilla::StyleDisplay::MozInlineBox == aDisplay ||
mozilla::StyleDisplay::RubyBase == aDisplay ||
return mozilla::StyleDisplay::RubyBase == aDisplay ||
mozilla::StyleDisplay::RubyBaseContainer == aDisplay ||
mozilla::StyleDisplay::RubyText == aDisplay ||
mozilla::StyleDisplay::RubyTextContainer == aDisplay;

View file

@ -21,7 +21,6 @@
-moz-font-smoothing-background-color: initial;
-moz-min-font-size-ratio: initial;
-moz-box-collapse: initial;
-moz-box-layout: initial;
math-depth: initial;
/* As long as inert implies pointer-events: none as it does now, we're

View file

@ -103,7 +103,6 @@ const char* gInaccessibleProperties[] = {
"-moz-top-layer", // parsed by UA sheets only
"-moz-min-font-size-ratio", // parsed by UA sheets only
"-moz-box-collapse", // chrome-only internal properties
"-moz-box-layout", // chrome-only internal properties
"-moz-font-smoothing-background-color", // chrome-only internal properties
"-moz-subtree-hidden-only-visually", // chrome-only internal properties
"-moz-window-input-region-margin", // chrome-only internal properties

View file

@ -20,9 +20,6 @@ EXPORTS += [
UNIFIED_SOURCES += [
"MiddleCroppingLabelFrame.cpp",
"nsBox.cpp",
"nsBoxLayoutState.cpp",
"nsLeafBoxFrame.cpp",
"nsMenuPopupFrame.cpp",
"nsRepeatService.cpp",
"nsScrollbarButtonFrame.cpp",

View file

@ -1,585 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "mozilla/Attributes.h"
#include "mozilla/StaticPtr.h"
#include "nsIFrame.h"
#include "nsBoxLayoutState.h"
#include "nsDOMAttributeMap.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsContainerFrame.h"
#include "nsNameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsITheme.h"
#include "nsLayoutUtils.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/Element.h"
#include <algorithm>
using namespace mozilla;
nsresult nsIFrame::BeginXULLayout(nsBoxLayoutState& aState) {
// mark ourselves as dirty so no child under us
// can post an incremental layout.
// XXXldb Is this still needed?
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
// If the parent is dirty, all the children are dirty (ReflowInput
// does this too).
nsIFrame* box;
for (box = GetChildXULBox(this); box; box = GetNextXULBox(box))
box->MarkSubtreeDirty();
}
// Another copy-over from ReflowInput.
// Since we are in reflow, we don't need to store these properties anymore.
RemoveProperty(UsedBorderProperty());
RemoveProperty(UsedPaddingProperty());
RemoveProperty(UsedMarginProperty());
return NS_OK;
}
nsresult nsIFrame::EndXULLayout(nsBoxLayoutState& aState) {
return SyncXULLayout(aState);
}
nsresult nsIFrame::GetXULClientRect(nsRect& aClientRect) {
aClientRect = mRect;
aClientRect.MoveTo(0, 0);
nsMargin borderPadding;
GetXULBorderAndPadding(borderPadding);
aClientRect.Deflate(borderPadding);
if (aClientRect.width < 0) aClientRect.width = 0;
if (aClientRect.height < 0) aClientRect.height = 0;
return NS_OK;
}
void nsIFrame::SetXULBounds(nsBoxLayoutState& aState, const nsRect& aRect,
bool aRemoveOverflowAreas) {
nsRect rect(mRect);
ReflowChildFlags flags = GetXULLayoutFlags() | aState.LayoutFlags();
if ((flags & ReflowChildFlags::NoMoveFrame) ==
ReflowChildFlags::NoMoveFrame) {
SetSize(aRect.Size());
} else {
SetRect(aRect);
}
// Nuke the overflow area. The caller is responsible for restoring
// it if necessary.
if (aRemoveOverflowAreas) {
// remove the previously stored overflow area
ClearOverflowRects();
}
if (!(flags & ReflowChildFlags::NoMoveView)) {
nsContainerFrame::PositionFrameView(this);
if ((rect.x != aRect.x) || (rect.y != aRect.y))
nsContainerFrame::PositionChildViews(this);
}
}
nsresult nsIFrame::GetXULBorderAndPadding(nsMargin& aBorderAndPadding) {
aBorderAndPadding.SizeTo(0, 0, 0, 0);
nsresult rv = GetXULBorder(aBorderAndPadding);
if (NS_FAILED(rv)) return rv;
nsMargin padding;
rv = GetXULPadding(padding);
if (NS_FAILED(rv)) return rv;
aBorderAndPadding += padding;
return rv;
}
nsresult nsIFrame::GetXULBorder(nsMargin& aBorder) {
aBorder.SizeTo(0, 0, 0, 0);
StyleAppearance appearance = StyleDisplay()->EffectiveAppearance();
if (appearance != StyleAppearance::None) {
// Go to the theme for the border.
nsPresContext* pc = PresContext();
nsITheme* theme = pc->Theme();
if (theme->ThemeSupportsWidget(pc, this, appearance)) {
LayoutDeviceIntMargin margin =
theme->GetWidgetBorder(pc->DeviceContext(), this, appearance);
aBorder =
LayoutDevicePixel::ToAppUnits(margin, pc->AppUnitsPerDevPixel());
return NS_OK;
}
}
aBorder = StyleBorder()->GetComputedBorder();
return NS_OK;
}
nsresult nsIFrame::GetXULPadding(nsMargin& aBorderAndPadding) {
StyleAppearance appearance = StyleDisplay()->EffectiveAppearance();
if (appearance != StyleAppearance::None) {
// Go to the theme for the padding.
nsPresContext* pc = PresContext();
nsITheme* theme = pc->Theme();
if (theme->ThemeSupportsWidget(pc, this, appearance)) {
LayoutDeviceIntMargin padding;
bool useThemePadding = theme->GetWidgetPadding(pc->DeviceContext(), this,
appearance, &padding);
if (useThemePadding) {
aBorderAndPadding =
LayoutDevicePixel::ToAppUnits(padding, pc->AppUnitsPerDevPixel());
return NS_OK;
}
}
}
aBorderAndPadding.SizeTo(0, 0, 0, 0);
StylePadding()->GetPadding(aBorderAndPadding);
return NS_OK;
}
nsresult nsIFrame::GetXULMargin(nsMargin& aMargin) {
aMargin.SizeTo(0, 0, 0, 0);
StyleMargin()->GetMargin(aMargin);
return NS_OK;
}
void nsIFrame::XULSizeNeedsRecalc(nsSize& aSize) {
aSize.width = -1;
aSize.height = -1;
}
void nsIFrame::XULCoordNeedsRecalc(nscoord& aCoord) { aCoord = -1; }
bool nsIFrame::XULNeedsRecalc(const nsSize& aSize) {
return (aSize.width == -1 || aSize.height == -1);
}
bool nsIFrame::XULNeedsRecalc(nscoord aCoord) { return (aCoord == -1); }
nsSize nsIFrame::GetUncachedXULPrefSize(nsBoxLayoutState& aBoxLayoutState) {
NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
"must have rendering context");
nsSize pref(0, 0);
DISPLAY_PREF_SIZE(this, pref);
if (IsXULCollapsed()) {
return pref;
}
AddXULBorderAndPadding(pref);
bool widthSet, heightSet;
nsIFrame::AddXULPrefSize(this, pref, widthSet, heightSet);
nsSize minSize = GetXULMinSize(aBoxLayoutState);
nsSize maxSize = GetXULMaxSize(aBoxLayoutState);
return XULBoundsCheck(minSize, pref, maxSize);
}
nsSize nsIFrame::GetUncachedXULMinSize(nsBoxLayoutState& aBoxLayoutState) {
NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
"must have rendering context");
nsSize min(0, 0);
DISPLAY_MIN_SIZE(this, min);
if (IsXULCollapsed()) {
return min;
}
AddXULBorderAndPadding(min);
bool widthSet, heightSet;
nsIFrame::AddXULMinSize(this, min, widthSet, heightSet);
return min;
}
nsSize nsIFrame::GetUncachedXULMaxSize(nsBoxLayoutState& aBoxLayoutState) {
NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
"must have rendering context");
nsSize maxSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
DISPLAY_MAX_SIZE(this, maxSize);
if (IsXULCollapsed()) {
return maxSize;
}
AddXULBorderAndPadding(maxSize);
bool widthSet, heightSet;
nsIFrame::AddXULMaxSize(this, maxSize, widthSet, heightSet);
return maxSize;
}
bool nsIFrame::IsXULCollapsed() {
return StyleVisibility()->mVisible == StyleVisibility::Collapse;
}
nsresult nsIFrame::XULLayout(nsBoxLayoutState& aState) {
NS_ASSERTION(aState.GetRenderingContext(), "must have rendering context");
nsIFrame* box = static_cast<nsIFrame*>(this);
DISPLAY_LAYOUT(box);
box->BeginXULLayout(aState);
box->DoXULLayout(aState);
box->EndXULLayout(aState);
return NS_OK;
}
bool nsIFrame::DoesClipChildrenInBothAxes() {
const nsStyleDisplay* display = StyleDisplay();
return display->mOverflowX == StyleOverflow::Clip &&
display->mOverflowY == StyleOverflow::Clip;
}
nsresult nsIFrame::SyncXULLayout(nsBoxLayoutState& aBoxLayoutState) {
/*
if (IsXULCollapsed()) {
CollapseChild(aBoxLayoutState, this, true);
return NS_OK;
}
*/
if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
XULRedraw(aBoxLayoutState);
}
RemoveStateBits(NS_FRAME_HAS_DIRTY_CHILDREN | NS_FRAME_IS_DIRTY |
NS_FRAME_FIRST_REFLOW | NS_FRAME_IN_REFLOW);
nsPresContext* presContext = aBoxLayoutState.PresContext();
ReflowChildFlags flags = GetXULLayoutFlags() | aBoxLayoutState.LayoutFlags();
nsRect inkOverflow;
if (XULComputesOwnOverflowArea()) {
inkOverflow = InkOverflowRect();
} else {
nsRect rect(nsPoint(0, 0), GetSize());
OverflowAreas overflowAreas(rect, rect);
if (!DoesClipChildrenInBothAxes() && !IsXULCollapsed()) {
// See if our child frames caused us to overflow after being laid
// out. If so, store the overflow area. This normally can't happen
// in XUL, but it can happen with the CSS 'outline' property and
// possibly with other exotic stuff (e.g. relatively positioned
// frames in HTML inside XUL).
nsLayoutUtils::UnionChildOverflow(this, overflowAreas);
}
FinishAndStoreOverflow(overflowAreas, GetSize());
inkOverflow = overflowAreas.InkOverflow();
}
nsView* view = GetView();
if (view) {
// Make sure the frame's view is properly sized and positioned and has
// things like opacity correct
nsContainerFrame::SyncFrameViewAfterReflow(presContext, this, view,
inkOverflow, flags);
}
return NS_OK;
}
nsresult nsIFrame::XULRedraw(nsBoxLayoutState& aState) {
if (aState.PaintingDisabled()) return NS_OK;
// Unclear whether we could get away with just InvalidateFrame().
InvalidateFrameSubtree();
return NS_OK;
}
bool nsIFrame::AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
bool& aHeightSet) {
aWidthSet = false;
aHeightSet = false;
// add in the css min, max, pref
const nsStylePosition* position = aBox->StylePosition();
// see if the width or height was specifically set
// XXX Handle eStyleUnit_Enumerated?
// (Handling the eStyleUnit_Enumerated types requires
// GetXULPrefSize/GetXULMinSize methods that don't consider
// (min-/max-/)(width/height) properties.)
const auto& width = position->mWidth;
if (width.ConvertsToLength()) {
aSize.width = std::max(0, width.ToLength());
aWidthSet = true;
}
const auto& height = position->mHeight;
if (height.ConvertsToLength()) {
aSize.height = std::max(0, height.ToLength());
aHeightSet = true;
}
nsIContent* content = aBox->GetContent();
// ignore 'height' and 'width' attributes if the actual element is not XUL
// For example, we might be magic XUL frames whose primary content is an HTML
// <select>
if (content && content->IsXULElement()) {
nsAutoString value;
nsresult error;
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
if (!value.IsEmpty()) {
value.Trim("%");
aSize.width = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aWidthSet = true;
}
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::height, value);
if (!value.IsEmpty()) {
value.Trim("%");
aSize.height =
nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aHeightSet = true;
}
}
return (aWidthSet && aHeightSet);
}
bool nsIFrame::AddXULMinSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
bool& aHeightSet) {
aWidthSet = false;
aHeightSet = false;
nsPresContext* pc = aBox->PresContext();
// See if a native theme wants to supply a minimum size.
const nsStyleDisplay* display = aBox->StyleDisplay();
if (display->HasAppearance()) {
nsITheme* theme = pc->Theme();
StyleAppearance appearance = display->EffectiveAppearance();
if (theme->ThemeSupportsWidget(pc, aBox, appearance)) {
LayoutDeviceIntSize size =
theme->GetMinimumWidgetSize(pc, aBox, appearance);
if (size.width) {
aSize.width = pc->DevPixelsToAppUnits(size.width);
aWidthSet = true;
}
if (size.height) {
aSize.height = pc->DevPixelsToAppUnits(size.height);
aHeightSet = true;
}
}
}
// add in the css min, max, pref
const nsStylePosition* position = aBox->StylePosition();
const auto& minWidth = position->mMinWidth;
if (minWidth.ConvertsToLength()) {
nscoord min = minWidth.ToLength();
if (!aWidthSet || min > aSize.width) {
aSize.width = min;
aWidthSet = true;
}
} else if (minWidth.ConvertsToPercentage()) {
NS_ASSERTION(minWidth.ToPercentage() == 0.0f,
"Non-zero percentage values not currently supported");
aSize.width = 0;
aWidthSet = true; // FIXME: should we really do this for
// nonzero values?
}
// XXX Handle ExtremumLength?
// (Handling them requires GetXULPrefSize/GetXULMinSize methods that don't
// consider (min-/max-/)(width/height) properties.
// calc() with percentage is treated like '0' (unset)
const auto& minHeight = position->mMinHeight;
if (minHeight.ConvertsToLength()) {
nscoord min = minHeight.ToLength();
if (!aHeightSet || min > aSize.height) {
aSize.height = min;
aHeightSet = true;
}
} else if (minHeight.ConvertsToPercentage()) {
NS_ASSERTION(position->mMinHeight.ToPercentage() == 0.0f,
"Non-zero percentage values not currently supported");
aSize.height = 0;
aHeightSet = true; // FIXME: should we really do this for
// nonzero values?
}
// calc() with percentage is treated like '0' (unset)
nsIContent* content = aBox->GetContent();
if (content && content->IsXULElement()) {
nsAutoString value;
nsresult error;
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth,
value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
if (val > aSize.width) aSize.width = val;
aWidthSet = true;
}
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::minheight,
value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
if (val > aSize.height) aSize.height = val;
aHeightSet = true;
}
}
return (aWidthSet && aHeightSet);
}
bool nsIFrame::AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
bool& aHeightSet) {
aWidthSet = false;
aHeightSet = false;
// add in the css min, max, pref
const nsStylePosition* position = aBox->StylePosition();
// and max
// see if the width or height was specifically set
// XXX Handle eStyleUnit_Enumerated?
// (Handling the eStyleUnit_Enumerated types requires
// GetXULPrefSize/GetXULMinSize methods that don't consider
// (min-/max-/)(width/height) properties.)
const auto& maxWidth = position->mMaxWidth;
if (maxWidth.ConvertsToLength()) {
aSize.width = maxWidth.ToLength();
aWidthSet = true;
}
// percentages and calc() with percentages are treated like 'none'
const auto& maxHeight = position->mMaxHeight;
if (maxHeight.ConvertsToLength()) {
aSize.height = maxHeight.ToLength();
aHeightSet = true;
}
// percentages and calc() with percentages are treated like 'none'
nsIContent* content = aBox->GetContent();
if (content && content->IsXULElement()) {
nsAutoString value;
nsresult error;
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth,
value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aSize.width = val;
aWidthSet = true;
}
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::maxheight,
value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aSize.height = val;
aHeightSet = true;
}
}
return (aWidthSet || aHeightSet);
}
void nsIFrame::AddXULBorderAndPadding(nsSize& aSize) {
AddXULBorderAndPadding(this, aSize);
}
void nsIFrame::AddXULBorderAndPadding(nsIFrame* aBox, nsSize& aSize) {
nsMargin borderPadding(0, 0, 0, 0);
aBox->GetXULBorderAndPadding(borderPadding);
AddXULMargin(aSize, borderPadding);
}
void nsIFrame::AddXULMargin(nsIFrame* aChild, nsSize& aSize) {
nsMargin margin(0, 0, 0, 0);
aChild->GetXULMargin(margin);
AddXULMargin(aSize, margin);
}
void nsIFrame::AddXULMargin(nsSize& aSize, const nsMargin& aMargin) {
if (aSize.width != NS_UNCONSTRAINEDSIZE)
aSize.width += aMargin.left + aMargin.right;
if (aSize.height != NS_UNCONSTRAINEDSIZE)
aSize.height += aMargin.top + aMargin.bottom;
}
nscoord nsIFrame::XULBoundsCheck(nscoord aMin, nscoord aPref, nscoord aMax) {
if (aPref > aMax) aPref = aMax;
if (aPref < aMin) aPref = aMin;
return aPref;
}
nsSize nsIFrame::XULBoundsCheckMinMax(const nsSize& aMinSize,
const nsSize& aMaxSize) {
return nsSize(std::max(aMaxSize.width, aMinSize.width),
std::max(aMaxSize.height, aMinSize.height));
}
nsSize nsIFrame::XULBoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
const nsSize& aMaxSize) {
return nsSize(
XULBoundsCheck(aMinSize.width, aPrefSize.width, aMaxSize.width),
XULBoundsCheck(aMinSize.height, aPrefSize.height, aMaxSize.height));
}
/*static*/
nsIFrame* nsIFrame::GetChildXULBox(const nsIFrame* aFrame) {
// box layout ends at box-wrapped frames, so don't allow these frames
// to report child boxes.
return aFrame->IsXULBoxFrame() ? aFrame->PrincipalChildList().FirstChild()
: nullptr;
}
/*static*/
nsIFrame* nsIFrame::GetNextXULBox(const nsIFrame* aFrame) {
return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame()
? aFrame->GetNextSibling()
: nullptr;
}
/*static*/
nsIFrame* nsIFrame::GetParentXULBox(const nsIFrame* aFrame) {
return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame()
? aFrame->GetParent()
: nullptr;
}

View file

@ -1,37 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
//
// Eric Vaughan
// Netscape Communications
//
// See documentation in associated header file
//
#include "nsBoxLayoutState.h"
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
gfxContext* aRenderingContext,
const ReflowInput* aOuterReflowInput,
uint16_t aReflowDepth)
: mPresContext(aPresContext),
mRenderingContext(aRenderingContext),
mOuterReflowInput(aOuterReflowInput),
mLayoutFlags(nsIFrame::ReflowChildFlags::Default),
mReflowDepth(aReflowDepth),
mPaintingDisabled(false) {
NS_ASSERTION(mPresContext, "PresContext must be non-null");
}
nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
: mPresContext(aState.mPresContext),
mRenderingContext(aState.mRenderingContext),
mOuterReflowInput(aState.mOuterReflowInput),
mLayoutFlags(aState.mLayoutFlags),
mReflowDepth(aState.mReflowDepth + 1),
mPaintingDisabled(aState.mPaintingDisabled) {
NS_ASSERTION(mPresContext, "PresContext must be non-null");
}

View file

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsBoxLayoutState_h___
#define nsBoxLayoutState_h___
#include "nsCOMPtr.h"
#include "nsPresContext.h"
#include "nsIFrame.h"
class gfxContext;
namespace mozilla {
class PresShell;
struct ReflowInput;
} // namespace mozilla
class MOZ_STACK_CLASS nsBoxLayoutState {
using ReflowInput = mozilla::ReflowInput;
public:
explicit nsBoxLayoutState(nsPresContext* aPresContext,
gfxContext* aRenderingContext = nullptr,
// see OuterReflowInput() below
const ReflowInput* aOuterReflowInput = nullptr,
uint16_t aReflowDepth = 0);
nsBoxLayoutState(const nsBoxLayoutState& aState);
nsPresContext* PresContext() const { return mPresContext; }
mozilla::PresShell* PresShell() const { return mPresContext->PresShell(); }
nsIFrame::ReflowChildFlags LayoutFlags() const { return mLayoutFlags; }
void SetLayoutFlags(nsIFrame::ReflowChildFlags aFlags) {
mLayoutFlags = aFlags;
}
// if true no one under us will paint during reflow.
void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
bool PaintingDisabled() const { return mPaintingDisabled; }
// The rendering context may be null for specialized uses of
// nsBoxLayoutState and should be null-checked before it is used.
// However, passing a null rendering context to the constructor when
// doing box layout or intrinsic size calculation will cause bugs.
gfxContext* GetRenderingContext() const { return mRenderingContext; }
struct AutoReflowDepth {
explicit AutoReflowDepth(nsBoxLayoutState& aState) : mState(aState) {
++mState.mReflowDepth;
}
~AutoReflowDepth() { --mState.mReflowDepth; }
nsBoxLayoutState& mState;
};
// The HTML reflow input that lives outside the box-block boundary.
// May not be set reliably yet.
const ReflowInput* OuterReflowInput() { return mOuterReflowInput; }
uint16_t GetReflowDepth() { return mReflowDepth; }
private:
RefPtr<nsPresContext> mPresContext;
gfxContext* mRenderingContext;
const ReflowInput* mOuterReflowInput;
nsIFrame::ReflowChildFlags mLayoutFlags;
uint16_t mReflowDepth;
bool mPaintingDisabled;
};
#endif

View file

@ -1,300 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
//
// Eric Vaughan
// Netscape Communications
//
// See documentation in associated header file
//
#include "mozilla/ComputedStyle.h"
#include "mozilla/PresShell.h"
#include "nsLeafBoxFrame.h"
#include "nsCOMPtr.h"
#include "nsGkAtoms.h"
#include "nsPresContext.h"
#include "nsIContent.h"
#include "nsNameSpaceManager.h"
#include "nsBoxLayoutState.h"
#include "nsWidgetsCID.h"
#include "nsViewManager.h"
#include "nsContainerFrame.h"
#include "nsDisplayList.h"
#include <algorithm>
using namespace mozilla;
//
// NS_NewLeafBoxFrame
//
// Creates a new Toolbar frame and returns it
//
nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) nsLeafBoxFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
/**
* Initialize us. This is a good time to get the alignment of the box
*/
void nsLeafBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
if (HasAnyStateBits(NS_FRAME_FONT_INFLATION_CONTAINER)) {
AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
}
}
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.
DisplayBorderBackgroundOutline(aBuilder, aLists);
if (!aBuilder->IsForEventDelivery() || !IsVisibleForPainting()) return;
aLists.Content()->AppendNewToTop<nsDisplayEventReceiver>(aBuilder, this);
}
/* virtual */
nscoord nsLeafBoxFrame::GetMinISize(gfxContext* aRenderingContext) {
nscoord result;
DISPLAY_MIN_INLINE_SIZE(this, result);
nsBoxLayoutState state(PresContext(), aRenderingContext);
WritingMode wm = GetWritingMode();
LogicalSize minSize(wm, GetXULMinSize(state));
// GetXULMinSize returns border-box size, and we want to return content
// inline-size. Since Reflow uses the reflow input's border and padding, we
// actually just want to subtract what GetXULMinSize added, which is the
// result of GetXULBorderAndPadding.
nsMargin bp;
GetXULBorderAndPadding(bp);
result = minSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
return result;
}
/* virtual */
nscoord nsLeafBoxFrame::GetPrefISize(gfxContext* aRenderingContext) {
nscoord result;
DISPLAY_PREF_INLINE_SIZE(this, result);
nsBoxLayoutState state(PresContext(), aRenderingContext);
WritingMode wm = GetWritingMode();
LogicalSize prefSize(wm, GetXULPrefSize(state));
// GetXULPrefSize returns border-box size, and we want to return content
// inline-size. Since Reflow uses the reflow input's border and padding, we
// actually just want to subtract what GetXULPrefSize added, which is the
// result of GetXULBorderAndPadding.
nsMargin bp;
GetXULBorderAndPadding(bp);
result = prefSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
return result;
}
nscoord nsLeafBoxFrame::GetIntrinsicISize() {
// No intrinsic width
return 0;
}
LogicalSize nsLeafBoxFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Important: NOT calling our direct superclass here!
return nsIFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorderPadding,
aSizeOverrides, aFlags);
}
void nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_ASSERTION(
aReflowInput.ComputedWidth() >= 0 && aReflowInput.ComputedHeight() >= 0,
"Computed Size < 0");
#ifdef DO_NOISY_REFLOW
printf(
"\n-------------Starting LeafBoxFrame Reflow "
"----------------------------\n");
printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);
switch (aReflowInput.reason) {
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;
default:
printf("<unknown>%d", aReflowInput.reason);
break;
}
printSize("AW", aReflowInput.AvailableWidth());
printSize("AH", aReflowInput.AvailableHeight());
printSize("CW", aReflowInput.ComputedWidth());
printSize("CH", aReflowInput.ComputedHeight());
printf(" *\n");
#endif
// create the layout state
nsBoxLayoutState state(aPresContext, aReflowInput.mRenderingContext);
nsSize computedSize(aReflowInput.ComputedWidth(),
aReflowInput.ComputedHeight());
nsMargin m;
m = aReflowInput.ComputedPhysicalBorderPadding();
// GetXULBorderAndPadding(m);
// this happens sometimes. So lets handle it gracefully.
if (aReflowInput.ComputedHeight() == 0) {
nsSize minSize = GetXULMinSize(state);
computedSize.height = minSize.height - m.top - m.bottom;
}
nsSize prefSize(0, 0);
// if we are told to layout intrinic then get our preferred size.
if (computedSize.width == NS_UNCONSTRAINEDSIZE ||
computedSize.height == NS_UNCONSTRAINEDSIZE) {
prefSize = GetXULPrefSize(state);
nsSize minSize = GetXULMinSize(state);
nsSize maxSize = GetXULMaxSize(state);
prefSize = XULBoundsCheck(minSize, prefSize, maxSize);
}
// get our desiredSize
if (aReflowInput.ComputedWidth() == NS_UNCONSTRAINEDSIZE) {
computedSize.width = prefSize.width;
} else {
computedSize.width += m.left + m.right;
}
if (aReflowInput.ComputedHeight() == NS_UNCONSTRAINEDSIZE) {
computedSize.height = prefSize.height;
} else {
computedSize.height += m.top + m.bottom;
}
// handle reflow input min and max sizes
// 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...
if (computedSize.width > aReflowInput.ComputedMaxWidth())
computedSize.width = aReflowInput.ComputedMaxWidth();
if (computedSize.width < aReflowInput.ComputedMinWidth())
computedSize.width = aReflowInput.ComputedMinWidth();
// 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.
computedSize.height = std::max(0, computedSize.height - m.TopBottom());
computedSize.height =
NS_CSS_MINMAX(computedSize.height, aReflowInput.ComputedMinHeight(),
aReflowInput.ComputedMaxHeight());
computedSize.height += m.TopBottom();
nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
SetXULBounds(state, r);
// layout our children
XULLayout(state);
// ok our child could have gotten bigger. So lets get its bounds
aDesiredSize.Width() = mRect.width;
aDesiredSize.Height() = mRect.height;
aDesiredSize.SetBlockStartAscent(GetXULBoxAscent(state));
// the overflow rect is set in SetXULBounds() above
aDesiredSize.mOverflowAreas = GetOverflowAreas();
#ifdef DO_NOISY_REFLOW
{
printf("%p ** nsLBF(done) W:%d H:%d ", this, aDesiredSize.Width(),
aDesiredSize.Height());
if (maxElementWidth) {
printf("MW:%d\n", *maxElementWidth);
} else {
printf("MW:?\n");
}
}
#endif
}
#ifdef DEBUG_FRAME_DUMP
nsresult nsLeafBoxFrame::GetFrameName(nsAString& aResult) const {
return MakeFrameName(u"LeafBox"_ns, aResult);
}
#endif
nsresult nsLeafBoxFrame::CharacterDataChanged(
const CharacterDataChangeInfo& aInfo) {
MarkIntrinsicISizesDirty();
return nsLeafFrame::CharacterDataChanged(aInfo);
}
/* virtual */
nsSize nsLeafBoxFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
return nsIFrame::GetUncachedXULPrefSize(aState);
}
/* virtual */
nsSize nsLeafBoxFrame::GetXULMinSize(nsBoxLayoutState& aState) {
return nsIFrame::GetUncachedXULMinSize(aState);
}
/* virtual */
nsSize nsLeafBoxFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
return nsIFrame::GetUncachedXULMaxSize(aState);
}
/* virtual */
nscoord nsLeafBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aState) {
if (IsXULCollapsed()) {
return 0;
}
return GetXULPrefSize(aState).height;
}
NS_IMETHODIMP
nsLeafBoxFrame::DoXULLayout(nsBoxLayoutState& aState) { return NS_OK; }

View file

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef nsLeafBoxFrame_h___
#define nsLeafBoxFrame_h___
#include "mozilla/Attributes.h"
#include "nsLeafFrame.h"
namespace mozilla {
class PresShell;
} // namespace mozilla
class nsLeafBoxFrame : public nsLeafFrame {
public:
NS_DECL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
friend nsIFrame* NS_NewLeafBoxFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aState) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aState) override;
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aState) override;
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aState) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override {
// This is bogus, but it's what we've always done.
// Note that nsLeafFrame is also eReplacedContainsBlock.
return nsLeafFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock |
nsIFrame::eXULBox));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
// nsIHTMLReflow overrides
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
// Our auto size is that provided by nsFrame, not nsLeafFrame
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult CharacterDataChanged(
const CharacterDataChangeInfo&) override;
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* asPrevInFlow) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
virtual bool XULComputesOwnOverflowArea() override { return false; }
protected:
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
virtual nscoord GetIntrinsicISize() override;
explicit nsLeafBoxFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID = kClassID)
: nsLeafFrame(aStyle, aPresContext, aID) {}
}; // class nsLeafBoxFrame
#endif /* nsLeafBoxFrame_h___ */

View file

@ -24,7 +24,6 @@
#include "nsFrameManager.h"
#include "mozilla/dom/Document.h"
#include "nsRect.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#include "nsIPopupContainer.h"
#include "nsIDocShell.h"

View file

@ -27,7 +27,6 @@
#include "nsISupportsImpl.h"
#include "nsScrollbarFrame.h"
#include "nsRepeatService.h"
#include "nsBoxLayoutState.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"

View file

@ -11,8 +11,10 @@
// See documentation in associated header file
//
#include "LayoutConstants.h"
#include "SimpleXULLeafFrame.h"
#include "gfxContext.h"
#include "mozilla/ReflowInput.h"
#include "nsSplitterFrame.h"
#include "nsGkAtoms.h"
#include "nsXULElement.h"
@ -26,7 +28,6 @@
#include "nsHTMLParts.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/CSSOrderAwareFrameIterator.h"
#include "nsBoxLayoutState.h"
#include "nsContainerFrame.h"
#include "nsContentCID.h"
#include "nsLayoutUtils.h"
@ -143,8 +144,7 @@ class nsSplitterFrameInner final : public nsIDOMEventListener {
bool SupportsCollapseDirection(CollapseDirection aDirection);
void EnsureOrient();
void SetPreferredSize(nsBoxLayoutState& aState, nsIFrame* aChildBox,
bool aIsHorizontal, nscoord aSize);
void SetPreferredSize(nsIFrame* aChildBox, bool aIsHorizontal, nscoord aSize);
nsSplitterFrame* mOuter;
bool mDidDrag = false;
@ -514,6 +514,15 @@ static nsSize ToLengthWithFallback(const LengthLike& aWidth,
ToLengthWithFallback(aHeight, aFallback)};
}
static void ApplyMargin(nsSize& aSize, const nsMargin& aMargin) {
if (aSize.width != NS_UNCONSTRAINEDSIZE) {
aSize.width += aMargin.LeftRight();
}
if (aSize.height != NS_UNCONSTRAINEDSIZE) {
aSize.height += aMargin.TopBottom();
}
}
nsresult nsSplitterFrameInner::MouseDown(Event* aMouseEvent) {
NS_ENSURE_TRUE(mOuter, NS_OK);
dom::MouseEvent* mouseEvent = aMouseEvent->AsMouseEvent();
@ -536,12 +545,6 @@ nsresult nsSplitterFrameInner::MouseDown(Event* aMouseEvent) {
}
// get our index
nsPresContext* outerPresContext = mOuter->PresContext();
UniquePtr<gfxContext> rc =
outerPresContext->PresShell()->CreateReferenceRenderingContext();
nsBoxLayoutState state(outerPresContext, rc.get());
mDidDrag = false;
EnsureOrient();
@ -579,7 +582,9 @@ nsresult nsSplitterFrameInner::MouseDown(Event* aMouseEvent) {
count++;
nsIContent* content = childBox->GetContent();
const nscoord flex = childBox->GetXULFlex();
// XXX flex seems untested, as it uses mBoxFlex rather than actual flexbox
// flex.
const nscoord flex = childBox->StyleXUL()->mBoxFlex;
const bool isBefore = !foundOuter;
const bool isResizable = [&] {
if (auto* element = nsXULElement::FromNode(content)) {
@ -634,13 +639,20 @@ nsresult nsSplitterFrameInner::MouseDown(Event* aMouseEvent) {
nsSize prefSize(ToLengthWithFallback(pos.mWidth, curSize.width),
ToLengthWithFallback(pos.mHeight, curSize.height));
maxSize = nsIFrame::XULBoundsCheckMinMax(minSize, maxSize);
prefSize = nsIFrame::XULBoundsCheck(minSize, prefSize, maxSize);
maxSize.width = std::max(maxSize.width, minSize.width);
maxSize.height = std::max(maxSize.height, minSize.height);
prefSize.width =
NS_CSS_MINMAX(prefSize.width, minSize.width, maxSize.width);
prefSize.height =
NS_CSS_MINMAX(prefSize.height, minSize.height, maxSize.height);
nsSplitterFrame::AddXULMargin(childBox, minSize);
nsSplitterFrame::AddXULMargin(childBox, maxSize);
nsSplitterFrame::AddXULMargin(childBox, prefSize);
nsSplitterFrame::AddXULMargin(childBox, curSize);
nsMargin m;
childBox->StyleMargin()->GetMargin(m);
ApplyMargin(curSize, m);
ApplyMargin(minSize, m);
ApplyMargin(maxSize, m);
ApplyMargin(prefSize, m);
auto& list = isBefore ? mChildInfosBefore : mChildInfosAfter;
nsSplitterInfo& info = *list.AppendElement();
@ -854,23 +866,19 @@ void nsSplitterFrameInner::AdjustChildren(nsPresContext* aPresContext,
bool aIsHorizontal) {
/// printf("------- AdjustChildren------\n");
nsBoxLayoutState state(aPresContext);
for (auto& info : aChildInfos) {
nscoord newPref = info.pref + (info.changed - info.current);
if (nsIFrame* childBox =
GetChildBoxForContent(mParentBox, info.childElem)) {
SetPreferredSize(state, childBox, aIsHorizontal, newPref);
SetPreferredSize(childBox, aIsHorizontal, newPref);
}
}
}
void nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState,
nsIFrame* aChildBox,
void nsSplitterFrameInner::SetPreferredSize(nsIFrame* aChildBox,
bool aIsHorizontal, nscoord aSize) {
nsMargin margin(0, 0, 0, 0);
aChildBox->GetXULMargin(margin);
nsMargin margin;
aChildBox->StyleMargin()->GetMargin(margin);
if (aIsHorizontal) {
aSize -= (margin.left + margin.right);
} else {

View file

@ -13,7 +13,6 @@ support-files =
windowminmaxsize10.xhtml
titledpanelwindow.xhtml
[test_blockify_moz_box.html]
[test_bug159346.xhtml]
[test_bug381167.xhtml]
[test_bug398982-1.xhtml]

View file

@ -1,114 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1580012
-->
<head>
<title>Test for Bug 1580012</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<style>
/* Styling for parents that blockify their children: */
.grid { display: grid; }
.flex { display: flex; }
/* Styling that blockifies an element itself: */
.float { float: left; }
.abs { position: absolute; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1580012">Mozilla Bug 1580012</a>
<p id="display"></p>
<div id="content">
<!-- Boxes that have no reason to be blockified: -->
<div class="moz-box" id="regularMozBox"></div>
<div class="moz-inline-box" id="regularMozInlineBox"></div>
<!-- A grid container with a -moz-box and a -moz-inline-box grid item (which
should both end up with display:-moz-box), and a -moz-inline-box
grandchild (which should preserve its -moz-inline-box display val): -->
<div class="grid">
<div class="moz-box" id="gridItemMozBox"></div>
<div class="moz-inline-box" id="gridItemMozInlineBox"></div>
<div><div class="moz-inline-box" id="gridGrandchildMozInlineBox"></div></div>
</div>
<!-- A flex container with a -moz-box and a -moz-inline-box flex item (which
should both end up with display:-moz-box), and a -moz-inline-box
grandchild (which should preserve its -moz-inline-box display val): -->
<div class="flex">
<div class="moz-box" id="flexItemMozBox"></div>
<div class="moz-inline-box" id="flexItemMozInlineBox"></div>
<div><div class="moz-inline-box" id="flexGrandchildMozInlineBox"></div></div>
</div>
<!-- Boxes that are directly blockified via other styling on them: -->
<!-- XXXdholbert commenting these out -- see notes below about assertion
failures for floated -moz-box.
<div class="float moz-box" id="floatMozBox"></div>
<div class="float moz-inline-box" id="floatMozInlineBox"></div>
-->
<!-- XXXdholbert commenting these out -- see notes below about assertion
failures for positioned -moz-box.
<div class="abs moz-box" id="absMozBox"></div>
<div class="abs moz-inline-box" id="absMozInlineBox"></div>
-->
</div>
<pre id="test">
<script>
/** Test for Bug 1580012 **/
function checkDisp(elemId, expectedDisplay) {
var elem = document.getElementById(elemId);
ok(elem, "should have a valid ID for an element");
is(getComputedStyle(elem).display, expectedDisplay,
"Element with ID " + elemId + " should have expected display value");
}
// Create CSS Style rules to add -moz-box / -moz-inline-box styling.
// Note that these style won't parse correctly until after we've flipped
// the prefs via pushPrefEnv(). That's why I'm creating these style rules
// here rather than just putting them inline in the <style> element.
var sheet = document.styleSheets[0];
sheet.insertRule(".moz-box { display: -moz-box; }");
sheet.insertRule(".moz-inline-box { display: -moz-inline-box; }");
// Check the computed 'display' of the various elements.
checkDisp("regularMozBox", "-moz-box");
checkDisp("regularMozInlineBox", "-moz-inline-box");
checkDisp("gridItemMozBox", "-moz-box");
checkDisp("gridItemMozInlineBox", "-moz-box");
checkDisp("gridGrandchildMozInlineBox", "-moz-inline-box");
checkDisp("flexItemMozBox", "-moz-box");
checkDisp("flexItemMozInlineBox", "-moz-box");
checkDisp("flexGrandchildMozInlineBox", "-moz-inline-box");
// XXXdholbert The floated boxes trigger assertion failures where
// nsLineLayout thinks it somehow ended up with an inline-level (really, just
// a non-'block') floated thing. In practice this isn't really a concern
// since -moz-box display values are disabled in content and since XUL
// doesn't use 'float' for layout. So: I've added a fatal assertion in
// ReflowInput.cpp to validate that we never actually encounter a floated
// -moz-box/-moz-inline-box, and I'm commenting out these lines (which
// trigger that fatal assertion).
//
// checkDisp("floatMozBox", "-moz-box");
// checkDisp("floatMozInlineBox", "-moz-box");
// XXXdholbert These abspos boxes trigger a diagnostic assertion added in
// bug 1582819 which is intended to flush out XUL content that is positioned
// and hence was previously blockified to 'block' but will now be '-moz-box'.
// The diagnostic assertion doesn't need to stay around forever, but while
// it exists, we can't test this scenario without triggering it.
//
// checkDisp("absMozBox", "-moz-box");
// checkDisp("absMozInlineBox", "-moz-box");
</script>
</pre>
</body>
</html>

View file

@ -96,8 +96,6 @@ XUL <splitter> collapsing tests
async function runAllTests() {
await runTests(false, "ltr-splitter");
await runTests(true, "rtl-splitter");
await runTests(false, "ltr-flex-splitter");
await runTests(true, "rtl-flex-splitter");
SimpleTest.finish();
}
@ -116,16 +114,4 @@ XUL <splitter> collapsing tests
<vbox style="height: 300px; flex: 1 auto" />
</hbox>
<hbox style="display: none; width: 200px; height: 300px; direction: ltr; -moz-box-layout: flex">
<vbox style="height: 300px; flex: 1 auto" />
<splitter id="ltr-flex-splitter" style="width: 5px"/>
<vbox style="height: 300px; flex: 1 auto" />
</hbox>
<hbox style="display: none; width: 200px; height: 300px; direction: rtl; -moz-box-layout: flex">
<vbox style="height: 300px; flex: 1 auto" />
<splitter id="rtl-flex-splitter" style="width: 5px"/>
<vbox style="height: 300px; flex: 1 auto" />
</hbox>
</window>

View file

@ -49,7 +49,6 @@
#include "nsVariant.h"
#include "nsWidgetsCID.h"
#include "nsIFrameInlines.h"
#include "nsBoxLayoutState.h"
#include "nsTreeContentView.h"
#include "nsTreeUtils.h"
#include "nsStyleConsts.h"

View file

@ -10,7 +10,6 @@
#include "mozilla/AtomArray.h"
#include "mozilla/Attributes.h"
#include "nsLeafBoxFrame.h"
#include "nsITreeView.h"
#include "nsIScrollbarMediator.h"
#include "nsITimer.h"

View file

@ -56,16 +56,6 @@ ${helpers.single_keyword(
spec="None (internal)",
)}
${helpers.single_keyword(
"-moz-box-layout",
"flex legacy",
engines="gecko",
gecko_enum_prefix="StyleMozBoxLayout",
animation_value_type="none",
enabled_in="chrome",
spec="None (internal)",
)}
${helpers.single_keyword(
"text-orientation",
"mixed upright sideways",

View file

@ -22,11 +22,6 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
#[cfg(feature = "gecko")]
fn moz_display_values_enabled(context: &ParserContext) -> bool {
context.in_ua_or_chrome_sheet()
}
#[cfg(not(feature = "servo-layout-2020"))]
fn flexbox_enabled() -> bool {
true
@ -56,8 +51,6 @@ pub enum DisplayOutside {
InternalTable,
#[cfg(feature = "gecko")]
InternalRuby,
#[cfg(feature = "gecko")]
XUL,
}
#[allow(missing_docs)]
@ -100,8 +93,6 @@ pub enum DisplayInside {
RubyTextContainer,
#[cfg(feature = "gecko")]
WebkitBox,
#[cfg(feature = "gecko")]
MozBox,
}
#[allow(missing_docs)]
@ -208,12 +199,6 @@ impl Display {
DisplayInside::RubyTextContainer,
);
/// XUL boxes.
#[cfg(feature = "gecko")]
pub const MozBox: Self = Self::new(DisplayOutside::Block, DisplayInside::MozBox);
#[cfg(feature = "gecko")]
pub const MozInlineBox: Self = Self::new(DisplayOutside::Inline, DisplayInside::MozBox);
/// Make a raw display value from <display-outside> and <display-inside> values.
#[inline]
const fn new(outside: DisplayOutside, inside: DisplayInside) -> Self {
@ -318,8 +303,6 @@ impl Display {
DisplayInside::Flex => true,
#[cfg(feature = "gecko")]
DisplayInside::Grid => true,
#[cfg(feature = "gecko")]
DisplayInside::MozBox => true,
_ => false,
}
}
@ -358,7 +341,7 @@ impl Display {
};
Display::from3(DisplayOutside::Block, inside, self.is_list_item())
},
DisplayOutside::Block | DisplayOutside::XUL | DisplayOutside::None => *self,
DisplayOutside::Block | DisplayOutside::None => *self,
#[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
_ => Display::Block,
}
@ -411,8 +394,6 @@ impl ToCss for Display {
Display::InlineBlock => dest.write_str("inline-block"),
#[cfg(feature = "gecko")]
Display::WebkitInlineBox => dest.write_str("-webkit-inline-box"),
#[cfg(feature = "gecko")]
Display::MozInlineBox => dest.write_str("-moz-inline-box"),
#[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
Display::TableCaption => dest.write_str("table-caption"),
_ => match (outside, inside) {
@ -587,10 +568,6 @@ impl Parse for Display {
"-webkit-box" => Display::WebkitBox,
#[cfg(feature = "gecko")]
"-webkit-inline-box" => Display::WebkitInlineBox,
#[cfg(feature = "gecko")]
"-moz-box" if moz_display_values_enabled(context) => Display::MozBox,
#[cfg(feature = "gecko")]
"-moz-inline-box" if moz_display_values_enabled(context) => Display::MozInlineBox,
})
}
}

View file

@ -135,9 +135,6 @@ treecol:where(:hover),
.treecol-text {
margin: 0 !important;
/* NOTE(emilio): Eventually we should move <treecol> out of XUL layout
* proper, till then this makes cropping work. */
-moz-box-layout: flex;
}
treecol[hideheader="true"] {