mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make element-backed pseudos inherit from NAC subtree roots and other NAC inherit from their parents.
Currently, NAC always inherits from the closest non-NAC ancestor element, regardless of whether it is for an element-backed pseudo or not. This patch changes the inheritance so that for element-backed pseudos, we inherit from the closest native anonymous root's parent, and for other NAC we inherit from the parent. This prevents the following two issues and allows us to remove the NODE_IS_NATIVE_ANONYMOUS flag: * Avoiding inheriting from the non-NAC ancestor in XBL bindings bound to NAC. - This is no longer a problem since we apply the rule only if we're a pseudo-element, and all pseudo-elements are in native anonymous subtrees. - This also allows to remove the hack that propagates the NODE_IS_NATIVE_ANONYMOUS flag from the ::cue pseudo-element from BindToTree. * Inheriting from the wrong thing if we're a nested NAC subtree. - We no longer look past our NAC subtree, with the exception of ::-moz-number-text's pseudo-elements, for which we do want to propagate ::placeholder to. A few rules from forms.css have been modified because they're useless or needed to propagate stuff to the anonymous form control in input[type="number"] which previously inherited from the input itself. Bug: 1460382 Reviewed-by: heycam MozReview-Commit-ID: IDKYt3EJtSH
This commit is contained in:
parent
92e2adf45f
commit
5507d53611
6 changed files with 53 additions and 49 deletions
|
@ -433,9 +433,10 @@ pub fn recalc_style_at<E, D, F>(
|
|||
if compute_self {
|
||||
child_cascade_requirement = compute_style(traversal_data, context, element, data);
|
||||
|
||||
if element.is_native_anonymous() {
|
||||
// We must always cascade native anonymous subtrees, since they inherit
|
||||
// styles from their first non-NAC ancestor.
|
||||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue