Closed Bug 1472065 Opened Last year Closed Last year
simplify management of style sheet and parent rule pointers in css::Rule
59 bytes, text/x-review-board-request
The style sheet and parent rule should be known at the time the Rule object is constructed, so I think it would be better to pass those in to the constructor rather than wait for SetStyleSheet / SetParentRule calls later.
Two things to note: 1. I moved the check we do when clearing out mSheet in group rules to avoid quadratic time behavior when unlinking to inside the function that would drop the reference (ServoCSSRuleList::DropSheetReference, renamed from SetStyleSheet). 2. I removed the mention of the direct style sheet owner of ServoCSSRuleList, since previously we would end up calling SetStyleSheet on it for non-top-level group rules anyway.
Comment on attachment 8988973 [details] Bug 1472065 - Initialize mSheet and mParentRule in css::Rule's constructor. https://reviewboard.mozilla.org/r/254092/#review260884 ::: layout/style/Rule.h:132 (Diff revision 1) > bool IsKnownLive() const; > > - // This is sometimes null (e.g., for style attributes). > - StyleSheet* mSheet; > - // When the parent GroupRule is destroyed, it will call SetParentRule(nullptr) > - // on this object. (Through SetParentRuleReference); > + // mSheet should only ever be null when we create a synthetic CSSFontFaceRule > + // for an InspectorFontFace. > + // > + // mSheet and mParentRule will be cleared when the parent object is destroyed. Probably better "when they are detached from the parent object, either because the rule is removed or the parent is destroyed."
Attachment #8988973 - Flags: review?(xidorn+moz) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/8fb94a730b6c Initialize mSheet and mParentRule in css::Rule's constructor. r=xidorn
You need to log in before you can comment on or make changes to this bug.