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

Unified Diff: Source/core/css/analyzer/RuleSetAnalyzer.h

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: Implement tree walk for descendant class invalidation. 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/RuleSetAnalyzer.h
diff --git a/Source/platform/graphics/GraphicsLayerDebugInfo.h b/Source/core/css/analyzer/RuleSetAnalyzer.h
similarity index 50%
copy from Source/platform/graphics/GraphicsLayerDebugInfo.h
copy to Source/core/css/analyzer/RuleSetAnalyzer.h
index 8ef0716d66b786edb67ef8aa7c7f53779b9996dc..a461a7199773ac5792c9933926cbd3b0217ed8b7 100644
--- a/Source/platform/graphics/GraphicsLayerDebugInfo.h
+++ b/Source/core/css/analyzer/RuleSetAnalyzer.h
@@ -28,42 +28,53 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GraphicsLayerDebugInfo_h
-#define GraphicsLayerDebugInfo_h
+#ifndef RuleSetAnalyzer_h
+#define RuleSetAnalyzer_h
-#include "platform/JSONValues.h"
-#include "platform/geometry/LayoutRect.h"
-#include "platform/graphics/CompositingReasons.h"
-#include "public/platform/WebGraphicsLayerDebugInfo.h"
-
-#include "wtf/Vector.h"
+#include "core/css/analyzer/DescendantInvalidationSet.h"
+#include "wtf/RefCounted.h"
namespace WebCore {
-class GraphicsLayerDebugInfo FINAL : public blink::WebGraphicsLayerDebugInfo {
-public:
- GraphicsLayerDebugInfo();
- virtual ~GraphicsLayerDebugInfo();
+class CSSSelector;
+class Document;
+class RuleFeatureSet;
+class RuleData;
+class ShadowRoot;
- virtual void appendAsTraceFormat(blink::WebString* out) const OVERRIDE;
+// Keeps track of information about a set of CSS rules in order to answer style questions about them.
+class RuleSetAnalyzer : public RefCounted<RuleSetAnalyzer> {
+public:
+ static PassRefPtr<RuleSetAnalyzer> create();
- GraphicsLayerDebugInfo* clone() const;
+ void collectFeaturesFromRuleData(RuleFeatureSet& features, const RuleData&);
+ void combine(const RuleSetAnalyzer& other);
- void setDebugName(const String& name) { m_debugName = name; }
- CompositingReasons compositingReasons() const { return m_compositingReasons; }
- void setCompositingReasons(CompositingReasons reasons) { m_compositingReasons = reasons; }
- Vector<LayoutRect>& currentLayoutRects() { return m_currentLayoutRects; }
+ bool scheduleClassInvalidationForElement(const AtomicString& className, Element*);
+ void recalcInvalidation(Document*);
+ bool needsInvalidation(const Element*) const;
private:
- void appendLayoutRects(JSONObject*) const;
- void appendCompositingReasons(JSONObject*) const;
- void appendDebugName(JSONObject*) const;
+ RuleSetAnalyzer();
+ typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > InvalidationSetMap;
+ typedef Vector<DescendantInvalidationSet*> InvalidationVec;
+ typedef HashMap<Element*, InvalidationVec* > PendingInvalidationMap;
+
+ DescendantInvalidationSet* ensureClassInvalidationSet(const AtomicString& className);
+
+ bool updateClassInvalidationSets(const CSSSelector*);
+
+ bool recalcInvalidationInternal(Element*, Vector<AtomicString>&, bool foundInvalidationSet);
+ bool recalcInvalidationInternalForShadowRoot(ShadowRoot*, Vector<AtomicString>& invalidationClasses, bool foundInvalidationSet);
+
+ InvalidationVec* ensurePendingInvalidationVector(Element*);
+
+ InvalidationSetMap classInvalidationSets;
- String m_debugName;
- CompositingReasons m_compositingReasons;
- Vector<LayoutRect> m_currentLayoutRects;
+
+ PendingInvalidationMap m_pendingInvalidationMap;
};
} // namespace WebCore
-#endif
+#endif // RuleSetAnalyzer_h
« no previous file with comments | « Source/core/css/analyzer/DescendantInvalidationSet.cpp ('k') | Source/core/css/analyzer/RuleSetAnalyzer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698