PassRefPtr<JSONObject> LayoutEditor::createValueDescription(const String& propertyName) { RefPtrWillBeRawPtr<CSSPrimitiveValue> cssValue = getPropertyCSSValue(cssPropertyID(propertyName)); if (cssValue && !(cssValue->isLength() || cssValue->isPercentage())) return nullptr; RefPtr<JSONObject> object = JSONObject::create(); object->setNumber("value", cssValue ? cssValue->getFloatValue() : 0); CSSPrimitiveValue::UnitType unitType = cssValue ? cssValue->typeWithCalcResolved() : CSSPrimitiveValue::UnitType::Pixels; object->setString("unit", CSSPrimitiveValue::unitTypeToString(unitType)); object->setBoolean("mutable", isMutableUnitType(unitType)); if (!m_growsInside.contains(propertyName)) m_growsInside.set(propertyName, growInside(propertyName, cssValue.get())); object->setBoolean("growInside", m_growsInside.get(propertyName)); return object.release(); }
std::unique_ptr<protocol::DictionaryValue> LayoutEditor::createValueDescription( const String& propertyName) { const CSSPrimitiveValue* cssValue = getPropertyCSSValue(cssPropertyID(propertyName)); if (cssValue && !(cssValue->isLength() || cssValue->isPercentage())) return nullptr; std::unique_ptr<protocol::DictionaryValue> object = protocol::DictionaryValue::create(); object->setDouble("value", cssValue ? cssValue->getFloatValue() : 0); CSSPrimitiveValue::UnitType unitType = cssValue ? cssValue->typeWithCalcResolved() : CSSPrimitiveValue::UnitType::Pixels; object->setString("unit", CSSPrimitiveValue::unitTypeToString(unitType)); object->setBoolean("mutable", isMutableUnitType(unitType)); if (!m_growsInside.contains(propertyName)) m_growsInside.set(propertyName, growInside(propertyName, cssValue)); object->setBoolean("growInside", m_growsInside.get(propertyName)); return object; }