mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
BREAKING - Make first parameter of measure and print functions CSSNodeRef instead of just context
Reviewed By: javache Differential Revision: D4081544 fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
This commit is contained in:
parent
553f4371e0
commit
8e69a9f695
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user