react-native-windows 0.73.11 → 0.74.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +12 -7
- package/Chakra/ChakraUtils.cpp +5 -10
- package/Chakra/ChakraUtils.h +2 -2
- package/Common/packages.lock.json +3 -3
- package/Directory.Build.props +5 -5
- package/Folly/Folly.vcxproj +2 -2
- package/Folly/Folly.vcxproj.filters +7 -0
- package/Folly/TEMP_UntilFollyUpdate/dynamic-inl.h +22 -1
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +4 -1
- package/Folly/cgmanifest.json +1 -1
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +6 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +6 -0
- package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +4 -45
- package/Libraries/Alert/Alert.windows.js +2 -3
- package/Libraries/Alert/NativeAlertManager.js +4 -26
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedPlatformConfig.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +14 -11
- package/Libraries/Animated/NativeAnimatedModule.js +4 -68
- package/Libraries/Animated/NativeAnimatedTurboModule.js +4 -69
- package/Libraries/Animated/animations/Animation.js +6 -22
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -16
- package/Libraries/Animated/components/AnimatedScrollView.js +36 -31
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -20
- package/Libraries/Animated/createAnimatedComponent.js +45 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +1 -1
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +21 -1
- package/Libraries/AppState/NativeAppState.js +4 -24
- package/Libraries/AppTheme/NativeAppTheme.js +4 -25
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/Blob.js +1 -4
- package/Libraries/Blob/BlobManager.js +6 -8
- package/Libraries/Blob/File.js +1 -1
- package/Libraries/Blob/NativeBlobModule.js +4 -50
- package/Libraries/Blob/NativeFileReaderModule.js +4 -13
- package/Libraries/BugReporting/NativeBugReporting.js +4 -12
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js +3 -23
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js +4 -57
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js +3 -2
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.windows.js +3 -2
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +9 -40
- package/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +3 -43
- package/Libraries/Components/Button.js +103 -107
- package/Libraries/Components/Button.windows.js +199 -206
- package/Libraries/Components/Clipboard/NativeClipboard.js +3 -11
- package/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +3 -114
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -5
- package/Libraries/Components/Keyboard/KeyboardExt.d.ts +8 -8
- package/Libraries/Components/Keyboard/KeyboardExt.js +27 -27
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Keyboard/KeyboardExtProps.d.ts +17 -17
- package/Libraries/Components/Keyboard/KeyboardExtProps.js +7 -7
- package/Libraries/Components/Keyboard/KeyboardExtProps.js.map +1 -1
- package/Libraries/Components/Keyboard/NativeKeyboardObserver.js +3 -10
- package/Libraries/Components/Pressable/Pressable.js +1 -1
- package/Libraries/Components/Pressable/Pressable.windows.js +1 -2
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +5 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +4 -24
- package/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +3 -64
- package/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +3 -61
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.windows.js +1 -1
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +3 -15
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +3 -16
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +5 -6
- package/Libraries/Components/ScrollView/ScrollView.js +12 -38
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -2
- package/Libraries/Components/Sound/NativeSoundManager.js +3 -12
- package/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +3 -58
- package/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +3 -79
- package/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +4 -53
- package/Libraries/Components/Switch/Switch.js +0 -2
- package/Libraries/Components/Switch/Switch.windows.js +0 -2
- package/Libraries/Components/Switch/SwitchNativeComponent.js +4 -52
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +8 -0
- package/Libraries/Components/TextInput/InputAccessoryView.js +18 -20
- package/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +4 -17
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +3 -6
- package/Libraries/Components/TextInput/TextInput.d.ts +16 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +16 -0
- package/Libraries/Components/TextInput/TextInput.js +65 -32
- package/Libraries/Components/TextInput/TextInput.windows.js +87 -38
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +773 -9
- package/Libraries/Components/ToastAndroid/NativeToastAndroid.js +3 -28
- package/Libraries/Components/Touchable/PooledClass.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +2 -3
- package/Libraries/Components/Touchable/Touchable.windows.js +2 -3
- package/Libraries/Components/Touchable/TouchableHighlight.js +4 -4
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +4 -4
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +5 -2
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +5 -2
- package/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +3 -16
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +2 -1
- package/Libraries/Components/View/View.js +0 -11
- package/Libraries/Components/View/View.windows.js +19 -18
- package/Libraries/Components/View/ViewAccessibility.d.ts +33 -17
- package/Libraries/Components/View/ViewPropTypes.d.ts +28 -17
- package/Libraries/Components/View/ViewPropTypes.js +36 -36
- package/Libraries/Components/View/ViewPropTypes.windows.js +36 -36
- package/Libraries/Core/InitializeCore.js +1 -1
- package/Libraries/Core/NativeExceptionsManager.js +3 -93
- package/Libraries/Core/ReactNativeVersion.js +12 -6
- package/Libraries/Core/ReactNativeVersionCheck.js +6 -6
- package/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +3 -18
- package/Libraries/Core/Timers/NativeTiming.js +3 -16
- package/Libraries/Core/registerCallableModule.d.ts +16 -0
- package/Libraries/Core/registerCallableModule.js +42 -0
- package/Libraries/Core/setUpPerformance.js +2 -2
- package/Libraries/Core/setUpPerformanceObserver.js +3 -1
- package/Libraries/Debugging/DebuggingOverlay.js +111 -0
- package/Libraries/Debugging/DebuggingOverlayNativeComponent.js +13 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +513 -0
- package/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry.js +32 -0
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +3 -14
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +3 -9
- package/Libraries/Image/AssetSourceResolver.js +5 -5
- package/Libraries/Image/AssetUtils.js +4 -5
- package/Libraries/Image/Image.android.js +146 -174
- package/Libraries/Image/Image.d.ts +1 -1
- package/Libraries/Image/Image.ios.js +53 -79
- package/Libraries/Image/Image.windows.js +53 -79
- package/Libraries/Image/ImageBackground.js +2 -2
- package/Libraries/Image/ImageInjection.js +76 -18
- package/Libraries/Image/ImageTypes.flow.js +71 -0
- package/Libraries/Image/ImageUtils.js +1 -1
- package/Libraries/Image/ImageViewNativeComponent.js +18 -0
- package/Libraries/Image/NativeImageEditor.js +3 -42
- package/Libraries/Image/NativeImageLoaderAndroid.js +4 -28
- package/Libraries/Image/NativeImageLoaderIOS.js +4 -28
- package/Libraries/Image/NativeImageStoreAndroid.js +3 -16
- package/Libraries/Image/NativeImageStoreIOS.js +3 -23
- package/Libraries/Image/resolveAssetSource.js +59 -26
- package/Libraries/Image/resolveAssetSource.windows.js +148 -0
- package/Libraries/Inspector/ElementProperties.js +26 -52
- package/Libraries/Inspector/Inspector.js +122 -186
- package/Libraries/Inspector/InspectorOverlay.js +21 -33
- package/Libraries/Inspector/InspectorPanel.js +3 -17
- package/Libraries/Inspector/ReactDevToolsOverlay.js +171 -0
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +20 -8
- package/Libraries/Interaction/FrameRateLogger.js +8 -18
- package/Libraries/Interaction/NativeFrameRateLogger.js +4 -16
- package/Libraries/IntersectionObserver/IntersectionObserver.js +1 -1
- package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +20 -19
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +84 -6
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +3 -31
- package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +12 -2
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -2
- package/Libraries/Linking/NativeIntentAndroid.js +3 -20
- package/Libraries/Linking/NativeLinkingManager.js +3 -17
- package/Libraries/Lists/FillRateHelper.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +6 -2
- package/Libraries/Lists/FlatList.windows.js +717 -0
- package/Libraries/Lists/SectionList.d.ts +6 -1
- package/Libraries/Lists/ViewabilityHelper.js +1 -1
- package/Libraries/Lists/VirtualizeUtils.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +1 -1
- package/Libraries/Lists/VirtualizedListContext.js +1 -1
- package/Libraries/Lists/VirtualizedSectionList.js +1 -1
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/Modal/Modal.js +43 -11
- package/Libraries/Modal/NativeModalManager.js +3 -11
- package/Libraries/Modal/RCTModalHostViewNativeComponent.js +3 -129
- package/Libraries/MutationObserver/MutationObserver.js +1 -1
- package/Libraries/MutationObserver/MutationObserverManager.js +2 -2
- package/Libraries/MutationObserver/MutationRecord.js +12 -10
- package/Libraries/MutationObserver/NativeMutationObserver.js +3 -48
- package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +3 -10
- package/Libraries/NativeModules/specs/NativeDevMenu.js +3 -13
- package/Libraries/NativeModules/specs/NativeDevSettings.js +3 -23
- package/Libraries/NativeModules/specs/NativeDeviceEventManager.js +3 -9
- package/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js +3 -38
- package/Libraries/NativeModules/specs/NativeDialogManagerWindows.js +11 -0
- package/Libraries/NativeModules/specs/NativeLogBox.js +3 -10
- package/Libraries/NativeModules/specs/NativeRedBox.js +4 -11
- package/Libraries/NativeModules/specs/NativeSourceCode.js +2 -25
- package/Libraries/Network/FormData.js +3 -1
- package/Libraries/Network/NativeNetworkingAndroid.js +4 -28
- package/Libraries/Network/NativeNetworkingIOS.js +4 -28
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +4 -2
- package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +3 -1
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +3 -9
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +4 -68
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
- package/Libraries/Pressability/Pressability.js +12 -2
- package/Libraries/Pressability/Pressability.windows.js +13 -3
- package/Libraries/Pressability/usePressability.js +7 -0
- package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +4 -70
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +45 -39
- package/Libraries/ReactNative/AppContainer-dev.js +211 -0
- package/Libraries/ReactNative/AppContainer-prod.js +53 -0
- package/Libraries/ReactNative/AppContainer.js +6 -149
- package/Libraries/ReactNative/AppRegistry.js +3 -1
- package/Libraries/ReactNative/BridgelessUIManager.js +375 -128
- package/Libraries/ReactNative/FabricUIManager.js +6 -0
- package/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js +3 -10
- package/Libraries/ReactNative/NativeI18nManager.js +3 -18
- package/Libraries/ReactNative/NativeUIManager.js +4 -112
- package/Libraries/ReactNative/PaperUIManager.js +8 -7
- package/Libraries/ReactNative/PaperUIManager.windows.js +29 -8
- package/Libraries/ReactNative/ReactFabricInternals.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +24 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -45
- package/Libraries/ReactNative/RendererImplementation.js +11 -0
- package/Libraries/ReactNative/UIManager.d.ts +11 -34
- package/Libraries/ReactNative/UIManager.js +2 -23
- package/Libraries/ReactNative/UIManagerProperties.js +0 -2
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +23 -1
- package/Libraries/ReactNative/getNativeComponentAttributes.js +5 -1
- package/Libraries/ReactNative/renderApplication.js +9 -6
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +6 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +24771 -21123
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4160 -3109
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4384 -3322
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +25194 -21398
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3763 -2636
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4027 -2867
- package/Libraries/Renderer/shims/ReactNativeTypes.js +8 -9
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -12
- package/Libraries/Settings/NativeSettingsManager.js +4 -16
- package/Libraries/Share/NativeShareModule.js +3 -13
- package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +1 -20
- package/Libraries/StyleSheet/StyleSheet.js +5 -28
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +51 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +19 -11
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processAspectRatio.js +1 -1
- package/Libraries/StyleSheet/processFontVariant.js +1 -1
- package/Libraries/Text/Text.js +0 -6
- package/Libraries/Text/Text.windows.js +0 -6
- package/Libraries/Text/TextAncestor.js +2 -3
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +4 -41
- package/Libraries/Types/ReactDevToolsTypes.js +58 -0
- package/Libraries/Types/UIManagerJSInterface.js +16 -0
- package/Libraries/Utilities/DebugEnvironment.js +1 -4
- package/Libraries/Utilities/Dimensions.js +8 -16
- package/Libraries/Utilities/GlobalPerformanceLogger.js +1 -2
- package/Libraries/Utilities/NativeAppearance.js +3 -26
- package/Libraries/Utilities/NativeDevLoadingView.js +3 -14
- package/Libraries/Utilities/NativeDeviceInfo.js +2 -47
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +3 -34
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +3 -26
- package/Libraries/Utilities/NativePlatformConstantsWin.js +3 -23
- package/Libraries/Utilities/PixelRatio.d.ts +4 -4
- package/Libraries/Utilities/Platform.android.js +4 -0
- package/Libraries/Utilities/Platform.d.ts +3 -0
- package/Libraries/Utilities/Platform.flow.js +7 -0
- package/Libraries/Utilities/Platform.flow.windows.js +9 -0
- package/Libraries/Utilities/Platform.ios.js +11 -0
- package/Libraries/Utilities/Platform.windows.js +6 -0
- package/Libraries/Utilities/binaryToBase64.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +4 -6
- package/Libraries/Utilities/createPerformanceLogger.js +2 -74
- package/Libraries/Utilities/useMergeRefs.js +5 -9
- package/Libraries/Vibration/NativeVibration.js +3 -14
- package/Libraries/WebSocket/NativeWebSocketModule.js +4 -25
- package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +1 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +50 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +23 -0
- package/Microsoft.ReactNative/Base/CoreUIManagers.cpp +4 -0
- package/Microsoft.ReactNative/Base/CxxReactIncludes.h +1 -1
- package/Microsoft.ReactNative/Base/FollyIncludes.h +2 -2
- package/Microsoft.ReactNative/ComponentView.idl +106 -0
- package/Microsoft.ReactNative/Composition.Input.idl +16 -2
- package/Microsoft.ReactNative/CompositionComponentView.idl +117 -0
- package/Microsoft.ReactNative/CompositionContext.idl +1 -1
- package/Microsoft.ReactNative/CompositionRootView.idl +8 -0
- package/Microsoft.ReactNative/CompositionSwitcher.idl +25 -14
- package/Microsoft.ReactNative/DevMenuControl.idl +0 -3
- package/Microsoft.ReactNative/DevMenuControl.xaml +0 -15
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +189 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.h +80 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +83 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +83 -0
- package/Microsoft.ReactNative/Fabric/AbiState.cpp +71 -0
- package/Microsoft.ReactNative/Fabric/AbiState.h +38 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +48 -19
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +8 -16
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +97 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +39 -0
- package/Microsoft.ReactNative/Fabric/AbiViewShadowNode.cpp +90 -0
- package/Microsoft.ReactNative/Fabric/AbiViewShadowNode.h +87 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +340 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.h +130 -64
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +48 -24
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +18 -14
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +42 -27
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.h +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +123 -28
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +69 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +651 -284
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +7 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +120 -31
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +308 -129
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +34 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +61 -54
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.h +0 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +99 -30
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +273 -28
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +28 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +7 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +479 -280
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +133 -79
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +113 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +61 -41
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +19 -14
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +343 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +67 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +53 -186
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +20 -12
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +59 -150
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +27 -76
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -32
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +27 -14
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +707 -64
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +47 -26
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +225 -125
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +34 -21
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +179 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +25 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +110 -115
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +228 -79
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +43 -22
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +4 -44
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +550 -0
- package/Microsoft.ReactNative/Fabric/Composition/Theme.h +73 -0
- package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +85 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +48 -26
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +30 -65
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +16 -25
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +72 -88
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +5 -2
- package/Microsoft.ReactNative/Fabric/IComponentViewRegistry.h +3 -2
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +6 -6
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +2 -2
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +12 -7
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +28 -19
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +5 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/WindowsViewEvents.h +2 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Float.h +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +86 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +38 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/{Color.cpp → PlatformColorUtils.cpp} +7 -77
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.h +12 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +2 -0
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +6 -87
- package/Microsoft.ReactNative/IReactContext.idl +3 -0
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +71 -1
- package/Microsoft.ReactNative/JsiApi.cpp +17 -7
- package/Microsoft.ReactNative/JsiApi.h +2 -2
- package/Microsoft.ReactNative/JsiApi.idl +5 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +13 -22
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +6 -2
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AlertModule.h +2 -2
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +12 -8
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.h +2 -2
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +5 -3
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +4 -4
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +10 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +71 -38
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +5 -5
- package/Microsoft.ReactNative/Modules/ExceptionsManager.cpp +110 -0
- package/Microsoft.ReactNative/Modules/ExceptionsManager.h +54 -0
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +11 -10
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +8 -6
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +3 -3
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +5 -28
- package/Microsoft.ReactNative/Modules/NativeUIManager.h +1 -1
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +8 -5
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +3 -3
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.cpp +49 -0
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.h +18 -0
- package/Microsoft.ReactNative/Modules/SourceCode.cpp +31 -0
- package/Microsoft.ReactNative/Modules/SourceCode.h +28 -0
- package/Microsoft.ReactNative/Modules/StatusBarManager.h +12 -0
- package/Microsoft.ReactNative/Modules/Timing.cpp +325 -0
- package/Microsoft.ReactNative/Modules/Timing.h +121 -0
- package/Microsoft.ReactNative/QuirkSettings.cpp +32 -0
- package/Microsoft.ReactNative/QuirkSettings.h +9 -0
- package/Microsoft.ReactNative/QuirkSettings.idl +6 -0
- package/Microsoft.ReactNative/ReactCoreInjection.cpp +15 -0
- package/Microsoft.ReactNative/ReactCoreInjection.h +4 -0
- package/Microsoft.ReactNative/ReactCoreInjection.idl +8 -0
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +1 -1
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +1 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +556 -234
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +36 -9
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +3 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +8 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.h +4 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.idl +12 -0
- package/Microsoft.ReactNative/SchedulerSettings.cpp +23 -0
- package/Microsoft.ReactNative/SchedulerSettings.h +9 -1
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +41 -0
- package/Microsoft.ReactNative/SynchronousEventBeat.h +29 -0
- package/Microsoft.ReactNative/Theme.idl +57 -0
- package/Microsoft.ReactNative/Timer.cpp +63 -0
- package/Microsoft.ReactNative/{CoreAppPage.h → Timer.h} +12 -5
- package/Microsoft.ReactNative/Timer.idl +34 -0
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +4 -0
- package/Microsoft.ReactNative/Utils/ImageUtils.cpp +37 -3
- package/Microsoft.ReactNative/Utils/ImageUtils.h +0 -1
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +11 -12
- package/Microsoft.ReactNative/Utils/LocalBundleReader.h +3 -3
- package/Microsoft.ReactNative/Utils/ThemeUtils.cpp +33 -0
- package/Microsoft.ReactNative/Utils/ThemeUtils.h +13 -0
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -5
- package/Microsoft.ReactNative/Utils/ValueUtils.h +0 -3
- package/Microsoft.ReactNative/ViewProps.idl +17 -0
- package/Microsoft.ReactNative/Views/ActivityIndicatorViewManager.cpp +1 -0
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.cpp +54 -0
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.h +30 -0
- package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -20
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +157 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.h +5 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +20 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.h +4 -0
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +1 -5
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +137 -0
- package/Microsoft.ReactNative/Views/ICompositionRootView.h +0 -1
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +0 -5
- package/Microsoft.ReactNative/Views/PopupViewManager.cpp +1 -5
- package/Microsoft.ReactNative/Views/ShadowNodeBase.cpp +11 -0
- package/Microsoft.ReactNative/Views/ShadowNodeBase.h +3 -4
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +0 -6
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +0 -11
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.cpp +79 -0
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.h +27 -0
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +46 -0
- package/Microsoft.ReactNative/Views/ViewManagerBase.h +1 -1
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +77 -2
- package/Microsoft.ReactNative/microsoft.reactnative.def +0 -3
- package/Microsoft.ReactNative/packages.lock.json +9 -6
- package/{Shared/Composition → Microsoft.ReactNative.Cxx}/AutoDraw.h +2 -0
- package/{Shared/Composition → Microsoft.ReactNative.Cxx}/CompositionSwitcher.interop.h +4 -10
- package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -5
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +5 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +19 -10
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +2 -0
- package/Microsoft.ReactNative.Cxx/JSValueComposition.h +22 -0
- package/Microsoft.ReactNative.Cxx/JSValueReader.h +19 -0
- package/Microsoft.ReactNative.Cxx/JSValueXaml.h +1 -1
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +6 -4
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +0 -1
- package/Microsoft.ReactNative.Cxx/NativeModules.h +15 -15
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +1 -1
- package/Microsoft.ReactNative.Managed/ReactSettingsSnapshot.cs +2 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +6 -3
- package/Microsoft.ReactNative.Managed.CodeGen/Microsoft.ReactNative.Managed.CodeGen.csproj +0 -1
- package/Mso/future/details/executor.h +1 -1
- package/Mso/src/debugAssertApi/debugAssertApi.cpp +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Common.props +8 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.props +24 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.targets +20 -0
- package/PropertySheets/External/Microsoft.ReactNative.Cpp.Dependencies.props +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +2 -0
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/JSEngine.props +0 -8
- package/PropertySheets/React.Cpp.props +14 -3
- package/PropertySheets/ReactCommunity.cpp.props +2 -2
- package/PropertySheets/Release.props +0 -1
- package/PropertySheets/WinUI.props +21 -1
- package/PropertySheets/x64.props +3 -0
- package/PropertySheets/x86.props +3 -0
- package/ReactCommon/ReactCommon.vcxproj +13 -8
- package/ReactCommon/ReactCommon.vcxproj.filters +12 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +114 -19
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.cpp +66 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +114 -52
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +13 -15
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +535 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +437 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.cpp +39 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.h +31 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/YGEnums.h +19 -24
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +600 -980
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/enums/ExperimentalFeature.h +5 -11
- package/ReactCommon/cgmanifest.json +1 -1
- package/Scripts/EnableInternalWinAppSDKFeed.ps1 +21 -0
- package/Scripts/IntegrationTests.ps1 +26 -15
- package/Scripts/Microsoft.ReactNative.targets +0 -6
- package/Scripts/OfficeReact.Win32.nuspec +1 -2
- package/Scripts/TestServers.ps1 +2 -28
- package/Scripts/Tfs/Start-TestServers.ps1 +1 -21
- package/Scripts/Tfs/Stop-TestServers.ps1 +0 -5
- package/Scripts/rnw-dependencies.ps1 +38 -67
- package/Shared/CreateInstance.h +25 -0
- package/Shared/DevServerHelper.h +0 -3
- package/Shared/DevSettings.h +9 -0
- package/Shared/HermesRuntimeHolder.cpp +17 -0
- package/Shared/HermesRuntimeHolder.h +17 -0
- package/Shared/HermesSamplingProfiler.cpp +12 -10
- package/Shared/HermesSamplingProfiler.h +5 -4
- package/Shared/IDevSupportManager.h +4 -2
- package/Shared/InstanceManager.cpp +13 -11
- package/Shared/InstanceManager.h +8 -18
- package/Shared/JSI/ChakraRuntime.cpp +66 -9
- package/Shared/JSI/ChakraRuntime.h +8 -0
- package/Shared/JSI/JSExecutorFactoryDelegate.h +12 -0
- package/Shared/JSI/JSExecutorFactorySettings.cpp +30 -0
- package/Shared/JSI/JSExecutorFactorySettings.h +21 -0
- package/Shared/Modules/BlobModule.h +1 -1
- package/Shared/Modules/FileReaderModule.h +1 -1
- package/Shared/Modules/HttpModule.h +1 -1
- package/Shared/Modules/WebSocketTurboModule.h +1 -1
- package/Shared/OInstance.cpp +212 -165
- package/Shared/OInstance.h +19 -0
- package/Shared/Shared.vcxitems +134 -50
- package/Shared/Shared.vcxitems.filters +81 -24
- package/Shared/Utils.cpp +12 -10
- package/Shared/Utils.h +2 -2
- package/Shared/WebSocketJSExecutorFactory.h +1 -0
- package/codegen/NativeBugReportingSpec.g.h +0 -6
- package/codegen/NativeFrameRateLoggerSpec.g.h +0 -2
- package/codegen/NativeImageLoaderAndroidSpec.g.h +10 -23
- package/codegen/NativePerformanceObserverSpec.g.h +6 -0
- package/codegen/NativePlatformConstantsIOSSpec.g.h +2 -0
- package/codegen/NativePlatformConstantsWinSpec.g.h +17 -0
- package/codegen/NativePushNotificationManagerIOSSpec.g.h +8 -6
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +88 -0
- package/codegen/NativeUIManagerSpec.g.h +83 -95
- package/codegen/react/components/rnwcore/ComponentDescriptors.h +9 -7
- package/codegen/react/components/rnwcore/EventEmitters.cpp +35 -56
- package/codegen/react/components/rnwcore/EventEmitters.h +58 -85
- package/codegen/react/components/rnwcore/Props.cpp +53 -95
- package/codegen/react/components/rnwcore/Props.h +188 -239
- package/codegen/react/components/rnwcore/ShadowNodes.cpp +5 -7
- package/codegen/react/components/rnwcore/ShadowNodes.h +27 -29
- package/codegen/react/components/rnwcore/States.cpp +3 -5
- package/codegen/react/components/rnwcore/States.h +17 -19
- package/codegen/rnwcoreJSI-generated.cpp +1442 -1398
- package/codegen/rnwcoreJSI.h +6066 -3593
- package/index.js +61 -99
- package/index.windows.js +60 -102
- package/jest/assetFileTransformer.js +1 -1
- package/jest/local-setup.js +0 -5
- package/jest/mockModal.js +2 -1
- package/jest/mockScrollView.js +1 -2
- package/jest/renderer.js +1 -1
- package/jest/setup.js +6 -3
- package/just-task.js +1 -1
- package/package.json +31 -29
- package/{Libraries/Core → src/private/core}/setUpDOM.js +2 -2
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +42 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +140 -0
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +84 -0
- package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +92 -0
- package/src/private/specs/components/ActivityIndicatorViewNativeComponent.js +53 -0
- package/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js +124 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +26 -0
- package/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js +74 -0
- package/src/private/specs/components/AndroidSwitchNativeComponent.js +62 -0
- package/src/private/specs/components/DebuggingOverlayNativeComponent.js +61 -0
- package/src/private/specs/components/ProgressBarAndroidNativeComponent.js +36 -0
- package/src/private/specs/components/PullToRefreshViewNativeComponent.js +71 -0
- package/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js +26 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +139 -0
- package/src/private/specs/components/RCTSafeAreaViewNativeComponent.js +25 -0
- package/src/private/specs/components/SwitchNativeComponent.js +61 -0
- package/src/private/specs/components/UnimplementedNativeViewNativeComponent.js +26 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +33 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +66 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +54 -0
- package/src/private/specs/modules/NativeAlertManager.js +35 -0
- package/src/private/specs/modules/NativeAnimatedModule.js +77 -0
- package/src/private/specs/modules/NativeAnimatedTurboModule.js +78 -0
- package/src/private/specs/modules/NativeAnimationsDebugModule.js +20 -0
- package/src/private/specs/modules/NativeAppState.js +33 -0
- package/src/private/specs/modules/NativeAppTheme.js +33 -0
- package/src/private/specs/modules/NativeAppearance.js +36 -0
- package/src/private/specs/modules/NativeBlobModule.js +59 -0
- package/src/private/specs/modules/NativeBugReporting.js +20 -0
- package/src/private/specs/modules/NativeClipboard.js +21 -0
- package/src/private/specs/modules/NativeDevLoadingView.js +24 -0
- package/src/private/specs/modules/NativeDevMenu.js +23 -0
- package/src/private/specs/modules/NativeDevSettings.js +33 -0
- package/src/private/specs/modules/NativeDevToolsSettingsManager.js +24 -0
- package/src/private/specs/modules/NativeDeviceEventManager.js +19 -0
- package/src/private/specs/modules/NativeDeviceInfo.js +58 -0
- package/src/private/specs/modules/NativeDialogManagerAndroid.js +48 -0
- package/{Libraries/Alert → src/private/specs/modules}/NativeDialogManagerWindows.js +5 -4
- package/src/private/specs/modules/NativeExceptionsManager.js +103 -0
- package/src/private/specs/modules/NativeFileReaderModule.js +22 -0
- package/src/private/specs/modules/NativeFrameRateLogger.js +22 -0
- package/src/private/specs/modules/NativeHeadlessJsTaskSupport.js +20 -0
- package/src/private/specs/modules/NativeI18nManager.js +28 -0
- package/src/private/specs/modules/NativeImageEditor.js +52 -0
- package/src/private/specs/modules/NativeImageLoaderAndroid.js +30 -0
- package/src/private/specs/modules/NativeImageLoaderIOS.js +37 -0
- package/src/private/specs/modules/NativeImageStoreAndroid.js +26 -0
- package/src/private/specs/modules/NativeImageStoreIOS.js +33 -0
- package/src/private/specs/modules/NativeIntentAndroid.js +30 -0
- package/src/private/specs/modules/NativeIntersectionObserver.js +41 -0
- package/src/private/specs/modules/NativeJSCHeapCapture.js +19 -0
- package/src/private/specs/modules/NativeJSCSamplingProfiler.js +19 -0
- package/src/private/specs/modules/NativeKeyboardObserver.js +20 -0
- package/src/private/specs/modules/NativeLinkingManager.js +27 -0
- package/src/private/specs/modules/NativeLogBox.js +20 -0
- package/src/private/specs/modules/NativeModalManager.js +21 -0
- package/src/private/specs/modules/NativeMutationObserver.js +58 -0
- package/src/private/specs/modules/NativeNetworkingAndroid.js +37 -0
- package/src/private/specs/modules/NativeNetworkingIOS.js +37 -0
- package/src/private/specs/modules/NativePermissionsAndroid.js +77 -0
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +44 -0
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +37 -0
- package/src/private/specs/modules/NativePlatformConstantsWin.js +38 -0
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +107 -0
- package/src/private/specs/modules/NativeRedBox.js +20 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +53 -0
- package/src/private/specs/modules/NativeSegmentFetcher.js +28 -0
- package/src/private/specs/modules/NativeSettingsManager.js +25 -0
- package/src/private/specs/modules/NativeShareModule.js +23 -0
- package/src/private/specs/modules/NativeSoundManager.js +22 -0
- package/src/private/specs/modules/NativeSourceCode.js +36 -0
- package/src/private/specs/modules/NativeStatusBarManagerAndroid.js +68 -0
- package/src/private/specs/modules/NativeStatusBarManagerIOS.js +89 -0
- package/src/private/specs/modules/NativeTiming.js +26 -0
- package/src/private/specs/modules/NativeToastAndroid.js +38 -0
- package/src/private/specs/modules/NativeUIManager.js +118 -0
- package/src/private/specs/modules/NativeVibration.js +24 -0
- package/src/private/specs/modules/NativeWebSocketModule.js +34 -0
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReactNativeElement.js +6 -6
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyCharacterData.js +2 -2
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyElement.js +5 -5
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyNode.js +19 -10
- package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/DOMRectList.js +1 -1
- package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +85 -0
- package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +80 -0
- package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +161 -0
- package/{Libraries/WebPerformance → src/private/webapis/performance}/NativePerformance.js +2 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/NativePerformanceObserver.js +3 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/Performance.js +2 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceEventTiming.js +1 -1
- package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceObserver.js +21 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/RawPerformanceEntry.js +1 -1
- package/{Libraries/WebPerformance → src/private/webapis/performance}/__mocks__/NativePerformanceObserver.js +9 -0
- package/src/private/webapis/performance/__tests__/EventCounts-test.js +116 -0
- package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +82 -0
- package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +108 -0
- package/src/private/webapis/performance/__tests__/Performance-test.js +117 -0
- package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +208 -0
- package/template/cpp-app/src/App.cpp +2 -2
- package/template/cs-app/src/App.xaml.cs +2 -2
- package/templates/cpp-app/jest.config.windows.js +3 -0
- package/templates/cpp-app/metro.config.js +0 -2
- package/templates/cpp-app/template.config.js +24 -9
- package/templates/cpp-app/windows/ExperimentalFeatures.props +1 -1
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.cpp +13 -0
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.h +10 -0
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +134 -249
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +12 -11
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj.filters +6 -3
- package/templates/cpp-app/windows/MyApp/pch.h +12 -9
- package/templates/cpp-app/windows/MyApp/resource.h +0 -1
- package/templates/cpp-app/windows/MyApp.sln +26 -26
- package/templates/cpp-lib/example/metro.config.js +74 -0
- package/templates/cpp-lib/template.config.js +235 -0
- package/templates/cpp-lib/windows/ExperimentalFeatures.props +11 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.cpp +18 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.def +3 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.h +31 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.rc +0 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +148 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj.filters +44 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.cpp +20 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.h +24 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.idl +9 -0
- package/templates/cpp-lib/windows/MyLib/pch.cpp +1 -0
- package/templates/cpp-lib/windows/MyLib/pch.h +30 -0
- package/templates/cpp-lib/windows/MyLib/resource.h +5 -0
- package/templates/cpp-lib/windows/MyLib/targetver.h +8 -0
- package/templates/cpp-lib/windows/MyLib.sln +156 -0
- package/templates/cpp-lib/windows/_gitignore +41 -0
- package/templates/templateUtils.js +137 -0
- package/types/index.d.ts +1 -0
- package/types/modules/globals.d.ts +1 -0
- package/Folly/TEMP_UntilFollyUpdate/hash/Hash.h +0 -1016
- package/Libraries/Components/Button.flow.js +0 -265
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.windows.js +0 -8
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.windows.js +0 -14
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +0 -34
- package/Libraries/Components/ScrollView/ScrollView.windows.js +0 -1941
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +0 -85
- package/Libraries/Components/ToastAndroid/ToastAndroid.windows.js +0 -45
- package/Libraries/Components/Touchable/Touchable.flow.js +0 -284
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +0 -189
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +0 -43
- package/Libraries/Image/Image.flow.js +0 -64
- package/Libraries/Inspector/DevtoolsOverlay.js +0 -223
- package/Libraries/Performance/QuickPerformanceLogger.js +0 -142
- package/Libraries/Settings/Settings.windows.js +0 -28
- package/Microsoft.ReactNative/CoreApp.cpp +0 -303
- package/Microsoft.ReactNative/CoreAppPage.cpp +0 -21
- package/Microsoft.ReactNative/CoreAppPage.idl +0 -12
- package/Microsoft.ReactNative/CoreAppPage.xaml +0 -14
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.cpp +0 -197
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.h +0 -84
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/EventEmitters.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/Props.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/ShadowNodes.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/States.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/core/graphicsConversions.h +0 -245
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Color.h +0 -134
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/conversions.h +0 -27
- package/Microsoft.ReactNative/Modules/TimingModule.cpp +0 -229
- package/Microsoft.ReactNative/Modules/TimingModule.h +0 -88
- package/Microsoft.ReactNative.Cxx/CoreApp.h +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/LongLivedObject.cpp +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/LongLivedObject.h +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleBinding.h +0 -63
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaLayoutableShadowNode.cpp +0 -1038
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaStylableProps.cpp +0 -503
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -895
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mapbuffer/MapBufferBuilder.cpp +0 -182
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mounting/ShadowTree.cpp +0 -543
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManagerBinding.cpp +0 -1505
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/bits/NumericBitfield.h +0 -67
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +0 -93
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +0 -88
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +0 -606
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.h +0 -344
- package/ReactCommon/Yoga.cpp +0 -961
- /package/{Libraries/DOM/Geometry → src/private/webapis/dom/geometry}/DOMRect.js +0 -0
- /package/{Libraries/DOM/Geometry → src/private/webapis/dom/geometry}/DOMRectReadOnly.js +0 -0
- /package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyText.js +0 -0
- /package/{Libraries/DOM/Nodes/Utilities → src/private/webapis/dom/nodes/utilities}/Traversal.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/ArrayLikeUtils.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/HTMLCollection.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/NodeList.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/EventCounts.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/MemoryInfo.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceEntry.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/ReactNativeStartupTiming.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/__mocks__/NativePerformance.js +0 -0
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
#include <yoga/Yoga.h>
|
|
15
15
|
|
|
16
|
+
#include <yoga/algorithm/AbsoluteLayout.h>
|
|
16
17
|
#include <yoga/algorithm/Align.h>
|
|
17
18
|
#include <yoga/algorithm/Baseline.h>
|
|
18
19
|
#include <yoga/algorithm/BoundAxis.h>
|
|
@@ -21,10 +22,10 @@
|
|
|
21
22
|
#include <yoga/algorithm/FlexDirection.h>
|
|
22
23
|
#include <yoga/algorithm/FlexLine.h>
|
|
23
24
|
#include <yoga/algorithm/PixelGrid.h>
|
|
24
|
-
#include <yoga/algorithm/
|
|
25
|
+
#include <yoga/algorithm/SizingMode.h>
|
|
26
|
+
#include <yoga/algorithm/TrailingPosition.h>
|
|
25
27
|
#include <yoga/debug/AssertFatal.h>
|
|
26
28
|
#include <yoga/debug/Log.h>
|
|
27
|
-
#include <yoga/debug/NodeToString.h>
|
|
28
29
|
#include <yoga/event/event.h>
|
|
29
30
|
#include <yoga/node/Node.h>
|
|
30
31
|
#include <yoga/numeric/Comparison.h>
|
|
@@ -34,87 +35,26 @@ namespace facebook::yoga {
|
|
|
34
35
|
|
|
35
36
|
std::atomic<uint32_t> gCurrentGenerationCount(0);
|
|
36
37
|
|
|
37
|
-
bool calculateLayoutInternal(
|
|
38
|
-
yoga::Node* const node,
|
|
39
|
-
const float availableWidth,
|
|
40
|
-
const float availableHeight,
|
|
41
|
-
const Direction ownerDirection,
|
|
42
|
-
const MeasureMode widthMeasureMode,
|
|
43
|
-
const MeasureMode heightMeasureMode,
|
|
44
|
-
const float ownerWidth,
|
|
45
|
-
const float ownerHeight,
|
|
46
|
-
const bool performLayout,
|
|
47
|
-
const LayoutPassReason reason,
|
|
48
|
-
LayoutData& layoutMarkerData,
|
|
49
|
-
const uint32_t depth,
|
|
50
|
-
const uint32_t generationCount);
|
|
51
|
-
|
|
52
|
-
static inline float dimensionWithMargin(
|
|
53
|
-
const yoga::Node* const node,
|
|
54
|
-
const FlexDirection axis,
|
|
55
|
-
const float widthSize) {
|
|
56
|
-
return node->getLayout().measuredDimension(dimension(axis)) +
|
|
57
|
-
(node->getLeadingMargin(axis, widthSize) +
|
|
58
|
-
node->getTrailingMargin(axis, widthSize))
|
|
59
|
-
.unwrap();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static inline bool styleDefinesDimension(
|
|
63
|
-
const yoga::Node* const node,
|
|
64
|
-
const FlexDirection axis,
|
|
65
|
-
const float ownerSize) {
|
|
66
|
-
bool isUndefined =
|
|
67
|
-
yoga::isUndefined(node->getResolvedDimension(dimension(axis)).value);
|
|
68
|
-
|
|
69
|
-
auto resolvedDimension = node->getResolvedDimension(dimension(axis));
|
|
70
|
-
return !(
|
|
71
|
-
resolvedDimension.unit == YGUnitAuto ||
|
|
72
|
-
resolvedDimension.unit == YGUnitUndefined ||
|
|
73
|
-
(resolvedDimension.unit == YGUnitPoint && !isUndefined &&
|
|
74
|
-
resolvedDimension.value < 0.0f) ||
|
|
75
|
-
(resolvedDimension.unit == YGUnitPercent && !isUndefined &&
|
|
76
|
-
(resolvedDimension.value < 0.0f || yoga::isUndefined(ownerSize))));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
static inline bool isLayoutDimensionDefined(
|
|
80
|
-
const yoga::Node* const node,
|
|
81
|
-
const FlexDirection axis) {
|
|
82
|
-
const float value = node->getLayout().measuredDimension(dimension(axis));
|
|
83
|
-
return !yoga::isUndefined(value) && value >= 0.0f;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static void setChildTrailingPosition(
|
|
87
|
-
const yoga::Node* const node,
|
|
88
|
-
yoga::Node* const child,
|
|
89
|
-
const FlexDirection axis) {
|
|
90
|
-
const float size = child->getLayout().measuredDimension(dimension(axis));
|
|
91
|
-
child->setLayoutPosition(
|
|
92
|
-
node->getLayout().measuredDimension(dimension(axis)) - size -
|
|
93
|
-
child->getLayout().position[leadingEdge(axis)],
|
|
94
|
-
trailingEdge(axis));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
38
|
static void constrainMaxSizeForMode(
|
|
98
|
-
const yoga::Node*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
float* size) {
|
|
39
|
+
const yoga::Node* node,
|
|
40
|
+
FlexDirection axis,
|
|
41
|
+
float ownerAxisSize,
|
|
42
|
+
float ownerWidth,
|
|
43
|
+
/*in_out*/ SizingMode* mode,
|
|
44
|
+
/*in_out*/ float* size) {
|
|
104
45
|
const FloatOptional maxSize =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
FloatOptional(node->getMarginForAxis(axis, ownerWidth));
|
|
46
|
+
node->style().maxDimension(dimension(axis)).resolve(ownerAxisSize) +
|
|
47
|
+
FloatOptional(node->style().computeMarginForAxis(axis, ownerWidth));
|
|
108
48
|
switch (*mode) {
|
|
109
|
-
case
|
|
110
|
-
case
|
|
49
|
+
case SizingMode::StretchFit:
|
|
50
|
+
case SizingMode::FitContent:
|
|
111
51
|
*size = (maxSize.isUndefined() || *size < maxSize.unwrap())
|
|
112
52
|
? *size
|
|
113
53
|
: maxSize.unwrap();
|
|
114
54
|
break;
|
|
115
|
-
case
|
|
116
|
-
if (
|
|
117
|
-
*mode =
|
|
55
|
+
case SizingMode::MaxContent:
|
|
56
|
+
if (maxSize.isDefined()) {
|
|
57
|
+
*mode = SizingMode::FitContent;
|
|
118
58
|
*size = maxSize.unwrap();
|
|
119
59
|
}
|
|
120
60
|
break;
|
|
@@ -125,34 +65,34 @@ static void computeFlexBasisForChild(
|
|
|
125
65
|
const yoga::Node* const node,
|
|
126
66
|
yoga::Node* const child,
|
|
127
67
|
const float width,
|
|
128
|
-
const
|
|
68
|
+
const SizingMode widthMode,
|
|
129
69
|
const float height,
|
|
130
70
|
const float ownerWidth,
|
|
131
71
|
const float ownerHeight,
|
|
132
|
-
const
|
|
72
|
+
const SizingMode heightMode,
|
|
133
73
|
const Direction direction,
|
|
134
74
|
LayoutData& layoutMarkerData,
|
|
135
75
|
const uint32_t depth,
|
|
136
76
|
const uint32_t generationCount) {
|
|
137
77
|
const FlexDirection mainAxis =
|
|
138
|
-
resolveDirection(node->
|
|
78
|
+
resolveDirection(node->style().flexDirection(), direction);
|
|
139
79
|
const bool isMainAxisRow = isRow(mainAxis);
|
|
140
80
|
const float mainAxisSize = isMainAxisRow ? width : height;
|
|
141
81
|
const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight;
|
|
142
82
|
|
|
143
83
|
float childWidth;
|
|
144
84
|
float childHeight;
|
|
145
|
-
|
|
146
|
-
|
|
85
|
+
SizingMode childWidthSizingMode;
|
|
86
|
+
SizingMode childHeightSizingMode;
|
|
147
87
|
|
|
148
88
|
const FloatOptional resolvedFlexBasis =
|
|
149
|
-
|
|
89
|
+
child->resolveFlexBasisPtr().resolve(mainAxisownerSize);
|
|
150
90
|
const bool isRowStyleDimDefined =
|
|
151
|
-
|
|
91
|
+
child->hasDefiniteLength(Dimension::Width, ownerWidth);
|
|
152
92
|
const bool isColumnStyleDimDefined =
|
|
153
|
-
|
|
93
|
+
child->hasDefiniteLength(Dimension::Height, ownerHeight);
|
|
154
94
|
|
|
155
|
-
if (
|
|
95
|
+
if (resolvedFlexBasis.isDefined() && yoga::isDefined(mainAxisSize)) {
|
|
156
96
|
if (child->getLayout().computedFlexBasis.isUndefined() ||
|
|
157
97
|
(child->getConfig()->isExperimentalFeatureEnabled(
|
|
158
98
|
ExperimentalFeature::WebFlexBasis) &&
|
|
@@ -168,76 +108,72 @@ static void computeFlexBasisForChild(
|
|
|
168
108
|
paddingAndBorderForAxis(child, FlexDirection::Row, ownerWidth));
|
|
169
109
|
|
|
170
110
|
child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
|
|
171
|
-
|
|
172
|
-
child->getResolvedDimension(YGDimensionWidth), ownerWidth),
|
|
111
|
+
child->getResolvedDimension(Dimension::Width).resolve(ownerWidth),
|
|
173
112
|
paddingAndBorder));
|
|
174
113
|
} else if (!isMainAxisRow && isColumnStyleDimDefined) {
|
|
175
114
|
// The height is definite, so use that as the flex basis.
|
|
176
115
|
const FloatOptional paddingAndBorder = FloatOptional(
|
|
177
116
|
paddingAndBorderForAxis(child, FlexDirection::Column, ownerWidth));
|
|
178
117
|
child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
|
|
179
|
-
|
|
180
|
-
child->getResolvedDimension(YGDimensionHeight), ownerHeight),
|
|
118
|
+
child->getResolvedDimension(Dimension::Height).resolve(ownerHeight),
|
|
181
119
|
paddingAndBorder));
|
|
182
120
|
} else {
|
|
183
121
|
// Compute the flex basis and hypothetical main size (i.e. the clamped flex
|
|
184
122
|
// basis).
|
|
185
123
|
childWidth = YGUndefined;
|
|
186
124
|
childHeight = YGUndefined;
|
|
187
|
-
|
|
188
|
-
|
|
125
|
+
childWidthSizingMode = SizingMode::MaxContent;
|
|
126
|
+
childHeightSizingMode = SizingMode::MaxContent;
|
|
189
127
|
|
|
190
128
|
auto marginRow =
|
|
191
|
-
child->
|
|
129
|
+
child->style().computeMarginForAxis(FlexDirection::Row, ownerWidth);
|
|
192
130
|
auto marginColumn =
|
|
193
|
-
child->
|
|
131
|
+
child->style().computeMarginForAxis(FlexDirection::Column, ownerWidth);
|
|
194
132
|
|
|
195
133
|
if (isRowStyleDimDefined) {
|
|
196
|
-
childWidth =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
.unwrap() +
|
|
134
|
+
childWidth = child->getResolvedDimension(Dimension::Width)
|
|
135
|
+
.resolve(ownerWidth)
|
|
136
|
+
.unwrap() +
|
|
200
137
|
marginRow;
|
|
201
|
-
|
|
138
|
+
childWidthSizingMode = SizingMode::StretchFit;
|
|
202
139
|
}
|
|
203
140
|
if (isColumnStyleDimDefined) {
|
|
204
|
-
childHeight =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.unwrap() +
|
|
141
|
+
childHeight = child->getResolvedDimension(Dimension::Height)
|
|
142
|
+
.resolve(ownerHeight)
|
|
143
|
+
.unwrap() +
|
|
208
144
|
marginColumn;
|
|
209
|
-
|
|
145
|
+
childHeightSizingMode = SizingMode::StretchFit;
|
|
210
146
|
}
|
|
211
147
|
|
|
212
148
|
// The W3C spec doesn't say anything about the 'overflow' property, but all
|
|
213
149
|
// major browsers appear to implement the following logic.
|
|
214
|
-
if ((!isMainAxisRow && node->
|
|
215
|
-
node->
|
|
216
|
-
if (yoga::isUndefined(childWidth) &&
|
|
150
|
+
if ((!isMainAxisRow && node->style().overflow() == Overflow::Scroll) ||
|
|
151
|
+
node->style().overflow() != Overflow::Scroll) {
|
|
152
|
+
if (yoga::isUndefined(childWidth) && yoga::isDefined(width)) {
|
|
217
153
|
childWidth = width;
|
|
218
|
-
|
|
154
|
+
childWidthSizingMode = SizingMode::FitContent;
|
|
219
155
|
}
|
|
220
156
|
}
|
|
221
157
|
|
|
222
|
-
if ((isMainAxisRow && node->
|
|
223
|
-
node->
|
|
224
|
-
if (yoga::isUndefined(childHeight) &&
|
|
158
|
+
if ((isMainAxisRow && node->style().overflow() == Overflow::Scroll) ||
|
|
159
|
+
node->style().overflow() != Overflow::Scroll) {
|
|
160
|
+
if (yoga::isUndefined(childHeight) && yoga::isDefined(height)) {
|
|
225
161
|
childHeight = height;
|
|
226
|
-
|
|
162
|
+
childHeightSizingMode = SizingMode::FitContent;
|
|
227
163
|
}
|
|
228
164
|
}
|
|
229
165
|
|
|
230
|
-
const auto& childStyle = child->
|
|
231
|
-
if (
|
|
232
|
-
if (!isMainAxisRow &&
|
|
166
|
+
const auto& childStyle = child->style();
|
|
167
|
+
if (childStyle.aspectRatio().isDefined()) {
|
|
168
|
+
if (!isMainAxisRow && childWidthSizingMode == SizingMode::StretchFit) {
|
|
233
169
|
childHeight = marginColumn +
|
|
234
170
|
(childWidth - marginRow) / childStyle.aspectRatio().unwrap();
|
|
235
|
-
|
|
171
|
+
childHeightSizingMode = SizingMode::StretchFit;
|
|
236
172
|
} else if (
|
|
237
|
-
isMainAxisRow &&
|
|
173
|
+
isMainAxisRow && childHeightSizingMode == SizingMode::StretchFit) {
|
|
238
174
|
childWidth = marginRow +
|
|
239
175
|
(childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
|
|
240
|
-
|
|
176
|
+
childWidthSizingMode = SizingMode::StretchFit;
|
|
241
177
|
}
|
|
242
178
|
}
|
|
243
179
|
|
|
@@ -245,35 +181,35 @@ static void computeFlexBasisForChild(
|
|
|
245
181
|
// the cross axis to be measured exactly with the available inner width
|
|
246
182
|
|
|
247
183
|
const bool hasExactWidth =
|
|
248
|
-
|
|
184
|
+
yoga::isDefined(width) && widthMode == SizingMode::StretchFit;
|
|
249
185
|
const bool childWidthStretch =
|
|
250
186
|
resolveChildAlignment(node, child) == Align::Stretch &&
|
|
251
|
-
|
|
187
|
+
childWidthSizingMode != SizingMode::StretchFit;
|
|
252
188
|
if (!isMainAxisRow && !isRowStyleDimDefined && hasExactWidth &&
|
|
253
189
|
childWidthStretch) {
|
|
254
190
|
childWidth = width;
|
|
255
|
-
|
|
256
|
-
if (
|
|
191
|
+
childWidthSizingMode = SizingMode::StretchFit;
|
|
192
|
+
if (childStyle.aspectRatio().isDefined()) {
|
|
257
193
|
childHeight =
|
|
258
194
|
(childWidth - marginRow) / childStyle.aspectRatio().unwrap();
|
|
259
|
-
|
|
195
|
+
childHeightSizingMode = SizingMode::StretchFit;
|
|
260
196
|
}
|
|
261
197
|
}
|
|
262
198
|
|
|
263
199
|
const bool hasExactHeight =
|
|
264
|
-
|
|
200
|
+
yoga::isDefined(height) && heightMode == SizingMode::StretchFit;
|
|
265
201
|
const bool childHeightStretch =
|
|
266
202
|
resolveChildAlignment(node, child) == Align::Stretch &&
|
|
267
|
-
|
|
203
|
+
childHeightSizingMode != SizingMode::StretchFit;
|
|
268
204
|
if (isMainAxisRow && !isColumnStyleDimDefined && hasExactHeight &&
|
|
269
205
|
childHeightStretch) {
|
|
270
206
|
childHeight = height;
|
|
271
|
-
|
|
207
|
+
childHeightSizingMode = SizingMode::StretchFit;
|
|
272
208
|
|
|
273
|
-
if (
|
|
209
|
+
if (childStyle.aspectRatio().isDefined()) {
|
|
274
210
|
childWidth =
|
|
275
211
|
(childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
|
|
276
|
-
|
|
212
|
+
childWidthSizingMode = SizingMode::StretchFit;
|
|
277
213
|
}
|
|
278
214
|
}
|
|
279
215
|
|
|
@@ -282,14 +218,14 @@ static void computeFlexBasisForChild(
|
|
|
282
218
|
FlexDirection::Row,
|
|
283
219
|
ownerWidth,
|
|
284
220
|
ownerWidth,
|
|
285
|
-
&
|
|
221
|
+
&childWidthSizingMode,
|
|
286
222
|
&childWidth);
|
|
287
223
|
constrainMaxSizeForMode(
|
|
288
224
|
child,
|
|
289
225
|
FlexDirection::Column,
|
|
290
226
|
ownerHeight,
|
|
291
227
|
ownerWidth,
|
|
292
|
-
&
|
|
228
|
+
&childHeightSizingMode,
|
|
293
229
|
&childHeight);
|
|
294
230
|
|
|
295
231
|
// Measure the child
|
|
@@ -298,8 +234,8 @@ static void computeFlexBasisForChild(
|
|
|
298
234
|
childWidth,
|
|
299
235
|
childHeight,
|
|
300
236
|
direction,
|
|
301
|
-
|
|
302
|
-
|
|
237
|
+
childWidthSizingMode,
|
|
238
|
+
childHeightSizingMode,
|
|
303
239
|
ownerWidth,
|
|
304
240
|
ownerHeight,
|
|
305
241
|
false,
|
|
@@ -315,241 +251,12 @@ static void computeFlexBasisForChild(
|
|
|
315
251
|
child->setLayoutComputedFlexBasisGeneration(generationCount);
|
|
316
252
|
}
|
|
317
253
|
|
|
318
|
-
static void layoutAbsoluteChild(
|
|
319
|
-
const yoga::Node* const node,
|
|
320
|
-
yoga::Node* const child,
|
|
321
|
-
const float width,
|
|
322
|
-
const MeasureMode widthMode,
|
|
323
|
-
const float height,
|
|
324
|
-
const Direction direction,
|
|
325
|
-
LayoutData& layoutMarkerData,
|
|
326
|
-
const uint32_t depth,
|
|
327
|
-
const uint32_t generationCount) {
|
|
328
|
-
const FlexDirection mainAxis =
|
|
329
|
-
resolveDirection(node->getStyle().flexDirection(), direction);
|
|
330
|
-
const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
|
331
|
-
const bool isMainAxisRow = isRow(mainAxis);
|
|
332
|
-
|
|
333
|
-
float childWidth = YGUndefined;
|
|
334
|
-
float childHeight = YGUndefined;
|
|
335
|
-
MeasureMode childWidthMeasureMode = MeasureMode::Undefined;
|
|
336
|
-
MeasureMode childHeightMeasureMode = MeasureMode::Undefined;
|
|
337
|
-
|
|
338
|
-
auto marginRow = child->getMarginForAxis(FlexDirection::Row, width).unwrap();
|
|
339
|
-
auto marginColumn =
|
|
340
|
-
child->getMarginForAxis(FlexDirection::Column, width).unwrap();
|
|
341
|
-
|
|
342
|
-
if (styleDefinesDimension(child, FlexDirection::Row, width)) {
|
|
343
|
-
childWidth =
|
|
344
|
-
yoga::resolveValue(child->getResolvedDimension(YGDimensionWidth), width)
|
|
345
|
-
.unwrap() +
|
|
346
|
-
marginRow;
|
|
347
|
-
} else {
|
|
348
|
-
// If the child doesn't have a specified width, compute the width based on
|
|
349
|
-
// the left/right offsets if they're defined.
|
|
350
|
-
if (child->isLeadingPositionDefined(FlexDirection::Row) &&
|
|
351
|
-
child->isTrailingPosDefined(FlexDirection::Row)) {
|
|
352
|
-
childWidth = node->getLayout().measuredDimension(YGDimensionWidth) -
|
|
353
|
-
(node->getLeadingBorder(FlexDirection::Row) +
|
|
354
|
-
node->getTrailingBorder(FlexDirection::Row)) -
|
|
355
|
-
(child->getLeadingPosition(FlexDirection::Row, width) +
|
|
356
|
-
child->getTrailingPosition(FlexDirection::Row, width))
|
|
357
|
-
.unwrap();
|
|
358
|
-
childWidth =
|
|
359
|
-
boundAxis(child, FlexDirection::Row, childWidth, width, width);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (styleDefinesDimension(child, FlexDirection::Column, height)) {
|
|
364
|
-
childHeight = yoga::resolveValue(
|
|
365
|
-
child->getResolvedDimension(YGDimensionHeight), height)
|
|
366
|
-
.unwrap() +
|
|
367
|
-
marginColumn;
|
|
368
|
-
} else {
|
|
369
|
-
// If the child doesn't have a specified height, compute the height based on
|
|
370
|
-
// the top/bottom offsets if they're defined.
|
|
371
|
-
if (child->isLeadingPositionDefined(FlexDirection::Column) &&
|
|
372
|
-
child->isTrailingPosDefined(FlexDirection::Column)) {
|
|
373
|
-
childHeight = node->getLayout().measuredDimension(YGDimensionHeight) -
|
|
374
|
-
(node->getLeadingBorder(FlexDirection::Column) +
|
|
375
|
-
node->getTrailingBorder(FlexDirection::Column)) -
|
|
376
|
-
(child->getLeadingPosition(FlexDirection::Column, height) +
|
|
377
|
-
child->getTrailingPosition(FlexDirection::Column, height))
|
|
378
|
-
.unwrap();
|
|
379
|
-
childHeight =
|
|
380
|
-
boundAxis(child, FlexDirection::Column, childHeight, height, width);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// Exactly one dimension needs to be defined for us to be able to do aspect
|
|
385
|
-
// ratio calculation. One dimension being the anchor and the other being
|
|
386
|
-
// flexible.
|
|
387
|
-
const auto& childStyle = child->getStyle();
|
|
388
|
-
if (yoga::isUndefined(childWidth) ^ yoga::isUndefined(childHeight)) {
|
|
389
|
-
if (!childStyle.aspectRatio().isUndefined()) {
|
|
390
|
-
if (yoga::isUndefined(childWidth)) {
|
|
391
|
-
childWidth = marginRow +
|
|
392
|
-
(childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
|
|
393
|
-
} else if (yoga::isUndefined(childHeight)) {
|
|
394
|
-
childHeight = marginColumn +
|
|
395
|
-
(childWidth - marginRow) / childStyle.aspectRatio().unwrap();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// If we're still missing one or the other dimension, measure the content.
|
|
401
|
-
if (yoga::isUndefined(childWidth) || yoga::isUndefined(childHeight)) {
|
|
402
|
-
childWidthMeasureMode = yoga::isUndefined(childWidth)
|
|
403
|
-
? MeasureMode::Undefined
|
|
404
|
-
: MeasureMode::Exactly;
|
|
405
|
-
childHeightMeasureMode = yoga::isUndefined(childHeight)
|
|
406
|
-
? MeasureMode::Undefined
|
|
407
|
-
: MeasureMode::Exactly;
|
|
408
|
-
|
|
409
|
-
// If the size of the owner is defined then try to constrain the absolute
|
|
410
|
-
// child to that size as well. This allows text within the absolute child to
|
|
411
|
-
// wrap to the size of its owner. This is the same behavior as many browsers
|
|
412
|
-
// implement.
|
|
413
|
-
if (!isMainAxisRow && yoga::isUndefined(childWidth) &&
|
|
414
|
-
widthMode != MeasureMode::Undefined && !yoga::isUndefined(width) &&
|
|
415
|
-
width > 0) {
|
|
416
|
-
childWidth = width;
|
|
417
|
-
childWidthMeasureMode = MeasureMode::AtMost;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
calculateLayoutInternal(
|
|
421
|
-
child,
|
|
422
|
-
childWidth,
|
|
423
|
-
childHeight,
|
|
424
|
-
direction,
|
|
425
|
-
childWidthMeasureMode,
|
|
426
|
-
childHeightMeasureMode,
|
|
427
|
-
childWidth,
|
|
428
|
-
childHeight,
|
|
429
|
-
false,
|
|
430
|
-
LayoutPassReason::kAbsMeasureChild,
|
|
431
|
-
layoutMarkerData,
|
|
432
|
-
depth,
|
|
433
|
-
generationCount);
|
|
434
|
-
childWidth = child->getLayout().measuredDimension(YGDimensionWidth) +
|
|
435
|
-
child->getMarginForAxis(FlexDirection::Row, width).unwrap();
|
|
436
|
-
childHeight = child->getLayout().measuredDimension(YGDimensionHeight) +
|
|
437
|
-
child->getMarginForAxis(FlexDirection::Column, width).unwrap();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
calculateLayoutInternal(
|
|
441
|
-
child,
|
|
442
|
-
childWidth,
|
|
443
|
-
childHeight,
|
|
444
|
-
direction,
|
|
445
|
-
MeasureMode::Exactly,
|
|
446
|
-
MeasureMode::Exactly,
|
|
447
|
-
childWidth,
|
|
448
|
-
childHeight,
|
|
449
|
-
true,
|
|
450
|
-
LayoutPassReason::kAbsLayout,
|
|
451
|
-
layoutMarkerData,
|
|
452
|
-
depth,
|
|
453
|
-
generationCount);
|
|
454
|
-
|
|
455
|
-
if (child->isTrailingPosDefined(mainAxis) &&
|
|
456
|
-
!child->isLeadingPositionDefined(mainAxis)) {
|
|
457
|
-
child->setLayoutPosition(
|
|
458
|
-
node->getLayout().measuredDimension(dimension(mainAxis)) -
|
|
459
|
-
child->getLayout().measuredDimension(dimension(mainAxis)) -
|
|
460
|
-
node->getTrailingBorder(mainAxis) -
|
|
461
|
-
child->getTrailingMargin(mainAxis, isMainAxisRow ? width : height)
|
|
462
|
-
.unwrap() -
|
|
463
|
-
child->getTrailingPosition(mainAxis, isMainAxisRow ? width : height)
|
|
464
|
-
.unwrap(),
|
|
465
|
-
leadingEdge(mainAxis));
|
|
466
|
-
} else if (
|
|
467
|
-
!child->isLeadingPositionDefined(mainAxis) &&
|
|
468
|
-
node->getStyle().justifyContent() == Justify::Center) {
|
|
469
|
-
child->setLayoutPosition(
|
|
470
|
-
(node->getLayout().measuredDimension(dimension(mainAxis)) -
|
|
471
|
-
child->getLayout().measuredDimension(dimension(mainAxis))) /
|
|
472
|
-
2.0f,
|
|
473
|
-
leadingEdge(mainAxis));
|
|
474
|
-
} else if (
|
|
475
|
-
!child->isLeadingPositionDefined(mainAxis) &&
|
|
476
|
-
node->getStyle().justifyContent() == Justify::FlexEnd) {
|
|
477
|
-
child->setLayoutPosition(
|
|
478
|
-
(node->getLayout().measuredDimension(dimension(mainAxis)) -
|
|
479
|
-
child->getLayout().measuredDimension(dimension(mainAxis))),
|
|
480
|
-
leadingEdge(mainAxis));
|
|
481
|
-
} else if (
|
|
482
|
-
node->getConfig()->isExperimentalFeatureEnabled(
|
|
483
|
-
ExperimentalFeature::AbsolutePercentageAgainstPaddingEdge) &&
|
|
484
|
-
child->isLeadingPositionDefined(mainAxis)) {
|
|
485
|
-
child->setLayoutPosition(
|
|
486
|
-
child->getLeadingPosition(
|
|
487
|
-
mainAxis,
|
|
488
|
-
node->getLayout().measuredDimension(dimension(mainAxis)))
|
|
489
|
-
.unwrap() +
|
|
490
|
-
node->getLeadingBorder(mainAxis) +
|
|
491
|
-
child
|
|
492
|
-
->getLeadingMargin(
|
|
493
|
-
mainAxis,
|
|
494
|
-
node->getLayout().measuredDimension(dimension(mainAxis)))
|
|
495
|
-
.unwrap(),
|
|
496
|
-
leadingEdge(mainAxis));
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
if (child->isTrailingPosDefined(crossAxis) &&
|
|
500
|
-
!child->isLeadingPositionDefined(crossAxis)) {
|
|
501
|
-
child->setLayoutPosition(
|
|
502
|
-
node->getLayout().measuredDimension(dimension(crossAxis)) -
|
|
503
|
-
child->getLayout().measuredDimension(dimension(crossAxis)) -
|
|
504
|
-
node->getTrailingBorder(crossAxis) -
|
|
505
|
-
child->getTrailingMargin(crossAxis, isMainAxisRow ? height : width)
|
|
506
|
-
.unwrap() -
|
|
507
|
-
child
|
|
508
|
-
->getTrailingPosition(crossAxis, isMainAxisRow ? height : width)
|
|
509
|
-
.unwrap(),
|
|
510
|
-
leadingEdge(crossAxis));
|
|
511
|
-
|
|
512
|
-
} else if (
|
|
513
|
-
!child->isLeadingPositionDefined(crossAxis) &&
|
|
514
|
-
resolveChildAlignment(node, child) == Align::Center) {
|
|
515
|
-
child->setLayoutPosition(
|
|
516
|
-
(node->getLayout().measuredDimension(dimension(crossAxis)) -
|
|
517
|
-
child->getLayout().measuredDimension(dimension(crossAxis))) /
|
|
518
|
-
2.0f,
|
|
519
|
-
leadingEdge(crossAxis));
|
|
520
|
-
} else if (
|
|
521
|
-
!child->isLeadingPositionDefined(crossAxis) &&
|
|
522
|
-
((resolveChildAlignment(node, child) == Align::FlexEnd) ^
|
|
523
|
-
(node->getStyle().flexWrap() == Wrap::WrapReverse))) {
|
|
524
|
-
child->setLayoutPosition(
|
|
525
|
-
(node->getLayout().measuredDimension(dimension(crossAxis)) -
|
|
526
|
-
child->getLayout().measuredDimension(dimension(crossAxis))),
|
|
527
|
-
leadingEdge(crossAxis));
|
|
528
|
-
} else if (
|
|
529
|
-
node->getConfig()->isExperimentalFeatureEnabled(
|
|
530
|
-
ExperimentalFeature::AbsolutePercentageAgainstPaddingEdge) &&
|
|
531
|
-
child->isLeadingPositionDefined(crossAxis)) {
|
|
532
|
-
child->setLayoutPosition(
|
|
533
|
-
child->getLeadingPosition(
|
|
534
|
-
crossAxis,
|
|
535
|
-
node->getLayout().measuredDimension(dimension(crossAxis)))
|
|
536
|
-
.unwrap() +
|
|
537
|
-
node->getLeadingBorder(crossAxis) +
|
|
538
|
-
child
|
|
539
|
-
->getLeadingMargin(
|
|
540
|
-
crossAxis,
|
|
541
|
-
node->getLayout().measuredDimension(dimension(crossAxis)))
|
|
542
|
-
.unwrap(),
|
|
543
|
-
leadingEdge(crossAxis));
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
254
|
static void measureNodeWithMeasureFunc(
|
|
548
255
|
yoga::Node* const node,
|
|
549
256
|
float availableWidth,
|
|
550
257
|
float availableHeight,
|
|
551
|
-
const
|
|
552
|
-
const
|
|
258
|
+
const SizingMode widthSizingMode,
|
|
259
|
+
const SizingMode heightSizingMode,
|
|
553
260
|
const float ownerWidth,
|
|
554
261
|
const float ownerHeight,
|
|
555
262
|
LayoutData& layoutMarkerData,
|
|
@@ -559,37 +266,38 @@ static void measureNodeWithMeasureFunc(
|
|
|
559
266
|
node->hasMeasureFunc(),
|
|
560
267
|
"Expected node to have custom measure function");
|
|
561
268
|
|
|
562
|
-
if (
|
|
269
|
+
if (widthSizingMode == SizingMode::MaxContent) {
|
|
563
270
|
availableWidth = YGUndefined;
|
|
564
271
|
}
|
|
565
|
-
if (
|
|
272
|
+
if (heightSizingMode == SizingMode::MaxContent) {
|
|
566
273
|
availableHeight = YGUndefined;
|
|
567
274
|
}
|
|
568
275
|
|
|
569
|
-
const auto&
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const float paddingAndBorderAxisColumn = padding
|
|
574
|
-
padding
|
|
276
|
+
const auto& layout = node->getLayout();
|
|
277
|
+
const float paddingAndBorderAxisRow = layout.padding(PhysicalEdge::Left) +
|
|
278
|
+
layout.padding(PhysicalEdge::Right) + layout.border(PhysicalEdge::Left) +
|
|
279
|
+
layout.border(PhysicalEdge::Right);
|
|
280
|
+
const float paddingAndBorderAxisColumn = layout.padding(PhysicalEdge::Top) +
|
|
281
|
+
layout.padding(PhysicalEdge::Bottom) + layout.border(PhysicalEdge::Top) +
|
|
282
|
+
layout.border(PhysicalEdge::Bottom);
|
|
575
283
|
|
|
576
284
|
// We want to make sure we don't call measure with negative size
|
|
577
285
|
const float innerWidth = yoga::isUndefined(availableWidth)
|
|
578
286
|
? availableWidth
|
|
579
|
-
: yoga::maxOrDefined(0, availableWidth - paddingAndBorderAxisRow);
|
|
287
|
+
: yoga::maxOrDefined(0.0f, availableWidth - paddingAndBorderAxisRow);
|
|
580
288
|
const float innerHeight = yoga::isUndefined(availableHeight)
|
|
581
289
|
? availableHeight
|
|
582
|
-
: yoga::maxOrDefined(0, availableHeight - paddingAndBorderAxisColumn);
|
|
290
|
+
: yoga::maxOrDefined(0.0f, availableHeight - paddingAndBorderAxisColumn);
|
|
583
291
|
|
|
584
|
-
if (
|
|
585
|
-
|
|
292
|
+
if (widthSizingMode == SizingMode::StretchFit &&
|
|
293
|
+
heightSizingMode == SizingMode::StretchFit &&
|
|
586
294
|
!YGConfigIsExperimentalFeatureEnabled( // [Win] YGExperimentalFeatureCallMeasureCallbackOnAllNodes check added for NetUI
|
|
587
|
-
|
|
295
|
+
node->getConfig(), YGExperimentalFeatureCallMeasureCallbackOnAllNodes)) {
|
|
588
296
|
// Don't bother sizing the text if both dimensions are already defined.
|
|
589
297
|
node->setLayoutMeasuredDimension(
|
|
590
298
|
boundAxis(
|
|
591
299
|
node, FlexDirection::Row, availableWidth, ownerWidth, ownerWidth),
|
|
592
|
-
|
|
300
|
+
Dimension::Width);
|
|
593
301
|
node->setLayoutMeasuredDimension(
|
|
594
302
|
boundAxis(
|
|
595
303
|
node,
|
|
@@ -597,13 +305,16 @@ static void measureNodeWithMeasureFunc(
|
|
|
597
305
|
availableHeight,
|
|
598
306
|
ownerHeight,
|
|
599
307
|
ownerWidth),
|
|
600
|
-
|
|
308
|
+
Dimension::Height);
|
|
601
309
|
} else {
|
|
602
310
|
Event::publish<Event::MeasureCallbackStart>(node);
|
|
603
311
|
|
|
604
312
|
// Measure the text under the current constraints.
|
|
605
313
|
const YGSize measuredSize = node->measure(
|
|
606
|
-
innerWidth,
|
|
314
|
+
innerWidth,
|
|
315
|
+
measureMode(widthSizingMode),
|
|
316
|
+
innerHeight,
|
|
317
|
+
measureMode(heightSizingMode));
|
|
607
318
|
|
|
608
319
|
layoutMarkerData.measureCallbacks += 1;
|
|
609
320
|
layoutMarkerData.measureCallbackReasonsCount[static_cast<size_t>(reason)] +=
|
|
@@ -612,9 +323,9 @@ static void measureNodeWithMeasureFunc(
|
|
|
612
323
|
Event::publish<Event::MeasureCallbackEnd>(
|
|
613
324
|
node,
|
|
614
325
|
{innerWidth,
|
|
615
|
-
unscopedEnum(
|
|
326
|
+
unscopedEnum(measureMode(widthSizingMode)),
|
|
616
327
|
innerHeight,
|
|
617
|
-
unscopedEnum(
|
|
328
|
+
unscopedEnum(measureMode(heightSizingMode)),
|
|
618
329
|
measuredSize.width,
|
|
619
330
|
measuredSize.height,
|
|
620
331
|
reason});
|
|
@@ -623,25 +334,25 @@ static void measureNodeWithMeasureFunc(
|
|
|
623
334
|
boundAxis(
|
|
624
335
|
node,
|
|
625
336
|
FlexDirection::Row,
|
|
626
|
-
(
|
|
627
|
-
|
|
337
|
+
(widthSizingMode == SizingMode::MaxContent ||
|
|
338
|
+
widthSizingMode == SizingMode::FitContent)
|
|
628
339
|
? measuredSize.width + paddingAndBorderAxisRow
|
|
629
340
|
: availableWidth,
|
|
630
341
|
ownerWidth,
|
|
631
342
|
ownerWidth),
|
|
632
|
-
|
|
343
|
+
Dimension::Width);
|
|
633
344
|
|
|
634
345
|
node->setLayoutMeasuredDimension(
|
|
635
346
|
boundAxis(
|
|
636
347
|
node,
|
|
637
348
|
FlexDirection::Column,
|
|
638
|
-
(
|
|
639
|
-
|
|
349
|
+
(heightSizingMode == SizingMode::MaxContent ||
|
|
350
|
+
heightSizingMode == SizingMode::FitContent)
|
|
640
351
|
? measuredSize.height + paddingAndBorderAxisColumn
|
|
641
352
|
: availableHeight,
|
|
642
353
|
ownerHeight,
|
|
643
354
|
ownerWidth),
|
|
644
|
-
|
|
355
|
+
Dimension::Height);
|
|
645
356
|
}
|
|
646
357
|
}
|
|
647
358
|
|
|
@@ -651,73 +362,74 @@ static void measureNodeWithoutChildren(
|
|
|
651
362
|
yoga::Node* const node,
|
|
652
363
|
const float availableWidth,
|
|
653
364
|
const float availableHeight,
|
|
654
|
-
const
|
|
655
|
-
const
|
|
365
|
+
const SizingMode widthSizingMode,
|
|
366
|
+
const SizingMode heightSizingMode,
|
|
656
367
|
const float ownerWidth,
|
|
657
368
|
const float ownerHeight) {
|
|
658
|
-
const auto&
|
|
659
|
-
const auto& border = node->getLayout().border;
|
|
369
|
+
const auto& layout = node->getLayout();
|
|
660
370
|
|
|
661
371
|
float width = availableWidth;
|
|
662
|
-
if (
|
|
663
|
-
|
|
664
|
-
width = padding
|
|
665
|
-
|
|
372
|
+
if (widthSizingMode == SizingMode::MaxContent ||
|
|
373
|
+
widthSizingMode == SizingMode::FitContent) {
|
|
374
|
+
width = layout.padding(PhysicalEdge::Left) +
|
|
375
|
+
layout.padding(PhysicalEdge::Right) +
|
|
376
|
+
layout.border(PhysicalEdge::Left) + layout.border(PhysicalEdge::Right);
|
|
666
377
|
}
|
|
667
378
|
node->setLayoutMeasuredDimension(
|
|
668
379
|
boundAxis(node, FlexDirection::Row, width, ownerWidth, ownerWidth),
|
|
669
|
-
|
|
380
|
+
Dimension::Width);
|
|
670
381
|
|
|
671
382
|
float height = availableHeight;
|
|
672
|
-
if (
|
|
673
|
-
|
|
674
|
-
height = padding
|
|
675
|
-
|
|
383
|
+
if (heightSizingMode == SizingMode::MaxContent ||
|
|
384
|
+
heightSizingMode == SizingMode::FitContent) {
|
|
385
|
+
height = layout.padding(PhysicalEdge::Top) +
|
|
386
|
+
layout.padding(PhysicalEdge::Bottom) +
|
|
387
|
+
layout.border(PhysicalEdge::Top) + layout.border(PhysicalEdge::Bottom);
|
|
676
388
|
}
|
|
677
389
|
node->setLayoutMeasuredDimension(
|
|
678
390
|
boundAxis(node, FlexDirection::Column, height, ownerHeight, ownerWidth),
|
|
679
|
-
|
|
391
|
+
Dimension::Height);
|
|
680
392
|
}
|
|
681
393
|
|
|
682
394
|
static bool measureNodeWithFixedSize(
|
|
683
395
|
yoga::Node* const node,
|
|
684
396
|
const float availableWidth,
|
|
685
397
|
const float availableHeight,
|
|
686
|
-
const
|
|
687
|
-
const
|
|
398
|
+
const SizingMode widthSizingMode,
|
|
399
|
+
const SizingMode heightSizingMode,
|
|
688
400
|
const float ownerWidth,
|
|
689
401
|
const float ownerHeight) {
|
|
690
|
-
if ((
|
|
691
|
-
|
|
692
|
-
(
|
|
693
|
-
|
|
694
|
-
(
|
|
695
|
-
|
|
402
|
+
if ((yoga::isDefined(availableWidth) &&
|
|
403
|
+
widthSizingMode == SizingMode::FitContent && availableWidth <= 0.0f) ||
|
|
404
|
+
(yoga::isDefined(availableHeight) &&
|
|
405
|
+
heightSizingMode == SizingMode::FitContent && availableHeight <= 0.0f) ||
|
|
406
|
+
(widthSizingMode == SizingMode::StretchFit &&
|
|
407
|
+
heightSizingMode == SizingMode::StretchFit)) {
|
|
696
408
|
node->setLayoutMeasuredDimension(
|
|
697
409
|
boundAxis(
|
|
698
410
|
node,
|
|
699
411
|
FlexDirection::Row,
|
|
700
412
|
yoga::isUndefined(availableWidth) ||
|
|
701
|
-
(
|
|
413
|
+
(widthSizingMode == SizingMode::FitContent &&
|
|
702
414
|
availableWidth < 0.0f)
|
|
703
415
|
? 0.0f
|
|
704
416
|
: availableWidth,
|
|
705
417
|
ownerWidth,
|
|
706
418
|
ownerWidth),
|
|
707
|
-
|
|
419
|
+
Dimension::Width);
|
|
708
420
|
|
|
709
421
|
node->setLayoutMeasuredDimension(
|
|
710
422
|
boundAxis(
|
|
711
423
|
node,
|
|
712
424
|
FlexDirection::Column,
|
|
713
425
|
yoga::isUndefined(availableHeight) ||
|
|
714
|
-
(
|
|
426
|
+
(heightSizingMode == SizingMode::FitContent &&
|
|
715
427
|
availableHeight < 0.0f)
|
|
716
428
|
? 0.0f
|
|
717
429
|
: availableHeight,
|
|
718
430
|
ownerHeight,
|
|
719
431
|
ownerWidth),
|
|
720
|
-
|
|
432
|
+
Dimension::Height);
|
|
721
433
|
return true;
|
|
722
434
|
}
|
|
723
435
|
|
|
@@ -726,8 +438,8 @@ static bool measureNodeWithFixedSize(
|
|
|
726
438
|
|
|
727
439
|
static void zeroOutLayoutRecursively(yoga::Node* const node) {
|
|
728
440
|
node->getLayout() = {};
|
|
729
|
-
node->setLayoutDimension(0,
|
|
730
|
-
node->setLayoutDimension(0,
|
|
441
|
+
node->setLayoutDimension(0, Dimension::Width);
|
|
442
|
+
node->setLayoutDimension(0, Dimension::Height);
|
|
731
443
|
node->setHasNewLayout(true);
|
|
732
444
|
|
|
733
445
|
node->cloneChildrenIfNeeded();
|
|
@@ -738,24 +450,24 @@ static void zeroOutLayoutRecursively(yoga::Node* const node) {
|
|
|
738
450
|
|
|
739
451
|
static float calculateAvailableInnerDimension(
|
|
740
452
|
const yoga::Node* const node,
|
|
741
|
-
const
|
|
453
|
+
const Dimension dimension,
|
|
742
454
|
const float availableDim,
|
|
743
455
|
const float paddingAndBorder,
|
|
744
456
|
const float ownerDim) {
|
|
745
457
|
float availableInnerDim = availableDim - paddingAndBorder;
|
|
746
458
|
// Max dimension overrides predefined dimension value; Min dimension in turn
|
|
747
459
|
// overrides both of the above
|
|
748
|
-
if (
|
|
460
|
+
if (yoga::isDefined(availableInnerDim)) {
|
|
749
461
|
// We want to make sure our available height does not violate min and max
|
|
750
462
|
// constraints
|
|
751
463
|
const FloatOptional minDimensionOptional =
|
|
752
|
-
|
|
464
|
+
node->style().minDimension(dimension).resolve(ownerDim);
|
|
753
465
|
const float minInnerDim = minDimensionOptional.isUndefined()
|
|
754
466
|
? 0.0f
|
|
755
467
|
: minDimensionOptional.unwrap() - paddingAndBorder;
|
|
756
468
|
|
|
757
469
|
const FloatOptional maxDimensionOptional =
|
|
758
|
-
|
|
470
|
+
node->style().maxDimension(dimension).resolve(ownerDim);
|
|
759
471
|
|
|
760
472
|
const float maxInnerDim = maxDimensionOptional.isUndefined()
|
|
761
473
|
? FLT_MAX
|
|
@@ -771,8 +483,8 @@ static float computeFlexBasisForChildren(
|
|
|
771
483
|
yoga::Node* const node,
|
|
772
484
|
const float availableInnerWidth,
|
|
773
485
|
const float availableInnerHeight,
|
|
774
|
-
|
|
775
|
-
|
|
486
|
+
SizingMode widthSizingMode,
|
|
487
|
+
SizingMode heightSizingMode,
|
|
776
488
|
Direction direction,
|
|
777
489
|
FlexDirection mainAxis,
|
|
778
490
|
bool performLayout,
|
|
@@ -782,12 +494,12 @@ static float computeFlexBasisForChildren(
|
|
|
782
494
|
float totalOuterFlexBasis = 0.0f;
|
|
783
495
|
YGNodeRef singleFlexChild = nullptr;
|
|
784
496
|
const auto& children = node->getChildren();
|
|
785
|
-
|
|
786
|
-
isRow(mainAxis) ?
|
|
497
|
+
SizingMode sizingModeMainDim =
|
|
498
|
+
isRow(mainAxis) ? widthSizingMode : heightSizingMode;
|
|
787
499
|
// If there is only one child with flexGrow + flexShrink it means we can set
|
|
788
500
|
// the computedFlexBasis to 0 instead of measuring and shrinking / flexing the
|
|
789
501
|
// child to exactly match the remaining space
|
|
790
|
-
if (
|
|
502
|
+
if (sizingModeMainDim == SizingMode::StretchFit) {
|
|
791
503
|
for (auto child : children) {
|
|
792
504
|
if (child->isNodeFlexible()) {
|
|
793
505
|
if (singleFlexChild != nullptr ||
|
|
@@ -806,7 +518,7 @@ static float computeFlexBasisForChildren(
|
|
|
806
518
|
|
|
807
519
|
for (auto child : children) {
|
|
808
520
|
child->resolveDimension();
|
|
809
|
-
if (child->
|
|
521
|
+
if (child->style().display() == Display::None) {
|
|
810
522
|
zeroOutLayoutRecursively(child);
|
|
811
523
|
child->setHasNewLayout(true);
|
|
812
524
|
child->setDirty(false);
|
|
@@ -823,7 +535,7 @@ static float computeFlexBasisForChildren(
|
|
|
823
535
|
childDirection, mainDim, crossDim, availableInnerWidth);
|
|
824
536
|
}
|
|
825
537
|
|
|
826
|
-
if (child->
|
|
538
|
+
if (child->style().positionType() == PositionType::Absolute) {
|
|
827
539
|
continue;
|
|
828
540
|
}
|
|
829
541
|
if (child == singleFlexChild) {
|
|
@@ -834,11 +546,11 @@ static float computeFlexBasisForChildren(
|
|
|
834
546
|
node,
|
|
835
547
|
child,
|
|
836
548
|
availableInnerWidth,
|
|
837
|
-
|
|
549
|
+
widthSizingMode,
|
|
838
550
|
availableInnerHeight,
|
|
839
551
|
availableInnerWidth,
|
|
840
552
|
availableInnerHeight,
|
|
841
|
-
|
|
553
|
+
heightSizingMode,
|
|
842
554
|
direction,
|
|
843
555
|
layoutMarkerData,
|
|
844
556
|
depth,
|
|
@@ -846,9 +558,8 @@ static float computeFlexBasisForChildren(
|
|
|
846
558
|
}
|
|
847
559
|
|
|
848
560
|
totalOuterFlexBasis +=
|
|
849
|
-
(child->getLayout().computedFlexBasis +
|
|
850
|
-
child->
|
|
851
|
-
.unwrap();
|
|
561
|
+
(child->getLayout().computedFlexBasis.unwrap() +
|
|
562
|
+
child->style().computeMarginForAxis(mainAxis, availableInnerWidth));
|
|
852
563
|
}
|
|
853
564
|
|
|
854
565
|
return totalOuterFlexBasis;
|
|
@@ -863,13 +574,14 @@ static float distributeFreeSpaceSecondPass(
|
|
|
863
574
|
yoga::Node* const node,
|
|
864
575
|
const FlexDirection mainAxis,
|
|
865
576
|
const FlexDirection crossAxis,
|
|
577
|
+
const Direction direction,
|
|
866
578
|
const float mainAxisownerSize,
|
|
867
579
|
const float availableInnerMainDim,
|
|
868
580
|
const float availableInnerCrossDim,
|
|
869
581
|
const float availableInnerWidth,
|
|
870
582
|
const float availableInnerHeight,
|
|
871
583
|
const bool mainAxisOverflows,
|
|
872
|
-
const
|
|
584
|
+
const SizingMode sizingModeCrossDim,
|
|
873
585
|
const bool performLayout,
|
|
874
586
|
LayoutData& layoutMarkerData,
|
|
875
587
|
const uint32_t depth,
|
|
@@ -879,7 +591,7 @@ static float distributeFreeSpaceSecondPass(
|
|
|
879
591
|
float flexGrowFactor = 0;
|
|
880
592
|
float deltaFreeSpace = 0;
|
|
881
593
|
const bool isMainAxisRow = isRow(mainAxis);
|
|
882
|
-
const bool isNodeFlexWrap = node->
|
|
594
|
+
const bool isNodeFlexWrap = node->style().flexWrap() != Wrap::NoWrap;
|
|
883
595
|
|
|
884
596
|
for (auto currentLineChild : flexLine.itemsInFlow) {
|
|
885
597
|
childFlexBasis = boundAxisWithinMinAndMax(
|
|
@@ -890,7 +602,7 @@ static float distributeFreeSpaceSecondPass(
|
|
|
890
602
|
.unwrap();
|
|
891
603
|
float updatedMainSize = childFlexBasis;
|
|
892
604
|
|
|
893
|
-
if (
|
|
605
|
+
if (yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
|
|
894
606
|
flexLine.layout.remainingFreeSpace < 0) {
|
|
895
607
|
flexShrinkScaledFactor =
|
|
896
608
|
-currentLineChild->resolveFlexShrink() * childFlexBasis;
|
|
@@ -898,7 +610,7 @@ static float distributeFreeSpaceSecondPass(
|
|
|
898
610
|
if (flexShrinkScaledFactor != 0) {
|
|
899
611
|
float childSize;
|
|
900
612
|
|
|
901
|
-
if (
|
|
613
|
+
if (yoga::isDefined(flexLine.layout.totalFlexShrinkScaledFactors) &&
|
|
902
614
|
flexLine.layout.totalFlexShrinkScaledFactors == 0) {
|
|
903
615
|
childSize = childFlexBasis + flexShrinkScaledFactor;
|
|
904
616
|
} else {
|
|
@@ -916,7 +628,7 @@ static float distributeFreeSpaceSecondPass(
|
|
|
916
628
|
availableInnerWidth);
|
|
917
629
|
}
|
|
918
630
|
} else if (
|
|
919
|
-
|
|
631
|
+
yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
|
|
920
632
|
flexLine.layout.remainingFreeSpace > 0) {
|
|
921
633
|
flexGrowFactor = currentLineChild->resolveFlexGrow();
|
|
922
634
|
|
|
@@ -935,58 +647,56 @@ static float distributeFreeSpaceSecondPass(
|
|
|
935
647
|
|
|
936
648
|
deltaFreeSpace += updatedMainSize - childFlexBasis;
|
|
937
649
|
|
|
938
|
-
const float marginMain =
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
currentLineChild->getMarginForAxis(crossAxis, availableInnerWidth)
|
|
943
|
-
.unwrap();
|
|
650
|
+
const float marginMain = currentLineChild->style().computeMarginForAxis(
|
|
651
|
+
mainAxis, availableInnerWidth);
|
|
652
|
+
const float marginCross = currentLineChild->style().computeMarginForAxis(
|
|
653
|
+
crossAxis, availableInnerWidth);
|
|
944
654
|
|
|
945
655
|
float childCrossSize;
|
|
946
656
|
float childMainSize = updatedMainSize + marginMain;
|
|
947
|
-
|
|
948
|
-
|
|
657
|
+
SizingMode childCrossSizingMode;
|
|
658
|
+
SizingMode childMainSizingMode = SizingMode::StretchFit;
|
|
949
659
|
|
|
950
|
-
const auto& childStyle = currentLineChild->
|
|
951
|
-
if (
|
|
660
|
+
const auto& childStyle = currentLineChild->style();
|
|
661
|
+
if (childStyle.aspectRatio().isDefined()) {
|
|
952
662
|
childCrossSize = isMainAxisRow
|
|
953
663
|
? (childMainSize - marginMain) / childStyle.aspectRatio().unwrap()
|
|
954
664
|
: (childMainSize - marginMain) * childStyle.aspectRatio().unwrap();
|
|
955
|
-
|
|
665
|
+
childCrossSizingMode = SizingMode::StretchFit;
|
|
956
666
|
|
|
957
667
|
childCrossSize += marginCross;
|
|
958
668
|
} else if (
|
|
959
669
|
!std::isnan(availableInnerCrossDim) &&
|
|
960
|
-
!
|
|
961
|
-
|
|
962
|
-
|
|
670
|
+
!currentLineChild->hasDefiniteLength(
|
|
671
|
+
dimension(crossAxis), availableInnerCrossDim) &&
|
|
672
|
+
sizingModeCrossDim == SizingMode::StretchFit &&
|
|
963
673
|
!(isNodeFlexWrap && mainAxisOverflows) &&
|
|
964
674
|
resolveChildAlignment(node, currentLineChild) == Align::Stretch &&
|
|
965
|
-
currentLineChild->
|
|
966
|
-
|
|
675
|
+
!currentLineChild->style().flexStartMarginIsAuto(
|
|
676
|
+
crossAxis, direction) &&
|
|
677
|
+
!currentLineChild->style().flexEndMarginIsAuto(crossAxis, direction)) {
|
|
967
678
|
childCrossSize = availableInnerCrossDim;
|
|
968
|
-
|
|
969
|
-
} else if (!
|
|
970
|
-
|
|
679
|
+
childCrossSizingMode = SizingMode::StretchFit;
|
|
680
|
+
} else if (!currentLineChild->hasDefiniteLength(
|
|
681
|
+
dimension(crossAxis), availableInnerCrossDim)) {
|
|
971
682
|
childCrossSize = availableInnerCrossDim;
|
|
972
|
-
|
|
973
|
-
?
|
|
974
|
-
:
|
|
683
|
+
childCrossSizingMode = yoga::isUndefined(childCrossSize)
|
|
684
|
+
? SizingMode::MaxContent
|
|
685
|
+
: SizingMode::FitContent;
|
|
975
686
|
} else {
|
|
976
687
|
childCrossSize =
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
availableInnerCrossDim)
|
|
688
|
+
currentLineChild->getResolvedDimension(dimension(crossAxis))
|
|
689
|
+
.resolve(availableInnerCrossDim)
|
|
980
690
|
.unwrap() +
|
|
981
691
|
marginCross;
|
|
982
692
|
const bool isLoosePercentageMeasurement =
|
|
983
|
-
currentLineChild->getResolvedDimension(dimension(crossAxis)).unit ==
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
693
|
+
currentLineChild->getResolvedDimension(dimension(crossAxis)).unit() ==
|
|
694
|
+
Unit::Percent &&
|
|
695
|
+
sizingModeCrossDim != SizingMode::StretchFit;
|
|
696
|
+
childCrossSizingMode =
|
|
987
697
|
yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement
|
|
988
|
-
?
|
|
989
|
-
:
|
|
698
|
+
? SizingMode::MaxContent
|
|
699
|
+
: SizingMode::StretchFit;
|
|
990
700
|
}
|
|
991
701
|
|
|
992
702
|
constrainMaxSizeForMode(
|
|
@@ -994,30 +704,31 @@ static float distributeFreeSpaceSecondPass(
|
|
|
994
704
|
mainAxis,
|
|
995
705
|
availableInnerMainDim,
|
|
996
706
|
availableInnerWidth,
|
|
997
|
-
&
|
|
707
|
+
&childMainSizingMode,
|
|
998
708
|
&childMainSize);
|
|
999
709
|
constrainMaxSizeForMode(
|
|
1000
710
|
currentLineChild,
|
|
1001
711
|
crossAxis,
|
|
1002
712
|
availableInnerCrossDim,
|
|
1003
713
|
availableInnerWidth,
|
|
1004
|
-
&
|
|
714
|
+
&childCrossSizingMode,
|
|
1005
715
|
&childCrossSize);
|
|
1006
716
|
|
|
1007
717
|
const bool requiresStretchLayout =
|
|
1008
|
-
!
|
|
1009
|
-
|
|
718
|
+
!currentLineChild->hasDefiniteLength(
|
|
719
|
+
dimension(crossAxis), availableInnerCrossDim) &&
|
|
1010
720
|
resolveChildAlignment(node, currentLineChild) == Align::Stretch &&
|
|
1011
|
-
currentLineChild->
|
|
1012
|
-
|
|
721
|
+
!currentLineChild->style().flexStartMarginIsAuto(
|
|
722
|
+
crossAxis, direction) &&
|
|
723
|
+
!currentLineChild->style().flexEndMarginIsAuto(crossAxis, direction);
|
|
1013
724
|
|
|
1014
725
|
const float childWidth = isMainAxisRow ? childMainSize : childCrossSize;
|
|
1015
726
|
const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize;
|
|
1016
727
|
|
|
1017
|
-
const
|
|
1018
|
-
isMainAxisRow ?
|
|
1019
|
-
const
|
|
1020
|
-
!isMainAxisRow ?
|
|
728
|
+
const SizingMode childWidthSizingMode =
|
|
729
|
+
isMainAxisRow ? childMainSizingMode : childCrossSizingMode;
|
|
730
|
+
const SizingMode childHeightSizingMode =
|
|
731
|
+
!isMainAxisRow ? childMainSizingMode : childCrossSizingMode;
|
|
1021
732
|
|
|
1022
733
|
const bool isLayoutPass = performLayout && !requiresStretchLayout;
|
|
1023
734
|
// Recursively call the layout algorithm for this child with the updated
|
|
@@ -1027,8 +738,8 @@ static float distributeFreeSpaceSecondPass(
|
|
|
1027
738
|
childWidth,
|
|
1028
739
|
childHeight,
|
|
1029
740
|
node->getLayout().direction(),
|
|
1030
|
-
|
|
1031
|
-
|
|
741
|
+
childWidthSizingMode,
|
|
742
|
+
childHeightSizingMode,
|
|
1032
743
|
availableInnerWidth,
|
|
1033
744
|
availableInnerHeight,
|
|
1034
745
|
isLayoutPass,
|
|
@@ -1072,7 +783,7 @@ static void distributeFreeSpaceFirstPass(
|
|
|
1072
783
|
-currentLineChild->resolveFlexShrink() * childFlexBasis;
|
|
1073
784
|
|
|
1074
785
|
// Is this child able to shrink?
|
|
1075
|
-
if (
|
|
786
|
+
if (yoga::isDefined(flexShrinkScaledFactor) &&
|
|
1076
787
|
flexShrinkScaledFactor != 0) {
|
|
1077
788
|
baseMainSize = childFlexBasis +
|
|
1078
789
|
flexLine.layout.remainingFreeSpace /
|
|
@@ -1084,8 +795,7 @@ static void distributeFreeSpaceFirstPass(
|
|
|
1084
795
|
baseMainSize,
|
|
1085
796
|
availableInnerMainDim,
|
|
1086
797
|
availableInnerWidth);
|
|
1087
|
-
if (
|
|
1088
|
-
!yoga::isUndefined(boundMainSize) &&
|
|
798
|
+
if (yoga::isDefined(baseMainSize) && yoga::isDefined(boundMainSize) &&
|
|
1089
799
|
baseMainSize != boundMainSize) {
|
|
1090
800
|
// By excluding this item's size and flex factor from remaining, this
|
|
1091
801
|
// item's min/max constraints should also trigger in the second pass
|
|
@@ -1098,12 +808,12 @@ static void distributeFreeSpaceFirstPass(
|
|
|
1098
808
|
}
|
|
1099
809
|
}
|
|
1100
810
|
} else if (
|
|
1101
|
-
|
|
811
|
+
yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
|
|
1102
812
|
flexLine.layout.remainingFreeSpace > 0) {
|
|
1103
813
|
flexGrowFactor = currentLineChild->resolveFlexGrow();
|
|
1104
814
|
|
|
1105
815
|
// Is this child able to grow?
|
|
1106
|
-
if (
|
|
816
|
+
if (yoga::isDefined(flexGrowFactor) && flexGrowFactor != 0) {
|
|
1107
817
|
baseMainSize = childFlexBasis +
|
|
1108
818
|
flexLine.layout.remainingFreeSpace /
|
|
1109
819
|
flexLine.layout.totalFlexGrowFactors * flexGrowFactor;
|
|
@@ -1114,8 +824,7 @@ static void distributeFreeSpaceFirstPass(
|
|
|
1114
824
|
availableInnerMainDim,
|
|
1115
825
|
availableInnerWidth);
|
|
1116
826
|
|
|
1117
|
-
if (
|
|
1118
|
-
!yoga::isUndefined(boundMainSize) &&
|
|
827
|
+
if (yoga::isDefined(baseMainSize) && yoga::isDefined(boundMainSize) &&
|
|
1119
828
|
baseMainSize != boundMainSize) {
|
|
1120
829
|
// By excluding this item's size and flex factor from remaining, this
|
|
1121
830
|
// item's min/max constraints should also trigger in the second pass
|
|
@@ -1157,13 +866,14 @@ static void resolveFlexibleLength(
|
|
|
1157
866
|
FlexLine& flexLine,
|
|
1158
867
|
const FlexDirection mainAxis,
|
|
1159
868
|
const FlexDirection crossAxis,
|
|
869
|
+
const Direction direction,
|
|
1160
870
|
const float mainAxisownerSize,
|
|
1161
871
|
const float availableInnerMainDim,
|
|
1162
872
|
const float availableInnerCrossDim,
|
|
1163
873
|
const float availableInnerWidth,
|
|
1164
874
|
const float availableInnerHeight,
|
|
1165
875
|
const bool mainAxisOverflows,
|
|
1166
|
-
const
|
|
876
|
+
const SizingMode sizingModeCrossDim,
|
|
1167
877
|
const bool performLayout,
|
|
1168
878
|
LayoutData& layoutMarkerData,
|
|
1169
879
|
const uint32_t depth,
|
|
@@ -1183,13 +893,14 @@ static void resolveFlexibleLength(
|
|
|
1183
893
|
node,
|
|
1184
894
|
mainAxis,
|
|
1185
895
|
crossAxis,
|
|
896
|
+
direction,
|
|
1186
897
|
mainAxisownerSize,
|
|
1187
898
|
availableInnerMainDim,
|
|
1188
899
|
availableInnerCrossDim,
|
|
1189
900
|
availableInnerWidth,
|
|
1190
901
|
availableInnerHeight,
|
|
1191
902
|
mainAxisOverflows,
|
|
1192
|
-
|
|
903
|
+
sizingModeCrossDim,
|
|
1193
904
|
performLayout,
|
|
1194
905
|
layoutMarkerData,
|
|
1195
906
|
depth,
|
|
@@ -1204,28 +915,33 @@ static void justifyMainAxis(
|
|
|
1204
915
|
const size_t startOfLineIndex,
|
|
1205
916
|
const FlexDirection mainAxis,
|
|
1206
917
|
const FlexDirection crossAxis,
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
918
|
+
const Direction direction,
|
|
919
|
+
const SizingMode sizingModeMainDim,
|
|
920
|
+
const SizingMode sizingModeCrossDim,
|
|
1209
921
|
const float mainAxisownerSize,
|
|
1210
922
|
const float ownerWidth,
|
|
1211
923
|
const float availableInnerMainDim,
|
|
1212
924
|
const float availableInnerCrossDim,
|
|
1213
925
|
const float availableInnerWidth,
|
|
1214
926
|
const bool performLayout) {
|
|
1215
|
-
const auto& style = node->
|
|
927
|
+
const auto& style = node->style();
|
|
928
|
+
|
|
1216
929
|
const float leadingPaddingAndBorderMain =
|
|
1217
|
-
node->
|
|
930
|
+
node->style().computeFlexStartPaddingAndBorder(
|
|
931
|
+
mainAxis, direction, ownerWidth);
|
|
1218
932
|
const float trailingPaddingAndBorderMain =
|
|
1219
|
-
node->
|
|
1220
|
-
|
|
933
|
+
node->style().computeFlexEndPaddingAndBorder(
|
|
934
|
+
mainAxis, direction, ownerWidth);
|
|
935
|
+
|
|
936
|
+
const float gap = node->style().computeGapForAxis(mainAxis);
|
|
1221
937
|
// If we are using "at most" rules in the main axis, make sure that
|
|
1222
938
|
// remainingFreeSpace is 0 when min main dimension is not given
|
|
1223
|
-
if (
|
|
939
|
+
if (sizingModeMainDim == SizingMode::FitContent &&
|
|
1224
940
|
flexLine.layout.remainingFreeSpace > 0) {
|
|
1225
|
-
if (
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
941
|
+
if (style.minDimension(dimension(mainAxis)).isDefined() &&
|
|
942
|
+
style.minDimension(dimension(mainAxis))
|
|
943
|
+
.resolve(mainAxisownerSize)
|
|
944
|
+
.isDefined()) {
|
|
1229
945
|
// This condition makes sure that if the size of main dimension(after
|
|
1230
946
|
// considering child nodes main dim, leading and trailing padding etc)
|
|
1231
947
|
// falls below min dimension, then the remainingFreeSpace is reassigned
|
|
@@ -1233,15 +949,14 @@ static void justifyMainAxis(
|
|
|
1233
949
|
|
|
1234
950
|
// `minAvailableMainDim` denotes minimum available space in which child
|
|
1235
951
|
// can be laid out, it will exclude space consumed by padding and border.
|
|
1236
|
-
const float minAvailableMainDim =
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
.unwrap() -
|
|
952
|
+
const float minAvailableMainDim = style.minDimension(dimension(mainAxis))
|
|
953
|
+
.resolve(mainAxisownerSize)
|
|
954
|
+
.unwrap() -
|
|
1240
955
|
leadingPaddingAndBorderMain - trailingPaddingAndBorderMain;
|
|
1241
956
|
const float occupiedSpaceByChildNodes =
|
|
1242
957
|
availableInnerMainDim - flexLine.layout.remainingFreeSpace;
|
|
1243
958
|
flexLine.layout.remainingFreeSpace = yoga::maxOrDefined(
|
|
1244
|
-
0, minAvailableMainDim - occupiedSpaceByChildNodes);
|
|
959
|
+
0.0f, minAvailableMainDim - occupiedSpaceByChildNodes);
|
|
1245
960
|
} else {
|
|
1246
961
|
flexLine.layout.remainingFreeSpace = 0;
|
|
1247
962
|
}
|
|
@@ -1250,11 +965,11 @@ static void justifyMainAxis(
|
|
|
1250
965
|
int numberOfAutoMarginsOnCurrentLine = 0;
|
|
1251
966
|
for (size_t i = startOfLineIndex; i < flexLine.endOfLineIndex; i++) {
|
|
1252
967
|
auto child = node->getChild(i);
|
|
1253
|
-
if (child->
|
|
1254
|
-
if (child->
|
|
968
|
+
if (child->style().positionType() != PositionType::Absolute) {
|
|
969
|
+
if (child->style().flexStartMarginIsAuto(mainAxis, direction)) {
|
|
1255
970
|
numberOfAutoMarginsOnCurrentLine++;
|
|
1256
971
|
}
|
|
1257
|
-
if (child->
|
|
972
|
+
if (child->style().flexEndMarginIsAuto(mainAxis, direction)) {
|
|
1258
973
|
numberOfAutoMarginsOnCurrentLine++;
|
|
1259
974
|
}
|
|
1260
975
|
}
|
|
@@ -1265,7 +980,7 @@ static void justifyMainAxis(
|
|
|
1265
980
|
// each two elements.
|
|
1266
981
|
float leadingMainDim = 0;
|
|
1267
982
|
float betweenMainDim = gap;
|
|
1268
|
-
const Justify justifyContent = node->
|
|
983
|
+
const Justify justifyContent = node->style().justifyContent();
|
|
1269
984
|
|
|
1270
985
|
if (numberOfAutoMarginsOnCurrentLine == 0) {
|
|
1271
986
|
switch (justifyContent) {
|
|
@@ -1278,7 +993,7 @@ static void justifyMainAxis(
|
|
|
1278
993
|
case Justify::SpaceBetween:
|
|
1279
994
|
if (flexLine.itemsInFlow.size() > 1) {
|
|
1280
995
|
betweenMainDim +=
|
|
1281
|
-
yoga::maxOrDefined(flexLine.layout.remainingFreeSpace, 0) /
|
|
996
|
+
yoga::maxOrDefined(flexLine.layout.remainingFreeSpace, 0.0f) /
|
|
1282
997
|
static_cast<float>(flexLine.itemsInFlow.size() - 1);
|
|
1283
998
|
}
|
|
1284
999
|
break;
|
|
@@ -1307,79 +1022,76 @@ static void justifyMainAxis(
|
|
|
1307
1022
|
bool isNodeBaselineLayout = isBaselineLayout(node);
|
|
1308
1023
|
for (size_t i = startOfLineIndex; i < flexLine.endOfLineIndex; i++) {
|
|
1309
1024
|
const auto child = node->getChild(i);
|
|
1310
|
-
const Style& childStyle = child->
|
|
1025
|
+
const Style& childStyle = child->style();
|
|
1311
1026
|
const LayoutResults& childLayout = child->getLayout();
|
|
1312
1027
|
if (childStyle.display() == Display::None) {
|
|
1313
1028
|
continue;
|
|
1314
1029
|
}
|
|
1315
1030
|
if (childStyle.positionType() == PositionType::Absolute &&
|
|
1316
|
-
child->
|
|
1031
|
+
child->style().isFlexStartPositionDefined(mainAxis, direction)) {
|
|
1317
1032
|
if (performLayout) {
|
|
1318
1033
|
// In case the child is position absolute and has left/top being
|
|
1319
1034
|
// defined, we override the position to whatever the user said (and
|
|
1320
1035
|
// margin/border).
|
|
1321
1036
|
child->setLayoutPosition(
|
|
1322
|
-
child->
|
|
1323
|
-
|
|
1324
|
-
node->
|
|
1325
|
-
child->
|
|
1326
|
-
|
|
1037
|
+
child->style().computeFlexStartPosition(
|
|
1038
|
+
mainAxis, direction, availableInnerMainDim) +
|
|
1039
|
+
node->style().computeFlexStartBorder(mainAxis, direction) +
|
|
1040
|
+
child->style().computeFlexStartMargin(
|
|
1041
|
+
mainAxis, direction, availableInnerWidth),
|
|
1042
|
+
flexStartEdge(mainAxis));
|
|
1327
1043
|
}
|
|
1328
1044
|
} else {
|
|
1329
1045
|
// Now that we placed the element, we need to update the variables.
|
|
1330
1046
|
// We need to do that only for relative elements. Absolute elements do not
|
|
1331
1047
|
// take part in that phase.
|
|
1332
1048
|
if (childStyle.positionType() != PositionType::Absolute) {
|
|
1333
|
-
if (child->
|
|
1049
|
+
if (child->style().flexStartMarginIsAuto(mainAxis, direction)) {
|
|
1334
1050
|
flexLine.layout.mainDim += flexLine.layout.remainingFreeSpace /
|
|
1335
1051
|
static_cast<float>(numberOfAutoMarginsOnCurrentLine);
|
|
1336
1052
|
}
|
|
1337
1053
|
|
|
1338
1054
|
if (performLayout) {
|
|
1339
1055
|
child->setLayoutPosition(
|
|
1340
|
-
childLayout.position
|
|
1056
|
+
childLayout.position(flexStartEdge(mainAxis)) +
|
|
1341
1057
|
flexLine.layout.mainDim,
|
|
1342
|
-
|
|
1058
|
+
flexStartEdge(mainAxis));
|
|
1343
1059
|
}
|
|
1344
1060
|
|
|
1345
1061
|
if (child != flexLine.itemsInFlow.back()) {
|
|
1346
1062
|
flexLine.layout.mainDim += betweenMainDim;
|
|
1347
1063
|
}
|
|
1348
1064
|
|
|
1349
|
-
if (child->
|
|
1065
|
+
if (child->style().flexEndMarginIsAuto(mainAxis, direction)) {
|
|
1350
1066
|
flexLine.layout.mainDim += flexLine.layout.remainingFreeSpace /
|
|
1351
1067
|
static_cast<float>(numberOfAutoMarginsOnCurrentLine);
|
|
1352
1068
|
}
|
|
1353
1069
|
bool canSkipFlex =
|
|
1354
|
-
!performLayout &&
|
|
1070
|
+
!performLayout && sizingModeCrossDim == SizingMode::StretchFit;
|
|
1355
1071
|
if (canSkipFlex) {
|
|
1356
1072
|
// If we skipped the flex step, then we can't rely on the measuredDims
|
|
1357
1073
|
// because they weren't computed. This means we can't call
|
|
1358
1074
|
// dimensionWithMargin.
|
|
1359
|
-
flexLine.layout.mainDim +=
|
|
1360
|
-
|
|
1075
|
+
flexLine.layout.mainDim += child->style().computeMarginForAxis(
|
|
1076
|
+
mainAxis, availableInnerWidth) +
|
|
1361
1077
|
childLayout.computedFlexBasis.unwrap();
|
|
1362
1078
|
flexLine.layout.crossDim = availableInnerCrossDim;
|
|
1363
1079
|
} else {
|
|
1364
1080
|
// The main dimension is the sum of all the elements dimension plus
|
|
1365
1081
|
// the spacing.
|
|
1366
1082
|
flexLine.layout.mainDim +=
|
|
1367
|
-
dimensionWithMargin(
|
|
1083
|
+
child->dimensionWithMargin(mainAxis, availableInnerWidth);
|
|
1368
1084
|
|
|
1369
1085
|
if (isNodeBaselineLayout) {
|
|
1370
1086
|
// If the child is baseline aligned then the cross dimension is
|
|
1371
1087
|
// calculated by adding maxAscent and maxDescent from the baseline.
|
|
1372
1088
|
const float ascent = calculateBaseline(child) +
|
|
1373
|
-
child
|
|
1374
|
-
|
|
1375
|
-
FlexDirection::Column, availableInnerWidth)
|
|
1376
|
-
.unwrap();
|
|
1089
|
+
child->style().computeFlexStartMargin(
|
|
1090
|
+
FlexDirection::Column, direction, availableInnerWidth);
|
|
1377
1091
|
const float descent =
|
|
1378
|
-
child->getLayout().measuredDimension(
|
|
1379
|
-
child
|
|
1380
|
-
|
|
1381
|
-
FlexDirection::Column, availableInnerWidth)
|
|
1382
|
-
.unwrap() -
|
|
1092
|
+
child->getLayout().measuredDimension(Dimension::Height) +
|
|
1093
|
+
child->style().computeMarginForAxis(
|
|
1094
|
+
FlexDirection::Column, availableInnerWidth) -
|
|
1383
1095
|
ascent;
|
|
1384
1096
|
|
|
1385
1097
|
maxAscentForCurrentLine =
|
|
@@ -1392,14 +1104,15 @@ static void justifyMainAxis(
|
|
|
1392
1104
|
// when the items are not baseline aligned
|
|
1393
1105
|
flexLine.layout.crossDim = yoga::maxOrDefined(
|
|
1394
1106
|
flexLine.layout.crossDim,
|
|
1395
|
-
dimensionWithMargin(
|
|
1107
|
+
child->dimensionWithMargin(crossAxis, availableInnerWidth));
|
|
1396
1108
|
}
|
|
1397
1109
|
}
|
|
1398
1110
|
} else if (performLayout) {
|
|
1399
1111
|
child->setLayoutPosition(
|
|
1400
|
-
childLayout.position
|
|
1401
|
-
node->
|
|
1402
|
-
|
|
1112
|
+
childLayout.position(flexStartEdge(mainAxis)) +
|
|
1113
|
+
node->style().computeFlexStartBorder(mainAxis, direction) +
|
|
1114
|
+
leadingMainDim,
|
|
1115
|
+
flexStartEdge(mainAxis));
|
|
1403
1116
|
}
|
|
1404
1117
|
}
|
|
1405
1118
|
}
|
|
@@ -1446,9 +1159,9 @@ static void justifyMainAxis(
|
|
|
1446
1159
|
// depends on layout flags
|
|
1447
1160
|
// - ownerDirection: the inline (text) direction within the owner
|
|
1448
1161
|
// (left-to-right or right-to-left)
|
|
1449
|
-
// -
|
|
1162
|
+
// - widthSizingMode: indicates the sizing rules for the width (see below
|
|
1450
1163
|
// for explanation)
|
|
1451
|
-
// -
|
|
1164
|
+
// - heightSizingMode: indicates the sizing rules for the height (see below
|
|
1452
1165
|
// for explanation)
|
|
1453
1166
|
// - performLayout: specifies whether the caller is interested in just the
|
|
1454
1167
|
// dimensions of the node or it requires the entire node and its subtree to
|
|
@@ -1463,26 +1176,17 @@ static void justifyMainAxis(
|
|
|
1463
1176
|
// layout.measuredDimensions field includes any border or padding for the
|
|
1464
1177
|
// node but does not include margins.
|
|
1465
1178
|
//
|
|
1466
|
-
// The spec describes four different layout modes: "fill available", "max
|
|
1467
|
-
// content", "min content", and "fit content". Of these, we don't use "min
|
|
1468
|
-
// content" because we don't support default minimum main sizes (see above
|
|
1469
|
-
// for details). Each of our measure modes maps to a layout mode from the
|
|
1470
|
-
// spec (https://www.w3.org/TR/CSS3-sizing/#terms):
|
|
1471
|
-
// - MeasureMode::Undefined: max content
|
|
1472
|
-
// - MeasureMode::Exactly: fill available
|
|
1473
|
-
// - MeasureMode::AtMost: fit content
|
|
1474
|
-
//
|
|
1475
1179
|
// When calling calculateLayoutImpl and calculateLayoutInternal, if the
|
|
1476
1180
|
// caller passes an available size of undefined then it must also pass a
|
|
1477
|
-
// measure mode of
|
|
1181
|
+
// measure mode of SizingMode::MaxContent in that dimension.
|
|
1478
1182
|
//
|
|
1479
1183
|
static void calculateLayoutImpl(
|
|
1480
1184
|
yoga::Node* const node,
|
|
1481
1185
|
const float availableWidth,
|
|
1482
1186
|
const float availableHeight,
|
|
1483
1187
|
const Direction ownerDirection,
|
|
1484
|
-
const
|
|
1485
|
-
const
|
|
1188
|
+
const SizingMode widthSizingMode,
|
|
1189
|
+
const SizingMode heightSizingMode,
|
|
1486
1190
|
const float ownerWidth,
|
|
1487
1191
|
const float ownerHeight,
|
|
1488
1192
|
const bool performLayout,
|
|
@@ -1493,17 +1197,17 @@ static void calculateLayoutImpl(
|
|
|
1493
1197
|
yoga::assertFatalWithNode(
|
|
1494
1198
|
node,
|
|
1495
1199
|
yoga::isUndefined(availableWidth)
|
|
1496
|
-
?
|
|
1200
|
+
? widthSizingMode == SizingMode::MaxContent
|
|
1497
1201
|
: true,
|
|
1498
|
-
"availableWidth is indefinite so
|
|
1499
|
-
"
|
|
1202
|
+
"availableWidth is indefinite so widthSizingMode must be "
|
|
1203
|
+
"SizingMode::MaxContent");
|
|
1500
1204
|
yoga::assertFatalWithNode(
|
|
1501
1205
|
node,
|
|
1502
1206
|
yoga::isUndefined(availableHeight)
|
|
1503
|
-
?
|
|
1207
|
+
? heightSizingMode == SizingMode::MaxContent
|
|
1504
1208
|
: true,
|
|
1505
|
-
"availableHeight is indefinite so
|
|
1506
|
-
"
|
|
1209
|
+
"availableHeight is indefinite so heightSizingMode must be "
|
|
1210
|
+
"SizingMode::MaxContent");
|
|
1507
1211
|
|
|
1508
1212
|
(performLayout ? layoutMarkerData.layouts : layoutMarkerData.measures) += 1;
|
|
1509
1213
|
|
|
@@ -1516,51 +1220,64 @@ static void calculateLayoutImpl(
|
|
|
1516
1220
|
const FlexDirection flexColumnDirection =
|
|
1517
1221
|
resolveDirection(FlexDirection::Column, direction);
|
|
1518
1222
|
|
|
1519
|
-
const
|
|
1520
|
-
direction == Direction::LTR ?
|
|
1521
|
-
const
|
|
1223
|
+
const auto startEdge =
|
|
1224
|
+
direction == Direction::LTR ? PhysicalEdge::Left : PhysicalEdge::Right;
|
|
1225
|
+
const auto endEdge =
|
|
1226
|
+
direction == Direction::LTR ? PhysicalEdge::Right : PhysicalEdge::Left;
|
|
1522
1227
|
|
|
1523
|
-
const float marginRowLeading =
|
|
1524
|
-
|
|
1228
|
+
const float marginRowLeading = node->style().computeInlineStartMargin(
|
|
1229
|
+
flexRowDirection, direction, ownerWidth);
|
|
1525
1230
|
node->setLayoutMargin(marginRowLeading, startEdge);
|
|
1526
|
-
const float marginRowTrailing =
|
|
1527
|
-
|
|
1231
|
+
const float marginRowTrailing = node->style().computeInlineEndMargin(
|
|
1232
|
+
flexRowDirection, direction, ownerWidth);
|
|
1528
1233
|
node->setLayoutMargin(marginRowTrailing, endEdge);
|
|
1529
|
-
const float marginColumnLeading =
|
|
1530
|
-
|
|
1531
|
-
node->setLayoutMargin(marginColumnLeading,
|
|
1532
|
-
const float marginColumnTrailing =
|
|
1533
|
-
|
|
1534
|
-
node->setLayoutMargin(marginColumnTrailing,
|
|
1234
|
+
const float marginColumnLeading = node->style().computeInlineStartMargin(
|
|
1235
|
+
flexColumnDirection, direction, ownerWidth);
|
|
1236
|
+
node->setLayoutMargin(marginColumnLeading, PhysicalEdge::Top);
|
|
1237
|
+
const float marginColumnTrailing = node->style().computeInlineEndMargin(
|
|
1238
|
+
flexColumnDirection, direction, ownerWidth);
|
|
1239
|
+
node->setLayoutMargin(marginColumnTrailing, PhysicalEdge::Bottom);
|
|
1535
1240
|
|
|
1536
1241
|
const float marginAxisRow = marginRowLeading + marginRowTrailing;
|
|
1537
1242
|
const float marginAxisColumn = marginColumnLeading + marginColumnTrailing;
|
|
1538
1243
|
|
|
1539
|
-
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), startEdge);
|
|
1540
|
-
node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), endEdge);
|
|
1541
|
-
node->setLayoutBorder(node->getLeadingBorder(flexColumnDirection), YGEdgeTop);
|
|
1542
1244
|
node->setLayoutBorder(
|
|
1543
|
-
node->
|
|
1245
|
+
node->style().computeInlineStartBorder(flexRowDirection, direction),
|
|
1246
|
+
startEdge);
|
|
1247
|
+
node->setLayoutBorder(
|
|
1248
|
+
node->style().computeInlineEndBorder(flexRowDirection, direction),
|
|
1249
|
+
endEdge);
|
|
1250
|
+
node->setLayoutBorder(
|
|
1251
|
+
node->style().computeInlineStartBorder(flexColumnDirection, direction),
|
|
1252
|
+
PhysicalEdge::Top);
|
|
1253
|
+
node->setLayoutBorder(
|
|
1254
|
+
node->style().computeInlineEndBorder(flexColumnDirection, direction),
|
|
1255
|
+
PhysicalEdge::Bottom);
|
|
1544
1256
|
|
|
1545
1257
|
node->setLayoutPadding(
|
|
1546
|
-
node->
|
|
1258
|
+
node->style().computeInlineStartPadding(
|
|
1259
|
+
flexRowDirection, direction, ownerWidth),
|
|
1547
1260
|
startEdge);
|
|
1548
1261
|
node->setLayoutPadding(
|
|
1549
|
-
node->
|
|
1262
|
+
node->style().computeInlineEndPadding(
|
|
1263
|
+
flexRowDirection, direction, ownerWidth),
|
|
1264
|
+
endEdge);
|
|
1550
1265
|
node->setLayoutPadding(
|
|
1551
|
-
node->
|
|
1552
|
-
|
|
1266
|
+
node->style().computeInlineStartPadding(
|
|
1267
|
+
flexColumnDirection, direction, ownerWidth),
|
|
1268
|
+
PhysicalEdge::Top);
|
|
1553
1269
|
node->setLayoutPadding(
|
|
1554
|
-
node->
|
|
1555
|
-
|
|
1270
|
+
node->style().computeInlineEndPadding(
|
|
1271
|
+
flexColumnDirection, direction, ownerWidth),
|
|
1272
|
+
PhysicalEdge::Bottom);
|
|
1556
1273
|
|
|
1557
1274
|
if (node->hasMeasureFunc()) {
|
|
1558
1275
|
measureNodeWithMeasureFunc(
|
|
1559
1276
|
node,
|
|
1560
1277
|
availableWidth - marginAxisRow,
|
|
1561
1278
|
availableHeight - marginAxisColumn,
|
|
1562
|
-
|
|
1563
|
-
|
|
1279
|
+
widthSizingMode,
|
|
1280
|
+
heightSizingMode,
|
|
1564
1281
|
ownerWidth,
|
|
1565
1282
|
ownerHeight,
|
|
1566
1283
|
layoutMarkerData,
|
|
@@ -1574,8 +1291,8 @@ static void calculateLayoutImpl(
|
|
|
1574
1291
|
node,
|
|
1575
1292
|
availableWidth - marginAxisRow,
|
|
1576
1293
|
availableHeight - marginAxisColumn,
|
|
1577
|
-
|
|
1578
|
-
|
|
1294
|
+
widthSizingMode,
|
|
1295
|
+
heightSizingMode,
|
|
1579
1296
|
ownerWidth,
|
|
1580
1297
|
ownerHeight);
|
|
1581
1298
|
return;
|
|
@@ -1588,8 +1305,8 @@ static void calculateLayoutImpl(
|
|
|
1588
1305
|
node,
|
|
1589
1306
|
availableWidth - marginAxisRow,
|
|
1590
1307
|
availableHeight - marginAxisColumn,
|
|
1591
|
-
|
|
1592
|
-
|
|
1308
|
+
widthSizingMode,
|
|
1309
|
+
heightSizingMode,
|
|
1593
1310
|
ownerWidth,
|
|
1594
1311
|
ownerHeight)) {
|
|
1595
1312
|
return;
|
|
@@ -1603,27 +1320,26 @@ static void calculateLayoutImpl(
|
|
|
1603
1320
|
|
|
1604
1321
|
// STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
|
|
1605
1322
|
const FlexDirection mainAxis =
|
|
1606
|
-
resolveDirection(node->
|
|
1323
|
+
resolveDirection(node->style().flexDirection(), direction);
|
|
1607
1324
|
const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
|
1608
1325
|
const bool isMainAxisRow = isRow(mainAxis);
|
|
1609
|
-
const bool isNodeFlexWrap = node->
|
|
1326
|
+
const bool isNodeFlexWrap = node->style().flexWrap() != Wrap::NoWrap;
|
|
1610
1327
|
|
|
1611
1328
|
const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight;
|
|
1612
1329
|
const float crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth;
|
|
1613
1330
|
|
|
1614
1331
|
const float paddingAndBorderAxisMain =
|
|
1615
1332
|
paddingAndBorderForAxis(node, mainAxis, ownerWidth);
|
|
1616
|
-
const float leadingPaddingAndBorderCross =
|
|
1617
|
-
node->getLeadingPaddingAndBorder(crossAxis, ownerWidth).unwrap();
|
|
1618
|
-
const float trailingPaddingAndBorderCross =
|
|
1619
|
-
node->getTrailingPaddingAndBorder(crossAxis, ownerWidth).unwrap();
|
|
1620
1333
|
const float paddingAndBorderAxisCross =
|
|
1621
|
-
|
|
1334
|
+
paddingAndBorderForAxis(node, crossAxis, ownerWidth);
|
|
1335
|
+
const float leadingPaddingAndBorderCross =
|
|
1336
|
+
node->style().computeFlexStartPaddingAndBorder(
|
|
1337
|
+
crossAxis, direction, ownerWidth);
|
|
1622
1338
|
|
|
1623
|
-
|
|
1624
|
-
isMainAxisRow ?
|
|
1625
|
-
|
|
1626
|
-
isMainAxisRow ?
|
|
1339
|
+
SizingMode sizingModeMainDim =
|
|
1340
|
+
isMainAxisRow ? widthSizingMode : heightSizingMode;
|
|
1341
|
+
SizingMode sizingModeCrossDim =
|
|
1342
|
+
isMainAxisRow ? heightSizingMode : widthSizingMode;
|
|
1627
1343
|
|
|
1628
1344
|
const float paddingAndBorderAxisRow =
|
|
1629
1345
|
isMainAxisRow ? paddingAndBorderAxisMain : paddingAndBorderAxisCross;
|
|
@@ -1634,13 +1350,13 @@ static void calculateLayoutImpl(
|
|
|
1634
1350
|
|
|
1635
1351
|
float availableInnerWidth = calculateAvailableInnerDimension(
|
|
1636
1352
|
node,
|
|
1637
|
-
|
|
1353
|
+
Dimension::Width,
|
|
1638
1354
|
availableWidth - marginAxisRow,
|
|
1639
1355
|
paddingAndBorderAxisRow,
|
|
1640
1356
|
ownerWidth);
|
|
1641
1357
|
float availableInnerHeight = calculateAvailableInnerDimension(
|
|
1642
1358
|
node,
|
|
1643
|
-
|
|
1359
|
+
Dimension::Height,
|
|
1644
1360
|
availableHeight - marginAxisColumn,
|
|
1645
1361
|
paddingAndBorderAxisColumn,
|
|
1646
1362
|
ownerHeight);
|
|
@@ -1658,8 +1374,8 @@ static void calculateLayoutImpl(
|
|
|
1658
1374
|
node,
|
|
1659
1375
|
availableInnerWidth,
|
|
1660
1376
|
availableInnerHeight,
|
|
1661
|
-
|
|
1662
|
-
|
|
1377
|
+
widthSizingMode,
|
|
1378
|
+
heightSizingMode,
|
|
1663
1379
|
direction,
|
|
1664
1380
|
mainAxis,
|
|
1665
1381
|
performLayout,
|
|
@@ -1668,18 +1384,17 @@ static void calculateLayoutImpl(
|
|
|
1668
1384
|
generationCount);
|
|
1669
1385
|
|
|
1670
1386
|
if (childCount > 1) {
|
|
1671
|
-
totalMainDim +=
|
|
1672
|
-
node->getGapForAxis(mainAxis, availableInnerCrossDim).unwrap() *
|
|
1387
|
+
totalMainDim += node->style().computeGapForAxis(mainAxis) *
|
|
1673
1388
|
static_cast<float>(childCount - 1);
|
|
1674
1389
|
}
|
|
1675
1390
|
|
|
1676
1391
|
const bool mainAxisOverflows =
|
|
1677
|
-
(
|
|
1392
|
+
(sizingModeMainDim != SizingMode::MaxContent) &&
|
|
1678
1393
|
totalMainDim > availableInnerMainDim;
|
|
1679
1394
|
|
|
1680
1395
|
if (isNodeFlexWrap && mainAxisOverflows &&
|
|
1681
|
-
|
|
1682
|
-
|
|
1396
|
+
sizingModeMainDim == SizingMode::FitContent) {
|
|
1397
|
+
sizingModeMainDim = SizingMode::StretchFit;
|
|
1683
1398
|
}
|
|
1684
1399
|
// STEP 4: COLLECT FLEX ITEMS INTO FLEX LINES
|
|
1685
1400
|
|
|
@@ -1693,8 +1408,7 @@ static void calculateLayoutImpl(
|
|
|
1693
1408
|
// Accumulated cross dimensions of all lines so far.
|
|
1694
1409
|
float totalLineCrossDim = 0;
|
|
1695
1410
|
|
|
1696
|
-
const float crossAxisGap =
|
|
1697
|
-
node->getGapForAxis(crossAxis, availableInnerCrossDim).unwrap();
|
|
1411
|
+
const float crossAxisGap = node->style().computeGapForAxis(crossAxis);
|
|
1698
1412
|
|
|
1699
1413
|
// Max main dimension of all the lines.
|
|
1700
1414
|
float maxLineMainDim = 0;
|
|
@@ -1714,7 +1428,7 @@ static void calculateLayoutImpl(
|
|
|
1714
1428
|
// If we don't need to measure the cross axis, we can skip the entire flex
|
|
1715
1429
|
// step.
|
|
1716
1430
|
const bool canSkipFlex =
|
|
1717
|
-
!performLayout &&
|
|
1431
|
+
!performLayout && sizingModeCrossDim == SizingMode::StretchFit;
|
|
1718
1432
|
|
|
1719
1433
|
// STEP 5: RESOLVING FLEXIBLE LENGTHS ON MAIN AXIS
|
|
1720
1434
|
// Calculate the remaining available space that needs to be allocated. If
|
|
@@ -1724,23 +1438,19 @@ static void calculateLayoutImpl(
|
|
|
1724
1438
|
bool sizeBasedOnContent = false;
|
|
1725
1439
|
// If we don't measure with exact main dimension we want to ensure we don't
|
|
1726
1440
|
// violate min and max
|
|
1727
|
-
if (
|
|
1728
|
-
const auto& style = node->
|
|
1441
|
+
if (sizingModeMainDim != SizingMode::StretchFit) {
|
|
1442
|
+
const auto& style = node->style();
|
|
1729
1443
|
const float minInnerWidth =
|
|
1730
|
-
|
|
1731
|
-
.unwrap() -
|
|
1444
|
+
style.minDimension(Dimension::Width).resolve(ownerWidth).unwrap() -
|
|
1732
1445
|
paddingAndBorderAxisRow;
|
|
1733
1446
|
const float maxInnerWidth =
|
|
1734
|
-
|
|
1735
|
-
.unwrap() -
|
|
1447
|
+
style.maxDimension(Dimension::Width).resolve(ownerWidth).unwrap() -
|
|
1736
1448
|
paddingAndBorderAxisRow;
|
|
1737
1449
|
const float minInnerHeight =
|
|
1738
|
-
|
|
1739
|
-
.unwrap() -
|
|
1450
|
+
style.minDimension(Dimension::Height).resolve(ownerHeight).unwrap() -
|
|
1740
1451
|
paddingAndBorderAxisColumn;
|
|
1741
1452
|
const float maxInnerHeight =
|
|
1742
|
-
|
|
1743
|
-
.unwrap() -
|
|
1453
|
+
style.maxDimension(Dimension::Height).resolve(ownerHeight).unwrap() -
|
|
1744
1454
|
paddingAndBorderAxisColumn;
|
|
1745
1455
|
|
|
1746
1456
|
const float minInnerMainDim =
|
|
@@ -1748,11 +1458,11 @@ static void calculateLayoutImpl(
|
|
|
1748
1458
|
const float maxInnerMainDim =
|
|
1749
1459
|
isMainAxisRow ? maxInnerWidth : maxInnerHeight;
|
|
1750
1460
|
|
|
1751
|
-
if (
|
|
1461
|
+
if (yoga::isDefined(minInnerMainDim) &&
|
|
1752
1462
|
flexLine.sizeConsumed < minInnerMainDim) {
|
|
1753
1463
|
availableInnerMainDim = minInnerMainDim;
|
|
1754
1464
|
} else if (
|
|
1755
|
-
|
|
1465
|
+
yoga::isDefined(maxInnerMainDim) &&
|
|
1756
1466
|
flexLine.sizeConsumed > maxInnerMainDim) {
|
|
1757
1467
|
availableInnerMainDim = maxInnerMainDim;
|
|
1758
1468
|
} else {
|
|
@@ -1760,9 +1470,9 @@ static void calculateLayoutImpl(
|
|
|
1760
1470
|
node->hasErrata(Errata::StretchFlexBasis);
|
|
1761
1471
|
|
|
1762
1472
|
if (!useLegacyStretchBehaviour &&
|
|
1763
|
-
((
|
|
1473
|
+
((yoga::isDefined(flexLine.layout.totalFlexGrowFactors) &&
|
|
1764
1474
|
flexLine.layout.totalFlexGrowFactors == 0) ||
|
|
1765
|
-
(
|
|
1475
|
+
(yoga::isDefined(node->resolveFlexGrow()) &&
|
|
1766
1476
|
node->resolveFlexGrow() == 0))) {
|
|
1767
1477
|
// If we don't have any children to flex or we can't flex the node
|
|
1768
1478
|
// itself, space we've used is all space we need. Root node also
|
|
@@ -1774,7 +1484,7 @@ static void calculateLayoutImpl(
|
|
|
1774
1484
|
}
|
|
1775
1485
|
}
|
|
1776
1486
|
|
|
1777
|
-
if (!sizeBasedOnContent &&
|
|
1487
|
+
if (!sizeBasedOnContent && yoga::isDefined(availableInnerMainDim)) {
|
|
1778
1488
|
flexLine.layout.remainingFreeSpace =
|
|
1779
1489
|
availableInnerMainDim - flexLine.sizeConsumed;
|
|
1780
1490
|
} else if (flexLine.sizeConsumed < 0) {
|
|
@@ -1791,13 +1501,14 @@ static void calculateLayoutImpl(
|
|
|
1791
1501
|
flexLine,
|
|
1792
1502
|
mainAxis,
|
|
1793
1503
|
crossAxis,
|
|
1504
|
+
direction,
|
|
1794
1505
|
mainAxisownerSize,
|
|
1795
1506
|
availableInnerMainDim,
|
|
1796
1507
|
availableInnerCrossDim,
|
|
1797
1508
|
availableInnerWidth,
|
|
1798
1509
|
availableInnerHeight,
|
|
1799
1510
|
mainAxisOverflows,
|
|
1800
|
-
|
|
1511
|
+
sizingModeCrossDim,
|
|
1801
1512
|
performLayout,
|
|
1802
1513
|
layoutMarkerData,
|
|
1803
1514
|
depth,
|
|
@@ -1805,7 +1516,7 @@ static void calculateLayoutImpl(
|
|
|
1805
1516
|
}
|
|
1806
1517
|
|
|
1807
1518
|
node->setLayoutHadOverflow(
|
|
1808
|
-
node->getLayout().hadOverflow()
|
|
1519
|
+
node->getLayout().hadOverflow() ||
|
|
1809
1520
|
(flexLine.layout.remainingFreeSpace < 0));
|
|
1810
1521
|
|
|
1811
1522
|
// STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
|
|
@@ -1821,8 +1532,9 @@ static void calculateLayoutImpl(
|
|
|
1821
1532
|
startOfLineIndex,
|
|
1822
1533
|
mainAxis,
|
|
1823
1534
|
crossAxis,
|
|
1824
|
-
|
|
1825
|
-
|
|
1535
|
+
direction,
|
|
1536
|
+
sizingModeMainDim,
|
|
1537
|
+
sizingModeCrossDim,
|
|
1826
1538
|
mainAxisownerSize,
|
|
1827
1539
|
ownerWidth,
|
|
1828
1540
|
availableInnerMainDim,
|
|
@@ -1831,8 +1543,8 @@ static void calculateLayoutImpl(
|
|
|
1831
1543
|
performLayout);
|
|
1832
1544
|
|
|
1833
1545
|
float containerCrossAxis = availableInnerCrossDim;
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1546
|
+
if (sizingModeCrossDim == SizingMode::MaxContent ||
|
|
1547
|
+
sizingModeCrossDim == SizingMode::FitContent) {
|
|
1836
1548
|
// Compute the cross axis from the max cross dimension of the children.
|
|
1837
1549
|
containerCrossAxis =
|
|
1838
1550
|
boundAxis(
|
|
@@ -1845,53 +1557,58 @@ static void calculateLayoutImpl(
|
|
|
1845
1557
|
}
|
|
1846
1558
|
|
|
1847
1559
|
// If there's no flex wrap, the cross dimension is defined by the container.
|
|
1848
|
-
if (!isNodeFlexWrap &&
|
|
1560
|
+
if (!isNodeFlexWrap && sizingModeCrossDim == SizingMode::StretchFit) {
|
|
1849
1561
|
flexLine.layout.crossDim = availableInnerCrossDim;
|
|
1850
1562
|
}
|
|
1851
1563
|
|
|
1852
|
-
//
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1564
|
+
// As-per https://www.w3.org/TR/css-flexbox-1/#cross-sizing, the
|
|
1565
|
+
// cross-size of the line within a single-line container should be bound to
|
|
1566
|
+
// min/max constraints before alignment within the line. In a multi-line
|
|
1567
|
+
// container, affecting alignment between the lines.
|
|
1568
|
+
if (!isNodeFlexWrap) {
|
|
1569
|
+
flexLine.layout.crossDim =
|
|
1570
|
+
boundAxis(
|
|
1571
|
+
node,
|
|
1572
|
+
crossAxis,
|
|
1573
|
+
flexLine.layout.crossDim + paddingAndBorderAxisCross,
|
|
1574
|
+
crossAxisownerSize,
|
|
1575
|
+
ownerWidth) -
|
|
1576
|
+
paddingAndBorderAxisCross;
|
|
1577
|
+
}
|
|
1861
1578
|
|
|
1862
1579
|
// STEP 7: CROSS-AXIS ALIGNMENT
|
|
1863
1580
|
// We can skip child alignment if we're just measuring the container.
|
|
1864
1581
|
if (performLayout) {
|
|
1865
1582
|
for (size_t i = startOfLineIndex; i < endOfLineIndex; i++) {
|
|
1866
1583
|
const auto child = node->getChild(i);
|
|
1867
|
-
if (child->
|
|
1584
|
+
if (child->style().display() == Display::None) {
|
|
1868
1585
|
continue;
|
|
1869
1586
|
}
|
|
1870
|
-
if (child->
|
|
1587
|
+
if (child->style().positionType() == PositionType::Absolute) {
|
|
1871
1588
|
// If the child is absolutely positioned and has a
|
|
1872
1589
|
// top/left/bottom/right set, override all the previously computed
|
|
1873
1590
|
// positions to set it correctly.
|
|
1874
1591
|
const bool isChildLeadingPosDefined =
|
|
1875
|
-
child->
|
|
1592
|
+
child->style().isFlexStartPositionDefined(crossAxis, direction);
|
|
1876
1593
|
if (isChildLeadingPosDefined) {
|
|
1877
1594
|
child->setLayoutPosition(
|
|
1878
|
-
child->
|
|
1879
|
-
|
|
1880
|
-
node->
|
|
1881
|
-
child->
|
|
1882
|
-
|
|
1883
|
-
|
|
1595
|
+
child->style().computeFlexStartPosition(
|
|
1596
|
+
crossAxis, direction, availableInnerCrossDim) +
|
|
1597
|
+
node->style().computeFlexStartBorder(crossAxis, direction) +
|
|
1598
|
+
child->style().computeFlexStartMargin(
|
|
1599
|
+
crossAxis, direction, availableInnerWidth),
|
|
1600
|
+
flexStartEdge(crossAxis));
|
|
1884
1601
|
}
|
|
1885
1602
|
// If leading position is not defined or calculations result in Nan,
|
|
1886
1603
|
// default to border + margin
|
|
1887
1604
|
if (!isChildLeadingPosDefined ||
|
|
1888
1605
|
yoga::isUndefined(
|
|
1889
|
-
child->getLayout().position
|
|
1606
|
+
child->getLayout().position(flexStartEdge(crossAxis)))) {
|
|
1890
1607
|
child->setLayoutPosition(
|
|
1891
|
-
node->
|
|
1892
|
-
child->
|
|
1893
|
-
|
|
1894
|
-
|
|
1608
|
+
node->style().computeFlexStartBorder(crossAxis, direction) +
|
|
1609
|
+
child->style().computeFlexStartMargin(
|
|
1610
|
+
crossAxis, direction, availableInnerWidth),
|
|
1611
|
+
flexStartEdge(crossAxis));
|
|
1895
1612
|
}
|
|
1896
1613
|
} else {
|
|
1897
1614
|
float leadingCrossDim = leadingPaddingAndBorderCross;
|
|
@@ -1905,42 +1622,41 @@ static void calculateLayoutImpl(
|
|
|
1905
1622
|
// time, this time forcing the cross-axis size to be the computed
|
|
1906
1623
|
// cross size for the current line.
|
|
1907
1624
|
if (alignItem == Align::Stretch &&
|
|
1908
|
-
child->
|
|
1909
|
-
child->
|
|
1625
|
+
!child->style().flexStartMarginIsAuto(crossAxis, direction) &&
|
|
1626
|
+
!child->style().flexEndMarginIsAuto(crossAxis, direction)) {
|
|
1910
1627
|
// If the child defines a definite size for its cross axis, there's
|
|
1911
1628
|
// no need to stretch.
|
|
1912
|
-
if (!
|
|
1913
|
-
|
|
1629
|
+
if (!child->hasDefiniteLength(
|
|
1630
|
+
dimension(crossAxis), availableInnerCrossDim)) {
|
|
1914
1631
|
float childMainSize =
|
|
1915
1632
|
child->getLayout().measuredDimension(dimension(mainAxis));
|
|
1916
|
-
const auto& childStyle = child->
|
|
1917
|
-
float childCrossSize =
|
|
1918
|
-
? child->
|
|
1919
|
-
|
|
1633
|
+
const auto& childStyle = child->style();
|
|
1634
|
+
float childCrossSize = childStyle.aspectRatio().isDefined()
|
|
1635
|
+
? child->style().computeMarginForAxis(
|
|
1636
|
+
crossAxis, availableInnerWidth) +
|
|
1920
1637
|
(isMainAxisRow
|
|
1921
1638
|
? childMainSize / childStyle.aspectRatio().unwrap()
|
|
1922
1639
|
: childMainSize * childStyle.aspectRatio().unwrap())
|
|
1923
1640
|
: flexLine.layout.crossDim;
|
|
1924
1641
|
|
|
1925
|
-
childMainSize +=
|
|
1926
|
-
|
|
1927
|
-
.unwrap();
|
|
1642
|
+
childMainSize += child->style().computeMarginForAxis(
|
|
1643
|
+
mainAxis, availableInnerWidth);
|
|
1928
1644
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1645
|
+
SizingMode childMainSizingMode = SizingMode::StretchFit;
|
|
1646
|
+
SizingMode childCrossSizingMode = SizingMode::StretchFit;
|
|
1931
1647
|
constrainMaxSizeForMode(
|
|
1932
1648
|
child,
|
|
1933
1649
|
mainAxis,
|
|
1934
1650
|
availableInnerMainDim,
|
|
1935
1651
|
availableInnerWidth,
|
|
1936
|
-
&
|
|
1652
|
+
&childMainSizingMode,
|
|
1937
1653
|
&childMainSize);
|
|
1938
1654
|
constrainMaxSizeForMode(
|
|
1939
1655
|
child,
|
|
1940
1656
|
crossAxis,
|
|
1941
1657
|
availableInnerCrossDim,
|
|
1942
1658
|
availableInnerWidth,
|
|
1943
|
-
&
|
|
1659
|
+
&childCrossSizingMode,
|
|
1944
1660
|
&childCrossSize);
|
|
1945
1661
|
|
|
1946
1662
|
const float childWidth =
|
|
@@ -1948,27 +1664,27 @@ static void calculateLayoutImpl(
|
|
|
1948
1664
|
const float childHeight =
|
|
1949
1665
|
!isMainAxisRow ? childMainSize : childCrossSize;
|
|
1950
1666
|
|
|
1951
|
-
auto alignContent = node->
|
|
1667
|
+
auto alignContent = node->style().alignContent();
|
|
1952
1668
|
auto crossAxisDoesNotGrow =
|
|
1953
1669
|
alignContent != Align::Stretch && isNodeFlexWrap;
|
|
1954
|
-
const
|
|
1670
|
+
const SizingMode childWidthSizingMode =
|
|
1955
1671
|
yoga::isUndefined(childWidth) ||
|
|
1956
1672
|
(!isMainAxisRow && crossAxisDoesNotGrow)
|
|
1957
|
-
?
|
|
1958
|
-
:
|
|
1959
|
-
const
|
|
1673
|
+
? SizingMode::MaxContent
|
|
1674
|
+
: SizingMode::StretchFit;
|
|
1675
|
+
const SizingMode childHeightSizingMode =
|
|
1960
1676
|
yoga::isUndefined(childHeight) ||
|
|
1961
1677
|
(isMainAxisRow && crossAxisDoesNotGrow)
|
|
1962
|
-
?
|
|
1963
|
-
:
|
|
1678
|
+
? SizingMode::MaxContent
|
|
1679
|
+
: SizingMode::StretchFit;
|
|
1964
1680
|
|
|
1965
1681
|
calculateLayoutInternal(
|
|
1966
1682
|
child,
|
|
1967
1683
|
childWidth,
|
|
1968
1684
|
childHeight,
|
|
1969
1685
|
direction,
|
|
1970
|
-
|
|
1971
|
-
|
|
1686
|
+
childWidthSizingMode,
|
|
1687
|
+
childHeightSizingMode,
|
|
1972
1688
|
availableInnerWidth,
|
|
1973
1689
|
availableInnerHeight,
|
|
1974
1690
|
true,
|
|
@@ -1979,17 +1695,17 @@ static void calculateLayoutImpl(
|
|
|
1979
1695
|
}
|
|
1980
1696
|
} else {
|
|
1981
1697
|
const float remainingCrossDim = containerCrossAxis -
|
|
1982
|
-
dimensionWithMargin(
|
|
1698
|
+
child->dimensionWithMargin(crossAxis, availableInnerWidth);
|
|
1983
1699
|
|
|
1984
|
-
if (child->
|
|
1985
|
-
child->
|
|
1700
|
+
if (child->style().flexStartMarginIsAuto(crossAxis, direction) &&
|
|
1701
|
+
child->style().flexEndMarginIsAuto(crossAxis, direction)) {
|
|
1986
1702
|
leadingCrossDim +=
|
|
1987
1703
|
yoga::maxOrDefined(0.0f, remainingCrossDim / 2);
|
|
1988
|
-
} else if (
|
|
1989
|
-
|
|
1704
|
+
} else if (child->style().flexEndMarginIsAuto(
|
|
1705
|
+
crossAxis, direction)) {
|
|
1990
1706
|
// No-Op
|
|
1991
|
-
} else if (
|
|
1992
|
-
|
|
1707
|
+
} else if (child->style().flexStartMarginIsAuto(
|
|
1708
|
+
crossAxis, direction)) {
|
|
1993
1709
|
leadingCrossDim += yoga::maxOrDefined(0.0f, remainingCrossDim);
|
|
1994
1710
|
} else if (alignItem == Align::FlexStart) {
|
|
1995
1711
|
// No-Op
|
|
@@ -2001,9 +1717,9 @@ static void calculateLayoutImpl(
|
|
|
2001
1717
|
}
|
|
2002
1718
|
// And we apply the position
|
|
2003
1719
|
child->setLayoutPosition(
|
|
2004
|
-
child->getLayout().position
|
|
1720
|
+
child->getLayout().position(flexStartEdge(crossAxis)) +
|
|
2005
1721
|
totalLineCrossDim + leadingCrossDim,
|
|
2006
|
-
|
|
1722
|
+
flexStartEdge(crossAxis));
|
|
2007
1723
|
}
|
|
2008
1724
|
}
|
|
2009
1725
|
}
|
|
@@ -2017,47 +1733,65 @@ static void calculateLayoutImpl(
|
|
|
2017
1733
|
// STEP 8: MULTI-LINE CONTENT ALIGNMENT
|
|
2018
1734
|
// currentLead stores the size of the cross dim
|
|
2019
1735
|
if (performLayout && (isNodeFlexWrap || isBaselineLayout(node))) {
|
|
2020
|
-
float
|
|
1736
|
+
float leadPerLine = 0;
|
|
2021
1737
|
float currentLead = leadingPaddingAndBorderCross;
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
1738
|
+
|
|
1739
|
+
const float unclampedCrossDim = sizingModeCrossDim == SizingMode::StretchFit
|
|
1740
|
+
? availableInnerCrossDim + paddingAndBorderAxisCross
|
|
1741
|
+
: node->hasDefiniteLength(dimension(crossAxis), crossAxisownerSize)
|
|
1742
|
+
? node->getResolvedDimension(dimension(crossAxis))
|
|
1743
|
+
.resolve(crossAxisownerSize)
|
|
1744
|
+
.unwrap()
|
|
1745
|
+
: totalLineCrossDim + paddingAndBorderAxisCross;
|
|
1746
|
+
|
|
1747
|
+
const float innerCrossDim =
|
|
1748
|
+
boundAxis(node, crossAxis, unclampedCrossDim, ownerHeight, ownerWidth) -
|
|
1749
|
+
paddingAndBorderAxisCross;
|
|
1750
|
+
|
|
1751
|
+
const float remainingAlignContentDim = innerCrossDim - totalLineCrossDim;
|
|
1752
|
+
switch (node->style().alignContent()) {
|
|
1753
|
+
case Align::FlexEnd:
|
|
1754
|
+
currentLead += remainingAlignContentDim;
|
|
1755
|
+
break;
|
|
1756
|
+
case Align::Center:
|
|
1757
|
+
currentLead += remainingAlignContentDim / 2;
|
|
1758
|
+
break;
|
|
1759
|
+
case Align::Stretch:
|
|
1760
|
+
if (innerCrossDim > totalLineCrossDim) {
|
|
1761
|
+
leadPerLine =
|
|
1762
|
+
remainingAlignContentDim / static_cast<float>(lineCount);
|
|
1763
|
+
}
|
|
1764
|
+
break;
|
|
1765
|
+
case Align::SpaceAround:
|
|
1766
|
+
if (innerCrossDim > totalLineCrossDim) {
|
|
1767
|
+
currentLead +=
|
|
1768
|
+
remainingAlignContentDim / (2 * static_cast<float>(lineCount));
|
|
1769
|
+
leadPerLine =
|
|
1770
|
+
remainingAlignContentDim / static_cast<float>(lineCount);
|
|
1771
|
+
} else {
|
|
2030
1772
|
currentLead += remainingAlignContentDim / 2;
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
remainingAlignContentDim / static_cast<float>(lineCount - 1);
|
|
2054
|
-
}
|
|
2055
|
-
break;
|
|
2056
|
-
case Align::Auto:
|
|
2057
|
-
case Align::FlexStart:
|
|
2058
|
-
case Align::Baseline:
|
|
2059
|
-
break;
|
|
2060
|
-
}
|
|
1773
|
+
}
|
|
1774
|
+
break;
|
|
1775
|
+
case Align::SpaceEvenly:
|
|
1776
|
+
if (innerCrossDim > totalLineCrossDim) {
|
|
1777
|
+
currentLead +=
|
|
1778
|
+
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
|
1779
|
+
leadPerLine =
|
|
1780
|
+
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
|
1781
|
+
} else {
|
|
1782
|
+
currentLead += remainingAlignContentDim / 2;
|
|
1783
|
+
}
|
|
1784
|
+
break;
|
|
1785
|
+
case Align::SpaceBetween:
|
|
1786
|
+
if (innerCrossDim > totalLineCrossDim && lineCount > 1) {
|
|
1787
|
+
leadPerLine =
|
|
1788
|
+
remainingAlignContentDim / static_cast<float>(lineCount - 1);
|
|
1789
|
+
}
|
|
1790
|
+
break;
|
|
1791
|
+
case Align::Auto:
|
|
1792
|
+
case Align::FlexStart:
|
|
1793
|
+
case Align::Baseline:
|
|
1794
|
+
break;
|
|
2061
1795
|
}
|
|
2062
1796
|
size_t endIndex = 0;
|
|
2063
1797
|
for (size_t i = 0; i < lineCount; i++) {
|
|
@@ -2070,32 +1804,28 @@ static void calculateLayoutImpl(
|
|
|
2070
1804
|
float maxDescentForCurrentLine = 0;
|
|
2071
1805
|
for (ii = startIndex; ii < childCount; ii++) {
|
|
2072
1806
|
const auto child = node->getChild(ii);
|
|
2073
|
-
if (child->
|
|
1807
|
+
if (child->style().display() == Display::None) {
|
|
2074
1808
|
continue;
|
|
2075
1809
|
}
|
|
2076
|
-
if (child->
|
|
1810
|
+
if (child->style().positionType() != PositionType::Absolute) {
|
|
2077
1811
|
if (child->getLineIndex() != i) {
|
|
2078
1812
|
break;
|
|
2079
1813
|
}
|
|
2080
|
-
if (isLayoutDimensionDefined(
|
|
1814
|
+
if (child->isLayoutDimensionDefined(crossAxis)) {
|
|
2081
1815
|
lineHeight = yoga::maxOrDefined(
|
|
2082
1816
|
lineHeight,
|
|
2083
1817
|
child->getLayout().measuredDimension(dimension(crossAxis)) +
|
|
2084
|
-
child->
|
|
2085
|
-
|
|
1818
|
+
child->style().computeMarginForAxis(
|
|
1819
|
+
crossAxis, availableInnerWidth));
|
|
2086
1820
|
}
|
|
2087
1821
|
if (resolveChildAlignment(node, child) == Align::Baseline) {
|
|
2088
1822
|
const float ascent = calculateBaseline(child) +
|
|
2089
|
-
child
|
|
2090
|
-
|
|
2091
|
-
FlexDirection::Column, availableInnerWidth)
|
|
2092
|
-
.unwrap();
|
|
1823
|
+
child->style().computeFlexStartMargin(
|
|
1824
|
+
FlexDirection::Column, direction, availableInnerWidth);
|
|
2093
1825
|
const float descent =
|
|
2094
|
-
child->getLayout().measuredDimension(
|
|
2095
|
-
child
|
|
2096
|
-
|
|
2097
|
-
FlexDirection::Column, availableInnerWidth)
|
|
2098
|
-
.unwrap() -
|
|
1826
|
+
child->getLayout().measuredDimension(Dimension::Height) +
|
|
1827
|
+
child->style().computeMarginForAxis(
|
|
1828
|
+
FlexDirection::Column, availableInnerWidth) -
|
|
2099
1829
|
ascent;
|
|
2100
1830
|
maxAscentForCurrentLine =
|
|
2101
1831
|
yoga::maxOrDefined(maxAscentForCurrentLine, ascent);
|
|
@@ -2107,33 +1837,32 @@ static void calculateLayoutImpl(
|
|
|
2107
1837
|
}
|
|
2108
1838
|
}
|
|
2109
1839
|
endIndex = ii;
|
|
2110
|
-
lineHeight += crossDimLead;
|
|
2111
1840
|
currentLead += i != 0 ? crossAxisGap : 0;
|
|
2112
1841
|
|
|
2113
1842
|
if (performLayout) {
|
|
2114
1843
|
for (ii = startIndex; ii < endIndex; ii++) {
|
|
2115
1844
|
const auto child = node->getChild(ii);
|
|
2116
|
-
if (child->
|
|
1845
|
+
if (child->style().display() == Display::None) {
|
|
2117
1846
|
continue;
|
|
2118
1847
|
}
|
|
2119
|
-
if (child->
|
|
1848
|
+
if (child->style().positionType() != PositionType::Absolute) {
|
|
2120
1849
|
switch (resolveChildAlignment(node, child)) {
|
|
2121
1850
|
case Align::FlexStart: {
|
|
2122
1851
|
child->setLayoutPosition(
|
|
2123
1852
|
currentLead +
|
|
2124
|
-
child->
|
|
2125
|
-
|
|
2126
|
-
|
|
1853
|
+
child->style().computeFlexStartPosition(
|
|
1854
|
+
crossAxis, direction, availableInnerWidth),
|
|
1855
|
+
flexStartEdge(crossAxis));
|
|
2127
1856
|
break;
|
|
2128
1857
|
}
|
|
2129
1858
|
case Align::FlexEnd: {
|
|
2130
1859
|
child->setLayoutPosition(
|
|
2131
1860
|
currentLead + lineHeight -
|
|
2132
|
-
child->
|
|
2133
|
-
|
|
1861
|
+
child->style().computeFlexEndMargin(
|
|
1862
|
+
crossAxis, direction, availableInnerWidth) -
|
|
2134
1863
|
child->getLayout().measuredDimension(
|
|
2135
1864
|
dimension(crossAxis)),
|
|
2136
|
-
|
|
1865
|
+
flexStartEdge(crossAxis));
|
|
2137
1866
|
break;
|
|
2138
1867
|
}
|
|
2139
1868
|
case Align::Center: {
|
|
@@ -2142,49 +1871,49 @@ static void calculateLayoutImpl(
|
|
|
2142
1871
|
|
|
2143
1872
|
child->setLayoutPosition(
|
|
2144
1873
|
currentLead + (lineHeight - childHeight) / 2,
|
|
2145
|
-
|
|
1874
|
+
flexStartEdge(crossAxis));
|
|
2146
1875
|
break;
|
|
2147
1876
|
}
|
|
2148
1877
|
case Align::Stretch: {
|
|
2149
1878
|
child->setLayoutPosition(
|
|
2150
1879
|
currentLead +
|
|
2151
|
-
child->
|
|
2152
|
-
|
|
2153
|
-
|
|
1880
|
+
child->style().computeFlexStartMargin(
|
|
1881
|
+
crossAxis, direction, availableInnerWidth),
|
|
1882
|
+
flexStartEdge(crossAxis));
|
|
2154
1883
|
|
|
2155
1884
|
// Remeasure child with the line height as it as been only
|
|
2156
1885
|
// measured with the owners height yet.
|
|
2157
|
-
if (!
|
|
2158
|
-
|
|
1886
|
+
if (!child->hasDefiniteLength(
|
|
1887
|
+
dimension(crossAxis), availableInnerCrossDim)) {
|
|
2159
1888
|
const float childWidth = isMainAxisRow
|
|
2160
1889
|
? (child->getLayout().measuredDimension(
|
|
2161
|
-
|
|
2162
|
-
child->
|
|
2163
|
-
|
|
2164
|
-
: lineHeight;
|
|
1890
|
+
Dimension::Width) +
|
|
1891
|
+
child->style().computeMarginForAxis(
|
|
1892
|
+
mainAxis, availableInnerWidth))
|
|
1893
|
+
: leadPerLine + lineHeight;
|
|
2165
1894
|
|
|
2166
1895
|
const float childHeight = !isMainAxisRow
|
|
2167
1896
|
? (child->getLayout().measuredDimension(
|
|
2168
|
-
|
|
2169
|
-
child->
|
|
2170
|
-
|
|
2171
|
-
: lineHeight;
|
|
1897
|
+
Dimension::Height) +
|
|
1898
|
+
child->style().computeMarginForAxis(
|
|
1899
|
+
crossAxis, availableInnerWidth))
|
|
1900
|
+
: leadPerLine + lineHeight;
|
|
2172
1901
|
|
|
2173
1902
|
if (!(yoga::inexactEquals(
|
|
2174
1903
|
childWidth,
|
|
2175
1904
|
child->getLayout().measuredDimension(
|
|
2176
|
-
|
|
1905
|
+
Dimension::Width)) &&
|
|
2177
1906
|
yoga::inexactEquals(
|
|
2178
1907
|
childHeight,
|
|
2179
1908
|
child->getLayout().measuredDimension(
|
|
2180
|
-
|
|
1909
|
+
Dimension::Height)))) {
|
|
2181
1910
|
calculateLayoutInternal(
|
|
2182
1911
|
child,
|
|
2183
1912
|
childWidth,
|
|
2184
1913
|
childHeight,
|
|
2185
1914
|
direction,
|
|
2186
|
-
|
|
2187
|
-
|
|
1915
|
+
SizingMode::StretchFit,
|
|
1916
|
+
SizingMode::StretchFit,
|
|
2188
1917
|
availableInnerWidth,
|
|
2189
1918
|
availableInnerHeight,
|
|
2190
1919
|
true,
|
|
@@ -2200,23 +1929,24 @@ static void calculateLayoutImpl(
|
|
|
2200
1929
|
child->setLayoutPosition(
|
|
2201
1930
|
currentLead + maxAscentForCurrentLine -
|
|
2202
1931
|
calculateBaseline(child) +
|
|
2203
|
-
child
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
1932
|
+
child->style().computeFlexStartPosition(
|
|
1933
|
+
FlexDirection::Column,
|
|
1934
|
+
direction,
|
|
1935
|
+
availableInnerCrossDim),
|
|
1936
|
+
PhysicalEdge::Top);
|
|
2208
1937
|
|
|
2209
1938
|
break;
|
|
2210
1939
|
}
|
|
2211
1940
|
case Align::Auto:
|
|
2212
1941
|
case Align::SpaceBetween:
|
|
2213
1942
|
case Align::SpaceAround:
|
|
1943
|
+
case Align::SpaceEvenly:
|
|
2214
1944
|
break;
|
|
2215
1945
|
}
|
|
2216
1946
|
}
|
|
2217
1947
|
}
|
|
2218
1948
|
}
|
|
2219
|
-
currentLead
|
|
1949
|
+
currentLead = currentLead + leadPerLine + lineHeight;
|
|
2220
1950
|
}
|
|
2221
1951
|
}
|
|
2222
1952
|
|
|
@@ -2229,7 +1959,7 @@ static void calculateLayoutImpl(
|
|
|
2229
1959
|
availableWidth - marginAxisRow,
|
|
2230
1960
|
ownerWidth,
|
|
2231
1961
|
ownerWidth),
|
|
2232
|
-
|
|
1962
|
+
Dimension::Width);
|
|
2233
1963
|
|
|
2234
1964
|
node->setLayoutMeasuredDimension(
|
|
2235
1965
|
boundAxis(
|
|
@@ -2238,13 +1968,13 @@ static void calculateLayoutImpl(
|
|
|
2238
1968
|
availableHeight - marginAxisColumn,
|
|
2239
1969
|
ownerHeight,
|
|
2240
1970
|
ownerWidth),
|
|
2241
|
-
|
|
1971
|
+
Dimension::Height);
|
|
2242
1972
|
|
|
2243
1973
|
// If the user didn't specify a width or height for the node, set the
|
|
2244
1974
|
// dimensions based on the children.
|
|
2245
|
-
if (
|
|
2246
|
-
(node->
|
|
2247
|
-
|
|
1975
|
+
if (sizingModeMainDim == SizingMode::MaxContent ||
|
|
1976
|
+
(node->style().overflow() != Overflow::Scroll &&
|
|
1977
|
+
sizingModeMainDim == SizingMode::FitContent)) {
|
|
2248
1978
|
// Clamp the size to the min/max size, if specified, and make sure it
|
|
2249
1979
|
// doesn't go below the padding and border amount.
|
|
2250
1980
|
node->setLayoutMeasuredDimension(
|
|
@@ -2253,8 +1983,8 @@ static void calculateLayoutImpl(
|
|
|
2253
1983
|
dimension(mainAxis));
|
|
2254
1984
|
|
|
2255
1985
|
} else if (
|
|
2256
|
-
|
|
2257
|
-
node->
|
|
1986
|
+
sizingModeMainDim == SizingMode::FitContent &&
|
|
1987
|
+
node->style().overflow() == Overflow::Scroll) {
|
|
2258
1988
|
node->setLayoutMeasuredDimension(
|
|
2259
1989
|
yoga::maxOrDefined(
|
|
2260
1990
|
yoga::minOrDefined(
|
|
@@ -2269,9 +1999,9 @@ static void calculateLayoutImpl(
|
|
|
2269
1999
|
dimension(mainAxis));
|
|
2270
2000
|
}
|
|
2271
2001
|
|
|
2272
|
-
if (
|
|
2273
|
-
(node->
|
|
2274
|
-
|
|
2002
|
+
if (sizingModeCrossDim == SizingMode::MaxContent ||
|
|
2003
|
+
(node->style().overflow() != Overflow::Scroll &&
|
|
2004
|
+
sizingModeCrossDim == SizingMode::FitContent)) {
|
|
2275
2005
|
// Clamp the size to the min/max size, if specified, and make sure it
|
|
2276
2006
|
// doesn't go below the padding and border amount.
|
|
2277
2007
|
node->setLayoutMeasuredDimension(
|
|
@@ -2284,8 +2014,8 @@ static void calculateLayoutImpl(
|
|
|
2284
2014
|
dimension(crossAxis));
|
|
2285
2015
|
|
|
2286
2016
|
} else if (
|
|
2287
|
-
|
|
2288
|
-
node->
|
|
2017
|
+
sizingModeCrossDim == SizingMode::FitContent &&
|
|
2018
|
+
node->style().overflow() == Overflow::Scroll) {
|
|
2289
2019
|
node->setLayoutMeasuredDimension(
|
|
2290
2020
|
yoga::maxOrDefined(
|
|
2291
2021
|
yoga::minOrDefined(
|
|
@@ -2303,57 +2033,51 @@ static void calculateLayoutImpl(
|
|
|
2303
2033
|
|
|
2304
2034
|
// As we only wrapped in normal direction yet, we need to reverse the
|
|
2305
2035
|
// positions on wrap-reverse.
|
|
2306
|
-
if (performLayout && node->
|
|
2036
|
+
if (performLayout && node->style().flexWrap() == Wrap::WrapReverse) {
|
|
2307
2037
|
for (size_t i = 0; i < childCount; i++) {
|
|
2308
2038
|
const auto child = node->getChild(i);
|
|
2309
|
-
if (child->
|
|
2039
|
+
if (child->style().positionType() != PositionType::Absolute) {
|
|
2310
2040
|
child->setLayoutPosition(
|
|
2311
2041
|
node->getLayout().measuredDimension(dimension(crossAxis)) -
|
|
2312
|
-
child->getLayout().position
|
|
2042
|
+
child->getLayout().position(flexStartEdge(crossAxis)) -
|
|
2313
2043
|
child->getLayout().measuredDimension(dimension(crossAxis)),
|
|
2314
|
-
|
|
2044
|
+
flexStartEdge(crossAxis));
|
|
2315
2045
|
}
|
|
2316
2046
|
}
|
|
2317
2047
|
}
|
|
2318
2048
|
|
|
2319
2049
|
if (performLayout) {
|
|
2320
2050
|
// STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
const bool absolutePercentageAgainstPaddingEdge =
|
|
2327
|
-
node->getConfig()->isExperimentalFeatureEnabled(
|
|
2328
|
-
ExperimentalFeature::AbsolutePercentageAgainstPaddingEdge);
|
|
2329
|
-
|
|
2330
|
-
layoutAbsoluteChild(
|
|
2051
|
+
// Let the containing block layout its absolute descendants. By definition
|
|
2052
|
+
// the containing block will not be static unless we are at the root.
|
|
2053
|
+
if (node->style().positionType() != PositionType::Static ||
|
|
2054
|
+
node->alwaysFormsContainingBlock() || depth == 1) {
|
|
2055
|
+
layoutAbsoluteDescendants(
|
|
2331
2056
|
node,
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
? node->getLayout().measuredDimension(YGDimensionWidth)
|
|
2335
|
-
: availableInnerWidth,
|
|
2336
|
-
isMainAxisRow ? measureModeMainDim : measureModeCrossDim,
|
|
2337
|
-
absolutePercentageAgainstPaddingEdge
|
|
2338
|
-
? node->getLayout().measuredDimension(YGDimensionHeight)
|
|
2339
|
-
: availableInnerHeight,
|
|
2057
|
+
node,
|
|
2058
|
+
isMainAxisRow ? sizingModeMainDim : sizingModeCrossDim,
|
|
2340
2059
|
direction,
|
|
2341
2060
|
layoutMarkerData,
|
|
2342
2061
|
depth,
|
|
2343
|
-
generationCount
|
|
2062
|
+
generationCount,
|
|
2063
|
+
0.0f,
|
|
2064
|
+
0.0f,
|
|
2065
|
+
availableInnerWidth,
|
|
2066
|
+
availableInnerHeight);
|
|
2344
2067
|
}
|
|
2345
2068
|
|
|
2346
2069
|
// STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN
|
|
2347
|
-
const bool needsMainTrailingPos = mainAxis
|
|
2348
|
-
|
|
2349
|
-
const bool needsCrossTrailingPos = crossAxis == FlexDirection::RowReverse ||
|
|
2350
|
-
crossAxis == FlexDirection::ColumnReverse;
|
|
2070
|
+
const bool needsMainTrailingPos = needsTrailingPosition(mainAxis);
|
|
2071
|
+
const bool needsCrossTrailingPos = needsTrailingPosition(crossAxis);
|
|
2351
2072
|
|
|
2352
|
-
// Set trailing position if necessary.
|
|
2353
2073
|
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
|
2354
2074
|
for (size_t i = 0; i < childCount; i++) {
|
|
2355
2075
|
const auto child = node->getChild(i);
|
|
2356
|
-
|
|
2076
|
+
// Absolute children will be handled by their containing block since we
|
|
2077
|
+
// cannot guarantee that their positions are set when their parents are
|
|
2078
|
+
// done with layout.
|
|
2079
|
+
if (child->style().display() == Display::None ||
|
|
2080
|
+
child->style().positionType() == PositionType::Absolute) {
|
|
2357
2081
|
continue;
|
|
2358
2082
|
}
|
|
2359
2083
|
if (needsMainTrailingPos) {
|
|
@@ -2368,35 +2092,6 @@ static void calculateLayoutImpl(
|
|
|
2368
2092
|
}
|
|
2369
2093
|
}
|
|
2370
2094
|
|
|
2371
|
-
bool gPrintChanges = false;
|
|
2372
|
-
bool gPrintSkips = false;
|
|
2373
|
-
|
|
2374
|
-
static const char* spacer =
|
|
2375
|
-
" ";
|
|
2376
|
-
|
|
2377
|
-
static const char* spacerWithLength(const unsigned long level) {
|
|
2378
|
-
const size_t spacerLen = strlen(spacer);
|
|
2379
|
-
if (level > spacerLen) {
|
|
2380
|
-
return &spacer[0];
|
|
2381
|
-
} else {
|
|
2382
|
-
return &spacer[spacerLen - level];
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
static const char* measureModeName(
|
|
2387
|
-
const MeasureMode mode,
|
|
2388
|
-
const bool performLayout) {
|
|
2389
|
-
switch (mode) {
|
|
2390
|
-
case MeasureMode::Undefined:
|
|
2391
|
-
return performLayout ? "LAY_UNDEFINED" : "UNDEFINED";
|
|
2392
|
-
case MeasureMode::Exactly:
|
|
2393
|
-
return performLayout ? "LAY_EXACTLY" : "EXACTLY";
|
|
2394
|
-
case MeasureMode::AtMost:
|
|
2395
|
-
return performLayout ? "LAY_AT_MOST" : "AT_MOST";
|
|
2396
|
-
}
|
|
2397
|
-
return "";
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
2095
|
//
|
|
2401
2096
|
// This is a wrapper around the calculateLayoutImpl function. It determines
|
|
2402
2097
|
// whether the layout request is redundant and can be skipped.
|
|
@@ -2410,8 +2105,8 @@ bool calculateLayoutInternal(
|
|
|
2410
2105
|
const float availableWidth,
|
|
2411
2106
|
const float availableHeight,
|
|
2412
2107
|
const Direction ownerDirection,
|
|
2413
|
-
const
|
|
2414
|
-
const
|
|
2108
|
+
const SizingMode widthSizingMode,
|
|
2109
|
+
const SizingMode heightSizingMode,
|
|
2415
2110
|
const float ownerWidth,
|
|
2416
2111
|
const float ownerHeight,
|
|
2417
2112
|
const bool performLayout,
|
|
@@ -2432,8 +2127,8 @@ bool calculateLayoutInternal(
|
|
|
2432
2127
|
layout->nextCachedMeasurementsIndex = 0;
|
|
2433
2128
|
layout->cachedLayout.availableWidth = -1;
|
|
2434
2129
|
layout->cachedLayout.availableHeight = -1;
|
|
2435
|
-
layout->cachedLayout.
|
|
2436
|
-
layout->cachedLayout.
|
|
2130
|
+
layout->cachedLayout.widthSizingMode = SizingMode::MaxContent;
|
|
2131
|
+
layout->cachedLayout.heightSizingMode = SizingMode::MaxContent;
|
|
2437
2132
|
layout->cachedLayout.computedWidth = -1;
|
|
2438
2133
|
layout->cachedLayout.computedHeight = -1;
|
|
2439
2134
|
}
|
|
@@ -2450,19 +2145,19 @@ bool calculateLayoutInternal(
|
|
|
2450
2145
|
// measurements if at all possible.
|
|
2451
2146
|
if (node->hasMeasureFunc()) {
|
|
2452
2147
|
const float marginAxisRow =
|
|
2453
|
-
node->
|
|
2148
|
+
node->style().computeMarginForAxis(FlexDirection::Row, ownerWidth);
|
|
2454
2149
|
const float marginAxisColumn =
|
|
2455
|
-
node->
|
|
2150
|
+
node->style().computeMarginForAxis(FlexDirection::Column, ownerWidth);
|
|
2456
2151
|
|
|
2457
2152
|
// First, try to use the layout cache.
|
|
2458
2153
|
if (canUseCachedMeasurement(
|
|
2459
|
-
|
|
2154
|
+
widthSizingMode,
|
|
2460
2155
|
availableWidth,
|
|
2461
|
-
|
|
2156
|
+
heightSizingMode,
|
|
2462
2157
|
availableHeight,
|
|
2463
|
-
layout->cachedLayout.
|
|
2158
|
+
layout->cachedLayout.widthSizingMode,
|
|
2464
2159
|
layout->cachedLayout.availableWidth,
|
|
2465
|
-
layout->cachedLayout.
|
|
2160
|
+
layout->cachedLayout.heightSizingMode,
|
|
2466
2161
|
layout->cachedLayout.availableHeight,
|
|
2467
2162
|
layout->cachedLayout.computedWidth,
|
|
2468
2163
|
layout->cachedLayout.computedHeight,
|
|
@@ -2474,13 +2169,13 @@ bool calculateLayoutInternal(
|
|
|
2474
2169
|
// Try to use the measurement cache.
|
|
2475
2170
|
for (size_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
|
|
2476
2171
|
if (canUseCachedMeasurement(
|
|
2477
|
-
|
|
2172
|
+
widthSizingMode,
|
|
2478
2173
|
availableWidth,
|
|
2479
|
-
|
|
2174
|
+
heightSizingMode,
|
|
2480
2175
|
availableHeight,
|
|
2481
|
-
layout->cachedMeasurements[i].
|
|
2176
|
+
layout->cachedMeasurements[i].widthSizingMode,
|
|
2482
2177
|
layout->cachedMeasurements[i].availableWidth,
|
|
2483
|
-
layout->cachedMeasurements[i].
|
|
2178
|
+
layout->cachedMeasurements[i].heightSizingMode,
|
|
2484
2179
|
layout->cachedMeasurements[i].availableHeight,
|
|
2485
2180
|
layout->cachedMeasurements[i].computedWidth,
|
|
2486
2181
|
layout->cachedMeasurements[i].computedHeight,
|
|
@@ -2497,8 +2192,8 @@ bool calculateLayoutInternal(
|
|
|
2497
2192
|
layout->cachedLayout.availableWidth, availableWidth) &&
|
|
2498
2193
|
yoga::inexactEquals(
|
|
2499
2194
|
layout->cachedLayout.availableHeight, availableHeight) &&
|
|
2500
|
-
layout->cachedLayout.
|
|
2501
|
-
layout->cachedLayout.
|
|
2195
|
+
layout->cachedLayout.widthSizingMode == widthSizingMode &&
|
|
2196
|
+
layout->cachedLayout.heightSizingMode == heightSizingMode) {
|
|
2502
2197
|
cachedResults = &layout->cachedLayout;
|
|
2503
2198
|
}
|
|
2504
2199
|
} else {
|
|
@@ -2507,9 +2202,8 @@ bool calculateLayoutInternal(
|
|
|
2507
2202
|
layout->cachedMeasurements[i].availableWidth, availableWidth) &&
|
|
2508
2203
|
yoga::inexactEquals(
|
|
2509
2204
|
layout->cachedMeasurements[i].availableHeight, availableHeight) &&
|
|
2510
|
-
layout->cachedMeasurements[i].
|
|
2511
|
-
layout->cachedMeasurements[i].
|
|
2512
|
-
heightMeasureMode) {
|
|
2205
|
+
layout->cachedMeasurements[i].widthSizingMode == widthSizingMode &&
|
|
2206
|
+
layout->cachedMeasurements[i].heightSizingMode == heightSizingMode) {
|
|
2513
2207
|
cachedResults = &layout->cachedMeasurements[i];
|
|
2514
2208
|
break;
|
|
2515
2209
|
}
|
|
@@ -2518,61 +2212,20 @@ bool calculateLayoutInternal(
|
|
|
2518
2212
|
|
|
2519
2213
|
if (!needToVisitNode && cachedResults != nullptr) {
|
|
2520
2214
|
layout->setMeasuredDimension(
|
|
2521
|
-
|
|
2215
|
+
Dimension::Width, cachedResults->computedWidth);
|
|
2522
2216
|
layout->setMeasuredDimension(
|
|
2523
|
-
|
|
2217
|
+
Dimension::Height, cachedResults->computedHeight);
|
|
2524
2218
|
|
|
2525
2219
|
(performLayout ? layoutMarkerData.cachedLayouts
|
|
2526
2220
|
: layoutMarkerData.cachedMeasures) += 1;
|
|
2527
|
-
|
|
2528
|
-
if (gPrintChanges && gPrintSkips) {
|
|
2529
|
-
yoga::log(
|
|
2530
|
-
node,
|
|
2531
|
-
LogLevel::Verbose,
|
|
2532
|
-
"%s%d.{[skipped] ",
|
|
2533
|
-
spacerWithLength(depth),
|
|
2534
|
-
depth);
|
|
2535
|
-
node->print();
|
|
2536
|
-
yoga::log(
|
|
2537
|
-
node,
|
|
2538
|
-
LogLevel::Verbose,
|
|
2539
|
-
"wm: %s, hm: %s, aw: %f ah: %f => d: (%f, %f) %s\n",
|
|
2540
|
-
measureModeName(widthMeasureMode, performLayout),
|
|
2541
|
-
measureModeName(heightMeasureMode, performLayout),
|
|
2542
|
-
availableWidth,
|
|
2543
|
-
availableHeight,
|
|
2544
|
-
cachedResults->computedWidth,
|
|
2545
|
-
cachedResults->computedHeight,
|
|
2546
|
-
LayoutPassReasonToString(reason));
|
|
2547
|
-
}
|
|
2548
2221
|
} else {
|
|
2549
|
-
if (gPrintChanges) {
|
|
2550
|
-
yoga::log(
|
|
2551
|
-
node,
|
|
2552
|
-
LogLevel::Verbose,
|
|
2553
|
-
"%s%d.{%s",
|
|
2554
|
-
spacerWithLength(depth),
|
|
2555
|
-
depth,
|
|
2556
|
-
needToVisitNode ? "*" : "");
|
|
2557
|
-
node->print();
|
|
2558
|
-
yoga::log(
|
|
2559
|
-
node,
|
|
2560
|
-
LogLevel::Verbose,
|
|
2561
|
-
"wm: %s, hm: %s, aw: %f ah: %f %s\n",
|
|
2562
|
-
measureModeName(widthMeasureMode, performLayout),
|
|
2563
|
-
measureModeName(heightMeasureMode, performLayout),
|
|
2564
|
-
availableWidth,
|
|
2565
|
-
availableHeight,
|
|
2566
|
-
LayoutPassReasonToString(reason));
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
2222
|
calculateLayoutImpl(
|
|
2570
2223
|
node,
|
|
2571
2224
|
availableWidth,
|
|
2572
2225
|
availableHeight,
|
|
2573
2226
|
ownerDirection,
|
|
2574
|
-
|
|
2575
|
-
|
|
2227
|
+
widthSizingMode,
|
|
2228
|
+
heightSizingMode,
|
|
2576
2229
|
ownerWidth,
|
|
2577
2230
|
ownerHeight,
|
|
2578
2231
|
performLayout,
|
|
@@ -2581,26 +2234,6 @@ bool calculateLayoutInternal(
|
|
|
2581
2234
|
generationCount,
|
|
2582
2235
|
reason);
|
|
2583
2236
|
|
|
2584
|
-
if (gPrintChanges) {
|
|
2585
|
-
yoga::log(
|
|
2586
|
-
node,
|
|
2587
|
-
LogLevel::Verbose,
|
|
2588
|
-
"%s%d.}%s",
|
|
2589
|
-
spacerWithLength(depth),
|
|
2590
|
-
depth,
|
|
2591
|
-
needToVisitNode ? "*" : "");
|
|
2592
|
-
node->print();
|
|
2593
|
-
yoga::log(
|
|
2594
|
-
node,
|
|
2595
|
-
LogLevel::Verbose,
|
|
2596
|
-
"wm: %s, hm: %s, d: (%f, %f) %s\n",
|
|
2597
|
-
measureModeName(widthMeasureMode, performLayout),
|
|
2598
|
-
measureModeName(heightMeasureMode, performLayout),
|
|
2599
|
-
layout->measuredDimension(YGDimensionWidth),
|
|
2600
|
-
layout->measuredDimension(YGDimensionHeight),
|
|
2601
|
-
LayoutPassReasonToString(reason));
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
2237
|
layout->lastOwnerDirection = ownerDirection;
|
|
2605
2238
|
|
|
2606
2239
|
if (cachedResults == nullptr) {
|
|
@@ -2610,9 +2243,6 @@ bool calculateLayoutInternal(
|
|
|
2610
2243
|
|
|
2611
2244
|
if (layout->nextCachedMeasurementsIndex ==
|
|
2612
2245
|
LayoutResults::MaxCachedMeasurements) {
|
|
2613
|
-
if (gPrintChanges) {
|
|
2614
|
-
yoga::log(node, LogLevel::Verbose, "Out of cache entries!\n");
|
|
2615
|
-
}
|
|
2616
2246
|
layout->nextCachedMeasurementsIndex = 0;
|
|
2617
2247
|
}
|
|
2618
2248
|
|
|
@@ -2629,22 +2259,22 @@ bool calculateLayoutInternal(
|
|
|
2629
2259
|
|
|
2630
2260
|
newCacheEntry->availableWidth = availableWidth;
|
|
2631
2261
|
newCacheEntry->availableHeight = availableHeight;
|
|
2632
|
-
newCacheEntry->
|
|
2633
|
-
newCacheEntry->
|
|
2262
|
+
newCacheEntry->widthSizingMode = widthSizingMode;
|
|
2263
|
+
newCacheEntry->heightSizingMode = heightSizingMode;
|
|
2634
2264
|
newCacheEntry->computedWidth =
|
|
2635
|
-
layout->measuredDimension(
|
|
2265
|
+
layout->measuredDimension(Dimension::Width);
|
|
2636
2266
|
newCacheEntry->computedHeight =
|
|
2637
|
-
layout->measuredDimension(
|
|
2267
|
+
layout->measuredDimension(Dimension::Height);
|
|
2638
2268
|
}
|
|
2639
2269
|
}
|
|
2640
2270
|
|
|
2641
2271
|
if (performLayout) {
|
|
2642
2272
|
node->setLayoutDimension(
|
|
2643
|
-
node->getLayout().measuredDimension(
|
|
2644
|
-
|
|
2273
|
+
node->getLayout().measuredDimension(Dimension::Width),
|
|
2274
|
+
Dimension::Width);
|
|
2645
2275
|
node->setLayoutDimension(
|
|
2646
|
-
node->getLayout().measuredDimension(
|
|
2647
|
-
|
|
2276
|
+
node->getLayout().measuredDimension(Dimension::Height),
|
|
2277
|
+
Dimension::Height);
|
|
2648
2278
|
|
|
2649
2279
|
node->setHasNewLayout(true);
|
|
2650
2280
|
node->setDirty(false);
|
|
@@ -2680,55 +2310,53 @@ void calculateLayout(
|
|
|
2680
2310
|
gCurrentGenerationCount.fetch_add(1, std::memory_order_relaxed);
|
|
2681
2311
|
node->resolveDimension();
|
|
2682
2312
|
float width = YGUndefined;
|
|
2683
|
-
|
|
2684
|
-
const auto& style = node->
|
|
2685
|
-
if (
|
|
2686
|
-
width =
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
} else if (
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
width =
|
|
2696
|
-
|
|
2697
|
-
widthMeasureMode = MeasureMode::AtMost;
|
|
2313
|
+
SizingMode widthSizingMode = SizingMode::MaxContent;
|
|
2314
|
+
const auto& style = node->style();
|
|
2315
|
+
if (node->hasDefiniteLength(Dimension::Width, ownerWidth)) {
|
|
2316
|
+
width =
|
|
2317
|
+
(node->getResolvedDimension(dimension(FlexDirection::Row))
|
|
2318
|
+
.resolve(ownerWidth)
|
|
2319
|
+
.unwrap() +
|
|
2320
|
+
node->style().computeMarginForAxis(FlexDirection::Row, ownerWidth));
|
|
2321
|
+
widthSizingMode = SizingMode::StretchFit;
|
|
2322
|
+
} else if (style.maxDimension(Dimension::Width)
|
|
2323
|
+
.resolve(ownerWidth)
|
|
2324
|
+
.isDefined()) {
|
|
2325
|
+
width = style.maxDimension(Dimension::Width).resolve(ownerWidth).unwrap();
|
|
2326
|
+
widthSizingMode = SizingMode::FitContent;
|
|
2698
2327
|
} else {
|
|
2699
2328
|
width = ownerWidth;
|
|
2700
|
-
|
|
2701
|
-
|
|
2329
|
+
widthSizingMode = yoga::isUndefined(width) ? SizingMode::MaxContent
|
|
2330
|
+
: SizingMode::StretchFit;
|
|
2702
2331
|
}
|
|
2703
2332
|
|
|
2704
2333
|
float height = YGUndefined;
|
|
2705
|
-
|
|
2706
|
-
if (
|
|
2707
|
-
height =
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
} else if (
|
|
2714
|
-
|
|
2715
|
-
|
|
2334
|
+
SizingMode heightSizingMode = SizingMode::MaxContent;
|
|
2335
|
+
if (node->hasDefiniteLength(Dimension::Height, ownerHeight)) {
|
|
2336
|
+
height =
|
|
2337
|
+
(node->getResolvedDimension(dimension(FlexDirection::Column))
|
|
2338
|
+
.resolve(ownerHeight)
|
|
2339
|
+
.unwrap() +
|
|
2340
|
+
node->style().computeMarginForAxis(FlexDirection::Column, ownerWidth));
|
|
2341
|
+
heightSizingMode = SizingMode::StretchFit;
|
|
2342
|
+
} else if (style.maxDimension(Dimension::Height)
|
|
2343
|
+
.resolve(ownerHeight)
|
|
2344
|
+
.isDefined()) {
|
|
2716
2345
|
height =
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
heightMeasureMode = MeasureMode::AtMost;
|
|
2346
|
+
style.maxDimension(Dimension::Height).resolve(ownerHeight).unwrap();
|
|
2347
|
+
heightSizingMode = SizingMode::FitContent;
|
|
2720
2348
|
} else {
|
|
2721
2349
|
height = ownerHeight;
|
|
2722
|
-
|
|
2723
|
-
|
|
2350
|
+
heightSizingMode = yoga::isUndefined(height) ? SizingMode::MaxContent
|
|
2351
|
+
: SizingMode::StretchFit;
|
|
2724
2352
|
}
|
|
2725
2353
|
if (calculateLayoutInternal(
|
|
2726
2354
|
node,
|
|
2727
2355
|
width,
|
|
2728
2356
|
height,
|
|
2729
2357
|
ownerDirection,
|
|
2730
|
-
|
|
2731
|
-
|
|
2358
|
+
widthSizingMode,
|
|
2359
|
+
heightSizingMode,
|
|
2732
2360
|
ownerWidth,
|
|
2733
2361
|
ownerHeight,
|
|
2734
2362
|
true,
|
|
@@ -2739,14 +2367,6 @@ void calculateLayout(
|
|
|
2739
2367
|
node->setPosition(
|
|
2740
2368
|
node->getLayout().direction(), ownerWidth, ownerHeight, ownerWidth);
|
|
2741
2369
|
roundLayoutResultsToPixelGrid(node, 0.0f, 0.0f);
|
|
2742
|
-
|
|
2743
|
-
#ifdef DEBUG
|
|
2744
|
-
if (node->getConfig()->shouldPrintTree()) {
|
|
2745
|
-
yoga::print(
|
|
2746
|
-
node,
|
|
2747
|
-
PrintOptions::Layout | PrintOptions::Children | PrintOptions::Style);
|
|
2748
|
-
}
|
|
2749
|
-
#endif
|
|
2750
2370
|
}
|
|
2751
2371
|
|
|
2752
2372
|
Event::publish<Event::LayoutPassEnd>(node, {&markerData});
|