mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: React to font-size changes on query containers
Much like we react to font-size changes on the root. Differential Revision: https://phabricator.services.mozilla.com/D157173
This commit is contained in:
parent
00c9d9d033
commit
f9f5283a65
2 changed files with 78 additions and 60 deletions
|
@ -8,7 +8,7 @@ use crate::context::{ElementCascadeInputs, SharedStyleContext, StyleContext};
|
|||
use crate::data::{ElementData, ElementStyles};
|
||||
use crate::dom::{NodeInfo, OpaqueNode, TElement, TNode};
|
||||
use crate::invalidation::element::restyle_hints::RestyleHint;
|
||||
use crate::matching::{ChildCascadeRequirement, MatchMethods};
|
||||
use crate::matching::{ChildRestyleRequirement, MatchMethods};
|
||||
use crate::selector_parser::PseudoElement;
|
||||
use crate::sharing::StyleSharingTarget;
|
||||
use crate::style_resolver::{PseudoElementResolution, StyleResolverForElement};
|
||||
|
@ -423,19 +423,19 @@ pub fn recalc_style_at<E, D, F>(
|
|||
data
|
||||
);
|
||||
|
||||
let mut child_cascade_requirement = ChildCascadeRequirement::CanSkipCascade;
|
||||
let mut child_restyle_requirement = ChildRestyleRequirement::CanSkipCascade;
|
||||
|
||||
// Compute style for this element if necessary.
|
||||
if compute_self {
|
||||
child_cascade_requirement = compute_style(traversal_data, context, element, data);
|
||||
child_restyle_requirement = compute_style(traversal_data, context, element, data);
|
||||
|
||||
if element.is_in_native_anonymous_subtree() {
|
||||
// We must always cascade native anonymous subtrees, since they
|
||||
// may have pseudo-elements underneath that would inherit from the
|
||||
// closest non-NAC ancestor instead of us.
|
||||
child_cascade_requirement = cmp::max(
|
||||
child_cascade_requirement,
|
||||
ChildCascadeRequirement::MustCascadeChildren,
|
||||
child_restyle_requirement = cmp::max(
|
||||
child_restyle_requirement,
|
||||
ChildRestyleRequirement::MustCascadeChildren,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -472,10 +472,10 @@ pub fn recalc_style_at<E, D, F>(
|
|||
let propagated_hint = data.hint.propagate(&flags);
|
||||
|
||||
trace!(
|
||||
"propagated_hint={:?}, cascade_requirement={:?}, \
|
||||
"propagated_hint={:?}, restyle_requirement={:?}, \
|
||||
is_display_none={:?}, implementing_pseudo={:?}",
|
||||
propagated_hint,
|
||||
child_cascade_requirement,
|
||||
child_restyle_requirement,
|
||||
data.styles.is_display_none(),
|
||||
element.implemented_pseudo_element()
|
||||
);
|
||||
|
@ -504,7 +504,7 @@ pub fn recalc_style_at<E, D, F>(
|
|||
// it's useless to style children.
|
||||
let mut traverse_children = has_dirty_descendants_for_this_restyle ||
|
||||
!propagated_hint.is_empty() ||
|
||||
!child_cascade_requirement.can_skip_cascade() ||
|
||||
!child_restyle_requirement.can_skip_cascade() ||
|
||||
is_servo_nonincremental_layout();
|
||||
|
||||
traverse_children = traverse_children && !data.styles.is_display_none();
|
||||
|
@ -516,7 +516,7 @@ pub fn recalc_style_at<E, D, F>(
|
|||
element,
|
||||
data,
|
||||
propagated_hint,
|
||||
child_cascade_requirement,
|
||||
child_restyle_requirement,
|
||||
is_initial_style,
|
||||
note_child,
|
||||
);
|
||||
|
@ -549,7 +549,7 @@ fn compute_style<E>(
|
|||
context: &mut StyleContext<E>,
|
||||
element: E,
|
||||
data: &mut ElementData,
|
||||
) -> ChildCascadeRequirement
|
||||
) -> ChildRestyleRequirement
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
|
@ -734,7 +734,7 @@ fn note_children<E, D, F>(
|
|||
element: E,
|
||||
data: &ElementData,
|
||||
propagated_hint: RestyleHint,
|
||||
cascade_requirement: ChildCascadeRequirement,
|
||||
restyle_requirement: ChildRestyleRequirement,
|
||||
is_initial_style: bool,
|
||||
mut note_child: F,
|
||||
) where
|
||||
|
@ -771,12 +771,12 @@ fn note_children<E, D, F>(
|
|||
|
||||
if let Some(ref mut child_data) = child_data {
|
||||
let mut child_hint = propagated_hint;
|
||||
match cascade_requirement {
|
||||
ChildCascadeRequirement::CanSkipCascade => {},
|
||||
ChildCascadeRequirement::MustCascadeDescendants => {
|
||||
match restyle_requirement {
|
||||
ChildRestyleRequirement::CanSkipCascade => {},
|
||||
ChildRestyleRequirement::MustCascadeDescendants => {
|
||||
child_hint |= RestyleHint::RECASCADE_SELF | RestyleHint::RECASCADE_DESCENDANTS;
|
||||
},
|
||||
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle => {
|
||||
ChildRestyleRequirement::MustCascadeChildrenIfInheritResetStyle => {
|
||||
use crate::computed_value_flags::ComputedValueFlags;
|
||||
if child_data
|
||||
.styles
|
||||
|
@ -787,9 +787,12 @@ fn note_children<E, D, F>(
|
|||
child_hint |= RestyleHint::RECASCADE_SELF;
|
||||
}
|
||||
},
|
||||
ChildCascadeRequirement::MustCascadeChildren => {
|
||||
ChildRestyleRequirement::MustCascadeChildren => {
|
||||
child_hint |= RestyleHint::RECASCADE_SELF;
|
||||
},
|
||||
ChildRestyleRequirement::MustMatchDescendants => {
|
||||
child_hint |= RestyleHint::restyle_subtree();
|
||||
}
|
||||
}
|
||||
|
||||
child_data.hint.insert(child_hint);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue