Bug 1576946 - Remove nsStackFrame platform code. r=mats

Differential Revision: https://phabricator.services.mozilla.com/D49487

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2019-11-12 19:50:19 +00:00
parent e9cf7725cf
commit b081bf6c33
20 changed files with 49 additions and 259 deletions

View File

@ -133,7 +133,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"scroll-snap-align",
"scroll-snap-type",
"shape-rendering",
"-moz-stack-sizing",
"scrollbar-width",
"stroke-linecap",
"stroke-linejoin",

View File

@ -1156,23 +1156,6 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"-moz-stack-sizing": {
"isInherited": false,
"subproperties": [
"-moz-stack-sizing"
],
"supports": [],
"values": [
"ignore",
"ignore-horizontal",
"ignore-vertical",
"inherit",
"initial",
"revert",
"stretch-to-fit",
"unset"
]
},
"-moz-tab-size": {
"isInherited": true,
"subproperties": [
@ -3339,7 +3322,6 @@ exports.CSS_PROPERTIES = {
"-moz-box-flex",
"-moz-box-orient",
"-moz-box-pack",
"-moz-stack-sizing",
"-moz-box-ordinal-group"
],
"supports": [],

View File

@ -49,11 +49,6 @@ const gMozillaSpecificProperties = {
from: "1",
to: "0"
},
"-moz-stack-sizing": {
// https://developer.mozilla.org/en/docs/Web/CSS/-moz-stack-sizing
from: "ignore",
to: "stretch-to-fit"
},
"-moz-text-size-adjust": {
// https://drafts.csswg.org/css-size-adjust/#propdef-text-size-adjust
from: "none",

View File

@ -44,9 +44,6 @@ const testcases = [
property: "-moz-osx-font-smoothing",
pref: "layout.css.osx-font-smoothing.enabled"
},
{
property: "-moz-stack-sizing"
},
{
property: "-moz-text-size-adjust"
},

View File

@ -219,8 +219,6 @@ nsIFrame* NS_NewDeckFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewStackFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewRangeFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewImageBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
@ -3981,7 +3979,6 @@ static bool IsXULDisplayType(const nsStyleDisplay* aDisplay) {
#ifdef MOZ_XUL
return (aDisplay->mDisplay == StyleDisplay::MozGrid ||
aDisplay->mDisplay == StyleDisplay::MozStack ||
aDisplay->mDisplay == StyleDisplay::MozGridGroup ||
aDisplay->mDisplay == StyleDisplay::MozGridLine ||
aDisplay->mDisplay == StyleDisplay::MozDeck ||
@ -4180,9 +4177,8 @@ already_AddRefed<ComputedStyle> nsCSSFrameConstructor::BeginBuildingScrollFrame(
// I wonder whether we can eliminate that somehow.
const nsStyleDisplay* displayStyle = aContentStyle->StyleDisplay();
if (IsXULDisplayType(displayStyle)) {
gfxScrollFrame = NS_NewXULScrollFrame(
mPresShell, contentStyle, aIsRoot,
displayStyle->mDisplay == StyleDisplay::MozStack);
gfxScrollFrame =
NS_NewXULScrollFrame(mPresShell, contentStyle, aIsRoot, false);
} else {
gfxScrollFrame = NS_NewHTMLScrollFrame(mPresShell, contentStyle, aIsRoot);
}
@ -4514,11 +4510,6 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
SCROLLABLE_XUL_FCDATA(NS_NewGridRowLeafFrame);
return &data;
}
case StyleDisplayInside::MozStack: {
static const FrameConstructionData data =
SCROLLABLE_XUL_FCDATA(NS_NewStackFrame);
return &data;
}
case StyleDisplayInside::MozDeck: {
static const FrameConstructionData data =
SIMPLE_XUL_FCDATA(NS_NewDeckFrame);

View File

@ -98,8 +98,6 @@ class nsTextControlFrame final : public nsContainerFrame,
#endif
virtual bool IsFrameOfType(uint32_t aFlags) const override {
// nsStackFrame is already both of these, but that's somewhat bogus,
// and we really mean it.
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}

View File

@ -98,7 +98,6 @@ FRAME_CLASSES = [
Frame("nsPageSequenceFrame", "Sequence", NOT_LEAF),
Frame("nsSliderFrame", "Slider", NOT_LEAF),
Frame("nsSplitterFrame", "Box", NOT_LEAF),
Frame("nsStackFrame", "Box", NOT_LEAF),
Frame("nsSubDocumentFrame", "SubDocument", LEAF),
Frame("nsSVGAFrame", "SVGA", NOT_LEAF),
Frame("nsSVGClipPathFrame", "SVGClipPath", NOT_LEAF),

View File

@ -105,7 +105,6 @@ rusty-enums = [
"mozilla::StyleShapeSourceType",
"mozilla::StyleBasicShapeType",
"nsStyleImageLayers_Size_DimensionType",
"mozilla::StyleStackSizing",
"mozilla::StyleBorderCollapse",
"mozilla::StyleBorderImageRepeat",
"mozilla::StyleBoxPack",

View File

@ -53,7 +53,6 @@ CSS_KEY(-moz-left, _moz_left)
CSS_KEY(-moz-none, _moz_none)
CSS_KEY(-moz-popup, _moz_popup)
CSS_KEY(-moz-right, _moz_right)
CSS_KEY(-moz-stack, _moz_stack)
CSS_KEY(-moz-zoom-in, _moz_zoom_in)
CSS_KEY(-moz-zoom-out, _moz_zoom_out)
CSS_KEY(-webkit-box, _webkit_box)

View File

@ -97,8 +97,6 @@ enum class StyleDisplay : uint16_t {
StyleDisplayInside::MozGridGroup),
MozGridLine = StyleDisplayFrom(StyleDisplayOutside::XUL,
StyleDisplayInside::MozGridLine),
MozStack =
StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozStack),
MozDeck =
StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozDeck),
MozGroupbox = StyleDisplayFrom(StyleDisplayOutside::XUL,
@ -270,14 +268,6 @@ enum class StyleShapeSourceType : uint8_t {
Path, // SVG path function
};
// -moz-stack-sizing
enum class StyleStackSizing : uint8_t {
Ignore,
StretchToFit,
IgnoreHorizontal,
IgnoreVertical,
};
// text-justify
enum class StyleTextJustify : uint8_t {
None,

View File

@ -628,8 +628,7 @@ nsStyleXUL::nsStyleXUL(const Document& aDocument)
mBoxAlign(StyleBoxAlign::Stretch),
mBoxDirection(StyleBoxDirection::Normal),
mBoxOrient(StyleBoxOrient::Horizontal),
mBoxPack(StyleBoxPack::Start),
mStackSizing(StyleStackSizing::StretchToFit) {
mBoxPack(StyleBoxPack::Start) {
MOZ_COUNT_CTOR(nsStyleXUL);
}
@ -641,8 +640,7 @@ nsStyleXUL::nsStyleXUL(const nsStyleXUL& aSource)
mBoxAlign(aSource.mBoxAlign),
mBoxDirection(aSource.mBoxDirection),
mBoxOrient(aSource.mBoxOrient),
mBoxPack(aSource.mBoxPack),
mStackSizing(aSource.mStackSizing) {
mBoxPack(aSource.mBoxPack) {
MOZ_COUNT_CTOR(nsStyleXUL);
}
@ -650,8 +648,7 @@ nsChangeHint nsStyleXUL::CalcDifference(const nsStyleXUL& aNewData) const {
if (mBoxAlign == aNewData.mBoxAlign &&
mBoxDirection == aNewData.mBoxDirection &&
mBoxFlex == aNewData.mBoxFlex && mBoxOrient == aNewData.mBoxOrient &&
mBoxPack == aNewData.mBoxPack && mBoxOrdinal == aNewData.mBoxOrdinal &&
mStackSizing == aNewData.mStackSizing) {
mBoxPack == aNewData.mBoxPack && mBoxOrdinal == aNewData.mBoxOrdinal) {
return nsChangeHint(0);
}
if (mBoxOrdinal != aNewData.mBoxOrdinal) {

View File

@ -2141,7 +2141,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL {
mozilla::StyleBoxDirection mBoxDirection;
mozilla::StyleBoxOrient mBoxOrient;
mozilla::StyleBoxPack mBoxPack;
mozilla::StyleStackSizing mStackSizing;
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn {

View File

@ -3570,14 +3570,6 @@ var gCSSProperties = {
other_values: ["both", "horizontal", "vertical", "inline", "block"],
invalid_values: [],
},
"-moz-stack-sizing": {
domProp: "MozStackSizing",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: ["stretch-to-fit"],
other_values: ["ignore", "ignore-horizontal", "ignore-vertical"],
invalid_values: [],
},
"-moz-tab-size": {
domProp: "MozTabSize",
inherited: true,

View File

@ -34,7 +34,6 @@ UNIFIED_SOURCES += [
'nsScrollbarFrame.cpp',
'nsSliderFrame.cpp',
'nsSprocketLayout.cpp',
'nsStackFrame.cpp',
'nsStackLayout.cpp',
'nsXULTooltipListener.cpp',
]

View File

@ -129,7 +129,7 @@ class nsBoxFrame : public nsContainerFrame {
virtual bool HonorPrintBackgroundSettings() override;
// virtual so nsStackFrame, nsButtonBoxFrame, nsSliderFrame and nsMenuFrame
// virtual so nsButtonBoxFrame, nsSliderFrame and nsMenuFrame
// can override it
virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists);

View File

@ -1,62 +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 "nsStackFrame.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/PresShell.h"
#include "nsIContent.h"
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsCSSRendering.h"
#include "nsBoxLayoutState.h"
#include "nsStackLayout.h"
#include "nsDisplayList.h"
using namespace mozilla;
nsIFrame* NS_NewStackFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) nsStackFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame)
nsStackFrame::nsStackFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsBoxFrame(aStyle, aPresContext, kClassID) {
nsCOMPtr<nsBoxLayout> layout;
NS_NewStackLayout(layout);
SetXULLayoutManager(layout);
}
// REVIEW: The old code put everything in the background layer. To be more
// consistent with the way other frames work, I'm putting everything in the
// Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild,
// the case for stacking context but non-positioned, non-floating frames).
// This could easily be changed back by hacking
// nsBoxFrame::BuildDisplayListInternal a bit more.
void nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
// BuildDisplayListForChild puts stacking contexts into the
// PositionedDescendants list. So we need to map that list to
// aLists.Content(). This is an easy way to do that.
nsDisplayList* content = aLists.Content();
nsDisplayListSet kidLists(content, content, content, content, content,
content);
nsIFrame* kid = mFrames.FirstChild();
while (kid) {
// Force each child into its own true stacking context.
BuildDisplayListForChild(aBuilder, kid, kidLists,
DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
kid = kid->GetNextSibling();
}
}

View File

@ -1,45 +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 D Vaughan
A frame that can have multiple children. Only one child may be displayed at
one time. So the can be flipped though like a Stack of cards.
**/
#ifndef nsStackFrame_h___
#define nsStackFrame_h___
#include "mozilla/Attributes.h"
#include "nsBoxFrame.h"
namespace mozilla {
class PresShell;
} // namespace mozilla
class nsStackFrame final : public nsBoxFrame {
public:
NS_DECL_FRAMEARENA_HELPERS(nsStackFrame)
friend nsIFrame* NS_NewStackFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Stack"), aResult);
}
#endif
virtual void BuildDisplayListForChildren(
nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) override;
protected:
explicit nsStackFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
}; // class nsStackFrame
#endif

View File

@ -47,9 +47,6 @@ nsStackLayout::nsStackLayout() {}
/*
* Sizing: we are as wide as the widest child plus its left offset
* we are tall as the tallest child plus its top offset.
*
* Only children which have -moz-stack-sizing set to stretch-to-fit
* (the default) will be included in the size computations.
*/
nsSize nsStackLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
@ -57,24 +54,19 @@ nsSize nsStackLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsIFrame* child = nsBox::GetChildXULBox(aBox);
while (child) {
auto stackSizing = child->StyleXUL()->mStackSizing;
if (stackSizing != StyleStackSizing::Ignore) {
nsSize pref = child->GetXULPrefSize(aState);
nsSize pref = child->GetXULPrefSize(aState);
AddMargin(child, pref);
nsMargin offset;
GetOffset(child, offset);
pref.width += offset.LeftRight();
pref.height += offset.TopBottom();
AddMargin(child, pref);
nsMargin offset;
GetOffset(child, offset);
pref.width += offset.LeftRight();
pref.height += offset.TopBottom();
if (pref.width > prefSize.width &&
stackSizing != StyleStackSizing::IgnoreHorizontal) {
prefSize.width = pref.width;
}
if (pref.height > prefSize.height &&
stackSizing != StyleStackSizing::IgnoreVertical) {
prefSize.height = pref.height;
}
if (pref.width > prefSize.width) {
prefSize.width = pref.width;
}
if (pref.height > prefSize.height) {
prefSize.height = pref.height;
}
child = nsBox::GetNextXULBox(child);
@ -90,24 +82,19 @@ nsSize nsStackLayout::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsIFrame* child = nsBox::GetChildXULBox(aBox);
while (child) {
auto stackSizing = child->StyleXUL()->mStackSizing;
if (stackSizing != StyleStackSizing::Ignore) {
nsSize min = child->GetXULMinSize(aState);
nsSize min = child->GetXULMinSize(aState);
AddMargin(child, min);
nsMargin offset;
GetOffset(child, offset);
min.width += offset.LeftRight();
min.height += offset.TopBottom();
AddMargin(child, min);
nsMargin offset;
GetOffset(child, offset);
min.width += offset.LeftRight();
min.height += offset.TopBottom();
if (min.width > minSize.width &&
stackSizing != StyleStackSizing::IgnoreHorizontal) {
minSize.width = min.width;
}
if (min.height > minSize.height &&
stackSizing != StyleStackSizing::IgnoreVertical) {
minSize.height = min.height;
}
if (min.width > minSize.width) {
minSize.width = min.width;
}
if (min.height > minSize.height) {
minSize.height = min.height;
}
child = nsBox::GetNextXULBox(child);
@ -123,27 +110,22 @@ nsSize nsStackLayout::GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsIFrame* child = nsBox::GetChildXULBox(aBox);
while (child) {
auto stackSizing = child->StyleXUL()->mStackSizing;
if (stackSizing != StyleStackSizing::Ignore) {
nsSize min = child->GetXULMinSize(aState);
nsSize max = child->GetXULMaxSize(aState);
nsSize min = child->GetXULMinSize(aState);
nsSize max = child->GetXULMaxSize(aState);
max = nsBox::BoundsCheckMinMax(min, max);
max = nsBox::BoundsCheckMinMax(min, max);
AddMargin(child, max);
nsMargin offset;
GetOffset(child, offset);
max.width += offset.LeftRight();
max.height += offset.TopBottom();
AddMargin(child, max);
nsMargin offset;
GetOffset(child, offset);
max.width += offset.LeftRight();
max.height += offset.TopBottom();
if (max.width < maxSize.width &&
stackSizing != StyleStackSizing::IgnoreHorizontal) {
maxSize.width = max.width;
}
if (max.height < maxSize.height &&
stackSizing != StyleStackSizing::IgnoreVertical) {
maxSize.height = max.height;
}
if (max.width < maxSize.width) {
maxSize.width = max.width;
}
if (max.height < maxSize.height) {
maxSize.height = max.height;
}
child = nsBox::GetNextXULBox(child);
@ -349,20 +331,15 @@ nsStackLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState) {
childRect = child->GetRect();
childRect.Inflate(margin);
auto stackSizing = child->StyleXUL()->mStackSizing;
if (stackSizing != StyleStackSizing::Ignore) {
// Did the child push back on us and get bigger?
if (offset.LeftRight() + childRect.width > clientRect.width &&
stackSizing != StyleStackSizing::IgnoreHorizontal) {
clientRect.width = childRect.width + offset.LeftRight();
grow = true;
}
// Did the child push back on us and get bigger?
if (offset.LeftRight() + childRect.width > clientRect.width) {
clientRect.width = childRect.width + offset.LeftRight();
grow = true;
}
if (offset.TopBottom() + childRect.height > clientRect.height &&
stackSizing != StyleStackSizing::IgnoreVertical) {
clientRect.height = childRect.height + offset.TopBottom();
grow = true;
}
if (offset.TopBottom() + childRect.height > clientRect.height) {
clientRect.height = childRect.height + offset.TopBottom();
grow = true;
}
}

View File

@ -64,16 +64,6 @@ ${helpers.single_keyword(
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-pack)",
)}
${helpers.single_keyword(
"-moz-stack-sizing",
"stretch-to-fit ignore ignore-horizontal ignore-vertical",
engines="gecko",
gecko_ffi_name="mStackSizing",
gecko_enum_prefix="StyleStackSizing",
animation_value_type="discrete",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-stack-sizing)",
)}
${helpers.predefined_type(
"-moz-box-ordinal-group",
"Integer",

View File

@ -109,8 +109,6 @@ pub enum DisplayInside {
#[cfg(feature = "gecko")]
MozGridLine,
#[cfg(feature = "gecko")]
MozStack,
#[cfg(feature = "gecko")]
MozDeck,
#[cfg(feature = "gecko")]
MozGroupbox,
@ -243,8 +241,6 @@ impl Display {
#[cfg(feature = "gecko")]
pub const MozGridLine: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGridLine);
#[cfg(feature = "gecko")]
pub const MozStack: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozStack);
#[cfg(feature = "gecko")]
pub const MozDeck: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozDeck);
#[cfg(feature = "gecko")]
pub const MozGroupbox: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGroupbox);
@ -669,8 +665,6 @@ impl Parse for Display {
#[cfg(feature = "gecko")]
"-moz-grid-line" if moz_display_values_enabled(context) => Display::MozGridLine,
#[cfg(feature = "gecko")]
"-moz-stack" if moz_display_values_enabled(context) => Display::MozStack,
#[cfg(feature = "gecko")]
"-moz-deck" if moz_display_values_enabled(context) => Display::MozDeck,
#[cfg(feature = "gecko")]
"-moz-groupbox" if moz_display_values_enabled(context) => Display::MozGroupbox,