Auto merge of #17744 - emilio:ensure-data, r=nox

script: Move the layout_wrapper outside of script.

This allows us to have ensure_data() and clear_data() functions on the TElement
trait, instead of hacking around it adding methods in random traits.

This also allows us to do some further cleanup, which I'd rather do in a
followup.

<!-- 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/17744)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-15 07:44:08 -07:00 committed by GitHub
commit 3497bbbf1d
17 changed files with 128 additions and 166 deletions

View file

@ -762,7 +762,7 @@ pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 {
#[no_mangle]
pub extern "C" fn Servo_Element_ClearData(element: RawGeckoElementBorrowed) {
GeckoElement(element).clear_data();
unsafe { GeckoElement(element).clear_data() };
}
#[no_mangle]
@ -1531,7 +1531,7 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
-> ServoComputedValuesStrong
{
let element = GeckoElement(element);
let data = unsafe { element.ensure_data() }.borrow_mut();
let data = unsafe { element.ensure_data() };
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
debug!("Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
@ -1582,7 +1582,7 @@ pub extern "C" fn Servo_SetExplicitStyle(element: RawGeckoElementBorrowed,
// We only support this API for initial styling. There's no reason it couldn't
// work for other things, we just haven't had a reason to do so.
debug_assert!(element.get_data().is_none());
let mut data = unsafe { element.ensure_data() }.borrow_mut();
let mut data = unsafe { element.ensure_data() };
data.styles.primary = Some(style.clone());
}