mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Add an inherited style bit to know whether an element is in an opacity: 0 subtree.
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
This commit is contained in:
parent
3460f71205
commit
1bd551ddc2
2 changed files with 23 additions and 13 deletions
|
@ -67,6 +67,9 @@ bitflags! {
|
||||||
|
|
||||||
/// Whether this style is the style of the document element.
|
/// Whether this style is the style of the document element.
|
||||||
const IS_ROOT_ELEMENT_STYLE = 1 << 11;
|
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.
|
/// Flags that are unconditionally propagated to descendants.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn inherited_flags() -> Self {
|
fn inherited_flags() -> Self {
|
||||||
ComputedValueFlags::IS_RELEVANT_LINK_VISITED |
|
Self::IS_RELEVANT_LINK_VISITED |
|
||||||
ComputedValueFlags::CAN_BE_FRAGMENTED |
|
Self::CAN_BE_FRAGMENTED |
|
||||||
ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE |
|
Self::IS_IN_PSEUDO_ELEMENT_SUBTREE |
|
||||||
ComputedValueFlags::HAS_TEXT_DECORATION_LINES
|
Self::HAS_TEXT_DECORATION_LINES |
|
||||||
|
Self::IS_IN_OPACITY_ZERO_SUBTREE
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Flags that may be propagated to descendants.
|
/// Flags that may be propagated to descendants.
|
||||||
|
|
|
@ -227,15 +227,21 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
fn set_bits(&mut self) {
|
fn set_bits(&mut self) {
|
||||||
let display = self.style.get_box().clone_display();
|
let display = self.style.get_box().clone_display();
|
||||||
|
|
||||||
if !display.is_contents() &&
|
if !display.is_contents() {
|
||||||
!self
|
if !self
|
||||||
.style
|
.style
|
||||||
.get_text()
|
.get_text()
|
||||||
.clone_text_decoration_line()
|
.clone_text_decoration_line()
|
||||||
.is_empty()
|
.is_empty()
|
||||||
{
|
{
|
||||||
self.style
|
self.style
|
||||||
.add_flags(ComputedValueFlags::HAS_TEXT_DECORATION_LINES);
|
.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() {
|
if self.style.is_pseudo_element() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue