BREAKING - Make first parameter of measure and print functions CSSNodeRef instead of just context
Summary: To perform some JNI optimizations for java we need a reference to the node in the measure function. This updates the API to provide the whole node as input instead of just the context. Reviewed By: javache Differential Revision: D4081544 fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
This commit is contained in:
committed by
Facebook Github Bot
parent
b59ce09109
commit
46823878a5
@@ -456,7 +456,7 @@ static void _CSSNodePrint(const CSSNodeRef node,
|
||||
gLogger("{");
|
||||
|
||||
if (node->print) {
|
||||
node->print(node->context);
|
||||
node->print(node);
|
||||
}
|
||||
|
||||
if (options & CSSPrintOptionsLayout) {
|
||||
@@ -1263,7 +1263,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
||||
} else {
|
||||
// Measure the text under the current constraints.
|
||||
const CSSSize measuredSize =
|
||||
node->measure(node->context, innerWidth, widthMeasureMode, innerHeight, heightMeasureMode);
|
||||
node->measure(node, innerWidth, widthMeasureMode, innerHeight, heightMeasureMode);
|
||||
|
||||
node->layout.measuredDimensions[CSSDimensionWidth] =
|
||||
boundAxis(node,
|
||||
@@ -2284,7 +2284,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
if (gPrintChanges && gPrintSkips) {
|
||||
printf("%s%d.{[skipped] ", getSpacer(gDepth), gDepth);
|
||||
if (node->print) {
|
||||
node->print(node->context);
|
||||
node->print(node);
|
||||
}
|
||||
printf("wm: %s, hm: %s, aw: %f ah: %f => d: (%f, %f) %s\n",
|
||||
getModeName(widthMeasureMode, performLayout),
|
||||
@@ -2299,7 +2299,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
if (gPrintChanges) {
|
||||
printf("%s%d.{%s", getSpacer(gDepth), gDepth, needToVisitNode ? "*" : "");
|
||||
if (node->print) {
|
||||
node->print(node->context);
|
||||
node->print(node);
|
||||
}
|
||||
printf("wm: %s, hm: %s, aw: %f ah: %f %s\n",
|
||||
getModeName(widthMeasureMode, performLayout),
|
||||
@@ -2320,7 +2320,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
if (gPrintChanges) {
|
||||
printf("%s%d.}%s", getSpacer(gDepth), gDepth, needToVisitNode ? "*" : "");
|
||||
if (node->print) {
|
||||
node->print(node->context);
|
||||
node->print(node);
|
||||
}
|
||||
printf("wm: %s, hm: %s, d: (%f, %f) %s\n",
|
||||
getModeName(widthMeasureMode, performLayout),
|
||||
|
@@ -116,12 +116,12 @@ typedef struct CSSSize {
|
||||
} CSSSize;
|
||||
|
||||
typedef struct CSSNode *CSSNodeRef;
|
||||
typedef CSSSize (*CSSMeasureFunc)(void *context,
|
||||
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
typedef void (*CSSPrintFunc)(void *context);
|
||||
typedef void (*CSSPrintFunc)(CSSNodeRef node);
|
||||
typedef int (*CSSLogger)(const char *format, ...);
|
||||
|
||||
#ifdef CSS_ASSERT_FAIL_ENABLED
|
||||
|
Reference in New Issue
Block a user