mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
make test-tidy check that = have space after them
This commit is contained in:
parent
ccb8e46557
commit
17663315dd
23 changed files with 127 additions and 111 deletions
|
@ -39,9 +39,9 @@ extern crate clipboard;
|
|||
extern crate time;
|
||||
extern crate url;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate core_graphics;
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate core_text;
|
||||
|
||||
pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask};
|
||||
|
|
|
@ -101,13 +101,13 @@ pub struct Font {
|
|||
|
||||
bitflags! {
|
||||
flags ShapingFlags: u8 {
|
||||
#[doc="Set if the text is entirely whitespace."]
|
||||
#[doc = "Set if the text is entirely whitespace."]
|
||||
const IS_WHITESPACE_SHAPING_FLAG = 0x01,
|
||||
#[doc="Set if we are to ignore ligatures."]
|
||||
#[doc = "Set if we are to ignore ligatures."]
|
||||
const IGNORE_LIGATURES_SHAPING_FLAG = 0x02,
|
||||
#[doc="Set if we are to disable kerning."]
|
||||
#[doc = "Set if we are to disable kerning."]
|
||||
const DISABLE_KERNING_SHAPING_FLAG = 0x04,
|
||||
#[doc="Text direction is right-to-left."]
|
||||
#[doc = "Text direction is right-to-left."]
|
||||
const RTL_FLAG = 0x08,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,16 +31,16 @@ use std::sync::Arc;
|
|||
use azure::azure_hl::BackendType;
|
||||
use azure::scaled_font::ScaledFont;
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use azure::scaled_font::FontInfo;
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
|
||||
ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes),
|
||||
pt_size.to_f32_px())
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
|
||||
let cgfont = template.ctfont().as_ref().unwrap().copy_to_CGFont();
|
||||
ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_f32_px())
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(arc_weak)]
|
||||
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(box_raw))]
|
||||
#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(box_raw))]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(hashmap_hasher)]
|
||||
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(heap_api))]
|
||||
#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(plugin)]
|
||||
#![feature(str_char)]
|
||||
|
@ -55,23 +55,23 @@ extern crate canvas_traits;
|
|||
extern crate harfbuzz;
|
||||
|
||||
// Linux and Android-specific library dependencies
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
extern crate fontconfig;
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
extern crate freetype;
|
||||
|
||||
// Mac OS-specific library dependencies
|
||||
#[cfg(target_os="macos")] extern crate core_foundation;
|
||||
#[cfg(target_os="macos")] extern crate core_graphics;
|
||||
#[cfg(target_os="macos")] extern crate core_text;
|
||||
#[cfg(target_os = "macos")] extern crate core_foundation;
|
||||
#[cfg(target_os = "macos")] extern crate core_graphics;
|
||||
#[cfg(target_os = "macos")] extern crate core_text;
|
||||
|
||||
pub use paint_context::PaintContext;
|
||||
|
||||
// Private painting modules
|
||||
mod paint_context;
|
||||
|
||||
#[path="display_list/mod.rs"]
|
||||
#[path = "display_list/mod.rs"]
|
||||
pub mod display_list;
|
||||
pub mod paint_task;
|
||||
|
||||
|
@ -85,7 +85,7 @@ pub mod font_template;
|
|||
mod filters;
|
||||
|
||||
// Platform-specific implementations.
|
||||
#[path="platform/mod.rs"]
|
||||
#[path = "platform/mod.rs"]
|
||||
pub mod platform;
|
||||
|
||||
// Text
|
||||
|
|
|
@ -139,7 +139,7 @@ pub fn get_system_default_family(generic_name: &str) -> Option<String> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn get_last_resort_font_families() -> Vec<String> {
|
||||
vec!(
|
||||
"Fira Sans".to_owned(),
|
||||
|
@ -148,7 +148,7 @@ pub fn get_last_resort_font_families() -> Vec<String> {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn get_last_resort_font_families() -> Vec<String> {
|
||||
vec!("Roboto".to_owned())
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
* 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/. */
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub use platform::freetype::{font, font_context, font_list, font_template};
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use platform::macos::{font, font_context, font_list, font_template};
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub mod freetype {
|
||||
pub mod font;
|
||||
pub mod font_context;
|
||||
|
@ -16,7 +16,7 @@ pub mod freetype {
|
|||
pub mod font_template;
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod macos {
|
||||
pub mod font;
|
||||
pub mod font_context;
|
||||
|
|
|
@ -561,7 +561,7 @@ pub struct BlockFlow {
|
|||
|
||||
bitflags! {
|
||||
flags BlockFlowFlags: u8 {
|
||||
#[doc="If this is set, then this block flow is the root flow."]
|
||||
#[doc = "If this is set, then this block flow is the root flow."]
|
||||
const IS_ROOT = 0x01,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ impl PrivateLayoutData {
|
|||
|
||||
bitflags! {
|
||||
flags LayoutDataFlags: u8 {
|
||||
#[doc="Whether a flow has been newly constructed."]
|
||||
#[doc = "Whether a flow has been newly constructed."]
|
||||
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2300,9 +2300,9 @@ bitflags! {
|
|||
// Various flags we can use when splitting fragments. See
|
||||
// `calculate_split_position_using_breaking_strategy()`.
|
||||
flags SplitOptions: u8 {
|
||||
#[doc="True if this is the first fragment on the line."]
|
||||
#[doc = "True if this is the first fragment on the line."]
|
||||
const STARTS_LINE = 0x01,
|
||||
#[doc="True if we should attempt to split at character boundaries if this split fails. \
|
||||
#[doc = "True if we should attempt to split at character boundaries if this split fails. \
|
||||
This is used to implement `overflow-wrap: break-word`."]
|
||||
const RETRY_AT_CHARACTER_BOUNDARIES = 0x02,
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ bitflags! {
|
|||
|
||||
bitflags! {
|
||||
flags SpecialRestyleDamage: u8 {
|
||||
#[doc="If this flag is set, we need to reflow the entire document. This is more or less a \
|
||||
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \
|
||||
temporary hack to deal with cases that we don't handle incrementally yet."]
|
||||
const REFLOW_ENTIRE_DOCUMENT = 0x01,
|
||||
}
|
||||
|
|
|
@ -183,9 +183,9 @@ int_range_index! {
|
|||
|
||||
bitflags! {
|
||||
flags InlineReflowFlags: u8 {
|
||||
#[doc="The `white-space: nowrap` property from CSS 2.1 § 16.6 is in effect."]
|
||||
#[doc = "The `white-space: nowrap` property from CSS 2.1 § 16.6 is in effect."]
|
||||
const NO_WRAP_INLINE_REFLOW_FLAG = 0x01,
|
||||
#[doc="The `white-space: pre` property from CSS 2.1 § 16.6 is in effect."]
|
||||
#[doc = "The `white-space: pre` property from CSS 2.1 § 16.6 is in effect."]
|
||||
const WRAP_ON_NEWLINE_INLINE_REFLOW_FLAG = 0x02
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ extern crate util;
|
|||
extern crate url;
|
||||
extern crate style;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate core_foundation;
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate io_surface;
|
||||
|
||||
pub mod compositor_msg;
|
||||
|
|
|
@ -13,9 +13,9 @@ extern crate ipc_channel;
|
|||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate profile_traits;
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
extern crate regex;
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate task_info;
|
||||
extern crate time as std_time;
|
||||
extern crate util;
|
||||
|
|
|
@ -368,7 +368,7 @@ mod system_reporter {
|
|||
use std::mem::size_of;
|
||||
use std::ptr::null_mut;
|
||||
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
use task_info::task_basic_info::{virtual_size, resident_size};
|
||||
|
||||
/// Collects global measurements from the OS and heap allocators.
|
||||
|
@ -418,12 +418,12 @@ mod system_reporter {
|
|||
request.reports_channel.send(reports);
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
extern {
|
||||
fn mallinfo() -> struct_mallinfo;
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[repr(C)]
|
||||
pub struct struct_mallinfo {
|
||||
arena: c_int,
|
||||
|
@ -438,7 +438,7 @@ mod system_reporter {
|
|||
keepcost: c_int,
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_system_heap_allocated() -> Option<usize> {
|
||||
let info: struct_mallinfo = unsafe { mallinfo() };
|
||||
|
||||
|
@ -457,7 +457,7 @@ mod system_reporter {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="linux"))]
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn get_system_heap_allocated() -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
@ -507,14 +507,14 @@ mod system_reporter {
|
|||
($e:expr) => (match $e { Some(e) => e, None => return None })
|
||||
);
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn page_size() -> usize {
|
||||
unsafe {
|
||||
::libc::sysconf(::libc::_SC_PAGESIZE) as usize
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_proc_self_statm_field(field: usize) -> Option<usize> {
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
@ -527,37 +527,37 @@ mod system_reporter {
|
|||
Some(npages * page_size())
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_vsize() -> Option<usize> {
|
||||
get_proc_self_statm_field(0)
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_resident() -> Option<usize> {
|
||||
get_proc_self_statm_field(1)
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn get_vsize() -> Option<usize> {
|
||||
virtual_size()
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn get_resident() -> Option<usize> {
|
||||
resident_size()
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os="linux", target_os = "macos")))]
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn get_vsize() -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os="linux", target_os = "macos")))]
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn get_resident() -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_resident_segments() -> Vec<(String, usize)> {
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
|
@ -658,7 +658,7 @@ mod system_reporter {
|
|||
segs
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="linux"))]
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn get_resident_segments() -> Vec<(String, usize)> {
|
||||
vec![]
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use num::Float;
|
|||
use std::ops::Deref;
|
||||
|
||||
/// Encapsulates the IDL restricted float type.
|
||||
#[derive(JSTraceable,Clone,Eq,PartialEq)]
|
||||
#[derive(JSTraceable, Clone, Eq, PartialEq)]
|
||||
pub struct Finite<T: Float>(T);
|
||||
|
||||
unsafe impl<T: Float> Zeroable for Finite<T> {}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
#![doc="The script crate contains all matters DOM."]
|
||||
#![doc = "The script crate contains all matters DOM."]
|
||||
|
||||
#![plugin(string_cache_plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
@ -103,7 +103,7 @@ mod webdriver_handlers;
|
|||
|
||||
use dom::bindings::codegen::RegisterBindings;
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(unsafe_code)]
|
||||
fn perform_platform_specific_initialization() {
|
||||
use std::mem;
|
||||
|
@ -119,7 +119,7 @@ fn perform_platform_specific_initialization() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="linux"))]
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn perform_platform_specific_initialization() {}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
@ -78,12 +78,12 @@ pub enum Direction {
|
|||
|
||||
/// Was the keyboard event accompanied by the standard control modifier,
|
||||
/// i.e. cmd on Mac OS or ctrl on other platforms.
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn is_control_key(mods: KeyModifiers) -> bool {
|
||||
mods.contains(SUPER) && !mods.contains(CONTROL | ALT)
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="macos"))]
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn is_control_key(mods: KeyModifiers) -> bool {
|
||||
mods.contains(CONTROL) && !mods.contains(SUPER | ALT)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ extern crate glutin_app as app;
|
|||
extern crate time;
|
||||
extern crate env_logger;
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
#[macro_use]
|
||||
extern crate android_glue;
|
||||
|
||||
|
@ -41,7 +41,7 @@ use servo::Browser;
|
|||
use std::rc::Rc;
|
||||
use util::opts;
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
fn main() {
|
||||
|
@ -134,16 +134,16 @@ impl app::NestedEventLoopListener for BrowserWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
fn setup_logging() {
|
||||
android::setup_logging();
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="android"))]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn setup_logging() {
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
fn get_args() -> Vec<String> {
|
||||
vec![
|
||||
"servo".to_owned(),
|
||||
|
@ -151,7 +151,7 @@ fn get_args() -> Vec<String> {
|
|||
]
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="android"))]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn get_args() -> Vec<String> {
|
||||
use std::env;
|
||||
env::args().collect()
|
||||
|
|
|
@ -335,10 +335,10 @@ fn args_fail(msg: &str) -> ! {
|
|||
|
||||
// Always use CPU painting on android.
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
static FORCE_CPU_PAINTING: bool = true;
|
||||
|
||||
#[cfg(not(target_os="android"))]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
static FORCE_CPU_PAINTING: bool = false;
|
||||
|
||||
enum UserAgent {
|
||||
|
@ -361,15 +361,15 @@ fn default_user_agent_string(agent: UserAgent) -> String {
|
|||
}.to_owned()
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
const DEFAULT_USER_AGENT: UserAgent = UserAgent::Android;
|
||||
|
||||
// FIXME: This requires https://github.com/servo/servo/issues/7138 to provide the
|
||||
// correct string in Gonk builds (i.e., it will never be chosen today).
|
||||
#[cfg(target_os="gonk")]
|
||||
#[cfg(target_os = "gonk")]
|
||||
const DEFAULT_USER_AGENT: UserAgent = UserAgent::Gonk;
|
||||
|
||||
#[cfg(not(any(target_os="android", target_os="gonk")))]
|
||||
#[cfg(not(any(target_os = "android", target_os = "gonk")))]
|
||||
const DEFAULT_USER_AGENT: UserAgent = UserAgent::Desktop;
|
||||
|
||||
pub fn default_opts() -> Opts {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#![feature(box_syntax, result_expect)]
|
||||
|
||||
#[macro_use] extern crate bitflags;
|
||||
#[cfg(target_os="macos")] extern crate cgl;
|
||||
#[cfg(target_os = "macos")] extern crate cgl;
|
||||
extern crate compositing;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
|
@ -19,9 +19,9 @@ extern crate net_traits;
|
|||
#[cfg(feature = "window")] extern crate script_traits;
|
||||
extern crate time;
|
||||
extern crate util;
|
||||
#[cfg(target_os="android")] extern crate egl;
|
||||
#[cfg(target_os = "android")] extern crate egl;
|
||||
extern crate url;
|
||||
#[cfg(target_os="linux")] extern crate x11;
|
||||
#[cfg(target_os = "linux")] extern crate x11;
|
||||
|
||||
use compositing::windowing::WindowEvent;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
|
|
|
@ -35,7 +35,7 @@ use std::cell::{Cell, RefCell};
|
|||
#[cfg(feature = "window")]
|
||||
use util::opts;
|
||||
|
||||
#[cfg(all(feature = "headless", target_os="linux"))]
|
||||
#[cfg(all(feature = "headless", target_os = "linux"))]
|
||||
use std::ptr;
|
||||
|
||||
#[cfg(feature = "window")]
|
||||
|
@ -56,15 +56,15 @@ bitflags! {
|
|||
}
|
||||
|
||||
// Some shortcuts use Cmd on Mac and Control on other systems.
|
||||
#[cfg(all(feature = "window", target_os="macos"))]
|
||||
#[cfg(all(feature = "window", target_os = "macos"))]
|
||||
const CMD_OR_CONTROL: constellation_msg::KeyModifiers = SUPER;
|
||||
#[cfg(all(feature = "window", not(target_os="macos")))]
|
||||
#[cfg(all(feature = "window", not(target_os = "macos")))]
|
||||
const CMD_OR_CONTROL: constellation_msg::KeyModifiers = CONTROL;
|
||||
|
||||
// Some shortcuts use Cmd on Mac and Alt on other systems.
|
||||
#[cfg(all(feature = "window", target_os="macos"))]
|
||||
#[cfg(all(feature = "window", target_os = "macos"))]
|
||||
const CMD_OR_ALT: constellation_msg::KeyModifiers = SUPER;
|
||||
#[cfg(all(feature = "window", not(target_os="macos")))]
|
||||
#[cfg(all(feature = "window", not(target_os = "macos")))]
|
||||
const CMD_OR_ALT: constellation_msg::KeyModifiers = ALT;
|
||||
|
||||
// This should vary by zoom level and maybe actual text size (focused or under cursor)
|
||||
|
@ -138,22 +138,22 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="android"))]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn gl_version() -> GlRequest {
|
||||
GlRequest::Specific(Api::OpenGl, (3, 0))
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
fn gl_version() -> GlRequest {
|
||||
GlRequest::Specific(Api::OpenGlEs, (2, 0))
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="android"))]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn load_gl_functions(window: &glutin::Window) {
|
||||
gl::load_with(|s| window.get_proc_address(s));
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(target_os = "android")]
|
||||
fn load_gl_functions(_: &glutin::Window) {
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ impl Window {
|
|||
self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(event));
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn handle_next_event(&self) -> bool {
|
||||
let event = self.window.wait_events().next().unwrap();
|
||||
let mut close = self.handle_window_event(event);
|
||||
|
@ -305,7 +305,7 @@ impl Window {
|
|||
close
|
||||
}
|
||||
|
||||
#[cfg(any(target_os="linux", target_os="android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn handle_next_event(&self) -> bool {
|
||||
use std::thread::sleep_ms;
|
||||
|
||||
|
@ -478,7 +478,7 @@ impl Window {
|
|||
result
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "window", not(target_os="win")))]
|
||||
#[cfg(all(feature = "window", not(target_os = "win")))]
|
||||
fn platform_handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
||||
match (mods, key) {
|
||||
(CMD_OR_CONTROL, Key::LeftBracket) => {
|
||||
|
@ -491,19 +491,19 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "window", target_os="win"))]
|
||||
#[cfg(all(feature = "window", target_os = "win"))]
|
||||
fn platform_handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
||||
}
|
||||
}
|
||||
|
||||
// WindowProxy is not implemented for android yet
|
||||
|
||||
#[cfg(all(feature = "window", target_os="android"))]
|
||||
#[cfg(all(feature = "window", target_os = "android"))]
|
||||
fn create_window_proxy(_: &Rc<Window>) -> Option<glutin::WindowProxy> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "window", not(target_os="android")))]
|
||||
#[cfg(all(feature = "window", not(target_os = "android")))]
|
||||
fn create_window_proxy(window: &Rc<Window>) -> Option<glutin::WindowProxy> {
|
||||
Some(window.window.create_window_proxy())
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ impl WindowMethods for Window {
|
|||
true
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
use x11::xlib;
|
||||
unsafe {
|
||||
|
@ -631,7 +631,7 @@ impl WindowMethods for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="linux"))]
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new()
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ impl WindowMethods for Window {
|
|||
true
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new(ptr::null_mut())
|
||||
}
|
||||
|
|
|
@ -188,33 +188,35 @@ def check_rust(file_name, contents):
|
|||
line = merged_lines + line
|
||||
merged_lines = ''
|
||||
|
||||
# get rid of strings and chars because cases like regex expression
|
||||
# get rid of strings and chars because cases like regex expression, keep attributes
|
||||
if not line_is_attribute(line):
|
||||
line = re.sub('".*?"|\'.*?\'', '', line)
|
||||
|
||||
# get rid of comments and attributes
|
||||
line = re.sub('//.*?$|/\*.*?$|^\*.*?$|^#.*?$', '', line)
|
||||
# get rid of comments
|
||||
line = re.sub('//.*?$|/\*.*?$|^\*.*?$', '', line)
|
||||
|
||||
# get rid of attributes that do not contain =
|
||||
line = re.sub('^#[A-Za-z0-9\(\)\[\]_]*?$', '', line)
|
||||
|
||||
match = re.search(r",[A-Za-z0-9]", line)
|
||||
if match:
|
||||
yield (idx + 1, "missing space after ,")
|
||||
|
||||
# Avoid flagging <Item=Foo> constructs
|
||||
def is_associated_type(match, line, index):
|
||||
open_angle = line[0:match.end()].rfind('<')
|
||||
close_angle = line[open_angle:].find('>') if open_angle != -1 else -1
|
||||
is_equals = match.group(0)[index] == '='
|
||||
generic_open = open_angle != -1 and open_angle < match.start()
|
||||
generic_close = close_angle != -1 and close_angle + open_angle >= match.end()
|
||||
return is_equals and generic_open and generic_close
|
||||
|
||||
if line_is_attribute(line):
|
||||
pre_space_re = r"[A-Za-z0-9]="
|
||||
post_space_re = r"=[A-Za-z0-9\"]"
|
||||
else:
|
||||
# - not included because of scientific notation (1e-6)
|
||||
match = re.search(r"[A-Za-z0-9][\+/\*%=]", line)
|
||||
pre_space_re = r"[A-Za-z0-9][\+/\*%=]"
|
||||
# * not included because of dereferencing and casting
|
||||
# - not included because of unary negation
|
||||
post_space_re = r"[\+/\%=][A-Za-z0-9\"]"
|
||||
|
||||
match = re.search(pre_space_re, line)
|
||||
if match and not is_associated_type(match, line, 1):
|
||||
yield (idx + 1, "missing space before %s" % match.group(0)[1])
|
||||
|
||||
# * not included because of dereferencing and casting
|
||||
# - not included because of unary negation
|
||||
match = re.search(r"[\+/\%=][A-Za-z0-9]", line)
|
||||
match = re.search(post_space_re, line)
|
||||
if match and not is_associated_type(match, line, 0):
|
||||
yield (idx + 1, "missing space after %s" % match.group(0)[0])
|
||||
|
||||
|
@ -260,6 +262,20 @@ def check_rust(file_name, contents):
|
|||
uses = []
|
||||
|
||||
|
||||
# Avoid flagging <Item=Foo> constructs
|
||||
def is_associated_type(match, line, index):
|
||||
open_angle = line[0:match.end()].rfind('<')
|
||||
close_angle = line[open_angle:].find('>') if open_angle != -1 else -1
|
||||
is_equals = match.group(0)[index] == '='
|
||||
generic_open = open_angle != -1 and open_angle < match.start()
|
||||
generic_close = close_angle != -1 and close_angle + open_angle >= match.end()
|
||||
return is_equals and generic_open and generic_close
|
||||
|
||||
|
||||
def line_is_attribute(line):
|
||||
return re.search(r"#\[.*\]", line)
|
||||
|
||||
|
||||
def check_webidl_spec(file_name, contents):
|
||||
# Sorted by this function (in pseudo-Rust). The idea is to group the same
|
||||
# organization together.
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
use msg::constellation_msg::SUPER;
|
||||
#[cfg(not(target_os="macos"))]
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
use msg::constellation_msg::CONTROL;
|
||||
|
||||
use script::clipboard_provider::DummyClipboardContext;
|
||||
|
@ -194,9 +194,9 @@ fn test_textinput_set_content() {
|
|||
|
||||
#[test]
|
||||
fn test_clipboard_paste() {
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os = "macos")]
|
||||
const MODIFIERS: KeyModifiers = SUPER;
|
||||
#[cfg(not(target_os="macos"))]
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
const MODIFIERS: KeyModifiers = CONTROL;
|
||||
|
||||
let mut textinput = TextInput::new(Lines::Single, "defg".to_owned(), DummyClipboardContext::new("abc"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue