From 102577565abb97530d73ec516daf8eb1c9120f33 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Wed, 20 Jul 2016 02:49:09 -0700 Subject: [PATCH] Remove fillCSSNode method Summary: fillCSSNode was only ever used in RCTShadowView to set the child count which is already performed in insert/remove subview calls and in RCTShadowText is was used to set the measure function which can be done in the initializer instead. Reviewed By: majak, javache Differential Revision: D3586418 fbshipit-source-id: de2155daf0f1702c8977bf23183a3b6a650d016b --- Libraries/Text/RCTShadowText.m | 8 +------- React/Views/RCTRootShadowView.m | 1 - React/Views/RCTShadowView.h | 1 - React/Views/RCTShadowView.m | 8 -------- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/Libraries/Text/RCTShadowText.m b/Libraries/Text/RCTShadowText.m index 32e73997f..edc8d0a8c 100644 --- a/Libraries/Text/RCTShadowText.m +++ b/Libraries/Text/RCTShadowText.m @@ -61,6 +61,7 @@ static css_dim_t RCTMeasure(void *context, float width, css_measure_mode_t width _cachedTextStorageWidth = -1; _cachedTextStorageWidthMode = -1; _fontSizeMultiplier = 1.0; + self.cssNode->measure = RCTMeasure; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contentSizeMultiplierDidChange:) name:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification @@ -442,13 +443,6 @@ static css_dim_t RCTMeasure(void *context, float width, css_measure_mode_t width } } -- (void)fillCSSNode:(css_node_t *)node -{ - [super fillCSSNode:node]; - node->measure = RCTMeasure; - node->children_count = 0; -} - - (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex { [super insertReactSubview:subview atIndex:atIndex]; diff --git a/React/Views/RCTRootShadowView.m b/React/Views/RCTRootShadowView.m index e01235896..965025e28 100644 --- a/React/Views/RCTRootShadowView.m +++ b/React/Views/RCTRootShadowView.m @@ -49,7 +49,6 @@ { [self applySizeConstraints]; - [self fillCSSNode:self.cssNode]; layoutNode(self.cssNode, CSS_UNDEFINED, CSS_UNDEFINED, CSS_DIRECTION_INHERIT); NSMutableSet *viewsWithNewFrame = [NSMutableSet set]; diff --git a/React/Views/RCTShadowView.h b/React/Views/RCTShadowView.h index b76e3000d..6c5bbf17c 100644 --- a/React/Views/RCTShadowView.h +++ b/React/Views/RCTShadowView.h @@ -186,7 +186,6 @@ typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry /** * The following are implementation details exposed to subclasses. Do not call them directly */ -- (void)fillCSSNode:(css_node_t *)node NS_REQUIRES_SUPER; - (void)dirtyLayout NS_REQUIRES_SUPER; - (BOOL)isLayoutDirty; diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index 2ff78efc1..a8cd30ae5 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -89,11 +89,6 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st : 0; } -- (void)fillCSSNode:(css_node_t *)node -{ - node->children_count = (int)_reactSubviews.count; -} - // The absolute stuff is so that we can take into account our absolute position when rounding in order to // snap to the pixel grid. For example, say you have the following structure: // @@ -253,7 +248,6 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st _layoutLifecycle = RCTUpdateLifecycleDirtied; } - [self fillCSSNode:_cssNode]; layoutNode(_cssNode, frame.size.width, frame.size.height, CSS_DIRECTION_INHERIT); [self applyLayoutNode:_cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition]; } @@ -299,7 +293,6 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st _cssNode->print = RCTPrint; _cssNode->get_child = RCTGetChild; _cssNode->is_dirty = RCTIsDirty; - [self fillCSSNode:_cssNode]; } return self; } @@ -637,7 +630,6 @@ RCT_STYLE_PROPERTY(FlexWrap, flexWrap, flex_wrap, css_wrap_type_t) if (_recomputePadding || _recomputeMargin || _recomputeBorder) { [self dirtyLayout]; } - [self fillCSSNode:_cssNode]; _recomputeMargin = NO; _recomputePadding = NO; _recomputeBorder = NO;