| Index: Source/core/css/analyzer/DescendantInvalidationSet.h
|
| diff --git a/Source/core/rendering/style/StyleVariableData.h b/Source/core/css/analyzer/DescendantInvalidationSet.h
|
| similarity index 55%
|
| copy from Source/core/rendering/style/StyleVariableData.h
|
| copy to Source/core/css/analyzer/DescendantInvalidationSet.h
|
| index 23429f19c2e3058532656a3c0e130e97a09339af..85f22dec9d1a9dc1df1bf3189c65c16564fbc4ba 100644
|
| --- a/Source/core/rendering/style/StyleVariableData.h
|
| +++ b/Source/core/css/analyzer/DescendantInvalidationSet.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + * Copyright (C) 2014 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -28,37 +28,51 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -
|
| -#ifndef StyleVariableData_h
|
| -#define StyleVariableData_h
|
| +#ifndef DescendantInvalidationSet_h
|
| +#define DescendantInvalidationSet_h
|
|
|
| #include "wtf/Forward.h"
|
| -#include "wtf/HashMap.h"
|
| +#include "wtf/HashSet.h"
|
| #include "wtf/RefCounted.h"
|
| +#include "wtf/RefPtr.h"
|
| #include "wtf/text/AtomicStringHash.h"
|
|
|
| namespace WebCore {
|
|
|
| -class CursorList;
|
| -class QuotesData;
|
| -class ShadowData;
|
| +class Element;
|
|
|
| -class StyleVariableData : public RefCounted<StyleVariableData> {
|
| +// Tracks data to determine which elements of a DOM subtree need to have style
|
| +// recalculated.
|
| +class DescendantInvalidationSet : public RefCounted<DescendantInvalidationSet> {
|
| public:
|
| - static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVariableData()); }
|
| - PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariableData(*this)); }
|
| + static PassRefPtr<DescendantInvalidationSet> create()
|
| + {
|
| + return adoptRef(new DescendantInvalidationSet);
|
| + }
|
| +
|
| + void combine(const DescendantInvalidationSet& other);
|
|
|
| - bool operator==(const StyleVariableData& other) const { return other.m_data == m_data; }
|
| - bool operator!=(const StyleVariableData& other) const { return !(*this == other); }
|
| + void addClass(const AtomicString& className);
|
| + void addId(const AtomicString& id);
|
| + void addTagName(const AtomicString& tagName);
|
|
|
| - void setVariable(const AtomicString& name, const String& value) { m_data.set(name, value); }
|
| + void appendClasses(Vector<AtomicString>& classes);
|
|
|
| - HashMap<AtomicString, String> m_data;
|
| + void setWholeSubtreeInvalid() { m_allDescendantsMightBeInvalid = true; };
|
| + bool wholeSubtreeInvalid() { return m_allDescendantsMightBeInvalid; }
|
| private:
|
| - explicit StyleVariableData() : RefCounted<StyleVariableData>() { }
|
| - StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariableData>(), m_data(HashMap<AtomicString, String>(other.m_data)) { }
|
| + DescendantInvalidationSet();
|
| +
|
| + bool invalidateElementSubtreeInternal(Element*);
|
| + // If true, all descendants might be invalidated, so a full subtree recalc is required.
|
| + bool m_allDescendantsMightBeInvalid;
|
| +
|
| + // FIXME: optimize this if it becomes a memory issue.
|
| + HashSet<AtomicString> m_classes;
|
| + HashSet<AtomicString> m_ids;
|
| + HashSet<AtomicString> m_tagNames;
|
| };
|
|
|
| } // namespace WebCore
|
|
|
| -#endif /* StyleVariableData_h */
|
| +#endif // DescendantInvalidationSet_h
|
|
|