OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef GraphicsLayerDebugInfo_h | 31 #ifndef RuleSetAnalyzer_h |
32 #define GraphicsLayerDebugInfo_h | 32 #define RuleSetAnalyzer_h |
33 | 33 |
34 #include "platform/JSONValues.h" | 34 #include "core/css/analyzer/DescendantInvalidationSet.h" |
35 #include "platform/geometry/LayoutRect.h" | 35 #include "wtf/RefCounted.h" |
36 #include "platform/graphics/CompositingReasons.h" | |
37 #include "public/platform/WebGraphicsLayerDebugInfo.h" | |
38 | |
39 #include "wtf/Vector.h" | |
40 | 36 |
41 namespace WebCore { | 37 namespace WebCore { |
42 | 38 |
43 class GraphicsLayerDebugInfo FINAL : public blink::WebGraphicsLayerDebugInfo { | 39 class CSSSelector; |
| 40 class Document; |
| 41 class RuleFeatureSet; |
| 42 class RuleData; |
| 43 class ShadowRoot; |
| 44 |
| 45 // Keeps track of information about a set of CSS rules in order to answer style
questions about them. |
| 46 class RuleSetAnalyzer : public RefCounted<RuleSetAnalyzer> { |
44 public: | 47 public: |
45 GraphicsLayerDebugInfo(); | 48 static PassRefPtr<RuleSetAnalyzer> create(); |
46 virtual ~GraphicsLayerDebugInfo(); | |
47 | 49 |
48 virtual void appendAsTraceFormat(blink::WebString* out) const OVERRIDE; | 50 void collectFeaturesFromRuleData(RuleFeatureSet& features, const RuleData&); |
| 51 void combine(const RuleSetAnalyzer& other); |
49 | 52 |
50 GraphicsLayerDebugInfo* clone() const; | 53 bool scheduleClassInvalidationForElement(const AtomicString& className, Elem
ent*); |
| 54 void recalcInvalidation(Document*); |
51 | 55 |
52 void setDebugName(const String& name) { m_debugName = name; } | 56 bool needsInvalidation(const Element*) const; |
53 CompositingReasons compositingReasons() const { return m_compositingReasons;
} | 57 private: |
54 void setCompositingReasons(CompositingReasons reasons) { m_compositingReason
s = reasons; } | 58 RuleSetAnalyzer(); |
55 Vector<LayoutRect>& currentLayoutRects() { return m_currentLayoutRects; } | 59 typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > Invalidati
onSetMap; |
| 60 typedef Vector<DescendantInvalidationSet*> InvalidationVec; |
| 61 typedef HashMap<Element*, InvalidationVec* > PendingInvalidationMap; |
56 | 62 |
57 private: | 63 DescendantInvalidationSet* ensureClassInvalidationSet(const AtomicString& cl
assName); |
58 void appendLayoutRects(JSONObject*) const; | |
59 void appendCompositingReasons(JSONObject*) const; | |
60 void appendDebugName(JSONObject*) const; | |
61 | 64 |
62 String m_debugName; | 65 bool updateClassInvalidationSets(const CSSSelector*); |
63 CompositingReasons m_compositingReasons; | 66 |
64 Vector<LayoutRect> m_currentLayoutRects; | 67 bool recalcInvalidationInternal(Element*, Vector<AtomicString>&, bool foundI
nvalidationSet); |
| 68 bool recalcInvalidationInternalForShadowRoot(ShadowRoot*, Vector<AtomicStrin
g>& invalidationClasses, bool foundInvalidationSet); |
| 69 |
| 70 InvalidationVec* ensurePendingInvalidationVector(Element*); |
| 71 |
| 72 InvalidationSetMap classInvalidationSets; |
| 73 |
| 74 |
| 75 PendingInvalidationMap m_pendingInvalidationMap; |
65 }; | 76 }; |
66 | 77 |
67 } // namespace WebCore | 78 } // namespace WebCore |
68 | 79 |
69 #endif | 80 #endif // RuleSetAnalyzer_h |
OLD | NEW |