mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -39,7 +39,7 @@ impl From<RulesMutateError> for Error {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSRuleList {
|
||||
pub(crate) struct CSSRuleList {
|
||||
reflector_: Reflector,
|
||||
parent_stylesheet: Dom<CSSStyleSheet>,
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
|
@ -47,14 +47,17 @@ pub struct CSSRuleList {
|
|||
dom_rules: DomRefCell<Vec<MutNullableDom<CSSRule>>>,
|
||||
}
|
||||
|
||||
pub enum RulesSource {
|
||||
pub(crate) enum RulesSource {
|
||||
Rules(Arc<Locked<CssRules>>),
|
||||
Keyframes(Arc<Locked<KeyframesRule>>),
|
||||
}
|
||||
|
||||
impl CSSRuleList {
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: RulesSource) -> CSSRuleList {
|
||||
pub(crate) fn new_inherited(
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
rules: RulesSource,
|
||||
) -> CSSRuleList {
|
||||
let guard = parent_stylesheet.shared_lock().read();
|
||||
let dom_rules = match rules {
|
||||
RulesSource::Rules(ref rules) => rules
|
||||
|
@ -80,7 +83,7 @@ impl CSSRuleList {
|
|||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
rules: RulesSource,
|
||||
|
@ -94,7 +97,7 @@ impl CSSRuleList {
|
|||
|
||||
/// Should only be called for CssRules-backed rules. Use append_lazy_rule
|
||||
/// for keyframes-backed rules.
|
||||
pub fn insert_rule(
|
||||
pub(crate) fn insert_rule(
|
||||
&self,
|
||||
rule: &str,
|
||||
idx: u32,
|
||||
|
@ -139,7 +142,7 @@ impl CSSRuleList {
|
|||
}
|
||||
|
||||
/// In case of a keyframe rule, index must be valid.
|
||||
pub fn remove_rule(&self, index: u32) -> ErrorResult {
|
||||
pub(crate) fn remove_rule(&self, index: u32) -> ErrorResult {
|
||||
let index = index as usize;
|
||||
let mut guard = self.parent_stylesheet.shared_lock().write();
|
||||
|
||||
|
@ -167,7 +170,7 @@ impl CSSRuleList {
|
|||
}
|
||||
|
||||
/// Remove parent stylesheets from all children
|
||||
pub fn deparent_all(&self) {
|
||||
pub(crate) fn deparent_all(&self) {
|
||||
for rule in self.dom_rules.borrow().iter() {
|
||||
if let Some(r) = rule.get() {
|
||||
DomRoot::upcast(r).deparent()
|
||||
|
@ -175,7 +178,7 @@ impl CSSRuleList {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
|
||||
pub(crate) fn item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
|
||||
self.dom_rules.borrow().get(idx as usize).map(|rule| {
|
||||
rule.or_init(|| {
|
||||
let parent_stylesheet = &self.parent_stylesheet;
|
||||
|
@ -201,7 +204,7 @@ impl CSSRuleList {
|
|||
///
|
||||
/// Should only be called for keyframes-backed rules, use insert_rule
|
||||
/// for CssRules-backed rules
|
||||
pub fn append_lazy_dom_rule(&self) {
|
||||
pub(crate) fn append_lazy_dom_rule(&self) {
|
||||
if let RulesSource::Rules(..) = self.rules {
|
||||
panic!("Can only call append_lazy_rule with keyframes-backed CSSRules");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue