<commit_before>/* 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/. */

<%namespace name="helpers" file="/helpers.mako.rs" />

<% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %>

<%helpers:longhand name="cursor">
    pub use self::computed_value::T as SpecifiedValue;
    use values::computed::ComputedValueAsSpecified;

    impl ComputedValueAsSpecified for SpecifiedValue {}

    pub mod computed_value {
        use cssparser::ToCss;
        use std::fmt;
        use style_traits::cursor::Cursor;

        #[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)]
        pub enum T {
            AutoCursor,
            SpecifiedCursor(Cursor),
        }

        impl ToCss for T {
            fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
                match *self {
                    T::AutoCursor => dest.write_str("auto"),
                    T::SpecifiedCursor(c) => c.to_css(dest),
                }
            }
        }
    }

    #[inline]
    pub fn get_initial_value() -> computed_value::T {
        computed_value::T::AutoCursor
    }
    pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
        use std::ascii::AsciiExt;
        use style_traits::cursor::Cursor;
        let ident = try!(input.expect_ident());
        if ident.eq_ignore_ascii_case("auto") {
            Ok(SpecifiedValue::AutoCursor)
        } else {
            Cursor::from_css_keyword(&ident)
            .map(SpecifiedValue::SpecifiedCursor)
        }
    }
</%helpers:longhand>

// NB: `pointer-events: auto` (and use of `pointer-events` in anything that isn't SVG, in fact)
// is nonstandard, slated for CSS4-UI.
// TODO(pcwalton): SVG-only values.
${helpers.single_keyword("pointer-events", "auto none")}

${helpers.single_keyword("-moz-user-focus",
                         "ignore normal select-after select-before select-menu select-same select-all none",
                         products="gecko",
                         gecko_ffi_name="mUserFocus",
                         gecko_constant_prefix="NS_STYLE_USER_FOCUS")}<commit_msg>Add -moz-user-modify<commit_after>/* 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/. */

<%namespace name="helpers" file="/helpers.mako.rs" />

<% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %>

<%helpers:longhand name="cursor">
    pub use self::computed_value::T as SpecifiedValue;
    use values::computed::ComputedValueAsSpecified;

    impl ComputedValueAsSpecified for SpecifiedValue {}

    pub mod computed_value {
        use cssparser::ToCss;
        use std::fmt;
        use style_traits::cursor::Cursor;

        #[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)]
        pub enum T {
            AutoCursor,
            SpecifiedCursor(Cursor),
        }

        impl ToCss for T {
            fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
                match *self {
                    T::AutoCursor => dest.write_str("auto"),
                    T::SpecifiedCursor(c) => c.to_css(dest),
                }
            }
        }
    }

    #[inline]
    pub fn get_initial_value() -> computed_value::T {
        computed_value::T::AutoCursor
    }
    pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
        use std::ascii::AsciiExt;
        use style_traits::cursor::Cursor;
        let ident = try!(input.expect_ident());
        if ident.eq_ignore_ascii_case("auto") {
            Ok(SpecifiedValue::AutoCursor)
        } else {
            Cursor::from_css_keyword(&ident)
            .map(SpecifiedValue::SpecifiedCursor)
        }
    }
</%helpers:longhand>

// NB: `pointer-events: auto` (and use of `pointer-events` in anything that isn't SVG, in fact)
// is nonstandard, slated for CSS4-UI.
// TODO(pcwalton): SVG-only values.
${helpers.single_keyword("pointer-events", "auto none")}

${helpers.single_keyword("-moz-user-modify", "read-only read-write write-only", products="gecko",
                         gecko_ffi_name="mUserModify", gecko_constant_prefix="NS_STYLE_USER_MODIFY")}

${helpers.single_keyword("-moz-user-focus",
                         "ignore normal select-after select-before select-menu select-same select-all none",
                         products="gecko",
                         gecko_ffi_name="mUserFocus",
                         gecko_constant_prefix="NS_STYLE_USER_FOCUS")}
{'fraction_non_alphanumeric': 0.12677824267782425, 'fraction_numerical': 0.0020920502092050207, 'mean_word_length': 2.451985559566787, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5895917', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1421, 'n_words': 323}