Bug 1380133 - Part 4: Make CalcStyleDifferenceInternal not cache any new structs on ServoStyleContexts when in a traversal. r=emilio

MozReview-Commit-ID: Eu4MvdQUBor

--HG--
extra : rebase_source : c98706cec1788662a09cb1d99bcd3893658261a9
This commit is contained in:
Cameron McCormack 2017-07-19 15:11:09 +08:00
Родитель 4b22db7890
Коммит a5c91255ab
3 изменённых файлов: 23 добавлений и 4 удалений

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

@ -10272,6 +10272,14 @@ nsIFrame::UpdateStyleOfOwnedChildFrame(
aNewStyleContext,
&equalStructs,
&samePointerStructs);
// CalcStyleDifference will handle caching structs on the new style context,
// but only if we're not on a style worker thread.
MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal(),
"if we can get in here from style worker threads, then we need "
"a ResolveSameStructsAs call to ensure structs are cached on "
"aNewStyleContext");
// If aChildFrame is out of flow, then aRestyleState's "changes handled by the
// parent" doesn't apply to it, because it may have some other parent in the
// frame tree.

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

@ -258,7 +258,8 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
unrequestedStruct = false; \
} \
if (this##struct_) { \
const nsStyle##struct_* other##struct_ = aNewContext->Style##struct_(); \
const nsStyle##struct_* other##struct_ = \
aNewContext->ThreadsafeStyle##struct_(); \
if (this##struct_ == other##struct_) { \
/* The very same struct, so we know that there will be no */ \
/* differences. */ \
@ -338,7 +339,7 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
#define STYLE_STRUCT(name_, callback_) \
{ \
const nsStyle##name_* data = PeekStyle##name_(); \
if (!data || data == aNewContext->Style##name_()) { \
if (!data || data == aNewContext->ThreadsafeStyle##name_()) { \
*aSamePointerStructs |= NS_STYLE_INHERIT_BIT(name_); \
} \
}
@ -387,8 +388,10 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
#define STYLE_FIELD(name_) thisVisStruct->name_ != otherVisStruct->name_
#define STYLE_STRUCT(name_, fields_) \
if (!change && PeekStyle##name_()) { \
const nsStyle##name_* thisVisStruct = thisVis->Style##name_(); \
const nsStyle##name_* otherVisStruct = otherVis->Style##name_(); \
const nsStyle##name_* thisVisStruct = \
thisVis->ThreadsafeStyle##name_(); \
const nsStyle##name_* otherVisStruct = \
otherVis->ThreadsafeStyle##name_(); \
if (MOZ_FOR_EACH_SEPARATED(STYLE_FIELD, (||), (), fields_)) { \
change = true; \
} \

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

@ -8067,6 +8067,14 @@ nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
newContext,
&equalStructs,
&samePointerStructs);
// CalcStyleDifference will handle caching structs on the new style context,
// but only if we're not on a style worker thread.
MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal(),
"if we can get in here from style worker threads, then we need "
"a ResolveSameStructsAs call to ensure structs are cached on "
"aNewStyleContext");
if (wrapperHint) {
aRestyleState.ChangeList().AppendChange(
aWrapperFrame, aWrapperFrame->GetContent(), wrapperHint);