mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-23 21:25:13 +08:00
Remove isTextNode optimization
Reviewed By: astreet Differential Revision: D4146785 fbshipit-source-id: e20d780fbd5759b8f38b809e8cadf29cedee82a8
This commit is contained in:
committed by
Facebook Github Bot
parent
47d9cb4dac
commit
81e4139edc
@@ -89,7 +89,6 @@ typedef struct CSSNode {
|
||||
CSSLayout layout;
|
||||
uint32_t lineIndex;
|
||||
bool hasNewLayout;
|
||||
bool isTextNode;
|
||||
CSSNodeRef parent;
|
||||
CSSNodeListRef children;
|
||||
bool isDirty;
|
||||
@@ -382,7 +381,6 @@ void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex) {
|
||||
|
||||
CSS_NODE_PROPERTY_IMPL(void *, Context, context, context);
|
||||
CSS_NODE_PROPERTY_IMPL(CSSPrintFunc, PrintFunc, printFunc, print);
|
||||
CSS_NODE_PROPERTY_IMPL(bool, IsTextnode, isTextNode, isTextNode);
|
||||
CSS_NODE_PROPERTY_IMPL(bool, HasNewLayout, hasNewLayout, hasNewLayout);
|
||||
|
||||
CSS_NODE_STYLE_PROPERTY_IMPL(CSSDirection, Direction, direction, direction);
|
||||
@@ -2104,8 +2102,7 @@ static inline bool newMeasureSizeIsStricterAndStillValid(CSSMeasureMode sizeMode
|
||||
lastSize > size && lastComputedSize <= size;
|
||||
}
|
||||
|
||||
bool CSSNodeCanUseCachedMeasurement(const bool isTextNode,
|
||||
const CSSMeasureMode widthMode,
|
||||
bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode,
|
||||
const float width,
|
||||
const CSSMeasureMode heightMode,
|
||||
const float height,
|
||||
@@ -2134,7 +2131,7 @@ bool CSSNodeCanUseCachedMeasurement(const bool isTextNode,
|
||||
newMeasureSizeIsStricterAndStillValid(
|
||||
widthMode, width - marginRow, lastWidthMode, lastWidth, lastComputedWidth);
|
||||
|
||||
const bool heightIsCompatible = isTextNode || hasSameHeightSpec ||
|
||||
const bool heightIsCompatible = hasSameHeightSpec ||
|
||||
newSizeIsExactAndMatchesOldMeasuredSize(heightMode,
|
||||
height - marginColumn,
|
||||
lastComputedHeight) ||
|
||||
@@ -2203,8 +2200,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn);
|
||||
|
||||
// First, try to use the layout cache.
|
||||
if (CSSNodeCanUseCachedMeasurement(node->isTextNode,
|
||||
widthMeasureMode,
|
||||
if (CSSNodeCanUseCachedMeasurement(widthMeasureMode,
|
||||
availableWidth,
|
||||
heightMeasureMode,
|
||||
availableHeight,
|
||||
@@ -2220,8 +2216,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
} else {
|
||||
// Try to use the measurement cache.
|
||||
for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
|
||||
if (CSSNodeCanUseCachedMeasurement(node->isTextNode,
|
||||
widthMeasureMode,
|
||||
if (CSSNodeCanUseCachedMeasurement(widthMeasureMode,
|
||||
availableWidth,
|
||||
heightMeasureMode,
|
||||
availableHeight,
|
||||
|
||||
Reference in New Issue
Block a user