1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
--- .pc/401042-backport.patch/layout/generic/nsInlineFrame.cpp 2009-01-05 02:55:09.000000000 +0100
+++ layout/generic/nsInlineFrame.cpp 2009-01-05 02:56:08.000000000 +0100
@@ -576,27 +576,52 @@ nsInlineFrame::ReflowFrames(nsPresContex
ReparentFloatsForInlineChild(irs.mLineContainer, frame, PR_FALSE);
}
frame->SetParent(this);
// We also need to check if frame has a next-in-flow. It it does, then set
// its parent frame pointer, too. Otherwise, if we reflow frame and it's
// complete we'll fail when deleting its next-in-flow which is no longer
// needed. This scenario doesn't happen often, but it can happen
nsIFrame* nextInFlow = frame->GetNextInFlow();
- while (nextInFlow) {
+ for ( ; nextInFlow; nextInFlow = nextInFlow->GetNextInFlow()) {
// Since we only do lazy setting of parent pointers for the frame's
// initial reflow, this frame can't have a next-in-flow. That means
// the continuing child frame must be in our child list as well. If
// not, then something is wrong
NS_ASSERTION(mFrames.ContainsFrame(nextInFlow), "unexpected flow");
if (havePrevBlock) {
ReparentFloatsForInlineChild(irs.mLineContainer, nextInFlow, PR_FALSE);
}
nextInFlow->SetParent(this);
- nextInFlow = nextInFlow->GetNextInFlow();
+ }
+
+ // Fix the parent pointer for ::first-letter child frame next-in-flows,
+ // so nsFirstLetterFrame::Reflow can destroy them safely (bug 401042).
+ nsIFrame* realFrame = nsPlaceholderFrame::GetRealFrameFor(frame);
+ if (realFrame->GetType() == nsLayoutAtoms::letterFrame) {
+ nsIFrame* child = realFrame->GetFirstChild(nsnull);
+ if (child) {
+ nsIFrame* nextInFlow = child->GetNextInFlow();
+ for ( ; nextInFlow; nextInFlow = nextInFlow->GetNextInFlow()) {
+ if (mFrames.ContainsFrame(nextInFlow)) {
+ nextInFlow->SetParent(this);
+ }
+ else {
+#ifdef DEBUG
+ // Once we find a next-in-flow that isn't ours none of the
+ // remaining next-in-flows should be either.
+ for ( ; nextInFlow; nextInFlow = nextInFlow->GetNextInFlow()) {
+ NS_ASSERTION(!mFrames.ContainsFrame(nextInFlow),
+ "unexpected letter frame flow");
+ }
+#endif
+ break;
+ }
+ }
+ }
}
}
rv = ReflowInlineFrame(aPresContext, aReflowState, irs, frame, aStatus);
if (NS_FAILED(rv)) {
done = PR_TRUE;
break;
}
if (NS_INLINE_IS_BREAK(aStatus) ||
|