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

Unified Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 18371008: Add a WebDocument::watchCssSelectors(selectors) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Fix most comments; TODO benchmark and use Element::recalcStyle Created 7 years, 5 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/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index 1ffb016b2fbd11bc963a16c1ebf6540dbc66ac96..bc0bd8fcea443aa5c358975fde13085b0ebf312b 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -26,6 +26,7 @@
#include <algorithm>
#include "CSSPropertyNames.h"
#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/CSSSelectorWatch.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/platform/graphics/Font.h"
#include "core/platform/graphics/FontSelector.h"
@@ -692,6 +693,28 @@ void RenderStyle::clearCursorList()
rareInheritedData.access()->cursorData = 0;
}
+void RenderStyle::addCallbackSelector(const String& selector, CSSSelectorWatch* selectorWatch)
+{
+ ASSERT(!rareNonInheritedData->m_selectorWatch.get()
+ || rareNonInheritedData->m_selectorWatch.get() == selectorWatch);
+ if (!rareNonInheritedData->m_callbackSelectors.contains(selector)) {
+ StyleRareNonInheritedData* data = rareNonInheritedData.access();
+ data->m_callbackSelectors.append(selector);
+ // Assigns a WeakPtr to |selectorWatch| to data->m_selectorWatch.
+ selectorWatch->addSelectorMatch(selector, data);
+ }
+}
+
+void RenderStyle::removeCallbackSelector(const String& selector)
esprehn 2013/07/17 07:14:32 Nothing ever calls this, can you just remove it?
Jeffrey Yasskin 2013/08/02 01:34:07 Done.
+{
+ size_t index = rareNonInheritedData->m_callbackSelectors.find(selector);
+ if (index != notFound) {
+ rareNonInheritedData.access()->m_callbackSelectors.remove(index);
+ if (CSSSelectorWatch* selectorWatch = rareNonInheritedData->m_selectorWatch.get())
+ selectorWatch->removeSelectorMatch(selector);
+ }
+}
+
void RenderStyle::clearContent()
{
if (rareNonInheritedData->m_content)

Powered by Google App Engine
This is Rietveld 408576698