diff --git a/Libraries/Text/RCTShadowText.m b/Libraries/Text/RCTShadowText.m index 00abb11fd..99ed6703e 100644 --- a/Libraries/Text/RCTShadowText.m +++ b/Libraries/Text/RCTShadowText.m @@ -38,9 +38,9 @@ CGFloat const RCTTextAutoSizeGranularity = 0.001f; CGFloat _effectiveLetterSpacing; } -static CSSSize RCTMeasure(void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) +static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) { - RCTShadowText *shadowText = (__bridge RCTShadowText *)context; + RCTShadowText *shadowText = (__bridge RCTShadowText *)CSSNodeGetContext(node); NSTextStorage *textStorage = [shadowText buildTextStorageForWidth:width widthMode:widthMode]; [shadowText calculateTextFrame:textStorage]; NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; @@ -476,7 +476,7 @@ static CSSSize RCTMeasure(void *context, float width, CSSMeasureMode widthMode, { CGRect textFrame = UIEdgeInsetsInsetRect((CGRect){CGPointZero, self.frame.size}, self.paddingAsInsets); - + if (_adjustsFontSizeToFit) { textFrame = [self updateStorage:textStorage toFitFrame:textFrame]; diff --git a/React/CSSLayout/CSSLayout.c b/React/CSSLayout/CSSLayout.c index 1cacc9934..9822e78c8 100644 --- a/React/CSSLayout/CSSLayout.c +++ b/React/CSSLayout/CSSLayout.c @@ -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), diff --git a/React/CSSLayout/CSSLayout.h b/React/CSSLayout/CSSLayout.h index 0dd3f1ca5..75e1e05c6 100644 --- a/React/CSSLayout/CSSLayout.h +++ b/React/CSSLayout/CSSLayout.h @@ -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 diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index 5a8dd827b..36296f74f 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -50,9 +50,9 @@ typedef NS_ENUM(unsigned int, meta_prop_t) { // cssNode api -static void RCTPrint(void *context) +static void RCTPrint(CSSNodeRef node) { - RCTShadowView *shadowView = (__bridge RCTShadowView *)context; + RCTShadowView *shadowView = (__bridge RCTShadowView *)CSSNodeGetContext(node); printf("%s(%zd), ", shadowView.viewName.UTF8String, shadowView.reactTag.integerValue); }