Bug 1464290 - Merge nsIFrame::IsVisuallyAtomic and IsStackingContext since the conclusion is that we want their behaviour to be identical. r?dbaron
MozReview-Commit-ID: A97NejkGoTr
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3654,24 +3654,21 @@ nsIFrame::BuildDisplayListForChild(nsDis
// Child is composited if it's transformed, partially transparent, or has
// SVG effects or a blend mode..
EffectSet* effectSet = EffectSet::GetEffectSet(child);
const nsStyleDisplay* disp = child->StyleDisplay();
const nsStyleEffects* effects = child->StyleEffects();
const nsStylePosition* pos = child->StylePosition();
- const bool isVisuallyAtomic =
- child->IsVisuallyAtomic(effectSet, disp, effects);
-
const bool isPositioned =
disp->IsAbsPosContainingBlock(child);
const bool isStackingContext =
- child->IsStackingContext(disp, pos, isPositioned, isVisuallyAtomic) ||
+ child->IsStackingContext(effectSet, disp, pos, effects, isPositioned) ||
(aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
if (pseudoStackingContext || isStackingContext || isPositioned ||
(!isSVG && disp->IsFloating(child)) ||
(isSVG && (effects->mClipFlags & NS_STYLE_CLIP_RECT) &&
IsSVGContentWithCSSClip(child))) {
pseudoStackingContext = true;
awayFromCommonPath = true;
@@ -3811,17 +3808,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
extraPositionedDescendants.AppendToTop(pseudoStack.PositionedDescendants());
#ifdef DEBUG
DisplayDebugBorders(aBuilder, child, aLists);
#endif
}
buildingForChild.RestoreBuildingInvisibleItemsValue();
- if (isPositioned || isVisuallyAtomic ||
+ if (isPositioned || isStackingContext ||
(aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT)) {
// Genuine stacking contexts, and positioned pseudo-stacking-contexts,
// go in this level.
if (!list.IsEmpty()) {
nsDisplayItem* item = WrapInWrapList(aBuilder, child, &list, wrapListASR, canSkipWrapList);
if (isSVG) {
aLists.Content()->AppendToTop(item);
} else {
@@ -10921,56 +10918,44 @@ nsIFrame::CreateOwnLayerIfNeeded(nsDispl
bool
nsIFrame::IsSelected() const
{
return (GetContent() && GetContent()->IsSelectionDescendant()) ?
IsFrameSelected() : false;
}
bool
-nsIFrame::IsVisuallyAtomic(EffectSet* aEffectSet,
- const nsStyleDisplay* aStyleDisplay,
- const nsStyleEffects* aStyleEffects) {
+nsIFrame::IsStackingContext(EffectSet* aEffectSet,
+ const nsStyleDisplay* aStyleDisplay,
+ const nsStylePosition* aStylePosition,
+ const nsStyleEffects* aStyleEffects,
+ bool aIsPositioned)
+{
return HasOpacity(aEffectSet) ||
IsTransformed(aStyleDisplay) ||
aStyleDisplay->IsContainPaint() ||
// strictly speaking, 'perspective' doesn't require visual atomicity,
// but the spec says it acts like the rest of these
ChildrenHavePerspective(aStyleDisplay) ||
aStyleEffects->mMixBlendMode != NS_STYLE_BLEND_NORMAL ||
- nsSVGIntegrationUtils::UsingEffectsForFrame(this);
-}
-
-bool
-nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
- const nsStylePosition* aStylePosition,
- bool aIsPositioned,
- bool aIsVisuallyAtomic)
-{
- return aIsVisuallyAtomic ||
+ nsSVGIntegrationUtils::UsingEffectsForFrame(this) ||
(aIsPositioned && (aStyleDisplay->IsPositionForcingStackingContext() ||
aStylePosition->mZIndex.GetUnit() == eStyleUnit_Integer)) ||
(aStyleDisplay->mWillChangeBitField & NS_STYLE_WILL_CHANGE_STACKING_CONTEXT) ||
aStyleDisplay->mIsolation != NS_STYLE_ISOLATION_AUTO;
}
bool
nsIFrame::IsStackingContext()
{
const nsStyleDisplay* disp = StyleDisplay();
- const bool isVisuallyAtomic = IsVisuallyAtomic(EffectSet::GetEffectSet(this),
- disp, StyleEffects());
- if (isVisuallyAtomic) {
- // If this is changed, the function above should be updated as well.
- return true;
- }
-
const bool isPositioned = disp->IsAbsPosContainingBlock(this);
- return IsStackingContext(disp, StylePosition(),
- isPositioned, isVisuallyAtomic);
+ return IsStackingContext(EffectSet::GetEffectSet(this), disp,
+ StylePosition(), StyleEffects(),
+ isPositioned);
}
static bool
IsFrameScrolledOutOfView(nsIFrame* aTarget,
const nsRect& aTargetRect,
nsIFrame* aParent)
{
nsIScrollableFrame* scrollableFrame =
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -3496,34 +3496,26 @@ public:
/**
* Overridable function to determine whether this frame should be considered
* "in" the given non-null aSelection for visibility purposes.
*/
virtual bool IsVisibleInSelection(mozilla::dom::Selection* aSelection);
/**
- * Determines if this frame has a container effect that requires
- * it to paint as a visually atomic unit.
- */
- bool IsVisuallyAtomic(mozilla::EffectSet* aEffectSet,
- const nsStyleDisplay* aStyleDisplay,
- const nsStyleEffects* aStyleEffects);
-
- /**
* Determines if this frame is a stacking context.
*
* @param aIsPositioned The precomputed result of IsAbsPosContainingBlock
* on the StyleDisplay().
- * @param aIsVisuallyAtomic The precomputed result of IsVisuallyAtomic.
- */
- bool IsStackingContext(const nsStyleDisplay* aStyleDisplay,
+ */
+ bool IsStackingContext(mozilla::EffectSet* aEffectSet,
+ const nsStyleDisplay* aStyleDisplay,
const nsStylePosition* aStylePosition,
- bool aIsPositioned,
- bool aIsVisuallyAtomic);
+ const nsStyleEffects* aStyleEffects,
+ bool aIsPositioned);
bool IsStackingContext();
virtual bool HonorPrintBackgroundSettings() { return true; }
/**
* Determine whether the frame is logically empty, which is roughly
* whether the layout would be the same whether or not the frame is
* present. Placeholder frames should return true. Block frames