Introducing .NET version of css-layout using P/Invoke

Summary:
This version of the css-layout project includes support for .NET projects.  Up in the air is how many configurations of .NET projects we allow for, such as Portable Class Libraries, Universal Windows Platform, .NET Core, etc.  Still needs integration with Buck.
Closes https://github.com/facebook/css-layout/pull/220

Reviewed By: lucasr

Differential Revision: D3909367

Pulled By: emilsjolander

fbshipit-source-id: aaaa9c4ff2d3452649f256c3268cf873cf33a0b9
This commit is contained in:
mattpodwysocki 2016-09-22 16:22:34 -07:00 committed by Facebook Github Bot 3
parent 727b7dffb4
commit 2da08884b2
2 changed files with 25 additions and 19 deletions

View File

@ -122,16 +122,16 @@ typedef CSSSize (*CSSMeasureFunc)(void *context,
typedef void (*CSSPrintFunc)(void *context);
// CSSNode
CSSNodeRef CSSNodeNew();
void CSSNodeInit(const CSSNodeRef node);
void CSSNodeFree(const CSSNodeRef node);
WIN_EXPORT CSSNodeRef CSSNodeNew();
WIN_EXPORT void CSSNodeInit(const CSSNodeRef node);
WIN_EXPORT void CSSNodeFree(const CSSNodeRef node);
void CSSNodeInsertChild(const CSSNodeRef node, const CSSNodeRef child, const uint32_t index);
void CSSNodeRemoveChild(const CSSNodeRef node, const CSSNodeRef child);
CSSNodeRef CSSNodeGetChild(const CSSNodeRef node, const uint32_t index);
uint32_t CSSNodeChildCount(const CSSNodeRef node);
WIN_EXPORT void CSSNodeInsertChild(const CSSNodeRef node, const CSSNodeRef child, const uint32_t index);
WIN_EXPORT void CSSNodeRemoveChild(const CSSNodeRef node, const CSSNodeRef child);
WIN_EXPORT CSSNodeRef CSSNodeGetChild(const CSSNodeRef node, const uint32_t index);
WIN_EXPORT uint32_t CSSNodeChildCount(const CSSNodeRef node);
void CSSNodeCalculateLayout(const CSSNodeRef node,
WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
const float availableWidth,
const float availableHeight,
const CSSDirection parentDirection);
@ -142,26 +142,26 @@ void CSSNodeCalculateLayout(const CSSNodeRef node,
// measure functions
// depends on information not known to CSSLayout they must perform this dirty
// marking manually.
void CSSNodeMarkDirty(const CSSNodeRef node);
bool CSSNodeIsDirty(const CSSNodeRef node);
WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node);
WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node);
void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options);
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options);
bool CSSValueIsUndefined(const float value);
WIN_EXPORT bool CSSValueIsUndefined(const float value);
#define CSS_NODE_PROPERTY(type, name, paramName) \
void CSSNodeSet##name(const CSSNodeRef node, type paramName); \
type CSSNodeGet##name(const CSSNodeRef node);
WIN_EXPORT void CSSNodeSet##name(const CSSNodeRef node, type paramName); \
WIN_EXPORT type CSSNodeGet##name(const CSSNodeRef node);
#define CSS_NODE_STYLE_PROPERTY(type, name, paramName) \
void CSSNodeStyleSet##name(const CSSNodeRef node, const type paramName); \
type CSSNodeStyleGet##name(const CSSNodeRef node);
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, const type paramName); \
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node);
#define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
void CSSNodeStyleSet##name(const CSSNodeRef node, const CSSEdge edge, const type paramName); \
type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge);
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, const CSSEdge edge, const type paramName); \
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge);
#define CSS_NODE_LAYOUT_PROPERTY(type, name) type CSSNodeLayoutGet##name(const CSSNodeRef node);
#define CSS_NODE_LAYOUT_PROPERTY(type, name) WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node);
CSS_NODE_PROPERTY(void *, Context, context);
CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc);

View File

@ -17,6 +17,12 @@
#define CSS_EXTERN_C_END
#endif
#ifdef _WINDLL
#define WIN_EXPORT __declspec(dllexport)
#else
#define WIN_EXPORT
#endif
#ifndef FB_ASSERTIONS_ENABLED
#define FB_ASSERTIONS_ENABLED 1
#endif