OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LayoutEditor_h | 5 #ifndef LayoutEditor_h |
6 #define LayoutEditor_h | 6 #define LayoutEditor_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
| 11 #include "core/css/CSSStyleRule.h" |
11 #include "core/dom/Element.h" | 12 #include "core/dom/Element.h" |
12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
13 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
14 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
15 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class CSSPrimitiveValue; | 20 class CSSPrimitiveValue; |
20 class InspectorCSSAgent; | 21 class InspectorCSSAgent; |
21 class InspectorDOMAgent; | 22 class InspectorDOMAgent; |
22 class JSONArray; | 23 class JSONArray; |
23 class JSONObject; | 24 class JSONObject; |
24 | 25 |
25 class CORE_EXPORT LayoutEditor final : public NoBaseWillBeGarbageCollectedFinali
zed<LayoutEditor> { | 26 class CORE_EXPORT LayoutEditor final : public NoBaseWillBeGarbageCollectedFinali
zed<LayoutEditor> { |
26 public: | 27 public: |
27 static PassOwnPtrWillBeRawPtr<LayoutEditor> create(InspectorCSSAgent* cssAge
nt, InspectorDOMAgent* domAgent) | 28 static PassOwnPtrWillBeRawPtr<LayoutEditor> create(InspectorCSSAgent* cssAge
nt, InspectorDOMAgent* domAgent) |
28 { | 29 { |
29 return adoptPtrWillBeNoop(new LayoutEditor(cssAgent, domAgent)); | 30 return adoptPtrWillBeNoop(new LayoutEditor(cssAgent, domAgent)); |
30 } | 31 } |
31 | 32 |
32 void selectNode(Node*); | 33 void selectNode(Node*); |
33 Node* node() { return m_element.get(); } | 34 Node* node() { return m_element.get(); } |
34 PassRefPtr<JSONObject> buildJSONInfo() const; | 35 PassRefPtr<JSONObject> buildJSONInfo() const; |
35 void overlayStartedPropertyChange(const String&); | 36 void overlayStartedPropertyChange(const String&); |
36 void overlayPropertyChanged(float); | 37 void overlayPropertyChanged(float); |
37 void overlayEndedPropertyChange(); | 38 void overlayEndedPropertyChange(); |
38 void clearSelection(bool); | 39 void clearSelection(bool); |
| 40 void nextSelector(); |
| 41 void previousSelector(); |
| 42 String currentSelectorInfo(); |
39 | 43 |
40 DECLARE_TRACE(); | 44 DECLARE_TRACE(); |
41 | 45 |
42 private: | 46 private: |
43 LayoutEditor(InspectorCSSAgent*, InspectorDOMAgent*); | 47 LayoutEditor(InspectorCSSAgent*, InspectorDOMAgent*); |
44 RefPtrWillBeRawPtr<CSSPrimitiveValue> getPropertyCSSValue(CSSPropertyID) con
st; | 48 RefPtrWillBeRawPtr<CSSPrimitiveValue> getPropertyCSSValue(CSSPropertyID) con
st; |
45 PassRefPtr<JSONObject> createValueDescription(const String&) const; | 49 PassRefPtr<JSONObject> createValueDescription(const String&) const; |
46 void appendAnchorFor(JSONArray*, const String&, const String&, const FloatPo
int&, const FloatPoint&) const; | 50 void appendAnchorFor(JSONArray*, const String&, const String&, const FloatPo
int&, const FloatPoint&) const; |
| 51 void initializeCSSRules(); |
47 | 52 |
48 RefPtrWillBeMember<Element> m_element; | 53 RefPtrWillBeMember<Element> m_element; |
49 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; | 54 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; |
50 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; | 55 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; |
51 CSSPropertyID m_changingProperty; | 56 CSSPropertyID m_changingProperty; |
52 float m_propertyInitialValue; | 57 float m_propertyInitialValue; |
53 float m_factor; | 58 float m_factor; |
54 CSSPrimitiveValue::UnitType m_valueUnitType; | 59 CSSPrimitiveValue::UnitType m_valueUnitType; |
55 bool m_isDirty; | 60 bool m_isDirty; |
| 61 |
| 62 WillBeHeapVector<RefPtrWillBeMember<CSSStyleRule>> m_matchedRules; |
| 63 HashMap<int, String> m_cachedSelectorsInfo; |
| 64 // -1 means "inline style". |
| 65 int m_currentRuleIndex; |
56 }; | 66 }; |
57 | 67 |
58 } // namespace blink | 68 } // namespace blink |
59 | 69 |
60 | 70 |
61 #endif // !defined(LayoutEditor_h) | 71 #endif // !defined(LayoutEditor_h) |
OLD | NEW |