mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Add support for skipping display fixup for pseudos.
This is needed for https://bugzilla.mozilla.org/show_bug.cgi?id=1346481
This commit is contained in:
parent
96a3bb5f16
commit
275865486e
4 changed files with 24 additions and 15 deletions
|
@ -21,7 +21,7 @@ use style::context::SharedStyleContext;
|
||||||
use style::data::ElementData;
|
use style::data::ElementData;
|
||||||
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
|
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
|
||||||
use style::dom::OpaqueNode;
|
use style::dom::OpaqueNode;
|
||||||
use style::properties::ServoComputedValues;
|
use style::properties::{CascadeFlags, ServoComputedValues};
|
||||||
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
|
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Clone, Debug)]
|
#[derive(Copy, PartialEq, Clone, Debug)]
|
||||||
|
@ -408,7 +408,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
||||||
&style_pseudo,
|
&style_pseudo,
|
||||||
Some(data.styles().primary.values()),
|
Some(data.styles().primary.values()),
|
||||||
&context.default_computed_values,
|
&context.default_computed_values,
|
||||||
false);
|
CascadeFlags::empty());
|
||||||
data.styles_mut().pseudos
|
data.styles_mut().pseudos
|
||||||
.insert(style_pseudo.clone(), new_style);
|
.insert(style_pseudo.clone(), new_style);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1666,6 +1666,7 @@ extern "C" {
|
||||||
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
ServoComputedValuesBorrowedOrNull,
|
ServoComputedValuesBorrowedOrNull,
|
||||||
pseudoTag: *mut nsIAtom,
|
pseudoTag: *mut nsIAtom,
|
||||||
|
skip_display_fixup: bool,
|
||||||
set:
|
set:
|
||||||
RawServoStyleSetBorrowed)
|
RawServoStyleSetBorrowed)
|
||||||
-> ServoComputedValuesStrong;
|
-> ServoComputedValuesStrong;
|
||||||
|
|
|
@ -14,7 +14,9 @@ use keyframes::KeyframesAnimation;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use pdqsort::sort_by;
|
use pdqsort::sort_by;
|
||||||
use properties::{self, CascadeFlags, ComputedValues, INHERIT_ALL};
|
use properties::{self, CascadeFlags, ComputedValues};
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
use properties::INHERIT_ALL;
|
||||||
use properties::PropertyDeclarationBlock;
|
use properties::PropertyDeclarationBlock;
|
||||||
use restyle_hints::{RestyleHint, DependencySet};
|
use restyle_hints::{RestyleHint, DependencySet};
|
||||||
use rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
|
use rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
|
||||||
|
@ -294,7 +296,7 @@ impl Stylist {
|
||||||
pseudo: &PseudoElement,
|
pseudo: &PseudoElement,
|
||||||
parent: Option<&Arc<ComputedValues>>,
|
parent: Option<&Arc<ComputedValues>>,
|
||||||
default: &Arc<ComputedValues>,
|
default: &Arc<ComputedValues>,
|
||||||
inherit_all: bool)
|
cascade_flags: CascadeFlags)
|
||||||
-> ComputedStyle {
|
-> ComputedStyle {
|
||||||
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
|
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
|
||||||
|
|
||||||
|
@ -308,11 +310,6 @@ impl Stylist {
|
||||||
None => self.rule_tree.root(),
|
None => self.rule_tree.root(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut flags = CascadeFlags::empty();
|
|
||||||
if inherit_all {
|
|
||||||
flags.insert(INHERIT_ALL)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE(emilio): We skip calculating the proper layout parent style
|
// NOTE(emilio): We skip calculating the proper layout parent style
|
||||||
// here.
|
// here.
|
||||||
//
|
//
|
||||||
|
@ -335,7 +332,7 @@ impl Stylist {
|
||||||
default,
|
default,
|
||||||
None,
|
None,
|
||||||
Box::new(StdoutErrorReporter),
|
Box::new(StdoutErrorReporter),
|
||||||
flags);
|
cascade_flags);
|
||||||
ComputedStyle::new(rule_node, Arc::new(computed))
|
ComputedStyle::new(rule_node, Arc::new(computed))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +360,11 @@ impl Stylist {
|
||||||
unreachable!("That pseudo doesn't represent an anonymous box!")
|
unreachable!("That pseudo doesn't represent an anonymous box!")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.precomputed_values_for_pseudo(&pseudo, Some(parent_style), default_style, inherit_all)
|
let mut cascade_flags = CascadeFlags::empty();
|
||||||
|
if inherit_all {
|
||||||
|
cascade_flags.insert(INHERIT_ALL);
|
||||||
|
}
|
||||||
|
self.precomputed_values_for_pseudo(&pseudo, Some(parent_style), default_style, cascade_flags)
|
||||||
.values.unwrap()
|
.values.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ use style::keyframes::KeyframesStepValue;
|
||||||
use style::media_queries::{MediaList, parse_media_query_list};
|
use style::media_queries::{MediaList, parse_media_query_list};
|
||||||
use style::parallel;
|
use style::parallel;
|
||||||
use style::parser::{ParserContext, ParserContextExtraData};
|
use style::parser::{ParserContext, ParserContextExtraData};
|
||||||
use style::properties::{ComputedValues, Importance, ParsedDeclaration};
|
use style::properties::{CascadeFlags, ComputedValues, Importance, ParsedDeclaration};
|
||||||
use style::properties::{PropertyDeclarationBlock, PropertyId};
|
use style::properties::{PropertyDeclarationBlock, PropertyId};
|
||||||
|
use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||||
use style::properties::animated_properties::{AnimationValue, Interpolate, TransitionProperty};
|
use style::properties::animated_properties::{AnimationValue, Interpolate, TransitionProperty};
|
||||||
use style::properties::parse_one_declaration;
|
use style::properties::parse_one_declaration;
|
||||||
use style::restyle_hints::{self, RestyleHint};
|
use style::restyle_hints::{self, RestyleHint};
|
||||||
|
@ -619,6 +620,7 @@ pub extern "C" fn Servo_MediaRule_GetCssText(rule: RawServoMediaRuleBorrowed, re
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesBorrowedOrNull,
|
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesBorrowedOrNull,
|
||||||
pseudo_tag: *mut nsIAtom,
|
pseudo_tag: *mut nsIAtom,
|
||||||
|
skip_display_fixup: bool,
|
||||||
raw_data: RawServoStyleSetBorrowed)
|
raw_data: RawServoStyleSetBorrowed)
|
||||||
-> ServoComputedValuesStrong {
|
-> ServoComputedValuesStrong {
|
||||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
|
let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
|
||||||
|
@ -627,8 +629,13 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
|
|
||||||
|
|
||||||
let maybe_parent = ComputedValues::arc_from_borrowed(&parent_style_or_null);
|
let maybe_parent = ComputedValues::arc_from_borrowed(&parent_style_or_null);
|
||||||
|
let mut cascade_flags = CascadeFlags::empty();
|
||||||
|
if skip_display_fixup {
|
||||||
|
cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
|
||||||
|
}
|
||||||
data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent,
|
data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent,
|
||||||
data.default_computed_values(), false)
|
data.default_computed_values(),
|
||||||
|
cascade_flags)
|
||||||
.values.unwrap()
|
.values.unwrap()
|
||||||
.into_strong()
|
.into_strong()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue