mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Avoid creating element data in Servo_ResolvePseudoStyle.
The reason the patch in bug 1402285 doesn't work is that we call this function multiple times with the same element. This fixes it. Bug: 1403465 Reviewed-by: bholley MozReview-Commit-ID: Ko9zirCOzTR Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
056c085119
commit
8789b91bd9
1 changed files with 20 additions and 10 deletions
|
@ -1772,21 +1772,31 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
|
||||||
-> ServoStyleContextStrong
|
-> ServoStyleContextStrong
|
||||||
{
|
{
|
||||||
let element = GeckoElement(element);
|
let element = GeckoElement(element);
|
||||||
let data = unsafe { element.ensure_data() };
|
|
||||||
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
|
|
||||||
debug!("Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
|
debug!("Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
|
||||||
element, PseudoElement::from_pseudo_type(pseudo_type), is_probe);
|
element, PseudoElement::from_pseudo_type(pseudo_type), is_probe);
|
||||||
|
|
||||||
// FIXME(bholley): Assert against this.
|
let data = element.borrow_data();
|
||||||
if !data.has_styles() {
|
|
||||||
warn!("Calling Servo_ResolvePseudoStyle on unstyled element");
|
let data = match data.as_ref() {
|
||||||
return if is_probe {
|
Some(data) if data.has_styles() => data,
|
||||||
Strong::null()
|
_ => {
|
||||||
} else {
|
// FIXME(bholley, emilio): Assert against this.
|
||||||
doc_data.default_computed_values().clone().into()
|
//
|
||||||
};
|
// Known offender is nsMathMLmoFrame::MarkIntrinsicISizesDirty,
|
||||||
}
|
// which goes and does a bunch of work involving style resolution.
|
||||||
|
//
|
||||||
|
// Bug 1403865 tracks fixing it, and potentially adding an assert
|
||||||
|
// here instead.
|
||||||
|
warn!("Calling Servo_ResolvePseudoStyle on unstyled element");
|
||||||
|
return if is_probe {
|
||||||
|
Strong::null()
|
||||||
|
} else {
|
||||||
|
doc_data.default_computed_values().clone().into()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let pseudo = PseudoElement::from_pseudo_type(pseudo_type)
|
let pseudo = PseudoElement::from_pseudo_type(pseudo_type)
|
||||||
.expect("ResolvePseudoStyle with a non-pseudo?");
|
.expect("ResolvePseudoStyle with a non-pseudo?");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue