Bug 813531 - Part 2: Stop reconstructing the entire SVG frame tree after the initial reflow of nsSVGOuterSVGFrame frames that have a viewBox. r=roc, a=bajaj.

This commit is contained in:
Jonathan Watt 2012-12-18 02:25:16 +00:00
Родитель 346dbc51e5
Коммит 3afd8ac2ec
3 изменённых файлов: 19 добавлений и 9 удалений

Просмотреть файл

@ -941,6 +941,16 @@ nsSVGSVGElement::GetViewBoxTransform() const
GetPreserveAspectRatioWithOverride());
}
void
nsSVGSVGElement::UpdateHasChildrenOnlyTransform()
{
bool hasChildrenOnlyTransform =
HasViewBoxOrSyntheticViewBox() ||
(IsRoot() && (mCurrentTranslate != nsSVGTranslatePoint(0.0f, 0.0f) ||
mCurrentScale != 1.0f));
mHasChildrenOnlyTransform = hasChildrenOnlyTransform;
}
void
nsSVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
{
@ -951,12 +961,13 @@ nsSVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
nsChangeHint changeHint;
bool hasChildrenOnlyTransform = HasViewBoxOrSyntheticViewBox() ||
(IsRoot() && (mCurrentTranslate != nsSVGTranslatePoint(0.0f, 0.0f) ||
mCurrentScale != 1.0f));
bool hadChildrenOnlyTransform = mHasChildrenOnlyTransform;
if (hasChildrenOnlyTransform != mHasChildrenOnlyTransform) {
UpdateHasChildrenOnlyTransform();
if (hadChildrenOnlyTransform != mHasChildrenOnlyTransform) {
// Reconstruct the frame tree to handle stacking context changes:
// XXXjwatt don't do this for root-<svg> or even outer-<svg>?
changeHint = nsChangeHint_ReconstructFrame;
} else {
// We just assume the old and new transforms are different.
@ -974,8 +985,6 @@ nsSVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
!(aFlags & eDuringReflow)) {
nsLayoutUtils::PostRestyleEvent(this, nsRestyleHint(0), changeHint);
}
mHasChildrenOnlyTransform = hasChildrenOnlyTransform;
}
nsresult

Просмотреть файл

@ -210,6 +210,8 @@ public:
return mHasChildrenOnlyTransform;
}
void UpdateHasChildrenOnlyTransform();
enum ChildrenOnlyTransformChangedFlags {
eDuringReflow = 1
};

Просмотреть файл

@ -414,8 +414,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
if (mState & NS_FRAME_FIRST_REFLOW) {
// Initialize
svgElem->mHasChildrenOnlyTransform =
anonKid->HasChildrenOnlyTransform(nullptr);
svgElem->UpdateHasChildrenOnlyTransform();
}
// If our SVG viewport has changed, update our content and notify.
@ -451,10 +450,10 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
changeBits |= FULL_ZOOM_CHANGED;
mFullZoom = PresContext()->GetFullZoom();
}
mViewportInitialized = true;
if (changeBits) {
NotifyViewportOrTransformChanged(changeBits);
}
mViewportInitialized = true;
if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
// Now that we've marked the necessary children as dirty, call