mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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>
This commit is contained in:
parent
f220d6d3a5
commit
c94d909a86
585 changed files with 5411 additions and 5013 deletions
|
@ -19,19 +19,19 @@ use crate::dom::eventtarget::EventTarget;
|
|||
use crate::dom::node::{Node, NodeDamage, NodeTraits};
|
||||
use crate::textinput::{SelectionDirection, SelectionState, TextInput, UTF8Bytes};
|
||||
|
||||
pub trait TextControlElement: DerivedFrom<EventTarget> + DerivedFrom<Node> {
|
||||
pub(crate) trait TextControlElement: DerivedFrom<EventTarget> + DerivedFrom<Node> {
|
||||
fn selection_api_applies(&self) -> bool;
|
||||
fn has_selectable_text(&self) -> bool;
|
||||
fn set_dirty_value_flag(&self, value: bool);
|
||||
}
|
||||
|
||||
pub struct TextControlSelection<'a, E: TextControlElement> {
|
||||
pub(crate) struct TextControlSelection<'a, E: TextControlElement> {
|
||||
element: &'a E,
|
||||
textinput: &'a DomRefCell<TextInput<ScriptToConstellationChan>>,
|
||||
}
|
||||
|
||||
impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
element: &'a E,
|
||||
textinput: &'a DomRefCell<TextInput<ScriptToConstellationChan>>,
|
||||
) -> Self {
|
||||
|
@ -39,7 +39,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-select
|
||||
pub fn dom_select(&self) {
|
||||
pub(crate) fn dom_select(&self) {
|
||||
// Step 1
|
||||
if !self.element.has_selectable_text() {
|
||||
return;
|
||||
|
@ -50,7 +50,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionstart
|
||||
pub fn dom_start(&self) -> Option<u32> {
|
||||
pub(crate) fn dom_start(&self) -> Option<u32> {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return None;
|
||||
|
@ -61,7 +61,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionstart
|
||||
pub fn set_dom_start(&self, start: Option<u32>) -> ErrorResult {
|
||||
pub(crate) fn set_dom_start(&self, start: Option<u32>) -> ErrorResult {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -83,7 +83,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionend
|
||||
pub fn dom_end(&self) -> Option<u32> {
|
||||
pub(crate) fn dom_end(&self) -> Option<u32> {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return None;
|
||||
|
@ -94,7 +94,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionend
|
||||
pub fn set_dom_end(&self, end: Option<u32>) -> ErrorResult {
|
||||
pub(crate) fn set_dom_end(&self, end: Option<u32>) -> ErrorResult {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -106,7 +106,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectiondirection
|
||||
pub fn dom_direction(&self) -> Option<DOMString> {
|
||||
pub(crate) fn dom_direction(&self) -> Option<DOMString> {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return None;
|
||||
|
@ -116,7 +116,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectiondirection
|
||||
pub fn set_dom_direction(&self, direction: Option<DOMString>) -> ErrorResult {
|
||||
pub(crate) fn set_dom_direction(&self, direction: Option<DOMString>) -> ErrorResult {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -133,7 +133,12 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-setselectionrange
|
||||
pub fn set_dom_range(&self, start: u32, end: u32, direction: Option<DOMString>) -> ErrorResult {
|
||||
pub(crate) fn set_dom_range(
|
||||
&self,
|
||||
start: u32,
|
||||
end: u32,
|
||||
direction: Option<DOMString>,
|
||||
) -> ErrorResult {
|
||||
// Step 1
|
||||
if !self.element.selection_api_applies() {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -150,7 +155,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-setrangetext
|
||||
pub fn set_dom_range_text(
|
||||
pub(crate) fn set_dom_range_text(
|
||||
&self,
|
||||
replacement: DOMString,
|
||||
start: Option<u32>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue