summaryrefslogtreecommitdiffstats
path: root/layout/base/nsCSSFrameConstructor.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:17:52 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:17:52 -0400
commit14bb98e17510892a5cd622d76c605f1a7fd8b247 (patch)
treebbe56c2a64c9dd076c07800e8f458e61002042de /layout/base/nsCSSFrameConstructor.cpp
parente31ed5b07466d4a579fe4b025f97c971003fbc3f (diff)
downloadUXP-14bb98e17510892a5cd622d76c605f1a7fd8b247.tar
UXP-14bb98e17510892a5cd622d76c605f1a7fd8b247.tar.gz
UXP-14bb98e17510892a5cd622d76c605f1a7fd8b247.tar.lz
UXP-14bb98e17510892a5cd622d76c605f1a7fd8b247.tar.xz
UXP-14bb98e17510892a5cd622d76c605f1a7fd8b247.zip
Bug 1380749 - Retry AdjustAppendParentForAfterContent in case |parentAfterFrame| was a :first-letter frame that we deleted
Tag #1375
Diffstat (limited to 'layout/base/nsCSSFrameConstructor.cpp')
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 85f53a820..bc49c277b 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7446,20 +7446,14 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
// Deal with possible :after generated content on the parent
nsIFrame* parentAfterFrame;
+ nsContainerFrame* preAdjustedParentFrame = parentFrame;
parentFrame =
::AdjustAppendParentForAfterContent(this, insertion.mContainer, parentFrame,
aFirstNewContent, &parentAfterFrame);
- // Create some new frames
- nsFrameConstructorState state(mPresShell,
- GetAbsoluteContainingBlock(parentFrame, FIXED_POS),
- GetAbsoluteContainingBlock(parentFrame, ABS_POS),
- GetFloatContainingBlock(parentFrame));
- state.mTreeMatchContext.InitAncestors(aContainer->AsElement());
-
// See if the containing block has :first-letter style applied.
bool haveFirstLetterStyle = false, haveFirstLineStyle = false;
- nsContainerFrame* containingBlock = state.mFloatedItems.containingBlock;
+ nsContainerFrame* containingBlock = GetFloatContainingBlock(parentFrame);
if (containingBlock) {
haveFirstLetterStyle = HasFirstLetterStyle(containingBlock);
haveFirstLineStyle =
@@ -7468,10 +7462,30 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
}
if (haveFirstLetterStyle) {
+ nsWeakFrame wf(parentAfterFrame);
// Before we get going, remove the current letter frames
- RemoveLetterFrames(state.mPresShell, containingBlock);
+ RemoveLetterFrames(mPresShell, containingBlock);
+
+ if (parentAfterFrame && !wf) {
+ // Ouch, parentAfterFrame was a letter frame and we just deleted it!
+ // Retry AdjustAppendParentForAfterContent; fortunately this is rare.
+ parentFrame =
+ ::AdjustAppendParentForAfterContent(this, insertion.mContainer,
+ preAdjustedParentFrame,
+ aFirstNewContent, &parentAfterFrame);
+ if (parentFrame != preAdjustedParentFrame) {
+ containingBlock = GetFloatContainingBlock(parentFrame);
+ }
+ }
}
+ // Create some new frames
+ nsFrameConstructorState state(mPresShell,
+ GetAbsoluteContainingBlock(parentFrame, FIXED_POS),
+ GetAbsoluteContainingBlock(parentFrame, ABS_POS),
+ containingBlock);
+ state.mTreeMatchContext.InitAncestors(aContainer->AsElement());
+
nsIAtom* frameType = parentFrame->GetType();
FlattenedChildIterator iter(aContainer);