diff --git a/components/style/properties/data.py b/components/style/properties/data.py index fca4b536e01..08001628e60 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -38,6 +38,10 @@ def to_rust_ident(name): return name +def to_snake_case(ident): + return re.sub("([A-Z]+)", lambda m: "_" + m.group(1).lower(), ident).strip("_") + + def to_camel_case(ident): return re.sub("(^|_|-)([a-z0-9])", lambda m: m.group(2).upper(), ident.strip("_").strip("-")) @@ -451,7 +455,7 @@ class StyleStruct(object): def __init__(self, name, inherited, gecko_name=None, additional_methods=None): self.gecko_struct_name = "Gecko" + name self.name = name - self.name_lower = name.lower() + self.name_lower = to_snake_case(name) self.ident = to_rust_ident(self.name_lower) self.longhands = [] self.inherited = inherited diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index a2ac0603a24..38a26a50675 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -3877,7 +3877,7 @@ where } % if category_to_cascade_now == "early": let writing_mode = - WritingMode::new(context.builder.get_inheritedbox()); + WritingMode::new(context.builder.get_inherited_box()); context.builder.writing_mode = writing_mode; let mut _skip_font_family = false; diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index 3983c780894..754abab0993 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -256,8 +256,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { use computed_values::text_combine_upright::T as TextCombineUpright; use computed_values::writing_mode::T as WritingMode; - let writing_mode = self.style.get_inheritedbox().clone_writing_mode(); - let text_combine_upright = self.style.get_inheritedtext().clone_text_combine_upright(); + let writing_mode = self.style.get_inherited_box().clone_writing_mode(); + let text_combine_upright = self.style.get_inherited_text().clone_text_combine_upright(); if writing_mode != WritingMode::HorizontalTb && text_combine_upright == TextCombineUpright::All @@ -266,7 +266,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { .flags .insert(ComputedValueFlags::IS_TEXT_COMBINED); self.style - .mutate_inheritedbox() + .mutate_inherited_box() .set_writing_mode(WritingMode::HorizontalTb); } } @@ -305,8 +305,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { /// /// fn adjust_for_writing_mode(&mut self, layout_parent_style: &ComputedValues) { - let our_writing_mode = self.style.get_inheritedbox().clone_writing_mode(); - let parent_writing_mode = layout_parent_style.get_inheritedbox().clone_writing_mode(); + let our_writing_mode = self.style.get_inherited_box().clone_writing_mode(); + let parent_writing_mode = layout_parent_style.get_inherited_box().clone_writing_mode(); if our_writing_mode != parent_writing_mode && self.style.get_box().clone_display() == Display::Inline @@ -496,13 +496,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { return; } - match self.style.get_inheritedtext().clone_text_align() { + match self.style.get_inherited_text().clone_text_align() { TextAlign::MozLeft | TextAlign::MozCenter | TextAlign::MozRight => {}, _ => return, } self.style - .mutate_inheritedtext() + .mutate_inherited_text() .set_text_align(TextAlign::Start) } @@ -516,8 +516,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { use values::computed::text::TextDecorationsInEffect; let decorations_in_effect = TextDecorationsInEffect::from_style(&self.style); - if self.style.get_inheritedtext().text_decorations_in_effect != decorations_in_effect { - self.style.mutate_inheritedtext().text_decorations_in_effect = decorations_in_effect; + if self.style.get_inherited_text().text_decorations_in_effect != decorations_in_effect { + self.style.mutate_inherited_text().text_decorations_in_effect = decorations_in_effect; } } diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index f2bcf11fe62..b41ecdb7e67 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -107,7 +107,7 @@ impl TextDecorationsInEffect { let mut result = match style.get_box().clone_display() { Display::InlineBlock | Display::InlineTable => Self::default(), _ => style - .get_parent_inheritedtext() + .get_parent_inherited_text() .text_decorations_in_effect .clone(), }; diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 70947ac0826..ef0e66672d0 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -514,7 +514,7 @@ impl ToComputedValue for TextAlign { } let parent = _context .builder - .get_parent_inheritedtext() + .get_parent_inherited_text() .clone_text_align(); let ltr = _context.builder.inherited_writing_mode().is_bidi_ltr(); match (parent, ltr) { @@ -529,7 +529,7 @@ impl ToComputedValue for TextAlign { TextAlign::MozCenterOrInherit => { let parent = _context .builder - .get_parent_inheritedtext() + .get_parent_inherited_text() .clone_text_align(); if parent == TextAlignKeyword::Start { TextAlignKeyword::Center @@ -653,7 +653,7 @@ impl ToComputedValue for TextEmphasisStyle { fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { match *self { TextEmphasisStyle::Keyword(ref keyword) => { - let default_shape = if context.style().get_inheritedbox().clone_writing_mode() == + let default_shape = if context.style().get_inherited_box().clone_writing_mode() == SpecifiedWritingMode::HorizontalTb { TextEmphasisShapeKeyword::Circle