mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #8273 - michaelwu:cleanups, r=jdm
Minor cleanups for DOM <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8273) <!-- Reviewable:end -->
This commit is contained in:
commit
c887aaf694
4 changed files with 10 additions and 11 deletions
|
@ -60,8 +60,8 @@ impl CSSStyleDeclaration {
|
||||||
CSSStyleDeclaration {
|
CSSStyleDeclaration {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
owner: JS::from_ref(owner),
|
owner: JS::from_ref(owner),
|
||||||
pseudo: pseudo,
|
|
||||||
readonly: modification_access == CSSModificationAccess::Readonly,
|
readonly: modification_access == CSSModificationAccess::Readonly,
|
||||||
|
pseudo: pseudo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,10 +155,10 @@ impl Element {
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
attrs: DOMRefCell::new(vec!()),
|
attrs: DOMRefCell::new(vec!()),
|
||||||
attr_list: Default::default(),
|
|
||||||
class_list: Default::default(),
|
|
||||||
id_attribute: DOMRefCell::new(None),
|
id_attribute: DOMRefCell::new(None),
|
||||||
style_attribute: DOMRefCell::new(None),
|
style_attribute: DOMRefCell::new(None),
|
||||||
|
attr_list: Default::default(),
|
||||||
|
class_list: Default::default(),
|
||||||
event_state: Cell::new(state),
|
event_state: Cell::new(state),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ pub unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace,
|
||||||
-> Option<LayoutJS<Attr>> {
|
-> Option<LayoutJS<Attr>> {
|
||||||
// cast to point to T in RefCell<T> directly
|
// cast to point to T in RefCell<T> directly
|
||||||
let attrs = elem.attrs.borrow_for_layout();
|
let attrs = elem.attrs.borrow_for_layout();
|
||||||
attrs.iter().find(|attr: & &JS<Attr>| {
|
attrs.iter().find(|attr| {
|
||||||
let attr = attr.to_layout();
|
let attr = attr.to_layout();
|
||||||
*name == attr.local_name_atom_forever() &&
|
*name == attr.local_name_atom_forever() &&
|
||||||
(*attr.unsafe_get()).namespace() == namespace
|
(*attr.unsafe_get()).namespace() == namespace
|
||||||
|
@ -216,7 +216,7 @@ impl RawLayoutElementHelpers for Element {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn get_attr_vals_for_layout<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
|
unsafe fn get_attr_vals_for_layout<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
|
||||||
let attrs = self.attrs.borrow_for_layout();
|
let attrs = self.attrs.borrow_for_layout();
|
||||||
(*attrs).iter().filter_map(|attr: &JS<Attr>| {
|
attrs.iter().filter_map(|attr| {
|
||||||
let attr = attr.to_layout();
|
let attr = attr.to_layout();
|
||||||
if *name == attr.local_name_atom_forever() {
|
if *name == attr.local_name_atom_forever() {
|
||||||
Some(attr.value_ref_forever())
|
Some(attr.value_ref_forever())
|
||||||
|
|
|
@ -62,15 +62,15 @@ impl Event {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
current_target: Default::default(),
|
current_target: Default::default(),
|
||||||
target: Default::default(),
|
target: Default::default(),
|
||||||
phase: Cell::new(EventPhase::None),
|
|
||||||
type_: DOMRefCell::new("".to_owned()),
|
type_: DOMRefCell::new("".to_owned()),
|
||||||
|
phase: Cell::new(EventPhase::None),
|
||||||
canceled: Cell::new(false),
|
canceled: Cell::new(false),
|
||||||
|
stop_propagation: Cell::new(false),
|
||||||
|
stop_immediate: Cell::new(false),
|
||||||
cancelable: Cell::new(false),
|
cancelable: Cell::new(false),
|
||||||
bubbles: Cell::new(false),
|
bubbles: Cell::new(false),
|
||||||
trusted: Cell::new(false),
|
trusted: Cell::new(false),
|
||||||
dispatching: Cell::new(false),
|
dispatching: Cell::new(false),
|
||||||
stop_propagation: Cell::new(false),
|
|
||||||
stop_immediate: Cell::new(false),
|
|
||||||
initialized: Cell::new(false),
|
initialized: Cell::new(false),
|
||||||
timestamp: time::get_time().sec as u64,
|
timestamp: time::get_time().sec as u64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,10 +163,9 @@ impl XMLHttpRequest {
|
||||||
request_headers: DOMRefCell::new(Headers::new()),
|
request_headers: DOMRefCell::new(Headers::new()),
|
||||||
request_body_len: Cell::new(0),
|
request_body_len: Cell::new(0),
|
||||||
sync: Cell::new(false),
|
sync: Cell::new(false),
|
||||||
send_flag: Cell::new(false),
|
|
||||||
|
|
||||||
upload_complete: Cell::new(false),
|
upload_complete: Cell::new(false),
|
||||||
upload_events: Cell::new(false),
|
upload_events: Cell::new(false),
|
||||||
|
send_flag: Cell::new(false),
|
||||||
|
|
||||||
global: GlobalField::from_rooted(&global),
|
global: GlobalField::from_rooted(&global),
|
||||||
timeout_cancel: DOMRefCell::new(None),
|
timeout_cancel: DOMRefCell::new(None),
|
||||||
|
@ -881,7 +880,7 @@ impl XMLHttpRequest {
|
||||||
_ => "error",
|
_ => "error",
|
||||||
};
|
};
|
||||||
|
|
||||||
let upload_complete: &Cell<bool> = &self.upload_complete;
|
let upload_complete = &self.upload_complete;
|
||||||
if !upload_complete.get() {
|
if !upload_complete.get() {
|
||||||
upload_complete.set(true);
|
upload_complete.set(true);
|
||||||
self.dispatch_upload_progress_event("progress".to_owned(), None);
|
self.dispatch_upload_progress_event("progress".to_owned(), None);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue