Skip to content

Commit

Permalink
Bug 1600542 - Remove a few other no longer reachable XUL box special-…
Browse files Browse the repository at this point in the history
…cases. r=TYLin

The only XUL frames that remain are either scrollbars, or leafs. These are uses
that I'm pretty sure are no longer needed. There are a few others that will go
in the future.

Depends on D172874

Differential Revision: https://phabricator.services.mozilla.com/D172875
  • Loading branch information
emilio committed Mar 20, 2023
1 parent c869e31 commit 5dfcee1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 64 deletions.
34 changes: 12 additions & 22 deletions layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11513,28 +11513,18 @@ PresShell::WindowSizeConstraints PresShell::GetWindowSizeConstraints() {
if (!rootFrame || !mPresContext) {
return {minSize, maxSize};
}
if (rootFrame->IsXULBoxFrame()) {
UniquePtr<gfxContext> rcx(CreateReferenceRenderingContext());
if (!rcx) {
return {minSize, maxSize};
}
nsBoxLayoutState state(mPresContext, rcx.get());
minSize = rootFrame->GetXULMinSize(state);
maxSize = rootFrame->GetXULMaxSize(state);
} else {
const auto* pos = rootFrame->StylePosition();
if (pos->mMinWidth.ConvertsToLength()) {
minSize.width = pos->mMinWidth.ToLength();
}
if (pos->mMinHeight.ConvertsToLength()) {
minSize.height = pos->mMinHeight.ToLength();
}
if (pos->mMaxWidth.ConvertsToLength()) {
maxSize.width = pos->mMaxWidth.ToLength();
}
if (pos->mMaxHeight.ConvertsToLength()) {
maxSize.height = pos->mMaxHeight.ToLength();
}
const auto* pos = rootFrame->StylePosition();
if (pos->mMinWidth.ConvertsToLength()) {
minSize.width = pos->mMinWidth.ToLength();
}
if (pos->mMinHeight.ConvertsToLength()) {
minSize.height = pos->mMinHeight.ToLength();
}
if (pos->mMaxWidth.ConvertsToLength()) {
maxSize.width = pos->mMaxWidth.ToLength();
}
if (pos->mMaxHeight.ConvertsToLength()) {
maxSize.height = pos->mMaxHeight.ToLength();
}
return {minSize, maxSize};
}
Expand Down
14 changes: 0 additions & 14 deletions layout/base/RestyleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,15 +965,6 @@ static bool RecomputePosition(nsIFrame* aFrame) {
return false;
}

static bool HasBoxAncestor(nsIFrame* aFrame) {
for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
if (f->IsXULBoxFrame()) {
return true;
}
}
return false;
}

/**
* Return true if aFrame's subtree has placeholders for out-of-flow content
* that would be affected due to the change to
Expand Down Expand Up @@ -1285,11 +1276,6 @@ static void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint) {
dirtyType = IntrinsicDirty::FrameAncestorsAndDescendants;
} else if (aHint & nsChangeHint_ClearAncestorIntrinsics) {
dirtyType = IntrinsicDirty::FrameAndAncestors;
} else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
HasBoxAncestor(aFrame)) {
// The frame's computed BSize is changing, and we have a box ancestor
// whose cached intrinsic height may need to be updated.
dirtyType = IntrinsicDirty::FrameAndAncestors;
} else {
dirtyType = IntrinsicDirty::None;
}
Expand Down
34 changes: 6 additions & 28 deletions layout/tables/BasicTableLayoutStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,23 +603,6 @@ void BasicTableLayoutStrategy::DistributePctISizeToColumns(float aSpanPrefPct,
}
}

#ifdef DEBUG
// Bypass some assertions for tables inside XUL which we're realistically not
// going to investigate unless they cause havoc. Thunderbird hits these very
// often.
static bool IsCloseToXULBox(nsTableFrame* aTableFrame) {
// NOTE: GetParent() is guaranteed to be the table wrapper (thus non-null).
nsIFrame* f = aTableFrame->GetParent()->GetParent();
for (size_t i = 0; f && i < 2; ++i) {
if (f->IsXULBoxFrame()) {
return true;
}
f = f->GetParent();
}
return false;
}
#endif

void BasicTableLayoutStrategy::DistributeISizeToColumns(
nscoord aISize, int32_t aFirstCol, int32_t aColCount,
BtlsISizeType aISizeType, bool aSpanHasSpecifiedISize) {
Expand Down Expand Up @@ -776,8 +759,7 @@ void BasicTableLayoutStrategy::DistributeISizeToColumns(
// Return early -- we don't have any extra space to distribute.
return;
}
NS_ASSERTION(!(aISizeType == BTLS_FINAL_ISIZE && aISize < guess_min) ||
IsCloseToXULBox(mTableFrame),
NS_ASSERTION(!(aISizeType == BTLS_FINAL_ISIZE && aISize < guess_min),
"Table inline-size is less than the "
"sum of its columns' min inline-sizes");
if (aISize < guess_min_pct) {
Expand Down Expand Up @@ -1007,13 +989,9 @@ void BasicTableLayoutStrategy::DistributeISizeToColumns(
} break;
}
}
#ifdef DEBUG
if (!IsCloseToXULBox(mTableFrame)) {
NS_ASSERTION((space == 0 || space == nscoord_MAX) &&
((l2t == FLEX_PCT_LARGE)
? (-0.001f < basis.f && basis.f < 0.001f)
: (basis.c == 0 || basis.c == nscoord_MAX)),
"didn't subtract all that we added");
}
#endif
NS_ASSERTION(
(space == 0 || space == nscoord_MAX) &&
((l2t == FLEX_PCT_LARGE) ? (-0.001f < basis.f && basis.f < 0.001f)
: (basis.c == 0 || basis.c == nscoord_MAX)),
"didn't subtract all that we added");
}

0 comments on commit 5dfcee1

Please sign in to comment.