Bug 1824877 Part 3 - Change ScrollContainerFrame's type from Scroll to ScrollContainer. r=dholbert

This effectively changes the `IsScrollFrame()` helper to
`IsScrollContainerFrame()`.

Differential Revision: https://phabricator.services.mozilla.com/D210357
This commit is contained in:
Ting-Yu Lin
2024-05-15 17:50:49 +00:00
parent 27bb908f13
commit b4a0842882
17 changed files with 40 additions and 34 deletions

View File

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

View File

@@ -2479,7 +2479,7 @@ nsIFrame* PresShell::GetRootScrollFrame() const {
return nullptr;
}
nsIFrame* theFrame = rootFrame->PrincipalChildList().FirstChild();
if (!theFrame || !theFrame->IsScrollFrame()) {
if (!theFrame || !theFrame->IsScrollContainerFrame()) {
return nullptr;
}
return theFrame;

View File

@@ -1128,7 +1128,7 @@ static nsIFrame* ContainingBlockForFrame(nsIFrame* aFrame) {
// Generally frames with a different insertion frame are hard to deal with,
// but scrollframes are easy because the containing block is just the
// insertion frame.
if (aFrame->IsScrollFrame()) {
if (aFrame->IsScrollContainerFrame()) {
return insertionFrame;
}
// Combobox frames are easy as well because they can't have positioned

View File

@@ -5507,7 +5507,7 @@ nsContainerFrame* nsCSSFrameConstructor::GetAbsoluteContainingBlock(
}
type = absPosCBCandidate->Type();
}
if (type == LayoutFrameType::Scroll) {
if (type == LayoutFrameType::ScrollContainer) {
nsIScrollableFrame* scrollFrame = do_QueryFrame(absPosCBCandidate);
absPosCBCandidate = scrollFrame->GetScrolledFrame();
if (!absPosCBCandidate) {

View File

@@ -100,7 +100,7 @@ void nsFrameIterator::Next() {
}
result = GetParentFrameNotPopup(parent);
if (!result || IsRootFrame(result) ||
(mLockScroll && result->IsScrollFrame())) {
(mLockScroll && result->IsScrollContainerFrame())) {
result = nullptr;
break;
}
@@ -151,7 +151,7 @@ void nsFrameIterator::Prev() {
}
result = GetParentFrameNotPopup(parent);
if (!result || IsRootFrame(result) ||
(mLockScroll && result->IsScrollFrame())) {
(mLockScroll && result->IsScrollContainerFrame())) {
result = nullptr;
break;
}
@@ -190,7 +190,9 @@ nsIFrame* nsFrameIterator::GetParentFrameNotPopup(nsIFrame* aFrame) {
nsIFrame* nsFrameIterator::GetFirstChild(nsIFrame* aFrame) {
nsIFrame* result = GetFirstChildInner(aFrame);
if (mLockScroll && result && result->IsScrollFrame()) return nullptr;
if (mLockScroll && result && result->IsScrollContainerFrame()) {
return nullptr;
}
if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result);
@@ -204,7 +206,9 @@ nsIFrame* nsFrameIterator::GetFirstChild(nsIFrame* aFrame) {
nsIFrame* nsFrameIterator::GetLastChild(nsIFrame* aFrame) {
nsIFrame* result = GetLastChildInner(aFrame);
if (mLockScroll && result && result->IsScrollFrame()) return nullptr;
if (mLockScroll && result && result->IsScrollContainerFrame()) {
return nullptr;
}
if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result);

View File

@@ -2373,8 +2373,8 @@ bool nsLayoutUtils::ContainsPoint(const nsRect& aRect, const nsPoint& aPoint,
nsRect nsLayoutUtils::ClampRectToScrollFrames(nsIFrame* aFrame,
const nsRect& aRect) {
nsIFrame* closestScrollFrame =
nsLayoutUtils::GetClosestFrameOfType(aFrame, LayoutFrameType::Scroll);
nsIFrame* closestScrollFrame = nsLayoutUtils::GetClosestFrameOfType(
aFrame, LayoutFrameType::ScrollContainer);
nsRect resultRect = aRect;
@@ -2393,7 +2393,7 @@ nsRect nsLayoutUtils::ClampRectToScrollFrames(nsIFrame* aFrame,
// Get next ancestor scroll frame.
closestScrollFrame = nsLayoutUtils::GetClosestFrameOfType(
closestScrollFrame->GetParent(), LayoutFrameType::Scroll);
closestScrollFrame->GetParent(), LayoutFrameType::ScrollContainer);
}
return resultRect;
@@ -5874,7 +5874,7 @@ bool nsLayoutUtils::GetLastLineBaseline(WritingMode aWM, const nsIFrame* aFrame,
kid->GetLogicalNormalPosition(aWM, containerSize).B(aWM);
return true;
}
if (kid->IsScrollFrame()) {
if (kid->IsScrollContainerFrame()) {
// Defer to nsIFrame::GetLogicalBaseline (which synthesizes a baseline
// from the margin-box).
kidBaseline = kid->GetLogicalBaseline(aWM);
@@ -5954,10 +5954,13 @@ nsIFrame* nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame) {
nsIFrame* layer;
for (layer = aFrame; layer; layer = layer->GetParent()) {
if (layer->IsAbsPosContainingBlock() ||
(layer->GetParent() && layer->GetParent()->IsScrollFrame()))
(layer->GetParent() && layer->GetParent()->IsScrollContainerFrame())) {
break;
}
}
if (layer) {
return layer;
}
if (layer) return layer;
return aFrame->PresShell()->GetRootFrame();
}

View File

@@ -111,7 +111,7 @@ FRAME_CLASSES = [
Frame("nsRubyFrame", "Ruby", RUBY_CONTENT),
Frame("nsRubyTextContainerFrame", "RubyTextContainer", {"None"}),
Frame("nsRubyTextFrame", "RubyText", RUBY_CONTENT),
Frame("ScrollContainerFrame", "Scroll", COMMON),
Frame("ScrollContainerFrame", "ScrollContainer", COMMON),
Frame("SimpleXULLeafFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsScrollbarButtonFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsScrollbarFrame", "Scrollbar", COMMON),

View File

@@ -394,7 +394,7 @@ void ReflowInput::Init(nsPresContext* aPresContext,
nsIFrame* parent = mFrame->GetParent();
if (parent && parent->HasAnyStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE) &&
!(parent->IsScrollFrame() &&
!(parent->IsScrollContainerFrame() &&
parent->StyleDisplay()->mOverflowY != StyleOverflow::Hidden)) {
mFrame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
} else if (type == LayoutFrameType::SVGForeignObject) {
@@ -521,7 +521,7 @@ void ReflowInput::InitCBReflowInput() {
static bool IsQuirkContainingBlockHeight(const ReflowInput* rs,
LayoutFrameType aFrameType) {
if (LayoutFrameType::Block == aFrameType ||
LayoutFrameType::Scroll == aFrameType) {
LayoutFrameType::ScrollContainer == aFrameType) {
// Note: This next condition could change due to a style change,
// but that would cause a style reflow anyway, which means we're ok.
if (NS_UNCONSTRAINEDSIZE == rs->ComputedHeight()) {
@@ -1995,7 +1995,7 @@ static nscoord CalcQuirkContainingBlockHeight(
// if the ancestor is auto height then skip it and continue up if it
// is the first block frame and possibly the body/html
if (LayoutFrameType::Block == frameType ||
LayoutFrameType::Scroll == frameType) {
LayoutFrameType::ScrollContainer == frameType) {
secondAncestorRI = firstAncestorRI;
firstAncestorRI = ri;

View File

@@ -94,7 +94,7 @@ static bool IsInlineAxisOverflowVisible(nsIFrame* aFrame) {
"expected a block frame");
nsIFrame* f = aFrame;
while (f && f->Style()->IsAnonBox() && !f->IsScrollFrame()) {
while (f && f->Style()->IsAnonBox() && !f->IsScrollContainerFrame()) {
f = f->GetParent();
}
if (!f) {

View File

@@ -66,7 +66,7 @@ void ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// If we have a scrollframe then it takes care of creating the display list
// for the top layer, but otherwise we need to do it here.
if (!kid->IsScrollFrame()) {
if (!kid->IsScrollContainerFrame()) {
bool isOpaque = false;
if (auto* list = BuildDisplayListForTopLayer(aBuilder, &isOpaque)) {
if (isOpaque) {

View File

@@ -1759,7 +1759,7 @@ bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
// If we're all scroll frame, then all descendants will be clipped, so we
// can't preserve 3d.
if (IsScrollFrame()) {
if (IsScrollContainerFrame()) {
return false;
}
@@ -9589,7 +9589,7 @@ std::pair<nsIFrame*, nsIFrame*> nsIFrame::GetContainingBlockForLine(
}
parentFrame = frame->GetParent();
if (parentFrame) {
if (aLockScroll && parentFrame->IsScrollFrame()) {
if (aLockScroll && parentFrame->IsScrollContainerFrame()) {
return std::pair(nullptr, nullptr);
}
if (parentFrame->CanProvideLineIterator()) {
@@ -10000,7 +10000,7 @@ static nsRect ComputeOutlineInnerRect(
}
const nsStyleDisplay* disp = aFrame->StyleDisplay();
LayoutFrameType fType = aFrame->Type();
if (fType == LayoutFrameType::Scroll ||
if (fType == LayoutFrameType::ScrollContainer ||
fType == LayoutFrameType::ListControl ||
fType == LayoutFrameType::SVGOuterSVG) {
return u;
@@ -10765,7 +10765,7 @@ void nsIFrame::GetFirstLeaf(nsIFrame** aFrame) {
}
bool nsIFrame::IsFocusableDueToScrollFrame() {
if (!IsScrollFrame()) {
if (!IsScrollContainerFrame()) {
if (nsFieldSetFrame* fieldset = do_QueryFrame(this)) {
// TODO: Do we have similar special-cases like this where we can have
// anonymous scrollable boxes hanging off a primary frame?
@@ -11549,7 +11549,7 @@ nsIFrame::PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
// the scrollable frame will already clip overflowing content, and because
// 'contain:paint' should prevent all means of escaping that clipping
// (e.g. because it forms a fixed-pos containing block).
if (aDisp->IsContainPaint() && !IsScrollFrame() &&
if (aDisp->IsContainPaint() && !IsScrollContainerFrame() &&
SupportsContainLayoutAndPaint()) {
return PhysicalAxes::Both;
}

View File

@@ -4651,7 +4651,7 @@ class nsIFrame : public nsQueryFrame {
// https://drafts.csswg.org/css-overflow-3/#scroll-container
bool IsScrollContainer() const {
const bool result = IsScrollFrame() || IsListControlFrame();
const bool result = IsScrollContainerFrame() || IsListControlFrame();
MOZ_ASSERT(result == !!GetAsScrollContainer());
return result;
}

View File

@@ -1303,7 +1303,7 @@ bool RetainedDisplayListBuilder::ShouldBuildPartial(
// reasons as above, but also because top layer items should to be marked
// modified if the root scroll frame is modified. Putting this check here
// means we don't need to check everytime a frame is marked modified though.
if (type == LayoutFrameType::Scroll && f->GetParent() &&
if (type == LayoutFrameType::ScrollContainer && f->GetParent() &&
!f->GetParent()->GetParent()) {
Metrics()->mPartialUpdateFailReason = PartialUpdateFailReason::FrameType;
return false;

View File

@@ -2174,7 +2174,7 @@ void nsCSSRendering::GetImageLayerClip(
aClipState->mBGClipArea = clipBorderArea;
if (aForFrame->IsScrollFrame() &&
if (aForFrame->IsScrollContainerFrame() &&
StyleImageLayerAttachment::Local == aLayer.mAttachment) {
// As of this writing, this is still in discussion in the CSS Working Group
// http://lists.w3.org/Archives/Public/www-style/2013Jul/0250.html
@@ -2769,7 +2769,7 @@ nsRect nsCSSRendering::ComputeImageLayerPositioningArea(
LayoutFrameType frameType = aForFrame->Type();
nsIFrame* geometryFrame = aForFrame;
if (MOZ_UNLIKELY(frameType == LayoutFrameType::Scroll &&
if (MOZ_UNLIKELY(frameType == LayoutFrameType::ScrollContainer &&
StyleImageLayerAttachment::Local == aLayer.mAttachment)) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame);
positionArea = nsRect(scrollableFrame->GetScrolledFrame()->GetPosition()

View File

@@ -1649,9 +1649,7 @@ bool nsDisplayListBuilder::IsAnimatedGeometryRoot(nsIFrame* aFrame,
}
}
LayoutFrameType parentType = parent->Type();
if (parentType == LayoutFrameType::Scroll ||
parentType == LayoutFrameType::ListControl) {
if (parent->IsScrollContainer()) {
nsIScrollableFrame* sf = do_QueryFrame(parent);
if (sf->GetScrolledFrame() == aFrame) {
MOZ_ASSERT(!aFrame->IsTransformed());

View File

@@ -893,7 +893,8 @@ static bool IsNonReplacedInline(nsIFrame* aFrame) {
// doesn't apply to ruby boxes.
return aFrame->StyleDisplay()->IsInlineFlow() && !aFrame->IsReplaced() &&
!aFrame->IsFieldSetFrame() && !aFrame->IsBlockFrame() &&
!aFrame->IsScrollFrame() && !aFrame->IsColumnSetWrapperFrame();
!aFrame->IsScrollContainerFrame() &&
!aFrame->IsColumnSetWrapperFrame();
}
static Side SideForPaddingOrMarginOrInsetProperty(nsCSSPropertyID aPropID) {

View File

@@ -754,7 +754,7 @@ void nsTableCellFrame::Reflow(nsPresContext* aPresContext,
{
const auto padding = aReflowInput.ComputedLogicalPadding(kidWM);
kidReflowInput.Init(aPresContext, Nothing(), Nothing(), Some(padding));
if (firstKid->IsScrollFrame()) {
if (firstKid->IsScrollContainerFrame()) {
// Propagate explicit block sizes to our inner frame, if it's a scroll
// frame. Note that in table layout, explicit heights act as a minimum
// height, see nsTableRowFrame::CalcCellActualBSize.