diff options
-rw-r--r-- | components/canvas/canvas_data.rs | 20 | ||||
-rw-r--r-- | components/canvas/gl_context.rs | 11 | ||||
-rw-r--r-- | components/msg/constellation_msg.rs | 8 | ||||
-rw-r--r-- | components/range/lib.rs | 22 | ||||
-rw-r--r-- | components/remutex/lib.rs | 6 | ||||
-rw-r--r-- | components/script/document_loader.rs | 18 | ||||
-rw-r--r-- | components/script/dom/attr.rs | 16 | ||||
-rw-r--r-- | components/script/dom/bindings/mod.rs | 3 | ||||
-rw-r--r-- | components/script/dom/bindings/root.rs | 8 | ||||
-rw-r--r-- | components/script/dom/bindings/str.rs | 12 | ||||
-rw-r--r-- | components/script/dom/dissimilaroriginlocation.rs | 6 | ||||
-rw-r--r-- | components/script/dom/dissimilaroriginwindow.rs | 6 | ||||
-rw-r--r-- | components/script/dom/document.rs | 4 | ||||
-rw-r--r-- | components/script/dom/element.rs | 34 | ||||
-rw-r--r-- | components/script/script_thread.rs | 15 | ||||
-rw-r--r-- | components/script_layout_interface/rpc.rs | 5 | ||||
-rw-r--r-- | components/script_traits/lib.rs | 4 | ||||
-rw-r--r-- | components/selectors/bloom.rs | 5 | ||||
-rw-r--r-- | components/style/properties/cascade.rs | 4 |
19 files changed, 4 insertions, 203 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 6b65f75117a..eb2cf963e70 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -1146,26 +1146,6 @@ fn write_image( draw_target.draw_surface(source_surface, dest_rect, image_rect, filter, draw_options); } -pub trait PointToi32 { - fn to_i32(&self) -> Point2D<i32>; -} - -impl PointToi32 for Point2D<f64> { - fn to_i32(&self) -> Point2D<i32> { - Point2D::new(self.x.to_i32().unwrap(), self.y.to_i32().unwrap()) - } -} - -pub trait SizeToi32 { - fn to_i32(&self) -> Size2D<i32>; -} - -impl SizeToi32 for Size2D<f64> { - fn to_i32(&self) -> Size2D<i32> { - Size2D::new(self.width.to_i32().unwrap(), self.height.to_i32().unwrap()) - } -} - pub trait RectToi32 { fn to_i32(&self) -> Rect<i32>; fn ceil(&self) -> Rect<f64>; diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs index 46434c24e81..844b60ba44d 100644 --- a/components/canvas/gl_context.rs +++ b/components/canvas/gl_context.rs @@ -147,17 +147,6 @@ impl GLContextWrapper { } } - pub fn unbind(&self) { - match *self { - GLContextWrapper::Native(ref ctx) => { - ctx.unbind().unwrap(); - }, - GLContextWrapper::OSMesa(ref ctx) => { - ctx.unbind().unwrap(); - }, - } - } - pub fn apply_command( &self, cmd: WebGLCommand, diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index aa61491afa5..ac84186b10c 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -122,17 +122,9 @@ impl PipelineId { } } - pub fn root_scroll_node(&self) -> webrender_api::SpatialId { - webrender_api::SpatialId::root_scroll_node(self.to_webrender()) - } - pub fn root_scroll_id(&self) -> webrender_api::ExternalScrollId { webrender_api::ExternalScrollId(0, self.to_webrender()) } - - pub fn root_clip_node(&self) -> webrender_api::ClipId { - webrender_api::ClipId::root(self.to_webrender()) - } } impl fmt::Display for PipelineId { diff --git a/components/range/lib.rs b/components/range/lib.rs index 0e0cbf76be9..b968eacb3b0 100644 --- a/components/range/lib.rs +++ b/components/range/lib.rs @@ -18,8 +18,6 @@ pub trait Int: { fn zero() -> Self; fn one() -> Self; - fn max_value() -> Self; - fn from_usize(n: usize) -> Option<Self>; fn to_usize(self) -> usize; } impl Int for isize { @@ -32,14 +30,6 @@ impl Int for isize { 1 } #[inline] - fn max_value() -> isize { - ::std::isize::MAX - } - #[inline] - fn from_usize(n: usize) -> Option<isize> { - num_traits::NumCast::from(n) - } - #[inline] fn to_usize(self) -> usize { num_traits::NumCast::from(self).unwrap() } @@ -54,14 +44,6 @@ impl Int for usize { 1 } #[inline] - fn max_value() -> usize { - ::std::usize::MAX - } - #[inline] - fn from_usize(n: usize) -> Option<usize> { - Some(n) - } - #[inline] fn to_usize(self) -> usize { self } @@ -134,10 +116,6 @@ macro_rules! int_range_index { #[inline] fn one() -> $Self_ { $Self_($crate::Int::one()) } #[inline] - fn max_value() -> $Self_ { $Self_($crate::Int::max_value()) } - #[inline] - fn from_usize(n: usize) -> Option<$Self_> { $crate::Int::from_usize(n).map($Self_) } - #[inline] fn to_usize(self) -> usize { self.to_usize() } } diff --git a/components/remutex/lib.rs b/components/remutex/lib.rs index e019d9cedce..5e48c88a94c 100644 --- a/components/remutex/lib.rs +++ b/components/remutex/lib.rs @@ -62,12 +62,6 @@ impl AtomicOptThreadId { let number = self.0.load(ordering); NonZeroUsize::new(number).map(ThreadId) } - #[allow(unsafe_code)] - pub fn swap(&self, value: Option<ThreadId>, ordering: Ordering) -> Option<ThreadId> { - let number = value.map(|id| id.0.get()).unwrap_or(0); - let number = self.0.swap(number, ordering); - NonZeroUsize::new(number).map(ThreadId) - } } /// A type for hand-over-hand mutexes. diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index ef4075d6599..ef60cbc2a6c 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -25,19 +25,6 @@ pub enum LoadType { Media, } -impl LoadType { - fn url(&self) -> Option<&ServoUrl> { - match *self { - LoadType::Image(ref url) | - LoadType::Script(ref url) | - LoadType::Subframe(ref url) | - LoadType::Stylesheet(ref url) | - LoadType::PageSource(ref url) => Some(url), - LoadType::Media => None, - } - } -} - /// Canary value ensuring that manually added blocking loads (ie. ones that weren't /// created via DocumentLoader::fetch_async) are always removed by the time /// that the owner is destroyed. @@ -67,11 +54,6 @@ impl LoadBlocker { } *blocker = None; } - - /// Return the url associated with this load. - pub fn url(&self) -> Option<&ServoUrl> { - self.load.as_ref().and_then(LoadType::url) - } } impl Drop for LoadBlocker { diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index e9f534350fe..269627bf870 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -252,10 +252,8 @@ impl Attr { pub trait AttrHelpersForLayout { unsafe fn value_forever(&self) -> &'static AttrValue; unsafe fn value_ref_forever(&self) -> &'static str; - unsafe fn value_atom_forever(&self) -> Option<Atom>; unsafe fn value_tokens_forever(&self) -> Option<&'static [Atom]>; unsafe fn local_name_atom_forever(&self) -> LocalName; - unsafe fn value_for_layout(&self) -> &AttrValue; } #[allow(unsafe_code)] @@ -272,15 +270,6 @@ impl AttrHelpersForLayout for LayoutDom<Attr> { } #[inline] - unsafe fn value_atom_forever(&self) -> Option<Atom> { - let value = (*self.unsafe_get()).value.borrow_for_layout(); - match *value { - AttrValue::Atom(ref val) => Some(val.clone()), - _ => None, - } - } - - #[inline] unsafe fn value_tokens_forever(&self) -> Option<&'static [Atom]> { // This transmute is used to cheat the lifetime restriction. match *self.value_forever() { @@ -293,9 +282,4 @@ impl AttrHelpersForLayout for LayoutDom<Attr> { unsafe fn local_name_atom_forever(&self) -> LocalName { (*self.unsafe_get()).identifier.local_name.clone() } - - #[inline] - unsafe fn value_for_layout(&self) -> &AttrValue { - (*self.unsafe_get()).value.borrow_for_layout() - } } diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 4ddbc43fa35..c6759edb360 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -168,9 +168,6 @@ pub mod codegen { pub mod InterfaceObjectMap { include!(concat!(env!("OUT_DIR"), "/InterfaceObjectMap.rs")); } - pub mod InterfaceTypes { - include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs")); - } #[allow(dead_code, unused_imports)] pub mod InheritTypes { include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs")); diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 940e0700b85..228015b1275 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -671,14 +671,6 @@ impl<T: DomObject> LayoutDom<T> { debug_assert!(thread_state::get().is_layout()); self.ptr.as_ptr() } - - /// Returns a reference to the interior of this JS object. This method is - /// safe to call because it originates from the layout thread, and it cannot - /// mutate DOM nodes. - pub fn get_for_script(&self) -> &T { - debug_assert!(thread_state::get().is_script()); - unsafe { &*self.ptr.as_ptr() } - } } /// Helper trait for safer manipulations of `Option<Heap<T>>` values. diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index dfeedc636d6..e08159bc1e2 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -17,7 +17,7 @@ use std::marker::PhantomData; use std::ops; use std::ops::{Deref, DerefMut}; use std::str; -use std::str::{Bytes, FromStr}; +use std::str::FromStr; /// Encapsulates the IDL `ByteString` type. #[derive(Clone, Debug, Default, Eq, JSTraceable, MallocSizeOf, PartialEq)] @@ -40,11 +40,6 @@ impl ByteString { self.0.len() } - /// Compare `self` to `other`, matching A–Z and a–z as equal. - pub fn eq_ignore_case(&self, other: &ByteString) -> bool { - self.0.eq_ignore_ascii_case(&other.0) - } - /// Returns `self` with A–Z replaced by a–z. pub fn to_lower(&self) -> ByteString { ByteString::new(self.0.to_ascii_lowercase()) @@ -219,11 +214,6 @@ impl DOMString { self.0.truncate(new_len); } - /// An iterator over the bytes of this `DOMString`. - pub fn bytes(&self) -> Bytes { - self.0.bytes() - } - /// Removes newline characters according to <https://infra.spec.whatwg.org/#strip-newlines>. pub fn strip_newlines(&mut self) { self.0.retain(|c| c != '\r' && c != '\n'); diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index 79d0a00b7a5..f7b978bc185 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -12,7 +12,6 @@ use crate::dom::bindings::str::DOMString; use crate::dom::bindings::str::USVString; use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow; use dom_struct::dom_struct; -use servo_url::MutableOrigin; /// Represents a dissimilar-origin `Location` that exists in another script thread. /// @@ -46,11 +45,6 @@ impl DissimilarOriginLocation { DissimilarOriginLocationBinding::Wrap, ) } - - #[allow(dead_code)] - pub fn origin(&self) -> &MutableOrigin { - self.window.origin() - } } impl DissimilarOriginLocationMethods for DissimilarOriginLocation { diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index 4814862881a..b66db40da3b 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -5,7 +5,6 @@ use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding; use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods; use crate::dom::bindings::error::{Error, ErrorResult}; -use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone::StructuredCloneData; @@ -20,7 +19,6 @@ use js::rust::HandleValue; use msg::constellation_msg::PipelineId; use script_traits::ScriptMsg; use servo_url::ImmutableOrigin; -use servo_url::MutableOrigin; use servo_url::ServoUrl; /// Represents a dissimilar-origin `Window` that exists in another script thread. @@ -71,10 +69,6 @@ impl DissimilarOriginWindow { unsafe { DissimilarOriginWindowBinding::Wrap(cx, win) } } - pub fn origin(&self) -> &MutableOrigin { - self.upcast::<GlobalScope>().origin() - } - pub fn window_proxy(&self) -> DomRoot<WindowProxy> { DomRoot::from_ref(&*self.window_proxy) } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 7eb43c81b79..3583e7b8842 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -473,10 +473,6 @@ impl Document { self.https_state.set(https_state); } - pub fn is_completely_loaded(&self) -> bool { - self.completely_loaded.get() - } - pub fn is_fully_active(&self) -> bool { self.activity.get() == DocumentActivity::FullyActive } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c4174309af9..66560172517 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -600,8 +600,6 @@ pub trait LayoutElementHelpers { fn local_name(&self) -> &LocalName; fn namespace(&self) -> &Namespace; fn get_lang_for_layout(&self) -> String; - fn get_checked_state_for_layout(&self) -> bool; - fn get_indeterminate_state_for_layout(&self) -> bool; fn get_state_for_layout(&self) -> ElementState; fn insert_selector_flags(&self, flags: ElementSelectorFlags); fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool; @@ -1031,26 +1029,6 @@ impl LayoutElementHelpers for LayoutDom<Element> { #[inline] #[allow(unsafe_code)] - fn get_checked_state_for_layout(&self) -> bool { - // TODO option and menuitem can also have a checked state. - match self.downcast::<HTMLInputElement>() { - Some(input) => unsafe { input.checked_state_for_layout() }, - None => false, - } - } - - #[inline] - #[allow(unsafe_code)] - fn get_indeterminate_state_for_layout(&self) -> bool { - // TODO progress elements can also be matched with :indeterminate - match self.downcast::<HTMLInputElement>() { - Some(input) => unsafe { input.indeterminate_state_for_layout() }, - None => false, - } - } - - #[inline] - #[allow(unsafe_code)] fn get_state_for_layout(&self) -> ElementState { unsafe { (*self.unsafe_get()).state.get() } } @@ -3293,10 +3271,6 @@ impl Element { self.state.set(state); } - pub fn active_state(&self) -> bool { - self.state.get().contains(ElementState::IN_ACTIVE_STATE) - } - /// <https://html.spec.whatwg.org/multipage/#concept-selector-active> pub fn set_active_state(&self, value: bool) { self.set_state(ElementState::IN_ACTIVE_STATE, value); @@ -3360,18 +3334,10 @@ impl Element { } } - pub fn target_state(&self) -> bool { - self.state.get().contains(ElementState::IN_TARGET_STATE) - } - pub fn set_target_state(&self, value: bool) { self.set_state(ElementState::IN_TARGET_STATE, value) } - pub fn fullscreen_state(&self) -> bool { - self.state.get().contains(ElementState::IN_FULLSCREEN_STATE) - } - pub fn set_fullscreen_state(&self, value: bool) { self.set_state(ElementState::IN_FULLSCREEN_STATE, value) } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 3d8d5bb1acc..f284e14dd0c 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -451,20 +451,12 @@ impl Documents { .map(|ref doc| DomRoot::from_ref(&**doc)) } - pub fn is_empty(&self) -> bool { - self.map.is_empty() - } - pub fn find_document(&self, pipeline_id: PipelineId) -> Option<DomRoot<Document>> { self.map .get(&pipeline_id) .map(|doc| DomRoot::from_ref(&**doc)) } - pub fn len(&self) -> usize { - self.map.len() - } - pub fn find_window(&self, pipeline_id: PipelineId) -> Option<DomRoot<Window>> { self.find_document(pipeline_id) .map(|doc| DomRoot::from_ref(doc.window())) @@ -824,13 +816,6 @@ impl ScriptThread { }) } - pub fn invoke_perform_a_microtask_checkpoint() { - SCRIPT_THREAD_ROOT.with(|root| { - let script_thread = unsafe { &*root.get().unwrap() }; - script_thread.perform_a_microtask_checkpoint() - }) - } - pub fn page_headers_available( id: &PipelineId, metadata: Option<Metadata>, diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index 3e759334ed4..f77b7e63836 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -3,10 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use euclid::{Point2D, Rect}; +use euclid::Rect; use script_traits::UntrustedNodeAddress; use servo_arc::Arc; -use style::properties::longhands::overflow_x; use style::properties::ComputedValues; use webrender_api::ExternalScrollId; @@ -50,8 +49,6 @@ pub struct NodeGeometryResponse { pub client_rect: Rect<i32>, } -pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>); - pub struct NodeScrollIdResponse(pub ExternalScrollId); pub struct ResolvedStyleResponse(pub String); diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index d5a030323f6..de05de657bd 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -550,10 +550,6 @@ pub type NsDuration = Length<u64, Nanoseconds>; pub fn precise_time_ms() -> MsDuration { Length::new(time::precise_time_ns() / (1000 * 1000)) } -/// Returns the duration since an unspecified epoch measured in ns. -pub fn precise_time_ns() -> NsDuration { - Length::new(time::precise_time_ns()) -} /// Data needed to construct a script thread. /// diff --git a/components/selectors/bloom.rs b/components/selectors/bloom.rs index 738894ebf22..c4b19e59ea8 100644 --- a/components/selectors/bloom.rs +++ b/components/selectors/bloom.rs @@ -18,11 +18,6 @@ const KEY_MASK: u32 = (1 << KEY_SIZE) - 1; /// A counting Bloom filter with 8-bit counters. pub type BloomFilter = CountingBloomFilter<BloomStorageU8>; -/// A non-counting Bloom filter. -/// -/// Effectively a counting Bloom filter with 1-bit counters. -pub type NonCountingBloomFilter = CountingBloomFilter<BloomStorageBool>; - /// A counting Bloom filter with parameterized storage to handle /// counters of different sizes. For now we assume that having two hash /// functions is enough, but we may revisit that decision later. diff --git a/components/style/properties/cascade.rs b/components/style/properties/cascade.rs index 9b1cfb8ec04..b3f2acde7c3 100644 --- a/components/style/properties/cascade.rs +++ b/components/style/properties/cascade.rs @@ -421,7 +421,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { } #[inline(always)] - fn apply_declaration<Phase: CascadePhase>( + fn apply_declaration( &mut self, longhand_id: LonghandId, declaration: &PropertyDeclaration, @@ -544,7 +544,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { // FIXME(emilio): We should avoid generating code for logical // longhands and just use the physical ones, then rename // physical_longhand_id to just longhand_id. - self.apply_declaration::<Phase>(longhand_id, &*declaration); + self.apply_declaration(longhand_id, &*declaration); } if Phase::is_early() { |