Skip to content

Commit

Permalink
Bug 1824957 - Remove a bunch of now completely dead XUL layout code. …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
emilio committed Mar 29, 2023
1 parent 14cbd2d commit 2d0e69f
Show file tree
Hide file tree
Showing 99 changed files with 131 additions and 3,496 deletions.
3 changes: 1 addition & 2 deletions accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
18 changes: 2 additions & 16 deletions accessible/generic/LocalAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 1 addition & 2 deletions accessible/generic/TableAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
1 change: 0 additions & 1 deletion accessible/tests/mochitest/attributes/a11y.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
53 changes: 0 additions & 53 deletions accessible/tests/mochitest/attributes/test_obj_css.xhtml

This file was deleted.

1 change: 0 additions & 1 deletion devtools/server/actors/animation-type-longhand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
45 changes: 12 additions & 33 deletions dom/events/EventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -3131,39 +3130,19 @@ void EventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent,
}

if (nsIScrollableFrame* scrollableFrame = do_QueryFrame(current)) {
if (current->IsFrameOfType(nsIFrame::eXULBox)) {
displayPanFeedback = true;

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;
}
layers::ScrollDirections scrollbarVisibility =
scrollableFrame->GetScrollbarVisibility();

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;
}
// 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
Expand Down
1 change: 0 additions & 1 deletion layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 16 additions & 36 deletions layout/base/nsCSSFrameConstructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()) {
Expand All @@ -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*
Expand Down Expand Up @@ -8704,8 +8690,7 @@ void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
return;
}

if (!aParentFrame->IsFlexOrGridContainer() &&
!aParentFrame->IsXULBoxFrame()) {
if (!aParentFrame->IsFlexOrGridContainer()) {
return;
}

Expand Down Expand Up @@ -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.
Expand All @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion layout/base/nsCSSFrameConstructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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&);

/**
Expand Down
11 changes: 0 additions & 11 deletions layout/forms/nsTextControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?");
Expand Down Expand Up @@ -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 =
Expand Down
3 changes: 0 additions & 3 deletions layout/forms/nsTextControlFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/CSSOrderAwareFrameIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Loading

0 comments on commit 2d0e69f

Please sign in to comment.