Skip to content
Permalink
Browse files

use less repetitive name

  • Loading branch information...
mrmiywj committed Jun 10, 2016
1 parent 3fa0dca commit 46cadfdd2ce17172fc508e0240b6ac43f5470e10
@@ -377,7 +377,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
display_list_section);
state.add_display_item(
DisplayItem::SolidColorClass(box SolidColorDisplayItem {
@@ -569,7 +569,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
display_list_section);
state.add_display_item(DisplayItem::ImageClass(box ImageDisplayItem {
base: base,
@@ -697,7 +697,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(absolute_bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
display_list_section);
let gradient_display_item = DisplayItem::GradientClass(box GradientDisplayItem {
base: base,
@@ -727,7 +727,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
display_list_section);
state.add_display_item(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem {
base: base,
@@ -799,7 +799,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
display_list_section);
state.add_display_item(DisplayItem::BorderClass(box BorderDisplayItem {
base: base,
@@ -842,7 +842,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&bounds,
&clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
DisplayListSection::Outlines);
state.add_display_item(DisplayItem::BorderClass(box BorderDisplayItem {
base: base,
@@ -867,7 +867,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(stacking_relative_border_box,
clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
DisplayListSection::Content);
state.add_display_item(DisplayItem::BorderClass(box BorderDisplayItem {
base: base,
@@ -888,7 +888,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(&baseline,
clip,
self.node,
style.get_cursor(Cursor::DefaultCursor),
style.get_cursor(Cursor::Default),
DisplayListSection::Content);
state.add_display_item(DisplayItem::LineClass(box LineDisplayItem {
base: base,
@@ -905,7 +905,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(stacking_relative_border_box,
clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
DisplayListSection::Content);
state.add_display_item(DisplayItem::BorderClass(box BorderDisplayItem {
base: base,
@@ -956,7 +956,7 @@ impl FragmentDisplayListBuilding for Fragment {
let base = state.create_base_display_item(stacking_relative_border_box,
&clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
display_list_section);
state.add_display_item(
DisplayItem::SolidColorClass(box SolidColorDisplayItem {
@@ -981,14 +981,14 @@ impl FragmentDisplayListBuilding for Fragment {
stacking_relative_border_box.origin.y),
Size2D::new(INSERTION_POINT_LOGICAL_WIDTH,
stacking_relative_border_box.size.height));
cursor = Cursor::TextCursor;
cursor = Cursor::Text;
} else {
insertion_point_bounds =
Rect::new(Point2D::new(stacking_relative_border_box.origin.x,
stacking_relative_border_box.origin.y + advance),
Size2D::new(stacking_relative_border_box.size.width,
INSERTION_POINT_LOGICAL_WIDTH));
cursor = Cursor::VerticalTextCursor;
cursor = Cursor::VerticalText;
};

let base = state.create_base_display_item(&insertion_point_bounds,
@@ -1208,7 +1208,7 @@ impl FragmentDisplayListBuilding for Fragment {
&stacking_relative_content_box,
clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
DisplayListSection::Content);
let item = DisplayItem::IframeClass(box IframeDisplayItem {
base: base,
@@ -1235,7 +1235,7 @@ impl FragmentDisplayListBuilding for Fragment {
&stacking_relative_content_box,
clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
DisplayListSection::Content);
state.add_display_item(DisplayItem::ImageClass(box ImageDisplayItem {
base: base,
@@ -1271,7 +1271,7 @@ impl FragmentDisplayListBuilding for Fragment {
&stacking_relative_content_box,
clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
DisplayListSection::Content);
let display_item = match canvas_data {
CanvasData::Pixels(canvas_data) => {
@@ -1545,12 +1545,12 @@ impl FragmentDisplayListBuilding for Fragment {
// Determine the orientation and cursor to use.
let (orientation, cursor) = if self.style.writing_mode.is_vertical() {
if self.style.writing_mode.is_sideways_left() {
(TextOrientation::SidewaysLeft, Cursor::VerticalTextCursor)
(TextOrientation::SidewaysLeft, Cursor::VerticalText)
} else {
(TextOrientation::SidewaysRight, Cursor::VerticalTextCursor)
(TextOrientation::SidewaysRight, Cursor::VerticalText)
}
} else {
(TextOrientation::Upright, Cursor::TextCursor)
(TextOrientation::Upright, Cursor::Text)
};

// Compute location of the baseline.
@@ -1649,7 +1649,7 @@ impl FragmentDisplayListBuilding for Fragment {
&shadow_bounds(&stacking_relative_box, blur_radius, Au(0)),
clip,
self.node,
self.style.get_cursor(Cursor::DefaultCursor),
self.style.get_cursor(Cursor::Default),
DisplayListSection::Content);
state.add_display_item(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem {
base: base,
@@ -74,7 +74,7 @@ impl LayoutRPC for LayoutRPCImpl {
if update_cursor {
// Compute the new cursor.
let cursor = match *result {
None => Cursor::DefaultCursor,
None => Cursor::Default,
Some(dim) => dim.pointing.unwrap(),
};
rw_data.constellation_chan.send(ConstellationMsg::SetCursor(cursor)).unwrap();
@@ -35,39 +35,39 @@ macro_rules! define_cursor {


define_cursor! {
"none" => NoCursor = 0,
"default" => DefaultCursor = 1,
"pointer" => PointerCursor = 2,
"context-menu" => ContextMenuCursor = 3,
"help" => HelpCursor = 4,
"progress" => ProgressCursor = 5,
"wait" => WaitCursor = 6,
"cell" => CellCursor = 7,
"crosshair" => CrosshairCursor = 8,
"text" => TextCursor = 9,
"vertical-text" => VerticalTextCursor = 10,
"alias" => AliasCursor = 11,
"copy" => CopyCursor = 12,
"move" => MoveCursor = 13,
"no-drop" => NoDropCursor = 14,
"not-allowed" => NotAllowedCursor = 15,
"grab" => GrabCursor = 16,
"grabbing" => GrabbingCursor = 17,
"e-resize" => EResizeCursor = 18,
"n-resize" => NResizeCursor = 19,
"ne-resize" => NeResizeCursor = 20,
"nw-resize" => NwResizeCursor = 21,
"s-resize" => SResizeCursor = 22,
"se-resize" => SeResizeCursor = 23,
"sw-resize" => SwResizeCursor = 24,
"w-resize" => WResizeCursor = 25,
"ew-resize" => EwResizeCursor = 26,
"ns-resize" => NsResizeCursor = 27,
"nesw-resize" => NeswResizeCursor = 28,
"nwse-resize" => NwseResizeCursor = 29,
"col-resize" => ColResizeCursor = 30,
"row-resize" => RowResizeCursor = 31,
"all-scroll" => AllScrollCursor = 32,
"zoom-in" => ZoomInCursor = 33,
"zoom-out" => ZoomOutCursor = 34,
"none" => None = 0,
"default" => Default = 1,
"pointer" => Pointer = 2,
"context-menu" => ContextMenu = 3,
"help" => Help = 4,
"progress" => Progress = 5,
"wait" => Wait = 6,
"cell" => Cell = 7,
"crosshair" => Crosshair = 8,
"text" => Text = 9,
"vertical-text" => VerticalText = 10,
"alias" => Alias = 11,
"copy" => Copy = 12,
"move" => Move = 13,
"no-drop" => NoDrop = 14,
"not-allowed" => NotAllowed = 15,
"grab" => Grab = 16,
"grabbing" => Grabbing = 17,
"e-resize" => EResize = 18,
"n-resize" => NResize = 19,
"ne-resize" => NeResize = 20,
"nw-resize" => NwResize = 21,
"s-resize" => SResize = 22,
"se-resize" => SeResize = 23,
"sw-resize" => SwResize = 24,
"w-resize" => WResize = 25,
"ew-resize" => EwResize = 26,
"ns-resize" => NsResize = 27,
"nesw-resize" => NeswResize = 28,
"nwse-resize" => NwseResize = 29,
"col-resize" => ColResize = 30,
"row-resize" => RowResize = 31,
"all-scroll" => AllScroll = 32,
"zoom-in" => ZoomIn = 33,
"zoom-out" => ZoomOut = 34,
}
@@ -105,27 +105,27 @@ impl Window {

fn cursor_type_for_cursor(&self, cursor: Cursor) -> cef_cursor_type_t {
match cursor {
Cursor::NoCursor => return cef_cursor_type_t::CT_NONE,
Cursor::ContextMenuCursor => return cef_cursor_type_t::CT_CONTEXTMENU,
Cursor::GrabbingCursor => return cef_cursor_type_t::CT_GRABBING,
Cursor::CrosshairCursor => return cef_cursor_type_t::CT_CROSS,
Cursor::CopyCursor => return cef_cursor_type_t::CT_COPY,
Cursor::AliasCursor => return cef_cursor_type_t::CT_ALIAS,
Cursor::TextCursor => return cef_cursor_type_t::CT_IBEAM,
Cursor::GrabCursor | Cursor::AllScrollCursor =>
Cursor::None => return cef_cursor_type_t::CT_NONE,
Cursor::ContextMenu => return cef_cursor_type_t::CT_CONTEXTMENU,
Cursor::Grabbing => return cef_cursor_type_t::CT_GRABBING,
Cursor::Crosshair => return cef_cursor_type_t::CT_CROSS,
Cursor::Copy => return cef_cursor_type_t::CT_COPY,
Cursor::Alias => return cef_cursor_type_t::CT_ALIAS,
Cursor::Text => return cef_cursor_type_t::CT_IBEAM,
Cursor::Grab | Cursor::AllScroll =>
return cef_cursor_type_t::CT_GRAB,
Cursor::NoDropCursor => return cef_cursor_type_t::CT_NODROP,
Cursor::NotAllowedCursor => return cef_cursor_type_t::CT_NOTALLOWED,
Cursor::PointerCursor => return cef_cursor_type_t::CT_POINTER,
Cursor::SResizeCursor => return cef_cursor_type_t::CT_SOUTHRESIZE,
Cursor::WResizeCursor => return cef_cursor_type_t::CT_WESTRESIZE,
Cursor::EwResizeCursor => return cef_cursor_type_t::CT_EASTWESTRESIZE,
Cursor::ColResizeCursor => return cef_cursor_type_t::CT_COLUMNRESIZE,
Cursor::EResizeCursor => return cef_cursor_type_t::CT_EASTRESIZE,
Cursor::NResizeCursor => return cef_cursor_type_t::CT_NORTHRESIZE,
Cursor::NsResizeCursor => return cef_cursor_type_t::CT_NORTHSOUTHRESIZE,
Cursor::RowResizeCursor => return cef_cursor_type_t::CT_ROWRESIZE,
Cursor::VerticalTextCursor => return cef_cursor_type_t::CT_VERTICALTEXT,
Cursor::NoDrop => return cef_cursor_type_t::CT_NODROP,
Cursor::NotAllowed => return cef_cursor_type_t::CT_NOTALLOWED,
Cursor::Pointer => return cef_cursor_type_t::CT_POINTER,
Cursor::SResize => return cef_cursor_type_t::CT_SOUTHRESIZE,
Cursor::WResize => return cef_cursor_type_t::CT_WESTRESIZE,
Cursor::EwResize => return cef_cursor_type_t::CT_EASTWESTRESIZE,
Cursor::ColResize => return cef_cursor_type_t::CT_COLUMNRESIZE,
Cursor::EResize => return cef_cursor_type_t::CT_EASTRESIZE,
Cursor::NResize => return cef_cursor_type_t::CT_NORTHRESIZE,
Cursor::NsResize => return cef_cursor_type_t::CT_NORTHSOUTHRESIZE,
Cursor::RowResize => return cef_cursor_type_t::CT_ROWRESIZE,
Cursor::VerticalText => return cef_cursor_type_t::CT_VERTICALTEXT,
_ => return cef_cursor_type_t::CT_POINTER,
}
}
@@ -138,27 +138,27 @@ impl Window {

unsafe {
match cursor {
Cursor::NoCursor => return 0 as cef_cursor_handle_t,
Cursor::ContextMenuCursor => msg_send![class("NSCursor"), contextualMenuCursor],
Cursor::GrabbingCursor => msg_send![class("NSCursor"), closedHandCursor],
Cursor::CrosshairCursor => msg_send![class("NSCursor"), crosshairCursor],
Cursor::CopyCursor => msg_send![class("NSCursor"), dragCopyCursor],
Cursor::AliasCursor => msg_send![class("NSCursor"), dragLinkCursor],
Cursor::TextCursor => msg_send![class("NSCursor"), IBeamCursor],
Cursor::GrabCursor | Cursor::AllScrollCursor =>
Cursor::None => return 0 as cef_cursor_handle_t,
Cursor::ContextMenu => msg_send![class("NSCursor"), contextualMenuCursor],
Cursor::Grabbing => msg_send![class("NSCursor"), closedHandCursor],
Cursor::Crosshair => msg_send![class("NSCursor"), crosshairCursor],
Cursor::Copy => msg_send![class("NSCursor"), dragCopyCursor],
Cursor::Alias => msg_send![class("NSCursor"), dragLinkCursor],
Cursor::Text => msg_send![class("NSCursor"), IBeamCursor],
Cursor::Grab | Cursor::AllScroll =>
msg_send![class("NSCursor"), openHandCursor],
Cursor::NoDropCursor | Cursor::NotAllowedCursor =>
Cursor::NoDrop | Cursor::NotAllowed =>
msg_send![class("NSCursor"), operationNotAllowedCursor],
Cursor::PointerCursor => msg_send![class("NSCursor"), pointingHandCursor],
Cursor::SResizeCursor => msg_send![class("NSCursor"), resizeDownCursor],
Cursor::WResizeCursor => msg_send![class("NSCursor"), resizeLeftCursor],
Cursor::EwResizeCursor | Cursor::ColResizeCursor =>
Cursor::Pointer => msg_send![class("NSCursor"), pointingHandCursor],
Cursor::SResize => msg_send![class("NSCursor"), resizeDownCursor],
Cursor::WResize => msg_send![class("NSCursor"), resizeLeftCursor],
Cursor::EwResize | Cursor::ColResize =>
msg_send![class("NSCursor"), resizeLeftRightCursor],
Cursor::EResizeCursor => msg_send![class("NSCursor"), resizeRightCursor],
Cursor::NResizeCursor => msg_send![class("NSCursor"), resizeUpCursor],
Cursor::NsResizeCursor | Cursor::RowResizeCursor =>
Cursor::EResize => msg_send![class("NSCursor"), resizeRightCursor],
Cursor::NResize => msg_send![class("NSCursor"), resizeUpCursor],
Cursor::NsResize | Cursor::RowResize =>
msg_send![class("NSCursor"), resizeUpDownCursor],
Cursor::VerticalTextCursor => msg_send![class("NSCursor"), IBeamCursorForVerticalLayout],
Cursor::VerticalText => msg_send![class("NSCursor"), IBeamCursorForVerticalLayout],
_ => msg_send![class("NSCursor"), arrowCursor],
}
}
Oops, something went wrong.

0 comments on commit 46cadfd

Please sign in to comment.
You can’t perform that action at this time.