Bug 1475229 - Remove unused parent parameter in ComputedValues::new. r?emilio
MozReview-Commit-ID: EBG0TS7tI4P
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -186,23 +186,21 @@ Gecko_DestroyAnonymousContentList(nsTArr
const nsTArray<RefPtr<nsINode>>*
Gecko_GetAssignedNodes(RawGeckoElementBorrowed aElement)
{
MOZ_ASSERT(HTMLSlotElement::FromNode(aElement));
return &static_cast<const HTMLSlotElement*>(aElement)->AssignedNodes();
}
void
-Gecko_ComputedStyle_Init(
- mozilla::ComputedStyle* aStyle,
- const mozilla::ComputedStyle* aParentContext,
- RawGeckoPresContextBorrowed aPresContext,
- const ServoComputedData* aValues,
- mozilla::CSSPseudoElementType aPseudoType,
- nsAtom* aPseudoTag)
+Gecko_ComputedStyle_Init(mozilla::ComputedStyle* aStyle,
+ RawGeckoPresContextBorrowed aPresContext,
+ const ServoComputedData* aValues,
+ mozilla::CSSPseudoElementType aPseudoType,
+ nsAtom* aPseudoTag)
{
auto* presContext = const_cast<nsPresContext*>(aPresContext);
new (KnownNotNull, aStyle) mozilla::ComputedStyle(
presContext, aPseudoTag, aPseudoType,
ServoComputedDataForgotten(aValues));
}
ServoComputedData::ServoComputedData(
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -143,19 +143,20 @@ bool Gecko_IsSignificantChild(RawGeckoNo
RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node);
RawGeckoNodeBorrowedOrNull Gecko_GetFlattenedTreeParentNode(RawGeckoNodeBorrowed node);
RawGeckoElementBorrowedOrNull Gecko_GetBeforeOrAfterPseudo(RawGeckoElementBorrowed element, bool is_before);
nsTArray<nsIContent*>* Gecko_GetAnonymousContentForElement(RawGeckoElementBorrowed element);
const nsTArray<RefPtr<nsINode>>* Gecko_GetAssignedNodes(RawGeckoElementBorrowed element);
void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* anon_content);
void Gecko_ComputedStyle_Init(mozilla::ComputedStyle* context,
- ComputedStyleBorrowedOrNull parent_context,
- RawGeckoPresContextBorrowed pres_context, ServoComputedDataBorrowed values,
- mozilla::CSSPseudoElementType pseudo_type, nsAtom* pseudo_tag);
+ RawGeckoPresContextBorrowed pres_context,
+ ServoComputedDataBorrowed values,
+ mozilla::CSSPseudoElementType pseudo_type,
+ nsAtom* pseudo_tag);
void Gecko_ComputedStyle_Destroy(mozilla::ComputedStyle* context);
// By default, Servo walks the DOM by traversing the siblings of the DOM-view
// first child. This generally works, but misses anonymous children, which we
// want to traverse during styling. To support these cases, we create an
// optional stack-allocated iterator in aIterator for nodes that need it.
void Gecko_ConstructStyleChildrenIterator(RawGeckoElementBorrowed aElement,
RawGeckoStyleChildrenIteratorBorrowedMut aIterator);
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -80,17 +80,16 @@ pub mod style_structs {
pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedData;
#[repr(C)]
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ComputedStyle);
impl ComputedValues {
pub fn new(
device: &Device,
- parent: Option<<&ComputedValues>,
pseudo: Option<<&PseudoElement>,
custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
% for style_struct in data.style_structs:
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor
@@ -100,31 +99,30 @@ impl ComputedValues {
writing_mode,
flags,
rules,
% for style_struct in data.style_structs:
${style_struct.ident},
% endfor
).to_outer(
device.pres_context(),
- parent,
pseudo.map(|p| p.pseudo_info())
)
}
pub fn default_values(pres_context: RawGeckoPresContextBorrowed) -> Arc<Self> {
ComputedValuesInner::new(
/* custom_properties = */ None,
/* writing_mode = */ WritingMode::empty(), // FIXME(bz): This seems dubious
ComputedValueFlags::empty(),
/* rules = */ None,
% for style_struct in data.style_structs:
style_structs::${style_struct.name}::default(pres_context),
% endfor
- ).to_outer(pres_context, None, None).shareable()
+ ).to_outer(pres_context, None).shareable()
}
pub fn pseudo(&self) -> Option<PseudoElement> {
let atom = (self.0).mPseudoTag.mRawPtr;
if atom.is_null() {
return None;
}
@@ -255,17 +253,16 @@ impl Clone for ComputedValuesInner {
flags: self.flags.clone(),
rules: self.rules.clone(),
visited_style: self.visited_style.clone(),
}
}
}
type PseudoInfo = (*mut structs::nsAtom, structs::CSSPseudoElementType);
-type ParentComputedStyleInfo<'a> = Option< &'a ComputedValues>;
impl ComputedValuesInner {
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
% for style_struct in data.style_structs:
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
@@ -281,40 +278,42 @@ impl ComputedValuesInner {
${style_struct.gecko_name}: Arc::into_raw_offset(${style_struct.ident}),
% endfor
}
}
fn to_outer(
self,
pres_context: RawGeckoPresContextBorrowed,
- parent: ParentComputedStyleInfo,
info: Option<PseudoInfo>
) -> UniqueArc<ComputedValues> {
let (tag, ty) = if let Some(info) = info {
info
} else {
(ptr::null_mut(), structs::CSSPseudoElementType::NotPseudo)
};
- unsafe { self.to_outer_helper(pres_context, parent, ty, tag) }
+ unsafe { self.to_outer_helper(pres_context, ty, tag) }
}
unsafe fn to_outer_helper(
self,
pres_context: bindings::RawGeckoPresContextBorrowed,
- parent: ParentComputedStyleInfo,
pseudo_ty: structs::CSSPseudoElementType,
pseudo_tag: *mut structs::nsAtom
) -> UniqueArc<ComputedValues> {
let arc = {
let arc: UniqueArc<ComputedValues> = UniqueArc::new(uninitialized());
- bindings::Gecko_ComputedStyle_Init(&arc.0 as *const _ as *mut _,
- parent, pres_context,
- &self, pseudo_ty, pseudo_tag);
+ bindings::Gecko_ComputedStyle_Init(
+ &arc.0 as *const _ as *mut _,
+ pres_context,
+ &self,
+ pseudo_ty,
+ pseudo_tag
+ );
// We're simulating a move by having C++ do a memcpy and then forgetting
// it on this end.
forget(self);
arc
};
arc
}
}
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -2716,17 +2716,16 @@ impl ComputedValues {
}
}
#[cfg(feature = "servo")]
impl ComputedValues {
/// Create a new refcounted `ComputedValues`
pub fn new(
_: &Device,
- _: Option<<&ComputedValues>,
_: Option<<&PseudoElement>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
% for style_struct in data.active_style_structs():
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor
@@ -3135,20 +3134,16 @@ pub struct StyleBuilder<'a> {
/// The style we're inheriting from for properties that don't inherit from
/// ::first-line. This is the same as inherited_style, unless
/// inherited_style is a ::first-line style.
inherited_style_ignoring_first_line: &'a ComputedValues,
/// The style we're getting reset structs from.
reset_style: &'a ComputedValues,
- /// The style we're inheriting from explicitly, or none if we're the root of
- /// a subtree.
- parent_style: Option<<&'a ComputedValues>,
-
/// The rule node representing the ordered list of rules matched for this
/// node.
pub rules: Option<StrongRuleNode>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
/// The pseudo-element this style will represent.
pub pseudo: Option<<&'a PseudoElement>,
@@ -3202,17 +3197,16 @@ impl<'a> StyleBuilder<'a> {
let mut flags = inherited_style.flags.inherited();
if cascade_flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) {
flags.insert(ComputedValueFlags::IS_STYLE_IF_VISITED);
}
StyleBuilder {
device,
- parent_style,
inherited_style,
inherited_style_ignoring_first_line,
reset_style,
pseudo,
rules,
modified_reset: false,
custom_properties,
writing_mode: inherited_style.writing_mode,
@@ -3245,17 +3239,16 @@ impl<'a> StyleBuilder<'a> {
) -> Self {
let reset_style = device.default_computed_values();
let inherited_style = parent_style.unwrap_or(reset_style);
#[cfg(feature = "gecko")]
debug_assert!(parent_style.is_none() ||
parent_style.unwrap().pseudo() != Some(PseudoElement::FirstLine));
StyleBuilder {
device,
- parent_style,
inherited_style,
// None of our callers pass in ::first-line parent styles.
inherited_style_ignoring_first_line: inherited_style,
reset_style,
pseudo: None,
modified_reset: false,
rules: None,
custom_properties: style_to_derive_from.custom_properties().cloned(),
@@ -3466,17 +3459,16 @@ impl<'a> StyleBuilder<'a> {
fn modified_reset(&self) -> bool {
self.modified_reset
}
/// Turns this `StyleBuilder` into a proper `ComputedValues` instance.
pub fn build(self) -> UniqueArc<ComputedValues> {
ComputedValues::new(
self.device,
- self.parent_style,
self.pseudo,
self.custom_properties,
self.writing_mode,
self.flags,
self.rules,
% for style_struct in data.active_style_structs():
self.${style_struct.ident}.build(),
% endfor