Fabric: Improved parsing EdgeInsets and CornerInsets styles
Summary: In case if it's just a number, it is treated as unified insets now. Reviewed By: mdvacca Differential Revision: D8473510 fbshipit-source-id: 1034377bc3e4abe55778c2f182360345419f00d5
This commit is contained in:
parent
c1e0ea9d38
commit
d92601be05
|
@ -84,6 +84,11 @@ inline void fromDynamic(const folly::dynamic &value, Size &result) {
|
|||
}
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, EdgeInsets &result) {
|
||||
if (value.isNumber()) {
|
||||
const Float number = value.asDouble();
|
||||
result = EdgeInsets {number, number, number, number};
|
||||
return;
|
||||
}
|
||||
if (value.isObject()) {
|
||||
result = EdgeInsets {
|
||||
(Float)value["top"].asDouble(),
|
||||
|
@ -106,6 +111,11 @@ inline void fromDynamic(const folly::dynamic &value, EdgeInsets &result) {
|
|||
}
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, CornerInsets &result) {
|
||||
if (value.isNumber()) {
|
||||
const Float number = value.asDouble();
|
||||
result = CornerInsets {number, number, number, number};
|
||||
return;
|
||||
}
|
||||
if (value.isObject()) {
|
||||
result = CornerInsets {
|
||||
(Float)value["topLeft"].asDouble(),
|
||||
|
|
Loading…
Reference in New Issue