mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 08:45:46 +00:00
Bug 1644498: Transition devtools nsFrameStateBits to nsIFrame.h r=heycam
This patch takes the flags NS_STATE_GRID_GENERATE_COMPUTED_VALUES and NS_STATE_FLEX_GENERATE_COMPUTED_VALUES and combines them into a single new flag that is defined in nsIFrame.h, with accessors. Differential Revision: https://phabricator.services.mozilla.com/D78978
This commit is contained in:
parent
ec7f81e276
commit
bec018af01
@ -4583,13 +4583,13 @@ void nsFlexContainerFrame::CalculatePackingSpace(
|
||||
|
||||
ComputedFlexContainerInfo*
|
||||
nsFlexContainerFrame::CreateOrClearFlexContainerInfo() {
|
||||
if (!HasAnyStateBits(NS_STATE_FLEX_GENERATE_COMPUTED_VALUES)) {
|
||||
if (!ShouldGenerateComputedInfo()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// NS_STATE_FLEX_GENERATE_COMPUTED_VALUES will never be cleared. That's
|
||||
// acceptable because it's only set in a Chrome API invoked by devtools, and
|
||||
// won't impact normal browsing.
|
||||
// The flag that sets ShouldGenerateComputedInfo() will never be cleared.
|
||||
// That's acceptable because it's only set in a Chrome API invoked by
|
||||
// devtools, and won't impact normal browsing.
|
||||
|
||||
// Re-use the ComputedFlexContainerInfo, if it exists.
|
||||
ComputedFlexContainerInfo* info = GetProperty(FlexContainerInfo());
|
||||
@ -4734,7 +4734,7 @@ nsFlexContainerFrame* nsFlexContainerFrame::GetFlexFrameWithComputedInfo(
|
||||
AutoWeakFrame weakFrameRef(aFrame);
|
||||
|
||||
RefPtr<mozilla::PresShell> presShell = flexFrame->PresShell();
|
||||
flexFrame->AddStateBits(NS_STATE_FLEX_GENERATE_COMPUTED_VALUES);
|
||||
flexFrame->SetShouldGenerateComputedInfo(true);
|
||||
presShell->FrameNeedsReflow(flexFrame, IntrinsicDirty::Resize,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
presShell->FlushPendingNotifications(FlushType::Layout);
|
||||
@ -4836,9 +4836,9 @@ void nsFlexContainerFrame::DoFlexLayout(
|
||||
// size adjustments). We'll later fix up the line properties,
|
||||
// because the correct values aren't available yet.
|
||||
if (aContainerInfo) {
|
||||
MOZ_ASSERT(HasAnyStateBits(NS_STATE_FLEX_GENERATE_COMPUTED_VALUES),
|
||||
MOZ_ASSERT(ShouldGenerateComputedInfo(),
|
||||
"We should only have the info struct if "
|
||||
"NS_STATE_FLEX_GENERATE_COMPUTED_VALUES state bit is set!");
|
||||
"ShouldGenerateComputedInfo() is true!");
|
||||
|
||||
if (!aStruts.IsEmpty()) {
|
||||
// We restarted DoFlexLayout, and may have stale mLines to clear:
|
||||
|
@ -341,24 +341,21 @@ FRAME_STATE_BIT(FlexContainer, 20,
|
||||
// 'display:-webkit-{inline-}box' or 'display:-moz-{inline-}box' container.
|
||||
FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_EMULATING_LEGACY_BOX)
|
||||
|
||||
// True iff computed flex values should be generated on the next reflow
|
||||
FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_GENERATE_COMPUTED_VALUES)
|
||||
|
||||
// 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 if any flex item in the container has a line with a
|
||||
// -webkit-line-ellipsis marker.
|
||||
FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_HAS_LINE_CLAMP_ELLIPSIS)
|
||||
FRAME_STATE_BIT(FlexContainer, 23, NS_STATE_FLEX_HAS_LINE_CLAMP_ELLIPSIS)
|
||||
|
||||
// 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, 25, NS_STATE_FLEX_DID_PUSH_ITEMS)
|
||||
FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_DID_PUSH_ITEMS)
|
||||
|
||||
// We've merged some OverflowList children since last reflow.
|
||||
FRAME_STATE_BIT(FlexContainer, 26, NS_STATE_FLEX_HAS_CHILD_NIFS)
|
||||
FRAME_STATE_BIT(FlexContainer, 25, NS_STATE_FLEX_HAS_CHILD_NIFS)
|
||||
|
||||
// == Frame state bits that apply to grid container frames ====================
|
||||
|
||||
@ -375,35 +372,32 @@ FRAME_STATE_BIT(GridContainer, 20,
|
||||
// actually finding any pushed items when this bit is set.
|
||||
FRAME_STATE_BIT(GridContainer, 21, NS_STATE_GRID_DID_PUSH_ITEMS)
|
||||
|
||||
// True iff computed grid values should be generated on the next reflow.
|
||||
FRAME_STATE_BIT(GridContainer, 22, NS_STATE_GRID_GENERATE_COMPUTED_VALUES)
|
||||
|
||||
// True if the container has no grid items; may lie if there is a pending
|
||||
// reflow.
|
||||
FRAME_STATE_BIT(GridContainer, 23, NS_STATE_GRID_SYNTHESIZE_BASELINE)
|
||||
FRAME_STATE_BIT(GridContainer, 22, NS_STATE_GRID_SYNTHESIZE_BASELINE)
|
||||
|
||||
// True if the container is a subgrid in its inline axis.
|
||||
FRAME_STATE_BIT(GridContainer, 24, NS_STATE_GRID_IS_COL_SUBGRID)
|
||||
FRAME_STATE_BIT(GridContainer, 23, NS_STATE_GRID_IS_COL_SUBGRID)
|
||||
|
||||
// True if the container is a subgrid in its block axis.
|
||||
FRAME_STATE_BIT(GridContainer, 25, NS_STATE_GRID_IS_ROW_SUBGRID)
|
||||
FRAME_STATE_BIT(GridContainer, 24, NS_STATE_GRID_IS_ROW_SUBGRID)
|
||||
|
||||
// The container contains one or more items subgridded in its inline axis.
|
||||
FRAME_STATE_BIT(GridContainer, 26, NS_STATE_GRID_HAS_COL_SUBGRID_ITEM)
|
||||
FRAME_STATE_BIT(GridContainer, 25, NS_STATE_GRID_HAS_COL_SUBGRID_ITEM)
|
||||
|
||||
// The container contains one or more items subgridded in its block axis.
|
||||
FRAME_STATE_BIT(GridContainer, 27, NS_STATE_GRID_HAS_ROW_SUBGRID_ITEM)
|
||||
FRAME_STATE_BIT(GridContainer, 26, NS_STATE_GRID_HAS_ROW_SUBGRID_ITEM)
|
||||
|
||||
// We've merged some OverflowList children since last reflow.
|
||||
FRAME_STATE_BIT(GridContainer, 28, NS_STATE_GRID_HAS_CHILD_NIFS)
|
||||
FRAME_STATE_BIT(GridContainer, 27, NS_STATE_GRID_HAS_CHILD_NIFS)
|
||||
|
||||
// True if the container has masonry layout in its inline axis.
|
||||
// (mutually exclusive with NS_STATE_GRID_IS_ROW_MASONRY)
|
||||
FRAME_STATE_BIT(GridContainer, 29, NS_STATE_GRID_IS_COL_MASONRY)
|
||||
FRAME_STATE_BIT(GridContainer, 28, NS_STATE_GRID_IS_COL_MASONRY)
|
||||
|
||||
// True if the container has masonry layout in its block axis.
|
||||
// (mutually exclusive with NS_STATE_GRID_IS_COL_MASONRY)
|
||||
FRAME_STATE_BIT(GridContainer, 30, NS_STATE_GRID_IS_ROW_MASONRY)
|
||||
FRAME_STATE_BIT(GridContainer, 29, NS_STATE_GRID_IS_ROW_MASONRY)
|
||||
|
||||
// == Frame state bits that apply to SVG frames ===============================
|
||||
|
||||
|
@ -2801,7 +2801,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
|
||||
|
||||
// Copy in the computed grid info state bit
|
||||
if (mSharedGridData->mGenerateComputedGridInfo) {
|
||||
aGridContainerFrame->AddStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
|
||||
aGridContainerFrame->SetShouldGenerateComputedInfo(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4842,8 +4842,7 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
|
||||
}
|
||||
|
||||
// Update the line boundaries of the implicit grid areas, if needed.
|
||||
if (mAreas &&
|
||||
aState.mFrame->HasAnyStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES)) {
|
||||
if (mAreas && aState.mFrame->ShouldGenerateComputedInfo()) {
|
||||
for (auto iter = mAreas->iter(); !iter.done(); iter.next()) {
|
||||
auto& areaInfo = iter.get().value();
|
||||
|
||||
@ -8666,7 +8665,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
bp.BStart(wm), bp.BEnd(wm), desiredSize.BSize(wm));
|
||||
}
|
||||
|
||||
if (HasAnyStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES)) {
|
||||
if (ShouldGenerateComputedInfo()) {
|
||||
// This state bit will never be cleared, since reflow can be called
|
||||
// multiple times in fragmented grids, and it's challenging to scope
|
||||
// the bit to only that sequence of calls. This is relatively harmless
|
||||
@ -8932,8 +8931,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
sharedGridData->mAbsPosItems.Clear();
|
||||
sharedGridData->mAbsPosItems.SwapElements(gridReflowInput.mAbsPosItems);
|
||||
|
||||
sharedGridData->mGenerateComputedGridInfo =
|
||||
HasAnyStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
|
||||
sharedGridData->mGenerateComputedGridInfo = ShouldGenerateComputedInfo();
|
||||
} else if (sharedGridData && !GetNextInFlow()) {
|
||||
RemoveProperty(SharedGridData::Prop());
|
||||
}
|
||||
@ -9621,7 +9619,7 @@ nsGridContainerFrame* nsGridContainerFrame::GetGridFrameWithComputedInfo(
|
||||
AutoWeakFrame weakFrameRef(gridFrame);
|
||||
|
||||
RefPtr<mozilla::PresShell> presShell = gridFrame->PresShell();
|
||||
gridFrame->AddStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
|
||||
gridFrame->SetShouldGenerateComputedInfo(true);
|
||||
presShell->FrameNeedsReflow(gridFrame, IntrinsicDirty::Resize,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
presShell->FlushPendingNotifications(FlushType::Layout);
|
||||
|
@ -606,7 +606,8 @@ class nsIFrame : public nsQueryFrame {
|
||||
mHasBSizeChange(false),
|
||||
mInScrollAnchorChain(false),
|
||||
mHasColumnSpanSiblings(false),
|
||||
mDescendantMayDependOnItsStaticPosition(false) {
|
||||
mDescendantMayDependOnItsStaticPosition(false),
|
||||
mShouldGenerateComputedInfo(false) {
|
||||
MOZ_ASSERT(mComputedStyle);
|
||||
MOZ_ASSERT(mPresContext);
|
||||
mozilla::PodZero(&mOverflow);
|
||||
@ -4583,6 +4584,13 @@ class nsIFrame : public nsQueryFrame {
|
||||
mDescendantMayDependOnItsStaticPosition = aValue;
|
||||
}
|
||||
|
||||
bool ShouldGenerateComputedInfo() const {
|
||||
return mShouldGenerateComputedInfo;
|
||||
}
|
||||
void SetShouldGenerateComputedInfo(bool aValue) {
|
||||
mShouldGenerateComputedInfo = aValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hit test area of the frame.
|
||||
*/
|
||||
@ -4830,6 +4838,13 @@ class nsIFrame : public nsQueryFrame {
|
||||
*/
|
||||
bool mDescendantMayDependOnItsStaticPosition : 1;
|
||||
|
||||
/**
|
||||
* True if the next reflow of this frame should generate computed info
|
||||
* metrics. These are used by devtools to reveal details of the layout
|
||||
* process.
|
||||
*/
|
||||
bool mShouldGenerateComputedInfo : 1;
|
||||
|
||||
protected:
|
||||
// Helpers
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user