mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
clippy: Fix several warnings (#31710)
Signed-off-by: RustAndMetal <111676747+RustAndMetal@users.noreply.github.com>
This commit is contained in:
parent
1ab8fa2895
commit
f6a975fc58
23 changed files with 75 additions and 86 deletions
|
@ -227,7 +227,7 @@ impl<'a> TextRun {
|
||||||
|
|
||||||
let mut push_range = |range: &std::ops::Range<usize>, options: &ShapingOptions| {
|
let mut push_range = |range: &std::ops::Range<usize>, options: &ShapingOptions| {
|
||||||
glyphs.push(GlyphRun {
|
glyphs.push(GlyphRun {
|
||||||
glyph_store: font.shape_text(&text[range.clone()], &options),
|
glyph_store: font.shape_text(&text[range.clone()], options),
|
||||||
range: Range::new(
|
range: Range::new(
|
||||||
ByteIndex(range.start as isize),
|
ByteIndex(range.start as isize),
|
||||||
ByteIndex(range.len() as isize),
|
ByteIndex(range.len() as isize),
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ impl<'a> FlexItem<'a> {
|
||||||
box_size,
|
box_size,
|
||||||
&pbm,
|
&pbm,
|
||||||
);
|
);
|
||||||
let cross_size = flex_context.vec2_to_flex_relative(size.clone()).cross;
|
let cross_size = flex_context.vec2_to_flex_relative(size).cross;
|
||||||
let fragments = replaced.contents.make_fragments(&replaced.style, size);
|
let fragments = replaced.contents.make_fragments(&replaced.style, size);
|
||||||
FlexItemLayoutResult {
|
FlexItemLayoutResult {
|
||||||
hypothetical_cross_size: cross_size.into(),
|
hypothetical_cross_size: cross_size.into(),
|
||||||
|
|
|
@ -975,7 +975,7 @@ impl FloatBox {
|
||||||
.into();
|
.into();
|
||||||
children = replaced
|
children = replaced
|
||||||
.contents
|
.contents
|
||||||
.make_fragments(&replaced.style, content_size.clone().into());
|
.make_fragments(&replaced.style, content_size.into());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1122,7 +1122,6 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
|
||||||
.placement_among_floats
|
.placement_among_floats
|
||||||
.get_or_init(|| self.place_line_among_floats(potential_line_size))
|
.get_or_init(|| self.place_line_among_floats(potential_line_size))
|
||||||
.size
|
.size
|
||||||
.clone()
|
|
||||||
} else {
|
} else {
|
||||||
LogicalVec2 {
|
LogicalVec2 {
|
||||||
inline: self.containing_block.inline_size.into(),
|
inline: self.containing_block.inline_size.into(),
|
||||||
|
@ -1991,9 +1990,7 @@ impl IndependentFormattingContext {
|
||||||
None,
|
None,
|
||||||
&pbm,
|
&pbm,
|
||||||
);
|
);
|
||||||
let fragments = replaced
|
let fragments = replaced.contents.make_fragments(&replaced.style, size);
|
||||||
.contents
|
|
||||||
.make_fragments(&replaced.style, size.clone());
|
|
||||||
let content_rect = LogicalRect {
|
let content_rect = LogicalRect {
|
||||||
start_corner: pbm_sums.start_offset(),
|
start_corner: pbm_sums.start_offset(),
|
||||||
size,
|
size,
|
||||||
|
|
|
@ -989,7 +989,7 @@ impl NonReplacedFormattingContext {
|
||||||
&collapsed_margin_block_start,
|
&collapsed_margin_block_start,
|
||||||
containing_block,
|
containing_block,
|
||||||
&pbm,
|
&pbm,
|
||||||
&content_size + &pbm.padding_border_sums.clone().into(),
|
&content_size + &pbm.padding_border_sums.into(),
|
||||||
&self.style,
|
&self.style,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1179,7 +1179,7 @@ fn layout_in_flow_replaced_block_level(
|
||||||
let margin_inline_end;
|
let margin_inline_end;
|
||||||
let effective_margin_inline_start;
|
let effective_margin_inline_start;
|
||||||
let (margin_block_start, margin_block_end) = solve_block_margins_for_in_flow_block_level(&pbm);
|
let (margin_block_start, margin_block_end) = solve_block_margins_for_in_flow_block_level(&pbm);
|
||||||
let fragments = replaced.make_fragments(style, content_size.clone());
|
let fragments = replaced.make_fragments(style, content_size);
|
||||||
|
|
||||||
let clearance;
|
let clearance;
|
||||||
if let Some(ref mut sequential_layout_state) = sequential_layout_state {
|
if let Some(ref mut sequential_layout_state) = sequential_layout_state {
|
||||||
|
@ -1204,7 +1204,7 @@ fn layout_in_flow_replaced_block_level(
|
||||||
&collapsed_margin_block_start,
|
&collapsed_margin_block_start,
|
||||||
containing_block,
|
containing_block,
|
||||||
&pbm,
|
&pbm,
|
||||||
size.clone().into(),
|
size.into(),
|
||||||
style,
|
style,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1498,7 +1498,7 @@ fn solve_clearance_and_inline_margins_avoiding_floats(
|
||||||
style.get_box().clear,
|
style.get_box().clear,
|
||||||
block_start_margin,
|
block_start_margin,
|
||||||
pbm,
|
pbm,
|
||||||
size.clone().into(),
|
size.into(),
|
||||||
);
|
);
|
||||||
let (inline_margins, effective_margin_inline_start) = solve_inline_margins_avoiding_floats(
|
let (inline_margins, effective_margin_inline_start) = solve_inline_margins_avoiding_floats(
|
||||||
sequential_layout_state,
|
sequential_layout_state,
|
||||||
|
|
|
@ -250,13 +250,13 @@ impl PositioningContext {
|
||||||
new_fragment: &mut BoxFragment,
|
new_fragment: &mut BoxFragment,
|
||||||
) {
|
) {
|
||||||
let padding_rect = LogicalRect {
|
let padding_rect = LogicalRect {
|
||||||
size: new_fragment.content_rect.size.clone(),
|
size: new_fragment.content_rect.size,
|
||||||
// Ignore the content rect’s position in its own containing block:
|
// Ignore the content rect’s position in its own containing block:
|
||||||
start_corner: LogicalVec2::zero(),
|
start_corner: LogicalVec2::zero(),
|
||||||
}
|
}
|
||||||
.inflate(&new_fragment.padding);
|
.inflate(&new_fragment.padding);
|
||||||
let containing_block = DefiniteContainingBlock {
|
let containing_block = DefiniteContainingBlock {
|
||||||
size: padding_rect.size.clone().into(),
|
size: padding_rect.size.into(),
|
||||||
style: &new_fragment.style,
|
style: &new_fragment.style,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -539,9 +539,7 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
||||||
let style = &replaced.style;
|
let style = &replaced.style;
|
||||||
content_size = computed_size.auto_is(|| unreachable!()).into();
|
content_size = computed_size.auto_is(|| unreachable!()).into();
|
||||||
fragments = replaced
|
fragments = replaced.contents.make_fragments(style, content_size);
|
||||||
.contents
|
|
||||||
.make_fragments(style, content_size.clone());
|
|
||||||
},
|
},
|
||||||
IndependentFormattingContext::NonReplaced(non_replaced) => {
|
IndependentFormattingContext::NonReplaced(non_replaced) => {
|
||||||
// https://drafts.csswg.org/css2/#min-max-widths
|
// https://drafts.csswg.org/css2/#min-max-widths
|
||||||
|
|
|
@ -1478,7 +1478,7 @@ impl<'a> TableLayout<'a> {
|
||||||
baselines.last = Some(row_end);
|
baselines.last = Some(row_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
let column_indices = 0..self.table.size.width.clone();
|
let column_indices = 0..self.table.size.width;
|
||||||
row_fragment_layout.fragments.reserve(self.table.size.width);
|
row_fragment_layout.fragments.reserve(self.table.size.width);
|
||||||
for column_index in column_indices {
|
for column_index in column_indices {
|
||||||
// The PositioningContext for cells is, in order or preference, the PositioningContext of the row,
|
// The PositioningContext for cells is, in order or preference, the PositioningContext of the row,
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl TransmitBodyConnectHandler {
|
||||||
source: BodySource,
|
source: BodySource,
|
||||||
) -> TransmitBodyConnectHandler {
|
) -> TransmitBodyConnectHandler {
|
||||||
TransmitBodyConnectHandler {
|
TransmitBodyConnectHandler {
|
||||||
stream: stream,
|
stream,
|
||||||
task_source,
|
task_source,
|
||||||
canceller,
|
canceller,
|
||||||
bytes_sender: None,
|
bytes_sender: None,
|
||||||
|
|
|
@ -175,8 +175,8 @@ pub fn handle_get_layout(
|
||||||
paddingRight: String::from(computed_style.PaddingRight()),
|
paddingRight: String::from(computed_style.PaddingRight()),
|
||||||
paddingBottom: String::from(computed_style.PaddingBottom()),
|
paddingBottom: String::from(computed_style.PaddingBottom()),
|
||||||
paddingLeft: String::from(computed_style.PaddingLeft()),
|
paddingLeft: String::from(computed_style.PaddingLeft()),
|
||||||
width: width,
|
width,
|
||||||
height: height,
|
height,
|
||||||
}))
|
}))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl DocumentLoader {
|
||||||
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
|
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
|
||||||
|
|
||||||
DocumentLoader {
|
DocumentLoader {
|
||||||
resource_threads: resource_threads,
|
resource_threads,
|
||||||
blocking_loads: initial_loads,
|
blocking_loads: initial_loads,
|
||||||
events_inhibited: false,
|
events_inhibited: false,
|
||||||
cancellers: Vec::new(),
|
cancellers: Vec::new(),
|
||||||
|
|
|
@ -26,6 +26,6 @@ pub struct SimpleWorkerErrorHandler<T: DomObject> {
|
||||||
|
|
||||||
impl<T: DomObject> SimpleWorkerErrorHandler<T> {
|
impl<T: DomObject> SimpleWorkerErrorHandler<T> {
|
||||||
pub fn new(addr: Trusted<T>) -> SimpleWorkerErrorHandler<T> {
|
pub fn new(addr: Trusted<T>) -> SimpleWorkerErrorHandler<T> {
|
||||||
SimpleWorkerErrorHandler { addr: addr }
|
SimpleWorkerErrorHandler { addr }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ where
|
||||||
{
|
{
|
||||||
let heap_buffer_source = match init {
|
let heap_buffer_source = match init {
|
||||||
HeapTypedArrayInit::Buffer(buffer_source) => HeapBufferSource {
|
HeapTypedArrayInit::Buffer(buffer_source) => HeapBufferSource {
|
||||||
buffer_source: buffer_source,
|
buffer_source,
|
||||||
phantom: PhantomData::default(),
|
phantom: PhantomData::default(),
|
||||||
},
|
},
|
||||||
HeapTypedArrayInit::Info { len, cx } => {
|
HeapTypedArrayInit::Info { len, cx } => {
|
||||||
|
|
|
@ -253,9 +253,9 @@ impl CallSetup {
|
||||||
let ais = callback.incumbent().map(AutoIncumbentScript::new);
|
let ais = callback.incumbent().map(AutoIncumbentScript::new);
|
||||||
CallSetup {
|
CallSetup {
|
||||||
exception_global: global,
|
exception_global: global,
|
||||||
cx: cx,
|
cx,
|
||||||
old_realm: unsafe { EnterRealm(*cx, callback.callback()) },
|
old_realm: unsafe { EnterRealm(*cx, callback.callback()) },
|
||||||
handling: handling,
|
handling,
|
||||||
entry_script: Some(aes),
|
entry_script: Some(aes),
|
||||||
incumbent_script: ais,
|
incumbent_script: ais,
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,7 @@ pub struct Guard<T: Clone + Copy> {
|
||||||
impl<T: Clone + Copy> Guard<T> {
|
impl<T: Clone + Copy> Guard<T> {
|
||||||
/// Construct a new guarded value.
|
/// Construct a new guarded value.
|
||||||
pub const fn new(condition: Condition, value: T) -> Self {
|
pub const fn new(condition: Condition, value: T) -> Self {
|
||||||
Guard {
|
Guard { condition, value }
|
||||||
condition: condition,
|
|
||||||
value: value,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Expose the value if the condition is satisfied.
|
/// Expose the value if the condition is satisfied.
|
||||||
|
|
|
@ -76,8 +76,8 @@ impl NonCallbackInterfaceObjectClass {
|
||||||
ext: 0 as *const _,
|
ext: 0 as *const _,
|
||||||
oOps: &OBJECT_OPS,
|
oOps: &OBJECT_OPS,
|
||||||
},
|
},
|
||||||
proto_id: proto_id,
|
proto_id,
|
||||||
proto_depth: proto_depth,
|
proto_depth,
|
||||||
representation: string_rep,
|
representation: string_rep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,10 +649,8 @@ pub fn get_desired_proto(
|
||||||
let global = GetNonCCWObjectGlobal(*new_target);
|
let global = GetNonCCWObjectGlobal(*new_target);
|
||||||
let proto_or_iface_cache = get_proto_or_iface_array(global);
|
let proto_or_iface_cache = get_proto_or_iface_array(global);
|
||||||
desired_proto.set((*proto_or_iface_cache)[proto_id as usize]);
|
desired_proto.set((*proto_or_iface_cache)[proto_id as usize]);
|
||||||
if &*new_target != &*original_new_target {
|
if &*new_target != &*original_new_target && !JS_WrapObject(*cx, desired_proto.into()) {
|
||||||
if !JS_WrapObject(*cx, desired_proto.into()) {
|
return Err(());
|
||||||
return Err(());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl<T: DomObjectIteratorWrap + JSTraceable + Iterable> IterableIterator<T> {
|
||||||
pub fn new(iterable: &T, type_: IteratorType) -> DomRoot<Self> {
|
pub fn new(iterable: &T, type_: IteratorType) -> DomRoot<Self> {
|
||||||
let iterator = Box::new(IterableIterator {
|
let iterator = Box::new(IterableIterator {
|
||||||
reflector: Reflector::new(),
|
reflector: Reflector::new(),
|
||||||
type_: type_,
|
type_,
|
||||||
iterable: Dom::from_ref(iterable),
|
iterable: Dom::from_ref(iterable),
|
||||||
index: Cell::new(0),
|
index: Cell::new(0),
|
||||||
});
|
});
|
||||||
|
|
|
@ -163,7 +163,7 @@ where
|
||||||
map.insert(key, property);
|
map.insert(key, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ConversionResult::Success(Record { map: map }))
|
Ok(ConversionResult::Success(Record { map }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
macro_rules! make_getter(
|
macro_rules! make_getter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self) -> DOMString {
|
fn $attr(&self) -> DOMString {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.get_string_attribute(&html5ever::local_name!($htmlname))
|
element.get_string_attribute(&html5ever::local_name!($htmlname))
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ macro_rules! make_getter(
|
||||||
macro_rules! make_bool_getter(
|
macro_rules! make_bool_getter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self) -> bool {
|
fn $attr(&self) -> bool {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.has_attribute(&html5ever::local_name!($htmlname))
|
element.has_attribute(&html5ever::local_name!($htmlname))
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ macro_rules! make_bool_getter(
|
||||||
macro_rules! make_limited_int_setter(
|
macro_rules! make_limited_int_setter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self, value: i32) -> $crate::dom::bindings::error::ErrorResult {
|
fn $attr(&self, value: i32) -> $crate::dom::bindings::error::ErrorResult {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
|
|
||||||
let value = if value < 0 {
|
let value = if value < 0 {
|
||||||
return Err($crate::dom::bindings::error::Error::IndexSize);
|
return Err($crate::dom::bindings::error::Error::IndexSize);
|
||||||
|
@ -50,8 +50,8 @@ macro_rules! make_limited_int_setter(
|
||||||
macro_rules! make_int_setter(
|
macro_rules! make_int_setter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self, value: i32) {
|
fn $attr(&self, value: i32) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
|
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.set_int_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_int_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
|
@ -66,8 +66,8 @@ macro_rules! make_int_setter(
|
||||||
macro_rules! make_int_getter(
|
macro_rules! make_int_getter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self) -> i32 {
|
fn $attr(&self) -> i32 {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.get_int_attribute(&html5ever::local_name!($htmlname), $default)
|
element.get_int_attribute(&html5ever::local_name!($htmlname), $default)
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ macro_rules! make_int_getter(
|
||||||
macro_rules! make_uint_getter(
|
macro_rules! make_uint_getter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self) -> u32 {
|
fn $attr(&self) -> u32 {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.get_uint_attribute(&html5ever::local_name!($htmlname), $default)
|
element.get_uint_attribute(&html5ever::local_name!($htmlname), $default)
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ macro_rules! make_uint_getter(
|
||||||
macro_rules! make_url_getter(
|
macro_rules! make_url_getter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self) -> USVString {
|
fn $attr(&self) -> USVString {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.get_url_attribute(&html5ever::local_name!($htmlname))
|
element.get_url_attribute(&html5ever::local_name!($htmlname))
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,8 @@ macro_rules! make_url_getter(
|
||||||
macro_rules! make_url_setter(
|
macro_rules! make_url_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: USVString) {
|
fn $attr(&self, value: USVString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.set_url_attribute(&html5ever::local_name!($htmlname),
|
element.set_url_attribute(&html5ever::local_name!($htmlname),
|
||||||
value);
|
value);
|
||||||
|
@ -122,8 +122,8 @@ macro_rules! make_url_setter(
|
||||||
macro_rules! make_form_action_getter(
|
macro_rules! make_form_action_getter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self) -> DOMString {
|
fn $attr(&self) -> DOMString {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let doc = crate::dom::node::document_from_node(self);
|
let doc = crate::dom::node::document_from_node(self);
|
||||||
let attr = element.get_attribute(&html5ever::ns!(), &html5ever::local_name!($htmlname));
|
let attr = element.get_attribute(&html5ever::ns!(), &html5ever::local_name!($htmlname));
|
||||||
|
@ -144,8 +144,8 @@ macro_rules! make_form_action_getter(
|
||||||
macro_rules! make_labels_getter(
|
macro_rules! make_labels_getter(
|
||||||
( $attr:ident, $memo:ident ) => (
|
( $attr:ident, $memo:ident ) => (
|
||||||
fn $attr(&self) -> DomRoot<NodeList> {
|
fn $attr(&self) -> DomRoot<NodeList> {
|
||||||
use crate::dom::htmlelement::HTMLElement;
|
use $crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::nodelist::NodeList;
|
use $crate::dom::nodelist::NodeList;
|
||||||
self.$memo.or_init(|| NodeList::new_labels_list(
|
self.$memo.or_init(|| NodeList::new_labels_list(
|
||||||
self.upcast::<Node>().owner_doc().window(),
|
self.upcast::<Node>().owner_doc().window(),
|
||||||
self.upcast::<HTMLElement>()
|
self.upcast::<HTMLElement>()
|
||||||
|
@ -159,8 +159,8 @@ macro_rules! make_labels_getter(
|
||||||
macro_rules! make_enumerated_getter(
|
macro_rules! make_enumerated_getter(
|
||||||
( $attr:ident, $htmlname:tt, $default:expr, $($choices: pat)|+) => (
|
( $attr:ident, $htmlname:tt, $default:expr, $($choices: pat)|+) => (
|
||||||
fn $attr(&self) -> DOMString {
|
fn $attr(&self) -> DOMString {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let mut val = element.get_string_attribute(&html5ever::local_name!($htmlname));
|
let mut val = element.get_string_attribute(&html5ever::local_name!($htmlname));
|
||||||
val.make_ascii_lowercase();
|
val.make_ascii_lowercase();
|
||||||
|
@ -179,8 +179,8 @@ macro_rules! make_enumerated_getter(
|
||||||
macro_rules! make_setter(
|
macro_rules! make_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: DOMString) {
|
fn $attr(&self, value: DOMString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.set_string_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_string_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
}
|
}
|
||||||
|
@ -191,8 +191,8 @@ macro_rules! make_setter(
|
||||||
macro_rules! make_bool_setter(
|
macro_rules! make_bool_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: bool) {
|
fn $attr(&self, value: bool) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.set_bool_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_bool_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,8 @@ macro_rules! make_bool_setter(
|
||||||
macro_rules! make_uint_setter(
|
macro_rules! make_uint_setter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self, value: u32) {
|
fn $attr(&self, value: u32) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
use crate::dom::values::UNSIGNED_LONG_MAX;
|
use crate::dom::values::UNSIGNED_LONG_MAX;
|
||||||
let value = if value > UNSIGNED_LONG_MAX {
|
let value = if value > UNSIGNED_LONG_MAX {
|
||||||
$default
|
$default
|
||||||
|
@ -224,8 +224,8 @@ macro_rules! make_uint_setter(
|
||||||
macro_rules! make_limited_uint_setter(
|
macro_rules! make_limited_uint_setter(
|
||||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||||
fn $attr(&self, value: u32) -> $crate::dom::bindings::error::ErrorResult {
|
fn $attr(&self, value: u32) -> $crate::dom::bindings::error::ErrorResult {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
use crate::dom::values::UNSIGNED_LONG_MAX;
|
use crate::dom::values::UNSIGNED_LONG_MAX;
|
||||||
let value = if value == 0 {
|
let value = if value == 0 {
|
||||||
return Err($crate::dom::bindings::error::Error::IndexSize);
|
return Err($crate::dom::bindings::error::Error::IndexSize);
|
||||||
|
@ -248,8 +248,8 @@ macro_rules! make_limited_uint_setter(
|
||||||
macro_rules! make_atomic_setter(
|
macro_rules! make_atomic_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: DOMString) {
|
fn $attr(&self, value: DOMString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.set_atomic_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_atomic_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
}
|
}
|
||||||
|
@ -260,8 +260,8 @@ macro_rules! make_atomic_setter(
|
||||||
macro_rules! make_legacy_color_setter(
|
macro_rules! make_legacy_color_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: DOMString) {
|
fn $attr(&self, value: DOMString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let value = AttrValue::from_legacy_color(value.into());
|
let value = AttrValue::from_legacy_color(value.into());
|
||||||
|
@ -274,8 +274,8 @@ macro_rules! make_legacy_color_setter(
|
||||||
macro_rules! make_dimension_setter(
|
macro_rules! make_dimension_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: DOMString) {
|
fn $attr(&self, value: DOMString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let value = AttrValue::from_dimension(value.into());
|
let value = AttrValue::from_dimension(value.into());
|
||||||
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
|
@ -287,8 +287,8 @@ macro_rules! make_dimension_setter(
|
||||||
macro_rules! make_nonzero_dimension_setter(
|
macro_rules! make_nonzero_dimension_setter(
|
||||||
( $attr:ident, $htmlname:tt ) => (
|
( $attr:ident, $htmlname:tt ) => (
|
||||||
fn $attr(&self, value: DOMString) {
|
fn $attr(&self, value: DOMString) {
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use $crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::element::Element;
|
use $crate::dom::element::Element;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let value = AttrValue::from_nonzero_dimension(value.into());
|
let value = AttrValue::from_nonzero_dimension(value.into());
|
||||||
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
||||||
|
|
|
@ -3369,7 +3369,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
fn DeleteQuery(&self, query: Option<&WebGLQuery>) {
|
fn DeleteQuery(&self, query: Option<&WebGLQuery>) {
|
||||||
if let Some(query) = query {
|
if let Some(query) = query {
|
||||||
handle_potential_webgl_error!(self.base, self.base.validate_ownership(query), return);
|
handle_potential_webgl_error!(self.base, self.base.validate_ownership(query), return);
|
||||||
|
@ -3431,7 +3431,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
fn BeginQuery(&self, target: u32, query: &WebGLQuery) {
|
fn BeginQuery(&self, target: u32, query: &WebGLQuery) {
|
||||||
handle_potential_webgl_error!(self.base, self.base.validate_ownership(query), return);
|
handle_potential_webgl_error!(self.base, self.base.validate_ownership(query), return);
|
||||||
|
|
||||||
|
@ -3460,7 +3460,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
fn EndQuery(&self, target: u32) {
|
fn EndQuery(&self, target: u32) {
|
||||||
let active_query = match target {
|
let active_query = match target {
|
||||||
constants::ANY_SAMPLES_PASSED |
|
constants::ANY_SAMPLES_PASSED |
|
||||||
|
@ -3487,7 +3487,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
fn GetQuery(&self, target: u32, pname: u32) -> Option<DomRoot<WebGLQuery>> {
|
fn GetQuery(&self, target: u32, pname: u32) -> Option<DomRoot<WebGLQuery>> {
|
||||||
if pname != constants::CURRENT_QUERY {
|
if pname != constants::CURRENT_QUERY {
|
||||||
self.base.webgl_error(InvalidEnum);
|
self.base.webgl_error(InvalidEnum);
|
||||||
|
@ -3515,7 +3515,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12>
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
fn GetQueryParameter(&self, _cx: JSContext, query: &WebGLQuery, pname: u32) -> JSVal {
|
fn GetQueryParameter(&self, _cx: JSContext, query: &WebGLQuery, pname: u32) -> JSVal {
|
||||||
handle_potential_webgl_error!(
|
handle_potential_webgl_error!(
|
||||||
self.base,
|
self.base,
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl WebGLQuery {
|
||||||
self.query_result_available.set(Some(is_available));
|
self.query_result_available.set(Some(is_available));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[rustfmt::skip]
|
||||||
pub fn get_parameter(
|
pub fn get_parameter(
|
||||||
&self,
|
&self,
|
||||||
context: &WebGLRenderingContext,
|
context: &WebGLRenderingContext,
|
||||||
|
|
|
@ -528,9 +528,9 @@ impl JsTimers {
|
||||||
let oneshot_handle = global.schedule_callback(callback, duration);
|
let oneshot_handle = global.schedule_callback(callback, duration);
|
||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
let entry = active_timers.entry(handle).or_insert(JsTimerEntry {
|
let entry = active_timers
|
||||||
oneshot_handle: oneshot_handle,
|
.entry(handle)
|
||||||
});
|
.or_insert(JsTimerEntry { oneshot_handle });
|
||||||
entry.oneshot_handle = oneshot_handle;
|
entry.oneshot_handle = oneshot_handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ use js::rust::{
|
||||||
Handle as RustHandle, HandleObject as RustHandleObject, IntoHandle,
|
Handle as RustHandle, HandleObject as RustHandleObject, IntoHandle,
|
||||||
MutableHandle as RustMutableHandle, MutableHandleObject as RustMutableHandleObject,
|
MutableHandle as RustMutableHandle, MutableHandleObject as RustMutableHandleObject,
|
||||||
};
|
};
|
||||||
use libc;
|
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::proxyhandler::set_property_descriptor;
|
use crate::dom::bindings::proxyhandler::set_property_descriptor;
|
||||||
|
|
2
third_party/blurmac/src/delegate.rs
vendored
2
third_party/blurmac/src/delegate.rs
vendored
|
@ -356,7 +356,7 @@ pub mod bm {
|
||||||
pub fn delegate_peripherals(delegate: *mut Object) -> *mut Object {
|
pub fn delegate_peripherals(delegate: *mut Object) -> *mut Object {
|
||||||
unsafe {
|
unsafe {
|
||||||
let peripherals: *mut Object =
|
let peripherals: *mut Object =
|
||||||
*(&mut *delegate).get_ivar::<*mut Object>(DELEGATE_PERIPHERALS_IVAR);
|
*(*delegate).get_ivar::<*mut Object>(DELEGATE_PERIPHERALS_IVAR);
|
||||||
peripherals
|
peripherals
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue