Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Sync changes from mozilla-central. #25299

Merged
merged 28 commits into from Dec 17, 2019
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
519a0e7
style: convert NS_STYLE_TOP_LAYER_* to an enum class in nsStyleConsts.h
jeffin143 Dec 1, 2019
5cc4394
style: convert NS_STYLE_RUBY_ALIGN_* to an enum class in nsStyleConsts.h
jeffin143 Dec 1, 2019
24f21f3
style: convert NS_STYLE_TEXT_SIZE_ADJUST_* to an enum class in nsStyl…
jeffin143 Dec 2, 2019
7e3e8e1
style: convert NS_STYLE_RUBY_POSITION_* to an enum class in nsStyleCo…
jeffin143 Dec 2, 2019
3bd62cf
style: Check for border-image-* initial specified values when seriali…
nordzilla Dec 3, 2019
51c1dfe
style: Add support for parsing of the CSS text-underline-position pro…
jfkthame Dec 4, 2019
5e7d429
style: Refactor InvalidationMap flags to use bitflags.
nordzilla Dec 5, 2019
f89c311
style: Remove layout.css.xul-box-display-values.survive-blockificatio…
emilio Dec 5, 2019
80ac4d2
style: Avoid writing into the empty array header.
emilio Dec 16, 2019
baa9ac1
style: Update derive_more.
emilio Dec 5, 2019
e944962
style: convert NS_STYLE_ISOLATION_* to an enum class in nsStyleConsts.h.
jeffin143 Dec 6, 2019
6973317
style: Correctly style dark scrollbars in tree components.
heycam Dec 9, 2019
7cd59da
style: Invalidate shadow part pseudo-class styles correctly.
emilio Dec 9, 2019
d954f51
style: Fix serialization of @namespace rule.
emilio Nov 25, 2019
e8a3a71
style: convert NS_STYLE_POINTER_EVENTS_* to an enum class in nsStyleC…
jeffin143 Dec 12, 2019
02c30bc
style: Preserve CSS input exactly during sanitization.
emilio Dec 12, 2019
4b62e9f
style: convert NS_STYLE_VISIBILITY_* to an enum class in nsStyleConsts.h
jeffin143 Dec 13, 2019
4cd8813
style: Remove full-screen-api.unprefix.enabled.
emilio Dec 13, 2019
a541046
style: Use less Au in font code.
emilio Dec 15, 2019
789ddd9
style: Make LengthPercentage not copy.
emilio Dec 15, 2019
ad61cae
style: Update smallvec to 1.0.
emilio Dec 15, 2019
c1c2b74
Update Cargo.lock.
emilio Dec 15, 2019
7d30a7d
Servo build fixes.
emilio Dec 15, 2019
e885ccb
layout-2020: build fixes.
emilio Dec 15, 2019
ef16c58
Rustfmt recent changes.
emilio Dec 15, 2019
75a05f0
Appease tidy.
emilio Dec 15, 2019
f7c5df5
Update WPT expectations.
emilio Dec 16, 2019
7513bc2
Cherry-pick some parts of the cssparser update.
emilio Dec 16, 2019
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

style: Invalidate shadow part pseudo-class styles correctly.

I was going to send a test for `:focus` via wpt, but then realized it was
probably not spec-compliant with the new rules people want to follow for
:focus, so I filed w3c/csswg-drafts#4555 instead.

Testing `:hover` / `:active` via wpt looked quite a bit of a hassle.

Differential Revision: https://phabricator.services.mozilla.com/D55591
  • Loading branch information
emilio committed Dec 16, 2019
commit 7cd59da2a097863e194189268695ed75dc5a0a70
@@ -807,6 +807,9 @@ pub trait TElement:
/// data if it comes from Shadow DOM.
///
/// Returns whether normal document author rules should apply.
///
/// TODO(emilio): We could separate the invalidation data for elements
/// matching in other scopes to avoid over-invalidation.
fn each_applicable_non_document_style_rule_data<'a, F>(&self, mut f: F) -> bool
where
Self: 'a,
@@ -841,11 +844,42 @@ pub trait TElement:
// Slots can only have assigned nodes when in a shadow tree.
let shadow = slot.containing_shadow().unwrap();
if let Some(data) = shadow.style_data() {
f(data, shadow.host());
if data.any_slotted_rule() {
f(data, shadow.host());
}
}
current = slot.assigned_slot();
}

if target.has_part_attr() {
if let Some(mut inner_shadow) = target.containing_shadow() {
loop {
let inner_shadow_host = inner_shadow.host();
match inner_shadow_host.containing_shadow() {
Some(shadow) => {
if let Some(data) = shadow.style_data() {
if data.any_part_rule() {
f(data, shadow.host())
}
}
// TODO: Could be more granular.
if !shadow.host().exports_any_part() {
break;
}
inner_shadow = shadow;
}
None => {
// TODO(emilio): Should probably distinguish with
// MatchesDocumentRules::{No,Yes,IfPart} or
// something so that we could skip some work.
doc_rules_apply = true;
break;
}
}
}
}
}

doc_rules_apply
}

@@ -348,7 +348,9 @@ where
return;
}

let outer_shadow = inner_shadow.host().containing_shadow();

let inner_shadow_host = inner_shadow.host();
let outer_shadow = inner_shadow_host.containing_shadow();
let part_rules = match outer_shadow {
Some(shadow) => shadow
.style_data()
@@ -387,8 +389,6 @@ where
shadow_cascade_order.inc();
}

let inner_shadow_host = inner_shadow.host();

inner_shadow = match outer_shadow {
Some(s) => s,
None => break, // Nowhere to export to.
@@ -1889,18 +1889,33 @@ impl CascadeData {
self.host_rules.as_ref().and_then(|d| d.rules(pseudo))
}

/// Whether there's any host rule that could match in this scope.
pub fn any_host_rules(&self) -> bool {
self.host_rules.is_some()
}

/// Returns the slotted rule map for a given pseudo-element.
#[inline]
pub fn slotted_rules(&self, pseudo: Option<&PseudoElement>) -> Option<&SelectorMap<Rule>> {
self.slotted_rules.as_ref().and_then(|d| d.rules(pseudo))
}

/// Whether there's any ::slotted rule that could match in this scope.
pub fn any_slotted_rule(&self) -> bool {
self.slotted_rules.is_some()
}

/// Returns the parts rule map for a given pseudo-element.
#[inline]
pub fn part_rules(&self, pseudo: Option<&PseudoElement>) -> Option<&PartMap> {
self.part_rules.as_ref().and_then(|d| d.rules(pseudo))
}

/// Whether there's any ::part rule that could match in this scope.
pub fn any_part_rule(&self) -> bool {
self.part_rules.is_some()
}

/// Collects all the applicable media query results into `results`.
///
/// This duplicates part of the logic in `add_stylesheet`, which is
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.