Privatize some items in EventTarget.

This commit is contained in:
Ms2ger 2017-01-09 10:21:50 +01:00
parent b8554abaa4
commit 63f0d3ecf5

View file

@ -69,7 +69,7 @@ pub enum ListenerPhase {
/// https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler /// https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler
#[derive(JSTraceable, Clone, PartialEq)] #[derive(JSTraceable, Clone, PartialEq)]
pub struct InternalRawUncompiledHandler { struct InternalRawUncompiledHandler {
source: DOMString, source: DOMString,
url: ServoUrl, url: ServoUrl,
line: usize, line: usize,
@ -77,7 +77,7 @@ pub struct InternalRawUncompiledHandler {
/// A representation of an event handler, either compiled or uncompiled raw source, or null. /// A representation of an event handler, either compiled or uncompiled raw source, or null.
#[derive(JSTraceable, PartialEq, Clone)] #[derive(JSTraceable, PartialEq, Clone)]
pub enum InlineEventListener { enum InlineEventListener {
Uncompiled(InternalRawUncompiledHandler), Uncompiled(InternalRawUncompiledHandler),
Compiled(CommonEventHandler), Compiled(CommonEventHandler),
Null, Null,
@ -308,9 +308,9 @@ impl EventTarget {
} }
/// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11 /// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11
pub fn set_inline_event_listener(&self, fn set_inline_event_listener(&self,
ty: Atom, ty: Atom,
listener: Option<InlineEventListener>) { listener: Option<InlineEventListener>) {
let mut handlers = self.handlers.borrow_mut(); let mut handlers = self.handlers.borrow_mut();
let entries = match handlers.entry(ty) { let entries = match handlers.entry(ty) {
Occupied(entry) => entry.into_mut(), Occupied(entry) => entry.into_mut(),
@ -363,10 +363,10 @@ impl EventTarget {
// https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler // https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn get_compiled_event_handler(&self, fn get_compiled_event_handler(&self,
handler: InternalRawUncompiledHandler, handler: InternalRawUncompiledHandler,
ty: &Atom) ty: &Atom)
-> Option<CommonEventHandler> { -> Option<CommonEventHandler> {
// Step 1.1 // Step 1.1
let element = self.downcast::<Element>(); let element = self.downcast::<Element>();
let document = match element { let document = match element {