зеркало из https://github.com/mozilla/pjs.git
Properly dirty intrinsic widths when doing things that change inflation. (Bug 759755, patch 3) r=roc
This commit is contained in:
Родитель
a7797481ee
Коммит
b30ee5e90d
|
@ -282,7 +282,8 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
|
||||||
if (shell) {
|
if (shell) {
|
||||||
nsIFrame *rootFrame = shell->GetRootFrame();
|
nsIFrame *rootFrame = shell->GetRootFrame();
|
||||||
if (rootFrame) {
|
if (rootFrame) {
|
||||||
shell->FrameNeedsReflow(rootFrame, nsIPresShell::eResize,
|
shell->FrameNeedsReflow(rootFrame,
|
||||||
|
nsIPresShell::eStyleChange,
|
||||||
NS_FRAME_IS_DIRTY);
|
NS_FRAME_IS_DIRTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2516,6 +2516,8 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
|
||||||
if (aIntrinsicDirty == eStyleChange) {
|
if (aIntrinsicDirty == eStyleChange) {
|
||||||
// Mark all descendants dirty (using an nsTArray stack rather than
|
// Mark all descendants dirty (using an nsTArray stack rather than
|
||||||
// recursion).
|
// recursion).
|
||||||
|
// Note that nsHTMLReflowState::InitResizeFlags has some similar
|
||||||
|
// code; see comments there for how and why it differs.
|
||||||
nsAutoTArray<nsIFrame*, 32> stack;
|
nsAutoTArray<nsIFrame*, 32> stack;
|
||||||
stack.AppendElement(subtreeRoot);
|
stack.AppendElement(subtreeRoot);
|
||||||
|
|
||||||
|
|
|
@ -403,6 +403,44 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameT
|
||||||
} else {
|
} else {
|
||||||
frame->AddStateBits(NS_FRAME_IS_DIRTY);
|
frame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark intrinsic widths on all descendants dirty. We need to do
|
||||||
|
// this (1) since we're changing the size of text and need to
|
||||||
|
// clear text runs on text frames and (2) since we actually are
|
||||||
|
// changing some intrinsic widths, but only those that live inside
|
||||||
|
// of containers.
|
||||||
|
|
||||||
|
// It makes sense to do this for descendants but not ancestors
|
||||||
|
// (which is unusual) because we're only changing the unusual
|
||||||
|
// inflation-dependent intrinsic widths (i.e., ones computed with
|
||||||
|
// nsPresContext::mInflationDisabledForShrinkWrap set to false),
|
||||||
|
// which should never affect anything outside of their inflation
|
||||||
|
// flow root (or, for that matter, even their inflation
|
||||||
|
// container).
|
||||||
|
|
||||||
|
// This is also different from what PresShell::FrameNeedsReflow
|
||||||
|
// does because it doesn't go through placeholders. It doesn't
|
||||||
|
// need to because we're actually doing something that cares about
|
||||||
|
// frame tree geometry (the width on an ancestor) rather than
|
||||||
|
// style.
|
||||||
|
|
||||||
|
nsAutoTArray<nsIFrame*, 32> stack;
|
||||||
|
stack.AppendElement(frame);
|
||||||
|
|
||||||
|
do {
|
||||||
|
nsIFrame *f = stack.ElementAt(stack.Length() - 1);
|
||||||
|
stack.RemoveElementAt(stack.Length() - 1);
|
||||||
|
|
||||||
|
nsIFrame::ChildListIterator lists(f);
|
||||||
|
for (; !lists.IsDone(); lists.Next()) {
|
||||||
|
nsFrameList::Enumerator childFrames(lists.CurrentList());
|
||||||
|
for (; !childFrames.AtEnd(); childFrames.Next()) {
|
||||||
|
nsIFrame* kid = childFrames.get();
|
||||||
|
kid->MarkIntrinsicWidthsDirty();
|
||||||
|
stack.AppendElement(kid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (stack.Length() != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче