| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/inspector/LayoutEditor.h" | 6 #include "core/inspector/LayoutEditor.h" |
| 7 | 7 |
| 8 #include "core/css/CSSComputedStyleDeclaration.h" | 8 #include "core/css/CSSComputedStyleDeclaration.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/inspector/InspectorCSSAgent.h" | 10 #include "core/inspector/InspectorCSSAgent.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return cssValue; | 142 return cssValue; |
| 143 } | 143 } |
| 144 | 144 |
| 145 PassRefPtr<JSONObject> LayoutEditor::createValueDescription(const String& proper
tyName) const | 145 PassRefPtr<JSONObject> LayoutEditor::createValueDescription(const String& proper
tyName) const |
| 146 { | 146 { |
| 147 NullableCSSValue cssValue = getPropertyCSSValue(cssPropertyID(propertyName))
; | 147 NullableCSSValue cssValue = getPropertyCSSValue(cssPropertyID(propertyName))
; |
| 148 if (!cssValue) | 148 if (!cssValue) |
| 149 return nullptr; | 149 return nullptr; |
| 150 | 150 |
| 151 RefPtr<JSONObject> object = JSONObject::create(); | 151 RefPtr<JSONObject> object = JSONObject::create(); |
| 152 object->setNumber("value", toCSSPrimitiveValue(*cssValue).getFloatValue()); | 152 object->setNumber("value", toCSSPrimitiveValue(cssValue).getFloatValue()); |
| 153 object->setString("unit", "px"); | 153 object->setString("unit", "px"); |
| 154 return object.release(); | 154 return object.release(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void LayoutEditor::overlayStartedPropertyChange(const String& anchorName) | 157 void LayoutEditor::overlayStartedPropertyChange(const String& anchorName) |
| 158 { | 158 { |
| 159 m_changingProperty = cssPropertyID(anchorName); | 159 m_changingProperty = cssPropertyID(anchorName); |
| 160 if (!m_node || !m_changingProperty) | 160 if (!m_node || !m_changingProperty) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 NullableCSSValue cssValue = getPropertyCSSValue(m_changingProperty); | 163 NullableCSSValue cssValue = getPropertyCSSValue(m_changingProperty); |
| 164 if (!cssValue) { | 164 if (!cssValue) { |
| 165 m_changingProperty = CSSPropertyInvalid; | 165 m_changingProperty = CSSPropertyInvalid; |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 | 168 |
| 169 m_propertyInitialValue = toCSSPrimitiveValue(*cssValue).getFloatValue(); | 169 m_propertyInitialValue = toCSSPrimitiveValue(cssValue).getFloatValue(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void LayoutEditor::overlayPropertyChanged(float cssDelta) | 172 void LayoutEditor::overlayPropertyChanged(float cssDelta) |
| 173 { | 173 { |
| 174 if (m_changingProperty && m_node->isElementNode()) { | 174 if (m_changingProperty && m_node->isElementNode()) { |
| 175 String errorString; | 175 String errorString; |
| 176 m_cssAgent->setCSSPropertyValue(&errorString, toElement(m_node.get()), m
_changingProperty, String::number(cssDelta + m_propertyInitialValue) + "px"); | 176 m_cssAgent->setCSSPropertyValue(&errorString, toElement(m_node.get()), m
_changingProperty, String::number(cssDelta + m_propertyInitialValue) + "px"); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 void LayoutEditor::overlayEndedPropertyChange() | 180 void LayoutEditor::overlayEndedPropertyChange() |
| 181 { | 181 { |
| 182 m_changingProperty = CSSPropertyInvalid; | 182 m_changingProperty = CSSPropertyInvalid; |
| 183 m_propertyInitialValue = 0; | 183 m_propertyInitialValue = 0; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |