Add api for retrieving computed padding

Summary: Add API for retrieving the computed final padding of a node. Many frameworks such as React Native retrieve padding via `YGNodeStyleGetPadding` but given that we now support percentage values this is not correct anymore.

Differential Revision: D4376572

fbshipit-source-id: 3ffb66e77090fc1257511bec5c933f9b0c304b9f
This commit is contained in:
Emil Sjolander
2017-01-05 12:48:07 -08:00
committed by Facebook Github Bot
parent a36faf89e3
commit bf5eeaf61e
3 changed files with 68 additions and 4 deletions

View File

@@ -191,6 +191,12 @@ YG_NODE_LAYOUT_PROPERTY(float, Width);
YG_NODE_LAYOUT_PROPERTY(float, Height);
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
// Get the computed padding for this node after performing layout. If padding was set using
// pixel values then the returned value will be the same as YGNodeStyleGetPadding. However if
// padding was set using a percentage value then the returned value is the computed value used
// during layout.
WIN_EXPORT float YGNodeLayoutGetPadding(const YGNodeRef node, const YGEdge edge);
WIN_EXPORT void YGSetLogger(YGLogger logger);
WIN_EXPORT void YGLog(YGLogLevel level, const char *message, ...);