зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1618303 - Add an inherited style bit to know whether an element is in an opacity: 0 subtree. r=hiro
I think this should work for the animation throttling stuff. Opacity works on the element tree, so I think this is sound. Differential Revision: https://phabricator.services.mozilla.com/D64441 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b6a0b062af
Коммит
551edfd98f
|
@ -166,6 +166,10 @@ class ComputedStyle {
|
|||
return bool(Flags() & Flag::IS_ROOT_ELEMENT_STYLE);
|
||||
}
|
||||
|
||||
bool IsInOpacityZeroSubtree() const {
|
||||
return bool(Flags() & Flag::IS_IN_OPACITY_ZERO_SUBTREE);
|
||||
}
|
||||
|
||||
ComputedStyle* GetCachedInheritingAnonBoxStyle(
|
||||
PseudoStyleType aPseudoType) const {
|
||||
MOZ_ASSERT(PseudoStyle::IsInheritingAnonBox(aPseudoType));
|
||||
|
|
|
@ -67,6 +67,9 @@ bitflags! {
|
|||
|
||||
/// Whether this style is the style of the document element.
|
||||
const IS_ROOT_ELEMENT_STYLE = 1 << 11;
|
||||
|
||||
/// Whether this element is inside an `opacity: 0` subtree.
|
||||
const IS_IN_OPACITY_ZERO_SUBTREE = 1 << 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,10 +77,11 @@ impl ComputedValueFlags {
|
|||
/// Flags that are unconditionally propagated to descendants.
|
||||
#[inline]
|
||||
fn inherited_flags() -> Self {
|
||||
ComputedValueFlags::IS_RELEVANT_LINK_VISITED |
|
||||
ComputedValueFlags::CAN_BE_FRAGMENTED |
|
||||
ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE |
|
||||
ComputedValueFlags::HAS_TEXT_DECORATION_LINES
|
||||
Self::IS_RELEVANT_LINK_VISITED |
|
||||
Self::CAN_BE_FRAGMENTED |
|
||||
Self::IS_IN_PSEUDO_ELEMENT_SUBTREE |
|
||||
Self::HAS_TEXT_DECORATION_LINES |
|
||||
Self::IS_IN_OPACITY_ZERO_SUBTREE
|
||||
}
|
||||
|
||||
/// Flags that may be propagated to descendants.
|
||||
|
|
|
@ -227,8 +227,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
fn set_bits(&mut self) {
|
||||
let display = self.style.get_box().clone_display();
|
||||
|
||||
if !display.is_contents() &&
|
||||
!self
|
||||
if !display.is_contents() {
|
||||
if !self
|
||||
.style
|
||||
.get_text()
|
||||
.clone_text_decoration_line()
|
||||
|
@ -238,6 +238,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
.add_flags(ComputedValueFlags::HAS_TEXT_DECORATION_LINES);
|
||||
}
|
||||
|
||||
if self.style.get_effects().clone_opacity() == 0. {
|
||||
self.style
|
||||
.add_flags(ComputedValueFlags::IS_IN_OPACITY_ZERO_SUBTREE);
|
||||
}
|
||||
}
|
||||
|
||||
if self.style.is_pseudo_element() {
|
||||
self.style
|
||||
.add_flags(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче