forked from mirrors/gecko-dev
Now `#[dom_struct]` also generates Reflectable impls, and there's another lint to ensure that a DOM struct only contains one bare DOM field (as the first field) or a Reflector. A lot of this was generated by sed -- each autogenerated change has its own commit for easy review; these will be squashed later. Source-Repo: https://github.com/servo/servo Source-Revision: 56d1b16d1b3a18d5ffa1d9c32562d3b209851711
40 lines
1 KiB
Rust
40 lines
1 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
use dom::bindings::codegen::Bindings::ScreenBinding;
|
|
use dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods;
|
|
use dom::bindings::global::GlobalRef;
|
|
use dom::bindings::js::{JSRef, Temporary};
|
|
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
|
use dom::window::Window;
|
|
|
|
#[dom_struct]
|
|
pub struct Screen {
|
|
reflector_: Reflector,
|
|
}
|
|
|
|
impl Screen {
|
|
fn new_inherited() -> Screen {
|
|
Screen {
|
|
reflector_: Reflector::new(),
|
|
}
|
|
}
|
|
|
|
pub fn new(window: JSRef<Window>) -> Temporary<Screen> {
|
|
reflect_dom_object(box Screen::new_inherited(),
|
|
GlobalRef::Window(window),
|
|
ScreenBinding::Wrap)
|
|
}
|
|
}
|
|
|
|
impl<'a> ScreenMethods for JSRef<'a, Screen> {
|
|
fn ColorDepth(self) -> u32 {
|
|
24
|
|
}
|
|
|
|
fn PixelDepth(self) -> u32 {
|
|
24
|
|
}
|
|
}
|
|
|