Bug 500467. When removing table rows/rowgroups/cells, don't try to create frames for their adjacent whitespace. We don't need it. r+sr=roc
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1972,29 +1972,28 @@ IsTablePseudo(nsIFrame* aFrame)
(aFrame->GetFirstChild(nsnull)->GetStyleContext()->GetPseudoType() ==
nsCSSAnonBoxes::table ||
aFrame->GetFirstChild(nsnull)->GetStyleContext()->GetPseudoType() ==
nsCSSAnonBoxes::inlineTable)));
}
/* static */
nsCSSFrameConstructor::ParentType
-nsCSSFrameConstructor::GetParentType(nsIFrame* aParentFrame)
-{
- nsIAtom* type = aParentFrame->GetType();
- if (type == nsGkAtoms::tableFrame) {
+nsCSSFrameConstructor::GetParentType(nsIAtom* aFrameType)
+{
+ if (aFrameType == nsGkAtoms::tableFrame) {
return eTypeTable;
}
- if (type == nsGkAtoms::tableRowGroupFrame) {
+ if (aFrameType == nsGkAtoms::tableRowGroupFrame) {
return eTypeRowGroup;
}
- if (type == nsGkAtoms::tableRowFrame) {
+ if (aFrameType == nsGkAtoms::tableRowFrame) {
return eTypeRow;
}
- if (type == nsGkAtoms::tableColGroupFrame) {
+ if (aFrameType == nsGkAtoms::tableColGroupFrame) {
return eTypeColGroup;
}
return eTypeBlock;
}
static nsIFrame*
AdjustCaptionParentFrame(nsIFrame* aParentFrame)
@@ -7265,16 +7264,17 @@ nsCSSFrameConstructor::ContentRemoved(ns
childFrame = mPresShell->GetPrimaryFrameFor(aChild);
if (!childFrame || childFrame->GetContent() != aChild) {
// XXXbz the GetContent() != aChild check is needed due to bug 135040.
// Remove it once that's fixed.
frameManager->ClearUndisplayedContentIn(aChild, aContainer);
return NS_OK;
}
parentFrame = childFrame->GetParent();
+ parentType = parentFrame->GetType();
#ifdef NOISY_FIRST_LETTER
printf(" ==> revised parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
printf(" childFrame=");
nsFrame::ListTag(stdout, childFrame);
printf("\n");
#endif
@@ -7348,19 +7348,23 @@ nsCSSFrameConstructor::ContentRemoved(ns
nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(parentFrame),
containingBlock);
RecoverLetterFrames(containingBlock);
}
// If we're just reconstructing frames for the element, then the
// following ContentInserted notification on the element will
- // take care of fixing up any adjacent text nodes.
+ // take care of fixing up any adjacent text nodes. We don't need
+ // to do this if the table parent type of our parent type is not
+ // eTypeBlock, though, because in that case the whitespace isn't
+ // being suppressed due to us anyway.
if (aContainer && aIndexInContainer >= 0 &&
- aFlags != REMOVE_FOR_RECONSTRUCTION) {
+ aFlags != REMOVE_FOR_RECONSTRUCTION &&
+ GetParentType(parentType) == eTypeBlock) {
// Adjacent whitespace-only text nodes might have been suppressed if
// this node does not have inline ends. Create frames for them now
// if necessary.
PRInt32 childCount = aContainer->GetChildCount();
// Reframe any text node just before the node being removed, if there is
// one, and if it's not the last child or the first child. If a whitespace
// textframe was being suppressed and it's now the last child or first
// child then it can stay suppressed since the parent must be a block
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -465,17 +465,22 @@ private:
FrameConstructionData */
#define FCDATA_DESIRED_PARENT_TYPE(_bits) \
ParentType((_bits) >> FCDATA_PARENT_TYPE_OFFSET)
/* Macro to create FrameConstructionData bits out of a desired parent type */
#define FCDATA_DESIRED_PARENT_TYPE_TO_BITS(_type) \
(((PRUint32)(_type)) << FCDATA_PARENT_TYPE_OFFSET)
/* Get the parent type that aParentFrame has. */
- static ParentType GetParentType(nsIFrame* aParentFrame);
+ static ParentType GetParentType(nsIFrame* aParentFrame) {
+ return GetParentType(aParentFrame->GetType());
+ }
+
+ /* Get the parent type for the given nsIFrame type atom */
+ static ParentType GetParentType(nsIAtom* aFrameType);
/* A constructor function that just creates an nsIFrame object. The caller
is responsible for initializing the object, adding it to frame lists,
constructing frames for the children, etc.
@param nsIPresShell the presshell whose arena should be used to allocate
the frame.
@param nsStyleContext the style context to use for the frame. */