Auto merge of #18826 - emilio:invalidation-xbl-stuff, r=heycam

style: Fix invalidation collection for XBL when quirks modes don't match.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18826)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-11 10:59:05 -05:00 committed by GitHub
commit 105c5d2a06

View file

@ -6,7 +6,7 @@
//! element styles need to be invalidated.
use Atom;
use context::{SharedStyleContext, StackLimitChecker};
use context::{QuirksMode, SharedStyleContext, StackLimitChecker};
use data::ElementData;
use dom::{TElement, TNode};
use element_state::{ElementState, IN_VISITED_OR_UNVISITED_STATE};
@ -262,7 +262,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
state_changes,
element: self.element,
snapshot: &snapshot,
shared_context: self.shared_context,
quirks_mode: self.shared_context.quirks_mode(),
removed_id: id_removed.as_ref(),
added_id: id_added.as_ref(),
classes_removed: &classes_removed,
@ -282,6 +282,10 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
// just at that map.
let _cut_off_inheritance =
self.element.each_xbl_stylist(|stylist| {
// FIXME(emilio): Replace with assert / remove when we
// figure out what to do with the quirks mode mismatches
// (that is, when bug 1406875 is properly fixed).
collector.quirks_mode = stylist.quirks_mode();
stylist.each_invalidation_map(|invalidation_map| {
collector.collect_dependencies_in_invalidation_map(invalidation_map);
});
@ -823,7 +827,7 @@ struct InvalidationCollector<'a, 'b: 'a, E>
wrapper: ElementWrapper<'b, E>,
nth_index_cache: Option<&'a mut NthIndexCache>,
snapshot: &'a Snapshot,
shared_context: &'a SharedStyleContext<'b>,
quirks_mode: QuirksMode,
lookup_element: E,
removed_id: Option<&'a Atom>,
added_id: Option<&'a Atom>,
@ -842,7 +846,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
&mut self,
map: &InvalidationMap,
) {
let quirks_mode = self.shared_context.quirks_mode();
let quirks_mode = self.quirks_mode;
let removed_id = self.removed_id;
if let Some(ref id) = removed_id {
if let Some(deps) = map.id_to_selector.get(id, quirks_mode) {
@ -895,7 +899,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
) {
map.lookup_with_additional(
self.lookup_element,
self.shared_context.quirks_mode(),
self.quirks_mode,
self.removed_id,
self.classes_removed,
&mut |dependency| {
@ -912,7 +916,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
) {
map.lookup_with_additional(
self.lookup_element,
self.shared_context.quirks_mode(),
self.quirks_mode,
self.removed_id,
self.classes_removed,
&mut |dependency| {
@ -945,7 +949,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
None,
self.nth_index_cache.as_mut().map(|c| &mut **c),
visited_handling_mode,
self.shared_context.quirks_mode(),
self.quirks_mode,
);
let matches_now = matches_selector(
@ -966,7 +970,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
None,
self.nth_index_cache.as_mut().map(|c| &mut **c),
visited_handling_mode,
self.shared_context.quirks_mode(),
self.quirks_mode,
);
let matched_then = matches_selector(