Introduce CSSLayoutSetLogger to pass the print result to C# side

Summary:
- CSSLayoutSetLogger
  - Problem: Unity or other logging system can't use printf output
  - Solution: Add CSSLogger to pass CSSNodePrint result to UnityEngine.Debug.Log or other logging system via CSSLogger function for debugging purpose

Reviewed By: emilsjolander

Differential Revision: D4027044

fbshipit-source-id: 90e2e449260888770f71fa7ea790ca9764d91c44
This commit is contained in:
Kazuki Sakamoto
2016-10-19 11:01:24 -07:00
committed by Facebook Github Bot
parent e4ad7d3c12
commit daed6f5b8a
11 changed files with 347 additions and 229 deletions

View File

@@ -11,6 +11,7 @@
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -121,6 +122,7 @@ typedef CSSSize (*CSSMeasureFunc)(void *context,
float height,
CSSMeasureMode heightMode);
typedef void (*CSSPrintFunc)(void *context);
typedef int (*CSSLogger)(const char *format, ...);
#ifdef CSS_ASSERT_FAIL_ENABLED
typedef void (*CSSAssertFailFunc)(const char *message);
@@ -210,6 +212,8 @@ CSS_NODE_LAYOUT_PROPERTY(float, Width);
CSS_NODE_LAYOUT_PROPERTY(float, Height);
CSS_NODE_LAYOUT_PROPERTY(CSSDirection, Direction);
WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger);
#ifdef CSS_ASSERT_FAIL_ENABLED
// Assert
WIN_EXPORT void CSSAssertSetFailFunc(CSSAssertFailFunc func);