Skip to content

Commit

Permalink
Bug 1298588 part 7, servo piece. Stop using initial_values in general…
Browse files Browse the repository at this point in the history
… in Gecko glue code. r=bholley
  • Loading branch information
bzbarsky committed Jan 5, 2017
1 parent c313c8d commit d3e34db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/style/gecko_bindings/bindings.rs
Expand Up @@ -1387,6 +1387,7 @@ extern "C" {
}
extern "C" {
pub fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
set: RawServoStyleSetBorrowed,
consume: ConsumeStyleBehavior)
-> ServoComputedValuesStrong;
}
Expand Down
8 changes: 5 additions & 3 deletions ports/geckolib/glue.rs
Expand Up @@ -544,18 +544,18 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
{
let element = GeckoElement(element);
let data = unsafe { element.ensure_data() }.borrow_mut();
let doc_data = PerDocumentStyleData::from_ffi(raw_data);

// FIXME(bholley): Assert against this.
if data.get_styles().is_none() {
error!("Calling Servo_ResolvePseudoStyle on unstyled element");
return if is_probe {
Strong::null()
} else {
Arc::new(ComputedValues::initial_values().clone()).into_strong()
doc_data.borrow().default_computed_values.clone().into_strong()
};
}

let doc_data = PerDocumentStyleData::from_ffi(raw_data);
match get_pseudo_style(element, pseudo_tag, data.styles(), doc_data) {
Some(values) => values.into_strong(),
None if !is_probe => data.styles().primary.values.clone().into_strong(),
Expand Down Expand Up @@ -942,17 +942,19 @@ pub extern "C" fn Servo_CheckChangeHint(element: RawGeckoElementBorrowed) -> nsC

#[no_mangle]
pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
raw_data: RawServoStyleSetBorrowed,
consume: structs::ConsumeStyleBehavior)
-> ServoComputedValuesStrong
{
let element = GeckoElement(element);
debug!("Servo_ResolveStyle: {:?}, consume={:?}", element, consume);

let mut data = unsafe { element.ensure_data() }.borrow_mut();
let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();

if !data.has_current_styles() {
error!("Resolving style on unstyled element with lazy computation forbidden.");
return Arc::new(ComputedValues::initial_values().clone()).into_strong();
return per_doc_data.default_computed_values.clone().into_strong();
}

let values = data.styles().primary.values.clone();
Expand Down

0 comments on commit d3e34db

Please sign in to comment.