Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Unified Diff: Source/core/css/CSSStyleSheet.cpp

Issue 49093005: Fix memory error during selector matching due to getMatchedCSSRules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSStyleSheet.cpp
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index 9737560190271c7ebc8e6aa57ef768b288dd7777..b1ce8d3351a8ccf62e8cb0cc147d706360e1c625 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -28,6 +28,7 @@
#include "core/css/CSSImportRule.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSRuleList.h"
+#include "core/css/CSSStyleRule.h"
#include "core/css/MediaList.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleSheetContents.h"
@@ -117,6 +118,9 @@ CSSStyleSheet::~CSSStyleSheet()
if (m_childRuleCSSOMWrappers[i])
m_childRuleCSSOMWrappers[i]->setParentStyleSheet(0);
}
+ for (unsigned i = 0; i < m_extraChildRuleCSSOMWrappers.size(); ++i) {
+ m_extraChildRuleCSSOMWrappers[i]->setParentStyleSheet(0);
+ }
if (m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper->clearParentStyleSheet();
@@ -164,6 +168,11 @@ void CSSStyleSheet::didMutate(StyleSheetUpdateType updateType)
owner->modifiedStyleSheet(this, RecalcStyleDeferred, updateMode);
}
+void CSSStyleSheet::registerExtraChildRuleCSSOMWrapper(PassRefPtr<CSSRule> rule)
+{
+ m_extraChildRuleCSSOMWrappers.append(rule);
+}
+
void CSSStyleSheet::reattachChildRuleCSSOMWrappers()
{
for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698