Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support keyword values for 'cursor' in geckolib #11688

Merged
merged 1 commit into from Jun 10, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Support keyword values for 'cursor' in geckolib

  • Loading branch information
mbrubeck committed Jun 9, 2016
commit d4a84cce8ef31b81c68d59ee95925ef904f4ea5d

Some generated files are not rendered by default. Learn more.

@@ -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]
@@ -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;

@@ -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)]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.