mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Fix indentation errors in servo rust code that tidy now finds.
This commit is contained in:
parent
57e74542ee
commit
fc34b9a14d
19 changed files with 127 additions and 127 deletions
|
@ -365,7 +365,7 @@ impl NetworkEventActor {
|
||||||
RawStatus(s, Cow::from(status_text))
|
RawStatus(s, Cow::from(status_text))
|
||||||
});
|
});
|
||||||
self.response.body = response.body.clone();
|
self.response.body = response.body.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event_actor(&self) -> EventActor {
|
pub fn event_actor(&self) -> EventActor {
|
||||||
// TODO: Send the correct values for startedDateTime, isXHR, private
|
// TODO: Send the correct values for startedDateTime, isXHR, private
|
||||||
|
@ -413,7 +413,7 @@ impl NetworkEventActor {
|
||||||
transferredSize: 0,
|
transferredSize: 0,
|
||||||
discardResponseBody: true,
|
discardResponseBody: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn response_cookies(&self) -> ResponseCookiesMsg {
|
pub fn response_cookies(&self) -> ResponseCookiesMsg {
|
||||||
let mut cookies_size = 0;
|
let mut cookies_size = 0;
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl HstsList {
|
||||||
|
|
||||||
fn has_subdomain(&self, host: &str, base_domain: &str) -> bool {
|
fn has_subdomain(&self, host: &str, base_domain: &str) -> bool {
|
||||||
self.entries_map.get(base_domain).map_or(false, |entries| {
|
self.entries_map.get(base_domain).map_or(false, |entries| {
|
||||||
entries.iter().any(|e| e.matches_subdomain(host))
|
entries.iter().any(|e| e.matches_subdomain(host))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -815,7 +815,7 @@ impl ByteMatcher {
|
||||||
mask: b"\xFF\xFF\xDF\xDF\xDF\xDF\xDF\xDF\xDF\xFF\xDF\xDF\xDF\xDF",
|
mask: b"\xFF\xFF\xDF\xDF\xDF\xDF\xDF\xDF\xDF\xFF\xDF\xDF\xDF\xDF",
|
||||||
content_type: (TopLevel::Text, "html"),
|
content_type: (TopLevel::Text, "html"),
|
||||||
leading_ignore: b"\t\n\x0C\r "
|
leading_ignore: b"\t\n\x0C\r "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -728,7 +728,7 @@ impl<T: JSTraceable> RootableVec<T> {
|
||||||
RootableVec {
|
RootableVec {
|
||||||
v: vec![],
|
v: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A vector of items that are rooted for the lifetime 'a.
|
/// A vector of items that are rooted for the lifetime 'a.
|
||||||
|
|
|
@ -353,12 +353,12 @@ pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()>
|
||||||
impl BlobMethods for Blob {
|
impl BlobMethods for Blob {
|
||||||
// https://w3c.github.io/FileAPI/#dfn-size
|
// https://w3c.github.io/FileAPI/#dfn-size
|
||||||
fn Size(&self) -> u64 {
|
fn Size(&self) -> u64 {
|
||||||
match *self.blob_impl.borrow() {
|
match *self.blob_impl.borrow() {
|
||||||
BlobImpl::File(ref f) => f.size,
|
BlobImpl::File(ref f) => f.size,
|
||||||
BlobImpl::Memory(ref v) => v.len() as u64,
|
BlobImpl::Memory(ref v) => v.len() as u64,
|
||||||
BlobImpl::Sliced(ref parent, ref rel_pos) =>
|
BlobImpl::Sliced(ref parent, ref rel_pos) =>
|
||||||
rel_pos.to_abs_range(parent.Size() as usize).len() as u64,
|
rel_pos.to_abs_range(parent.Size() as usize).len() as u64,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/FileAPI/#dfn-type
|
// https://w3c.github.io/FileAPI/#dfn-type
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl DOMMatrixReadOnly {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
matrix: DOMRefCell::new(matrix),
|
matrix: DOMRefCell::new(matrix),
|
||||||
is2D: Cell::new(is2D),
|
is2D: Cell::new(is2D),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||||
|
|
|
@ -2599,7 +2599,7 @@ impl Element {
|
||||||
self.has_attribute(&local_name!("href"))
|
self.has_attribute(&local_name!("href"))
|
||||||
},
|
},
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Please call this method *only* for real click events
|
/// Please call this method *only* for real click events
|
||||||
|
|
|
@ -2383,7 +2383,7 @@ impl NodeMethods for Node {
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
Node::namespace_to_string(Node::locate_namespace(self, prefix))
|
Node::namespace_to_string(Node::locate_namespace(self, prefix))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
|
// https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
|
||||||
fn IsDefaultNamespace(&self, namespace: Option<DOMString>) -> bool {
|
fn IsDefaultNamespace(&self, namespace: Option<DOMString>) -> bool {
|
||||||
|
|
|
@ -457,7 +457,7 @@ impl<'a> Iterator for &'a TreeWalker {
|
||||||
// will probably be using a native Rust filter,
|
// will probably be using a native Rust filter,
|
||||||
// which cannot produce an Err result.
|
// which cannot produce an Err result.
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1795,7 +1795,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
|
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
|
||||||
self.webgl_error(InvalidValue);
|
self.webgl_error(InvalidValue);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match program.get_active_uniform(index) {
|
match program.get_active_uniform(index) {
|
||||||
|
@ -1822,7 +1822,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
|
// WebGl conformance expects error with null programs. Check tests in get-active-test.html
|
||||||
self.webgl_error(InvalidValue);
|
self.webgl_error(InvalidValue);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match program.get_active_attrib(index) {
|
match program.get_active_attrib(index) {
|
||||||
|
|
|
@ -22,28 +22,28 @@ pub struct CSSErrorReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParseErrorReporter for CSSErrorReporter {
|
impl ParseErrorReporter for CSSErrorReporter {
|
||||||
fn report_error(&self,
|
fn report_error(&self,
|
||||||
input: &mut Parser,
|
input: &mut Parser,
|
||||||
position: SourcePosition,
|
position: SourcePosition,
|
||||||
message: &str,
|
message: &str,
|
||||||
url: &ServoUrl,
|
url: &ServoUrl,
|
||||||
line_number_offset: u64) {
|
line_number_offset: u64) {
|
||||||
let location = input.source_location(position);
|
let location = input.source_location(position);
|
||||||
let line_offset = location.line + line_number_offset as usize;
|
let line_offset = location.line + line_number_offset as usize;
|
||||||
if log_enabled!(log::LogLevel::Info) {
|
if log_enabled!(log::LogLevel::Info) {
|
||||||
info!("Url:\t{}\n{}:{} {}",
|
info!("Url:\t{}\n{}:{} {}",
|
||||||
url.as_str(),
|
url.as_str(),
|
||||||
line_offset,
|
line_offset,
|
||||||
location.column,
|
location.column,
|
||||||
message)
|
message)
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: report a real filename
|
//TODO: report a real filename
|
||||||
let _ = self.script_chan.lock().unwrap().send(
|
let _ = self.script_chan.lock().unwrap().send(
|
||||||
ConstellationControlMsg::ReportCSSError(self.pipelineid,
|
ConstellationControlMsg::ReportCSSError(self.pipelineid,
|
||||||
"".to_owned(),
|
"".to_owned(),
|
||||||
location.line,
|
location.line,
|
||||||
location.column,
|
location.column,
|
||||||
message.to_owned()));
|
message.to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ impl<Impl: SelectorImpl> ToCss for SimpleSelector<Impl> {
|
||||||
attr_selector_to_css(a, " = ", v, match case {
|
attr_selector_to_css(a, " = ", v, match case {
|
||||||
CaseSensitivity::CaseSensitive => None,
|
CaseSensitivity::CaseSensitive => None,
|
||||||
CaseSensitivity::CaseInsensitive => Some(" i"),
|
CaseSensitivity::CaseInsensitive => Some(" i"),
|
||||||
}, dest)
|
}, dest)
|
||||||
}
|
}
|
||||||
AttrDashMatch(ref a, ref v) => attr_selector_to_css(a, " |= ", v, None, dest),
|
AttrDashMatch(ref a, ref v) => attr_selector_to_css(a, " |= ", v, None, dest),
|
||||||
AttrIncludesNeverMatch(ref a, ref v) |
|
AttrIncludesNeverMatch(ref a, ref v) |
|
||||||
|
|
|
@ -381,7 +381,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
|
||||||
// [1]: https://drafts.csswg.org/css-transitions/#starting
|
// [1]: https://drafts.csswg.org/css-transitions/#starting
|
||||||
if possibly_expired_animations.iter().any(|animation| {
|
if possibly_expired_animations.iter().any(|animation| {
|
||||||
animation.has_the_same_end_value_as(&property_animation)
|
animation.has_the_same_end_value_as(&property_animation)
|
||||||
}) {
|
}) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,8 @@ impl AttrValue {
|
||||||
pub fn from_comma_separated_tokenlist(tokens: String) -> AttrValue {
|
pub fn from_comma_separated_tokenlist(tokens: String) -> AttrValue {
|
||||||
let atoms = split_commas(&tokens).map(Atom::from)
|
let atoms = split_commas(&tokens).map(Atom::from)
|
||||||
.fold(vec![], |mut acc, atom| {
|
.fold(vec![], |mut acc, atom| {
|
||||||
if !acc.contains(&atom) { acc.push(atom) }
|
if !acc.contains(&atom) { acc.push(atom) }
|
||||||
acc
|
acc
|
||||||
});
|
});
|
||||||
AttrValue::TokenList(tokens, atoms)
|
AttrValue::TokenList(tokens, atoms)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ impl ToCss for CalcLengthOrPercentage {
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(dest, ")")
|
write!(dest, ")")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A percentage value.
|
/// A percentage value.
|
||||||
|
|
|
@ -554,7 +554,7 @@ impl HasViewportPercentage for BorderWidth {
|
||||||
match *self {
|
match *self {
|
||||||
BorderWidth::Thin | BorderWidth::Medium | BorderWidth::Thick => false,
|
BorderWidth::Thin | BorderWidth::Medium | BorderWidth::Thick => false,
|
||||||
BorderWidth::Width(ref length) => length.has_viewport_percentage()
|
BorderWidth::Width(ref length) => length.has_viewport_percentage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
|
||||||
match server::start(SocketAddr::V4(address), handler, &extension_routes()) {
|
match server::start(SocketAddr::V4(address), handler, &extension_routes()) {
|
||||||
Ok(listening) => info!("WebDriver server listening on {}", listening.socket),
|
Ok(listening) => info!("WebDriver server listening on {}", listening.socket),
|
||||||
Err(_) => panic!("Unable to start WebDriver HTTPD server"),
|
Err(_) => panic!("Unable to start WebDriver HTTPD server"),
|
||||||
}
|
}
|
||||||
}).expect("Thread spawning failed");
|
}).expect("Thread spawning failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2023,90 +2023,90 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet
|
||||||
let style = ComputedValues::as_arc(&style);
|
let style = ComputedValues::as_arc(&style);
|
||||||
|
|
||||||
if let Some(ref animation) = data.stylist.animations().get(&name) {
|
if let Some(ref animation) = data.stylist.animations().get(&name) {
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
let guard = global_style_data.shared_lock.read();
|
let guard = global_style_data.shared_lock.read();
|
||||||
for step in &animation.steps {
|
for step in &animation.steps {
|
||||||
// Override timing_function if the keyframe has animation-timing-function.
|
// Override timing_function if the keyframe has animation-timing-function.
|
||||||
let timing_function = if let Some(val) = step.get_animation_timing_function(&guard) {
|
let timing_function = if let Some(val) = step.get_animation_timing_function(&guard) {
|
||||||
val.into()
|
val.into()
|
||||||
} else {
|
} else {
|
||||||
*timing_function
|
*timing_function
|
||||||
};
|
};
|
||||||
|
|
||||||
let keyframe = unsafe {
|
let keyframe = unsafe {
|
||||||
Gecko_AnimationAppendKeyframe(keyframes,
|
Gecko_AnimationAppendKeyframe(keyframes,
|
||||||
step.start_percentage.0 as f32,
|
step.start_percentage.0 as f32,
|
||||||
&timing_function)
|
&timing_function)
|
||||||
};
|
};
|
||||||
|
|
||||||
fn add_computed_property_value(keyframe: *mut Keyframe,
|
fn add_computed_property_value(keyframe: *mut Keyframe,
|
||||||
index: usize,
|
index: usize,
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
property: &TransitionProperty,
|
property: &TransitionProperty,
|
||||||
shared_lock: &SharedRwLock) {
|
shared_lock: &SharedRwLock) {
|
||||||
let block = style.to_declaration_block(property.clone().into());
|
let block = style.to_declaration_block(property.clone().into());
|
||||||
unsafe {
|
unsafe {
|
||||||
(*keyframe).mPropertyValues.set_len((index + 1) as u32);
|
(*keyframe).mPropertyValues.set_len((index + 1) as u32);
|
||||||
(*keyframe).mPropertyValues[index].mProperty = property.clone().into();
|
(*keyframe).mPropertyValues[index].mProperty = property.clone().into();
|
||||||
// FIXME. Do not set computed values once we handles missing keyframes
|
// FIXME. Do not set computed values once we handles missing keyframes
|
||||||
// with additive composition.
|
// with additive composition.
|
||||||
(*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
|
(*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
|
||||||
Arc::new(shared_lock.wrap(block)));
|
Arc::new(shared_lock.wrap(block)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match step.value {
|
match step.value {
|
||||||
KeyframesStepValue::ComputedValues => {
|
KeyframesStepValue::ComputedValues => {
|
||||||
for (index, property) in animation.properties_changed.iter().enumerate() {
|
for (index, property) in animation.properties_changed.iter().enumerate() {
|
||||||
add_computed_property_value(
|
add_computed_property_value(
|
||||||
keyframe, index, style, property, &global_style_data.shared_lock);
|
keyframe, index, style, property, &global_style_data.shared_lock);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
KeyframesStepValue::Declarations { ref block } => {
|
KeyframesStepValue::Declarations { ref block } => {
|
||||||
let guard = block.read_with(&guard);
|
let guard = block.read_with(&guard);
|
||||||
// Filter out non-animatable properties.
|
// Filter out non-animatable properties.
|
||||||
let animatable =
|
let animatable =
|
||||||
guard.declarations()
|
guard.declarations()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&&(ref declaration, _)| {
|
.filter(|&&(ref declaration, _)| {
|
||||||
declaration.is_animatable()
|
declaration.is_animatable()
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut seen = LonghandIdSet::new();
|
let mut seen = LonghandIdSet::new();
|
||||||
|
|
||||||
for (index, &(ref declaration, _)) in animatable.enumerate() {
|
for (index, &(ref declaration, _)) in animatable.enumerate() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let property = TransitionProperty::from_declaration(declaration).unwrap();
|
let property = TransitionProperty::from_declaration(declaration).unwrap();
|
||||||
(*keyframe).mPropertyValues.set_len((index + 1) as u32);
|
(*keyframe).mPropertyValues.set_len((index + 1) as u32);
|
||||||
(*keyframe).mPropertyValues[index].mProperty = property.into();
|
(*keyframe).mPropertyValues[index].mProperty = property.into();
|
||||||
(*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
|
(*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
|
||||||
Arc::new(global_style_data.shared_lock.wrap(
|
Arc::new(global_style_data.shared_lock.wrap(
|
||||||
PropertyDeclarationBlock::with_one(
|
PropertyDeclarationBlock::with_one(
|
||||||
declaration.clone(), Importance::Normal
|
declaration.clone(), Importance::Normal
|
||||||
))));
|
))));
|
||||||
if step.start_percentage.0 == 0. ||
|
if step.start_percentage.0 == 0. ||
|
||||||
step.start_percentage.0 == 1. {
|
step.start_percentage.0 == 1. {
|
||||||
seen.set_transition_property_bit(&property);
|
seen.set_transition_property_bit(&property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append missing property values in the initial or the finial keyframes.
|
// Append missing property values in the initial or the finial keyframes.
|
||||||
if step.start_percentage.0 == 0. ||
|
if step.start_percentage.0 == 0. ||
|
||||||
step.start_percentage.0 == 1. {
|
step.start_percentage.0 == 1. {
|
||||||
let mut index = unsafe { (*keyframe).mPropertyValues.len() };
|
let mut index = unsafe { (*keyframe).mPropertyValues.len() };
|
||||||
for property in animation.properties_changed.iter() {
|
for property in animation.properties_changed.iter() {
|
||||||
if !seen.has_transition_property_bit(&property) {
|
if !seen.has_transition_property_bit(&property) {
|
||||||
add_computed_property_value(
|
add_computed_property_value(
|
||||||
keyframe, index, style, property, &global_style_data.shared_lock);
|
keyframe, index, style, property, &global_style_data.shared_lock);
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,12 +283,12 @@ fn test_mq_expressions() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_to_css() {
|
fn test_to_css() {
|
||||||
test_media_rule("@media print and (width: 43px) { }", |list, _| {
|
test_media_rule("@media print and (width: 43px) { }", |list, _| {
|
||||||
let q = &list.media_queries[0];
|
let q = &list.media_queries[0];
|
||||||
let mut dest = String::new();
|
let mut dest = String::new();
|
||||||
assert_eq!(Ok(()), q.to_css(&mut dest));
|
assert_eq!(Ok(()), q.to_css(&mut dest));
|
||||||
assert_eq!(dest, "print and (width: 43px)");
|
assert_eq!(dest, "print and (width: 43px)");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue