Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support keyword values for 'cursor' in geckolib
  • Loading branch information
mbrubeck committed Jun 9, 2016
1 parent ca58ff6 commit d4a84cc
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions ports/geckolib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ports/geckolib/Cargo.toml
Expand Up @@ -43,6 +43,7 @@ time = {version = "0.1", optional = true, features = ["rustc-serialize"]}
util = {path = "../../components/util"}
uuid = {version = "0.2", optional = true, features = ["v4", "serde"]}
style = {path = "../../components/style", features = ["gecko"]}
style_traits = {path = "../../components/style_traits"}
env_logger = "0.3"

[replace]
Expand Down
1 change: 1 addition & 0 deletions ports/geckolib/lib.rs
Expand Up @@ -29,6 +29,7 @@ extern crate smallvec;
#[macro_use(atom, ns)]
extern crate string_cache;
extern crate style;
extern crate style_traits;
extern crate url;
extern crate util;

Expand Down
53 changes: 53 additions & 0 deletions ports/geckolib/properties.mako.rs
Expand Up @@ -967,6 +967,59 @@ fn static_assert() {
}
</%self:impl_trait>

<%self:impl_trait style_struct_name="Pointing"
skip_longhands="cursor">

fn set_cursor(&mut self, v: longhands::cursor::computed_value::T) {
use style::properties::longhands::cursor::computed_value::T;
use style_traits::cursor::Cursor;

self.gecko.mCursor = match v {
T::AutoCursor => structs::NS_STYLE_CURSOR_AUTO,
T::SpecifiedCursor(cursor) => match cursor {
Cursor::NoCursor => structs::NS_STYLE_CURSOR_NONE,
Cursor::DefaultCursor => structs::NS_STYLE_CURSOR_DEFAULT,
Cursor::PointerCursor => structs::NS_STYLE_CURSOR_POINTER,
Cursor::ContextMenuCursor => structs::NS_STYLE_CURSOR_CONTEXT_MENU,
Cursor::HelpCursor => structs::NS_STYLE_CURSOR_HELP,
Cursor::ProgressCursor => structs::NS_STYLE_CURSOR_DEFAULT, // Gecko doesn't support "progress" yet
Cursor::WaitCursor => structs::NS_STYLE_CURSOR_WAIT,
Cursor::CellCursor => structs::NS_STYLE_CURSOR_CELL,
Cursor::CrosshairCursor => structs::NS_STYLE_CURSOR_CROSSHAIR,
Cursor::TextCursor => structs::NS_STYLE_CURSOR_TEXT,
Cursor::VerticalTextCursor => structs::NS_STYLE_CURSOR_VERTICAL_TEXT,
Cursor::AliasCursor => structs::NS_STYLE_CURSOR_ALIAS,
Cursor::CopyCursor => structs::NS_STYLE_CURSOR_COPY,
Cursor::MoveCursor => structs::NS_STYLE_CURSOR_MOVE,
Cursor::NoDropCursor => structs::NS_STYLE_CURSOR_NO_DROP,
Cursor::NotAllowedCursor => structs::NS_STYLE_CURSOR_NOT_ALLOWED,
Cursor::GrabCursor => structs::NS_STYLE_CURSOR_GRAB,
Cursor::GrabbingCursor => structs::NS_STYLE_CURSOR_GRABBING,
Cursor::EResizeCursor => structs::NS_STYLE_CURSOR_E_RESIZE,
Cursor::NResizeCursor => structs::NS_STYLE_CURSOR_N_RESIZE,
Cursor::NeResizeCursor => structs::NS_STYLE_CURSOR_NE_RESIZE,
Cursor::NwResizeCursor => structs::NS_STYLE_CURSOR_NW_RESIZE,
Cursor::SResizeCursor => structs::NS_STYLE_CURSOR_S_RESIZE,
Cursor::SeResizeCursor => structs::NS_STYLE_CURSOR_SE_RESIZE,
Cursor::SwResizeCursor => structs::NS_STYLE_CURSOR_SW_RESIZE,
Cursor::WResizeCursor => structs::NS_STYLE_CURSOR_W_RESIZE,
Cursor::EwResizeCursor => structs::NS_STYLE_CURSOR_EW_RESIZE,
Cursor::NsResizeCursor => structs::NS_STYLE_CURSOR_NS_RESIZE,
Cursor::NeswResizeCursor => structs::NS_STYLE_CURSOR_NESW_RESIZE,
Cursor::NwseResizeCursor => structs::NS_STYLE_CURSOR_NWSE_RESIZE,
Cursor::ColResizeCursor => structs::NS_STYLE_CURSOR_COL_RESIZE,
Cursor::RowResizeCursor => structs::NS_STYLE_CURSOR_ROW_RESIZE,
Cursor::AllScrollCursor => structs::NS_STYLE_CURSOR_ALL_SCROLL,
Cursor::ZoomInCursor => structs::NS_STYLE_CURSOR_ZOOM_IN,
Cursor::ZoomOutCursor => structs::NS_STYLE_CURSOR_ZOOM_OUT,
}
} as u8;
}

${impl_simple_copy('cursor', 'mCursor')}

</%self:impl_trait>

<%def name="define_ffi_struct_accessor(style_struct)">
#[no_mangle]
#[allow(non_snake_case, unused_variables)]
Expand Down

0 comments on commit d4a84cc

Please sign in to comment.