Bug 1346481. Add stylo support for skipping parent-display-based fixup for anonymous boxes. r?emilio
MozReview-Commit-ID: Ahd95HP6xiD
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -254,17 +254,18 @@ SERVO_BINDING_FUNC(Servo_CSSSupports2, b
const nsACString* name, const nsACString* value)
SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
const nsACString* cond)
// Computed style data
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
ServoComputedValuesStrong,
ServoComputedValuesBorrowedOrNull parent_style_or_null,
- nsIAtom* pseudoTag, RawServoStyleSetBorrowed set)
+ nsIAtom* pseudoTag, bool skip_display_fixup,
+ RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
RawServoStyleSetBorrowed set,
ServoComputedValuesBorrowedOrNull parent_style)
// Initialize Servo components. Should be called exactly once at startup.
SERVO_BINDING_FUNC(Servo_Initialize, void)
// Shut down Servo components. Should be called exactly once at shutdown.
SERVO_BINDING_FUNC(Servo_Shutdown, void)
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -339,17 +339,17 @@ ServoStyleSet::ResolveInheritingAnonymou
MOZ_ASSERT(aFlags == 0 ||
aFlags == nsStyleSet::eSkipParentDisplayBasedStyleFixup);
bool skipFixup = aFlags & nsStyleSet::eSkipParentDisplayBasedStyleFixup;
const ServoComputedValues* parentStyle =
aParentContext ? aParentContext->StyleSource().AsServoComputedValues()
: nullptr;
RefPtr<ServoComputedValues> computedValues =
- Servo_ComputedValues_GetForAnonymousBox(parentStyle, aPseudoTag,
+ Servo_ComputedValues_GetForAnonymousBox(parentStyle, aPseudoTag, skipFixup,
mRawSet.get()).Consume();
#ifdef DEBUG
if (!computedValues) {
nsString pseudo;
aPseudoTag->ToString(pseudo);
NS_ERROR(nsPrintfCString("stylo: could not get anon-box: %s",
NS_ConvertUTF16toUTF8(pseudo).get()).get());
MOZ_CRASH();
@@ -377,18 +377,22 @@ ServoStyleSet::ResolveNonInheritingAnony
nsCSSAnonBoxes::NonInheriting type =
nsCSSAnonBoxes::NonInheritingTypeForPseudoTag(aPseudoTag);
RefPtr<nsStyleContext>& cache = mNonInheritingStyleContexts[type];
if (cache) {
RefPtr<nsStyleContext> retval = cache;
return retval.forget();
}
+ // We always want to skip parent-based display fixup here. It never makes
+ // sense for non-inheriting anonymous boxes.
+ MOZ_ASSERT(!nsCSSAnonBoxes::IsNonInheritingAnonBox(nsCSSAnonBoxes::viewport),
+ "viewport needs fixup to handle blockifying it");
RefPtr<ServoComputedValues> computedValues =
- Servo_ComputedValues_GetForAnonymousBox(nullptr, aPseudoTag,
+ Servo_ComputedValues_GetForAnonymousBox(nullptr, aPseudoTag, true,
mRawSet.get()).Consume();
#ifdef DEBUG
if (!computedValues) {
nsString pseudo;
aPseudoTag->ToString(pseudo);
NS_ERROR(nsPrintfCString("stylo: could not get anon-box: %s",
NS_ConvertUTF16toUTF8(pseudo).get()).get());
MOZ_CRASH();