diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-14 16:10:15 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-14 16:51:28 +0100 |
commit | cf15336a51af938b1cc6d9f161d0ebdd6abda36b (patch) | |
tree | c4d0520f4cb6709229f1062abd0dc40be1b1bff9 | |
parent | 087e6d649bd76edd1f0fa48928dddaceafffed8c (diff) | |
download | servo-cf15336a51af938b1cc6d9f161d0ebdd6abda36b.tar.gz servo-cf15336a51af938b1cc6d9f161d0ebdd6abda36b.zip |
Simplify get_cursor
-rw-r--r-- | components/layout/display_list/builder.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 18b5b0608bf..18fb0980fcd 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -59,7 +59,6 @@ use style::values::computed::image::Image as ComputedImage; use style::values::computed::Gradient; use style::values::generics::background::BackgroundSize; use style::values::generics::image::{GradientKind, Image, PaintWorklet}; -use style::values::generics::ui::Cursor; use style::values::{Either, RGBA}; use style_traits::cursor::CursorKind; use style_traits::CSSPixel; @@ -2831,20 +2830,14 @@ impl BaseFlow { /// text display items it may be `TextCursor` or `VerticalTextCursor`. #[inline] fn get_cursor(values: &ComputedValues, default_cursor: CursorKind) -> Option<CursorKind> { - match ( - values.get_inherited_ui().pointer_events, - &values.get_inherited_ui().cursor, - ) { - (PointerEvents::None, _) => None, - ( - PointerEvents::Auto, - &Cursor { - keyword: CursorKind::Auto, - .. - }, - ) => Some(default_cursor), - (PointerEvents::Auto, &Cursor { keyword, .. }) => Some(keyword), - } + let inherited_ui = values.get_inherited_ui(); + if inherited_ui.pointer_events == PointerEvents::None { + return None; + } + Some(match inherited_ui.cursor.keyword { + CursorKind::Auto => default_cursor, + keyword => keyword, + }) } /// Adjusts `content_rect` as necessary for the given spread, and blur so that the resulting |