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

Unified Diff: Source/core/css/analyzer/DescendantInvalidationSet.cpp

Issue 129633003: Add a first pass of a class descendant invalidator, and a containing RuleSetAnalyzer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed name Created 6 years, 11 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/analyzer/DescendantInvalidationSet.cpp
diff --git a/Source/core/svg/SVGAnimatedLength.cpp b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
similarity index 54%
copy from Source/core/svg/SVGAnimatedLength.cpp
copy to Source/core/css/analyzer/DescendantInvalidationSet.cpp
index bc447b07280ebfb8d410374e1bd403a14d4851cc..6249f197e84095c9c95f51e3d1ec75114840cdb6 100644
--- a/Source/core/svg/SVGAnimatedLength.cpp
+++ b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
@@ -29,28 +29,51 @@
*/
#include "config.h"
+#include "core/css/analyzer/DescendantInvalidationSet.h"
-#include "core/svg/SVGAnimatedLength.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/Element.h"
namespace WebCore {
-void SVGAnimatedLength::setDefaultValueAsString(const String& value)
+DescendantInvalidationSet::DescendantInvalidationSet()
+ : m_allDescendantsMightBeInvalid(false)
{
- baseValue()->setValueAsString(value, ASSERT_NO_EXCEPTION);
}
-void SVGAnimatedLength::setBaseValueAsString(const String& value, SVGLengthNegativeValuesMode mode, SVGParsingError& parseError)
+void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other)
{
- TrackExceptionState es;
+ m_allDescendantsMightBeInvalid = m_allDescendantsMightBeInvalid || other.m_allDescendantsMightBeInvalid;
+ // No longer bother combining data structures, since the whole subtree is deemed invalid.
+ if (m_allDescendantsMightBeInvalid)
+ return;
- baseValue()->setValueAsString(value, es);
+ HashSet<AtomicString>::const_iterator end = other.m_classes.end();
+ for (HashSet<AtomicString>::const_iterator it = other.m_classes.begin(); it != end; ++it)
+ addClass(*it);
- if (es.hadException()) {
- parseError = ParsingAttributeFailedError;
- baseValue()->newValueSpecifiedUnits(LengthTypeNumber, 0);
- } else if (mode == ForbidNegativeLengths && baseValue()->valueInSpecifiedUnits() < 0) {
- parseError = NegativeValueForbiddenError;
- }
+ end = other.m_ids.end();
+ for (HashSet<AtomicString>::const_iterator it = other.m_ids.begin(); it != end; ++it)
+ addId(*it);
+
+ end = other.m_tagNames.end();
+ for (HashSet<AtomicString>::const_iterator it = other.m_tagNames.begin(); it != end; ++it)
+ addTagName(*it);
}
+void DescendantInvalidationSet::addClass(const AtomicString& className)
+{
+ m_classes.add(className);
+}
+
+void DescendantInvalidationSet::addId(const AtomicString& id)
+{
+ m_ids.add(id);
}
+
+void DescendantInvalidationSet::addTagName(const AtomicString& tagName)
+{
+ m_tagNames.add(tagName);
+}
+
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698