mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Make UIEvent.view be in a Cell.
This commit is contained in:
parent
b38f39ebe4
commit
93f8ae4cf0
1 changed files with 4 additions and 3 deletions
|
@ -13,11 +13,12 @@ use dom::window::Window;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
use serialize::{Encoder, Encodable};
|
use serialize::{Encoder, Encodable};
|
||||||
|
use std::cell::Cell;
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
pub struct UIEvent {
|
pub struct UIEvent {
|
||||||
pub event: Event,
|
pub event: Event,
|
||||||
pub view: Option<JS<Window>>,
|
pub view: Cell<Option<JS<Window>>>,
|
||||||
pub detail: i32
|
pub detail: i32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ impl UIEvent {
|
||||||
pub fn new_inherited(type_id: EventTypeId) -> UIEvent {
|
pub fn new_inherited(type_id: EventTypeId) -> UIEvent {
|
||||||
UIEvent {
|
UIEvent {
|
||||||
event: Event::new_inherited(type_id),
|
event: Event::new_inherited(type_id),
|
||||||
view: None,
|
view: Cell::new(None),
|
||||||
detail: 0
|
detail: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,7 @@ pub trait UIEventMethods {
|
||||||
|
|
||||||
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
||||||
fn GetView(&self) -> Option<Temporary<Window>> {
|
fn GetView(&self) -> Option<Temporary<Window>> {
|
||||||
self.view.map(|view| Temporary::new(view))
|
self.view.get().map(|view| Temporary::new(view))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Detail(&self) -> i32 {
|
fn Detail(&self) -> i32 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue