Bug 1351139. Use only one kind of anonymous box for the block wrappers we create for a block-inside-inline split. r=dbaron

Note that this removes the useless (because this anon box is never absolutely
positioned) "clip: inherit" style.

MozReview-Commit-ID: iJJdv5VL06

--HG--
extra : rebase_source : d7a8697a89391eb6a80683dcbe8e3fa6f76c6a41
This commit is contained in:
Boris Zbarsky 2017-03-28 21:26:31 -04:00
Родитель 13c19caa61
Коммит 06a153ffc1
6 изменённых файлов: 35 добавлений и 46 удалений

Просмотреть файл

@ -12256,10 +12256,8 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
// resulting translation also affects the block-level box contained
// in the inline box.
RefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(aIsPositioned ?
nsCSSAnonBoxes::mozAnonymousPositionedBlock :
nsCSSAnonBoxes::mozAnonymousBlock,
styleContext);
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
styleContext);
nsContainerFrame* lastNewInline =
static_cast<nsContainerFrame*>(aInitialInline->FirstContinuation());

Просмотреть файл

@ -3951,8 +3951,7 @@ AddBoxesForFrame(nsIFrame* aFrame,
AddBoxesForFrame(kid, aCallback);
}
}
} else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
} else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
for (nsIFrame* kid : aFrame->PrincipalChildList()) {
@ -3990,8 +3989,7 @@ nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame)
return f;
}
}
} else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
} else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
for (nsIFrame* kid : aFrame->PrincipalChildList()) {

Просмотреть файл

@ -6910,8 +6910,7 @@ bool
nsIFrame::IsBlockWrapper() const
{
nsIAtom *pseudoType = StyleContext()->GetPseudo();
return (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
return (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
pseudoType == nsCSSAnonBoxes::buttonContent ||
pseudoType == nsCSSAnonBoxes::cellContent);
}
@ -8817,17 +8816,15 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
return;
}
// When the outline property is set on :-moz-anonymous-block or
// :-moz-anonymous-positioned-block pseudo-elements, it inherited
// that outline from the inline that was broken because it
// contained a block. In that case, we don't want a really wide
// outline if the block inside the inline is narrow, so union the
// actual contents of the anonymous blocks.
// When the outline property is set on a :-moz-block-inside-inline-wrapper
// pseudo-element, it inherited that outline from the inline that was broken
// because it contained a block. In that case, we don't want a really wide
// outline if the block inside the inline is narrow, so union the actual
// contents of the anonymous blocks.
nsIFrame *frameForArea = aFrame;
do {
nsIAtom *pseudoType = frameForArea->StyleContext()->GetPseudo();
if (pseudoType != nsCSSAnonBoxes::mozAnonymousBlock &&
pseudoType != nsCSSAnonBoxes::mozAnonymousPositionedBlock)
if (pseudoType != nsCSSAnonBoxes::mozBlockInsideInlineWrapper)
break;
// If we're done, we really want it and all its later siblings.
frameForArea = frameForArea->PrincipalChildList().FirstChild();
@ -9177,8 +9174,7 @@ GetIBSplitSiblingForAnonymousBlock(const nsIFrame* aFrame)
"GetIBSplitSibling should only be called on ib-split frames");
nsIAtom* type = aFrame->StyleContext()->GetPseudo();
if (type != nsCSSAnonBoxes::mozAnonymousBlock &&
type != nsCSSAnonBoxes::mozAnonymousPositionedBlock) {
if (type != nsCSSAnonBoxes::mozBlockInsideInlineWrapper) {
// it's not an anonymous block
return nullptr;
}
@ -9279,8 +9275,7 @@ nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
// for non-elements. Those should not be treated as an anon box.
if (!nsCSSAnonBoxes::IsNonElement(aChildPseudo) &&
nsCSSAnonBoxes::IsAnonBox(aChildPseudo)) {
NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozAnonymousBlock &&
aChildPseudo != nsCSSAnonBoxes::mozAnonymousPositionedBlock,
NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
"Should have dealt with kids that have "
"NS_FRAME_PART_OF_IBSPLIT elsewhere");
return aProspectiveParent;

Просмотреть файл

@ -1049,15 +1049,11 @@ nsInlineFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsIFrame* blockFrame = propTable->Get(this, nsIFrame::IBSplitSibling());
MOZ_ASSERT(blockFrame, "Why did we have an IB split?");
nsIAtom* pseudo = blockFrame->StyleContext()->GetPseudo();
MOZ_ASSERT(pseudo == nsCSSAnonBoxes::mozAnonymousBlock ||
pseudo == nsCSSAnonBoxes::mozAnonymousPositionedBlock,
"Unexpected kind of style context");
// The anonymous block's style inherits from ours, and we already have our new
// style context.
RefPtr<nsStyleContext> newContext =
aStyleSet.ResolveInheritingAnonymousBoxStyle(pseudo, StyleContext());
aStyleSet.ResolveInheritingAnonymousBoxStyle(
nsCSSAnonBoxes::mozBlockInsideInlineWrapper, StyleContext());
// We're guaranteed that newContext only differs from the old style context on
// the block in things they might inherit from us. And changehint processing
@ -1068,6 +1064,11 @@ nsInlineFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
while (blockFrame) {
MOZ_ASSERT(!blockFrame->GetPrevContinuation(),
"Must be first continuation");
MOZ_ASSERT(blockFrame->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
"Unexpected kind of style context");
// We _could_ just walk along using GetNextContinuationWithSameStyle here,
// but it would involve going back to the first continuation every so often,
// which is a bit silly when we can just keep track of our first

Просмотреть файл

@ -42,8 +42,7 @@ CSS_NON_INHERITING_ANON_BOX(oofPlaceholder, ":-moz-oof-placeholder")
// nsFirstLetterFrames for content outside the ::first-letter.
CSS_ANON_BOX(firstLetterContinuation, ":-moz-first-letter-continuation")
CSS_ANON_BOX(mozAnonymousBlock, ":-moz-anonymous-block")
CSS_ANON_BOX(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block")
CSS_ANON_BOX(mozBlockInsideInlineWrapper, ":-moz-block-inside-inline-wrapper")
CSS_ANON_BOX(mozMathMLAnonymousBlock, ":-moz-mathml-anonymous-block")
CSS_ANON_BOX(mozXULAnonymousBlock, ":-moz-xul-anonymous-block")

Просмотреть файл

@ -132,7 +132,7 @@
/* Miscellaneous */
*|*::-moz-anonymous-block, *|*::-moz-cell-content {
*|*::-moz-cell-content {
display: block !important;
position: static !important;
unicode-bidi: inherit;
@ -140,8 +140,10 @@
overflow-clip-box: inherit;
}
*|*::-moz-anonymous-block, *|*::-moz-anonymous-positioned-block {
*|*::-moz-block-inside-inline-wrapper {
display: block !important;
/* we currently inherit from the inline that is split */
position: inherit; /* static or relative or sticky */
outline: inherit;
outline-offset: inherit;
clip-path: inherit;
@ -151,6 +153,16 @@
text-decoration: inherit;
-moz-box-ordinal-group: inherit !important;
overflow-clip-box: inherit;
unicode-bidi: inherit;
text-overflow: inherit;
/* The properties below here don't apply if our position is static,
and we do want them to have an effect it it's not, so it's fine
to always inherit them. */
top: inherit;
left: inherit;
bottom: inherit;
right: inherit;
z-index: inherit;
}
*|*::-moz-xul-anonymous-block {
@ -268,20 +280,6 @@
display: block !important;
}
*|*::-moz-anonymous-positioned-block {
display: block !important;
position: inherit; /* relative or sticky */
top: inherit;
left: inherit;
bottom: inherit;
right: inherit;
z-index: inherit;
clip: inherit;
opacity: inherit;
unicode-bidi: inherit;
text-overflow: inherit;
}
/* Printing */
@media print {