mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename enums
Differential Revision: D4244360 fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
This commit is contained in:
committed by
Martin Konicek
parent
11a2b21e84
commit
d414fdc906
@@ -29,7 +29,7 @@
|
||||
[super setUp];
|
||||
|
||||
self.parentView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionColumn);
|
||||
CSSNodeStyleSetFlexDirection(node, YGFlexDirectionColumn);
|
||||
CSSNodeStyleSetWidth(node, 440);
|
||||
CSSNodeStyleSetHeight(node, 440);
|
||||
}];
|
||||
@@ -56,8 +56,8 @@
|
||||
|
||||
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 2);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeLeft, 10);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeRight, 10);
|
||||
CSSNodeStyleSetMargin(node, YGEdgeLeft, 10);
|
||||
CSSNodeStyleSetMargin(node, YGEdgeRight, 10);
|
||||
}];
|
||||
|
||||
RCTShadowView *rightView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
@@ -65,10 +65,10 @@
|
||||
}];
|
||||
|
||||
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionRow);
|
||||
CSSNodeStyleSetFlexDirection(node, YGFlexDirectionRow);
|
||||
CSSNodeStyleSetFlex(node, 2);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeTop, 10);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeBottom, 10);
|
||||
CSSNodeStyleSetMargin(node, YGEdgeTop, 10);
|
||||
CSSNodeStyleSetMargin(node, YGEdgeBottom, 10);
|
||||
}];
|
||||
|
||||
[mainView insertReactSubview:leftView atIndex:0];
|
||||
@@ -83,10 +83,10 @@
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeLeft, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeTop, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeRight, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeBottom, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, YGEdgeLeft, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, YGEdgeTop, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, YGEdgeRight, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, YGEdgeBottom, 10);
|
||||
|
||||
[self.parentView insertReactSubview:headerView atIndex:0];
|
||||
[self.parentView insertReactSubview:mainView atIndex:1];
|
||||
@@ -132,8 +132,8 @@
|
||||
- (void)testAssignsSuggestedWidthDimension
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
CSSNodeStyleSetHeight(node, 10);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, 3, 10)
|
||||
@@ -143,8 +143,8 @@
|
||||
- (void)testAssignsSuggestedHeightDimension
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
CSSNodeStyleSetWidth(node, 10);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, 10, 4)
|
||||
@@ -154,8 +154,8 @@
|
||||
- (void)testDoesNotOverrideDimensionStyleWithSuggestedDimensions
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
CSSNodeStyleSetWidth(node, 10);
|
||||
CSSNodeStyleSetHeight(node, 10);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ CGFloat const RCTTextAutoSizeGranularity = 0.001f;
|
||||
CGFloat _effectiveLetterSpacing;
|
||||
}
|
||||
|
||||
static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
|
||||
static CSSSize RCTMeasure(CSSNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
|
||||
{
|
||||
RCTShadowText *shadowText = (__bridge RCTShadowText *)CSSNodeGetContext(node);
|
||||
NSTextStorage *textStorage = [shadowText buildTextStorageForWidth:width widthMode:widthMode];
|
||||
@@ -114,7 +114,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
|
||||
|
||||
NSNumber *parentTag = [[self reactSuperview] reactTag];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:CSSMeasureModeExactly];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:YGMeasureModeExactly];
|
||||
CGRect textFrame = [self calculateTextFrame:textStorage];
|
||||
BOOL selectable = _selectable;
|
||||
[applierBlocks addObject:^(NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
@@ -153,7 +153,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
// Run layout on subviews.
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:CSSMeasureModeExactly];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:YGMeasureModeExactly];
|
||||
NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
|
||||
NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
|
||||
NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
|
||||
@@ -187,7 +187,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode
|
||||
{
|
||||
if (_cachedTextStorage && width == _cachedTextStorageWidth && widthMode == _cachedTextStorageWidthMode) {
|
||||
return _cachedTextStorage;
|
||||
@@ -208,7 +208,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
}
|
||||
|
||||
textContainer.maximumNumberOfLines = _numberOfLines;
|
||||
textContainer.size = (CGSize){widthMode == CSSMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
|
||||
textContainer.size = (CGSize){widthMode == YGMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
|
||||
|
||||
[layoutManager addTextContainer:textContainer];
|
||||
[layoutManager ensureLayoutForTextContainer:textContainer];
|
||||
@@ -403,10 +403,10 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
// We will climb up to the first node which style has been setted as non-inherit
|
||||
if (newTextAlign == NSTextAlignmentRight || newTextAlign == NSTextAlignmentLeft) {
|
||||
RCTShadowView *view = self;
|
||||
while (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionInherit) {
|
||||
while (view != nil && CSSNodeStyleGetDirection(view.cssNode) == YGDirectionInherit) {
|
||||
view = [view reactSuperview];
|
||||
}
|
||||
if (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionRTL) {
|
||||
if (view != nil && CSSNodeStyleGetDirection(view.cssNode) == YGDirectionRTL) {
|
||||
if (newTextAlign == NSTextAlignmentRight) {
|
||||
newTextAlign = NSTextAlignmentLeft;
|
||||
} else if (newTextAlign == NSTextAlignmentLeft) {
|
||||
|
||||
@@ -35,7 +35,7 @@ static void collectDirtyNonTextDescendants(RCTShadowText *shadowView, NSMutableA
|
||||
|
||||
@interface RCTShadowText (Private)
|
||||
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode;
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -109,13 +109,13 @@ typedef id NSPropertyList;
|
||||
+ (NSPropertyList)NSPropertyList:(id)json;
|
||||
|
||||
typedef BOOL css_backface_visibility_t;
|
||||
+ (CSSOverflow)CSSOverflow:(id)json;
|
||||
+ (YGOverflow)YGOverflow:(id)json;
|
||||
+ (css_backface_visibility_t)css_backface_visibility_t:(id)json;
|
||||
+ (CSSFlexDirection)CSSFlexDirection:(id)json;
|
||||
+ (CSSJustify)CSSJustify:(id)json;
|
||||
+ (CSSAlign)CSSAlign:(id)json;
|
||||
+ (CSSPositionType)CSSPositionType:(id)json;
|
||||
+ (CSSWrap)CSSWrap:(id)json;
|
||||
+ (YGFlexDirection)YGFlexDirection:(id)json;
|
||||
+ (YGJustify)YGJustify:(id)json;
|
||||
+ (YGAlign)YGAlign:(id)json;
|
||||
+ (YGPositionType)YGPositionType:(id)json;
|
||||
+ (YGWrap)YGWrap:(id)json;
|
||||
|
||||
+ (RCTPointerEvents)RCTPointerEvents:(id)json;
|
||||
+ (RCTAnimationType)RCTAnimationType:(id)json;
|
||||
|
||||
+33
-33
@@ -614,44 +614,44 @@ RCT_ENUM_CONVERTER(css_backface_visibility_t, (@{
|
||||
@"visible": @YES
|
||||
}), YES, boolValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSOverflow, (@{
|
||||
@"hidden": @(CSSOverflowHidden),
|
||||
@"visible": @(CSSOverflowVisible),
|
||||
@"scroll": @(CSSOverflowScroll),
|
||||
}), CSSOverflowVisible, intValue)
|
||||
RCT_ENUM_CONVERTER(YGOverflow, (@{
|
||||
@"hidden": @(YGOverflowHidden),
|
||||
@"visible": @(YGOverflowVisible),
|
||||
@"scroll": @(YGOverflowScroll),
|
||||
}), YGOverflowVisible, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSFlexDirection, (@{
|
||||
@"row": @(CSSFlexDirectionRow),
|
||||
@"row-reverse": @(CSSFlexDirectionRowReverse),
|
||||
@"column": @(CSSFlexDirectionColumn),
|
||||
@"column-reverse": @(CSSFlexDirectionColumnReverse)
|
||||
}), CSSFlexDirectionColumn, intValue)
|
||||
RCT_ENUM_CONVERTER(YGFlexDirection, (@{
|
||||
@"row": @(YGFlexDirectionRow),
|
||||
@"row-reverse": @(YGFlexDirectionRowReverse),
|
||||
@"column": @(YGFlexDirectionColumn),
|
||||
@"column-reverse": @(YGFlexDirectionColumnReverse)
|
||||
}), YGFlexDirectionColumn, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSJustify, (@{
|
||||
@"flex-start": @(CSSJustifyFlexStart),
|
||||
@"flex-end": @(CSSJustifyFlexEnd),
|
||||
@"center": @(CSSJustifyCenter),
|
||||
@"space-between": @(CSSJustifySpaceBetween),
|
||||
@"space-around": @(CSSJustifySpaceAround)
|
||||
}), CSSJustifyFlexStart, intValue)
|
||||
RCT_ENUM_CONVERTER(YGJustify, (@{
|
||||
@"flex-start": @(YGJustifyFlexStart),
|
||||
@"flex-end": @(YGJustifyFlexEnd),
|
||||
@"center": @(YGJustifyCenter),
|
||||
@"space-between": @(YGJustifySpaceBetween),
|
||||
@"space-around": @(YGJustifySpaceAround)
|
||||
}), YGJustifyFlexStart, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSAlign, (@{
|
||||
@"flex-start": @(CSSAlignFlexStart),
|
||||
@"flex-end": @(CSSAlignFlexEnd),
|
||||
@"center": @(CSSAlignCenter),
|
||||
@"auto": @(CSSAlignAuto),
|
||||
@"stretch": @(CSSAlignStretch)
|
||||
}), CSSAlignFlexStart, intValue)
|
||||
RCT_ENUM_CONVERTER(YGAlign, (@{
|
||||
@"flex-start": @(YGAlignFlexStart),
|
||||
@"flex-end": @(YGAlignFlexEnd),
|
||||
@"center": @(YGAlignCenter),
|
||||
@"auto": @(YGAlignAuto),
|
||||
@"stretch": @(YGAlignStretch)
|
||||
}), YGAlignFlexStart, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSPositionType, (@{
|
||||
@"absolute": @(CSSPositionTypeAbsolute),
|
||||
@"relative": @(CSSPositionTypeRelative)
|
||||
}), CSSPositionTypeRelative, intValue)
|
||||
RCT_ENUM_CONVERTER(YGPositionType, (@{
|
||||
@"absolute": @(YGPositionTypeAbsolute),
|
||||
@"relative": @(YGPositionTypeRelative)
|
||||
}), YGPositionTypeRelative, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSWrap, (@{
|
||||
@"wrap": @(CSSWrapWrap),
|
||||
@"nowrap": @(CSSWrapNoWrap)
|
||||
}), CSSWrapNoWrap, intValue)
|
||||
RCT_ENUM_CONVERTER(YGWrap, (@{
|
||||
@"wrap": @(YGWrapWrap),
|
||||
@"nowrap": @(YGWrapNoWrap)
|
||||
}), YGWrapNoWrap, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(RCTPointerEvents, (@{
|
||||
@"none": @(RCTPointerEventsNone),
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
typedef enum YGFlexDirection {
|
||||
YGFlexDirectionColumn,
|
||||
YGFlexDirectionColumnReverse,
|
||||
YGFlexDirectionRow,
|
||||
YGFlexDirectionRowReverse,
|
||||
YGFlexDirectionCount,
|
||||
} YGFlexDirection;
|
||||
|
||||
typedef enum YGMeasureMode {
|
||||
YGMeasureModeUndefined,
|
||||
YGMeasureModeExactly,
|
||||
YGMeasureModeAtMost,
|
||||
YGMeasureModeCount,
|
||||
} YGMeasureMode;
|
||||
|
||||
typedef enum YGPrintOptions {
|
||||
YGPrintOptionsLayout = 1,
|
||||
YGPrintOptionsStyle = 2,
|
||||
YGPrintOptionsChildren = 4,
|
||||
YGPrintOptionsCount,
|
||||
} YGPrintOptions;
|
||||
|
||||
typedef enum YGEdge {
|
||||
YGEdgeLeft,
|
||||
YGEdgeTop,
|
||||
YGEdgeRight,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeHorizontal,
|
||||
YGEdgeVertical,
|
||||
YGEdgeAll,
|
||||
YGEdgeCount,
|
||||
} YGEdge;
|
||||
|
||||
typedef enum YGPositionType {
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeAbsolute,
|
||||
YGPositionTypeCount,
|
||||
} YGPositionType;
|
||||
|
||||
typedef enum YGDimension {
|
||||
YGDimensionWidth,
|
||||
YGDimensionHeight,
|
||||
YGDimensionCount,
|
||||
} YGDimension;
|
||||
|
||||
typedef enum YGJustify {
|
||||
YGJustifyFlexStart,
|
||||
YGJustifyCenter,
|
||||
YGJustifyFlexEnd,
|
||||
YGJustifySpaceBetween,
|
||||
YGJustifySpaceAround,
|
||||
YGJustifyCount,
|
||||
} YGJustify;
|
||||
|
||||
typedef enum YGDirection {
|
||||
YGDirectionInherit,
|
||||
YGDirectionLTR,
|
||||
YGDirectionRTL,
|
||||
YGDirectionCount,
|
||||
} YGDirection;
|
||||
|
||||
typedef enum YGLogLevel {
|
||||
YGLogLevelError,
|
||||
YGLogLevelWarn,
|
||||
YGLogLevelInfo,
|
||||
YGLogLevelDebug,
|
||||
YGLogLevelVerbose,
|
||||
YGLogLevelCount,
|
||||
} YGLogLevel;
|
||||
|
||||
typedef enum YGWrap {
|
||||
YGWrapNoWrap,
|
||||
YGWrapWrap,
|
||||
YGWrapCount,
|
||||
} YGWrap;
|
||||
|
||||
typedef enum YGOverflow {
|
||||
YGOverflowVisible,
|
||||
YGOverflowHidden,
|
||||
YGOverflowScroll,
|
||||
YGOverflowCount,
|
||||
} YGOverflow;
|
||||
|
||||
typedef enum YGExperimentalFeature {
|
||||
YGExperimentalFeatureRounding,
|
||||
YGExperimentalFeatureWebFlexBasis,
|
||||
YGExperimentalFeatureCount,
|
||||
} YGExperimentalFeature;
|
||||
|
||||
typedef enum YGAlign {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
YGAlignCenter,
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignCount,
|
||||
} YGAlign;
|
||||
+619
-630
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
// Not defined in MSVC++
|
||||
#ifndef NAN
|
||||
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
|
||||
#define NAN (*(const float *) __nan)
|
||||
#endif
|
||||
|
||||
#define YGUndefined NAN
|
||||
|
||||
#include "CSSEnums.h"
|
||||
#include "CSSMacros.h"
|
||||
|
||||
CSS_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct CSSSize {
|
||||
float width;
|
||||
float height;
|
||||
} CSSSize;
|
||||
|
||||
typedef struct CSSNode *CSSNodeRef;
|
||||
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode);
|
||||
typedef void (*CSSPrintFunc)(CSSNodeRef node);
|
||||
typedef int (*CSSLogger)(YGLogLevel level, const char *format, va_list args);
|
||||
|
||||
typedef void *(*CSSMalloc)(size_t size);
|
||||
typedef void *(*CSSCalloc)(size_t count, size_t size);
|
||||
typedef void *(*CSSRealloc)(void *ptr, size_t size);
|
||||
typedef void (*CSSFree)(void *ptr);
|
||||
|
||||
// CSSNode
|
||||
WIN_EXPORT CSSNodeRef CSSNodeNew(void);
|
||||
WIN_EXPORT void CSSNodeInit(const CSSNodeRef node);
|
||||
WIN_EXPORT void CSSNodeFree(const CSSNodeRef node);
|
||||
WIN_EXPORT void CSSNodeFreeRecursive(const CSSNodeRef node);
|
||||
WIN_EXPORT void CSSNodeReset(const CSSNodeRef node);
|
||||
WIN_EXPORT int32_t CSSNodeGetInstanceCount(void);
|
||||
|
||||
WIN_EXPORT void CSSNodeInsertChild(const CSSNodeRef node,
|
||||
const CSSNodeRef child,
|
||||
const uint32_t index);
|
||||
WIN_EXPORT void CSSNodeRemoveChild(const CSSNodeRef node, const CSSNodeRef child);
|
||||
WIN_EXPORT CSSNodeRef CSSNodeGetChild(const CSSNodeRef node, const uint32_t index);
|
||||
WIN_EXPORT uint32_t CSSNodeChildCount(const CSSNodeRef node);
|
||||
|
||||
WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
|
||||
const float availableWidth,
|
||||
const float availableHeight,
|
||||
const YGDirection parentDirection);
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
// set.
|
||||
// CSSLayout knows when to mark all other nodes as dirty but because nodes with
|
||||
// measure functions
|
||||
// depends on information not known to CSSLayout they must perform this dirty
|
||||
// marking manually.
|
||||
WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node);
|
||||
WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node);
|
||||
|
||||
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool CSSValueIsUndefined(const float value);
|
||||
|
||||
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
||||
const float width,
|
||||
const YGMeasureMode heightMode,
|
||||
const float height,
|
||||
const YGMeasureMode lastWidthMode,
|
||||
const float lastWidth,
|
||||
const YGMeasureMode lastHeightMode,
|
||||
const float lastHeight,
|
||||
const float lastComputedWidth,
|
||||
const float lastComputedHeight,
|
||||
const float marginRow,
|
||||
const float marginColumn);
|
||||
|
||||
WIN_EXPORT void CSSNodeCopyStyle(const CSSNodeRef dstNode, const CSSNodeRef srcNode);
|
||||
|
||||
#define CSS_NODE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void CSSNodeSet##name(const CSSNodeRef node, type paramName); \
|
||||
WIN_EXPORT type CSSNodeGet##name(const CSSNodeRef node);
|
||||
|
||||
#define CSS_NODE_STYLE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, const type paramName); \
|
||||
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node);
|
||||
|
||||
#define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \
|
||||
const YGEdge edge, \
|
||||
const type paramName); \
|
||||
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const YGEdge edge);
|
||||
|
||||
#define CSS_NODE_LAYOUT_PROPERTY(type, name) \
|
||||
WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node);
|
||||
|
||||
CSS_NODE_PROPERTY(void *, Context, context);
|
||||
CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc);
|
||||
CSS_NODE_PROPERTY(CSSPrintFunc, PrintFunc, printFunc);
|
||||
CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
|
||||
|
||||
CSS_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
|
||||
CSS_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
|
||||
CSS_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
|
||||
CSS_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
|
||||
CSS_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
|
||||
CSS_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
||||
|
||||
WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex);
|
||||
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
||||
CSS_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
||||
CSS_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
|
||||
|
||||
CSS_NODE_STYLE_EDGE_PROPERTY(float, Position, position);
|
||||
CSS_NODE_STYLE_EDGE_PROPERTY(float, Margin, margin);
|
||||
CSS_NODE_STYLE_EDGE_PROPERTY(float, Padding, padding);
|
||||
CSS_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
||||
|
||||
CSS_NODE_STYLE_PROPERTY(float, Width, width);
|
||||
CSS_NODE_STYLE_PROPERTY(float, Height, height);
|
||||
CSS_NODE_STYLE_PROPERTY(float, MinWidth, minWidth);
|
||||
CSS_NODE_STYLE_PROPERTY(float, MinHeight, minHeight);
|
||||
CSS_NODE_STYLE_PROPERTY(float, MaxWidth, maxWidth);
|
||||
CSS_NODE_STYLE_PROPERTY(float, MaxHeight, maxHeight);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
// Aspect ratio control the size of the undefined dimension of a node.
|
||||
// - On a node with a set width/height aspect ratio control the size of the unset dimension
|
||||
// - On a node with a set flex basis aspect ratio controls the size of the node in the cross axis if
|
||||
// unset
|
||||
// - On a node with a measure function aspect ratio works as though the measure function measures
|
||||
// the flex basis
|
||||
// - On a node with flex grow/shrink aspect ratio controls the size of the node in the cross axis if
|
||||
// unset
|
||||
// - Aspect ratio takes min/max dimensions into account
|
||||
CSS_NODE_STYLE_PROPERTY(float, AspectRatio, aspectRatio);
|
||||
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Left);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Top);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Right);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Bottom);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Width);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Height);
|
||||
CSS_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger);
|
||||
WIN_EXPORT void CSSLog(YGLogLevel level, const char *message, ...);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
|
||||
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc,
|
||||
CSSCalloc cssCalloc,
|
||||
CSSRealloc cssRealloc,
|
||||
CSSFree cssFree);
|
||||
|
||||
CSS_EXTERN_C_END
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define CSS_EXTERN_C_BEGIN extern "C" {
|
||||
#define CSS_EXTERN_C_END }
|
||||
#else
|
||||
#define CSS_EXTERN_C_BEGIN
|
||||
#define CSS_EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#ifdef _WINDLL
|
||||
#define WIN_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define WIN_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef FB_ASSERTIONS_ENABLED
|
||||
#define FB_ASSERTIONS_ENABLED 1
|
||||
#endif
|
||||
|
||||
#if FB_ASSERTIONS_ENABLED
|
||||
#define CSS_ABORT() abort()
|
||||
#else
|
||||
#define CSS_ABORT()
|
||||
#endif
|
||||
|
||||
#ifndef CSS_ASSERT
|
||||
#define CSS_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
CSSLog(YGLogLevelError, "%s", message); \
|
||||
CSS_ABORT(); \
|
||||
}
|
||||
#endif
|
||||
@@ -21,7 +21,7 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if ([[RCTI18nUtil sharedInstance] isRTL]) {
|
||||
CSSNodeStyleSetDirection(self.cssNode, CSSDirectionRTL);
|
||||
CSSNodeStyleSetDirection(self.cssNode, YGDirectionRTL);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
@@ -33,14 +33,14 @@
|
||||
case RCTRootViewSizeFlexibilityNone:
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityWidth:
|
||||
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
|
||||
CSSNodeStyleSetWidth(self.cssNode, YGUndefined);
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityHeight:
|
||||
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
|
||||
CSSNodeStyleSetHeight(self.cssNode, YGUndefined);
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityWidthAndHeight:
|
||||
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
|
||||
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
|
||||
CSSNodeStyleSetWidth(self.cssNode, YGUndefined);
|
||||
CSSNodeStyleSetHeight(self.cssNode, YGUndefined);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
{
|
||||
[self applySizeConstraints];
|
||||
|
||||
CSSNodeCalculateLayout(self.cssNode, CSSUndefined, CSSUndefined, CSSDirectionInherit);
|
||||
CSSNodeCalculateLayout(self.cssNode, YGUndefined, YGUndefined, YGDirectionInherit);
|
||||
|
||||
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];
|
||||
[self applyLayoutNode:self.cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:CGPointZero];
|
||||
|
||||
@@ -87,8 +87,8 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollAnimationEnd, RCTDirectEventBlock)
|
||||
// is set to from js we want to clip drawing or not. This piece of code ensures
|
||||
// that css-layout is always treating the contents of a scroll container as
|
||||
// overflow: 'scroll'.
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(overflow, CSSOverflow, RCTShadowView) {
|
||||
view.overflow = CSSOverflowScroll;
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(overflow, YGOverflow, RCTShadowView) {
|
||||
view.overflow = YGOverflowScroll;
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getContentSize:(nonnull NSNumber *)reactTag
|
||||
|
||||
@@ -126,12 +126,12 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
/**
|
||||
* Flexbox properties. All zero/disabled by default
|
||||
*/
|
||||
@property (nonatomic, assign) CSSFlexDirection flexDirection;
|
||||
@property (nonatomic, assign) CSSJustify justifyContent;
|
||||
@property (nonatomic, assign) CSSAlign alignSelf;
|
||||
@property (nonatomic, assign) CSSAlign alignItems;
|
||||
@property (nonatomic, assign) CSSPositionType position;
|
||||
@property (nonatomic, assign) CSSWrap flexWrap;
|
||||
@property (nonatomic, assign) YGFlexDirection flexDirection;
|
||||
@property (nonatomic, assign) YGJustify justifyContent;
|
||||
@property (nonatomic, assign) YGAlign alignSelf;
|
||||
@property (nonatomic, assign) YGAlign alignItems;
|
||||
@property (nonatomic, assign) YGPositionType position;
|
||||
@property (nonatomic, assign) YGWrap flexWrap;
|
||||
|
||||
@property (nonatomic, assign) float flexGrow;
|
||||
@property (nonatomic, assign) float flexShrink;
|
||||
@@ -149,7 +149,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
/**
|
||||
* Clipping properties
|
||||
*/
|
||||
@property (nonatomic, assign) CSSOverflow overflow;
|
||||
@property (nonatomic, assign) YGOverflow overflow;
|
||||
|
||||
/**
|
||||
* Calculate property changes that need to be propagated to the view.
|
||||
|
||||
+62
-62
@@ -60,43 +60,43 @@ static void RCTPrint(CSSNodeRef node)
|
||||
#define DEFINE_PROCESS_META_PROPS(type) \
|
||||
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], CSSNodeRef node) { \
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_LEFT])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_LEFT]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_LEFT]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, 0); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeStart, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, 0); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeEnd, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_TOP])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_TOP]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_TOP]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, 0); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeTop, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, 0); \
|
||||
CSSNodeStyleSet##type(node, YGEdgeBottom, 0); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -261,14 +261,14 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
}
|
||||
|
||||
if (!CGRectEqualToRect(frame, _frame)) {
|
||||
CSSNodeStyleSetPositionType(_cssNode, CSSPositionTypeAbsolute);
|
||||
CSSNodeStyleSetPositionType(_cssNode, YGPositionTypeAbsolute);
|
||||
CSSNodeStyleSetWidth(_cssNode, frame.size.width);
|
||||
CSSNodeStyleSetHeight(_cssNode, frame.size.height);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, frame.origin.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, frame.origin.y);
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeLeft, frame.origin.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeTop, frame.origin.y);
|
||||
}
|
||||
|
||||
CSSNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, CSSDirectionInherit);
|
||||
CSSNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, YGDirectionInherit);
|
||||
[self applyLayoutNode:_cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition];
|
||||
}
|
||||
|
||||
@@ -304,12 +304,12 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
_frame = CGRectMake(0, 0, CSSUndefined, CSSUndefined);
|
||||
_frame = CGRectMake(0, 0, YGUndefined, YGUndefined);
|
||||
|
||||
for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) {
|
||||
_paddingMetaProps[ii] = CSSUndefined;
|
||||
_marginMetaProps[ii] = CSSUndefined;
|
||||
_borderMetaProps[ii] = CSSUndefined;
|
||||
_paddingMetaProps[ii] = YGUndefined;
|
||||
_marginMetaProps[ii] = YGUndefined;
|
||||
_borderMetaProps[ii] = YGUndefined;
|
||||
}
|
||||
|
||||
_newView = YES;
|
||||
@@ -491,27 +491,27 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
|
||||
|
||||
- (UIEdgeInsets)paddingAsInsets
|
||||
{
|
||||
if (CSSNodeLayoutGetDirection(_cssNode) == CSSDirectionRTL) {
|
||||
if (CSSNodeLayoutGetDirection(_cssNode) == YGDirectionRTL) {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
||||
};
|
||||
} else {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -569,37 +569,37 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight)
|
||||
return CSSNodeStyleGetPosition(_cssNode, edge); \
|
||||
}
|
||||
|
||||
RCT_POSITION_PROPERTY(Top, top, CSSEdgeTop)
|
||||
RCT_POSITION_PROPERTY(Right, right, CSSEdgeEnd)
|
||||
RCT_POSITION_PROPERTY(Bottom, bottom, CSSEdgeBottom)
|
||||
RCT_POSITION_PROPERTY(Left, left, CSSEdgeStart)
|
||||
RCT_POSITION_PROPERTY(Top, top, YGEdgeTop)
|
||||
RCT_POSITION_PROPERTY(Right, right, YGEdgeEnd)
|
||||
RCT_POSITION_PROPERTY(Bottom, bottom, YGEdgeBottom)
|
||||
RCT_POSITION_PROPERTY(Left, left, YGEdgeStart)
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
if (!CGRectEqualToRect(frame, _frame)) {
|
||||
_frame = frame;
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, CGRectGetMinX(frame));
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, CGRectGetMinY(frame));
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeLeft, CGRectGetMinX(frame));
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeTop, CGRectGetMinY(frame));
|
||||
CSSNodeStyleSetWidth(_cssNode, CGRectGetWidth(frame));
|
||||
CSSNodeStyleSetHeight(_cssNode, CGRectGetHeight(frame));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension dimension, CGFloat amount)
|
||||
static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, YGDimension dimension, CGFloat amount)
|
||||
{
|
||||
if (amount != UIViewNoIntrinsicMetric) {
|
||||
switch (dimension) {
|
||||
case CSSDimensionWidth:
|
||||
case YGDimensionWidth:
|
||||
if (isnan(CSSNodeStyleGetWidth(cssNode))) {
|
||||
CSSNodeStyleSetWidth(cssNode, amount);
|
||||
}
|
||||
break;
|
||||
case CSSDimensionHeight:
|
||||
case YGDimensionHeight:
|
||||
if (isnan(CSSNodeStyleGetHeight(cssNode))) {
|
||||
CSSNodeStyleSetHeight(cssNode, amount);
|
||||
}
|
||||
break;
|
||||
case CSSDimensionCount:
|
||||
case YGDimensionCount:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -608,15 +608,15 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
|
||||
- (void)setIntrinsicContentSize:(CGSize)size
|
||||
{
|
||||
if (CSSNodeStyleGetFlexGrow(_cssNode) == 0 && CSSNodeStyleGetFlexShrink(_cssNode) == 0) {
|
||||
RCTAssignSuggestedDimension(_cssNode, CSSDimensionHeight, size.height);
|
||||
RCTAssignSuggestedDimension(_cssNode, CSSDimensionWidth, size.width);
|
||||
RCTAssignSuggestedDimension(_cssNode, YGDimensionHeight, size.height);
|
||||
RCTAssignSuggestedDimension(_cssNode, YGDimensionWidth, size.width);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTopLeft:(CGPoint)topLeft
|
||||
{
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, topLeft.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, topLeft.y);
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeLeft, topLeft.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, YGEdgeTop, topLeft.y);
|
||||
}
|
||||
|
||||
- (void)setSize:(CGSize)size
|
||||
@@ -645,13 +645,13 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
|
||||
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float)
|
||||
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float)
|
||||
RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, float)
|
||||
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, CSSFlexDirection)
|
||||
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, CSSJustify)
|
||||
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, CSSAlign)
|
||||
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, CSSAlign)
|
||||
RCT_STYLE_PROPERTY(Position, position, PositionType, CSSPositionType)
|
||||
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, CSSWrap)
|
||||
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, CSSOverflow)
|
||||
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)
|
||||
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify)
|
||||
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign)
|
||||
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, YGAlign)
|
||||
RCT_STYLE_PROPERTY(Position, position, PositionType, YGPositionType)
|
||||
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, YGWrap)
|
||||
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, YGOverflow)
|
||||
RCT_STYLE_PROPERTY(AspectRatio, aspectRatio, AspectRatio, float)
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)color
|
||||
|
||||
@@ -109,10 +109,10 @@ RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(overflow, CSSOverflow, RCTView)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView)
|
||||
{
|
||||
if (json) {
|
||||
view.clipsToBounds = [RCTConvert CSSOverflow:json] != CSSOverflowVisible;
|
||||
view.clipsToBounds = [RCTConvert YGOverflow:json] != YGOverflowVisible;
|
||||
} else {
|
||||
view.clipsToBounds = defaultView.clipsToBounds;
|
||||
}
|
||||
@@ -288,15 +288,15 @@ RCT_EXPORT_SHADOW_PROPERTY(flex, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexBasis, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, CSSFlexDirection)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, CSSWrap)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, CSSJustify)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignItems, CSSAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, CSSAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(position, CSSPositionType)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, YGFlexDirection)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, YGWrap)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, YGJustify)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignItems, YGAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, YGAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(position, YGPositionType)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(aspectRatio, float)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(overflow, CSSOverflow)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(overflow, YGOverflow)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
/**
|
||||
* Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger);
|
||||
* See CSSLogLevel for the different log levels.
|
||||
* See YogaLogLevel for the different log levels.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public interface CSSLogger {
|
||||
@DoNotStrip
|
||||
void log(CSSLogLevel level, String message);
|
||||
void log(YogaLogLevel level, String message);
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
int feature,
|
||||
boolean enabled);
|
||||
public static void setExperimentalFeatureEnabled(
|
||||
CSSExperimentalFeature feature,
|
||||
YogaExperimentalFeature feature,
|
||||
boolean enabled) {
|
||||
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
|
||||
}
|
||||
|
||||
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature);
|
||||
public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) {
|
||||
public static boolean isExperimentalFeatureEnabled(YogaExperimentalFeature feature) {
|
||||
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
private boolean mHasSetPosition = false;
|
||||
|
||||
@DoNotStrip
|
||||
private float mWidth = CSSConstants.UNDEFINED;
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mHeight = CSSConstants.UNDEFINED;
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mTop = CSSConstants.UNDEFINED;
|
||||
private float mTop = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mLeft = CSSConstants.UNDEFINED;
|
||||
private float mLeft = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
|
||||
@@ -97,10 +97,10 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
mHasSetBorder = false;
|
||||
mHasSetPosition = false;
|
||||
|
||||
mWidth = CSSConstants.UNDEFINED;
|
||||
mHeight = CSSConstants.UNDEFINED;
|
||||
mTop = CSSConstants.UNDEFINED;
|
||||
mLeft = CSSConstants.UNDEFINED;
|
||||
mWidth = YogaConstants.UNDEFINED;
|
||||
mHeight = YogaConstants.UNDEFINED;
|
||||
mTop = YogaConstants.UNDEFINED;
|
||||
mLeft = YogaConstants.UNDEFINED;
|
||||
mLayoutDirection = 0;
|
||||
|
||||
mMeasureFunction = null;
|
||||
@@ -193,103 +193,103 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
|
||||
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSDirection getStyleDirection() {
|
||||
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
|
||||
@Override
|
||||
public void setDirection(CSSDirection direction) {
|
||||
public void setDirection(YogaDirection direction) {
|
||||
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSFlexDirection getFlexDirection() {
|
||||
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||
public YogaFlexDirection getFlexDirection() {
|
||||
return YogaFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||
@Override
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
|
||||
@Override
|
||||
public CSSJustify getJustifyContent() {
|
||||
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||
public YogaJustify getJustifyContent() {
|
||||
return YogaJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||
@Override
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignItems() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||
public YogaAlign getAlignItems() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||
@Override
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignSelf() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||
public YogaAlign getAlignSelf() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||
@Override
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignContent() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||
public YogaAlign getAlignContent() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||
@Override
|
||||
public void setAlignContent(CSSAlign alignContent) {
|
||||
public void setAlignContent(YogaAlign alignContent) {
|
||||
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
|
||||
@Override
|
||||
public CSSPositionType getPositionType() {
|
||||
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||
public YogaPositionType getPositionType() {
|
||||
return YogaPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||
@Override
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||
@Override
|
||||
public void setWrap(CSSWrap flexWrap) {
|
||||
public void setWrap(YogaWrap flexWrap) {
|
||||
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
|
||||
@Override
|
||||
public CSSOverflow getOverflow() {
|
||||
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||
public YogaOverflow getOverflow() {
|
||||
return YogaOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
@Override
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||
}
|
||||
|
||||
@@ -337,64 +337,64 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
|
||||
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getMargin(CSSEdge edge) {
|
||||
public float getMargin(YogaEdge edge) {
|
||||
if (!mHasSetMargin) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||
@Override
|
||||
public void setMargin(CSSEdge edge, float margin) {
|
||||
public void setMargin(YogaEdge edge, float margin) {
|
||||
mHasSetMargin = true;
|
||||
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPadding(CSSEdge edge) {
|
||||
public float getPadding(YogaEdge edge) {
|
||||
if (!mHasSetPadding) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||
@Override
|
||||
public void setPadding(CSSEdge edge, float padding) {
|
||||
public void setPadding(YogaEdge edge, float padding) {
|
||||
mHasSetPadding = true;
|
||||
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getBorder(CSSEdge edge) {
|
||||
public float getBorder(YogaEdge edge) {
|
||||
if (!mHasSetBorder) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||
@Override
|
||||
public void setBorder(CSSEdge edge, float border) {
|
||||
public void setBorder(YogaEdge edge, float border) {
|
||||
mHasSetBorder = true;
|
||||
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPosition(CSSEdge edge) {
|
||||
public float getPosition(YogaEdge edge) {
|
||||
if (!mHasSetPosition) {
|
||||
return CSSConstants.UNDEFINED;
|
||||
return YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||
@Override
|
||||
public void setPosition(CSSEdge edge, float position) {
|
||||
public void setPosition(YogaEdge edge, float position) {
|
||||
mHasSetPosition = true;
|
||||
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||
}
|
||||
@@ -502,8 +502,8 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CSSDirection getLayoutDirection() {
|
||||
return CSSDirection.values()[mLayoutDirection];
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.values()[mLayoutDirection];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
@@ -527,9 +527,9 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
CSSMeasureMode.values()[widthMode],
|
||||
YogaMeasureMode.values()[widthMode],
|
||||
height,
|
||||
CSSMeasureMode.values()[heightMode]);
|
||||
YogaMeasureMode.values()[heightMode]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
YogaMeasureMode heightMode);
|
||||
}
|
||||
|
||||
int getChildCount();
|
||||
@@ -37,21 +37,21 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
void dirty();
|
||||
void markLayoutSeen();
|
||||
void copyStyle(CSSNodeType srcNode);
|
||||
CSSDirection getStyleDirection();
|
||||
void setDirection(CSSDirection direction);
|
||||
CSSFlexDirection getFlexDirection();
|
||||
void setFlexDirection(CSSFlexDirection flexDirection);
|
||||
CSSJustify getJustifyContent();
|
||||
void setJustifyContent(CSSJustify justifyContent);
|
||||
CSSAlign getAlignItems();
|
||||
void setAlignItems(CSSAlign alignItems);
|
||||
CSSAlign getAlignSelf();
|
||||
void setAlignSelf(CSSAlign alignSelf);
|
||||
CSSAlign getAlignContent();
|
||||
void setAlignContent(CSSAlign alignContent);
|
||||
CSSPositionType getPositionType();
|
||||
void setPositionType(CSSPositionType positionType);
|
||||
void setWrap(CSSWrap flexWrap);
|
||||
YogaDirection getStyleDirection();
|
||||
void setDirection(YogaDirection direction);
|
||||
YogaFlexDirection getFlexDirection();
|
||||
void setFlexDirection(YogaFlexDirection flexDirection);
|
||||
YogaJustify getJustifyContent();
|
||||
void setJustifyContent(YogaJustify justifyContent);
|
||||
YogaAlign getAlignItems();
|
||||
void setAlignItems(YogaAlign alignItems);
|
||||
YogaAlign getAlignSelf();
|
||||
void setAlignSelf(YogaAlign alignSelf);
|
||||
YogaAlign getAlignContent();
|
||||
void setAlignContent(YogaAlign alignContent);
|
||||
YogaPositionType getPositionType();
|
||||
void setPositionType(YogaPositionType positionType);
|
||||
void setWrap(YogaWrap flexWrap);
|
||||
void setFlex(float flex);
|
||||
float getFlexGrow();
|
||||
void setFlexGrow(float flexGrow);
|
||||
@@ -59,14 +59,14 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
void setFlexShrink(float flexShrink);
|
||||
float getFlexBasis();
|
||||
void setFlexBasis(float flexBasis);
|
||||
float getMargin(CSSEdge edge);
|
||||
void setMargin(CSSEdge edge, float margin);
|
||||
float getPadding(CSSEdge edge);
|
||||
void setPadding(CSSEdge edge, float padding);
|
||||
float getBorder(CSSEdge edge);
|
||||
void setBorder(CSSEdge edge, float border);
|
||||
float getPosition(CSSEdge edge);
|
||||
void setPosition(CSSEdge edge, float position);
|
||||
float getMargin(YogaEdge edge);
|
||||
void setMargin(YogaEdge edge, float margin);
|
||||
float getPadding(YogaEdge edge);
|
||||
void setPadding(YogaEdge edge, float padding);
|
||||
float getBorder(YogaEdge edge);
|
||||
void setBorder(YogaEdge edge, float border);
|
||||
float getPosition(YogaEdge edge);
|
||||
void setPosition(YogaEdge edge, float position);
|
||||
float getWidth();
|
||||
void setWidth(float width);
|
||||
float getHeight();
|
||||
@@ -83,9 +83,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
float getLayoutY();
|
||||
float getLayoutWidth();
|
||||
float getLayoutHeight();
|
||||
CSSDirection getLayoutDirection();
|
||||
CSSOverflow getOverflow();
|
||||
void setOverflow(CSSOverflow overflow);
|
||||
YogaDirection getLayoutDirection();
|
||||
YogaOverflow getOverflow();
|
||||
void setOverflow(YogaOverflow overflow);
|
||||
void setData(Object data);
|
||||
Object getData();
|
||||
void reset();
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSAlign {
|
||||
public enum YogaAlign {
|
||||
AUTO(0),
|
||||
FLEX_START(1),
|
||||
CENTER(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSAlign {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSAlign(int intValue) {
|
||||
YogaAlign(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSAlign {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSAlign fromInt(int value) {
|
||||
public static YogaAlign fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return AUTO;
|
||||
case 1: return FLEX_START;
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
public class CSSConstants {
|
||||
public class YogaConstants {
|
||||
|
||||
public static final float UNDEFINED = Float.NaN;
|
||||
|
||||
+3
-3
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSDimension {
|
||||
public enum YogaDimension {
|
||||
WIDTH(0),
|
||||
HEIGHT(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSDimension(int intValue) {
|
||||
YogaDimension(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSDimension {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSDimension fromInt(int value) {
|
||||
public static YogaDimension fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return WIDTH;
|
||||
case 1: return HEIGHT;
|
||||
+3
-3
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSDirection {
|
||||
public enum YogaDirection {
|
||||
INHERIT(0),
|
||||
LTR(1),
|
||||
RTL(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSDirection(int intValue) {
|
||||
YogaDirection(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSDirection {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSDirection fromInt(int value) {
|
||||
public static YogaDirection fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return INHERIT;
|
||||
case 1: return LTR;
|
||||
+3
-3
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSEdge {
|
||||
public enum YogaEdge {
|
||||
LEFT(0),
|
||||
TOP(1),
|
||||
RIGHT(2),
|
||||
@@ -25,7 +25,7 @@ public enum CSSEdge {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSEdge(int intValue) {
|
||||
YogaEdge(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public enum CSSEdge {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSEdge fromInt(int value) {
|
||||
public static YogaEdge fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return LEFT;
|
||||
case 1: return TOP;
|
||||
+3
-3
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSExperimentalFeature {
|
||||
public enum YogaExperimentalFeature {
|
||||
ROUNDING(0),
|
||||
WEB_FLEX_BASIS(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSExperimentalFeature(int intValue) {
|
||||
YogaExperimentalFeature(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSExperimentalFeature {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSExperimentalFeature fromInt(int value) {
|
||||
public static YogaExperimentalFeature fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ROUNDING;
|
||||
case 1: return WEB_FLEX_BASIS;
|
||||
+3
-3
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSFlexDirection {
|
||||
public enum YogaFlexDirection {
|
||||
COLUMN(0),
|
||||
COLUMN_REVERSE(1),
|
||||
ROW(2),
|
||||
@@ -20,7 +20,7 @@ public enum CSSFlexDirection {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSFlexDirection(int intValue) {
|
||||
YogaFlexDirection(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum CSSFlexDirection {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSFlexDirection fromInt(int value) {
|
||||
public static YogaFlexDirection fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return COLUMN;
|
||||
case 1: return COLUMN_REVERSE;
|
||||
+3
-3
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSJustify {
|
||||
public enum YogaJustify {
|
||||
FLEX_START(0),
|
||||
CENTER(1),
|
||||
FLEX_END(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSJustify {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSJustify(int intValue) {
|
||||
YogaJustify(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSJustify {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSJustify fromInt(int value) {
|
||||
public static YogaJustify fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return FLEX_START;
|
||||
case 1: return CENTER;
|
||||
+3
-3
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSLogLevel {
|
||||
public enum YogaLogLevel {
|
||||
ERROR(0),
|
||||
WARN(1),
|
||||
INFO(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSLogLevel {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSLogLevel(int intValue) {
|
||||
YogaLogLevel(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSLogLevel {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSLogLevel fromInt(int value) {
|
||||
public static YogaLogLevel fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ERROR;
|
||||
case 1: return WARN;
|
||||
+3
-3
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSMeasureMode {
|
||||
public enum YogaMeasureMode {
|
||||
UNDEFINED(0),
|
||||
EXACTLY(1),
|
||||
AT_MOST(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSMeasureMode(int intValue) {
|
||||
YogaMeasureMode(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSMeasureMode {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSMeasureMode fromInt(int value) {
|
||||
public static YogaMeasureMode fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return UNDEFINED;
|
||||
case 1: return EXACTLY;
|
||||
+3
-3
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSOverflow {
|
||||
public enum YogaOverflow {
|
||||
VISIBLE(0),
|
||||
HIDDEN(1),
|
||||
SCROLL(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSOverflow(int intValue) {
|
||||
YogaOverflow(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSOverflow {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSOverflow fromInt(int value) {
|
||||
public static YogaOverflow fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return VISIBLE;
|
||||
case 1: return HIDDEN;
|
||||
+3
-3
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSPositionType {
|
||||
public enum YogaPositionType {
|
||||
RELATIVE(0),
|
||||
ABSOLUTE(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSPositionType(int intValue) {
|
||||
YogaPositionType(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSPositionType {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSPositionType fromInt(int value) {
|
||||
public static YogaPositionType fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return RELATIVE;
|
||||
case 1: return ABSOLUTE;
|
||||
+3
-3
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSPrintOptions {
|
||||
public enum YogaPrintOptions {
|
||||
LAYOUT(1),
|
||||
STYLE(2),
|
||||
CHILDREN(4);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSPrintOptions(int intValue) {
|
||||
YogaPrintOptions(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSPrintOptions {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSPrintOptions fromInt(int value) {
|
||||
public static YogaPrintOptions fromInt(int value) {
|
||||
switch (value) {
|
||||
case 1: return LAYOUT;
|
||||
case 2: return STYLE;
|
||||
+3
-3
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSWrap {
|
||||
public enum YogaWrap {
|
||||
NO_WRAP(0),
|
||||
WRAP(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSWrap(int intValue) {
|
||||
YogaWrap(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSWrap {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSWrap fromInt(int value) {
|
||||
public static YogaWrap fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return NO_WRAP;
|
||||
case 1: return WRAP;
|
||||
@@ -6,13 +6,13 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.csslayout.YogaAlign;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaFlexDirection;
|
||||
import com.facebook.csslayout.YogaJustify;
|
||||
import com.facebook.csslayout.YogaOverflow;
|
||||
import com.facebook.csslayout.YogaPositionType;
|
||||
import com.facebook.csslayout.YogaWrap;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
|
||||
@@ -27,57 +27,57 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
*/
|
||||
public class LayoutShadowNode extends ReactShadowNode {
|
||||
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setWidth(float width) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
setStyleWidth(YogaConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinWidth(float minWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinWidth(
|
||||
CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
YogaConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxWidth(
|
||||
CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
YogaConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setHeight(float height) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleHeight(
|
||||
CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
YogaConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinHeight(float minHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinHeight(
|
||||
CSSConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
YogaConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxHeight(float maxHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxHeight(
|
||||
CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
YogaConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.FLEX, defaultFloat = 0f)
|
||||
@@ -112,7 +112,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
super.setFlexBasis(flexBasis);
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
setStyleAspectRatio(aspectRatio);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setFlexDirection(
|
||||
flexDirection == null ? CSSFlexDirection.COLUMN : CSSFlexDirection.valueOf(
|
||||
flexDirection == null ? YogaFlexDirection.COLUMN : YogaFlexDirection.valueOf(
|
||||
flexDirection.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
if (flexWrap == null || flexWrap.equals("nowrap")) {
|
||||
setFlexWrap(CSSWrap.NO_WRAP);
|
||||
setFlexWrap(YogaWrap.NO_WRAP);
|
||||
} else if (flexWrap.equals("wrap")) {
|
||||
setFlexWrap(CSSWrap.WRAP);
|
||||
setFlexWrap(YogaWrap.WRAP);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown flexWrap value: " + flexWrap);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setAlignSelf(alignSelf == null ? CSSAlign.AUTO : CSSAlign.valueOf(
|
||||
setAlignSelf(alignSelf == null ? YogaAlign.AUTO : YogaAlign.valueOf(
|
||||
alignSelf.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setAlignItems(
|
||||
alignItems == null ? CSSAlign.STRETCH : CSSAlign.valueOf(
|
||||
alignItems == null ? YogaAlign.STRETCH : YogaAlign.valueOf(
|
||||
alignItems.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
|
||||
setJustifyContent(justifyContent == null ? YogaJustify.FLEX_START : YogaJustify.valueOf(
|
||||
justifyContent.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setOverflow(overflow == null ? CSSOverflow.VISIBLE : CSSOverflow.valueOf(
|
||||
setOverflow(overflow == null ? YogaOverflow.VISIBLE : YogaOverflow.valueOf(
|
||||
overflow.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.MARGIN_RIGHT,
|
||||
ViewProps.MARGIN_TOP,
|
||||
ViewProps.MARGIN_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMargins(int index, float margin) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -202,14 +202,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.PADDING_RIGHT,
|
||||
ViewProps.PADDING_TOP,
|
||||
ViewProps.PADDING_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPaddings(int index, float padding) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPadding(
|
||||
ViewProps.PADDING_MARGIN_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
YogaConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
}
|
||||
|
||||
@ReactPropGroup(names = {
|
||||
@@ -218,7 +218,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidths(int index, float borderWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -231,14 +231,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.RIGHT,
|
||||
ViewProps.TOP,
|
||||
ViewProps.BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPositionValues(int index, float position) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPosition(
|
||||
ViewProps.POSITION_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
YogaConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.POSITION)
|
||||
@@ -246,8 +246,8 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
CSSPositionType positionType = position == null ?
|
||||
CSSPositionType.RELATIVE : CSSPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
YogaPositionType positionType = position == null ?
|
||||
YogaPositionType.RELATIVE : YogaPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
setPositionType(positionType);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,17 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSEdge;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.YogaAlign;
|
||||
import com.facebook.csslayout.YogaEdge;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaFlexDirection;
|
||||
import com.facebook.csslayout.YogaJustify;
|
||||
import com.facebook.csslayout.CSSNode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.csslayout.YogaOverflow;
|
||||
import com.facebook.csslayout.YogaPositionType;
|
||||
import com.facebook.csslayout.YogaWrap;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ReactShadowNode {
|
||||
private float mAbsoluteRight;
|
||||
private float mAbsoluteBottom;
|
||||
private final Spacing mDefaultPadding = new Spacing(0);
|
||||
private final Spacing mPadding = new Spacing(CSSConstants.UNDEFINED);
|
||||
private final Spacing mPadding = new Spacing(YogaConstants.UNDEFINED);
|
||||
private final CSSNode mCSSNode;
|
||||
|
||||
public ReactShadowNode() {
|
||||
@@ -506,11 +506,11 @@ public class ReactShadowNode {
|
||||
return Math.round(mAbsoluteBottom - mAbsoluteTop);
|
||||
}
|
||||
|
||||
public final CSSDirection getLayoutDirection() {
|
||||
public final YogaDirection getLayoutDirection() {
|
||||
return mCSSNode.getLayoutDirection();
|
||||
}
|
||||
|
||||
public void setLayoutDirection(CSSDirection direction) {
|
||||
public void setLayoutDirection(YogaDirection direction) {
|
||||
mCSSNode.setDirection(direction);
|
||||
}
|
||||
|
||||
@@ -566,36 +566,36 @@ public class ReactShadowNode {
|
||||
mCSSNode.setAspectRatio(aspectRatio);
|
||||
}
|
||||
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
mCSSNode.setFlexDirection(flexDirection);
|
||||
}
|
||||
|
||||
public void setFlexWrap(CSSWrap wrap) {
|
||||
public void setFlexWrap(YogaWrap wrap) {
|
||||
mCSSNode.setWrap(wrap);
|
||||
}
|
||||
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
mCSSNode.setAlignSelf(alignSelf);
|
||||
}
|
||||
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
mCSSNode.setAlignItems(alignItems);
|
||||
}
|
||||
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
mCSSNode.setJustifyContent(justifyContent);
|
||||
}
|
||||
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
mCSSNode.setOverflow(overflow);
|
||||
}
|
||||
|
||||
public void setMargin(int spacingType, float margin) {
|
||||
mCSSNode.setMargin(CSSEdge.fromInt(spacingType), margin);
|
||||
mCSSNode.setMargin(YogaEdge.fromInt(spacingType), margin);
|
||||
}
|
||||
|
||||
public final float getPadding(int spacingType) {
|
||||
return mCSSNode.getPadding(CSSEdge.fromInt(spacingType));
|
||||
return mCSSNode.getPadding(YogaEdge.fromInt(spacingType));
|
||||
}
|
||||
|
||||
public void setDefaultPadding(int spacingType, float padding) {
|
||||
@@ -614,40 +614,40 @@ public class ReactShadowNode {
|
||||
spacingType == Spacing.RIGHT ||
|
||||
spacingType == Spacing.START ||
|
||||
spacingType == Spacing.END) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else if (spacingType == Spacing.TOP || spacingType == Spacing.BOTTOM) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBorder(int spacingType, float borderWidth) {
|
||||
mCSSNode.setBorder(CSSEdge.fromInt(spacingType), borderWidth);
|
||||
mCSSNode.setBorder(YogaEdge.fromInt(spacingType), borderWidth);
|
||||
}
|
||||
|
||||
public void setPosition(int spacingType, float position) {
|
||||
mCSSNode.setPosition(CSSEdge.fromInt(spacingType), position);
|
||||
mCSSNode.setPosition(YogaEdge.fromInt(spacingType), position);
|
||||
}
|
||||
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
mCSSNode.setPositionType(positionType);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Spacing {
|
||||
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
||||
mSpacing[spacingType] = value;
|
||||
|
||||
if (CSSConstants.isUndefined(value)) {
|
||||
if (YogaConstants.isUndefined(value)) {
|
||||
mValueFlags &= ~sFlagsMap[spacingType];
|
||||
} else {
|
||||
mValueFlags |= sFlagsMap[spacingType];
|
||||
@@ -120,7 +120,7 @@ public class Spacing {
|
||||
*/
|
||||
public float get(int spacingType) {
|
||||
float defaultValue = (spacingType == START || spacingType == END
|
||||
? CSSConstants.UNDEFINED
|
||||
? YogaConstants.UNDEFINED
|
||||
: mDefaultValue);
|
||||
|
||||
if (mValueFlags == 0) {
|
||||
@@ -159,7 +159,7 @@ public class Spacing {
|
||||
* recycling {@link Spacing} instances.
|
||||
*/
|
||||
public void reset() {
|
||||
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mSpacing, YogaConstants.UNDEFINED);
|
||||
mHasAliasesSet = false;
|
||||
mValueFlags = 0;
|
||||
}
|
||||
@@ -178,15 +178,15 @@ public class Spacing {
|
||||
|
||||
private static float[] newFullSpacingArray() {
|
||||
return new float[] {
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
@@ -84,7 +84,7 @@ public class UIImplementation {
|
||||
ReactShadowNode rootCSSNode = new ReactShadowNode();
|
||||
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
|
||||
if (sharedI18nUtilInstance.isRTL(mReactContext)) {
|
||||
rootCSSNode.setLayoutDirection(CSSDirection.RTL);
|
||||
rootCSSNode.setLayoutDirection(YogaDirection.RTL);
|
||||
}
|
||||
rootCSSNode.setViewClassName("Root");
|
||||
return rootCSSNode;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.react.views.art;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
@@ -31,9 +31,9 @@ public class ARTSurfaceViewManager extends
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
throw new IllegalStateException("SurfaceView should have explicit width and height set");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Map;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
@@ -116,9 +116,9 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactImageView view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.facebook.common.util.UriUtil;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.drawee.controller.BaseControllerListener;
|
||||
import com.facebook.drawee.controller.ControllerListener;
|
||||
@@ -150,7 +150,7 @@ public class ReactImageView extends GenericDraweeView {
|
||||
private int mBorderColor;
|
||||
private int mOverlayColor;
|
||||
private float mBorderWidth;
|
||||
private float mBorderRadius = CSSConstants.UNDEFINED;
|
||||
private float mBorderRadius = YogaConstants.UNDEFINED;
|
||||
private @Nullable float[] mBorderCornerRadii;
|
||||
private ScalingUtils.ScaleType mScaleType;
|
||||
private boolean mIsDirty;
|
||||
@@ -247,7 +247,7 @@ public class ReactImageView extends GenericDraweeView {
|
||||
public void setBorderRadius(float borderRadius, int position) {
|
||||
if (mBorderCornerRadii == null) {
|
||||
mBorderCornerRadii = new float[4];
|
||||
Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mBorderCornerRadii, YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], borderRadius)) {
|
||||
@@ -304,12 +304,12 @@ public class ReactImageView extends GenericDraweeView {
|
||||
}
|
||||
|
||||
private void cornerRadii(float[] computedCorners) {
|
||||
float defaultBorderRadius = !CSSConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float defaultBorderRadius = !YogaConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
|
||||
computedCorners[0] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
computedCorners[1] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
computedCorners[2] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
computedCorners[3] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
computedCorners[0] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
computedCorners[1] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
computedCorners[2] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
computedCorners[3] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
}
|
||||
|
||||
public void maybeUpdateView() {
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
@@ -55,9 +55,9 @@ public class ProgressBarShadowNode extends LayoutShadowNode implements CSSNodeAP
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
|
||||
if (!mMeasured.contains(style)) {
|
||||
ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -53,9 +53,9 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
if (!mMeasured) {
|
||||
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
|
||||
final int spec = View.MeasureSpec.makeMeasureSpec(
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -47,9 +47,9 @@ public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
if (!mMeasured) {
|
||||
// Create a switch with the default config and measure it; since we don't (currently)
|
||||
// support setting custom switch text, this is fine, as all switches will measure the same
|
||||
|
||||
@@ -30,9 +30,9 @@ import android.text.style.UnderlineSpan;
|
||||
import android.view.Gravity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
@@ -224,9 +224,9 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
// TODO(5578671): Handle text direction (see View#getTextDirectionHeuristic)
|
||||
TextPaint textPaint = sTextPaintInstance;
|
||||
Layout layout;
|
||||
@@ -238,11 +238,11 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
Layout.getDesiredWidth(text, textPaint) : Float.NaN;
|
||||
|
||||
// technically, width should never be negative, but there is currently a bug in
|
||||
boolean unconstrainedWidth = widthMode == CSSMeasureMode.UNDEFINED || width < 0;
|
||||
boolean unconstrainedWidth = widthMode == YogaMeasureMode.UNDEFINED || width < 0;
|
||||
|
||||
if (boring == null &&
|
||||
(unconstrainedWidth ||
|
||||
(!CSSConstants.isUndefined(desiredWidth) && desiredWidth <= width))) {
|
||||
(!YogaConstants.isUndefined(desiredWidth) && desiredWidth <= width))) {
|
||||
// Is used when the width is not known and the text is not boring, ie. if it contains
|
||||
// unicode characters.
|
||||
layout = new StaticLayout(
|
||||
@@ -369,7 +369,7 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
// Return text alignment according to LTR or RTL style
|
||||
private int getTextAlign() {
|
||||
int textAlign = mTextAlign;
|
||||
if (getLayoutDirection() == CSSDirection.RTL) {
|
||||
if (getLayoutDirection() == YogaDirection.RTL) {
|
||||
if (textAlign == Gravity.RIGHT) {
|
||||
textAlign = Gravity.LEFT;
|
||||
} else if (textAlign == Gravity.LEFT) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
@@ -102,9 +102,9 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactTextView view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactTextView view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -138,8 +138,8 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactTextView view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.facebook.common.util.UriUtil;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
@@ -35,8 +35,8 @@ public class FrescoBasedReactTextInlineImageShadowNode extends ReactTextInlineIm
|
||||
private @Nullable Uri mUri;
|
||||
private final AbstractDraweeControllerBuilder mDraweeControllerBuilder;
|
||||
private final @Nullable Object mCallerContext;
|
||||
private float mWidth = CSSConstants.UNDEFINED;
|
||||
private float mHeight = CSSConstants.UNDEFINED;
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
|
||||
public FrescoBasedReactTextInlineImageShadowNode(
|
||||
AbstractDraweeControllerBuilder draweeControllerBuilder,
|
||||
|
||||
+7
-7
@@ -28,7 +28,7 @@ import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -496,9 +496,9 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactEditText view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -520,9 +520,9 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactEditText view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -532,8 +532,8 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactEditText view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -16,8 +16,8 @@ import android.util.TypedValue;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
@@ -73,9 +73,9 @@ public class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
// measure() should never be called before setThemedContext()
|
||||
EditText editText = Assertions.assertNotNull(mEditText);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
||||
super.onCollectExtraUpdates(uiViewOperationQueue);
|
||||
if (mComputedPadding != null) {
|
||||
float[] updatedPadding = mComputedPadding;
|
||||
if (getLayoutDirection() == CSSDirection.RTL) {
|
||||
if (getLayoutDirection() == YogaDirection.RTL) {
|
||||
updatedPadding = new float[] {
|
||||
getPadding(Spacing.END),
|
||||
getPadding(Spacing.TOP),
|
||||
|
||||
@@ -4,14 +4,14 @@ package com.facebook.react.views.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
|
||||
public class MeasureUtil {
|
||||
|
||||
public static int getMeasureSpec(float size, CSSMeasureMode mode) {
|
||||
if (mode == CSSMeasureMode.EXACTLY) {
|
||||
public static int getMeasureSpec(float size, YogaMeasureMode mode) {
|
||||
if (mode == YogaMeasureMode.EXACTLY) {
|
||||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.EXACTLY);
|
||||
} else if (mode == CSSMeasureMode.AT_MOST) {
|
||||
} else if (mode == YogaMeasureMode.AT_MOST) {
|
||||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.AT_MOST);
|
||||
} else {
|
||||
return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
|
||||
+13
-13
@@ -27,7 +27,7 @@ import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.uimanager.FloatUtil;
|
||||
import com.facebook.react.uimanager.Spacing;
|
||||
@@ -87,7 +87,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
private @Nullable RectF mTempRectForBorderRadius;
|
||||
private @Nullable RectF mTempRectForBorderRadiusOutline;
|
||||
private boolean mNeedUpdatePathForBorderRadius = false;
|
||||
private float mBorderRadius = CSSConstants.UNDEFINED;
|
||||
private float mBorderRadius = YogaConstants.UNDEFINED;
|
||||
|
||||
/* Used by all types of background and for drawing borders */
|
||||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
@@ -100,7 +100,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
public void draw(Canvas canvas) {
|
||||
updatePathEffect();
|
||||
boolean roundedBorders = mBorderCornerRadii != null ||
|
||||
(!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0);
|
||||
(!YogaConstants.isUndefined(mBorderRadius) && mBorderRadius > 0);
|
||||
|
||||
if ((mBorderStyle == null || mBorderStyle == BorderStyle.SOLID) && !roundedBorders) {
|
||||
drawRectangularBackgroundWithBorders(canvas);
|
||||
@@ -145,7 +145,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
super.getOutline(outline);
|
||||
return;
|
||||
}
|
||||
if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
|
||||
if ((!YogaConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
|
||||
updatePath();
|
||||
|
||||
outline.setConvexPath(mPathForBorderRadiusOutline);
|
||||
@@ -216,7 +216,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
public void setRadius(float radius, int position) {
|
||||
if (mBorderCornerRadii == null) {
|
||||
mBorderCornerRadii = new float[4];
|
||||
Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mBorderCornerRadii, YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], radius)) {
|
||||
@@ -277,11 +277,11 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
mTempRectForBorderRadius.inset(fullBorderWidth * 0.5f, fullBorderWidth * 0.5f);
|
||||
}
|
||||
|
||||
float defaultBorderRadius = !CSSConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float topLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
float topRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
float bottomRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
float bottomLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
float defaultBorderRadius = !YogaConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float topLeftRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
float topRightRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
float bottomRightRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
float bottomLeftRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
|
||||
mPathForBorderRadius.addRoundRect(
|
||||
mTempRectForBorderRadius,
|
||||
@@ -333,7 +333,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
* For rounded borders we use default "borderWidth" property.
|
||||
*/
|
||||
private float getFullBorderWidth() {
|
||||
return (mBorderWidth != null && !CSSConstants.isUndefined(mBorderWidth.getRaw(Spacing.ALL))) ?
|
||||
return (mBorderWidth != null && !YogaConstants.isUndefined(mBorderWidth.getRaw(Spacing.ALL))) ?
|
||||
mBorderWidth.getRaw(Spacing.ALL) : 0f;
|
||||
}
|
||||
|
||||
@@ -342,9 +342,9 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
* {@link #getFullBorderWidth}.
|
||||
*/
|
||||
private int getFullBorderColor() {
|
||||
float rgb = (mBorderRGB != null && !CSSConstants.isUndefined(mBorderRGB.getRaw(Spacing.ALL))) ?
|
||||
float rgb = (mBorderRGB != null && !YogaConstants.isUndefined(mBorderRGB.getRaw(Spacing.ALL))) ?
|
||||
mBorderRGB.getRaw(Spacing.ALL) : DEFAULT_BORDER_RGB;
|
||||
float alpha = (mBorderAlpha != null && !CSSConstants.isUndefined(mBorderAlpha.getRaw(Spacing.ALL))) ?
|
||||
float alpha = (mBorderAlpha != null && !YogaConstants.isUndefined(mBorderAlpha.getRaw(Spacing.ALL))) ?
|
||||
mBorderAlpha.getRaw(Spacing.ALL) : DEFAULT_BORDER_ALPHA;
|
||||
return ReactViewBackgroundDrawable.colorFromAlphaAndRGBComponents(alpha, rgb);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
@@ -61,9 +61,9 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactViewGroup view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactViewGroup view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -146,8 +146,8 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactViewGroup view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ static void _jniTransferLayoutOutputsRecursive(CSSNodeRef root) {
|
||||
_jniTransferLayoutOutputsRecursive(CSSNodeGetChild(root, i));
|
||||
}
|
||||
} else {
|
||||
CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,15 +48,15 @@ static void _jniPrint(CSSNodeRef node) {
|
||||
if (auto obj = jobjectContext(node)->lockLocal()) {
|
||||
cout << obj->toString() << endl;
|
||||
} else {
|
||||
CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
}
|
||||
}
|
||||
|
||||
static CSSSize _jniMeasureFunc(CSSNodeRef node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YGMeasureMode heightMode) {
|
||||
if (auto obj = jobjectContext(node)->lockLocal()) {
|
||||
static auto measureFunc = findClassLocal("com/facebook/csslayout/CSSNode")
|
||||
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
||||
@@ -72,31 +72,31 @@ static CSSSize _jniMeasureFunc(CSSNodeRef node,
|
||||
|
||||
return CSSSize{measuredWidth, measuredHeight};
|
||||
} else {
|
||||
CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n");
|
||||
return CSSSize{
|
||||
widthMode == CSSMeasureModeUndefined ? 0 : width,
|
||||
heightMode == CSSMeasureModeUndefined ? 0 : height,
|
||||
widthMode == YGMeasureModeUndefined ? 0 : width,
|
||||
heightMode == YGMeasureModeUndefined ? 0 : height,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
struct JCSSLogLevel : public JavaClass<JCSSLogLevel> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/CSSLogLevel;";
|
||||
struct JYogaLogLevel : public JavaClass<JYogaLogLevel> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/YogaLogLevel;";
|
||||
};
|
||||
|
||||
static global_ref<jobject> *jLogger;
|
||||
static int _jniLog(CSSLogLevel level, const char *format, va_list args) {
|
||||
static int _jniLog(YGLogLevel level, const char *format, va_list args) {
|
||||
char buffer[256];
|
||||
int result = vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
|
||||
static auto logFunc = findClassLocal("com/facebook/csslayout/CSSLogger")
|
||||
->getMethod<void(local_ref<JCSSLogLevel>, jstring)>("log");
|
||||
->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log");
|
||||
|
||||
static auto logLevelFromInt =
|
||||
JCSSLogLevel::javaClassStatic()->getStaticMethod<JCSSLogLevel::javaobject(jint)>("fromInt");
|
||||
JYogaLogLevel::javaClassStatic()->getStaticMethod<JYogaLogLevel::javaobject(jint)>("fromInt");
|
||||
|
||||
logFunc(jLogger->get(),
|
||||
logLevelFromInt(JCSSLogLevel::javaClassStatic(), static_cast<jint>(level)),
|
||||
logLevelFromInt(JYogaLogLevel::javaClassStatic(), static_cast<jint>(level)),
|
||||
Environment::current()->NewStringUTF(buffer));
|
||||
|
||||
return result;
|
||||
@@ -123,18 +123,18 @@ void jni_CSSLayoutSetLogger(alias_ref<jclass> clazz, alias_ref<jobject> logger)
|
||||
|
||||
void jni_CSSLog(alias_ref<jclass> clazz, jint level, jstring message) {
|
||||
const char *nMessage = Environment::current()->GetStringUTFChars(message, 0);
|
||||
CSSLog(static_cast<CSSLogLevel>(level), "%s", nMessage);
|
||||
CSSLog(static_cast<YGLogLevel>(level), "%s", nMessage);
|
||||
Environment::current()->ReleaseStringUTFChars(message, nMessage);
|
||||
}
|
||||
|
||||
void jni_CSSLayoutSetExperimentalFeatureEnabled(alias_ref<jclass> clazz,
|
||||
jint feature,
|
||||
jboolean enabled) {
|
||||
CSSLayoutSetExperimentalFeatureEnabled(static_cast<CSSExperimentalFeature>(feature), enabled);
|
||||
CSSLayoutSetExperimentalFeatureEnabled(static_cast<YGExperimentalFeature>(feature), enabled);
|
||||
}
|
||||
|
||||
jboolean jni_CSSLayoutIsExperimentalFeatureEnabled(alias_ref<jclass> clazz, jint feature) {
|
||||
return CSSLayoutIsExperimentalFeatureEnabled(static_cast<CSSExperimentalFeature>(feature));
|
||||
return CSSLayoutIsExperimentalFeatureEnabled(static_cast<YGExperimentalFeature>(feature));
|
||||
}
|
||||
|
||||
jint jni_CSSNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
||||
@@ -176,8 +176,8 @@ void jni_CSSNodeRemoveChild(alias_ref<jobject>, jlong nativePointer, jlong child
|
||||
void jni_CSSNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer) {
|
||||
const CSSNodeRef root = _jlong2CSSNodeRef(nativePointer);
|
||||
CSSNodeCalculateLayout(root,
|
||||
CSSUndefined,
|
||||
CSSUndefined,
|
||||
YGUndefined,
|
||||
YGUndefined,
|
||||
CSSNodeStyleGetDirection(_jlong2CSSNodeRef(nativePointer)));
|
||||
_jniTransferLayoutOutputsRecursive(root);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ void jni_CSSNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcN
|
||||
#define CSS_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \
|
||||
javatype jni_CSSNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer, jint edge) { \
|
||||
return (javatype) CSSNodeStyleGet##name(_jlong2CSSNodeRef(nativePointer), \
|
||||
static_cast<CSSEdge>(edge)); \
|
||||
static_cast<YGEdge>(edge)); \
|
||||
} \
|
||||
\
|
||||
void jni_CSSNodeStyleSet##name(alias_ref<jobject>, \
|
||||
@@ -228,19 +228,19 @@ void jni_CSSNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcN
|
||||
jint edge, \
|
||||
javatype value) { \
|
||||
CSSNodeStyleSet##name(_jlong2CSSNodeRef(nativePointer), \
|
||||
static_cast<CSSEdge>(edge), \
|
||||
static_cast<YGEdge>(edge), \
|
||||
static_cast<type>(value)); \
|
||||
}
|
||||
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSDirection, Direction);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSFlexDirection, FlexDirection);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSJustify, JustifyContent);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignItems);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignSelf);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignContent);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSPositionType, PositionType);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSWrap, FlexWrap);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, CSSOverflow, Overflow);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignItems);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignSelf);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
|
||||
CSS_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
|
||||
|
||||
void jni_CSSNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) {
|
||||
CSSNodeStyleSetFlex(_jlong2CSSNodeRef(nativePointer), static_cast<float>(value));
|
||||
|
||||
+50
-50
@@ -11,11 +11,11 @@ package com.facebook.react.uimanager;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.YogaAlign;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaFlexDirection;
|
||||
import com.facebook.csslayout.YogaJustify;
|
||||
import com.facebook.csslayout.YogaPositionType;
|
||||
import com.facebook.react.bridge.JavaOnlyMap;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -135,7 +135,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPosition(eq(Spacing.BOTTOM), anyFloat());
|
||||
verify(reactShadowNode).setPosition(eq(Spacing.END), anyFloat());
|
||||
verify(reactShadowNode).setPositionType(any(CSSPositionType.class));
|
||||
verify(reactShadowNode).setPositionType(any(YogaPositionType.class));
|
||||
verify(map).getFloat("bottom", Float.NaN);
|
||||
verify(map).getFloat("right", Float.NaN);
|
||||
|
||||
@@ -145,7 +145,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode, never()).setPosition(eq(Spacing.BOTTOM), anyFloat());
|
||||
verify(reactShadowNode, never()).setPosition(eq(Spacing.END), anyFloat());
|
||||
verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
|
||||
verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
|
||||
verify(map, never()).getFloat("bottom", Float.NaN);
|
||||
verify(map, never()).getFloat("right", Float.NaN);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.ALL), anyFloat());
|
||||
verify(map).getFloat("margin", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("margin", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginVertical
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -166,7 +166,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.VERTICAL), anyFloat());
|
||||
verify(map).getFloat("marginVertical", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginVertical", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginHorizontal
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -174,7 +174,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.HORIZONTAL), anyFloat());
|
||||
verify(map).getFloat("marginHorizontal", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginHorizontal", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginTop
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -182,7 +182,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.TOP), anyFloat());
|
||||
verify(map).getFloat("marginTop", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginTop", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginBottom
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -190,7 +190,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.BOTTOM), anyFloat());
|
||||
verify(map).getFloat("marginBottom", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginBottom", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginLeft
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -198,7 +198,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.START), anyFloat());
|
||||
verify(map).getFloat("marginLeft", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginLeft", YogaConstants.UNDEFINED);
|
||||
|
||||
// marginRight
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -206,7 +206,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setMargin(eq(Spacing.END), anyFloat());
|
||||
verify(map).getFloat("marginRight", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("marginRight", YogaConstants.UNDEFINED);
|
||||
|
||||
// no margin
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -214,7 +214,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode, never()).setMargin(anyInt(), anyFloat());
|
||||
verify(map, never()).getFloat("margin", CSSConstants.UNDEFINED);
|
||||
verify(map, never()).getFloat("margin", YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -225,7 +225,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.ALL), anyFloat());
|
||||
verify(map).getFloat("padding", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("padding", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingVertical
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -233,7 +233,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.VERTICAL), anyFloat());
|
||||
verify(map).getFloat("paddingVertical", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingVertical", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingHorizontal
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -241,7 +241,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.HORIZONTAL), anyFloat());
|
||||
verify(map).getFloat("paddingHorizontal", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingHorizontal", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingTop
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -249,7 +249,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.TOP), anyFloat());
|
||||
verify(map).getFloat("paddingTop", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingTop", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingBottom
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -257,7 +257,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.BOTTOM), anyFloat());
|
||||
verify(map).getFloat("paddingBottom", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingBottom", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingLeft
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -265,7 +265,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.START), anyFloat());
|
||||
verify(map).getFloat("paddingLeft", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingLeft", YogaConstants.UNDEFINED);
|
||||
|
||||
// paddingRight
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -273,7 +273,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setPadding(eq(Spacing.END), anyFloat());
|
||||
verify(map).getFloat("paddingRight", CSSConstants.UNDEFINED);
|
||||
verify(map).getFloat("paddingRight", YogaConstants.UNDEFINED);
|
||||
|
||||
// no padding
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
@@ -281,7 +281,7 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode, never()).setPadding(anyInt(), anyFloat());
|
||||
verify(map, never()).getFloat("padding", CSSConstants.UNDEFINED);
|
||||
verify(map, never()).getFloat("padding", YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -300,21 +300,21 @@ public class LayoutPropertyApplicatorTest {
|
||||
"relative");
|
||||
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
|
||||
verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
|
||||
verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
|
||||
verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
|
||||
verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);
|
||||
verify(reactShadowNode).setFlexDirection(YogaFlexDirection.COLUMN);
|
||||
verify(reactShadowNode).setAlignSelf(YogaAlign.STRETCH);
|
||||
verify(reactShadowNode).setAlignItems(YogaAlign.CENTER);
|
||||
verify(reactShadowNode).setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
||||
verify(reactShadowNode).setPositionType(YogaPositionType.RELATIVE);
|
||||
|
||||
reactShadowNode = spy(new LayoutShadowNode());
|
||||
map = buildStyles();
|
||||
reactShadowNode.updateProperties(map);
|
||||
|
||||
verify(reactShadowNode, never()).setFlexDirection(any(CSSFlexDirection.class));
|
||||
verify(reactShadowNode, never()).setAlignSelf(any(CSSAlign.class));
|
||||
verify(reactShadowNode, never()).setAlignItems(any(CSSAlign.class));
|
||||
verify(reactShadowNode, never()).setJustifyContent(any(CSSJustify.class));
|
||||
verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
|
||||
verify(reactShadowNode, never()).setFlexDirection(any(YogaFlexDirection.class));
|
||||
verify(reactShadowNode, never()).setAlignSelf(any(YogaAlign.class));
|
||||
verify(reactShadowNode, never()).setAlignItems(any(YogaAlign.class));
|
||||
verify(reactShadowNode, never()).setJustifyContent(any(YogaJustify.class));
|
||||
verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -361,11 +361,11 @@ public class LayoutPropertyApplicatorTest {
|
||||
verify(reactShadowNode).setPadding(Spacing.ALL, 10.f);
|
||||
verify(reactShadowNode).setMargin(Spacing.START, 10.f);
|
||||
verify(reactShadowNode).setBorder(Spacing.TOP, 10.f);
|
||||
verify(reactShadowNode).setFlexDirection(CSSFlexDirection.ROW);
|
||||
verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
|
||||
verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
|
||||
verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
|
||||
verify(reactShadowNode).setPositionType(CSSPositionType.ABSOLUTE);
|
||||
verify(reactShadowNode).setFlexDirection(YogaFlexDirection.ROW);
|
||||
verify(reactShadowNode).setAlignSelf(YogaAlign.STRETCH);
|
||||
verify(reactShadowNode).setAlignItems(YogaAlign.CENTER);
|
||||
verify(reactShadowNode).setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
||||
verify(reactShadowNode).setPositionType(YogaPositionType.ABSOLUTE);
|
||||
|
||||
map = buildStyles(
|
||||
"width",
|
||||
@@ -397,19 +397,19 @@ public class LayoutPropertyApplicatorTest {
|
||||
|
||||
reset(reactShadowNode);
|
||||
reactShadowNode.updateProperties(map);
|
||||
verify(reactShadowNode).setStyleWidth(CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setStyleHeight(CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setPosition(Spacing.START, CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setPosition(Spacing.TOP, CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setStyleWidth(YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setStyleHeight(YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setPosition(Spacing.START, YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setPosition(Spacing.TOP, YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setFlex(0.f);
|
||||
verify(reactShadowNode).setPadding(Spacing.ALL, CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setMargin(Spacing.START, CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setBorder(Spacing.TOP, CSSConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
|
||||
verify(reactShadowNode).setAlignSelf(CSSAlign.AUTO);
|
||||
verify(reactShadowNode).setAlignItems(CSSAlign.STRETCH);
|
||||
verify(reactShadowNode).setJustifyContent(CSSJustify.FLEX_START);
|
||||
verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);
|
||||
verify(reactShadowNode).setPadding(Spacing.ALL, YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setMargin(Spacing.START, YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setBorder(Spacing.TOP, YogaConstants.UNDEFINED);
|
||||
verify(reactShadowNode).setFlexDirection(YogaFlexDirection.COLUMN);
|
||||
verify(reactShadowNode).setAlignSelf(YogaAlign.AUTO);
|
||||
verify(reactShadowNode).setAlignItems(YogaAlign.STRETCH);
|
||||
verify(reactShadowNode).setJustifyContent(YogaJustify.FLEX_START);
|
||||
verify(reactShadowNode).setPositionType(YogaPositionType.RELATIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -7,102 +7,102 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
typedef enum CSSOverflow {
|
||||
CSSOverflowVisible,
|
||||
CSSOverflowHidden,
|
||||
CSSOverflowScroll,
|
||||
CSSOverflowCount,
|
||||
} CSSOverflow;
|
||||
typedef enum YGFlexDirection {
|
||||
YGFlexDirectionColumn,
|
||||
YGFlexDirectionColumnReverse,
|
||||
YGFlexDirectionRow,
|
||||
YGFlexDirectionRowReverse,
|
||||
YGFlexDirectionCount,
|
||||
} YGFlexDirection;
|
||||
|
||||
typedef enum CSSJustify {
|
||||
CSSJustifyFlexStart,
|
||||
CSSJustifyCenter,
|
||||
CSSJustifyFlexEnd,
|
||||
CSSJustifySpaceBetween,
|
||||
CSSJustifySpaceAround,
|
||||
CSSJustifyCount,
|
||||
} CSSJustify;
|
||||
typedef enum YGMeasureMode {
|
||||
YGMeasureModeUndefined,
|
||||
YGMeasureModeExactly,
|
||||
YGMeasureModeAtMost,
|
||||
YGMeasureModeCount,
|
||||
} YGMeasureMode;
|
||||
|
||||
typedef enum CSSFlexDirection {
|
||||
CSSFlexDirectionColumn,
|
||||
CSSFlexDirectionColumnReverse,
|
||||
CSSFlexDirectionRow,
|
||||
CSSFlexDirectionRowReverse,
|
||||
CSSFlexDirectionCount,
|
||||
} CSSFlexDirection;
|
||||
typedef enum YGPrintOptions {
|
||||
YGPrintOptionsLayout = 1,
|
||||
YGPrintOptionsStyle = 2,
|
||||
YGPrintOptionsChildren = 4,
|
||||
YGPrintOptionsCount,
|
||||
} YGPrintOptions;
|
||||
|
||||
typedef enum CSSAlign {
|
||||
CSSAlignAuto,
|
||||
CSSAlignFlexStart,
|
||||
CSSAlignCenter,
|
||||
CSSAlignFlexEnd,
|
||||
CSSAlignStretch,
|
||||
CSSAlignCount,
|
||||
} CSSAlign;
|
||||
typedef enum YGEdge {
|
||||
YGEdgeLeft,
|
||||
YGEdgeTop,
|
||||
YGEdgeRight,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeHorizontal,
|
||||
YGEdgeVertical,
|
||||
YGEdgeAll,
|
||||
YGEdgeCount,
|
||||
} YGEdge;
|
||||
|
||||
typedef enum CSSEdge {
|
||||
CSSEdgeLeft,
|
||||
CSSEdgeTop,
|
||||
CSSEdgeRight,
|
||||
CSSEdgeBottom,
|
||||
CSSEdgeStart,
|
||||
CSSEdgeEnd,
|
||||
CSSEdgeHorizontal,
|
||||
CSSEdgeVertical,
|
||||
CSSEdgeAll,
|
||||
CSSEdgeCount,
|
||||
} CSSEdge;
|
||||
typedef enum YGPositionType {
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeAbsolute,
|
||||
YGPositionTypeCount,
|
||||
} YGPositionType;
|
||||
|
||||
typedef enum CSSWrap {
|
||||
CSSWrapNoWrap,
|
||||
CSSWrapWrap,
|
||||
CSSWrapCount,
|
||||
} CSSWrap;
|
||||
typedef enum YGDimension {
|
||||
YGDimensionWidth,
|
||||
YGDimensionHeight,
|
||||
YGDimensionCount,
|
||||
} YGDimension;
|
||||
|
||||
typedef enum CSSDirection {
|
||||
CSSDirectionInherit,
|
||||
CSSDirectionLTR,
|
||||
CSSDirectionRTL,
|
||||
CSSDirectionCount,
|
||||
} CSSDirection;
|
||||
typedef enum YGJustify {
|
||||
YGJustifyFlexStart,
|
||||
YGJustifyCenter,
|
||||
YGJustifyFlexEnd,
|
||||
YGJustifySpaceBetween,
|
||||
YGJustifySpaceAround,
|
||||
YGJustifyCount,
|
||||
} YGJustify;
|
||||
|
||||
typedef enum CSSExperimentalFeature {
|
||||
CSSExperimentalFeatureRounding,
|
||||
CSSExperimentalFeatureWebFlexBasis,
|
||||
CSSExperimentalFeatureCount,
|
||||
} CSSExperimentalFeature;
|
||||
typedef enum YGDirection {
|
||||
YGDirectionInherit,
|
||||
YGDirectionLTR,
|
||||
YGDirectionRTL,
|
||||
YGDirectionCount,
|
||||
} YGDirection;
|
||||
|
||||
typedef enum CSSLogLevel {
|
||||
CSSLogLevelError,
|
||||
CSSLogLevelWarn,
|
||||
CSSLogLevelInfo,
|
||||
CSSLogLevelDebug,
|
||||
CSSLogLevelVerbose,
|
||||
CSSLogLevelCount,
|
||||
} CSSLogLevel;
|
||||
typedef enum YGLogLevel {
|
||||
YGLogLevelError,
|
||||
YGLogLevelWarn,
|
||||
YGLogLevelInfo,
|
||||
YGLogLevelDebug,
|
||||
YGLogLevelVerbose,
|
||||
YGLogLevelCount,
|
||||
} YGLogLevel;
|
||||
|
||||
typedef enum CSSDimension {
|
||||
CSSDimensionWidth,
|
||||
CSSDimensionHeight,
|
||||
CSSDimensionCount,
|
||||
} CSSDimension;
|
||||
typedef enum YGWrap {
|
||||
YGWrapNoWrap,
|
||||
YGWrapWrap,
|
||||
YGWrapCount,
|
||||
} YGWrap;
|
||||
|
||||
typedef enum CSSMeasureMode {
|
||||
CSSMeasureModeUndefined,
|
||||
CSSMeasureModeExactly,
|
||||
CSSMeasureModeAtMost,
|
||||
CSSMeasureModeCount,
|
||||
} CSSMeasureMode;
|
||||
typedef enum YGOverflow {
|
||||
YGOverflowVisible,
|
||||
YGOverflowHidden,
|
||||
YGOverflowScroll,
|
||||
YGOverflowCount,
|
||||
} YGOverflow;
|
||||
|
||||
typedef enum CSSPositionType {
|
||||
CSSPositionTypeRelative,
|
||||
CSSPositionTypeAbsolute,
|
||||
CSSPositionTypeCount,
|
||||
} CSSPositionType;
|
||||
typedef enum YGExperimentalFeature {
|
||||
YGExperimentalFeatureRounding,
|
||||
YGExperimentalFeatureWebFlexBasis,
|
||||
YGExperimentalFeatureCount,
|
||||
} YGExperimentalFeature;
|
||||
|
||||
typedef enum CSSPrintOptions {
|
||||
CSSPrintOptionsLayout = 1,
|
||||
CSSPrintOptionsStyle = 2,
|
||||
CSSPrintOptionsChildren = 4,
|
||||
CSSPrintOptionsCount,
|
||||
} CSSPrintOptions;
|
||||
typedef enum YGAlign {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
YGAlignCenter,
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignCount,
|
||||
} YGAlign;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@ static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
|
||||
#define NAN (*(const float *) __nan)
|
||||
#endif
|
||||
|
||||
#define CSSUndefined NAN
|
||||
#define YGUndefined NAN
|
||||
|
||||
#include "CSSEnums.h"
|
||||
#include "CSSMacros.h"
|
||||
@@ -41,11 +41,11 @@ typedef struct CSSSize {
|
||||
typedef struct CSSNode *CSSNodeRef;
|
||||
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
YGMeasureMode heightMode);
|
||||
typedef void (*CSSPrintFunc)(CSSNodeRef node);
|
||||
typedef int (*CSSLogger)(CSSLogLevel level, const char *format, va_list args);
|
||||
typedef int (*CSSLogger)(YGLogLevel level, const char *format, va_list args);
|
||||
|
||||
typedef void *(*CSSMalloc)(size_t size);
|
||||
typedef void *(*CSSCalloc)(size_t count, size_t size);
|
||||
@@ -70,7 +70,7 @@ WIN_EXPORT uint32_t CSSNodeChildCount(const CSSNodeRef node);
|
||||
WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
|
||||
const float availableWidth,
|
||||
const float availableHeight,
|
||||
const CSSDirection parentDirection);
|
||||
const YGDirection parentDirection);
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
// set.
|
||||
@@ -81,17 +81,17 @@ WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
|
||||
WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node);
|
||||
WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node);
|
||||
|
||||
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options);
|
||||
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool CSSValueIsUndefined(const float value);
|
||||
|
||||
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode,
|
||||
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
||||
const float width,
|
||||
const CSSMeasureMode heightMode,
|
||||
const YGMeasureMode heightMode,
|
||||
const float height,
|
||||
const CSSMeasureMode lastWidthMode,
|
||||
const YGMeasureMode lastWidthMode,
|
||||
const float lastWidth,
|
||||
const CSSMeasureMode lastHeightMode,
|
||||
const YGMeasureMode lastHeightMode,
|
||||
const float lastHeight,
|
||||
const float lastComputedWidth,
|
||||
const float lastComputedHeight,
|
||||
@@ -110,9 +110,9 @@ WIN_EXPORT void CSSNodeCopyStyle(const CSSNodeRef dstNode, const CSSNodeRef srcN
|
||||
|
||||
#define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \
|
||||
const CSSEdge edge, \
|
||||
const YGEdge edge, \
|
||||
const type paramName); \
|
||||
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge);
|
||||
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const YGEdge edge);
|
||||
|
||||
#define CSS_NODE_LAYOUT_PROPERTY(type, name) \
|
||||
WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node);
|
||||
@@ -122,15 +122,15 @@ CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc);
|
||||
CSS_NODE_PROPERTY(CSSPrintFunc, PrintFunc, printFunc);
|
||||
CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
|
||||
|
||||
CSS_NODE_STYLE_PROPERTY(CSSDirection, Direction, direction);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSFlexDirection, FlexDirection, flexDirection);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSJustify, JustifyContent, justifyContent);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignContent, alignContent);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignItems, alignItems);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignSelf, alignSelf);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSWrap, FlexWrap, flexWrap);
|
||||
CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow);
|
||||
CSS_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
|
||||
CSS_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
|
||||
CSS_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
|
||||
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
|
||||
CSS_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
|
||||
CSS_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
|
||||
CSS_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
||||
|
||||
WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex);
|
||||
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
||||
@@ -167,14 +167,13 @@ CSS_NODE_LAYOUT_PROPERTY(float, Right);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Bottom);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Width);
|
||||
CSS_NODE_LAYOUT_PROPERTY(float, Height);
|
||||
CSS_NODE_LAYOUT_PROPERTY(CSSDirection, Direction);
|
||||
CSS_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger);
|
||||
WIN_EXPORT void CSSLog(CSSLogLevel level, const char *message, ...);
|
||||
WIN_EXPORT void CSSLog(YGLogLevel level, const char *message, ...);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature,
|
||||
bool enabled);
|
||||
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature);
|
||||
WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
|
||||
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
|
||||
|
||||
WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc,
|
||||
CSSCalloc cssCalloc,
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
#endif
|
||||
|
||||
#ifndef CSS_ASSERT
|
||||
#define CSS_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
CSSLog(CSSLogLevelError, "%s", message); \
|
||||
CSS_ABORT(); \
|
||||
#define CSS_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
CSSLog(YGLogLevelError, "%s", message); \
|
||||
CSS_ABORT(); \
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user