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

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: Initial 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
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/StyleRareNonInheritedData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index a48257fdfa04ec7ca1520c628dd7a1e98e6c0649..9cebcfbd524ed53e80fff81cd46e215c674bd337 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -691,6 +691,30 @@ void RenderStyle::clearCursorList()
rareInheritedData.access()->cursorData = 0;
}
+#if ENABLE(CSS_CALLBACKS)
+void RenderStyle::addCallbackSelector(const String& selector, Document* document)
+{
+ ASSERT(!rareNonInheritedData->m_document.get()
+ || rareNonInheritedData->m_document.get() == document);
+ if (!rareNonInheritedData->m_callbackSelectors.contains(selector)) {
+ StyleRareNonInheritedData* data = rareNonInheritedData.access();
+ data->m_callbackSelectors.append(selector);
+ // Assigns a WeakPtr to |document| to data->m_document.
+ document->addSelectorMatch(selector, data);
+ }
+}
+
+void RenderStyle::removeCallbackSelector(const String& selector)
+{
+ size_t index = rareNonInheritedData->m_callbackSelectors.find(selector);
+ if (index != notFound) {
+ rareNonInheritedData.access()->m_callbackSelectors.remove(index);
+ if (Document* document = rareNonInheritedData->m_document.get())
+ document->removeSelectorMatch(selector);
+ }
+}
+#endif
+
void RenderStyle::clearContent()
{
if (rareNonInheritedData->m_content)
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/StyleRareNonInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698