mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Simplify get_cursor
This commit is contained in:
parent
087e6d649b
commit
cf15336a51
1 changed files with 7 additions and 14 deletions
|
@ -59,7 +59,6 @@ use style::values::computed::image::Image as ComputedImage;
|
||||||
use style::values::computed::Gradient;
|
use style::values::computed::Gradient;
|
||||||
use style::values::generics::background::BackgroundSize;
|
use style::values::generics::background::BackgroundSize;
|
||||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||||
use style::values::generics::ui::Cursor;
|
|
||||||
use style::values::{Either, RGBA};
|
use style::values::{Either, RGBA};
|
||||||
use style_traits::cursor::CursorKind;
|
use style_traits::cursor::CursorKind;
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
|
@ -2831,20 +2830,14 @@ impl BaseFlow {
|
||||||
/// text display items it may be `TextCursor` or `VerticalTextCursor`.
|
/// text display items it may be `TextCursor` or `VerticalTextCursor`.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_cursor(values: &ComputedValues, default_cursor: CursorKind) -> Option<CursorKind> {
|
fn get_cursor(values: &ComputedValues, default_cursor: CursorKind) -> Option<CursorKind> {
|
||||||
match (
|
let inherited_ui = values.get_inherited_ui();
|
||||||
values.get_inherited_ui().pointer_events,
|
if inherited_ui.pointer_events == PointerEvents::None {
|
||||||
&values.get_inherited_ui().cursor,
|
return None;
|
||||||
) {
|
|
||||||
(PointerEvents::None, _) => None,
|
|
||||||
(
|
|
||||||
PointerEvents::Auto,
|
|
||||||
&Cursor {
|
|
||||||
keyword: CursorKind::Auto,
|
|
||||||
..
|
|
||||||
},
|
|
||||||
) => Some(default_cursor),
|
|
||||||
(PointerEvents::Auto, &Cursor { keyword, .. }) => Some(keyword),
|
|
||||||
}
|
}
|
||||||
|
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
|
/// Adjusts `content_rect` as necessary for the given spread, and blur so that the resulting
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue