mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Attach FrameProperties to each frame instead of using a shared hashtable
Dispense the shared hashtable and instead attach the frame property list directly to nsIFrame.
This commit is contained in:
parent
c135831979
commit
922e819d1c
62 changed files with 738 additions and 945 deletions
|
|
@ -1816,8 +1816,8 @@ nsFlexContainerFrame::MeasureAscentAndHeightForFlexItem(
|
|||
nsPresContext* aPresContext,
|
||||
ReflowInput& aChildReflowInput)
|
||||
{
|
||||
const FrameProperties props = aItem.Frame()->Properties();
|
||||
if (const auto* cachedResult = props.Get(CachedFlexMeasuringReflow())) {
|
||||
if (const auto* cachedResult =
|
||||
aItem.Frame()->GetProperty(CachedFlexMeasuringReflow())) {
|
||||
if (cachedResult->IsValidFor(aChildReflowInput)) {
|
||||
return *cachedResult;
|
||||
}
|
||||
|
|
@ -1847,7 +1847,7 @@ nsFlexContainerFrame::MeasureAscentAndHeightForFlexItem(
|
|||
auto result =
|
||||
new CachedMeasuringReflowResult(aChildReflowInput, childDesiredSize);
|
||||
|
||||
props.Set(CachedFlexMeasuringReflow(), result);
|
||||
aItem.Frame()->SetProperty(CachedFlexMeasuringReflow(), result);
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
|
@ -1855,7 +1855,7 @@ nsFlexContainerFrame::MeasureAscentAndHeightForFlexItem(
|
|||
nsFlexContainerFrame::MarkIntrinsicISizesDirty()
|
||||
{
|
||||
for (nsIFrame* childFrame : mFrames) {
|
||||
childFrame->Properties().Delete(CachedFlexMeasuringReflow());
|
||||
childFrame->DeleteProperty(CachedFlexMeasuringReflow());
|
||||
}
|
||||
nsContainerFrame::MarkIntrinsicISizesDirty();
|
||||
}
|
||||
|
|
@ -4236,25 +4236,26 @@ class MOZ_RAII AutoFlexItemMainSizeOverride final
|
|||
public:
|
||||
explicit AutoFlexItemMainSizeOverride(FlexItem& aItem
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mItemProps(aItem.Frame()->Properties())
|
||||
: mItemFrame(aItem.Frame())
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
MOZ_ASSERT(!mItemProps.Has(nsIFrame::FlexItemMainSizeOverride()),
|
||||
MOZ_ASSERT(!mItemFrame->HasProperty(nsIFrame::FlexItemMainSizeOverride()),
|
||||
"FlexItemMainSizeOverride prop shouldn't be set already; "
|
||||
"it should only be set temporarily (& not recursively)");
|
||||
NS_ASSERTION(aItem.HasIntrinsicRatio(),
|
||||
"This should only be needed for items with an aspect ratio");
|
||||
|
||||
mItemProps.Set(nsIFrame::FlexItemMainSizeOverride(), aItem.GetMainSize());
|
||||
mItemFrame->SetProperty(nsIFrame::FlexItemMainSizeOverride(),
|
||||
aItem.GetMainSize());
|
||||
}
|
||||
|
||||
~AutoFlexItemMainSizeOverride() {
|
||||
mItemProps.Remove(nsIFrame::FlexItemMainSizeOverride());
|
||||
mItemFrame->RemoveProperty(nsIFrame::FlexItemMainSizeOverride());
|
||||
}
|
||||
|
||||
private:
|
||||
const FrameProperties mItemProps;
|
||||
nsIFrame* mItemFrame;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
|
|
@ -4668,8 +4669,7 @@ nsFlexContainerFrame::MoveFlexItemToFinalPosition(
|
|||
// If item is relpos, look up its offsets (cached from prev reflow)
|
||||
LogicalMargin logicalOffsets(outerWM);
|
||||
if (NS_STYLE_POSITION_RELATIVE == aItem.Frame()->StyleDisplay()->mPosition) {
|
||||
FrameProperties props = aItem.Frame()->Properties();
|
||||
nsMargin* cachedOffsets = props.Get(nsIFrame::ComputedOffsetProperty());
|
||||
nsMargin* cachedOffsets = aItem.Frame()->GetProperty(nsIFrame::ComputedOffsetProperty());
|
||||
MOZ_ASSERT(cachedOffsets,
|
||||
"relpos previously-reflowed frame should've cached its offsets");
|
||||
logicalOffsets = LogicalMargin(outerWM, *cachedOffsets);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue