diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 9a626f98c74..6af189896d3 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -4671,6 +4671,17 @@ clip-path // background-image to a url() value, since only properties in reset structs // are re-used from the applicable declaration cache, and the Pointing struct // is an inherited struct. + + match v.images[i].hotspot { + Some((x, y)) => { + self.gecko.mCursorImages[i].mHaveHotspot = true; + self.gecko.mCursorImages[i].mHotspotX = x; + self.gecko.mCursorImages[i].mHotspotY = y; + }, + _ => { + self.gecko.mCursorImages[i].mHaveHotspot = false; + } + } } } @@ -4681,6 +4692,71 @@ clip-path } } + pub fn clone_cursor(&self) -> longhands::cursor::computed_value::T { + use properties::longhands::cursor::computed_value::{Keyword, Image}; + use style_traits::cursor::Cursor; + use values::specified::url::SpecifiedUrl; + + let keyword = match self.gecko.mCursor as u32 { + structs::NS_STYLE_CURSOR_AUTO => Keyword::Auto, + structs::NS_STYLE_CURSOR_NONE => Keyword::Cursor(Cursor::None), + structs::NS_STYLE_CURSOR_DEFAULT => Keyword::Cursor(Cursor::Default), + structs::NS_STYLE_CURSOR_POINTER => Keyword::Cursor(Cursor::Pointer), + structs::NS_STYLE_CURSOR_CONTEXT_MENU => Keyword::Cursor(Cursor::ContextMenu), + structs::NS_STYLE_CURSOR_HELP => Keyword::Cursor(Cursor::Help), + structs::NS_STYLE_CURSOR_SPINNING => Keyword::Cursor(Cursor::Progress), + structs::NS_STYLE_CURSOR_WAIT => Keyword::Cursor(Cursor::Wait), + structs::NS_STYLE_CURSOR_CELL => Keyword::Cursor(Cursor::Cell), + structs::NS_STYLE_CURSOR_CROSSHAIR => Keyword::Cursor(Cursor::Crosshair), + structs::NS_STYLE_CURSOR_TEXT => Keyword::Cursor(Cursor::Text), + structs::NS_STYLE_CURSOR_VERTICAL_TEXT => Keyword::Cursor(Cursor::VerticalText), + structs::NS_STYLE_CURSOR_ALIAS => Keyword::Cursor(Cursor::Alias), + structs::NS_STYLE_CURSOR_COPY => Keyword::Cursor(Cursor::Copy), + structs::NS_STYLE_CURSOR_MOVE => Keyword::Cursor(Cursor::Move), + structs::NS_STYLE_CURSOR_NO_DROP => Keyword::Cursor(Cursor::NoDrop), + structs::NS_STYLE_CURSOR_NOT_ALLOWED => Keyword::Cursor(Cursor::NotAllowed), + structs::NS_STYLE_CURSOR_GRAB => Keyword::Cursor(Cursor::Grab), + structs::NS_STYLE_CURSOR_GRABBING => Keyword::Cursor(Cursor::Grabbing), + structs::NS_STYLE_CURSOR_E_RESIZE => Keyword::Cursor(Cursor::EResize), + structs::NS_STYLE_CURSOR_N_RESIZE => Keyword::Cursor(Cursor::NResize), + structs::NS_STYLE_CURSOR_NE_RESIZE => Keyword::Cursor(Cursor::NeResize), + structs::NS_STYLE_CURSOR_NW_RESIZE => Keyword::Cursor(Cursor::NwResize), + structs::NS_STYLE_CURSOR_S_RESIZE => Keyword::Cursor(Cursor::SResize), + structs::NS_STYLE_CURSOR_SE_RESIZE => Keyword::Cursor(Cursor::SeResize), + structs::NS_STYLE_CURSOR_SW_RESIZE => Keyword::Cursor(Cursor::SwResize), + structs::NS_STYLE_CURSOR_W_RESIZE => Keyword::Cursor(Cursor::WResize), + structs::NS_STYLE_CURSOR_EW_RESIZE => Keyword::Cursor(Cursor::EwResize), + structs::NS_STYLE_CURSOR_NS_RESIZE => Keyword::Cursor(Cursor::NsResize), + structs::NS_STYLE_CURSOR_NESW_RESIZE => Keyword::Cursor(Cursor::NeswResize), + structs::NS_STYLE_CURSOR_NWSE_RESIZE => Keyword::Cursor(Cursor::NwseResize), + structs::NS_STYLE_CURSOR_COL_RESIZE => Keyword::Cursor(Cursor::ColResize), + structs::NS_STYLE_CURSOR_ROW_RESIZE => Keyword::Cursor(Cursor::RowResize), + structs::NS_STYLE_CURSOR_ALL_SCROLL => Keyword::Cursor(Cursor::AllScroll), + structs::NS_STYLE_CURSOR_ZOOM_IN => Keyword::Cursor(Cursor::ZoomIn), + structs::NS_STYLE_CURSOR_ZOOM_OUT => Keyword::Cursor(Cursor::ZoomOut), + x => panic!("Found unexpected value in style struct for cursor property: {:?}", x), + }; + + let images = self.gecko.mCursorImages.iter().map(|gecko_cursor_image| { + let url = unsafe { + let gecko_image_request = gecko_cursor_image.mImage.mRawPtr.as_ref().unwrap(); + SpecifiedUrl::from_image_request(&gecko_image_request) + .expect("mCursorImages.mImage could not convert to SpecifiedUrl") + }; + + let hotspot = + if gecko_cursor_image.mHaveHotspot { + Some((gecko_cursor_image.mHotspotX, gecko_cursor_image.mHotspotY)) + } else { + None + }; + + Image { url, hotspot } + }).collect(); + + longhands::cursor::computed_value::T { images, keyword } + } + <%call expr="impl_color('caret_color', 'mCaretColor', need_clone=True)"> diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index b5aafda574b..8a3558436a5 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -16,31 +16,35 @@ return "https://drafts.csswg.org/css-backgrounds/#border-%s-%s" % (side[0], kind) %> % for side in ALL_SIDES: - ${helpers.predefined_type("border-%s-color" % side[0], "Color", + <% + side_name = side[0] + is_logical = side[1] + %> + ${helpers.predefined_type("border-%s-color" % side_name, "Color", "computed_value::T::currentcolor()", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"), spec=maybe_logical_spec(side, "color"), animation_value_type="IntermediateColor", - logical=side[1], - allow_quirks=not side[1], + logical=is_logical, + allow_quirks=not is_logical, ignored_when_colors_disabled=True)} - ${helpers.predefined_type("border-%s-style" % side[0], "BorderStyle", + ${helpers.predefined_type("border-%s-style" % side_name, "BorderStyle", "specified::BorderStyle::none", - need_clone=True, alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"), spec=maybe_logical_spec(side, "style"), - animation_value_type="none", logical=side[1])} + animation_value_type="discrete" if not is_logical else "none", + logical=is_logical)} - ${helpers.predefined_type("border-%s-width" % side[0], + ${helpers.predefined_type("border-%s-width" % side_name, "BorderSideWidth", "Au::from_px(3)", computed_type="::app_units::Au", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"), spec=maybe_logical_spec(side, "width"), animation_value_type="ComputedValue", - logical=side[1], - allow_quirks=not side[1])} + logical=is_logical, + allow_quirks=not is_logical)} % endfor ${helpers.gecko_keyword_conversion(Keyword('border-style', diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index c9270bd799d..9bf7e43446f 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -6,7 +6,7 @@ <% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %> -<%helpers:longhand name="cursor" boxed="${product == 'gecko'}" animation_value_type="none" +<%helpers:longhand name="cursor" boxed="${product == 'gecko'}" animation_value_type="discrete" spec="https://drafts.csswg.org/css-ui/#cursor"> pub use self::computed_value::T as SpecifiedValue; use values::computed::ComputedValueAsSpecified; diff --git a/components/style/properties/longhand/ui.mako.rs b/components/style/properties/longhand/ui.mako.rs index 41926a69bec..b3a279aba7a 100644 --- a/components/style/properties/longhand/ui.mako.rs +++ b/components/style/properties/longhand/ui.mako.rs @@ -22,9 +22,10 @@ ${helpers.single_keyword("-moz-user-select", "auto text none all element element alias="-webkit-user-select", gecko_ffi_name="mUserSelect", gecko_enum_prefix="StyleUserSelect", + gecko_inexhaustive=True, gecko_strip_moz_prefix=False, aliases="-moz-none=none", - animation_value_type="none", + animation_value_type="discrete", spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select")} ${helpers.single_keyword("-moz-window-dragging", "default drag no-drag", products="gecko",