зеркало из https://github.com/mozilla/gecko-dev.git
Bug 950526 - don't dump textruns within nsTextFrame::DidSetStyleContext. r=dbaron
This commit is contained in:
Родитель
345975db49
Коммит
8174f98f22
|
@ -3676,6 +3676,51 @@ nsLayoutUtils::ComputeHeightDependentValue(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutUtils::MarkDescendantsDirty(nsIFrame *aSubtreeRoot)
|
||||
{
|
||||
nsAutoTArray<nsIFrame*, 4> subtrees;
|
||||
subtrees.AppendElement(aSubtreeRoot);
|
||||
|
||||
// dirty descendants, iterating over subtrees that may include
|
||||
// additional subtrees associated with placeholders
|
||||
do {
|
||||
nsIFrame *subtreeRoot = subtrees.ElementAt(subtrees.Length() - 1);
|
||||
subtrees.RemoveElementAt(subtrees.Length() - 1);
|
||||
|
||||
// Mark all descendants dirty (using an nsTArray stack rather than
|
||||
// recursion).
|
||||
// Note that nsHTMLReflowState::InitResizeFlags has some similar
|
||||
// code; see comments there for how and why it differs.
|
||||
nsAutoTArray<nsIFrame*, 32> stack;
|
||||
stack.AppendElement(subtreeRoot);
|
||||
|
||||
do {
|
||||
nsIFrame *f = stack.ElementAt(stack.Length() - 1);
|
||||
stack.RemoveElementAt(stack.Length() - 1);
|
||||
|
||||
f->MarkIntrinsicWidthsDirty();
|
||||
|
||||
if (f->GetType() == nsGkAtoms::placeholderFrame) {
|
||||
nsIFrame *oof = nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
|
||||
if (!nsLayoutUtils::IsProperAncestorFrame(subtreeRoot, oof)) {
|
||||
// We have another distinct subtree we need to mark.
|
||||
subtrees.AppendElement(oof);
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame::ChildListIterator lists(f);
|
||||
for (; !lists.IsDone(); lists.Next()) {
|
||||
nsFrameList::Enumerator childFrames(lists.CurrentList());
|
||||
for (; !childFrames.AtEnd(); childFrames.Next()) {
|
||||
nsIFrame* kid = childFrames.get();
|
||||
stack.AppendElement(kid);
|
||||
}
|
||||
}
|
||||
} while (stack.Length() != 0);
|
||||
} while (subtrees.Length() != 0);
|
||||
}
|
||||
|
||||
#define MULDIV(a,b,c) (nscoord(int64_t(a) * int64_t(b) / int64_t(c)))
|
||||
|
||||
/* static */ nsSize
|
||||
|
|
|
@ -1210,6 +1210,8 @@ public:
|
|||
nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) == 0);
|
||||
}
|
||||
|
||||
static void MarkDescendantsDirty(nsIFrame *aSubtreeRoot);
|
||||
|
||||
/*
|
||||
* Calculate the used values for 'width' and 'height' for a replaced element.
|
||||
*
|
||||
|
|
|
@ -85,6 +85,7 @@ nsFirstLetterFrame::SetInitialChildList(ChildListID aListID,
|
|||
for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
|
||||
NS_ASSERTION(e.get()->GetParent() == this, "Unexpected parent");
|
||||
restyleManager->ReparentStyleContext(e.get());
|
||||
nsLayoutUtils::MarkDescendantsDirty(e.get());
|
||||
}
|
||||
|
||||
mFrames.SetFrames(aChildList);
|
||||
|
|
|
@ -286,6 +286,7 @@ ReparentChildListStyle(nsPresContext* aPresContext,
|
|||
for (nsFrameList::Enumerator e(aFrames); !e.AtEnd(); e.Next()) {
|
||||
NS_ASSERTION(e.get()->GetParent() == aParentFrame, "Bogus parentage");
|
||||
restyleManager->ReparentStyleContext(e.get());
|
||||
nsLayoutUtils::MarkDescendantsDirty(e.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,6 +425,7 @@ nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags,
|
|||
f->SetParent(this);
|
||||
if (inFirstLine) {
|
||||
restyleManager->ReparentStyleContext(f);
|
||||
nsLayoutUtils::MarkDescendantsDirty(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -529,6 +531,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
child->SetParent(this);
|
||||
if (inFirstLine) {
|
||||
restyleManager->ReparentStyleContext(child);
|
||||
nsLayoutUtils::MarkDescendantsDirty(child);
|
||||
}
|
||||
// We also need to do the same for |frame|'s next-in-flows that are in
|
||||
// the sibling list. Otherwise, if we reflow |frame| and it's complete
|
||||
|
@ -563,6 +566,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
nextInFlow->SetParent(this);
|
||||
if (inFirstLine) {
|
||||
restyleManager->ReparentStyleContext(nextInFlow);
|
||||
nsLayoutUtils::MarkDescendantsDirty(nextInFlow);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1005,6 +1009,7 @@ nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowState& i
|
|||
// style-context that we just pulled.
|
||||
NS_ASSERTION(frame->GetParent() == this, "Incorrect parent?");
|
||||
aPresContext->RestyleManager()->ReparentStyleContext(frame);
|
||||
nsLayoutUtils::MarkDescendantsDirty(frame);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
|
|
@ -4441,7 +4441,6 @@ nsTextFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
|
|||
nsTextFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
{
|
||||
nsFrame::DidSetStyleContext(aOldStyleContext);
|
||||
ClearTextRuns();
|
||||
}
|
||||
|
||||
class nsDisplayTextGeometry : public nsDisplayItemGenericGeometry
|
||||
|
|
|
@ -3312,7 +3312,7 @@ SVGTextFrame::ScheduleReflowSVGNonDisplayText()
|
|||
MOZ_ASSERT(f, "should have found an ancestor frame to reflow");
|
||||
|
||||
PresContext()->PresShell()->FrameNeedsReflow(
|
||||
f, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
f, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(SVGTextFrame::MutationObserver, nsIMutationObserver)
|
||||
|
|
Загрузка…
Ссылка в новой задаче