summaryrefslogtreecommitdiffstats
path: root/layout/style/ServoKeyframesRule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/style/ServoKeyframesRule.cpp')
-rw-r--r--layout/style/ServoKeyframesRule.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/layout/style/ServoKeyframesRule.cpp b/layout/style/ServoKeyframesRule.cpp
index 66bfafd..2bb9f95 100644
--- a/layout/style/ServoKeyframesRule.cpp
+++ b/layout/style/ServoKeyframesRule.cpp
@@ -73,7 +73,16 @@ class ServoKeyframeList : public dom::CSSRuleList {
void AppendRule() { mRules.AppendObject(nullptr); }
- void RemoveRule(uint32_t aIndex) { mRules.RemoveObjectAt(aIndex); }
+ void RemoveRule(uint32_t aIndex) {
+ if (aIndex >= mRules.Length()) {
+ return;
+ }
+ if (css::Rule* child = mRules[aIndex]) {
+ child->SetStyleSheet(nullptr);
+ child->SetParentRule(nullptr);
+ }
+ mRules.RemoveObjectAt(aIndex);
+ }
uint32_t Length() final { return mRules.Length(); }