Bug 1261265 - Fix nsStyleContext::MoveTo flag assertions to allow mismatch on parents if bit is set on child. r=dholbert

This commit is contained in:
Cameron McCormack 2016-04-11 16:22:05 +10:00
Родитель a7dd3bfa4c
Коммит 7b70aa2a8c
1 изменённых файлов: 17 добавлений и 11 удалений

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

@ -346,17 +346,23 @@ nsStyleContext::MoveTo(nsStyleContext* aNewParent)
MOZ_ASSERT(aNewParent != mParent);
// This function shouldn't be getting called if the parents have different
// values for some flags in mBits, because if that were the case we would need
// to recompute those bits for |this|.
DebugOnly<uint64_t> mask = NS_STYLE_HAS_PSEUDO_ELEMENT_DATA |
NS_STYLE_IN_DISPLAY_NONE_SUBTREE;
MOZ_ASSERT((mParent->mBits & mask) == (aNewParent->mBits & mask));
MOZ_ASSERT((mParent->mBits & NS_STYLE_HAS_TEXT_DECORATION_LINES) ==
(aNewParent->mBits & NS_STYLE_HAS_TEXT_DECORATION_LINES) ||
StyleTextReset()->HasTextDecorationLines());
MOZ_ASSERT((mParent->mBits & NS_STYLE_RELEVANT_LINK_VISITED) ==
(aNewParent->mBits & NS_STYLE_RELEVANT_LINK_VISITED) ||
IsLinkContext());
// values for some flags in mBits (unless the flag is also set on this style
// context) because if that were the case we would need to recompute those
// bits for |this|.
#define CHECK_FLAG(bit_) \
MOZ_ASSERT((mParent->mBits & (bit_)) == (aNewParent->mBits & (bit_)) || \
(mBits & (bit_)), \
"MoveTo cannot be called if " #bit_ " value on old and new " \
"style context parents do not match, unless the flag is set " \
"on this style context");
CHECK_FLAG(NS_STYLE_HAS_PSEUDO_ELEMENT_DATA)
CHECK_FLAG(NS_STYLE_IN_DISPLAY_NONE_SUBTREE)
CHECK_FLAG(NS_STYLE_HAS_TEXT_DECORATION_LINES)
CHECK_FLAG(NS_STYLE_RELEVANT_LINK_VISITED)
#undef CHECK_FLAG
// Assertions checking for visited style are just to avoid some tricky
// cases we can't be bothered handling at the moment.