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/dom/Node.h" | 11 #include "core/dom/Element.h" |
| 12 #include "core/inspector/InspectorHighlight.h" |
12 #include "core/inspector/InspectorOverlayHost.h" | 13 #include "core/inspector/InspectorOverlayHost.h" |
13 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
14 #include "wtf/PassOwnPtr.h" | 15 #include "wtf/PassOwnPtr.h" |
15 #include "wtf/RefPtr.h" | 16 #include "wtf/RefPtr.h" |
16 #include "wtf/text/WTFString.h" | 17 #include "wtf/text/WTFString.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 class CSSPrimitiveValue; | 21 class CSSPrimitiveValue; |
21 class InspectorCSSAgent; | 22 class InspectorCSSAgent; |
| 23 class InspectorDOMAgent; |
22 class JSONArray; | 24 class JSONArray; |
23 class JSONObject; | 25 class JSONObject; |
24 | 26 |
25 class CORE_EXPORT LayoutEditor final: public NoBaseWillBeGarbageCollectedFinaliz
ed<LayoutEditor>, public InspectorOverlayHost::LayoutEditorListener { | 27 class CORE_EXPORT LayoutEditor final: public NoBaseWillBeGarbageCollectedFinaliz
ed<LayoutEditor>, public InspectorOverlayHost::LayoutEditorListener { |
26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LayoutEditor); | 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LayoutEditor); |
27 public: | 29 public: |
28 static PassOwnPtrWillBeRawPtr<LayoutEditor> create(InspectorCSSAgent* cssAge
nt) | 30 static PassOwnPtrWillBeRawPtr<LayoutEditor> create(InspectorCSSAgent* cssAge
nt, InspectorDOMAgent* domAgent) |
29 { | 31 { |
30 return adoptPtrWillBeNoop(new LayoutEditor(cssAgent)); | 32 return adoptPtrWillBeNoop(new LayoutEditor(cssAgent, domAgent)); |
31 } | 33 } |
32 | 34 |
33 void setNode(Node*); | 35 void setNode(Node*); |
| 36 Node* node() { return m_element.get(); } |
34 PassRefPtr<JSONObject> buildJSONInfo() const; | 37 PassRefPtr<JSONObject> buildJSONInfo() const; |
35 | 38 void setHighlightConfig(const InspectorHighlightConfig& highlightConfig) { m
_highlightConfig = adoptPtr(new InspectorHighlightConfig(highlightConfig)); } |
| 39 InspectorHighlightConfig& highlightConfig() { return *m_highlightConfig.get(
); } |
36 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
37 | 41 |
38 private: | 42 private: |
39 explicit LayoutEditor(InspectorCSSAgent*); | 43 LayoutEditor(InspectorCSSAgent*, InspectorDOMAgent*); |
40 RefPtrWillBeRawPtr<CSSPrimitiveValue> getPropertyCSSValue(CSSPropertyID) con
st; | 44 RefPtrWillBeRawPtr<CSSPrimitiveValue> getPropertyCSSValue(CSSPropertyID) con
st; |
41 PassRefPtr<JSONObject> createValueDescription(const String&) const; | 45 PassRefPtr<JSONObject> createValueDescription(const String&) const; |
42 void appendAnchorFor(JSONArray*, const String&, const String&, const FloatPo
int&, const FloatPoint&) const; | 46 void appendAnchorFor(JSONArray*, const String&, const String&, const FloatPo
int&, const FloatPoint&) const; |
43 | 47 |
44 // InspectorOverlayHost::LayoutEditorListener implementation. | 48 // InspectorOverlayHost::LayoutEditorListener implementation. |
45 void overlayStartedPropertyChange(const String&) override; | 49 void overlayStartedPropertyChange(const String&) override; |
46 void overlayPropertyChanged(float) override; | 50 void overlayPropertyChanged(float) override; |
47 void overlayEndedPropertyChange() override; | 51 void overlayEndedPropertyChange() override; |
| 52 void clearSelection(bool) override; |
48 | 53 |
49 RefPtrWillBeMember<Element> m_element; | 54 RefPtrWillBeMember<Element> m_element; |
50 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; | 55 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; |
| 56 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; |
51 CSSPropertyID m_changingProperty; | 57 CSSPropertyID m_changingProperty; |
52 float m_propertyInitialValue; | 58 float m_propertyInitialValue; |
53 float m_factor; | 59 float m_factor; |
54 CSSPrimitiveValue::UnitType m_valueUnitType; | 60 CSSPrimitiveValue::UnitType m_valueUnitType; |
| 61 bool m_isDirty; |
| 62 OwnPtr<InspectorHighlightConfig> m_highlightConfig; |
55 }; | 63 }; |
56 | 64 |
57 } // namespace blink | 65 } // namespace blink |
58 | 66 |
59 | 67 |
60 #endif // !defined(LayoutEditor_h) | 68 #endif // !defined(LayoutEditor_h) |
OLD | NEW |