servo: Merge #4443 - Make the argument to dispatch_event_with_target non-optional (from Ms2ger:dispatch_event_with_target); r=Manishearth

The name of the method makes it clear it's supposed to be used with a target
override, so we might as well enforce that.

Source-Repo: https://github.com/servo/servo
Source-Revision: 11b27361c9f6af08ed78fa1a3fe58732b4c69cd4
This commit is contained in:
Ms2ger
2014-12-19 04:33:46 -07:00
parent b8408bacd9
commit f2ea9296ec
2 changed files with 5 additions and 5 deletions

View File

@@ -108,7 +108,7 @@ impl EventTarget {
pub trait EventTargetHelpers { pub trait EventTargetHelpers {
fn dispatch_event_with_target(self, fn dispatch_event_with_target(self,
target: Option<JSRef<EventTarget>>, target: JSRef<EventTarget>,
event: JSRef<Event>) -> bool; event: JSRef<Event>) -> bool;
fn dispatch_event(self, event: JSRef<Event>) -> bool; fn dispatch_event(self, event: JSRef<Event>) -> bool;
fn set_inline_event_listener(self, fn set_inline_event_listener(self,
@@ -130,13 +130,13 @@ pub trait EventTargetHelpers {
impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> { impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
fn dispatch_event_with_target(self, fn dispatch_event_with_target(self,
target: Option<JSRef<EventTarget>>, target: JSRef<EventTarget>,
event: JSRef<Event>) -> bool { event: JSRef<Event>) -> bool {
dispatch_event(self, target, event) dispatch_event(self, Some(target), event)
} }
fn dispatch_event(self, event: JSRef<Event>) -> bool { fn dispatch_event(self, event: JSRef<Event>) -> bool {
self.dispatch_event_with_target(None, event) dispatch_event(self, None, event)
} }
fn set_inline_event_listener(self, fn set_inline_event_listener(self,

View File

@@ -859,7 +859,7 @@ impl ScriptTask {
EventBubbles::DoesNotBubble, EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable).root(); EventCancelable::NotCancelable).root();
let wintarget: JSRef<EventTarget> = EventTargetCast::from_ref(*window); let wintarget: JSRef<EventTarget> = EventTargetCast::from_ref(*window);
let _ = wintarget.dispatch_event_with_target(Some(doctarget), *event); let _ = wintarget.dispatch_event_with_target(doctarget, *event);
*page.fragment_name.borrow_mut() = final_url.fragment.clone(); *page.fragment_name.borrow_mut() = final_url.fragment.clone();