forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct LayoutMetrics comparison and make debuggable
Summary: Allow conversion of LayoutMetrics to DebuggableString. We also skipped a field in comparison. It probably isn't impactful in terms of production issues, but still wasn't correct. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D27709451 fbshipit-source-id: 987fc2de0a4562a295d6cbeffdd922cbf056b811
- Loading branch information
1 parent
60a18c1
commit 88c3090
Showing
5 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <react/renderer/debug/DebugStringConvertible.h> | ||
#include <react/renderer/debug/flags.h> | ||
|
||
#include "LayoutMetrics.h" | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
#if RN_DEBUG_STRING_CONVERTIBLE | ||
|
||
std::string getDebugName(LayoutMetrics const &object) { | ||
return "LayoutMetrics"; | ||
} | ||
|
||
std::vector<DebugStringConvertibleObject> getDebugProps( | ||
LayoutMetrics const &object, | ||
DebugStringConvertibleOptions options) { | ||
return { | ||
{"frame", | ||
"{x:" + getDebugDescription(object.frame.origin.x, {}) + | ||
",y:" + getDebugDescription(object.frame.origin.y, {}) + | ||
",width:" + getDebugDescription(object.frame.size.width, {}) + | ||
",height:" + getDebugDescription(object.frame.size.height, {}) + | ||
"}"}, | ||
{"contentInsets", | ||
"{top:" + getDebugDescription(object.contentInsets.top, {}) + | ||
",right:" + getDebugDescription(object.contentInsets.right, {}) + | ||
",bottom:" + getDebugDescription(object.contentInsets.bottom, {}) + | ||
",left:" + getDebugDescription(object.contentInsets.left, {}) + "}"}, | ||
{"borderWidth", | ||
"{top:" + getDebugDescription(object.borderWidth.top, {}) + | ||
",right:" + getDebugDescription(object.borderWidth.right, {}) + | ||
",bottom:" + getDebugDescription(object.borderWidth.bottom, {}) + | ||
",left:" + getDebugDescription(object.borderWidth.left, {}) + "}"}, | ||
{"overflowInset", | ||
"{top:" + getDebugDescription(object.overflowInset.top, {}) + | ||
",right:" + getDebugDescription(object.overflowInset.right, {}) + | ||
",bottom:" + getDebugDescription(object.overflowInset.bottom, {}) + | ||
",left:" + getDebugDescription(object.overflowInset.left, {}) + "}"}, | ||
{"displayType", | ||
object.displayType == DisplayType::None | ||
? "None" | ||
: (object.displayType == DisplayType::Flex ? "Flex" : "Inline")}, | ||
{"layoutDirection", | ||
object.layoutDirection == LayoutDirection::Undefined | ||
? "Undefined" | ||
: (object.layoutDirection == LayoutDirection::LeftToRight | ||
? "LeftToRight" | ||
: "RightToLeft")}, | ||
{"pointScaleFactor", | ||
getDebugDescription(object.pointScaleFactor, options)}, | ||
}; | ||
} | ||
|
||
#endif | ||
|
||
} // namespace react | ||
} // namespace facebook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters