mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Bug 842114 - Part 1. Correct assert condition and promote NS_ASSERTION to MOZ_ASSERT. r=heycam
Except during restyle process, we should skip this checking in reflow as well. But what really should do is to skip this checking if this function is called from ComputeEffectsRect. The reason is explained in the beginning of ComputePostEffectsVisualOverflowRect. Also promote NS_ASSERTION to MOZ_ASSERTION in this patch. MozReview-Commit-ID: 3CuKkdR4kTK --HG-- extra : rebase_source : 968f708603ec4424dd32f23bf2a4ffc74ce3fc85
This commit is contained in:
parent
a972c3dec6
commit
f8a699428b
@ -55,18 +55,21 @@ public:
|
||||
*/
|
||||
PreEffectsVisualOverflowCollector(nsIFrame* aFirstContinuation,
|
||||
nsIFrame* aCurrentFrame,
|
||||
const nsRect& aCurrentFrameOverflowArea)
|
||||
const nsRect& aCurrentFrameOverflowArea,
|
||||
bool aCheckPreEffectsBBoxPropCache)
|
||||
: mFirstContinuation(aFirstContinuation)
|
||||
, mCurrentFrame(aCurrentFrame)
|
||||
, mCurrentFrameOverflowArea(aCurrentFrameOverflowArea)
|
||||
, mCheckPreEffectsBBoxPropCache(aCheckPreEffectsBBoxPropCache)
|
||||
{
|
||||
NS_ASSERTION(!mFirstContinuation->GetPrevContinuation(),
|
||||
"We want the first continuation here");
|
||||
}
|
||||
|
||||
virtual void AddBox(nsIFrame* aFrame) override {
|
||||
nsRect overflow = (aFrame == mCurrentFrame) ?
|
||||
mCurrentFrameOverflowArea : GetPreEffectsVisualOverflowRect(aFrame);
|
||||
nsRect overflow = (aFrame == mCurrentFrame)
|
||||
? mCurrentFrameOverflowArea
|
||||
: GetPreEffectsVisualOverflowRect(aFrame, mCheckPreEffectsBBoxPropCache);
|
||||
mResult.UnionRect(mResult, overflow + aFrame->GetOffsetTo(mFirstContinuation));
|
||||
}
|
||||
|
||||
@ -76,7 +79,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
static nsRect GetPreEffectsVisualOverflowRect(nsIFrame* aFrame) {
|
||||
static nsRect GetPreEffectsVisualOverflowRect(nsIFrame* aFrame,
|
||||
bool aCheckPropCache) {
|
||||
nsRect* r = aFrame->Properties().Get(nsIFrame::PreEffectsBBoxProperty());
|
||||
if (r) {
|
||||
return *r;
|
||||
@ -112,27 +116,24 @@ private:
|
||||
// property set, that would be bad, since then our GetVisualOverflowRect()
|
||||
// call would give us the post-effects, and post-transform, overflow rect.
|
||||
//
|
||||
// There are two more exceptions:
|
||||
// 1. In nsStyleImageLayers::Layer::CalcDifference, we do not add
|
||||
// nsChangeHint_UpdateOverflow hint when image mask(not SVG mask)
|
||||
// property value changed, since replace image mask does not cause
|
||||
// layout change. So even if we apply a new mask image to this frame,
|
||||
// PreEffectsBBoxProperty might still left empty.
|
||||
// 2. During restyling: before the last continuation is restyled, there
|
||||
// is no guarantee that every continuation carries a
|
||||
// PreEffectsBBoxProperty property.
|
||||
// There is one more exceptions, in
|
||||
// nsStyleImageLayers::Layer::CalcDifference, we do not add
|
||||
// nsChangeHint_UpdateOverflow hint when image mask(not SVG mask) property
|
||||
// value changed, since replace image mask does not cause layout change.
|
||||
// So even if we apply a new mask image to this frame,
|
||||
// PreEffectsBBoxProperty might still left empty.
|
||||
#ifdef DEBUG
|
||||
nsIFrame* firstFrame =
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
|
||||
bool mightHaveNoneSVGMask =
|
||||
nsSVGEffects::GetEffectProperties(firstFrame).MightHaveNoneSVGMask();
|
||||
bool inRestyle =
|
||||
aFrame->PresContext()->RestyleManager()->IsInStyleRefresh();
|
||||
if (aCheckPropCache) {
|
||||
nsIFrame* firstFrame =
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
|
||||
bool mightHaveNoneSVGMask =
|
||||
nsSVGEffects::GetEffectProperties(firstFrame).MightHaveNoneSVGMask();
|
||||
|
||||
NS_ASSERTION(mightHaveNoneSVGMask || inRestyle ||
|
||||
MOZ_ASSERT(mightHaveNoneSVGMask ||
|
||||
aFrame->GetParent()->StyleContext()->GetPseudo() ==
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
"How did we getting here, then?");
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(!aFrame->Properties().Get(
|
||||
aFrame->PreTransformOverflowAreasProperty()),
|
||||
@ -144,6 +145,7 @@ private:
|
||||
nsIFrame* mCurrentFrame;
|
||||
const nsRect& mCurrentFrameOverflowArea;
|
||||
nsRect mResult;
|
||||
bool mCheckPreEffectsBBoxPropCache;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -154,13 +156,15 @@ static nsRect
|
||||
GetPreEffectsVisualOverflowUnion(nsIFrame* aFirstContinuation,
|
||||
nsIFrame* aCurrentFrame,
|
||||
const nsRect& aCurrentFramePreEffectsOverflow,
|
||||
const nsPoint& aFirstContinuationToUserSpace)
|
||||
const nsPoint& aFirstContinuationToUserSpace,
|
||||
bool aCheckPreEffectsBBoxPropCache)
|
||||
{
|
||||
NS_ASSERTION(!aFirstContinuation->GetPrevContinuation(),
|
||||
"Need first continuation here");
|
||||
PreEffectsVisualOverflowCollector collector(aFirstContinuation,
|
||||
aCurrentFrame,
|
||||
aCurrentFramePreEffectsOverflow);
|
||||
aCurrentFramePreEffectsOverflow,
|
||||
aCheckPreEffectsBBoxPropCache);
|
||||
// Compute union of all overflow areas relative to aFirstContinuation:
|
||||
nsLayoutUtils::GetAllInFlowBoxes(aFirstContinuation, &collector);
|
||||
// Return the result in user space:
|
||||
@ -238,7 +242,8 @@ nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame)
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
|
||||
// 'r' is in "user space":
|
||||
nsRect r = GetPreEffectsVisualOverflowUnion(firstFrame, nullptr, nsRect(),
|
||||
GetOffsetToBoundingBox(firstFrame));
|
||||
GetOffsetToBoundingBox(firstFrame),
|
||||
true);
|
||||
return nsLayoutUtils::RectToGfxRect(r,
|
||||
aNonSVGFrame->PresContext()->AppUnitsPerCSSPixel());
|
||||
}
|
||||
@ -300,7 +305,11 @@ nsRect
|
||||
nsLayoutUtils::RectToGfxRect(
|
||||
GetPreEffectsVisualOverflowUnion(firstFrame, aFrame,
|
||||
aPreEffectsOverflowRect,
|
||||
firstFrameToBoundingBox),
|
||||
firstFrameToBoundingBox,
|
||||
false /* See the beginning of the
|
||||
comment above this function to
|
||||
know why we skip this
|
||||
checking. */),
|
||||
aFrame->PresContext()->AppUnitsPerCSSPixel());
|
||||
overrideBBox.RoundOut();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user