Bug 1285474: stylo: Add dirtiness-tracking hooks for Servo and convenient methods. r=bholley

Also, guard with asserts the access to the new shared flags.

MozReview-Commit-ID: H9UFFHRPmiu
This commit is contained in:
Emilio Cobos Álvarez
2016-07-08 00:07:06 -07:00
parent 6fdfeb30ce
commit 948a479bad
9 changed files with 77 additions and 36 deletions

View File

@@ -1980,7 +1980,7 @@ nsCSSFrameConstructor::GetParentType(nsIAtom* aFrameType)
}
if (aFrameType == nsGkAtoms::rubyTextContainerFrame) {
return eTypeRubyTextContainer;
}
}
if (aFrameType == nsGkAtoms::rubyFrame) {
return eTypeRuby;
}
@@ -2430,7 +2430,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// this document. Unlike in AddFrameConstructionItems, it's safe to
// unset all element restyle flags, since we don't have any
// siblings.
aDocElement->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
aDocElement->UnsetRestyleFlagsIfGecko();
// --------- CREATE AREA OR BOX FRAME -------
// FIXME: Should this use ResolveStyleContext? (The calls in this
@@ -4140,7 +4140,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
} else {
FrameConstructionItemList items;
{
// Skip parent display based style-fixup during our
// Skip parent display based style-fixup during our
// AddFrameConstructionItems() call:
TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper
parentDisplayBasedStyleFixupSkipper(aState.mTreeMatchContext);
@@ -5513,7 +5513,7 @@ nsCSSFrameConstructor::ShouldCreateItemsForChild(nsFrameConstructorState& aState
nsContainerFrame* aParentFrame)
{
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
if (aContent->IsElement()) {
if (aContent->IsElement() && !aContent->IsStyledByServo()) {
// We can't just remove our pending restyle flags, since we may
// have restyle-later-siblings set on us. But we _can_ remove the
// "is possible restyle root" flags, and need to. Otherwise we can
@@ -9756,7 +9756,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
&nsCSSAnonBoxes::ruby
},
{ // Ruby Base
FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
FCDATA_IS_LINE_PARTICIPANT |
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyBaseContainer) |
FCDATA_SKIP_FRAMESET,
@@ -10326,7 +10326,7 @@ nsCSSFrameConstructor::CreateNeededPseudoContainers(
break;
case eTypeColGroup:
MOZ_CRASH("Colgroups should be suppresing non-col child items");
default:
default:
NS_ASSERTION(ourParentType == eTypeBlock, "Unrecognized parent type");
if (IsRubyParentType(groupingParentType)) {
wrapperType = eTypeRuby;
@@ -10542,13 +10542,16 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
"CreateAnonymousFrames manually and not follow the standard "
"ProcessChildren() codepath for this frame");
#endif
// Anything restyled by servo should already have the style data.
MOZ_ASSERT_IF(content->IsStyledByServo(), !!content->GetServoNodeData());
// Gecko-styled nodes should have no pending restyle flags.
MOZ_ASSERT_IF(!content->IsStyledByServo(),
!content->IsElement() ||
!(content->GetFlags() & ELEMENT_ALL_RESTYLE_FLAGS));
// Assert some things about this content
MOZ_ASSERT(!(content->GetFlags() &
(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME)),
"Should not be marked as needing frames");
MOZ_ASSERT(!content->IsElement() ||
!(content->GetFlags() & ELEMENT_ALL_RESTYLE_FLAGS),
"Should have no pending restyle flags");
MOZ_ASSERT(!content->GetPrimaryFrame(),
"Should have no existing frame");
MOZ_ASSERT(!content->IsNodeOfType(nsINode::eCOMMENT) &&
@@ -10696,9 +10699,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
// Frame construction item construction should not post
// restyles, so removing restyle flags here is safe.
if (child->IsElement()) {
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
}
child->UnsetRestyleFlagsIfGecko();
if (addChildItems) {
AddFrameConstructionItems(aState, child, iter.XBLInvolved(), insertion,
itemsToConstruct);
@@ -12008,13 +12009,12 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
continue;
}
if (content->IsElement()) {
// See comment explaining why we need to remove the "is possible
// restyle root" flags in AddFrameConstructionItems. But note
// that we can remove all restyle flags, just like in
// ProcessChildren and for the same reason.
content->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
}
// See comment explaining why we need to remove the "is possible
// restyle root" flags in AddFrameConstructionItems. But note
// that we can remove all restyle flags, just like in
// ProcessChildren and for the same reason.
content->UnsetRestyleFlagsIfGecko();
RefPtr<nsStyleContext> childContext =
ResolveStyleContext(parentStyleContext, content, &aState);