diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-01-10 03:19:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-10 08:19:19 +0000 |
commit | c94d909a8688589209cdf0c7ae58e40f9b8c411e (patch) | |
tree | 12febf23eed4438249fd4d276c4d8b35dee22a97 /components/script/dom/abstractrange.rs | |
parent | f220d6d3a52296794cd19935e9e59cc75a179a44 (diff) | |
download | servo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.tar.gz servo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.zip |
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Mass pub->pub(crate) conversion.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Hide existing dead code warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix clippy warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix unit tests.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix clippy.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* More formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/abstractrange.rs')
-rw-r--r-- | components/script/dom/abstractrange.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/components/script/dom/abstractrange.rs b/components/script/dom/abstractrange.rs index c16a6434d5b..80cd64a0df5 100644 --- a/components/script/dom/abstractrange.rs +++ b/components/script/dom/abstractrange.rs @@ -17,14 +17,14 @@ use crate::dom::node::{Node, ShadowIncluding}; use crate::script_runtime::CanGc; #[dom_struct] -pub struct AbstractRange { +pub(crate) struct AbstractRange { reflector_: Reflector, start: BoundaryPoint, end: BoundaryPoint, } impl AbstractRange { - pub fn new_inherited( + pub(crate) fn new_inherited( start_container: &Node, start_offset: u32, end_container: &Node, @@ -37,7 +37,7 @@ impl AbstractRange { } } - pub fn new( + pub(crate) fn new( document: &Document, start_container: &Node, start_offset: u32, @@ -57,11 +57,11 @@ impl AbstractRange { abstractrange } - pub fn start(&self) -> &BoundaryPoint { + pub(crate) fn start(&self) -> &BoundaryPoint { &self.start } - pub fn end(&self) -> &BoundaryPoint { + pub(crate) fn end(&self) -> &BoundaryPoint { &self.end } } @@ -95,7 +95,7 @@ impl AbstractRangeMethods<crate::DomTypeHolder> for AbstractRange { #[derive(DenyPublicFields, JSTraceable, MallocSizeOf)] #[crown::unrooted_must_root_lint::must_root] -pub struct BoundaryPoint { +pub(crate) struct BoundaryPoint { node: MutDom<Node>, offset: Cell<u32>, } @@ -109,16 +109,16 @@ impl BoundaryPoint { } } - pub fn set(&self, node: &Node, offset: u32) { + pub(crate) fn set(&self, node: &Node, offset: u32) { self.node.set(node); self.set_offset(offset); } - pub fn set_offset(&self, offset: u32) { + pub(crate) fn set_offset(&self, offset: u32) { self.offset.set(offset); } - pub fn node(&self) -> &MutDom<Node> { + pub(crate) fn node(&self) -> &MutDom<Node> { &self.node } } @@ -143,7 +143,12 @@ impl PartialEq for BoundaryPoint { } /// <https://dom.spec.whatwg.org/#concept-range-bp-position> -pub fn bp_position(a_node: &Node, a_offset: u32, b_node: &Node, b_offset: u32) -> Option<Ordering> { +pub(crate) fn bp_position( + a_node: &Node, + a_offset: u32, + b_node: &Node, + b_offset: u32, +) -> Option<Ordering> { if std::ptr::eq(a_node, b_node) { // Step 1. return Some(a_offset.cmp(&b_offset)); |