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 // resulting translation also affects the block-level box contained
// in the inline box. // in the inline box.
RefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()-> RefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(aIsPositioned ? ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
nsCSSAnonBoxes::mozAnonymousPositionedBlock : styleContext);
nsCSSAnonBoxes::mozAnonymousBlock,
styleContext);
nsContainerFrame* lastNewInline = nsContainerFrame* lastNewInline =
static_cast<nsContainerFrame*>(aInitialInline->FirstContinuation()); static_cast<nsContainerFrame*>(aInitialInline->FirstContinuation());

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

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

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

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

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

@ -1049,15 +1049,11 @@ nsInlineFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsIFrame* blockFrame = propTable->Get(this, nsIFrame::IBSplitSibling()); nsIFrame* blockFrame = propTable->Get(this, nsIFrame::IBSplitSibling());
MOZ_ASSERT(blockFrame, "Why did we have an IB split?"); 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 // The anonymous block's style inherits from ours, and we already have our new
// style context. // style context.
RefPtr<nsStyleContext> newContext = 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 // 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 // the block in things they might inherit from us. And changehint processing
@ -1068,6 +1064,11 @@ nsInlineFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
while (blockFrame) { while (blockFrame) {
MOZ_ASSERT(!blockFrame->GetPrevContinuation(), MOZ_ASSERT(!blockFrame->GetPrevContinuation(),
"Must be first continuation"); "Must be first continuation");
MOZ_ASSERT(blockFrame->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
"Unexpected kind of style context");
// We _could_ just walk along using GetNextContinuationWithSameStyle here, // We _could_ just walk along using GetNextContinuationWithSameStyle here,
// but it would involve going back to the first continuation every so often, // 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 // 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. // nsFirstLetterFrames for content outside the ::first-letter.
CSS_ANON_BOX(firstLetterContinuation, ":-moz-first-letter-continuation") CSS_ANON_BOX(firstLetterContinuation, ":-moz-first-letter-continuation")
CSS_ANON_BOX(mozAnonymousBlock, ":-moz-anonymous-block") CSS_ANON_BOX(mozBlockInsideInlineWrapper, ":-moz-block-inside-inline-wrapper")
CSS_ANON_BOX(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block")
CSS_ANON_BOX(mozMathMLAnonymousBlock, ":-moz-mathml-anonymous-block") CSS_ANON_BOX(mozMathMLAnonymousBlock, ":-moz-mathml-anonymous-block")
CSS_ANON_BOX(mozXULAnonymousBlock, ":-moz-xul-anonymous-block") CSS_ANON_BOX(mozXULAnonymousBlock, ":-moz-xul-anonymous-block")

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

@ -132,7 +132,7 @@
/* Miscellaneous */ /* Miscellaneous */
*|*::-moz-anonymous-block, *|*::-moz-cell-content { *|*::-moz-cell-content {
display: block !important; display: block !important;
position: static !important; position: static !important;
unicode-bidi: inherit; unicode-bidi: inherit;
@ -140,8 +140,10 @@
overflow-clip-box: inherit; 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 */ /* we currently inherit from the inline that is split */
position: inherit; /* static or relative or sticky */
outline: inherit; outline: inherit;
outline-offset: inherit; outline-offset: inherit;
clip-path: inherit; clip-path: inherit;
@ -151,6 +153,16 @@
text-decoration: inherit; text-decoration: inherit;
-moz-box-ordinal-group: inherit !important; -moz-box-ordinal-group: inherit !important;
overflow-clip-box: inherit; 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 { *|*::-moz-xul-anonymous-block {
@ -268,20 +280,6 @@
display: block !important; 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 */ /* Printing */
@media print { @media print {