diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..919434a6
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/Example/cocoapods/FlexLayoutSample.xcodeproj/project.pbxproj b/Example/cocoapods/FlexLayoutSample.xcodeproj/project.pbxproj
index eb834b8a..ca6c764f 100644
--- a/Example/cocoapods/FlexLayoutSample.xcodeproj/project.pbxproj
+++ b/Example/cocoapods/FlexLayoutSample.xcodeproj/project.pbxproj
@@ -449,11 +449,13 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FlexLayoutSample/Pods-FlexLayoutSample-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/FlexLayout/FlexLayout.framework",
"${BUILT_PRODUCTS_DIR}/PinLayout/PinLayout.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FlexLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PinLayout.framework",
);
@@ -475,7 +477,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "Pods/SwiftLint/swiftlint ../FlexLayoutSample\n";
+ shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\" --path ../FlexLayoutSample\n";
};
/* End PBXShellScriptBuildPhase section */
diff --git a/Example/cocoapods/Podfile b/Example/cocoapods/Podfile
deleted file mode 100644
index 038ea15f..00000000
--- a/Example/cocoapods/Podfile
+++ /dev/null
@@ -1,15 +0,0 @@
-source 'https://cdn.cocoapods.org/'
-use_frameworks!
-platform :ios, '12.0'
-
-workspace 'FlexLayoutSample.xcworkspace'
-
-target 'FlexLayoutSample' do
- project 'FlexLayoutSample.xcodeproj'
-
- pod 'FlexLayout', path: '../..'
- pod 'PinLayout'
-
- # Debug only
- pod 'SwiftLint'
-end
diff --git a/Example/cocoapods/Podfile.lock b/Example/cocoapods/Podfile.lock
deleted file mode 100644
index a409bac0..00000000
--- a/Example/cocoapods/Podfile.lock
+++ /dev/null
@@ -1,27 +0,0 @@
-PODS:
- - FlexLayout (2.0.04)
- - PinLayout (1.10.5)
- - SwiftLint (0.54.0)
-
-DEPENDENCIES:
- - FlexLayout (from `../..`)
- - PinLayout
- - SwiftLint
-
-SPEC REPOS:
- trunk:
- - PinLayout
- - SwiftLint
-
-EXTERNAL SOURCES:
- FlexLayout:
- :path: "../.."
-
-SPEC CHECKSUMS:
- FlexLayout: 222177b4cd0c7e57b662ba05314a64c122958dac
- PinLayout: f6c2b63a5a5b24864064e1d15c67de41b4e74748
- SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
-
-PODFILE CHECKSUM: acd6f8f55e169593da8f5d86c0f788512ba67886
-
-COCOAPODS: 1.14.3
diff --git a/FlexLayout.podspec b/FlexLayout.podspec
index bcdc7872..1b7dccf3 100644
--- a/FlexLayout.podspec
+++ b/FlexLayout.podspec
@@ -10,7 +10,7 @@ Pod::Spec.new do |spec|
spec.platform = :ios, "12.0"
spec.source = { :git => "https://github.com/lucdion/FlexLayout.git", :tag => "#{spec.version}" }
spec.source_files = "Sources/**/*.{swift,h,m,mm,cpp,c}"
- spec.public_header_files = "Sources/yoga/include/yoga/*.h", "Sources/YogaKit/include/YogaKit/*.h"
+ spec.public_header_files = "Sources/YogaKit/include/YogaKit/*.h"
spec.libraries = 'c++'
# Should match yoga_defs.bzl + BUCK configuration
@@ -22,4 +22,6 @@ Pod::Spec.new do |spec|
'-std=c++20',
'-fPIC'
]
+
+ spec.dependency 'Yoga'
end
diff --git a/FlexLayout.xcodeproj/project.pbxproj b/FlexLayout.xcodeproj/project.pbxproj
index 3b327f47..ea500dfd 100644
--- a/FlexLayout.xcodeproj/project.pbxproj
+++ b/FlexLayout.xcodeproj/project.pbxproj
@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
1207ABCE834615F650234676 /* Pods_FlexLayoutTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F69C581A2C68BBBD1B64F21 /* Pods_FlexLayoutTests.framework */; };
24AE973E1FEAF30A00995987 /* FlexLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE972E1FEAF30A00995987 /* FlexLayout.swift */; };
- 24AE973F1FEAF30A00995987 /* FlexLayout+Enum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE97301FEAF30A00995987 /* FlexLayout+Enum.swift */; };
24AE97401FEAF30A00995987 /* FlexLayout+Private.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE97311FEAF30A00995987 /* FlexLayout+Private.swift */; };
24AE97411FEAF30A00995987 /* UIView+FlexLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE97321FEAF30A00995987 /* UIView+FlexLayout.swift */; };
24AE97421FEAF30A00995987 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE97331FEAF30A00995987 /* Percent.swift */; };
@@ -19,85 +18,14 @@
711F2EE92ACC727000DDDD67 /* FlexLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 711F2EE32ACC727000DDDD67 /* FlexLayoutTests.swift */; };
711F2EEA2ACC727000DDDD67 /* MarginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 711F2EE42ACC727000DDDD67 /* MarginTests.swift */; };
711F2EEB2ACC727000DDDD67 /* JustifyContentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 711F2EE52ACC727000DDDD67 /* JustifyContentTests.swift */; };
- 71332C262B794826000667C9 /* FlexLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 24AE97351FEAF30A00995987 /* FlexLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 71332C272B794935000667C9 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617F2ABEE4B600D5A2E0 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 71332C282B794935000667C9 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617E2ABEE4B600D5A2E0 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 71332C292B794935000667C9 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617D2ABEE4B600D5A2E0 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Public, ); }; };
715C61812ABEE4B600D5A2E0 /* UIView+Yoga.mm in Sources */ = {isa = PBXBuildFile; fileRef = 715C617A2ABEE4B600D5A2E0 /* UIView+Yoga.mm */; };
715C61852ABEE4B600D5A2E0 /* YGLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 715C61802ABEE4B600D5A2E0 /* YGLayout.mm */; };
- EF0E61302C1A811100DF30F6 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E32C1A811100DF30F6 /* YGConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61312C1A811100DF30F6 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E42C1A811100DF30F6 /* YGEnums.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61322C1A811100DF30F6 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E52C1A811100DF30F6 /* YGMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61332C1A811100DF30F6 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E62C1A811100DF30F6 /* YGNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61342C1A811100DF30F6 /* YGNodeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E72C1A811100DF30F6 /* YGNodeLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61352C1A811100DF30F6 /* YGNodeStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E82C1A811100DF30F6 /* YGNodeStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61362C1A811100DF30F6 /* YGPixelGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60E92C1A811100DF30F6 /* YGPixelGrid.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61372C1A811100DF30F6 /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60EA2C1A811100DF30F6 /* YGValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61382C1A811100DF30F6 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60EB2C1A811100DF30F6 /* Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
- EF0E61392C1A811100DF30F6 /* Algorithm_AbsoluteLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60EE2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.cpp */; };
- EF0E613A2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60EF2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.h */; };
- EF0E613B2C1A811100DF30F6 /* Algorithm_Align.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F02C1A811100DF30F6 /* Algorithm_Align.h */; };
- EF0E613C2C1A811100DF30F6 /* Algorithm_Baseline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60F12C1A811100DF30F6 /* Algorithm_Baseline.cpp */; };
- EF0E613D2C1A811100DF30F6 /* Algorithm_Baseline.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F22C1A811100DF30F6 /* Algorithm_Baseline.h */; };
- EF0E613E2C1A811100DF30F6 /* Algorithm_BoundAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F32C1A811100DF30F6 /* Algorithm_BoundAxis.h */; };
- EF0E613F2C1A811100DF30F6 /* Algorithm_Cache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60F42C1A811100DF30F6 /* Algorithm_Cache.cpp */; };
- EF0E61402C1A811100DF30F6 /* Algorithm_Cache.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F52C1A811100DF30F6 /* Algorithm_Cache.h */; };
- EF0E61412C1A811100DF30F6 /* Algorithm_CalculateLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60F62C1A811100DF30F6 /* Algorithm_CalculateLayout.cpp */; };
- EF0E61422C1A811100DF30F6 /* Algorithm_CalculateLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F72C1A811100DF30F6 /* Algorithm_CalculateLayout.h */; };
- EF0E61432C1A811100DF30F6 /* Algorithm_FlexDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60F82C1A811100DF30F6 /* Algorithm_FlexDirection.h */; };
- EF0E61442C1A811100DF30F6 /* Algorithm_FlexLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60F92C1A811100DF30F6 /* Algorithm_FlexLine.cpp */; };
- EF0E61452C1A811100DF30F6 /* Algorithm_FlexLine.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60FA2C1A811100DF30F6 /* Algorithm_FlexLine.h */; };
- EF0E61462C1A811100DF30F6 /* Algorithm_PixelGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E60FB2C1A811100DF30F6 /* Algorithm_PixelGrid.cpp */; };
- EF0E61472C1A811100DF30F6 /* Algorithm_PixelGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60FC2C1A811100DF30F6 /* Algorithm_PixelGrid.h */; };
- EF0E61482C1A811100DF30F6 /* Algorithm_SizingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60FD2C1A811100DF30F6 /* Algorithm_SizingMode.h */; };
- EF0E61492C1A811100DF30F6 /* Algorithm_TrailingPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E60FE2C1A811100DF30F6 /* Algorithm_TrailingPosition.h */; };
- EF0E614A2C1A811100DF30F6 /* CMakeLists.txt in Resources */ = {isa = PBXBuildFile; fileRef = EF0E60FF2C1A811100DF30F6 /* CMakeLists.txt */; };
- EF0E614B2C1A811100DF30F6 /* Config_Config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61002C1A811100DF30F6 /* Config_Config.cpp */; };
- EF0E614C2C1A811100DF30F6 /* Config_Config.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61012C1A811100DF30F6 /* Config_Config.h */; };
- EF0E614D2C1A811100DF30F6 /* Debug_AssertFatal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61022C1A811100DF30F6 /* Debug_AssertFatal.cpp */; };
- EF0E614E2C1A811100DF30F6 /* Debug_AssertFatal.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61032C1A811100DF30F6 /* Debug_AssertFatal.h */; };
- EF0E614F2C1A811100DF30F6 /* Debug_Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61042C1A811100DF30F6 /* Debug_Log.cpp */; };
- EF0E61502C1A811100DF30F6 /* Debug_Log.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61052C1A811100DF30F6 /* Debug_Log.h */; };
- EF0E61512C1A811100DF30F6 /* Enums_Align.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61062C1A811100DF30F6 /* Enums_Align.h */; };
- EF0E61522C1A811100DF30F6 /* Enums_Dimension.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61072C1A811100DF30F6 /* Enums_Dimension.h */; };
- EF0E61532C1A811100DF30F6 /* Enums_Direction.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61082C1A811100DF30F6 /* Enums_Direction.h */; };
- EF0E61542C1A811100DF30F6 /* Enums_Display.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61092C1A811100DF30F6 /* Enums_Display.h */; };
- EF0E61552C1A811100DF30F6 /* Enums_Edge.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610A2C1A811100DF30F6 /* Enums_Edge.h */; };
- EF0E61562C1A811100DF30F6 /* Enums_Errata.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610B2C1A811100DF30F6 /* Enums_Errata.h */; };
- EF0E61572C1A811100DF30F6 /* Enums_ExperimentalFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610C2C1A811100DF30F6 /* Enums_ExperimentalFeature.h */; };
- EF0E61582C1A811100DF30F6 /* Enums_FlexDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610D2C1A811100DF30F6 /* Enums_FlexDirection.h */; };
- EF0E61592C1A811100DF30F6 /* Enums_Gutter.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610E2C1A811100DF30F6 /* Enums_Gutter.h */; };
- EF0E615A2C1A811100DF30F6 /* Enums_Justify.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E610F2C1A811100DF30F6 /* Enums_Justify.h */; };
- EF0E615B2C1A811100DF30F6 /* Enums_LogLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61102C1A811100DF30F6 /* Enums_LogLevel.h */; };
- EF0E615C2C1A811100DF30F6 /* Enums_MeasureMode.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61112C1A811100DF30F6 /* Enums_MeasureMode.h */; };
- EF0E615D2C1A811100DF30F6 /* Enums_NodeType.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61122C1A811100DF30F6 /* Enums_NodeType.h */; };
- EF0E615E2C1A811100DF30F6 /* Enums_Overflow.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61132C1A811100DF30F6 /* Enums_Overflow.h */; };
- EF0E615F2C1A811100DF30F6 /* Enums_PhysicalEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61142C1A811100DF30F6 /* Enums_PhysicalEdge.h */; };
- EF0E61602C1A811100DF30F6 /* Enums_PositionType.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61152C1A811100DF30F6 /* Enums_PositionType.h */; };
- EF0E61612C1A811100DF30F6 /* Enums_Unit.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61162C1A811100DF30F6 /* Enums_Unit.h */; };
- EF0E61622C1A811100DF30F6 /* Enums_Wrap.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61172C1A811100DF30F6 /* Enums_Wrap.h */; };
- EF0E61632C1A811100DF30F6 /* Enums_YogaEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61182C1A811100DF30F6 /* Enums_YogaEnums.h */; };
- EF0E61642C1A811100DF30F6 /* Event_event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61192C1A811100DF30F6 /* Event_event.cpp */; };
- EF0E61652C1A811100DF30F6 /* Event_event.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E611A2C1A811100DF30F6 /* Event_event.h */; };
- EF0E61662C1A811100DF30F6 /* Node_CachedMeasurement.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E611C2C1A811100DF30F6 /* Node_CachedMeasurement.h */; };
- EF0E61672C1A811100DF30F6 /* Node_LayoutResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E611D2C1A811100DF30F6 /* Node_LayoutResults.cpp */; };
- EF0E61682C1A811100DF30F6 /* Node_LayoutResults.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E611E2C1A811100DF30F6 /* Node_LayoutResults.h */; };
- EF0E61692C1A811100DF30F6 /* Node_Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E611F2C1A811100DF30F6 /* Node_Node.cpp */; };
- EF0E616A2C1A811100DF30F6 /* Node_Node.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61202C1A811100DF30F6 /* Node_Node.h */; };
- EF0E616B2C1A811100DF30F6 /* Numeric_Comparison.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61212C1A811100DF30F6 /* Numeric_Comparison.h */; };
- EF0E616C2C1A811100DF30F6 /* Numeric_FloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61222C1A811100DF30F6 /* Numeric_FloatOptional.h */; };
- EF0E616D2C1A811100DF30F6 /* Style_SmallValueBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61232C1A811100DF30F6 /* Style_SmallValueBuffer.h */; };
- EF0E616E2C1A811100DF30F6 /* Style_Style.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61242C1A811100DF30F6 /* Style_Style.h */; };
- EF0E616F2C1A811100DF30F6 /* Style_StyleLength.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61252C1A811100DF30F6 /* Style_StyleLength.h */; };
- EF0E61702C1A811100DF30F6 /* Style_StyleValueHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61262C1A811100DF30F6 /* Style_StyleValueHandle.h */; };
- EF0E61712C1A811100DF30F6 /* Style_StyleValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = EF0E61272C1A811100DF30F6 /* Style_StyleValuePool.h */; };
- EF0E61722C1A811100DF30F6 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61282C1A811100DF30F6 /* YGConfig.cpp */; };
- EF0E61732C1A811100DF30F6 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E61292C1A811100DF30F6 /* YGEnums.cpp */; };
- EF0E61742C1A811100DF30F6 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E612A2C1A811100DF30F6 /* YGNode.cpp */; };
- EF0E61752C1A811100DF30F6 /* YGNodeLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E612B2C1A811100DF30F6 /* YGNodeLayout.cpp */; };
- EF0E61762C1A811100DF30F6 /* YGNodeStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E612C2C1A811100DF30F6 /* YGNodeStyle.cpp */; };
- EF0E61772C1A811100DF30F6 /* YGPixelGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E612D2C1A811100DF30F6 /* YGPixelGrid.cpp */; };
- EF0E61782C1A811100DF30F6 /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EF0E612E2C1A811100DF30F6 /* YGValue.cpp */; };
+ 71A5522D2CEAED24005D9FBF /* FlexLayout+Enum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24AE97301FEAF30A00995987 /* FlexLayout+Enum.swift */; };
+ 71A5522E2CEAED47005D9FBF /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617F2ABEE4B600D5A2E0 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 71A5522F2CEAED47005D9FBF /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617E2ABEE4B600D5A2E0 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 71A552302CEAED47005D9FBF /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 715C617D2ABEE4B600D5A2E0 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 71A552312CEAEDC1005D9FBF /* FlexLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 24AE97351FEAF30A00995987 /* FlexLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 9421472A1695AFD38FAEBD72 /* Pods_FlexLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F893AE16F96F495E91B6D58 /* Pods_FlexLayout.framework */; };
EF5445402C1D607100BF4A33 /* InsetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF54453F2C1D607100BF4A33 /* InsetTests.swift */; };
/* End PBXBuildFile section */
@@ -125,6 +53,7 @@
/* Begin PBXFileReference section */
1F69C581A2C68BBBD1B64F21 /* Pods_FlexLayoutTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FlexLayoutTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 224171C69665A229D0A217EF /* Pods-FlexLayout.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlexLayout.debug.xcconfig"; path = "Target Support Files/Pods-FlexLayout/Pods-FlexLayout.debug.xcconfig"; sourceTree = ""; };
2491CC5C1FCB931F00F3A61C /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; };
2491CC5E1FCB932B00F3A61C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = ""; };
24AE972E1FEAF30A00995987 /* FlexLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlexLayout.swift; sourceTree = ""; };
@@ -138,6 +67,8 @@
24DA37631EF843C500D1AB2F /* FlexLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlexLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2B210ECFE9D7665DACB8E8A7 /* Pods-FlexLayoutTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlexLayoutTests.debug.xcconfig"; path = "Target Support Files/Pods-FlexLayoutTests/Pods-FlexLayoutTests.debug.xcconfig"; sourceTree = ""; };
38E690AA4AF8EDFC95DB6626 /* Pods-FlexLayoutTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlexLayoutTests.release.xcconfig"; path = "Target Support Files/Pods-FlexLayoutTests/Pods-FlexLayoutTests.release.xcconfig"; sourceTree = ""; };
+ 3F893AE16F96F495E91B6D58 /* Pods_FlexLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FlexLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 6B9A88E410DD5E3EA6C308DD /* Pods-FlexLayout.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlexLayout.release.xcconfig"; path = "Target Support Files/Pods-FlexLayout/Pods-FlexLayout.release.xcconfig"; sourceTree = ""; };
711F2EE12ACC727000DDDD67 /* WidthSizeContentTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WidthSizeContentTests.swift; sourceTree = ""; };
711F2EE22ACC727000DDDD67 /* PaddingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaddingTests.swift; sourceTree = ""; };
711F2EE32ACC727000DDDD67 /* FlexLayoutTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlexLayoutTests.swift; sourceTree = ""; };
@@ -148,80 +79,6 @@
715C617E2ABEE4B600D5A2E0 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; };
715C617F2ABEE4B600D5A2E0 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = ""; };
715C61802ABEE4B600D5A2E0 /* YGLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.objcpp; path = YGLayout.mm; sourceTree = ""; tabWidth = 2; };
- EF0E60E32C1A811100DF30F6 /* YGConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGConfig.h; sourceTree = ""; };
- EF0E60E42C1A811100DF30F6 /* YGEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = ""; };
- EF0E60E52C1A811100DF30F6 /* YGMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = ""; };
- EF0E60E62C1A811100DF30F6 /* YGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNode.h; sourceTree = ""; };
- EF0E60E72C1A811100DF30F6 /* YGNodeLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodeLayout.h; sourceTree = ""; };
- EF0E60E82C1A811100DF30F6 /* YGNodeStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodeStyle.h; sourceTree = ""; };
- EF0E60E92C1A811100DF30F6 /* YGPixelGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGPixelGrid.h; sourceTree = ""; };
- EF0E60EA2C1A811100DF30F6 /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; };
- EF0E60EB2C1A811100DF30F6 /* Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; };
- EF0E60EE2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_AbsoluteLayout.cpp; sourceTree = ""; };
- EF0E60EF2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_AbsoluteLayout.h; sourceTree = ""; };
- EF0E60F02C1A811100DF30F6 /* Algorithm_Align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_Align.h; sourceTree = ""; };
- EF0E60F12C1A811100DF30F6 /* Algorithm_Baseline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_Baseline.cpp; sourceTree = ""; };
- EF0E60F22C1A811100DF30F6 /* Algorithm_Baseline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_Baseline.h; sourceTree = ""; };
- EF0E60F32C1A811100DF30F6 /* Algorithm_BoundAxis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_BoundAxis.h; sourceTree = ""; };
- EF0E60F42C1A811100DF30F6 /* Algorithm_Cache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_Cache.cpp; sourceTree = ""; };
- EF0E60F52C1A811100DF30F6 /* Algorithm_Cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_Cache.h; sourceTree = ""; };
- EF0E60F62C1A811100DF30F6 /* Algorithm_CalculateLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_CalculateLayout.cpp; sourceTree = ""; };
- EF0E60F72C1A811100DF30F6 /* Algorithm_CalculateLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_CalculateLayout.h; sourceTree = ""; };
- EF0E60F82C1A811100DF30F6 /* Algorithm_FlexDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_FlexDirection.h; sourceTree = ""; };
- EF0E60F92C1A811100DF30F6 /* Algorithm_FlexLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_FlexLine.cpp; sourceTree = ""; };
- EF0E60FA2C1A811100DF30F6 /* Algorithm_FlexLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_FlexLine.h; sourceTree = ""; };
- EF0E60FB2C1A811100DF30F6 /* Algorithm_PixelGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Algorithm_PixelGrid.cpp; sourceTree = ""; };
- EF0E60FC2C1A811100DF30F6 /* Algorithm_PixelGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_PixelGrid.h; sourceTree = ""; };
- EF0E60FD2C1A811100DF30F6 /* Algorithm_SizingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_SizingMode.h; sourceTree = ""; };
- EF0E60FE2C1A811100DF30F6 /* Algorithm_TrailingPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Algorithm_TrailingPosition.h; sourceTree = ""; };
- EF0E60FF2C1A811100DF30F6 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; };
- EF0E61002C1A811100DF30F6 /* Config_Config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Config_Config.cpp; sourceTree = ""; };
- EF0E61012C1A811100DF30F6 /* Config_Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config_Config.h; sourceTree = ""; };
- EF0E61022C1A811100DF30F6 /* Debug_AssertFatal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Debug_AssertFatal.cpp; sourceTree = ""; };
- EF0E61032C1A811100DF30F6 /* Debug_AssertFatal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Debug_AssertFatal.h; sourceTree = ""; };
- EF0E61042C1A811100DF30F6 /* Debug_Log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Debug_Log.cpp; sourceTree = ""; };
- EF0E61052C1A811100DF30F6 /* Debug_Log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Debug_Log.h; sourceTree = ""; };
- EF0E61062C1A811100DF30F6 /* Enums_Align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Align.h; sourceTree = ""; };
- EF0E61072C1A811100DF30F6 /* Enums_Dimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Dimension.h; sourceTree = ""; };
- EF0E61082C1A811100DF30F6 /* Enums_Direction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Direction.h; sourceTree = ""; };
- EF0E61092C1A811100DF30F6 /* Enums_Display.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Display.h; sourceTree = ""; };
- EF0E610A2C1A811100DF30F6 /* Enums_Edge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Edge.h; sourceTree = ""; };
- EF0E610B2C1A811100DF30F6 /* Enums_Errata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Errata.h; sourceTree = ""; };
- EF0E610C2C1A811100DF30F6 /* Enums_ExperimentalFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_ExperimentalFeature.h; sourceTree = ""; };
- EF0E610D2C1A811100DF30F6 /* Enums_FlexDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_FlexDirection.h; sourceTree = ""; };
- EF0E610E2C1A811100DF30F6 /* Enums_Gutter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Gutter.h; sourceTree = ""; };
- EF0E610F2C1A811100DF30F6 /* Enums_Justify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Justify.h; sourceTree = ""; };
- EF0E61102C1A811100DF30F6 /* Enums_LogLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_LogLevel.h; sourceTree = ""; };
- EF0E61112C1A811100DF30F6 /* Enums_MeasureMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_MeasureMode.h; sourceTree = ""; };
- EF0E61122C1A811100DF30F6 /* Enums_NodeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_NodeType.h; sourceTree = ""; };
- EF0E61132C1A811100DF30F6 /* Enums_Overflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Overflow.h; sourceTree = ""; };
- EF0E61142C1A811100DF30F6 /* Enums_PhysicalEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_PhysicalEdge.h; sourceTree = ""; };
- EF0E61152C1A811100DF30F6 /* Enums_PositionType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_PositionType.h; sourceTree = ""; };
- EF0E61162C1A811100DF30F6 /* Enums_Unit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Unit.h; sourceTree = ""; };
- EF0E61172C1A811100DF30F6 /* Enums_Wrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_Wrap.h; sourceTree = ""; };
- EF0E61182C1A811100DF30F6 /* Enums_YogaEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enums_YogaEnums.h; sourceTree = ""; };
- EF0E61192C1A811100DF30F6 /* Event_event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event_event.cpp; sourceTree = ""; };
- EF0E611A2C1A811100DF30F6 /* Event_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Event_event.h; sourceTree = ""; };
- EF0E611B2C1A811100DF30F6 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; };
- EF0E611C2C1A811100DF30F6 /* Node_CachedMeasurement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Node_CachedMeasurement.h; sourceTree = ""; };
- EF0E611D2C1A811100DF30F6 /* Node_LayoutResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Node_LayoutResults.cpp; sourceTree = ""; };
- EF0E611E2C1A811100DF30F6 /* Node_LayoutResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Node_LayoutResults.h; sourceTree = ""; };
- EF0E611F2C1A811100DF30F6 /* Node_Node.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Node_Node.cpp; sourceTree = ""; };
- EF0E61202C1A811100DF30F6 /* Node_Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Node_Node.h; sourceTree = ""; };
- EF0E61212C1A811100DF30F6 /* Numeric_Comparison.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Numeric_Comparison.h; sourceTree = ""; };
- EF0E61222C1A811100DF30F6 /* Numeric_FloatOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Numeric_FloatOptional.h; sourceTree = ""; };
- EF0E61232C1A811100DF30F6 /* Style_SmallValueBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Style_SmallValueBuffer.h; sourceTree = ""; };
- EF0E61242C1A811100DF30F6 /* Style_Style.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Style_Style.h; sourceTree = ""; };
- EF0E61252C1A811100DF30F6 /* Style_StyleLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Style_StyleLength.h; sourceTree = ""; };
- EF0E61262C1A811100DF30F6 /* Style_StyleValueHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Style_StyleValueHandle.h; sourceTree = ""; };
- EF0E61272C1A811100DF30F6 /* Style_StyleValuePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Style_StyleValuePool.h; sourceTree = ""; };
- EF0E61282C1A811100DF30F6 /* YGConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGConfig.cpp; sourceTree = ""; };
- EF0E61292C1A811100DF30F6 /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = ""; };
- EF0E612A2C1A811100DF30F6 /* YGNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNode.cpp; sourceTree = ""; };
- EF0E612B2C1A811100DF30F6 /* YGNodeLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodeLayout.cpp; sourceTree = ""; };
- EF0E612C2C1A811100DF30F6 /* YGNodeStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodeStyle.cpp; sourceTree = ""; };
- EF0E612D2C1A811100DF30F6 /* YGPixelGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGPixelGrid.cpp; sourceTree = ""; };
- EF0E612E2C1A811100DF30F6 /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; };
EF54453F2C1D607100BF4A33 /* InsetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsetTests.swift; sourceTree = ""; };
/* End PBXFileReference section */
@@ -230,6 +87,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 9421472A1695AFD38FAEBD72 /* Pods_FlexLayout.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -249,6 +107,8 @@
children = (
2B210ECFE9D7665DACB8E8A7 /* Pods-FlexLayoutTests.debug.xcconfig */,
38E690AA4AF8EDFC95DB6626 /* Pods-FlexLayoutTests.release.xcconfig */,
+ 224171C69665A229D0A217EF /* Pods-FlexLayout.debug.xcconfig */,
+ 6B9A88E410DD5E3EA6C308DD /* Pods-FlexLayout.release.xcconfig */,
);
path = Pods;
sourceTree = "";
@@ -256,7 +116,6 @@
24AE972D1FEAF30A00995987 /* Sources */ = {
isa = PBXGroup;
children = (
- EF0E612F2C1A811100DF30F6 /* yoga */,
B9EAD87E238884C90058E0CB /* Swift */,
715C61792ABEE4B600D5A2E0 /* YogaKit */,
);
@@ -356,6 +215,7 @@
2491CC5E1FCB932B00F3A61C /* Quick.framework */,
2491CC5C1FCB931F00F3A61C /* Nimble.framework */,
1F69C581A2C68BBBD1B64F21 /* Pods_FlexLayoutTests.framework */,
+ 3F893AE16F96F495E91B6D58 /* Pods_FlexLayout.framework */,
);
name = Frameworks;
sourceTree = "";
@@ -372,103 +232,6 @@
path = Swift;
sourceTree = "";
};
- EF0E60EC2C1A811100DF30F6 /* yoga */ = {
- isa = PBXGroup;
- children = (
- EF0E60E32C1A811100DF30F6 /* YGConfig.h */,
- EF0E60E42C1A811100DF30F6 /* YGEnums.h */,
- EF0E60E52C1A811100DF30F6 /* YGMacros.h */,
- EF0E60E62C1A811100DF30F6 /* YGNode.h */,
- EF0E60E72C1A811100DF30F6 /* YGNodeLayout.h */,
- EF0E60E82C1A811100DF30F6 /* YGNodeStyle.h */,
- EF0E60E92C1A811100DF30F6 /* YGPixelGrid.h */,
- EF0E60EA2C1A811100DF30F6 /* YGValue.h */,
- EF0E60EB2C1A811100DF30F6 /* Yoga.h */,
- );
- path = yoga;
- sourceTree = "";
- };
- EF0E60ED2C1A811100DF30F6 /* include */ = {
- isa = PBXGroup;
- children = (
- EF0E60EC2C1A811100DF30F6 /* yoga */,
- );
- path = include;
- sourceTree = "";
- };
- EF0E612F2C1A811100DF30F6 /* yoga */ = {
- isa = PBXGroup;
- children = (
- EF0E60ED2C1A811100DF30F6 /* include */,
- EF0E60EE2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.cpp */,
- EF0E60EF2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.h */,
- EF0E60F02C1A811100DF30F6 /* Algorithm_Align.h */,
- EF0E60F12C1A811100DF30F6 /* Algorithm_Baseline.cpp */,
- EF0E60F22C1A811100DF30F6 /* Algorithm_Baseline.h */,
- EF0E60F32C1A811100DF30F6 /* Algorithm_BoundAxis.h */,
- EF0E60F42C1A811100DF30F6 /* Algorithm_Cache.cpp */,
- EF0E60F52C1A811100DF30F6 /* Algorithm_Cache.h */,
- EF0E60F62C1A811100DF30F6 /* Algorithm_CalculateLayout.cpp */,
- EF0E60F72C1A811100DF30F6 /* Algorithm_CalculateLayout.h */,
- EF0E60F82C1A811100DF30F6 /* Algorithm_FlexDirection.h */,
- EF0E60F92C1A811100DF30F6 /* Algorithm_FlexLine.cpp */,
- EF0E60FA2C1A811100DF30F6 /* Algorithm_FlexLine.h */,
- EF0E60FB2C1A811100DF30F6 /* Algorithm_PixelGrid.cpp */,
- EF0E60FC2C1A811100DF30F6 /* Algorithm_PixelGrid.h */,
- EF0E60FD2C1A811100DF30F6 /* Algorithm_SizingMode.h */,
- EF0E60FE2C1A811100DF30F6 /* Algorithm_TrailingPosition.h */,
- EF0E60FF2C1A811100DF30F6 /* CMakeLists.txt */,
- EF0E61002C1A811100DF30F6 /* Config_Config.cpp */,
- EF0E61012C1A811100DF30F6 /* Config_Config.h */,
- EF0E61022C1A811100DF30F6 /* Debug_AssertFatal.cpp */,
- EF0E61032C1A811100DF30F6 /* Debug_AssertFatal.h */,
- EF0E61042C1A811100DF30F6 /* Debug_Log.cpp */,
- EF0E61052C1A811100DF30F6 /* Debug_Log.h */,
- EF0E61062C1A811100DF30F6 /* Enums_Align.h */,
- EF0E61072C1A811100DF30F6 /* Enums_Dimension.h */,
- EF0E61082C1A811100DF30F6 /* Enums_Direction.h */,
- EF0E61092C1A811100DF30F6 /* Enums_Display.h */,
- EF0E610A2C1A811100DF30F6 /* Enums_Edge.h */,
- EF0E610B2C1A811100DF30F6 /* Enums_Errata.h */,
- EF0E610C2C1A811100DF30F6 /* Enums_ExperimentalFeature.h */,
- EF0E610D2C1A811100DF30F6 /* Enums_FlexDirection.h */,
- EF0E610E2C1A811100DF30F6 /* Enums_Gutter.h */,
- EF0E610F2C1A811100DF30F6 /* Enums_Justify.h */,
- EF0E61102C1A811100DF30F6 /* Enums_LogLevel.h */,
- EF0E61112C1A811100DF30F6 /* Enums_MeasureMode.h */,
- EF0E61122C1A811100DF30F6 /* Enums_NodeType.h */,
- EF0E61132C1A811100DF30F6 /* Enums_Overflow.h */,
- EF0E61142C1A811100DF30F6 /* Enums_PhysicalEdge.h */,
- EF0E61152C1A811100DF30F6 /* Enums_PositionType.h */,
- EF0E61162C1A811100DF30F6 /* Enums_Unit.h */,
- EF0E61172C1A811100DF30F6 /* Enums_Wrap.h */,
- EF0E61182C1A811100DF30F6 /* Enums_YogaEnums.h */,
- EF0E61192C1A811100DF30F6 /* Event_event.cpp */,
- EF0E611A2C1A811100DF30F6 /* Event_event.h */,
- EF0E611B2C1A811100DF30F6 /* module.modulemap */,
- EF0E611C2C1A811100DF30F6 /* Node_CachedMeasurement.h */,
- EF0E611D2C1A811100DF30F6 /* Node_LayoutResults.cpp */,
- EF0E611E2C1A811100DF30F6 /* Node_LayoutResults.h */,
- EF0E611F2C1A811100DF30F6 /* Node_Node.cpp */,
- EF0E61202C1A811100DF30F6 /* Node_Node.h */,
- EF0E61212C1A811100DF30F6 /* Numeric_Comparison.h */,
- EF0E61222C1A811100DF30F6 /* Numeric_FloatOptional.h */,
- EF0E61232C1A811100DF30F6 /* Style_SmallValueBuffer.h */,
- EF0E61242C1A811100DF30F6 /* Style_Style.h */,
- EF0E61252C1A811100DF30F6 /* Style_StyleLength.h */,
- EF0E61262C1A811100DF30F6 /* Style_StyleValueHandle.h */,
- EF0E61272C1A811100DF30F6 /* Style_StyleValuePool.h */,
- EF0E61282C1A811100DF30F6 /* YGConfig.cpp */,
- EF0E61292C1A811100DF30F6 /* YGEnums.cpp */,
- EF0E612A2C1A811100DF30F6 /* YGNode.cpp */,
- EF0E612B2C1A811100DF30F6 /* YGNodeLayout.cpp */,
- EF0E612C2C1A811100DF30F6 /* YGNodeStyle.cpp */,
- EF0E612D2C1A811100DF30F6 /* YGPixelGrid.cpp */,
- EF0E612E2C1A811100DF30F6 /* YGValue.cpp */,
- );
- path = yoga;
- sourceTree = "";
- };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -476,63 +239,10 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- EF0E61562C1A811100DF30F6 /* Enums_Errata.h in Headers */,
- EF0E61382C1A811100DF30F6 /* Yoga.h in Headers */,
- EF0E614E2C1A811100DF30F6 /* Debug_AssertFatal.h in Headers */,
- EF0E615B2C1A811100DF30F6 /* Enums_LogLevel.h in Headers */,
- EF0E61652C1A811100DF30F6 /* Event_event.h in Headers */,
- 71332C262B794826000667C9 /* FlexLayout.h in Headers */,
- EF0E615D2C1A811100DF30F6 /* Enums_NodeType.h in Headers */,
- EF0E61632C1A811100DF30F6 /* Enums_YogaEnums.h in Headers */,
- EF0E614C2C1A811100DF30F6 /* Config_Config.h in Headers */,
- EF0E61522C1A811100DF30F6 /* Enums_Dimension.h in Headers */,
- EF0E61602C1A811100DF30F6 /* Enums_PositionType.h in Headers */,
- 71332C272B794935000667C9 /* UIView+Yoga.h in Headers */,
- EF0E613D2C1A811100DF30F6 /* Algorithm_Baseline.h in Headers */,
- EF0E61572C1A811100DF30F6 /* Enums_ExperimentalFeature.h in Headers */,
- 71332C282B794935000667C9 /* YGLayout.h in Headers */,
- 71332C292B794935000667C9 /* YGLayout+Private.h in Headers */,
- EF0E61532C1A811100DF30F6 /* Enums_Direction.h in Headers */,
- EF0E61352C1A811100DF30F6 /* YGNodeStyle.h in Headers */,
- EF0E616E2C1A811100DF30F6 /* Style_Style.h in Headers */,
- EF0E61492C1A811100DF30F6 /* Algorithm_TrailingPosition.h in Headers */,
- EF0E61682C1A811100DF30F6 /* Node_LayoutResults.h in Headers */,
- EF0E616F2C1A811100DF30F6 /* Style_StyleLength.h in Headers */,
- EF0E61342C1A811100DF30F6 /* YGNodeLayout.h in Headers */,
- EF0E61452C1A811100DF30F6 /* Algorithm_FlexLine.h in Headers */,
- EF0E613A2C1A811100DF30F6 /* Algorithm_AbsoluteLayout.h in Headers */,
- EF0E61512C1A811100DF30F6 /* Enums_Align.h in Headers */,
- EF0E61592C1A811100DF30F6 /* Enums_Gutter.h in Headers */,
- EF0E615F2C1A811100DF30F6 /* Enums_PhysicalEdge.h in Headers */,
- EF0E616D2C1A811100DF30F6 /* Style_SmallValueBuffer.h in Headers */,
- EF0E61432C1A811100DF30F6 /* Algorithm_FlexDirection.h in Headers */,
- EF0E61472C1A811100DF30F6 /* Algorithm_PixelGrid.h in Headers */,
- EF0E61612C1A811100DF30F6 /* Enums_Unit.h in Headers */,
- EF0E61402C1A811100DF30F6 /* Algorithm_Cache.h in Headers */,
- EF0E613E2C1A811100DF30F6 /* Algorithm_BoundAxis.h in Headers */,
- EF0E61622C1A811100DF30F6 /* Enums_Wrap.h in Headers */,
- EF0E61332C1A811100DF30F6 /* YGNode.h in Headers */,
- EF0E61422C1A811100DF30F6 /* Algorithm_CalculateLayout.h in Headers */,
- EF0E61712C1A811100DF30F6 /* Style_StyleValuePool.h in Headers */,
- EF0E61662C1A811100DF30F6 /* Node_CachedMeasurement.h in Headers */,
- EF0E61502C1A811100DF30F6 /* Debug_Log.h in Headers */,
- EF0E61582C1A811100DF30F6 /* Enums_FlexDirection.h in Headers */,
- EF0E61482C1A811100DF30F6 /* Algorithm_SizingMode.h in Headers */,
- EF0E61542C1A811100DF30F6 /* Enums_Display.h in Headers */,
- EF0E615C2C1A811100DF30F6 /* Enums_MeasureMode.h in Headers */,
- EF0E61302C1A811100DF30F6 /* YGConfig.h in Headers */,
- EF0E615A2C1A811100DF30F6 /* Enums_Justify.h in Headers */,
- EF0E616B2C1A811100DF30F6 /* Numeric_Comparison.h in Headers */,
- EF0E616A2C1A811100DF30F6 /* Node_Node.h in Headers */,
- EF0E61372C1A811100DF30F6 /* YGValue.h in Headers */,
- EF0E61702C1A811100DF30F6 /* Style_StyleValueHandle.h in Headers */,
- EF0E61322C1A811100DF30F6 /* YGMacros.h in Headers */,
- EF0E613B2C1A811100DF30F6 /* Algorithm_Align.h in Headers */,
- EF0E61362C1A811100DF30F6 /* YGPixelGrid.h in Headers */,
- EF0E615E2C1A811100DF30F6 /* Enums_Overflow.h in Headers */,
- EF0E61552C1A811100DF30F6 /* Enums_Edge.h in Headers */,
- EF0E61312C1A811100DF30F6 /* YGEnums.h in Headers */,
- EF0E616C2C1A811100DF30F6 /* Numeric_FloatOptional.h in Headers */,
+ 71A5522E2CEAED47005D9FBF /* UIView+Yoga.h in Headers */,
+ 71A5522F2CEAED47005D9FBF /* YGLayout.h in Headers */,
+ 71A552302CEAED47005D9FBF /* YGLayout+Private.h in Headers */,
+ 71A552312CEAEDC1005D9FBF /* FlexLayout.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -543,6 +253,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 24DA376E1EF843C500D1AB2F /* Build configuration list for PBXNativeTarget "FlexLayout" */;
buildPhases = (
+ 296ABF4DC2205E5C45A6CE32 /* [CP] Check Pods Manifest.lock */,
24DA37551EF843C500D1AB2F /* Sources */,
24DA37561EF843C500D1AB2F /* Frameworks */,
24DA37571EF843C500D1AB2F /* Headers */,
@@ -624,7 +335,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- EF0E614A2C1A811100DF30F6 /* CMakeLists.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -638,10 +348,12 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FlexLayoutTests/Pods-FlexLayoutTests-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/FlexLayout/FlexLayout.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FlexLayout.framework",
);
runOnlyForDeploymentPostprocessing = 0;
@@ -649,6 +361,28 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FlexLayoutTests/Pods-FlexLayoutTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
+ 296ABF4DC2205E5C45A6CE32 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-FlexLayout-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
780CC5362B9779C60FF80C2D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -679,31 +413,12 @@
buildActionMask = 2147483647;
files = (
24AE974A1FEAF30A00995987 /* YGLayoutExtensions.swift in Sources */,
- EF0E614B2C1A811100DF30F6 /* Config_Config.cpp in Sources */,
24AE97411FEAF30A00995987 /* UIView+FlexLayout.swift in Sources */,
- EF0E614F2C1A811100DF30F6 /* Debug_Log.cpp in Sources */,
24AE97421FEAF30A00995987 /* Percent.swift in Sources */,
- EF0E61782C1A811100DF30F6 /* YGValue.cpp in Sources */,
715C61852ABEE4B600D5A2E0 /* YGLayout.mm in Sources */,
24AE97401FEAF30A00995987 /* FlexLayout+Private.swift in Sources */,
- EF0E614D2C1A811100DF30F6 /* Debug_AssertFatal.cpp in Sources */,
- EF0E61442C1A811100DF30F6 /* Algorithm_FlexLine.cpp in Sources */,
- EF0E61462C1A811100DF30F6 /* Algorithm_PixelGrid.cpp in Sources */,
- EF0E61772C1A811100DF30F6 /* YGPixelGrid.cpp in Sources */,
- EF0E61392C1A811100DF30F6 /* Algorithm_AbsoluteLayout.cpp in Sources */,
- 24AE973F1FEAF30A00995987 /* FlexLayout+Enum.swift in Sources */,
715C61812ABEE4B600D5A2E0 /* UIView+Yoga.mm in Sources */,
- EF0E61752C1A811100DF30F6 /* YGNodeLayout.cpp in Sources */,
- EF0E61692C1A811100DF30F6 /* Node_Node.cpp in Sources */,
- EF0E61742C1A811100DF30F6 /* YGNode.cpp in Sources */,
- EF0E61722C1A811100DF30F6 /* YGConfig.cpp in Sources */,
- EF0E61412C1A811100DF30F6 /* Algorithm_CalculateLayout.cpp in Sources */,
- EF0E61732C1A811100DF30F6 /* YGEnums.cpp in Sources */,
- EF0E613F2C1A811100DF30F6 /* Algorithm_Cache.cpp in Sources */,
- EF0E61642C1A811100DF30F6 /* Event_event.cpp in Sources */,
- EF0E613C2C1A811100DF30F6 /* Algorithm_Baseline.cpp in Sources */,
- EF0E61762C1A811100DF30F6 /* YGNodeStyle.cpp in Sources */,
- EF0E61672C1A811100DF30F6 /* Node_LayoutResults.cpp in Sources */,
+ 71A5522D2CEAED24005D9FBF /* FlexLayout+Enum.swift in Sources */,
24AE973E1FEAF30A00995987 /* FlexLayout.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -864,6 +579,7 @@
};
24DA376F1EF843C500D1AB2F /* Debug */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 224171C69665A229D0A217EF /* Pods-FlexLayout.debug.xcconfig */;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
@@ -891,6 +607,7 @@
};
24DA37701EF843C500D1AB2F /* Release */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 6B9A88E410DD5E3EA6C308DD /* Pods-FlexLayout.release.xcconfig */;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
diff --git a/Package.resolved b/Package.resolved
new file mode 100644
index 00000000..4cc6489b
--- /dev/null
+++ b/Package.resolved
@@ -0,0 +1,16 @@
+{
+ "object": {
+ "pins": [
+ {
+ "package": "yoga",
+ "repositoryURL": "https://github.com/facebook/yoga.git",
+ "state": {
+ "branch": null,
+ "revision": "69b8934429702bd3ab06e8d6f709112a761b474b",
+ "version": "3.1.0"
+ }
+ }
+ ]
+ },
+ "version": 1
+}
diff --git a/Package.swift b/Package.swift
index 663bd387..ddcc190c 100644
--- a/Package.swift
+++ b/Package.swift
@@ -6,11 +6,14 @@ import PackageDescription
let package = Package(
name: "FlexLayout",
platforms: [
- .iOS(.v12)
+ .iOS(.v12),
],
products: [
.library(name: "FlexLayout", targets: ["FlexLayout"]),
],
+ dependencies: [
+ .package(url: "https://github.com/facebook/yoga.git", from: "3.1.0"),
+ ],
targets: [
.target(
name: "FlexLayout",
@@ -18,15 +21,9 @@ let package = Package(
path: "Sources/Swift",
publicHeadersPath: "Public"
),
- .target(
- name: "FlexLayoutYoga",
- dependencies: [],
- path: "Sources/yoga",
- publicHeadersPath: "include/yoga"
- ),
.target(
name: "FlexLayoutYogaKit",
- dependencies: ["FlexLayoutYoga"],
+ dependencies: ["yoga"],
path: "Sources/YogaKit",
publicHeadersPath: "include/YogaKit"
),
diff --git a/Podfile b/Podfile
index fcefd2f6..5425a248 100644
--- a/Podfile
+++ b/Podfile
@@ -1,9 +1,13 @@
source 'https://cdn.cocoapods.org/'
use_frameworks!
-platform :ios, '12.0'
+platform :ios, '14.0'
workspace 'FlexLayout.xcworkspace'
+target 'FlexLayout' do
+ pod 'Yoga', git: 'https://github.com/facebook/yoga.git', tag: 'v3.1.0'
+end
+
target 'FlexLayoutTests' do
project 'FlexLayout.xcodeproj'
pod 'FlexLayout', path: './'
diff --git a/Podfile.lock b/Podfile.lock
index 5c896040..2fadbdb9 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -1,12 +1,15 @@
PODS:
- - FlexLayout (2.0.10)
+ - FlexLayout (2.0.10):
+ - Yoga
- PinLayout (1.10.5)
- SwiftLint (0.55.1)
+ - Yoga (3.1.0)
DEPENDENCIES:
- FlexLayout (from `./`)
- PinLayout
- SwiftLint
+ - Yoga (from `https://github.com/facebook/yoga.git`, tag `v3.1.0`)
SPEC REPOS:
trunk:
@@ -16,12 +19,21 @@ SPEC REPOS:
EXTERNAL SOURCES:
FlexLayout:
:path: "./"
+ Yoga:
+ :git: https://github.com/facebook/yoga.git
+ :tag: v3.1.0
+
+CHECKOUT OPTIONS:
+ Yoga:
+ :git: https://github.com/facebook/yoga.git
+ :tag: v3.1.0
SPEC CHECKSUMS:
- FlexLayout: ea94491c923485f7f28891cb5b10245d22df380b
+ FlexLayout: aaf305c1f3203be3d8694c3835773d1e7a912b72
PinLayout: f6c2b63a5a5b24864064e1d15c67de41b4e74748
SwiftLint: 3fe909719babe5537c552ee8181c0031392be933
+ Yoga: 73e3c7ca57e233ad32a1a265a8b55dcce6c4d529
-PODFILE CHECKSUM: a0f152e938c551fd661bee3ffe26ccc6175f088b
+PODFILE CHECKSUM: 616cb577f11ab8498737680dedeed47c6fae4b64
COCOAPODS: 1.14.3
diff --git a/Sources/Swift/Impl/FlexLayout+Enum.swift b/Sources/Swift/Impl/FlexLayout+Enum.swift
index ae2c68d6..2ba399dc 100644
--- a/Sources/Swift/Impl/FlexLayout+Enum.swift
+++ b/Sources/Swift/Impl/FlexLayout+Enum.swift
@@ -14,65 +14,7 @@
import UIKit
-#if SWIFT_PACKAGE
-import FlexLayoutYoga
-
-extension YGFlexDirection {
- static let column = YGFlexDirectionColumn
- static let columnReverse = YGFlexDirectionColumnReverse
- static let row = YGFlexDirectionRow
- static let rowReverse = YGFlexDirectionRowReverse
-}
-
-extension YGJustify {
- static let flexStart = YGJustifyFlexStart
- static let center = YGJustifyCenter
- static let flexEnd = YGJustifyFlexEnd
- static let spaceBetween = YGJustifySpaceBetween
- static let spaceAround = YGJustifySpaceAround
- static let spaceEvenly = YGJustifySpaceEvenly
-}
-
-extension YGAlign {
- static let auto = YGAlignAuto
- static let baseline = YGAlignBaseline
- static let stretch = YGAlignStretch
- static let flexStart = YGAlignFlexStart
- static let center = YGAlignCenter
- static let flexEnd = YGAlignFlexEnd
- static let spaceBetween = YGAlignSpaceBetween
- static let spaceAround = YGAlignSpaceAround
- static let spaceEvenly = YGAlignSpaceEvenly
-}
-
-extension YGWrap {
- static let noWrap = YGWrapNoWrap
- static let wrap = YGWrapWrap
- static let wrapReverse = YGWrapWrapReverse
-}
-
-extension YGPositionType {
- static let relative = YGPositionTypeRelative
- static let absolute = YGPositionTypeAbsolute
- static let `static` = YGPositionTypeStatic
-}
-
-extension YGDirection {
- static let LTR = YGDirectionLTR
- static let RTL = YGDirectionRTL
- static let inherit = YGDirectionInherit
-}
-
-extension YGDisplay {
- static let flex = YGDisplayFlex
- static let none = YGDisplayNone
-}
-
-extension YGUnit {
- static let percent = YGUnitPercent
- static let point = YGUnitPoint
-}
-#endif
+import yoga
extension Flex.Direction {
var yogaValue: YGFlexDirection {
diff --git a/Sources/Swift/Impl/FlexLayout+Private.swift b/Sources/Swift/Impl/FlexLayout+Private.swift
index 7436cf01..9e57ae90 100644
--- a/Sources/Swift/Impl/FlexLayout+Private.swift
+++ b/Sources/Swift/Impl/FlexLayout+Private.swift
@@ -8,9 +8,7 @@
import UIKit
-#if SWIFT_PACKAGE
-import FlexLayoutYoga
-#endif
+import yoga
extension Flex {
func valueOrUndefined(_ value: CGFloat?) -> YGValue {
diff --git a/Sources/Swift/YGLayoutExtensions.swift b/Sources/Swift/YGLayoutExtensions.swift
index a0e8fa8c..fea92daa 100644
--- a/Sources/Swift/YGLayoutExtensions.swift
+++ b/Sources/Swift/YGLayoutExtensions.swift
@@ -7,9 +7,7 @@
import CoreGraphics
-#if SWIFT_PACKAGE
-import FlexLayoutYoga
-#endif
+import yoga
extension Int {
public static postfix func %(value: Int) -> YGValue {
diff --git a/Sources/YogaKit/include/YogaKit/YGLayout+Private.h b/Sources/YogaKit/include/YogaKit/YGLayout+Private.h
index a341addb..63fd8c79 100644
--- a/Sources/YogaKit/include/YogaKit/YGLayout+Private.h
+++ b/Sources/YogaKit/include/YogaKit/YGLayout+Private.h
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-#import "Yoga.h"
+#import
#import "YGLayout.h"
@interface YGLayout ()
diff --git a/Sources/YogaKit/include/YogaKit/YGLayout.h b/Sources/YogaKit/include/YogaKit/YGLayout.h
index 5ffb00e7..337b9737 100644
--- a/Sources/YogaKit/include/YogaKit/YGLayout.h
+++ b/Sources/YogaKit/include/YogaKit/YGLayout.h
@@ -7,9 +7,9 @@
#import
-#import "YGEnums.h"
-#import "YGMacros.h"
-#import "Yoga.h"
+#import
+#import
+#import
YG_EXTERN_C_BEGIN
diff --git a/Sources/yoga/Algorithm_AbsoluteLayout.cpp b/Sources/yoga/Algorithm_AbsoluteLayout.cpp
deleted file mode 100644
index 8da927e8..00000000
--- a/Sources/yoga/Algorithm_AbsoluteLayout.cpp
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Algorithm_AbsoluteLayout.h"
-#include "Algorithm_Align.h"
-#include "Algorithm_BoundAxis.h"
-#include "Algorithm_CalculateLayout.h"
-#include "Algorithm_TrailingPosition.h"
-
-namespace facebook::yoga {
-
-static inline void setFlexStartLayoutPosition(
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const float containingBlockWidth) {
- child->setLayoutPosition(
- child->style().computeFlexStartMargin(
- axis, direction, containingBlockWidth) +
- parent->getLayout().border(flexStartEdge(axis)) +
- parent->getLayout().padding(flexStartEdge(axis)),
- flexStartEdge(axis));
-}
-
-static inline void setFlexEndLayoutPosition(
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const float containingBlockWidth) {
- child->setLayoutPosition(
- getPositionOfOppositeEdge(
- parent->getLayout().border(flexEndEdge(axis)) +
- parent->getLayout().padding(flexEndEdge(axis)) +
- child->style().computeFlexEndMargin(
- axis, direction, containingBlockWidth),
- axis,
- parent,
- child),
- flexStartEdge(axis));
-}
-
-static inline void setCenterLayoutPosition(
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const float containingBlockWidth) {
- const float parentContentBoxSize =
- parent->getLayout().measuredDimension(dimension(axis)) -
- parent->getLayout().border(flexStartEdge(axis)) -
- parent->getLayout().border(flexEndEdge(axis)) -
- parent->getLayout().padding(flexStartEdge(axis)) -
- parent->getLayout().padding(flexEndEdge(axis));
- const float childOuterSize =
- child->getLayout().measuredDimension(dimension(axis)) +
- child->style().computeMarginForAxis(axis, containingBlockWidth);
- child->setLayoutPosition(
- (parentContentBoxSize - childOuterSize) / 2.0f +
- parent->getLayout().border(flexStartEdge(axis)) +
- parent->getLayout().padding(flexStartEdge(axis)) +
- child->style().computeFlexStartMargin(
- axis, direction, containingBlockWidth),
- flexStartEdge(axis));
-}
-
-static void justifyAbsoluteChild(
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection mainAxis,
- const float containingBlockWidth) {
- const Justify parentJustifyContent = parent->style().justifyContent();
- switch (parentJustifyContent) {
- case Justify::FlexStart:
- case Justify::SpaceBetween:
- setFlexStartLayoutPosition(
- parent, child, direction, mainAxis, containingBlockWidth);
- break;
- case Justify::FlexEnd:
- setFlexEndLayoutPosition(
- parent, child, direction, mainAxis, containingBlockWidth);
- break;
- case Justify::Center:
- case Justify::SpaceAround:
- case Justify::SpaceEvenly:
- setCenterLayoutPosition(
- parent, child, direction, mainAxis, containingBlockWidth);
- break;
- }
-}
-
-static void alignAbsoluteChild(
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection crossAxis,
- const float containingBlockWidth) {
- Align itemAlign = resolveChildAlignment(parent, child);
- const Wrap parentWrap = parent->style().flexWrap();
- if (parentWrap == Wrap::WrapReverse) {
- if (itemAlign == Align::FlexEnd) {
- itemAlign = Align::FlexStart;
- } else if (itemAlign != Align::Center) {
- itemAlign = Align::FlexEnd;
- }
- }
-
- switch (itemAlign) {
- case Align::Auto:
- case Align::FlexStart:
- case Align::Baseline:
- case Align::SpaceAround:
- case Align::SpaceBetween:
- case Align::Stretch:
- case Align::SpaceEvenly:
- setFlexStartLayoutPosition(
- parent, child, direction, crossAxis, containingBlockWidth);
- break;
- case Align::FlexEnd:
- setFlexEndLayoutPosition(
- parent, child, direction, crossAxis, containingBlockWidth);
- break;
- case Align::Center:
- setCenterLayoutPosition(
- parent, child, direction, crossAxis, containingBlockWidth);
- break;
- }
-}
-
-// To ensure no breaking changes, we preserve the legacy way of positioning
-// absolute children and determine if we should use it using an errata.
-static void positionAbsoluteChildLegacy(
- const yoga::Node* const containingNode,
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const bool isMainAxis,
- const float containingBlockWidth,
- const float containingBlockHeight) {
- const bool isAxisRow = isRow(axis);
- const bool shouldCenter = isMainAxis
- ? parent->style().justifyContent() == Justify::Center
- : resolveChildAlignment(parent, child) == Align::Center;
- const bool shouldFlexEnd = isMainAxis
- ? parent->style().justifyContent() == Justify::FlexEnd
- : ((resolveChildAlignment(parent, child) == Align::FlexEnd) ^
- (parent->style().flexWrap() == Wrap::WrapReverse));
-
- if (child->style().isFlexEndPositionDefined(axis, direction) &&
- !child->style().isFlexStartPositionDefined(axis, direction)) {
- child->setLayoutPosition(
- containingNode->getLayout().measuredDimension(dimension(axis)) -
- child->getLayout().measuredDimension(dimension(axis)) -
- containingNode->style().computeFlexEndBorder(axis, direction) -
- child->style().computeFlexEndMargin(
- axis,
- direction,
- isAxisRow ? containingBlockWidth : containingBlockHeight) -
- child->style().computeFlexEndPosition(
- axis,
- direction,
- isAxisRow ? containingBlockWidth : containingBlockHeight),
- flexStartEdge(axis));
- } else if (
- !child->style().isFlexStartPositionDefined(axis, direction) &&
- shouldCenter) {
- child->setLayoutPosition(
- (parent->getLayout().measuredDimension(dimension(axis)) -
- child->getLayout().measuredDimension(dimension(axis))) /
- 2.0f,
- flexStartEdge(axis));
- } else if (
- !child->style().isFlexStartPositionDefined(axis, direction) &&
- shouldFlexEnd) {
- child->setLayoutPosition(
- (parent->getLayout().measuredDimension(dimension(axis)) -
- child->getLayout().measuredDimension(dimension(axis))),
- flexStartEdge(axis));
- }
-}
-
-/*
- * Absolutely positioned nodes do not participate in flex layout and thus their
- * positions can be determined independently from the rest of their siblings.
- * For each axis there are essentially two cases:
- *
- * 1) The node has insets defined. In this case we can just use these to
- * determine the position of the node.
- * 2) The node does not have insets defined. In this case we look at the style
- * of the parent to position the node. Things like justify content and
- * align content will move absolute children around. If none of these
- * special properties are defined, the child is positioned at the start
- * (defined by flex direction) of the leading flex line.
- *
- * This function does that positioning for the given axis. The spec has more
- * information on this topic: https://www.w3.org/TR/css-flexbox-1/#abspos-items
- */
-static void positionAbsoluteChildImpl(
- const yoga::Node* const containingNode,
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const bool isMainAxis,
- const float containingBlockWidth,
- const float containingBlockHeight) {
- const bool isAxisRow = isRow(axis);
- const float containingBlockSize =
- isAxisRow ? containingBlockWidth : containingBlockHeight;
-
- // The inline-start position takes priority over the end position in the case
- // that they are both set and the node has a fixed width. Thus we only have 2
- // cases here: if inline-start is defined and if inline-end is defined.
- //
- // Despite checking inline-start to honor prioritization of insets, we write
- // to the flex-start edge because this algorithm works by positioning on the
- // flex-start edge and then filling in the flex-end direction at the end if
- // necessary.
- if (child->style().isInlineStartPositionDefined(axis, direction)) {
- const float positionRelativeToInlineStart =
- child->style().computeInlineStartPosition(
- axis, direction, containingBlockSize) +
- containingNode->style().computeInlineStartBorder(axis, direction) +
- child->style().computeInlineStartMargin(
- axis, direction, containingBlockSize);
- const float positionRelativeToFlexStart =
- inlineStartEdge(axis, direction) != flexStartEdge(axis)
- ? getPositionOfOppositeEdge(
- positionRelativeToInlineStart, axis, containingNode, child)
- : positionRelativeToInlineStart;
-
- child->setLayoutPosition(positionRelativeToFlexStart, flexStartEdge(axis));
- } else if (child->style().isInlineEndPositionDefined(axis, direction)) {
- const float positionRelativeToInlineStart =
- containingNode->getLayout().measuredDimension(dimension(axis)) -
- child->getLayout().measuredDimension(dimension(axis)) -
- containingNode->style().computeInlineEndBorder(axis, direction) -
- child->style().computeInlineEndMargin(
- axis, direction, containingBlockSize) -
- child->style().computeInlineEndPosition(
- axis, direction, containingBlockSize);
- const float positionRelativeToFlexStart =
- inlineStartEdge(axis, direction) != flexStartEdge(axis)
- ? getPositionOfOppositeEdge(
- positionRelativeToInlineStart, axis, containingNode, child)
- : positionRelativeToInlineStart;
-
- child->setLayoutPosition(positionRelativeToFlexStart, flexStartEdge(axis));
- } else {
- isMainAxis ? justifyAbsoluteChild(
- parent, child, direction, axis, containingBlockWidth)
- : alignAbsoluteChild(
- parent, child, direction, axis, containingBlockWidth);
- }
-}
-
-static void positionAbsoluteChild(
- const yoga::Node* const containingNode,
- const yoga::Node* const parent,
- yoga::Node* child,
- const Direction direction,
- const FlexDirection axis,
- const bool isMainAxis,
- const float containingBlockWidth,
- const float containingBlockHeight) {
- child->hasErrata(Errata::AbsolutePositioningIncorrect)
- ? positionAbsoluteChildLegacy(
- containingNode,
- parent,
- child,
- direction,
- axis,
- isMainAxis,
- containingBlockWidth,
- containingBlockHeight)
- : positionAbsoluteChildImpl(
- containingNode,
- parent,
- child,
- direction,
- axis,
- isMainAxis,
- containingBlockWidth,
- containingBlockHeight);
-}
-
-void layoutAbsoluteChild(
- const yoga::Node* const containingNode,
- const yoga::Node* const node,
- yoga::Node* const child,
- const float containingBlockWidth,
- const float containingBlockHeight,
- const SizingMode widthMode,
- const Direction direction,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount) {
- const FlexDirection mainAxis =
- resolveDirection(node->style().flexDirection(), direction);
- const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
- const bool isMainAxisRow = isRow(mainAxis);
-
- float childWidth = YGUndefined;
- float childHeight = YGUndefined;
- SizingMode childWidthSizingMode = SizingMode::MaxContent;
- SizingMode childHeightSizingMode = SizingMode::MaxContent;
-
- auto marginRow = child->style().computeMarginForAxis(
- FlexDirection::Row, containingBlockWidth);
- auto marginColumn = child->style().computeMarginForAxis(
- FlexDirection::Column, containingBlockWidth);
-
- if (child->hasDefiniteLength(Dimension::Width, containingBlockWidth)) {
- childWidth = child->getResolvedDimension(Dimension::Width)
- .resolve(containingBlockWidth)
- .unwrap() +
- marginRow;
- } else {
- // If the child doesn't have a specified width, compute the width based on
- // the left/right offsets if they're defined.
- if (child->style().isFlexStartPositionDefined(
- FlexDirection::Row, direction) &&
- child->style().isFlexEndPositionDefined(
- FlexDirection::Row, direction)) {
- childWidth =
- containingNode->getLayout().measuredDimension(Dimension::Width) -
- (containingNode->style().computeFlexStartBorder(
- FlexDirection::Row, direction) +
- containingNode->style().computeFlexEndBorder(
- FlexDirection::Row, direction)) -
- (child->style().computeFlexStartPosition(
- FlexDirection::Row, direction, containingBlockWidth) +
- child->style().computeFlexEndPosition(
- FlexDirection::Row, direction, containingBlockWidth));
- childWidth = boundAxis(
- child,
- FlexDirection::Row,
- childWidth,
- containingBlockWidth,
- containingBlockWidth);
- }
- }
-
- if (child->hasDefiniteLength(Dimension::Height, containingBlockHeight)) {
- childHeight = child->getResolvedDimension(Dimension::Height)
- .resolve(containingBlockHeight)
- .unwrap() +
- marginColumn;
- } else {
- // If the child doesn't have a specified height, compute the height based
- // on the top/bottom offsets if they're defined.
- if (child->style().isFlexStartPositionDefined(
- FlexDirection::Column, direction) &&
- child->style().isFlexEndPositionDefined(
- FlexDirection::Column, direction)) {
- childHeight =
- containingNode->getLayout().measuredDimension(Dimension::Height) -
- (containingNode->style().computeFlexStartBorder(
- FlexDirection::Column, direction) +
- containingNode->style().computeFlexEndBorder(
- FlexDirection::Column, direction)) -
- (child->style().computeFlexStartPosition(
- FlexDirection::Column, direction, containingBlockHeight) +
- child->style().computeFlexEndPosition(
- FlexDirection::Column, direction, containingBlockHeight));
- childHeight = boundAxis(
- child,
- FlexDirection::Column,
- childHeight,
- containingBlockHeight,
- containingBlockWidth);
- }
- }
-
- // Exactly one dimension needs to be defined for us to be able to do aspect
- // ratio calculation. One dimension being the anchor and the other being
- // flexible.
- const auto& childStyle = child->style();
- if (yoga::isUndefined(childWidth) ^ yoga::isUndefined(childHeight)) {
- if (childStyle.aspectRatio().isDefined()) {
- if (yoga::isUndefined(childWidth)) {
- childWidth = marginRow +
- (childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
- } else if (yoga::isUndefined(childHeight)) {
- childHeight = marginColumn +
- (childWidth - marginRow) / childStyle.aspectRatio().unwrap();
- }
- }
- }
-
- // If we're still missing one or the other dimension, measure the content.
- if (yoga::isUndefined(childWidth) || yoga::isUndefined(childHeight)) {
- childWidthSizingMode = yoga::isUndefined(childWidth)
- ? SizingMode::MaxContent
- : SizingMode::StretchFit;
- childHeightSizingMode = yoga::isUndefined(childHeight)
- ? SizingMode::MaxContent
- : SizingMode::StretchFit;
-
- // If the size of the owner is defined then try to constrain the absolute
- // child to that size as well. This allows text within the absolute child
- // to wrap to the size of its owner. This is the same behavior as many
- // browsers implement.
- if (!isMainAxisRow && yoga::isUndefined(childWidth) &&
- widthMode != SizingMode::MaxContent &&
- yoga::isDefined(containingBlockWidth) && containingBlockWidth > 0) {
- childWidth = containingBlockWidth;
- childWidthSizingMode = SizingMode::FitContent;
- }
-
- calculateLayoutInternal(
- child,
- childWidth,
- childHeight,
- direction,
- childWidthSizingMode,
- childHeightSizingMode,
- containingBlockWidth,
- containingBlockHeight,
- false,
- LayoutPassReason::kAbsMeasureChild,
- layoutMarkerData,
- depth,
- generationCount);
- childWidth = child->getLayout().measuredDimension(Dimension::Width) +
- child->style().computeMarginForAxis(
- FlexDirection::Row, containingBlockWidth);
- childHeight = child->getLayout().measuredDimension(Dimension::Height) +
- child->style().computeMarginForAxis(
- FlexDirection::Column, containingBlockWidth);
- }
-
- calculateLayoutInternal(
- child,
- childWidth,
- childHeight,
- direction,
- SizingMode::StretchFit,
- SizingMode::StretchFit,
- containingBlockWidth,
- containingBlockHeight,
- true,
- LayoutPassReason::kAbsLayout,
- layoutMarkerData,
- depth,
- generationCount);
-
- positionAbsoluteChild(
- containingNode,
- node,
- child,
- direction,
- mainAxis,
- true /*isMainAxis*/,
- containingBlockWidth,
- containingBlockHeight);
- positionAbsoluteChild(
- containingNode,
- node,
- child,
- direction,
- crossAxis,
- false /*isMainAxis*/,
- containingBlockWidth,
- containingBlockHeight);
-}
-
-void layoutAbsoluteDescendants(
- yoga::Node* containingNode,
- yoga::Node* currentNode,
- SizingMode widthSizingMode,
- Direction currentNodeDirection,
- LayoutData& layoutMarkerData,
- uint32_t currentDepth,
- uint32_t generationCount,
- float currentNodeLeftOffsetFromContainingBlock,
- float currentNodeTopOffsetFromContainingBlock,
- float containingNodeAvailableInnerWidth,
- float containingNodeAvailableInnerHeight) {
- for (auto child : currentNode->getChildren()) {
- if (child->style().display() == Display::None) {
- continue;
- } else if (child->style().positionType() == PositionType::Absolute) {
- const bool absoluteErrata =
- currentNode->hasErrata(Errata::AbsolutePercentAgainstInnerSize);
- const float containingBlockWidth = absoluteErrata
- ? containingNodeAvailableInnerWidth
- : containingNode->getLayout().measuredDimension(Dimension::Width) -
- containingNode->style().computeBorderForAxis(FlexDirection::Row);
- const float containingBlockHeight = absoluteErrata
- ? containingNodeAvailableInnerHeight
- : containingNode->getLayout().measuredDimension(Dimension::Height) -
- containingNode->style().computeBorderForAxis(
- FlexDirection::Column);
-
- layoutAbsoluteChild(
- containingNode,
- currentNode,
- child,
- containingBlockWidth,
- containingBlockHeight,
- widthSizingMode,
- currentNodeDirection,
- layoutMarkerData,
- currentDepth,
- generationCount);
-
- /*
- * At this point the child has its position set but only on its the
- * parent's flexStart edge. Additionally, this position should be
- * interpreted relative to the containing block of the child if it had
- * insets defined. So we need to adjust the position by subtracting the
- * the parents offset from the containing block. However, getting that
- * offset is complicated since the two nodes can have different main/cross
- * axes.
- */
- const FlexDirection parentMainAxis = resolveDirection(
- currentNode->style().flexDirection(), currentNodeDirection);
- const FlexDirection parentCrossAxis =
- resolveCrossDirection(parentMainAxis, currentNodeDirection);
-
- if (needsTrailingPosition(parentMainAxis)) {
- const bool mainInsetsDefined = isRow(parentMainAxis)
- ? child->style().horizontalInsetsDefined()
- : child->style().verticalInsetsDefined();
- setChildTrailingPosition(
- mainInsetsDefined ? containingNode : currentNode,
- child,
- parentMainAxis);
- }
- if (needsTrailingPosition(parentCrossAxis)) {
- const bool crossInsetsDefined = isRow(parentCrossAxis)
- ? child->style().horizontalInsetsDefined()
- : child->style().verticalInsetsDefined();
- setChildTrailingPosition(
- crossInsetsDefined ? containingNode : currentNode,
- child,
- parentCrossAxis);
- }
-
- /*
- * At this point we know the left and top physical edges of the child are
- * set with positions that are relative to the containing block if insets
- * are defined
- */
- const float childLeftPosition =
- child->getLayout().position(PhysicalEdge::Left);
- const float childTopPosition =
- child->getLayout().position(PhysicalEdge::Top);
-
- const float childLeftOffsetFromParent =
- child->style().horizontalInsetsDefined()
- ? (childLeftPosition - currentNodeLeftOffsetFromContainingBlock)
- : childLeftPosition;
- const float childTopOffsetFromParent =
- child->style().verticalInsetsDefined()
- ? (childTopPosition - currentNodeTopOffsetFromContainingBlock)
- : childTopPosition;
-
- child->setLayoutPosition(childLeftOffsetFromParent, PhysicalEdge::Left);
- child->setLayoutPosition(childTopOffsetFromParent, PhysicalEdge::Top);
- } else if (
- child->style().positionType() == PositionType::Static &&
- !child->alwaysFormsContainingBlock()) {
- const Direction childDirection =
- child->resolveDirection(currentNodeDirection);
- // By now all descendants of the containing block that are not absolute
- // will have their positions set for left and top.
- const float childLeftOffsetFromContainingBlock =
- currentNodeLeftOffsetFromContainingBlock +
- child->getLayout().position(PhysicalEdge::Left);
- const float childTopOffsetFromContainingBlock =
- currentNodeTopOffsetFromContainingBlock +
- child->getLayout().position(PhysicalEdge::Top);
-
- layoutAbsoluteDescendants(
- containingNode,
- child,
- widthSizingMode,
- childDirection,
- layoutMarkerData,
- currentDepth + 1,
- generationCount,
- childLeftOffsetFromContainingBlock,
- childTopOffsetFromContainingBlock,
- containingNodeAvailableInnerWidth,
- containingNodeAvailableInnerHeight);
- }
- }
-}
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_AbsoluteLayout.h b/Sources/yoga/Algorithm_AbsoluteLayout.h
deleted file mode 100644
index abbebc03..00000000
--- a/Sources/yoga/Algorithm_AbsoluteLayout.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Event_event.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-void layoutAbsoluteChild(
- const yoga::Node* const containingNode,
- const yoga::Node* const node,
- yoga::Node* const child,
- const float containingBlockWidth,
- const float containingBlockHeight,
- const SizingMode widthMode,
- const Direction direction,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount);
-
-void layoutAbsoluteDescendants(
- yoga::Node* containingNode,
- yoga::Node* currentNode,
- SizingMode widthSizingMode,
- Direction currentNodeDirection,
- LayoutData& layoutMarkerData,
- uint32_t currentDepth,
- uint32_t generationCount,
- float currentNodeMainOffsetFromContainingBlock,
- float currentNodeCrossOffsetFromContainingBlock,
- float containingNodeAvailableInnerWidth,
- float containingNodeAvailableInnerHeight);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_Align.h b/Sources/yoga/Algorithm_Align.h
deleted file mode 100644
index a5573e7c..00000000
--- a/Sources/yoga/Algorithm_Align.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-
-#include "Algorithm_FlexDirection.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-inline Align resolveChildAlignment(
- const yoga::Node* node,
- const yoga::Node* child) {
- const Align align = child->style().alignSelf() == Align::Auto
- ? node->style().alignItems()
- : child->style().alignSelf();
- if (align == Align::Baseline && isColumn(node->style().flexDirection())) {
- return Align::FlexStart;
- }
- return align;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_Baseline.cpp b/Sources/yoga/Algorithm_Baseline.cpp
deleted file mode 100644
index c54a400a..00000000
--- a/Sources/yoga/Algorithm_Baseline.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Yoga.h"
-
-#include "Algorithm_Align.h"
-#include "Algorithm_Baseline.h"
-#include "Debug_AssertFatal.h"
-#include "Event_event.h"
-
-namespace facebook::yoga {
-
-float calculateBaseline(const yoga::Node* node) {
- if (node->hasBaselineFunc()) {
- Event::publish(node);
-
- const float baseline = node->baseline(
- node->getLayout().measuredDimension(Dimension::Width),
- node->getLayout().measuredDimension(Dimension::Height));
-
- Event::publish(node);
-
- yoga::assertFatalWithNode(
- node,
- !std::isnan(baseline),
- "Expect custom baseline function to not return NaN");
- return baseline;
- }
-
- yoga::Node* baselineChild = nullptr;
- const size_t childCount = node->getChildCount();
- for (size_t i = 0; i < childCount; i++) {
- auto child = node->getChild(i);
- if (child->getLineIndex() > 0) {
- break;
- }
- if (child->style().positionType() == PositionType::Absolute) {
- continue;
- }
- if (resolveChildAlignment(node, child) == Align::Baseline ||
- child->isReferenceBaseline()) {
- baselineChild = child;
- break;
- }
-
- if (baselineChild == nullptr) {
- baselineChild = child;
- }
- }
-
- if (baselineChild == nullptr) {
- return node->getLayout().measuredDimension(Dimension::Height);
- }
-
- const float baseline = calculateBaseline(baselineChild);
- return baseline + baselineChild->getLayout().position(PhysicalEdge::Top);
-}
-
-bool isBaselineLayout(const yoga::Node* node) {
- if (isColumn(node->style().flexDirection())) {
- return false;
- }
- if (node->style().alignItems() == Align::Baseline) {
- return true;
- }
- const auto childCount = node->getChildCount();
- for (size_t i = 0; i < childCount; i++) {
- auto child = node->getChild(i);
- if (child->style().positionType() != PositionType::Absolute &&
- child->style().alignSelf() == Align::Baseline) {
- return true;
- }
- }
-
- return false;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_Baseline.h b/Sources/yoga/Algorithm_Baseline.h
deleted file mode 100644
index 481df1ba..00000000
--- a/Sources/yoga/Algorithm_Baseline.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-// Calculate baseline represented as an offset from the top edge of the node.
-float calculateBaseline(const yoga::Node* node);
-
-// Whether any of the children of this node participate in baseline alignment
-bool isBaselineLayout(const yoga::Node* node);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_BoundAxis.h b/Sources/yoga/Algorithm_BoundAxis.h
deleted file mode 100644
index 7fe3f98a..00000000
--- a/Sources/yoga/Algorithm_BoundAxis.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Algorithm_FlexDirection.h"
-#include "Enums_Dimension.h"
-#include "Enums_FlexDirection.h"
-#include "Node_Node.h"
-#include "Numeric_Comparison.h"
-#include "Numeric_FloatOptional.h"
-
-namespace facebook::yoga {
-
-inline float paddingAndBorderForAxis(
- const yoga::Node* const node,
- const FlexDirection axis,
- const float widthSize) {
- // The total padding/border for a given axis does not depend on the direction
- // so hardcoding LTR here to avoid piping direction to this function
- return node->style().computeInlineStartPaddingAndBorder(
- axis, Direction::LTR, widthSize) +
- node->style().computeInlineEndPaddingAndBorder(
- axis, Direction::LTR, widthSize);
-}
-
-inline FloatOptional boundAxisWithinMinAndMax(
- const yoga::Node* const node,
- const FlexDirection axis,
- const FloatOptional value,
- const float axisSize) {
- FloatOptional min;
- FloatOptional max;
-
- if (isColumn(axis)) {
- min = node->style().minDimension(Dimension::Height).resolve(axisSize);
- max = node->style().maxDimension(Dimension::Height).resolve(axisSize);
- } else if (isRow(axis)) {
- min = node->style().minDimension(Dimension::Width).resolve(axisSize);
- max = node->style().maxDimension(Dimension::Width).resolve(axisSize);
- }
-
- if (max >= FloatOptional{0} && value > max) {
- return max;
- }
-
- if (min >= FloatOptional{0} && value < min) {
- return min;
- }
-
- return value;
-}
-
-// Like boundAxisWithinMinAndMax but also ensures that the value doesn't
-// go below the padding and border amount.
-inline float boundAxis(
- const yoga::Node* const node,
- const FlexDirection axis,
- const float value,
- const float axisSize,
- const float widthSize) {
- return yoga::maxOrDefined(
- boundAxisWithinMinAndMax(node, axis, FloatOptional{value}, axisSize)
- .unwrap(),
- paddingAndBorderForAxis(node, axis, widthSize));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_Cache.cpp b/Sources/yoga/Algorithm_Cache.cpp
deleted file mode 100644
index c0d826a8..00000000
--- a/Sources/yoga/Algorithm_Cache.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Algorithm_Cache.h"
-#include "Algorithm_PixelGrid.h"
-#include "Numeric_Comparison.h"
-
-namespace facebook::yoga {
-
-static inline bool sizeIsExactAndMatchesOldMeasuredSize(
- SizingMode sizeMode,
- float size,
- float lastComputedSize) {
- return sizeMode == SizingMode::StretchFit &&
- yoga::inexactEquals(size, lastComputedSize);
-}
-
-static inline bool oldSizeIsMaxContentAndStillFits(
- SizingMode sizeMode,
- float size,
- SizingMode lastSizeMode,
- float lastComputedSize) {
- return sizeMode == SizingMode::FitContent &&
- lastSizeMode == SizingMode::MaxContent &&
- (size >= lastComputedSize || yoga::inexactEquals(size, lastComputedSize));
-}
-
-static inline bool newSizeIsStricterAndStillValid(
- SizingMode sizeMode,
- float size,
- SizingMode lastSizeMode,
- float lastSize,
- float lastComputedSize) {
- return lastSizeMode == SizingMode::FitContent &&
- sizeMode == SizingMode::FitContent && yoga::isDefined(lastSize) &&
- yoga::isDefined(size) && yoga::isDefined(lastComputedSize) &&
- lastSize > size &&
- (lastComputedSize <= size || yoga::inexactEquals(size, lastComputedSize));
-}
-
-bool canUseCachedMeasurement(
- const SizingMode widthMode,
- const float availableWidth,
- const SizingMode heightMode,
- const float availableHeight,
- const SizingMode lastWidthMode,
- const float lastAvailableWidth,
- const SizingMode lastHeightMode,
- const float lastAvailableHeight,
- const float lastComputedWidth,
- const float lastComputedHeight,
- const float marginRow,
- const float marginColumn,
- const yoga::Config* const config) {
- if ((yoga::isDefined(lastComputedHeight) && lastComputedHeight < 0) ||
- ((yoga::isDefined(lastComputedWidth)) && lastComputedWidth < 0)) {
- return false;
- }
-
- const float pointScaleFactor = config->getPointScaleFactor();
-
- bool useRoundedComparison = config != nullptr && pointScaleFactor != 0;
- const float effectiveWidth = useRoundedComparison
- ? roundValueToPixelGrid(availableWidth, pointScaleFactor, false, false)
- : availableWidth;
- const float effectiveHeight = useRoundedComparison
- ? roundValueToPixelGrid(availableHeight, pointScaleFactor, false, false)
- : availableHeight;
- const float effectiveLastWidth = useRoundedComparison
- ? roundValueToPixelGrid(
- lastAvailableWidth, pointScaleFactor, false, false)
- : lastAvailableWidth;
- const float effectiveLastHeight = useRoundedComparison
- ? roundValueToPixelGrid(
- lastAvailableHeight, pointScaleFactor, false, false)
- : lastAvailableHeight;
-
- const bool hasSameWidthSpec = lastWidthMode == widthMode &&
- yoga::inexactEquals(effectiveLastWidth, effectiveWidth);
- const bool hasSameHeightSpec = lastHeightMode == heightMode &&
- yoga::inexactEquals(effectiveLastHeight, effectiveHeight);
-
- const bool widthIsCompatible =
- hasSameWidthSpec ||
- sizeIsExactAndMatchesOldMeasuredSize(
- widthMode, availableWidth - marginRow, lastComputedWidth) ||
- oldSizeIsMaxContentAndStillFits(
- widthMode,
- availableWidth - marginRow,
- lastWidthMode,
- lastComputedWidth) ||
- newSizeIsStricterAndStillValid(
- widthMode,
- availableWidth - marginRow,
- lastWidthMode,
- lastAvailableWidth,
- lastComputedWidth);
-
- const bool heightIsCompatible = hasSameHeightSpec ||
- sizeIsExactAndMatchesOldMeasuredSize(
- heightMode,
- availableHeight - marginColumn,
- lastComputedHeight) ||
- oldSizeIsMaxContentAndStillFits(heightMode,
- availableHeight - marginColumn,
- lastHeightMode,
- lastComputedHeight) ||
- newSizeIsStricterAndStillValid(heightMode,
- availableHeight - marginColumn,
- lastHeightMode,
- lastAvailableHeight,
- lastComputedHeight);
-
- return widthIsCompatible && heightIsCompatible;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_Cache.h b/Sources/yoga/Algorithm_Cache.h
deleted file mode 100644
index 11f97ca1..00000000
--- a/Sources/yoga/Algorithm_Cache.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Algorithm_SizingMode.h"
-#include "Config_Config.h"
-
-namespace facebook::yoga {
-
-bool canUseCachedMeasurement(
- SizingMode widthMode,
- float availableWidth,
- SizingMode heightMode,
- float availableHeight,
- SizingMode lastWidthMode,
- float lastAvailableWidth,
- SizingMode lastHeightMode,
- float lastAvailableHeight,
- float lastComputedWidth,
- float lastComputedHeight,
- float marginRow,
- float marginColumn,
- const yoga::Config* config);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_CalculateLayout.cpp b/Sources/yoga/Algorithm_CalculateLayout.cpp
deleted file mode 100644
index 31816cbf..00000000
--- a/Sources/yoga/Algorithm_CalculateLayout.cpp
+++ /dev/null
@@ -1,2372 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "Yoga.h"
-
-#include "Algorithm_AbsoluteLayout.h"
-#include "Algorithm_Align.h"
-#include "Algorithm_Baseline.h"
-#include "Algorithm_BoundAxis.h"
-#include "Algorithm_Cache.h"
-#include "Algorithm_CalculateLayout.h"
-#include "Algorithm_FlexDirection.h"
-#include "Algorithm_FlexLine.h"
-#include "Algorithm_PixelGrid.h"
-#include "Algorithm_SizingMode.h"
-#include "Algorithm_TrailingPosition.h"
-#include "Debug_AssertFatal.h"
-#include "Debug_Log.h"
-#include "Event_event.h"
-#include "Node_Node.h"
-#include "Numeric_Comparison.h"
-#include "Numeric_FloatOptional.h"
-
-namespace facebook::yoga {
-
-std::atomic gCurrentGenerationCount(0);
-
-static void constrainMaxSizeForMode(
- const yoga::Node* node,
- FlexDirection axis,
- float ownerAxisSize,
- float ownerWidth,
- /*in_out*/ SizingMode* mode,
- /*in_out*/ float* size) {
- const FloatOptional maxSize =
- node->style().maxDimension(dimension(axis)).resolve(ownerAxisSize) +
- FloatOptional(node->style().computeMarginForAxis(axis, ownerWidth));
- switch (*mode) {
- case SizingMode::StretchFit:
- case SizingMode::FitContent:
- *size = (maxSize.isUndefined() || *size < maxSize.unwrap())
- ? *size
- : maxSize.unwrap();
- break;
- case SizingMode::MaxContent:
- if (maxSize.isDefined()) {
- *mode = SizingMode::FitContent;
- *size = maxSize.unwrap();
- }
- break;
- }
-}
-
-static void computeFlexBasisForChild(
- const yoga::Node* const node,
- yoga::Node* const child,
- const float width,
- const SizingMode widthMode,
- const float height,
- const float ownerWidth,
- const float ownerHeight,
- const SizingMode heightMode,
- const Direction direction,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount) {
- const FlexDirection mainAxis =
- resolveDirection(node->style().flexDirection(), direction);
- const bool isMainAxisRow = isRow(mainAxis);
- const float mainAxisSize = isMainAxisRow ? width : height;
- const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight;
-
- float childWidth;
- float childHeight;
- SizingMode childWidthSizingMode;
- SizingMode childHeightSizingMode;
-
- const FloatOptional resolvedFlexBasis =
- child->resolveFlexBasisPtr().resolve(mainAxisownerSize);
- const bool isRowStyleDimDefined =
- child->hasDefiniteLength(Dimension::Width, ownerWidth);
- const bool isColumnStyleDimDefined =
- child->hasDefiniteLength(Dimension::Height, ownerHeight);
-
- if (resolvedFlexBasis.isDefined() && yoga::isDefined(mainAxisSize)) {
- if (child->getLayout().computedFlexBasis.isUndefined() ||
- (child->getConfig()->isExperimentalFeatureEnabled(
- ExperimentalFeature::WebFlexBasis) &&
- child->getLayout().computedFlexBasisGeneration != generationCount)) {
- const FloatOptional paddingAndBorder =
- FloatOptional(paddingAndBorderForAxis(child, mainAxis, ownerWidth));
- child->setLayoutComputedFlexBasis(
- yoga::maxOrDefined(resolvedFlexBasis, paddingAndBorder));
- }
- } else if (isMainAxisRow && isRowStyleDimDefined) {
- // The width is definite, so use that as the flex basis.
- const FloatOptional paddingAndBorder = FloatOptional(
- paddingAndBorderForAxis(child, FlexDirection::Row, ownerWidth));
-
- child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
- child->getResolvedDimension(Dimension::Width).resolve(ownerWidth),
- paddingAndBorder));
- } else if (!isMainAxisRow && isColumnStyleDimDefined) {
- // The height is definite, so use that as the flex basis.
- const FloatOptional paddingAndBorder = FloatOptional(
- paddingAndBorderForAxis(child, FlexDirection::Column, ownerWidth));
- child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
- child->getResolvedDimension(Dimension::Height).resolve(ownerHeight),
- paddingAndBorder));
- } else {
- // Compute the flex basis and hypothetical main size (i.e. the clamped flex
- // basis).
- childWidth = YGUndefined;
- childHeight = YGUndefined;
- childWidthSizingMode = SizingMode::MaxContent;
- childHeightSizingMode = SizingMode::MaxContent;
-
- auto marginRow =
- child->style().computeMarginForAxis(FlexDirection::Row, ownerWidth);
- auto marginColumn =
- child->style().computeMarginForAxis(FlexDirection::Column, ownerWidth);
-
- if (isRowStyleDimDefined) {
- childWidth = child->getResolvedDimension(Dimension::Width)
- .resolve(ownerWidth)
- .unwrap() +
- marginRow;
- childWidthSizingMode = SizingMode::StretchFit;
- }
- if (isColumnStyleDimDefined) {
- childHeight = child->getResolvedDimension(Dimension::Height)
- .resolve(ownerHeight)
- .unwrap() +
- marginColumn;
- childHeightSizingMode = SizingMode::StretchFit;
- }
-
- // The W3C spec doesn't say anything about the 'overflow' property, but all
- // major browsers appear to implement the following logic.
- if ((!isMainAxisRow && node->style().overflow() == Overflow::Scroll) ||
- node->style().overflow() != Overflow::Scroll) {
- if (yoga::isUndefined(childWidth) && yoga::isDefined(width)) {
- childWidth = width;
- childWidthSizingMode = SizingMode::FitContent;
- }
- }
-
- if ((isMainAxisRow && node->style().overflow() == Overflow::Scroll) ||
- node->style().overflow() != Overflow::Scroll) {
- if (yoga::isUndefined(childHeight) && yoga::isDefined(height)) {
- childHeight = height;
- childHeightSizingMode = SizingMode::FitContent;
- }
- }
-
- const auto& childStyle = child->style();
- if (childStyle.aspectRatio().isDefined()) {
- if (!isMainAxisRow && childWidthSizingMode == SizingMode::StretchFit) {
- childHeight = marginColumn +
- (childWidth - marginRow) / childStyle.aspectRatio().unwrap();
- childHeightSizingMode = SizingMode::StretchFit;
- } else if (
- isMainAxisRow && childHeightSizingMode == SizingMode::StretchFit) {
- childWidth = marginRow +
- (childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
- childWidthSizingMode = SizingMode::StretchFit;
- }
- }
-
- // If child has no defined size in the cross axis and is set to stretch, set
- // the cross axis to be measured exactly with the available inner width
-
- const bool hasExactWidth =
- yoga::isDefined(width) && widthMode == SizingMode::StretchFit;
- const bool childWidthStretch =
- resolveChildAlignment(node, child) == Align::Stretch &&
- childWidthSizingMode != SizingMode::StretchFit;
- if (!isMainAxisRow && !isRowStyleDimDefined && hasExactWidth &&
- childWidthStretch) {
- childWidth = width;
- childWidthSizingMode = SizingMode::StretchFit;
- if (childStyle.aspectRatio().isDefined()) {
- childHeight =
- (childWidth - marginRow) / childStyle.aspectRatio().unwrap();
- childHeightSizingMode = SizingMode::StretchFit;
- }
- }
-
- const bool hasExactHeight =
- yoga::isDefined(height) && heightMode == SizingMode::StretchFit;
- const bool childHeightStretch =
- resolveChildAlignment(node, child) == Align::Stretch &&
- childHeightSizingMode != SizingMode::StretchFit;
- if (isMainAxisRow && !isColumnStyleDimDefined && hasExactHeight &&
- childHeightStretch) {
- childHeight = height;
- childHeightSizingMode = SizingMode::StretchFit;
-
- if (childStyle.aspectRatio().isDefined()) {
- childWidth =
- (childHeight - marginColumn) * childStyle.aspectRatio().unwrap();
- childWidthSizingMode = SizingMode::StretchFit;
- }
- }
-
- constrainMaxSizeForMode(
- child,
- FlexDirection::Row,
- ownerWidth,
- ownerWidth,
- &childWidthSizingMode,
- &childWidth);
- constrainMaxSizeForMode(
- child,
- FlexDirection::Column,
- ownerHeight,
- ownerWidth,
- &childHeightSizingMode,
- &childHeight);
-
- // Measure the child
- calculateLayoutInternal(
- child,
- childWidth,
- childHeight,
- direction,
- childWidthSizingMode,
- childHeightSizingMode,
- ownerWidth,
- ownerHeight,
- false,
- LayoutPassReason::kMeasureChild,
- layoutMarkerData,
- depth,
- generationCount);
-
- child->setLayoutComputedFlexBasis(FloatOptional(yoga::maxOrDefined(
- child->getLayout().measuredDimension(dimension(mainAxis)),
- paddingAndBorderForAxis(child, mainAxis, ownerWidth))));
- }
- child->setLayoutComputedFlexBasisGeneration(generationCount);
-}
-
-static void measureNodeWithMeasureFunc(
- yoga::Node* const node,
- float availableWidth,
- float availableHeight,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight,
- LayoutData& layoutMarkerData,
- const LayoutPassReason reason) {
- yoga::assertFatalWithNode(
- node,
- node->hasMeasureFunc(),
- "Expected node to have custom measure function");
-
- if (widthSizingMode == SizingMode::MaxContent) {
- availableWidth = YGUndefined;
- }
- if (heightSizingMode == SizingMode::MaxContent) {
- availableHeight = YGUndefined;
- }
-
- const auto& layout = node->getLayout();
- const float paddingAndBorderAxisRow = layout.padding(PhysicalEdge::Left) +
- layout.padding(PhysicalEdge::Right) + layout.border(PhysicalEdge::Left) +
- layout.border(PhysicalEdge::Right);
- const float paddingAndBorderAxisColumn = layout.padding(PhysicalEdge::Top) +
- layout.padding(PhysicalEdge::Bottom) + layout.border(PhysicalEdge::Top) +
- layout.border(PhysicalEdge::Bottom);
-
- // We want to make sure we don't call measure with negative size
- const float innerWidth = yoga::isUndefined(availableWidth)
- ? availableWidth
- : yoga::maxOrDefined(0.0f, availableWidth - paddingAndBorderAxisRow);
- const float innerHeight = yoga::isUndefined(availableHeight)
- ? availableHeight
- : yoga::maxOrDefined(0.0f, availableHeight - paddingAndBorderAxisColumn);
-
- if (widthSizingMode == SizingMode::StretchFit &&
- heightSizingMode == SizingMode::StretchFit) {
- // Don't bother sizing the text if both dimensions are already defined.
- node->setLayoutMeasuredDimension(
- boundAxis(
- node, FlexDirection::Row, availableWidth, ownerWidth, ownerWidth),
- Dimension::Width);
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Column,
- availableHeight,
- ownerHeight,
- ownerWidth),
- Dimension::Height);
- } else {
- Event::publish(node);
-
- // Measure the text under the current constraints.
- const YGSize measuredSize = node->measure(
- innerWidth,
- measureMode(widthSizingMode),
- innerHeight,
- measureMode(heightSizingMode));
-
- layoutMarkerData.measureCallbacks += 1;
- layoutMarkerData.measureCallbackReasonsCount[static_cast(reason)] +=
- 1;
-
- Event::publish(
- node,
- {innerWidth,
- unscopedEnum(measureMode(widthSizingMode)),
- innerHeight,
- unscopedEnum(measureMode(heightSizingMode)),
- measuredSize.width,
- measuredSize.height,
- reason});
-
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Row,
- (widthSizingMode == SizingMode::MaxContent ||
- widthSizingMode == SizingMode::FitContent)
- ? measuredSize.width + paddingAndBorderAxisRow
- : availableWidth,
- ownerWidth,
- ownerWidth),
- Dimension::Width);
-
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Column,
- (heightSizingMode == SizingMode::MaxContent ||
- heightSizingMode == SizingMode::FitContent)
- ? measuredSize.height + paddingAndBorderAxisColumn
- : availableHeight,
- ownerHeight,
- ownerWidth),
- Dimension::Height);
- }
-}
-
-// For nodes with no children, use the available values if they were provided,
-// or the minimum size as indicated by the padding and border sizes.
-static void measureNodeWithoutChildren(
- yoga::Node* const node,
- const float availableWidth,
- const float availableHeight,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight) {
- const auto& layout = node->getLayout();
-
- float width = availableWidth;
- if (widthSizingMode == SizingMode::MaxContent ||
- widthSizingMode == SizingMode::FitContent) {
- width = layout.padding(PhysicalEdge::Left) +
- layout.padding(PhysicalEdge::Right) +
- layout.border(PhysicalEdge::Left) + layout.border(PhysicalEdge::Right);
- }
- node->setLayoutMeasuredDimension(
- boundAxis(node, FlexDirection::Row, width, ownerWidth, ownerWidth),
- Dimension::Width);
-
- float height = availableHeight;
- if (heightSizingMode == SizingMode::MaxContent ||
- heightSizingMode == SizingMode::FitContent) {
- height = layout.padding(PhysicalEdge::Top) +
- layout.padding(PhysicalEdge::Bottom) +
- layout.border(PhysicalEdge::Top) + layout.border(PhysicalEdge::Bottom);
- }
- node->setLayoutMeasuredDimension(
- boundAxis(node, FlexDirection::Column, height, ownerHeight, ownerWidth),
- Dimension::Height);
-}
-
-static bool measureNodeWithFixedSize(
- yoga::Node* const node,
- const float availableWidth,
- const float availableHeight,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight) {
- if ((yoga::isDefined(availableWidth) &&
- widthSizingMode == SizingMode::FitContent && availableWidth <= 0.0f) ||
- (yoga::isDefined(availableHeight) &&
- heightSizingMode == SizingMode::FitContent && availableHeight <= 0.0f) ||
- (widthSizingMode == SizingMode::StretchFit &&
- heightSizingMode == SizingMode::StretchFit)) {
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Row,
- yoga::isUndefined(availableWidth) ||
- (widthSizingMode == SizingMode::FitContent &&
- availableWidth < 0.0f)
- ? 0.0f
- : availableWidth,
- ownerWidth,
- ownerWidth),
- Dimension::Width);
-
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Column,
- yoga::isUndefined(availableHeight) ||
- (heightSizingMode == SizingMode::FitContent &&
- availableHeight < 0.0f)
- ? 0.0f
- : availableHeight,
- ownerHeight,
- ownerWidth),
- Dimension::Height);
- return true;
- }
-
- return false;
-}
-
-static void zeroOutLayoutRecursively(yoga::Node* const node) {
- node->getLayout() = {};
- node->setLayoutDimension(0, Dimension::Width);
- node->setLayoutDimension(0, Dimension::Height);
- node->setHasNewLayout(true);
-
- node->cloneChildrenIfNeeded();
- for (const auto child : node->getChildren()) {
- zeroOutLayoutRecursively(child);
- }
-}
-
-static float calculateAvailableInnerDimension(
- const yoga::Node* const node,
- const Dimension dimension,
- const float availableDim,
- const float paddingAndBorder,
- const float ownerDim) {
- float availableInnerDim = availableDim - paddingAndBorder;
- // Max dimension overrides predefined dimension value; Min dimension in turn
- // overrides both of the above
- if (yoga::isDefined(availableInnerDim)) {
- // We want to make sure our available height does not violate min and max
- // constraints
- const FloatOptional minDimensionOptional =
- node->style().minDimension(dimension).resolve(ownerDim);
- const float minInnerDim = minDimensionOptional.isUndefined()
- ? 0.0f
- : minDimensionOptional.unwrap() - paddingAndBorder;
-
- const FloatOptional maxDimensionOptional =
- node->style().maxDimension(dimension).resolve(ownerDim);
-
- const float maxInnerDim = maxDimensionOptional.isUndefined()
- ? FLT_MAX
- : maxDimensionOptional.unwrap() - paddingAndBorder;
- availableInnerDim = yoga::maxOrDefined(
- yoga::minOrDefined(availableInnerDim, maxInnerDim), minInnerDim);
- }
-
- return availableInnerDim;
-}
-
-static float computeFlexBasisForChildren(
- yoga::Node* const node,
- const float availableInnerWidth,
- const float availableInnerHeight,
- SizingMode widthSizingMode,
- SizingMode heightSizingMode,
- Direction direction,
- FlexDirection mainAxis,
- bool performLayout,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount) {
- float totalOuterFlexBasis = 0.0f;
- YGNodeRef singleFlexChild = nullptr;
- const auto& children = node->getChildren();
- SizingMode sizingModeMainDim =
- isRow(mainAxis) ? widthSizingMode : heightSizingMode;
- // If there is only one child with flexGrow + flexShrink it means we can set
- // the computedFlexBasis to 0 instead of measuring and shrinking / flexing the
- // child to exactly match the remaining space
- if (sizingModeMainDim == SizingMode::StretchFit) {
- for (auto child : children) {
- if (child->isNodeFlexible()) {
- if (singleFlexChild != nullptr ||
- yoga::inexactEquals(child->resolveFlexGrow(), 0.0f) ||
- yoga::inexactEquals(child->resolveFlexShrink(), 0.0f)) {
- // There is already a flexible child, or this flexible child doesn't
- // have flexGrow and flexShrink, abort
- singleFlexChild = nullptr;
- break;
- } else {
- singleFlexChild = child;
- }
- }
- }
- }
-
- for (auto child : children) {
- child->resolveDimension();
- if (child->style().display() == Display::None) {
- zeroOutLayoutRecursively(child);
- child->setHasNewLayout(true);
- child->setDirty(false);
- continue;
- }
- if (performLayout) {
- // Set the initial position (relative to the owner).
- const Direction childDirection = child->resolveDirection(direction);
- const float mainDim =
- isRow(mainAxis) ? availableInnerWidth : availableInnerHeight;
- const float crossDim =
- isRow(mainAxis) ? availableInnerHeight : availableInnerWidth;
- child->setPosition(
- childDirection, mainDim, crossDim, availableInnerWidth);
- }
-
- if (child->style().positionType() == PositionType::Absolute) {
- continue;
- }
- if (child == singleFlexChild) {
- child->setLayoutComputedFlexBasisGeneration(generationCount);
- child->setLayoutComputedFlexBasis(FloatOptional(0));
- } else {
- computeFlexBasisForChild(
- node,
- child,
- availableInnerWidth,
- widthSizingMode,
- availableInnerHeight,
- availableInnerWidth,
- availableInnerHeight,
- heightSizingMode,
- direction,
- layoutMarkerData,
- depth,
- generationCount);
- }
-
- totalOuterFlexBasis +=
- (child->getLayout().computedFlexBasis.unwrap() +
- child->style().computeMarginForAxis(mainAxis, availableInnerWidth));
- }
-
- return totalOuterFlexBasis;
-}
-
-// It distributes the free space to the flexible items and ensures that the size
-// of the flex items abide the min and max constraints. At the end of this
-// function the child nodes would have proper size. Prior using this function
-// please ensure that distributeFreeSpaceFirstPass is called.
-static float distributeFreeSpaceSecondPass(
- FlexLine& flexLine,
- yoga::Node* const node,
- const FlexDirection mainAxis,
- const FlexDirection crossAxis,
- const Direction direction,
- const float mainAxisownerSize,
- const float availableInnerMainDim,
- const float availableInnerCrossDim,
- const float availableInnerWidth,
- const float availableInnerHeight,
- const bool mainAxisOverflows,
- const SizingMode sizingModeCrossDim,
- const bool performLayout,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount) {
- float childFlexBasis = 0;
- float flexShrinkScaledFactor = 0;
- float flexGrowFactor = 0;
- float deltaFreeSpace = 0;
- const bool isMainAxisRow = isRow(mainAxis);
- const bool isNodeFlexWrap = node->style().flexWrap() != Wrap::NoWrap;
-
- for (auto currentLineChild : flexLine.itemsInFlow) {
- childFlexBasis = boundAxisWithinMinAndMax(
- currentLineChild,
- mainAxis,
- currentLineChild->getLayout().computedFlexBasis,
- mainAxisownerSize)
- .unwrap();
- float updatedMainSize = childFlexBasis;
-
- if (yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
- flexLine.layout.remainingFreeSpace < 0) {
- flexShrinkScaledFactor =
- -currentLineChild->resolveFlexShrink() * childFlexBasis;
- // Is this child able to shrink?
- if (flexShrinkScaledFactor != 0) {
- float childSize;
-
- if (yoga::isDefined(flexLine.layout.totalFlexShrinkScaledFactors) &&
- flexLine.layout.totalFlexShrinkScaledFactors == 0) {
- childSize = childFlexBasis + flexShrinkScaledFactor;
- } else {
- childSize = childFlexBasis +
- (flexLine.layout.remainingFreeSpace /
- flexLine.layout.totalFlexShrinkScaledFactors) *
- flexShrinkScaledFactor;
- }
-
- updatedMainSize = boundAxis(
- currentLineChild,
- mainAxis,
- childSize,
- availableInnerMainDim,
- availableInnerWidth);
- }
- } else if (
- yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
- flexLine.layout.remainingFreeSpace > 0) {
- flexGrowFactor = currentLineChild->resolveFlexGrow();
-
- // Is this child able to grow?
- if (!std::isnan(flexGrowFactor) && flexGrowFactor != 0) {
- updatedMainSize = boundAxis(
- currentLineChild,
- mainAxis,
- childFlexBasis +
- flexLine.layout.remainingFreeSpace /
- flexLine.layout.totalFlexGrowFactors * flexGrowFactor,
- availableInnerMainDim,
- availableInnerWidth);
- }
- }
-
- deltaFreeSpace += updatedMainSize - childFlexBasis;
-
- const float marginMain = currentLineChild->style().computeMarginForAxis(
- mainAxis, availableInnerWidth);
- const float marginCross = currentLineChild->style().computeMarginForAxis(
- crossAxis, availableInnerWidth);
-
- float childCrossSize;
- float childMainSize = updatedMainSize + marginMain;
- SizingMode childCrossSizingMode;
- SizingMode childMainSizingMode = SizingMode::StretchFit;
-
- const auto& childStyle = currentLineChild->style();
- if (childStyle.aspectRatio().isDefined()) {
- childCrossSize = isMainAxisRow
- ? (childMainSize - marginMain) / childStyle.aspectRatio().unwrap()
- : (childMainSize - marginMain) * childStyle.aspectRatio().unwrap();
- childCrossSizingMode = SizingMode::StretchFit;
-
- childCrossSize += marginCross;
- } else if (
- !std::isnan(availableInnerCrossDim) &&
- !currentLineChild->hasDefiniteLength(
- dimension(crossAxis), availableInnerCrossDim) &&
- sizingModeCrossDim == SizingMode::StretchFit &&
- !(isNodeFlexWrap && mainAxisOverflows) &&
- resolveChildAlignment(node, currentLineChild) == Align::Stretch &&
- !currentLineChild->style().flexStartMarginIsAuto(
- crossAxis, direction) &&
- !currentLineChild->style().flexEndMarginIsAuto(crossAxis, direction)) {
- childCrossSize = availableInnerCrossDim;
- childCrossSizingMode = SizingMode::StretchFit;
- } else if (!currentLineChild->hasDefiniteLength(
- dimension(crossAxis), availableInnerCrossDim)) {
- childCrossSize = availableInnerCrossDim;
- childCrossSizingMode = yoga::isUndefined(childCrossSize)
- ? SizingMode::MaxContent
- : SizingMode::FitContent;
- } else {
- childCrossSize =
- currentLineChild->getResolvedDimension(dimension(crossAxis))
- .resolve(availableInnerCrossDim)
- .unwrap() +
- marginCross;
- const bool isLoosePercentageMeasurement =
- currentLineChild->getResolvedDimension(dimension(crossAxis)).unit() ==
- Unit::Percent &&
- sizingModeCrossDim != SizingMode::StretchFit;
- childCrossSizingMode =
- yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement
- ? SizingMode::MaxContent
- : SizingMode::StretchFit;
- }
-
- constrainMaxSizeForMode(
- currentLineChild,
- mainAxis,
- availableInnerMainDim,
- availableInnerWidth,
- &childMainSizingMode,
- &childMainSize);
- constrainMaxSizeForMode(
- currentLineChild,
- crossAxis,
- availableInnerCrossDim,
- availableInnerWidth,
- &childCrossSizingMode,
- &childCrossSize);
-
- const bool requiresStretchLayout =
- !currentLineChild->hasDefiniteLength(
- dimension(crossAxis), availableInnerCrossDim) &&
- resolveChildAlignment(node, currentLineChild) == Align::Stretch &&
- !currentLineChild->style().flexStartMarginIsAuto(
- crossAxis, direction) &&
- !currentLineChild->style().flexEndMarginIsAuto(crossAxis, direction);
-
- const float childWidth = isMainAxisRow ? childMainSize : childCrossSize;
- const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize;
-
- const SizingMode childWidthSizingMode =
- isMainAxisRow ? childMainSizingMode : childCrossSizingMode;
- const SizingMode childHeightSizingMode =
- !isMainAxisRow ? childMainSizingMode : childCrossSizingMode;
-
- const bool isLayoutPass = performLayout && !requiresStretchLayout;
- // Recursively call the layout algorithm for this child with the updated
- // main size.
- calculateLayoutInternal(
- currentLineChild,
- childWidth,
- childHeight,
- node->getLayout().direction(),
- childWidthSizingMode,
- childHeightSizingMode,
- availableInnerWidth,
- availableInnerHeight,
- isLayoutPass,
- isLayoutPass ? LayoutPassReason::kFlexLayout
- : LayoutPassReason::kFlexMeasure,
- layoutMarkerData,
- depth,
- generationCount);
- node->setLayoutHadOverflow(
- node->getLayout().hadOverflow() ||
- currentLineChild->getLayout().hadOverflow());
- }
- return deltaFreeSpace;
-}
-
-// It distributes the free space to the flexible items.For those flexible items
-// whose min and max constraints are triggered, those flex item's clamped size
-// is removed from the remaingfreespace.
-static void distributeFreeSpaceFirstPass(
- FlexLine& flexLine,
- const FlexDirection mainAxis,
- const float mainAxisownerSize,
- const float availableInnerMainDim,
- const float availableInnerWidth) {
- float flexShrinkScaledFactor = 0;
- float flexGrowFactor = 0;
- float baseMainSize = 0;
- float boundMainSize = 0;
- float deltaFreeSpace = 0;
-
- for (auto currentLineChild : flexLine.itemsInFlow) {
- float childFlexBasis = boundAxisWithinMinAndMax(
- currentLineChild,
- mainAxis,
- currentLineChild->getLayout().computedFlexBasis,
- mainAxisownerSize)
- .unwrap();
-
- if (flexLine.layout.remainingFreeSpace < 0) {
- flexShrinkScaledFactor =
- -currentLineChild->resolveFlexShrink() * childFlexBasis;
-
- // Is this child able to shrink?
- if (yoga::isDefined(flexShrinkScaledFactor) &&
- flexShrinkScaledFactor != 0) {
- baseMainSize = childFlexBasis +
- flexLine.layout.remainingFreeSpace /
- flexLine.layout.totalFlexShrinkScaledFactors *
- flexShrinkScaledFactor;
- boundMainSize = boundAxis(
- currentLineChild,
- mainAxis,
- baseMainSize,
- availableInnerMainDim,
- availableInnerWidth);
- if (yoga::isDefined(baseMainSize) && yoga::isDefined(boundMainSize) &&
- baseMainSize != boundMainSize) {
- // By excluding this item's size and flex factor from remaining, this
- // item's min/max constraints should also trigger in the second pass
- // resulting in the item's size calculation being identical in the
- // first and second passes.
- deltaFreeSpace += boundMainSize - childFlexBasis;
- flexLine.layout.totalFlexShrinkScaledFactors -=
- (-currentLineChild->resolveFlexShrink() *
- currentLineChild->getLayout().computedFlexBasis.unwrap());
- }
- }
- } else if (
- yoga::isDefined(flexLine.layout.remainingFreeSpace) &&
- flexLine.layout.remainingFreeSpace > 0) {
- flexGrowFactor = currentLineChild->resolveFlexGrow();
-
- // Is this child able to grow?
- if (yoga::isDefined(flexGrowFactor) && flexGrowFactor != 0) {
- baseMainSize = childFlexBasis +
- flexLine.layout.remainingFreeSpace /
- flexLine.layout.totalFlexGrowFactors * flexGrowFactor;
- boundMainSize = boundAxis(
- currentLineChild,
- mainAxis,
- baseMainSize,
- availableInnerMainDim,
- availableInnerWidth);
-
- if (yoga::isDefined(baseMainSize) && yoga::isDefined(boundMainSize) &&
- baseMainSize != boundMainSize) {
- // By excluding this item's size and flex factor from remaining, this
- // item's min/max constraints should also trigger in the second pass
- // resulting in the item's size calculation being identical in the
- // first and second passes.
- deltaFreeSpace += boundMainSize - childFlexBasis;
- flexLine.layout.totalFlexGrowFactors -= flexGrowFactor;
- }
- }
- }
- }
- flexLine.layout.remainingFreeSpace -= deltaFreeSpace;
-}
-
-// Do two passes over the flex items to figure out how to distribute the
-// remaining space.
-//
-// The first pass finds the items whose min/max constraints trigger, freezes
-// them at those sizes, and excludes those sizes from the remaining space.
-//
-// The second pass sets the size of each flexible item. It distributes the
-// remaining space amongst the items whose min/max constraints didn't trigger in
-// the first pass. For the other items, it sets their sizes by forcing their
-// min/max constraints to trigger again.
-//
-// This two pass approach for resolving min/max constraints deviates from the
-// spec. The spec
-// (https://www.w3.org/TR/CSS-flexbox-1/#resolve-flexible-lengths) describes a
-// process that needs to be repeated a variable number of times. The algorithm
-// implemented here won't handle all cases but it was simpler to implement and
-// it mitigates performance concerns because we know exactly how many passes
-// it'll do.
-//
-// At the end of this function the child nodes would have the proper size
-// assigned to them.
-//
-static void resolveFlexibleLength(
- yoga::Node* const node,
- FlexLine& flexLine,
- const FlexDirection mainAxis,
- const FlexDirection crossAxis,
- const Direction direction,
- const float mainAxisownerSize,
- const float availableInnerMainDim,
- const float availableInnerCrossDim,
- const float availableInnerWidth,
- const float availableInnerHeight,
- const bool mainAxisOverflows,
- const SizingMode sizingModeCrossDim,
- const bool performLayout,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount) {
- const float originalFreeSpace = flexLine.layout.remainingFreeSpace;
- // First pass: detect the flex items whose min/max constraints trigger
- distributeFreeSpaceFirstPass(
- flexLine,
- mainAxis,
- mainAxisownerSize,
- availableInnerMainDim,
- availableInnerWidth);
-
- // Second pass: resolve the sizes of the flexible items
- const float distributedFreeSpace = distributeFreeSpaceSecondPass(
- flexLine,
- node,
- mainAxis,
- crossAxis,
- direction,
- mainAxisownerSize,
- availableInnerMainDim,
- availableInnerCrossDim,
- availableInnerWidth,
- availableInnerHeight,
- mainAxisOverflows,
- sizingModeCrossDim,
- performLayout,
- layoutMarkerData,
- depth,
- generationCount);
-
- flexLine.layout.remainingFreeSpace = originalFreeSpace - distributedFreeSpace;
-}
-
-static void justifyMainAxis(
- yoga::Node* const node,
- FlexLine& flexLine,
- const size_t startOfLineIndex,
- const FlexDirection mainAxis,
- const FlexDirection crossAxis,
- const Direction direction,
- const SizingMode sizingModeMainDim,
- const SizingMode sizingModeCrossDim,
- const float mainAxisownerSize,
- const float ownerWidth,
- const float availableInnerMainDim,
- const float availableInnerCrossDim,
- const float availableInnerWidth,
- const bool performLayout) {
- const auto& style = node->style();
-
- const float leadingPaddingAndBorderMain =
- node->style().computeFlexStartPaddingAndBorder(
- mainAxis, direction, ownerWidth);
- const float trailingPaddingAndBorderMain =
- node->style().computeFlexEndPaddingAndBorder(
- mainAxis, direction, ownerWidth);
-
- const float gap = node->style().computeGapForAxis(mainAxis);
- // If we are using "at most" rules in the main axis, make sure that
- // remainingFreeSpace is 0 when min main dimension is not given
- if (sizingModeMainDim == SizingMode::FitContent &&
- flexLine.layout.remainingFreeSpace > 0) {
- if (style.minDimension(dimension(mainAxis)).isDefined() &&
- style.minDimension(dimension(mainAxis))
- .resolve(mainAxisownerSize)
- .isDefined()) {
- // This condition makes sure that if the size of main dimension(after
- // considering child nodes main dim, leading and trailing padding etc)
- // falls below min dimension, then the remainingFreeSpace is reassigned
- // considering the min dimension
-
- // `minAvailableMainDim` denotes minimum available space in which child
- // can be laid out, it will exclude space consumed by padding and border.
- const float minAvailableMainDim = style.minDimension(dimension(mainAxis))
- .resolve(mainAxisownerSize)
- .unwrap() -
- leadingPaddingAndBorderMain - trailingPaddingAndBorderMain;
- const float occupiedSpaceByChildNodes =
- availableInnerMainDim - flexLine.layout.remainingFreeSpace;
- flexLine.layout.remainingFreeSpace = yoga::maxOrDefined(
- 0.0f, minAvailableMainDim - occupiedSpaceByChildNodes);
- } else {
- flexLine.layout.remainingFreeSpace = 0;
- }
- }
-
- int numberOfAutoMarginsOnCurrentLine = 0;
- for (size_t i = startOfLineIndex; i < flexLine.endOfLineIndex; i++) {
- auto child = node->getChild(i);
- if (child->style().positionType() != PositionType::Absolute) {
- if (child->style().flexStartMarginIsAuto(mainAxis, direction)) {
- numberOfAutoMarginsOnCurrentLine++;
- }
- if (child->style().flexEndMarginIsAuto(mainAxis, direction)) {
- numberOfAutoMarginsOnCurrentLine++;
- }
- }
- }
-
- // In order to position the elements in the main axis, we have two controls.
- // The space between the beginning and the first element and the space between
- // each two elements.
- float leadingMainDim = 0;
- float betweenMainDim = gap;
- const Justify justifyContent = node->style().justifyContent();
-
- if (numberOfAutoMarginsOnCurrentLine == 0) {
- switch (justifyContent) {
- case Justify::Center:
- leadingMainDim = flexLine.layout.remainingFreeSpace / 2;
- break;
- case Justify::FlexEnd:
- leadingMainDim = flexLine.layout.remainingFreeSpace;
- break;
- case Justify::SpaceBetween:
- if (flexLine.itemsInFlow.size() > 1) {
- betweenMainDim +=
- yoga::maxOrDefined(flexLine.layout.remainingFreeSpace, 0.0f) /
- static_cast(flexLine.itemsInFlow.size() - 1);
- }
- break;
- case Justify::SpaceEvenly:
- // Space is distributed evenly across all elements
- leadingMainDim = flexLine.layout.remainingFreeSpace /
- static_cast(flexLine.itemsInFlow.size() + 1);
- betweenMainDim += leadingMainDim;
- break;
- case Justify::SpaceAround:
- // Space on the edges is half of the space between elements
- leadingMainDim = 0.5f * flexLine.layout.remainingFreeSpace /
- static_cast(flexLine.itemsInFlow.size());
- betweenMainDim += leadingMainDim * 2;
- break;
- case Justify::FlexStart:
- break;
- }
- }
-
- flexLine.layout.mainDim = leadingPaddingAndBorderMain + leadingMainDim;
- flexLine.layout.crossDim = 0;
-
- float maxAscentForCurrentLine = 0;
- float maxDescentForCurrentLine = 0;
- bool isNodeBaselineLayout = isBaselineLayout(node);
- for (size_t i = startOfLineIndex; i < flexLine.endOfLineIndex; i++) {
- const auto child = node->getChild(i);
- const Style& childStyle = child->style();
- const LayoutResults& childLayout = child->getLayout();
- if (childStyle.display() == Display::None) {
- continue;
- }
- if (childStyle.positionType() == PositionType::Absolute &&
- child->style().isFlexStartPositionDefined(mainAxis, direction)) {
- if (performLayout) {
- // In case the child is position absolute and has left/top being
- // defined, we override the position to whatever the user said (and
- // margin/border).
- child->setLayoutPosition(
- child->style().computeFlexStartPosition(
- mainAxis, direction, availableInnerMainDim) +
- node->style().computeFlexStartBorder(mainAxis, direction) +
- child->style().computeFlexStartMargin(
- mainAxis, direction, availableInnerWidth),
- flexStartEdge(mainAxis));
- }
- } else {
- // Now that we placed the element, we need to update the variables.
- // We need to do that only for relative elements. Absolute elements do not
- // take part in that phase.
- if (childStyle.positionType() != PositionType::Absolute) {
- if (child->style().flexStartMarginIsAuto(mainAxis, direction)) {
- flexLine.layout.mainDim += flexLine.layout.remainingFreeSpace /
- static_cast(numberOfAutoMarginsOnCurrentLine);
- }
-
- if (performLayout) {
- child->setLayoutPosition(
- childLayout.position(flexStartEdge(mainAxis)) +
- flexLine.layout.mainDim,
- flexStartEdge(mainAxis));
- }
-
- if (child != flexLine.itemsInFlow.back()) {
- flexLine.layout.mainDim += betweenMainDim;
- }
-
- if (child->style().flexEndMarginIsAuto(mainAxis, direction)) {
- flexLine.layout.mainDim += flexLine.layout.remainingFreeSpace /
- static_cast(numberOfAutoMarginsOnCurrentLine);
- }
- bool canSkipFlex =
- !performLayout && sizingModeCrossDim == SizingMode::StretchFit;
- if (canSkipFlex) {
- // If we skipped the flex step, then we can't rely on the measuredDims
- // because they weren't computed. This means we can't call
- // dimensionWithMargin.
- flexLine.layout.mainDim += child->style().computeMarginForAxis(
- mainAxis, availableInnerWidth) +
- childLayout.computedFlexBasis.unwrap();
- flexLine.layout.crossDim = availableInnerCrossDim;
- } else {
- // The main dimension is the sum of all the elements dimension plus
- // the spacing.
- flexLine.layout.mainDim +=
- child->dimensionWithMargin(mainAxis, availableInnerWidth);
-
- if (isNodeBaselineLayout) {
- // If the child is baseline aligned then the cross dimension is
- // calculated by adding maxAscent and maxDescent from the baseline.
- const float ascent = calculateBaseline(child) +
- child->style().computeFlexStartMargin(
- FlexDirection::Column, direction, availableInnerWidth);
- const float descent =
- child->getLayout().measuredDimension(Dimension::Height) +
- child->style().computeMarginForAxis(
- FlexDirection::Column, availableInnerWidth) -
- ascent;
-
- maxAscentForCurrentLine =
- yoga::maxOrDefined(maxAscentForCurrentLine, ascent);
- maxDescentForCurrentLine =
- yoga::maxOrDefined(maxDescentForCurrentLine, descent);
- } else {
- // The cross dimension is the max of the elements dimension since
- // there can only be one element in that cross dimension in the case
- // when the items are not baseline aligned
- flexLine.layout.crossDim = yoga::maxOrDefined(
- flexLine.layout.crossDim,
- child->dimensionWithMargin(crossAxis, availableInnerWidth));
- }
- }
- } else if (performLayout) {
- child->setLayoutPosition(
- childLayout.position(flexStartEdge(mainAxis)) +
- node->style().computeFlexStartBorder(mainAxis, direction) +
- leadingMainDim,
- flexStartEdge(mainAxis));
- }
- }
- }
- flexLine.layout.mainDim += trailingPaddingAndBorderMain;
-
- if (isNodeBaselineLayout) {
- flexLine.layout.crossDim =
- maxAscentForCurrentLine + maxDescentForCurrentLine;
- }
-}
-
-//
-// This is the main routine that implements a subset of the flexbox layout
-// algorithm described in the W3C CSS documentation:
-// https://www.w3.org/TR/CSS3-flexbox/.
-//
-// Limitations of this algorithm, compared to the full standard:
-// * Display property is always assumed to be 'flex' except for Text nodes,
-// which are assumed to be 'inline-flex'.
-// * The 'zIndex' property (or any form of z ordering) is not supported. Nodes
-// are stacked in document order.
-// * The 'order' property is not supported. The order of flex items is always
-// defined by document order.
-// * The 'visibility' property is always assumed to be 'visible'. Values of
-// 'collapse' and 'hidden' are not supported.
-// * There is no support for forced breaks.
-// * It does not support vertical inline directions (top-to-bottom or
-// bottom-to-top text).
-//
-// Deviations from standard:
-// * Section 4.5 of the spec indicates that all flex items have a default
-// minimum main size. For text blocks, for example, this is the width of the
-// widest word. Calculating the minimum width is expensive, so we forego it
-// and assume a default minimum main size of 0.
-// * Min/Max sizes in the main axis are not honored when resolving flexible
-// lengths.
-// * The spec indicates that the default value for 'flexDirection' is 'row',
-// but the algorithm below assumes a default of 'column'.
-//
-// Input parameters:
-// - node: current node to be sized and laid out
-// - availableWidth & availableHeight: available size to be used for sizing
-// the node or YGUndefined if the size is not available; interpretation
-// depends on layout flags
-// - ownerDirection: the inline (text) direction within the owner
-// (left-to-right or right-to-left)
-// - widthSizingMode: indicates the sizing rules for the width (see below
-// for explanation)
-// - heightSizingMode: indicates the sizing rules for the height (see below
-// for explanation)
-// - performLayout: specifies whether the caller is interested in just the
-// dimensions of the node or it requires the entire node and its subtree to
-// be laid out (with final positions)
-//
-// Details:
-// This routine is called recursively to lay out subtrees of flexbox
-// elements. It uses the information in node.style, which is treated as a
-// read-only input. It is responsible for setting the layout.direction and
-// layout.measuredDimensions fields for the input node as well as the
-// layout.position and layout.lineIndex fields for its child nodes. The
-// layout.measuredDimensions field includes any border or padding for the
-// node but does not include margins.
-//
-// When calling calculateLayoutImpl and calculateLayoutInternal, if the
-// caller passes an available size of undefined then it must also pass a
-// measure mode of SizingMode::MaxContent in that dimension.
-//
-static void calculateLayoutImpl(
- yoga::Node* const node,
- const float availableWidth,
- const float availableHeight,
- const Direction ownerDirection,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight,
- const bool performLayout,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount,
- const LayoutPassReason reason) {
- yoga::assertFatalWithNode(
- node,
- yoga::isUndefined(availableWidth)
- ? widthSizingMode == SizingMode::MaxContent
- : true,
- "availableWidth is indefinite so widthSizingMode must be "
- "SizingMode::MaxContent");
- yoga::assertFatalWithNode(
- node,
- yoga::isUndefined(availableHeight)
- ? heightSizingMode == SizingMode::MaxContent
- : true,
- "availableHeight is indefinite so heightSizingMode must be "
- "SizingMode::MaxContent");
-
- (performLayout ? layoutMarkerData.layouts : layoutMarkerData.measures) += 1;
-
- // Set the resolved resolution in the node's layout.
- const Direction direction = node->resolveDirection(ownerDirection);
- node->setLayoutDirection(direction);
-
- const FlexDirection flexRowDirection =
- resolveDirection(FlexDirection::Row, direction);
- const FlexDirection flexColumnDirection =
- resolveDirection(FlexDirection::Column, direction);
-
- const auto startEdge =
- direction == Direction::LTR ? PhysicalEdge::Left : PhysicalEdge::Right;
- const auto endEdge =
- direction == Direction::LTR ? PhysicalEdge::Right : PhysicalEdge::Left;
-
- const float marginRowLeading = node->style().computeInlineStartMargin(
- flexRowDirection, direction, ownerWidth);
- node->setLayoutMargin(marginRowLeading, startEdge);
- const float marginRowTrailing = node->style().computeInlineEndMargin(
- flexRowDirection, direction, ownerWidth);
- node->setLayoutMargin(marginRowTrailing, endEdge);
- const float marginColumnLeading = node->style().computeInlineStartMargin(
- flexColumnDirection, direction, ownerWidth);
- node->setLayoutMargin(marginColumnLeading, PhysicalEdge::Top);
- const float marginColumnTrailing = node->style().computeInlineEndMargin(
- flexColumnDirection, direction, ownerWidth);
- node->setLayoutMargin(marginColumnTrailing, PhysicalEdge::Bottom);
-
- const float marginAxisRow = marginRowLeading + marginRowTrailing;
- const float marginAxisColumn = marginColumnLeading + marginColumnTrailing;
-
- node->setLayoutBorder(
- node->style().computeInlineStartBorder(flexRowDirection, direction),
- startEdge);
- node->setLayoutBorder(
- node->style().computeInlineEndBorder(flexRowDirection, direction),
- endEdge);
- node->setLayoutBorder(
- node->style().computeInlineStartBorder(flexColumnDirection, direction),
- PhysicalEdge::Top);
- node->setLayoutBorder(
- node->style().computeInlineEndBorder(flexColumnDirection, direction),
- PhysicalEdge::Bottom);
-
- node->setLayoutPadding(
- node->style().computeInlineStartPadding(
- flexRowDirection, direction, ownerWidth),
- startEdge);
- node->setLayoutPadding(
- node->style().computeInlineEndPadding(
- flexRowDirection, direction, ownerWidth),
- endEdge);
- node->setLayoutPadding(
- node->style().computeInlineStartPadding(
- flexColumnDirection, direction, ownerWidth),
- PhysicalEdge::Top);
- node->setLayoutPadding(
- node->style().computeInlineEndPadding(
- flexColumnDirection, direction, ownerWidth),
- PhysicalEdge::Bottom);
-
- if (node->hasMeasureFunc()) {
- measureNodeWithMeasureFunc(
- node,
- availableWidth - marginAxisRow,
- availableHeight - marginAxisColumn,
- widthSizingMode,
- heightSizingMode,
- ownerWidth,
- ownerHeight,
- layoutMarkerData,
- reason);
- return;
- }
-
- const auto childCount = node->getChildCount();
- if (childCount == 0) {
- measureNodeWithoutChildren(
- node,
- availableWidth - marginAxisRow,
- availableHeight - marginAxisColumn,
- widthSizingMode,
- heightSizingMode,
- ownerWidth,
- ownerHeight);
- return;
- }
-
- // If we're not being asked to perform a full layout we can skip the algorithm
- // if we already know the size
- if (!performLayout &&
- measureNodeWithFixedSize(
- node,
- availableWidth - marginAxisRow,
- availableHeight - marginAxisColumn,
- widthSizingMode,
- heightSizingMode,
- ownerWidth,
- ownerHeight)) {
- return;
- }
-
- // At this point we know we're going to perform work. Ensure that each child
- // has a mutable copy.
- node->cloneChildrenIfNeeded();
- // Reset layout flags, as they could have changed.
- node->setLayoutHadOverflow(false);
-
- // STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
- const FlexDirection mainAxis =
- resolveDirection(node->style().flexDirection(), direction);
- const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
- const bool isMainAxisRow = isRow(mainAxis);
- const bool isNodeFlexWrap = node->style().flexWrap() != Wrap::NoWrap;
-
- const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight;
- const float crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth;
-
- const float paddingAndBorderAxisMain =
- paddingAndBorderForAxis(node, mainAxis, ownerWidth);
- const float paddingAndBorderAxisCross =
- paddingAndBorderForAxis(node, crossAxis, ownerWidth);
- const float leadingPaddingAndBorderCross =
- node->style().computeFlexStartPaddingAndBorder(
- crossAxis, direction, ownerWidth);
-
- SizingMode sizingModeMainDim =
- isMainAxisRow ? widthSizingMode : heightSizingMode;
- SizingMode sizingModeCrossDim =
- isMainAxisRow ? heightSizingMode : widthSizingMode;
-
- const float paddingAndBorderAxisRow =
- isMainAxisRow ? paddingAndBorderAxisMain : paddingAndBorderAxisCross;
- const float paddingAndBorderAxisColumn =
- isMainAxisRow ? paddingAndBorderAxisCross : paddingAndBorderAxisMain;
-
- // STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS
-
- float availableInnerWidth = calculateAvailableInnerDimension(
- node,
- Dimension::Width,
- availableWidth - marginAxisRow,
- paddingAndBorderAxisRow,
- ownerWidth);
- float availableInnerHeight = calculateAvailableInnerDimension(
- node,
- Dimension::Height,
- availableHeight - marginAxisColumn,
- paddingAndBorderAxisColumn,
- ownerHeight);
-
- float availableInnerMainDim =
- isMainAxisRow ? availableInnerWidth : availableInnerHeight;
- const float availableInnerCrossDim =
- isMainAxisRow ? availableInnerHeight : availableInnerWidth;
-
- // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM
-
- // Computed basis + margins + gap
- float totalMainDim = 0;
- totalMainDim += computeFlexBasisForChildren(
- node,
- availableInnerWidth,
- availableInnerHeight,
- widthSizingMode,
- heightSizingMode,
- direction,
- mainAxis,
- performLayout,
- layoutMarkerData,
- depth,
- generationCount);
-
- if (childCount > 1) {
- totalMainDim += node->style().computeGapForAxis(mainAxis) *
- static_cast(childCount - 1);
- }
-
- const bool mainAxisOverflows =
- (sizingModeMainDim != SizingMode::MaxContent) &&
- totalMainDim > availableInnerMainDim;
-
- if (isNodeFlexWrap && mainAxisOverflows &&
- sizingModeMainDim == SizingMode::FitContent) {
- sizingModeMainDim = SizingMode::StretchFit;
- }
- // STEP 4: COLLECT FLEX ITEMS INTO FLEX LINES
-
- // Indexes of children that represent the first and last items in the line.
- size_t startOfLineIndex = 0;
- size_t endOfLineIndex = 0;
-
- // Number of lines.
- size_t lineCount = 0;
-
- // Accumulated cross dimensions of all lines so far.
- float totalLineCrossDim = 0;
-
- const float crossAxisGap = node->style().computeGapForAxis(crossAxis);
-
- // Max main dimension of all the lines.
- float maxLineMainDim = 0;
- for (; endOfLineIndex < childCount;
- lineCount++, startOfLineIndex = endOfLineIndex) {
- auto flexLine = calculateFlexLine(
- node,
- ownerDirection,
- mainAxisownerSize,
- availableInnerWidth,
- availableInnerMainDim,
- startOfLineIndex,
- lineCount);
-
- endOfLineIndex = flexLine.endOfLineIndex;
-
- // If we don't need to measure the cross axis, we can skip the entire flex
- // step.
- const bool canSkipFlex =
- !performLayout && sizingModeCrossDim == SizingMode::StretchFit;
-
- // STEP 5: RESOLVING FLEXIBLE LENGTHS ON MAIN AXIS
- // Calculate the remaining available space that needs to be allocated. If
- // the main dimension size isn't known, it is computed based on the line
- // length, so there's no more space left to distribute.
-
- bool sizeBasedOnContent = false;
- // If we don't measure with exact main dimension we want to ensure we don't
- // violate min and max
- if (sizingModeMainDim != SizingMode::StretchFit) {
- const auto& style = node->style();
- const float minInnerWidth =
- style.minDimension(Dimension::Width).resolve(ownerWidth).unwrap() -
- paddingAndBorderAxisRow;
- const float maxInnerWidth =
- style.maxDimension(Dimension::Width).resolve(ownerWidth).unwrap() -
- paddingAndBorderAxisRow;
- const float minInnerHeight =
- style.minDimension(Dimension::Height).resolve(ownerHeight).unwrap() -
- paddingAndBorderAxisColumn;
- const float maxInnerHeight =
- style.maxDimension(Dimension::Height).resolve(ownerHeight).unwrap() -
- paddingAndBorderAxisColumn;
-
- const float minInnerMainDim =
- isMainAxisRow ? minInnerWidth : minInnerHeight;
- const float maxInnerMainDim =
- isMainAxisRow ? maxInnerWidth : maxInnerHeight;
-
- if (yoga::isDefined(minInnerMainDim) &&
- flexLine.sizeConsumed < minInnerMainDim) {
- availableInnerMainDim = minInnerMainDim;
- } else if (
- yoga::isDefined(maxInnerMainDim) &&
- flexLine.sizeConsumed > maxInnerMainDim) {
- availableInnerMainDim = maxInnerMainDim;
- } else {
- bool useLegacyStretchBehaviour =
- node->hasErrata(Errata::StretchFlexBasis);
-
- if (!useLegacyStretchBehaviour &&
- ((yoga::isDefined(flexLine.layout.totalFlexGrowFactors) &&
- flexLine.layout.totalFlexGrowFactors == 0) ||
- (yoga::isDefined(node->resolveFlexGrow()) &&
- node->resolveFlexGrow() == 0))) {
- // If we don't have any children to flex or we can't flex the node
- // itself, space we've used is all space we need. Root node also
- // should be shrunk to minimum
- availableInnerMainDim = flexLine.sizeConsumed;
- }
-
- sizeBasedOnContent = !useLegacyStretchBehaviour;
- }
- }
-
- if (!sizeBasedOnContent && yoga::isDefined(availableInnerMainDim)) {
- flexLine.layout.remainingFreeSpace =
- availableInnerMainDim - flexLine.sizeConsumed;
- } else if (flexLine.sizeConsumed < 0) {
- // availableInnerMainDim is indefinite which means the node is being sized
- // based on its content. sizeConsumed is negative which means
- // the node will allocate 0 points for its content. Consequently,
- // remainingFreeSpace is 0 - sizeConsumed.
- flexLine.layout.remainingFreeSpace = -flexLine.sizeConsumed;
- }
-
- if (!canSkipFlex) {
- resolveFlexibleLength(
- node,
- flexLine,
- mainAxis,
- crossAxis,
- direction,
- mainAxisownerSize,
- availableInnerMainDim,
- availableInnerCrossDim,
- availableInnerWidth,
- availableInnerHeight,
- mainAxisOverflows,
- sizingModeCrossDim,
- performLayout,
- layoutMarkerData,
- depth,
- generationCount);
- }
-
- node->setLayoutHadOverflow(
- node->getLayout().hadOverflow() ||
- (flexLine.layout.remainingFreeSpace < 0));
-
- // STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
-
- // At this point, all the children have their dimensions set in the main
- // axis. Their dimensions are also set in the cross axis with the exception
- // of items that are aligned "stretch". We need to compute these stretch
- // values and set the final positions.
-
- justifyMainAxis(
- node,
- flexLine,
- startOfLineIndex,
- mainAxis,
- crossAxis,
- direction,
- sizingModeMainDim,
- sizingModeCrossDim,
- mainAxisownerSize,
- ownerWidth,
- availableInnerMainDim,
- availableInnerCrossDim,
- availableInnerWidth,
- performLayout);
-
- float containerCrossAxis = availableInnerCrossDim;
- if (sizingModeCrossDim == SizingMode::MaxContent ||
- sizingModeCrossDim == SizingMode::FitContent) {
- // Compute the cross axis from the max cross dimension of the children.
- containerCrossAxis =
- boundAxis(
- node,
- crossAxis,
- flexLine.layout.crossDim + paddingAndBorderAxisCross,
- crossAxisownerSize,
- ownerWidth) -
- paddingAndBorderAxisCross;
- }
-
- // If there's no flex wrap, the cross dimension is defined by the container.
- if (!isNodeFlexWrap && sizingModeCrossDim == SizingMode::StretchFit) {
- flexLine.layout.crossDim = availableInnerCrossDim;
- }
-
- // As-per https://www.w3.org/TR/css-flexbox-1/#cross-sizing, the
- // cross-size of the line within a single-line container should be bound to
- // min/max constraints before alignment within the line. In a multi-line
- // container, affecting alignment between the lines.
- if (!isNodeFlexWrap) {
- flexLine.layout.crossDim =
- boundAxis(
- node,
- crossAxis,
- flexLine.layout.crossDim + paddingAndBorderAxisCross,
- crossAxisownerSize,
- ownerWidth) -
- paddingAndBorderAxisCross;
- }
-
- // STEP 7: CROSS-AXIS ALIGNMENT
- // We can skip child alignment if we're just measuring the container.
- if (performLayout) {
- for (size_t i = startOfLineIndex; i < endOfLineIndex; i++) {
- const auto child = node->getChild(i);
- if (child->style().display() == Display::None) {
- continue;
- }
- if (child->style().positionType() == PositionType::Absolute) {
- // If the child is absolutely positioned and has a
- // top/left/bottom/right set, override all the previously computed
- // positions to set it correctly.
- const bool isChildLeadingPosDefined =
- child->style().isFlexStartPositionDefined(crossAxis, direction);
- if (isChildLeadingPosDefined) {
- child->setLayoutPosition(
- child->style().computeFlexStartPosition(
- crossAxis, direction, availableInnerCrossDim) +
- node->style().computeFlexStartBorder(crossAxis, direction) +
- child->style().computeFlexStartMargin(
- crossAxis, direction, availableInnerWidth),
- flexStartEdge(crossAxis));
- }
- // If leading position is not defined or calculations result in Nan,
- // default to border + margin
- if (!isChildLeadingPosDefined ||
- yoga::isUndefined(
- child->getLayout().position(flexStartEdge(crossAxis)))) {
- child->setLayoutPosition(
- node->style().computeFlexStartBorder(crossAxis, direction) +
- child->style().computeFlexStartMargin(
- crossAxis, direction, availableInnerWidth),
- flexStartEdge(crossAxis));
- }
- } else {
- float leadingCrossDim = leadingPaddingAndBorderCross;
-
- // For a relative children, we're either using alignItems (owner) or
- // alignSelf (child) in order to determine the position in the cross
- // axis
- const Align alignItem = resolveChildAlignment(node, child);
-
- // If the child uses align stretch, we need to lay it out one more
- // time, this time forcing the cross-axis size to be the computed
- // cross size for the current line.
- if (alignItem == Align::Stretch &&
- !child->style().flexStartMarginIsAuto(crossAxis, direction) &&
- !child->style().flexEndMarginIsAuto(crossAxis, direction)) {
- // If the child defines a definite size for its cross axis, there's
- // no need to stretch.
- if (!child->hasDefiniteLength(
- dimension(crossAxis), availableInnerCrossDim)) {
- float childMainSize =
- child->getLayout().measuredDimension(dimension(mainAxis));
- const auto& childStyle = child->style();
- float childCrossSize = childStyle.aspectRatio().isDefined()
- ? child->style().computeMarginForAxis(
- crossAxis, availableInnerWidth) +
- (isMainAxisRow
- ? childMainSize / childStyle.aspectRatio().unwrap()
- : childMainSize * childStyle.aspectRatio().unwrap())
- : flexLine.layout.crossDim;
-
- childMainSize += child->style().computeMarginForAxis(
- mainAxis, availableInnerWidth);
-
- SizingMode childMainSizingMode = SizingMode::StretchFit;
- SizingMode childCrossSizingMode = SizingMode::StretchFit;
- constrainMaxSizeForMode(
- child,
- mainAxis,
- availableInnerMainDim,
- availableInnerWidth,
- &childMainSizingMode,
- &childMainSize);
- constrainMaxSizeForMode(
- child,
- crossAxis,
- availableInnerCrossDim,
- availableInnerWidth,
- &childCrossSizingMode,
- &childCrossSize);
-
- const float childWidth =
- isMainAxisRow ? childMainSize : childCrossSize;
- const float childHeight =
- !isMainAxisRow ? childMainSize : childCrossSize;
-
- auto alignContent = node->style().alignContent();
- auto crossAxisDoesNotGrow =
- alignContent != Align::Stretch && isNodeFlexWrap;
- const SizingMode childWidthSizingMode =
- yoga::isUndefined(childWidth) ||
- (!isMainAxisRow && crossAxisDoesNotGrow)
- ? SizingMode::MaxContent
- : SizingMode::StretchFit;
- const SizingMode childHeightSizingMode =
- yoga::isUndefined(childHeight) ||
- (isMainAxisRow && crossAxisDoesNotGrow)
- ? SizingMode::MaxContent
- : SizingMode::StretchFit;
-
- calculateLayoutInternal(
- child,
- childWidth,
- childHeight,
- direction,
- childWidthSizingMode,
- childHeightSizingMode,
- availableInnerWidth,
- availableInnerHeight,
- true,
- LayoutPassReason::kStretch,
- layoutMarkerData,
- depth,
- generationCount);
- }
- } else {
- const float remainingCrossDim = containerCrossAxis -
- child->dimensionWithMargin(crossAxis, availableInnerWidth);
-
- if (child->style().flexStartMarginIsAuto(crossAxis, direction) &&
- child->style().flexEndMarginIsAuto(crossAxis, direction)) {
- leadingCrossDim +=
- yoga::maxOrDefined(0.0f, remainingCrossDim / 2);
- } else if (child->style().flexEndMarginIsAuto(
- crossAxis, direction)) {
- // No-Op
- } else if (child->style().flexStartMarginIsAuto(
- crossAxis, direction)) {
- leadingCrossDim += yoga::maxOrDefined(0.0f, remainingCrossDim);
- } else if (alignItem == Align::FlexStart) {
- // No-Op
- } else if (alignItem == Align::Center) {
- leadingCrossDim += remainingCrossDim / 2;
- } else {
- leadingCrossDim += remainingCrossDim;
- }
- }
- // And we apply the position
- child->setLayoutPosition(
- child->getLayout().position(flexStartEdge(crossAxis)) +
- totalLineCrossDim + leadingCrossDim,
- flexStartEdge(crossAxis));
- }
- }
- }
-
- const float appliedCrossGap = lineCount != 0 ? crossAxisGap : 0.0f;
- totalLineCrossDim += flexLine.layout.crossDim + appliedCrossGap;
- maxLineMainDim =
- yoga::maxOrDefined(maxLineMainDim, flexLine.layout.mainDim);
- }
-
- // STEP 8: MULTI-LINE CONTENT ALIGNMENT
- // currentLead stores the size of the cross dim
- if (performLayout && (isNodeFlexWrap || isBaselineLayout(node))) {
- float leadPerLine = 0;
- float currentLead = leadingPaddingAndBorderCross;
-
- const float unclampedCrossDim = sizingModeCrossDim == SizingMode::StretchFit
- ? availableInnerCrossDim + paddingAndBorderAxisCross
- : node->hasDefiniteLength(dimension(crossAxis), crossAxisownerSize)
- ? node->getResolvedDimension(dimension(crossAxis))
- .resolve(crossAxisownerSize)
- .unwrap()
- : totalLineCrossDim + paddingAndBorderAxisCross;
-
- const float innerCrossDim =
- boundAxis(node, crossAxis, unclampedCrossDim, ownerHeight, ownerWidth) -
- paddingAndBorderAxisCross;
-
- const float remainingAlignContentDim = innerCrossDim - totalLineCrossDim;
- switch (node->style().alignContent()) {
- case Align::FlexEnd:
- currentLead += remainingAlignContentDim;
- break;
- case Align::Center:
- currentLead += remainingAlignContentDim / 2;
- break;
- case Align::Stretch:
- if (innerCrossDim > totalLineCrossDim) {
- leadPerLine =
- remainingAlignContentDim / static_cast(lineCount);
- }
- break;
- case Align::SpaceAround:
- if (innerCrossDim > totalLineCrossDim) {
- currentLead +=
- remainingAlignContentDim / (2 * static_cast(lineCount));
- leadPerLine =
- remainingAlignContentDim / static_cast(lineCount);
- } else {
- currentLead += remainingAlignContentDim / 2;
- }
- break;
- case Align::SpaceEvenly:
- if (innerCrossDim > totalLineCrossDim) {
- currentLead +=
- remainingAlignContentDim / static_cast(lineCount + 1);
- leadPerLine =
- remainingAlignContentDim / static_cast(lineCount + 1);
- } else {
- currentLead += remainingAlignContentDim / 2;
- }
- break;
- case Align::SpaceBetween:
- if (innerCrossDim > totalLineCrossDim && lineCount > 1) {
- leadPerLine =
- remainingAlignContentDim / static_cast(lineCount - 1);
- }
- break;
- case Align::Auto:
- case Align::FlexStart:
- case Align::Baseline:
- break;
- }
- size_t endIndex = 0;
- for (size_t i = 0; i < lineCount; i++) {
- const size_t startIndex = endIndex;
- size_t ii;
-
- // compute the line's height and find the endIndex
- float lineHeight = 0;
- float maxAscentForCurrentLine = 0;
- float maxDescentForCurrentLine = 0;
- for (ii = startIndex; ii < childCount; ii++) {
- const auto child = node->getChild(ii);
- if (child->style().display() == Display::None) {
- continue;
- }
- if (child->style().positionType() != PositionType::Absolute) {
- if (child->getLineIndex() != i) {
- break;
- }
- if (child->isLayoutDimensionDefined(crossAxis)) {
- lineHeight = yoga::maxOrDefined(
- lineHeight,
- child->getLayout().measuredDimension(dimension(crossAxis)) +
- child->style().computeMarginForAxis(
- crossAxis, availableInnerWidth));
- }
- if (resolveChildAlignment(node, child) == Align::Baseline) {
- const float ascent = calculateBaseline(child) +
- child->style().computeFlexStartMargin(
- FlexDirection::Column, direction, availableInnerWidth);
- const float descent =
- child->getLayout().measuredDimension(Dimension::Height) +
- child->style().computeMarginForAxis(
- FlexDirection::Column, availableInnerWidth) -
- ascent;
- maxAscentForCurrentLine =
- yoga::maxOrDefined(maxAscentForCurrentLine, ascent);
- maxDescentForCurrentLine =
- yoga::maxOrDefined(maxDescentForCurrentLine, descent);
- lineHeight = yoga::maxOrDefined(
- lineHeight, maxAscentForCurrentLine + maxDescentForCurrentLine);
- }
- }
- }
- endIndex = ii;
- currentLead += i != 0 ? crossAxisGap : 0;
-
- if (performLayout) {
- for (ii = startIndex; ii < endIndex; ii++) {
- const auto child = node->getChild(ii);
- if (child->style().display() == Display::None) {
- continue;
- }
- if (child->style().positionType() != PositionType::Absolute) {
- switch (resolveChildAlignment(node, child)) {
- case Align::FlexStart: {
- child->setLayoutPosition(
- currentLead +
- child->style().computeFlexStartPosition(
- crossAxis, direction, availableInnerWidth),
- flexStartEdge(crossAxis));
- break;
- }
- case Align::FlexEnd: {
- child->setLayoutPosition(
- currentLead + lineHeight -
- child->style().computeFlexEndMargin(
- crossAxis, direction, availableInnerWidth) -
- child->getLayout().measuredDimension(
- dimension(crossAxis)),
- flexStartEdge(crossAxis));
- break;
- }
- case Align::Center: {
- float childHeight =
- child->getLayout().measuredDimension(dimension(crossAxis));
-
- child->setLayoutPosition(
- currentLead + (lineHeight - childHeight) / 2,
- flexStartEdge(crossAxis));
- break;
- }
- case Align::Stretch: {
- child->setLayoutPosition(
- currentLead +
- child->style().computeFlexStartMargin(
- crossAxis, direction, availableInnerWidth),
- flexStartEdge(crossAxis));
-
- // Remeasure child with the line height as it as been only
- // measured with the owners height yet.
- if (!child->hasDefiniteLength(
- dimension(crossAxis), availableInnerCrossDim)) {
- const float childWidth = isMainAxisRow
- ? (child->getLayout().measuredDimension(
- Dimension::Width) +
- child->style().computeMarginForAxis(
- mainAxis, availableInnerWidth))
- : leadPerLine + lineHeight;
-
- const float childHeight = !isMainAxisRow
- ? (child->getLayout().measuredDimension(
- Dimension::Height) +
- child->style().computeMarginForAxis(
- crossAxis, availableInnerWidth))
- : leadPerLine + lineHeight;
-
- if (!(yoga::inexactEquals(
- childWidth,
- child->getLayout().measuredDimension(
- Dimension::Width)) &&
- yoga::inexactEquals(
- childHeight,
- child->getLayout().measuredDimension(
- Dimension::Height)))) {
- calculateLayoutInternal(
- child,
- childWidth,
- childHeight,
- direction,
- SizingMode::StretchFit,
- SizingMode::StretchFit,
- availableInnerWidth,
- availableInnerHeight,
- true,
- LayoutPassReason::kMultilineStretch,
- layoutMarkerData,
- depth,
- generationCount);
- }
- }
- break;
- }
- case Align::Baseline: {
- child->setLayoutPosition(
- currentLead + maxAscentForCurrentLine -
- calculateBaseline(child) +
- child->style().computeFlexStartPosition(
- FlexDirection::Column,
- direction,
- availableInnerCrossDim),
- PhysicalEdge::Top);
-
- break;
- }
- case Align::Auto:
- case Align::SpaceBetween:
- case Align::SpaceAround:
- case Align::SpaceEvenly:
- break;
- }
- }
- }
- }
- currentLead = currentLead + leadPerLine + lineHeight;
- }
- }
-
- // STEP 9: COMPUTING FINAL DIMENSIONS
-
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Row,
- availableWidth - marginAxisRow,
- ownerWidth,
- ownerWidth),
- Dimension::Width);
-
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- FlexDirection::Column,
- availableHeight - marginAxisColumn,
- ownerHeight,
- ownerWidth),
- Dimension::Height);
-
- // If the user didn't specify a width or height for the node, set the
- // dimensions based on the children.
- if (sizingModeMainDim == SizingMode::MaxContent ||
- (node->style().overflow() != Overflow::Scroll &&
- sizingModeMainDim == SizingMode::FitContent)) {
- // Clamp the size to the min/max size, if specified, and make sure it
- // doesn't go below the padding and border amount.
- node->setLayoutMeasuredDimension(
- boundAxis(
- node, mainAxis, maxLineMainDim, mainAxisownerSize, ownerWidth),
- dimension(mainAxis));
-
- } else if (
- sizingModeMainDim == SizingMode::FitContent &&
- node->style().overflow() == Overflow::Scroll) {
- node->setLayoutMeasuredDimension(
- yoga::maxOrDefined(
- yoga::minOrDefined(
- availableInnerMainDim + paddingAndBorderAxisMain,
- boundAxisWithinMinAndMax(
- node,
- mainAxis,
- FloatOptional{maxLineMainDim},
- mainAxisownerSize)
- .unwrap()),
- paddingAndBorderAxisMain),
- dimension(mainAxis));
- }
-
- if (sizingModeCrossDim == SizingMode::MaxContent ||
- (node->style().overflow() != Overflow::Scroll &&
- sizingModeCrossDim == SizingMode::FitContent)) {
- // Clamp the size to the min/max size, if specified, and make sure it
- // doesn't go below the padding and border amount.
- node->setLayoutMeasuredDimension(
- boundAxis(
- node,
- crossAxis,
- totalLineCrossDim + paddingAndBorderAxisCross,
- crossAxisownerSize,
- ownerWidth),
- dimension(crossAxis));
-
- } else if (
- sizingModeCrossDim == SizingMode::FitContent &&
- node->style().overflow() == Overflow::Scroll) {
- node->setLayoutMeasuredDimension(
- yoga::maxOrDefined(
- yoga::minOrDefined(
- availableInnerCrossDim + paddingAndBorderAxisCross,
- boundAxisWithinMinAndMax(
- node,
- crossAxis,
- FloatOptional{
- totalLineCrossDim + paddingAndBorderAxisCross},
- crossAxisownerSize)
- .unwrap()),
- paddingAndBorderAxisCross),
- dimension(crossAxis));
- }
-
- // As we only wrapped in normal direction yet, we need to reverse the
- // positions on wrap-reverse.
- if (performLayout && node->style().flexWrap() == Wrap::WrapReverse) {
- for (size_t i = 0; i < childCount; i++) {
- const auto child = node->getChild(i);
- if (child->style().positionType() != PositionType::Absolute) {
- child->setLayoutPosition(
- node->getLayout().measuredDimension(dimension(crossAxis)) -
- child->getLayout().position(flexStartEdge(crossAxis)) -
- child->getLayout().measuredDimension(dimension(crossAxis)),
- flexStartEdge(crossAxis));
- }
- }
- }
-
- if (performLayout) {
- // STEP 10: SETTING TRAILING POSITIONS FOR CHILDREN
- const bool needsMainTrailingPos = needsTrailingPosition(mainAxis);
- const bool needsCrossTrailingPos = needsTrailingPosition(crossAxis);
-
- if (needsMainTrailingPos || needsCrossTrailingPos) {
- for (size_t i = 0; i < childCount; i++) {
- const auto child = node->getChild(i);
- // Absolute children will be handled by their containing block since we
- // cannot guarantee that their positions are set when their parents are
- // done with layout.
- if (child->style().display() == Display::None ||
- child->style().positionType() == PositionType::Absolute) {
- continue;
- }
- if (needsMainTrailingPos) {
- setChildTrailingPosition(node, child, mainAxis);
- }
-
- if (needsCrossTrailingPos) {
- setChildTrailingPosition(node, child, crossAxis);
- }
- }
- }
-
- // STEP 11: SIZING AND POSITIONING ABSOLUTE CHILDREN
- // Let the containing block layout its absolute descendants.
- if (node->style().positionType() != PositionType::Static ||
- node->alwaysFormsContainingBlock() || depth == 1) {
- layoutAbsoluteDescendants(
- node,
- node,
- isMainAxisRow ? sizingModeMainDim : sizingModeCrossDim,
- direction,
- layoutMarkerData,
- depth,
- generationCount,
- 0.0f,
- 0.0f,
- availableInnerWidth,
- availableInnerHeight);
- }
- }
-}
-
-//
-// This is a wrapper around the calculateLayoutImpl function. It determines
-// whether the layout request is redundant and can be skipped.
-//
-// Parameters:
-// Input parameters are the same as calculateLayoutImpl (see above)
-// Return parameter is true if layout was performed, false if skipped
-//
-bool calculateLayoutInternal(
- yoga::Node* const node,
- const float availableWidth,
- const float availableHeight,
- const Direction ownerDirection,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight,
- const bool performLayout,
- const LayoutPassReason reason,
- LayoutData& layoutMarkerData,
- uint32_t depth,
- const uint32_t generationCount) {
- LayoutResults* layout = &node->getLayout();
-
- depth++;
-
- const bool needToVisitNode =
- (node->isDirty() && layout->generationCount != generationCount) ||
- layout->lastOwnerDirection != ownerDirection;
-
- if (needToVisitNode) {
- // Invalidate the cached results.
- layout->nextCachedMeasurementsIndex = 0;
- layout->cachedLayout.availableWidth = -1;
- layout->cachedLayout.availableHeight = -1;
- layout->cachedLayout.widthSizingMode = SizingMode::MaxContent;
- layout->cachedLayout.heightSizingMode = SizingMode::MaxContent;
- layout->cachedLayout.computedWidth = -1;
- layout->cachedLayout.computedHeight = -1;
- }
-
- CachedMeasurement* cachedResults = nullptr;
-
- // Determine whether the results are already cached. We maintain a separate
- // cache for layouts and measurements. A layout operation modifies the
- // positions and dimensions for nodes in the subtree. The algorithm assumes
- // that each node gets laid out a maximum of one time per tree layout, but
- // multiple measurements may be required to resolve all of the flex
- // dimensions. We handle nodes with measure functions specially here because
- // they are the most expensive to measure, so it's worth avoiding redundant
- // measurements if at all possible.
- if (node->hasMeasureFunc()) {
- const float marginAxisRow =
- node->style().computeMarginForAxis(FlexDirection::Row, ownerWidth);
- const float marginAxisColumn =
- node->style().computeMarginForAxis(FlexDirection::Column, ownerWidth);
-
- // First, try to use the layout cache.
- if (canUseCachedMeasurement(
- widthSizingMode,
- availableWidth,
- heightSizingMode,
- availableHeight,
- layout->cachedLayout.widthSizingMode,
- layout->cachedLayout.availableWidth,
- layout->cachedLayout.heightSizingMode,
- layout->cachedLayout.availableHeight,
- layout->cachedLayout.computedWidth,
- layout->cachedLayout.computedHeight,
- marginAxisRow,
- marginAxisColumn,
- node->getConfig())) {
- cachedResults = &layout->cachedLayout;
- } else {
- // Try to use the measurement cache.
- for (size_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
- if (canUseCachedMeasurement(
- widthSizingMode,
- availableWidth,
- heightSizingMode,
- availableHeight,
- layout->cachedMeasurements[i].widthSizingMode,
- layout->cachedMeasurements[i].availableWidth,
- layout->cachedMeasurements[i].heightSizingMode,
- layout->cachedMeasurements[i].availableHeight,
- layout->cachedMeasurements[i].computedWidth,
- layout->cachedMeasurements[i].computedHeight,
- marginAxisRow,
- marginAxisColumn,
- node->getConfig())) {
- cachedResults = &layout->cachedMeasurements[i];
- break;
- }
- }
- }
- } else if (performLayout) {
- if (yoga::inexactEquals(
- layout->cachedLayout.availableWidth, availableWidth) &&
- yoga::inexactEquals(
- layout->cachedLayout.availableHeight, availableHeight) &&
- layout->cachedLayout.widthSizingMode == widthSizingMode &&
- layout->cachedLayout.heightSizingMode == heightSizingMode) {
- cachedResults = &layout->cachedLayout;
- }
- } else {
- for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
- if (yoga::inexactEquals(
- layout->cachedMeasurements[i].availableWidth, availableWidth) &&
- yoga::inexactEquals(
- layout->cachedMeasurements[i].availableHeight, availableHeight) &&
- layout->cachedMeasurements[i].widthSizingMode == widthSizingMode &&
- layout->cachedMeasurements[i].heightSizingMode == heightSizingMode) {
- cachedResults = &layout->cachedMeasurements[i];
- break;
- }
- }
- }
-
- if (!needToVisitNode && cachedResults != nullptr) {
- layout->setMeasuredDimension(
- Dimension::Width, cachedResults->computedWidth);
- layout->setMeasuredDimension(
- Dimension::Height, cachedResults->computedHeight);
-
- (performLayout ? layoutMarkerData.cachedLayouts
- : layoutMarkerData.cachedMeasures) += 1;
- } else {
- calculateLayoutImpl(
- node,
- availableWidth,
- availableHeight,
- ownerDirection,
- widthSizingMode,
- heightSizingMode,
- ownerWidth,
- ownerHeight,
- performLayout,
- layoutMarkerData,
- depth,
- generationCount,
- reason);
-
- layout->lastOwnerDirection = ownerDirection;
-
- if (cachedResults == nullptr) {
- layoutMarkerData.maxMeasureCache = std::max(
- layoutMarkerData.maxMeasureCache,
- layout->nextCachedMeasurementsIndex + 1u);
-
- if (layout->nextCachedMeasurementsIndex ==
- LayoutResults::MaxCachedMeasurements) {
- layout->nextCachedMeasurementsIndex = 0;
- }
-
- CachedMeasurement* newCacheEntry;
- if (performLayout) {
- // Use the single layout cache entry.
- newCacheEntry = &layout->cachedLayout;
- } else {
- // Allocate a new measurement cache entry.
- newCacheEntry =
- &layout->cachedMeasurements[layout->nextCachedMeasurementsIndex];
- layout->nextCachedMeasurementsIndex++;
- }
-
- newCacheEntry->availableWidth = availableWidth;
- newCacheEntry->availableHeight = availableHeight;
- newCacheEntry->widthSizingMode = widthSizingMode;
- newCacheEntry->heightSizingMode = heightSizingMode;
- newCacheEntry->computedWidth =
- layout->measuredDimension(Dimension::Width);
- newCacheEntry->computedHeight =
- layout->measuredDimension(Dimension::Height);
- }
- }
-
- if (performLayout) {
- node->setLayoutDimension(
- node->getLayout().measuredDimension(Dimension::Width),
- Dimension::Width);
- node->setLayoutDimension(
- node->getLayout().measuredDimension(Dimension::Height),
- Dimension::Height);
-
- node->setHasNewLayout(true);
- node->setDirty(false);
- }
-
- layout->generationCount = generationCount;
-
- LayoutType layoutType;
- if (performLayout) {
- layoutType = !needToVisitNode && cachedResults == &layout->cachedLayout
- ? LayoutType::kCachedLayout
- : LayoutType::kLayout;
- } else {
- layoutType = cachedResults != nullptr ? LayoutType::kCachedMeasure
- : LayoutType::kMeasure;
- }
- Event::publish(node, {layoutType});
-
- return (needToVisitNode || cachedResults == nullptr);
-}
-
-void calculateLayout(
- yoga::Node* const node,
- const float ownerWidth,
- const float ownerHeight,
- const Direction ownerDirection) {
- Event::publish(node);
- LayoutData markerData = {};
-
- // Increment the generation count. This will force the recursive routine to
- // visit all dirty nodes at least once. Subsequent visits will be skipped if
- // the input parameters don't change.
- gCurrentGenerationCount.fetch_add(1, std::memory_order_relaxed);
- node->resolveDimension();
- float width = YGUndefined;
- SizingMode widthSizingMode = SizingMode::MaxContent;
- const auto& style = node->style();
- if (node->hasDefiniteLength(Dimension::Width, ownerWidth)) {
- width =
- (node->getResolvedDimension(dimension(FlexDirection::Row))
- .resolve(ownerWidth)
- .unwrap() +
- node->style().computeMarginForAxis(FlexDirection::Row, ownerWidth));
- widthSizingMode = SizingMode::StretchFit;
- } else if (style.maxDimension(Dimension::Width)
- .resolve(ownerWidth)
- .isDefined()) {
- width = style.maxDimension(Dimension::Width).resolve(ownerWidth).unwrap();
- widthSizingMode = SizingMode::FitContent;
- } else {
- width = ownerWidth;
- widthSizingMode = yoga::isUndefined(width) ? SizingMode::MaxContent
- : SizingMode::StretchFit;
- }
-
- float height = YGUndefined;
- SizingMode heightSizingMode = SizingMode::MaxContent;
- if (node->hasDefiniteLength(Dimension::Height, ownerHeight)) {
- height =
- (node->getResolvedDimension(dimension(FlexDirection::Column))
- .resolve(ownerHeight)
- .unwrap() +
- node->style().computeMarginForAxis(FlexDirection::Column, ownerWidth));
- heightSizingMode = SizingMode::StretchFit;
- } else if (style.maxDimension(Dimension::Height)
- .resolve(ownerHeight)
- .isDefined()) {
- height =
- style.maxDimension(Dimension::Height).resolve(ownerHeight).unwrap();
- heightSizingMode = SizingMode::FitContent;
- } else {
- height = ownerHeight;
- heightSizingMode = yoga::isUndefined(height) ? SizingMode::MaxContent
- : SizingMode::StretchFit;
- }
- if (calculateLayoutInternal(
- node,
- width,
- height,
- ownerDirection,
- widthSizingMode,
- heightSizingMode,
- ownerWidth,
- ownerHeight,
- true,
- LayoutPassReason::kInitial,
- markerData,
- 0, // tree root
- gCurrentGenerationCount.load(std::memory_order_relaxed))) {
- node->setPosition(
- node->getLayout().direction(), ownerWidth, ownerHeight, ownerWidth);
- roundLayoutResultsToPixelGrid(node, 0.0f, 0.0f);
- }
-
- Event::publish(node, {&markerData});
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_CalculateLayout.h b/Sources/yoga/Algorithm_CalculateLayout.h
deleted file mode 100644
index af0ba734..00000000
--- a/Sources/yoga/Algorithm_CalculateLayout.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-#include "Algorithm_FlexDirection.h"
-#include "Event_event.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-void calculateLayout(
- yoga::Node* const node,
- const float ownerWidth,
- const float ownerHeight,
- const Direction ownerDirection);
-
-bool calculateLayoutInternal(
- yoga::Node* const node,
- const float availableWidth,
- const float availableHeight,
- const Direction ownerDirection,
- const SizingMode widthSizingMode,
- const SizingMode heightSizingMode,
- const float ownerWidth,
- const float ownerHeight,
- const bool performLayout,
- const LayoutPassReason reason,
- LayoutData& layoutMarkerData,
- const uint32_t depth,
- const uint32_t generationCount);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_FlexDirection.h b/Sources/yoga/Algorithm_FlexDirection.h
deleted file mode 100644
index cdb9ccba..00000000
--- a/Sources/yoga/Algorithm_FlexDirection.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-
-#include "Debug_AssertFatal.h"
-#include "Enums_Dimension.h"
-#include "Enums_Direction.h"
-#include "Enums_Edge.h"
-#include "Enums_FlexDirection.h"
-#include "Enums_PhysicalEdge.h"
-
-namespace facebook::yoga {
-
-inline bool isRow(const FlexDirection flexDirection) {
- return flexDirection == FlexDirection::Row ||
- flexDirection == FlexDirection::RowReverse;
-}
-
-inline bool isColumn(const FlexDirection flexDirection) {
- return flexDirection == FlexDirection::Column ||
- flexDirection == FlexDirection::ColumnReverse;
-}
-
-inline FlexDirection resolveDirection(
- const FlexDirection flexDirection,
- const Direction direction) {
- if (direction == Direction::RTL) {
- if (flexDirection == FlexDirection::Row) {
- return FlexDirection::RowReverse;
- } else if (flexDirection == FlexDirection::RowReverse) {
- return FlexDirection::Row;
- }
- }
-
- return flexDirection;
-}
-
-inline FlexDirection resolveCrossDirection(
- const FlexDirection flexDirection,
- const Direction direction) {
- return isColumn(flexDirection)
- ? resolveDirection(FlexDirection::Row, direction)
- : FlexDirection::Column;
-}
-
-inline PhysicalEdge flexStartEdge(FlexDirection flexDirection) {
- switch (flexDirection) {
- case FlexDirection::Column:
- return PhysicalEdge::Top;
- case FlexDirection::ColumnReverse:
- return PhysicalEdge::Bottom;
- case FlexDirection::Row:
- return PhysicalEdge::Left;
- case FlexDirection::RowReverse:
- return PhysicalEdge::Right;
- }
-
- fatalWithMessage("Invalid FlexDirection");
-}
-
-inline PhysicalEdge flexEndEdge(FlexDirection flexDirection) {
- switch (flexDirection) {
- case FlexDirection::Column:
- return PhysicalEdge::Bottom;
- case FlexDirection::ColumnReverse:
- return PhysicalEdge::Top;
- case FlexDirection::Row:
- return PhysicalEdge::Right;
- case FlexDirection::RowReverse:
- return PhysicalEdge::Left;
- }
-
- fatalWithMessage("Invalid FlexDirection");
-}
-
-inline PhysicalEdge inlineStartEdge(
- FlexDirection flexDirection,
- Direction direction) {
- if (isRow(flexDirection)) {
- return direction == Direction::RTL ? PhysicalEdge::Right
- : PhysicalEdge::Left;
- }
-
- return PhysicalEdge::Top;
-}
-
-inline PhysicalEdge inlineEndEdge(
- FlexDirection flexDirection,
- Direction direction) {
- if (isRow(flexDirection)) {
- return direction == Direction::RTL ? PhysicalEdge::Left
- : PhysicalEdge::Right;
- }
-
- return PhysicalEdge::Bottom;
-}
-
-inline Dimension dimension(FlexDirection flexDirection) {
- switch (flexDirection) {
- case FlexDirection::Column:
- return Dimension::Height;
- case FlexDirection::ColumnReverse:
- return Dimension::Height;
- case FlexDirection::Row:
- return Dimension::Width;
- case FlexDirection::RowReverse:
- return Dimension::Width;
- }
-
- fatalWithMessage("Invalid FlexDirection");
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_FlexLine.cpp b/Sources/yoga/Algorithm_FlexLine.cpp
deleted file mode 100644
index b16ba96d..00000000
--- a/Sources/yoga/Algorithm_FlexLine.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Yoga.h"
-
-#include "Algorithm_BoundAxis.h"
-#include "Algorithm_FlexDirection.h"
-#include "Algorithm_FlexLine.h"
-
-namespace facebook::yoga {
-
-FlexLine calculateFlexLine(
- yoga::Node* const node,
- const Direction ownerDirection,
- const float mainAxisownerSize,
- const float availableInnerWidth,
- const float availableInnerMainDim,
- const size_t startOfLineIndex,
- const size_t lineCount) {
- std::vector itemsInFlow;
- itemsInFlow.reserve(node->getChildren().size());
-
- float sizeConsumed = 0.0f;
- float totalFlexGrowFactors = 0.0f;
- float totalFlexShrinkScaledFactors = 0.0f;
- size_t endOfLineIndex = startOfLineIndex;
- size_t firstElementInLineIndex = startOfLineIndex;
-
- float sizeConsumedIncludingMinConstraint = 0;
- const FlexDirection mainAxis = resolveDirection(
- node->style().flexDirection(), node->resolveDirection(ownerDirection));
- const bool isNodeFlexWrap = node->style().flexWrap() != Wrap::NoWrap;
- const float gap = node->style().computeGapForAxis(mainAxis);
-
- // Add items to the current line until it's full or we run out of items.
- for (; endOfLineIndex < node->getChildren().size(); endOfLineIndex++) {
- auto child = node->getChild(endOfLineIndex);
- if (child->style().display() == Display::None ||
- child->style().positionType() == PositionType::Absolute) {
- if (firstElementInLineIndex == endOfLineIndex) {
- // We haven't found the first contributing element in the line yet.
- firstElementInLineIndex++;
- }
- continue;
- }
-
- const bool isFirstElementInLine =
- (endOfLineIndex - firstElementInLineIndex) == 0;
-
- child->setLineIndex(lineCount);
- const float childMarginMainAxis =
- child->style().computeMarginForAxis(mainAxis, availableInnerWidth);
- const float childLeadingGapMainAxis = isFirstElementInLine ? 0.0f : gap;
- const float flexBasisWithMinAndMaxConstraints =
- boundAxisWithinMinAndMax(
- child,
- mainAxis,
- child->getLayout().computedFlexBasis,
- mainAxisownerSize)
- .unwrap();
-
- // If this is a multi-line flow and this item pushes us over the available
- // size, we've hit the end of the current line. Break out of the loop and
- // lay out the current line.
- if (sizeConsumedIncludingMinConstraint + flexBasisWithMinAndMaxConstraints +
- childMarginMainAxis + childLeadingGapMainAxis >
- availableInnerMainDim &&
- isNodeFlexWrap && itemsInFlow.size() > 0) {
- break;
- }
-
- sizeConsumedIncludingMinConstraint += flexBasisWithMinAndMaxConstraints +
- childMarginMainAxis + childLeadingGapMainAxis;
- sizeConsumed += flexBasisWithMinAndMaxConstraints + childMarginMainAxis +
- childLeadingGapMainAxis;
-
- if (child->isNodeFlexible()) {
- totalFlexGrowFactors += child->resolveFlexGrow();
-
- // Unlike the grow factor, the shrink factor is scaled relative to the
- // child dimension.
- totalFlexShrinkScaledFactors += -child->resolveFlexShrink() *
- child->getLayout().computedFlexBasis.unwrap();
- }
-
- itemsInFlow.push_back(child);
- }
-
- // The total flex factor needs to be floored to 1.
- if (totalFlexGrowFactors > 0 && totalFlexGrowFactors < 1) {
- totalFlexGrowFactors = 1;
- }
-
- // The total flex shrink factor needs to be floored to 1.
- if (totalFlexShrinkScaledFactors > 0 && totalFlexShrinkScaledFactors < 1) {
- totalFlexShrinkScaledFactors = 1;
- }
-
- return FlexLine{
- std::move(itemsInFlow),
- sizeConsumed,
- endOfLineIndex,
- FlexLineRunningLayout{
- totalFlexGrowFactors,
- totalFlexShrinkScaledFactors,
- }};
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_FlexLine.h b/Sources/yoga/Algorithm_FlexLine.h
deleted file mode 100644
index f589990f..00000000
--- a/Sources/yoga/Algorithm_FlexLine.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include
-
-#include "Yoga.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-struct FlexLineRunningLayout {
- // Total flex grow factors of flex items which are to be laid in the current
- // line. This is decremented as free space is distributed.
- float totalFlexGrowFactors{0.0f};
-
- // Total flex shrink factors of flex items which are to be laid in the current
- // line. This is decremented as free space is distributed.
- float totalFlexShrinkScaledFactors{0.0f};
-
- // The amount of available space within inner dimensions of the line which may
- // still be distributed.
- float remainingFreeSpace{0.0f};
-
- // The size of the mainDim for the row after considering size, padding, margin
- // and border of flex items. This is used to calculate maxLineDim after going
- // through all the rows to decide on the main axis size of owner.
- float mainDim{0.0f};
-
- // The size of the crossDim for the row after considering size, padding,
- // margin and border of flex items. Used for calculating containers crossSize.
- float crossDim{0.0f};
-};
-
-struct FlexLine {
- // List of children which are part of the line flow. This means they are not
- // positioned absolutely, or with `display: "none"`, and do not overflow the
- // available dimensions.
- const std::vector itemsInFlow{};
-
- // Accumulation of the dimensions and margin of all the children on the
- // current line. This will be used in order to either set the dimensions of
- // the node if none already exist or to compute the remaining space left for
- // the flexible children.
- const float sizeConsumed{0.0f};
-
- // The index of the first item beyond the current line.
- const size_t endOfLineIndex{0};
-
- // Layout information about the line computed in steps after line-breaking
- FlexLineRunningLayout layout{};
-};
-
-// Calculates where a line starting at a given index should break, returning
-// information about the collective children on the liune.
-//
-// This function assumes that all the children of node have their
-// computedFlexBasis properly computed(To do this use
-// computeFlexBasisForChildren function).
-FlexLine calculateFlexLine(
- yoga::Node* const node,
- Direction ownerDirection,
- float mainAxisownerSize,
- float availableInnerWidth,
- float availableInnerMainDim,
- size_t startOfLineIndex,
- size_t lineCount);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_PixelGrid.cpp b/Sources/yoga/Algorithm_PixelGrid.cpp
deleted file mode 100644
index 3905fd48..00000000
--- a/Sources/yoga/Algorithm_PixelGrid.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Yoga.h"
-
-#include "Algorithm_PixelGrid.h"
-#include "Numeric_Comparison.h"
-
-namespace facebook::yoga {
-
-float roundValueToPixelGrid(
- const double value,
- const double pointScaleFactor,
- const bool forceCeil,
- const bool forceFloor) {
- double scaledValue = value * pointScaleFactor;
- // We want to calculate `fractial` such that `floor(scaledValue) = scaledValue
- // - fractial`.
- double fractial = fmod(scaledValue, 1.0);
- if (fractial < 0) {
- // This branch is for handling negative numbers for `value`.
- //
- // Regarding `floor` and `ceil`. Note that for a number x, `floor(x) <= x <=
- // ceil(x)` even for negative numbers. Here are a couple of examples:
- // - x = 2.2: floor( 2.2) = 2, ceil( 2.2) = 3
- // - x = -2.2: floor(-2.2) = -3, ceil(-2.2) = -2
- //
- // Regarding `fmodf`. For fractional negative numbers, `fmodf` returns a
- // negative number. For example, `fmodf(-2.2) = -0.2`. However, we want
- // `fractial` to be the number such that subtracting it from `value` will
- // give us `floor(value)`. In the case of negative numbers, adding 1 to
- // `fmodf(value)` gives us this. Let's continue the example from above:
- // - fractial = fmodf(-2.2) = -0.2
- // - Add 1 to the fraction: fractial2 = fractial + 1 = -0.2 + 1 = 0.8
- // - Finding the `floor`: -2.2 - fractial2 = -2.2 - 0.8 = -3
- ++fractial;
- }
- if (yoga::inexactEquals(fractial, 0)) {
- // First we check if the value is already rounded
- scaledValue = scaledValue - fractial;
- } else if (yoga::inexactEquals(fractial, 1.0)) {
- scaledValue = scaledValue - fractial + 1.0;
- } else if (forceCeil) {
- // Next we check if we need to use forced rounding
- scaledValue = scaledValue - fractial + 1.0;
- } else if (forceFloor) {
- scaledValue = scaledValue - fractial;
- } else {
- // Finally we just round the value
- scaledValue = scaledValue - fractial +
- (!std::isnan(fractial) &&
- (fractial > 0.5 || yoga::inexactEquals(fractial, 0.5))
- ? 1.0
- : 0.0);
- }
- return (std::isnan(scaledValue) || std::isnan(pointScaleFactor))
- ? YGUndefined
- : (float)(scaledValue / pointScaleFactor);
-}
-
-void roundLayoutResultsToPixelGrid(
- yoga::Node* const node,
- const double absoluteLeft,
- const double absoluteTop) {
- const auto pointScaleFactor = node->getConfig()->getPointScaleFactor();
-
- const double nodeLeft = node->getLayout().position(PhysicalEdge::Left);
- const double nodeTop = node->getLayout().position(PhysicalEdge::Top);
-
- const double nodeWidth = node->getLayout().dimension(Dimension::Width);
- const double nodeHeight = node->getLayout().dimension(Dimension::Height);
-
- const double absoluteNodeLeft = absoluteLeft + nodeLeft;
- const double absoluteNodeTop = absoluteTop + nodeTop;
-
- const double absoluteNodeRight = absoluteNodeLeft + nodeWidth;
- const double absoluteNodeBottom = absoluteNodeTop + nodeHeight;
-
- if (pointScaleFactor != 0.0f) {
- // If a node has a custom measure function we never want to round down its
- // size as this could lead to unwanted text truncation.
- const bool textRounding = node->getNodeType() == NodeType::Text;
-
- node->setLayoutPosition(
- roundValueToPixelGrid(nodeLeft, pointScaleFactor, false, textRounding),
- PhysicalEdge::Left);
-
- node->setLayoutPosition(
- roundValueToPixelGrid(nodeTop, pointScaleFactor, false, textRounding),
- PhysicalEdge::Top);
-
- // We multiply dimension by scale factor and if the result is close to the
- // whole number, we don't have any fraction To verify if the result is close
- // to whole number we want to check both floor and ceil numbers
- const bool hasFractionalWidth =
- !yoga::inexactEquals(fmod(nodeWidth * pointScaleFactor, 1.0), 0) &&
- !yoga::inexactEquals(fmod(nodeWidth * pointScaleFactor, 1.0), 1.0);
- const bool hasFractionalHeight =
- !yoga::inexactEquals(fmod(nodeHeight * pointScaleFactor, 1.0), 0) &&
- !yoga::inexactEquals(fmod(nodeHeight * pointScaleFactor, 1.0), 1.0);
-
- node->setLayoutDimension(
- roundValueToPixelGrid(
- absoluteNodeRight,
- pointScaleFactor,
- (textRounding && hasFractionalWidth),
- (textRounding && !hasFractionalWidth)) -
- roundValueToPixelGrid(
- absoluteNodeLeft, pointScaleFactor, false, textRounding),
- Dimension::Width);
-
- node->setLayoutDimension(
- roundValueToPixelGrid(
- absoluteNodeBottom,
- pointScaleFactor,
- (textRounding && hasFractionalHeight),
- (textRounding && !hasFractionalHeight)) -
- roundValueToPixelGrid(
- absoluteNodeTop, pointScaleFactor, false, textRounding),
- Dimension::Height);
- }
-
- for (yoga::Node* child : node->getChildren()) {
- roundLayoutResultsToPixelGrid(child, absoluteNodeLeft, absoluteNodeTop);
- }
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_PixelGrid.h b/Sources/yoga/Algorithm_PixelGrid.h
deleted file mode 100644
index cb6f0c97..00000000
--- a/Sources/yoga/Algorithm_PixelGrid.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-// Round a point value to the nearest physical pixel based on DPI
-// (pointScaleFactor)
-float roundValueToPixelGrid(
- const double value,
- const double pointScaleFactor,
- const bool forceCeil,
- const bool forceFloor);
-
-// Round the layout results of a node and its subtree to the pixel grid.
-void roundLayoutResultsToPixelGrid(
- yoga::Node* const node,
- const double absoluteLeft,
- const double absoluteTop);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_SizingMode.h b/Sources/yoga/Algorithm_SizingMode.h
deleted file mode 100644
index ee1af852..00000000
--- a/Sources/yoga/Algorithm_SizingMode.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Debug_AssertFatal.h"
-#include "Enums_MeasureMode.h"
-
-namespace facebook::yoga {
-
-/**
- * Corresponds to a CSS auto box sizes. Missing "min-content", as Yoga does not
- * current support automatic minimum sizes.
- * https://www.w3.org/TR/css-sizing-3/#auto-box-sizes
- * https://www.w3.org/TR/css-flexbox-1/#min-size-auto
- */
-enum class SizingMode {
- /**
- * The size a box would take if its outer size filled the available space in
- * the given axis; in other words, the stretch fit into the available space,
- * if that is definite. Undefined if the available space is indefinite.
- */
- StretchFit,
-
- /**
- * A box’s “ideal” size in a given axis when given infinite available space.
- * Usually this is the smallest size the box could take in that axis while
- * still fitting around its contents, i.e. minimizing unfilled space while
- * avoiding overflow.
- */
- MaxContent,
-
- /**
- * If the available space in a given axis is definite, equal to
- * clamp(min-content size, stretch-fit size, max-content size) (i.e.
- * max(min-content size, min(max-content size, stretch-fit size))). When
- * sizing under a min-content constraint, equal to the min-content size.
- * Otherwise, equal to the max-content size in that axis.
- */
- FitContent,
-};
-
-inline MeasureMode measureMode(SizingMode mode) {
- switch (mode) {
- case SizingMode::StretchFit:
- return MeasureMode::Exactly;
- case SizingMode::MaxContent:
- return MeasureMode::Undefined;
- case SizingMode::FitContent:
- return MeasureMode::AtMost;
- }
-
- fatalWithMessage("Invalid SizingMode");
-}
-
-inline SizingMode sizingMode(MeasureMode mode) {
- switch (mode) {
- case MeasureMode::Exactly:
- return SizingMode::StretchFit;
- case MeasureMode::Undefined:
- return SizingMode::MaxContent;
- case MeasureMode::AtMost:
- return SizingMode::FitContent;
- }
-
- fatalWithMessage("Invalid MeasureMode");
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Algorithm_TrailingPosition.h b/Sources/yoga/Algorithm_TrailingPosition.h
deleted file mode 100644
index a5fbbc6e..00000000
--- a/Sources/yoga/Algorithm_TrailingPosition.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-#include "Algorithm_FlexDirection.h"
-#include "Event_event.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-// Given an offset to an edge, returns the offset to the opposite edge on the
-// same axis. This assumes that the width/height of both nodes is determined at
-// this point.
-inline float getPositionOfOppositeEdge(
- float position,
- FlexDirection axis,
- const yoga::Node* const containingNode,
- const yoga::Node* const node) {
- return containingNode->getLayout().measuredDimension(dimension(axis)) -
- node->getLayout().measuredDimension(dimension(axis)) - position;
-}
-
-inline void setChildTrailingPosition(
- const yoga::Node* const node,
- yoga::Node* const child,
- const FlexDirection axis) {
- child->setLayoutPosition(
- getPositionOfOppositeEdge(
- child->getLayout().position(flexStartEdge(axis)), axis, node, child),
- flexEndEdge(axis));
-}
-
-inline bool needsTrailingPosition(const FlexDirection axis) {
- return axis == FlexDirection::RowReverse ||
- axis == FlexDirection::ColumnReverse;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/CMakeLists.txt b/Sources/yoga/CMakeLists.txt
deleted file mode 100644
index b6eca1ac..00000000
--- a/Sources/yoga/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) Meta Platforms, Inc. and affiliates.
-#
-# This source code is licensed under the MIT license found in the
-# LICENSE file in the root directory of this source tree.
-
-
-cmake_minimum_required(VERSION 3.13...3.26)
-project(yogacore)
-set(CMAKE_VERBOSE_MAKEFILE on)
-
-if(TARGET yogacore)
- return()
-endif()
-
-include(CheckIPOSupported)
-
-set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..)
-include(${YOGA_ROOT}/cmake/project-defaults.cmake)
-
-
-file(GLOB SOURCES CONFIGURE_DEPENDS
- ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp)
-
-add_library(yogacore STATIC ${SOURCES})
-
-# Yoga conditionally uses when building for Android
-if (ANDROID)
- target_link_libraries(yogacore log)
-endif()
-
-check_ipo_supported(RESULT result)
-if(result)
- set_target_properties(yogacore PROPERTIES
- CMAKE_INTERPROCEDURAL_OPTIMIZATION true)
-endif()
-
-target_include_directories(yogacore
- PUBLIC
- $
- $)
diff --git a/Sources/yoga/Config_Config.cpp b/Sources/yoga/Config_Config.cpp
deleted file mode 100644
index 4e013884..00000000
--- a/Sources/yoga/Config_Config.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Config_Config.h"
-#include "Debug_Log.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-bool configUpdateInvalidatesLayout(
- const Config& oldConfig,
- const Config& newConfig) {
- return oldConfig.getErrata() != newConfig.getErrata() ||
- oldConfig.getEnabledExperiments() != newConfig.getEnabledExperiments() ||
- oldConfig.getPointScaleFactor() != newConfig.getPointScaleFactor() ||
- oldConfig.useWebDefaults() != newConfig.useWebDefaults();
-}
-
-Config::Config(YGLogger logger) : cloneNodeCallback_{nullptr} {
- setLogger(logger);
-}
-
-void Config::setUseWebDefaults(bool useWebDefaults) {
- useWebDefaults_ = useWebDefaults;
-}
-
-bool Config::useWebDefaults() const {
- return useWebDefaults_;
-}
-
-void Config::setExperimentalFeatureEnabled(
- ExperimentalFeature feature,
- bool enabled) {
- experimentalFeatures_.set(static_cast(feature), enabled);
-}
-
-bool Config::isExperimentalFeatureEnabled(ExperimentalFeature feature) const {
- return experimentalFeatures_.test(static_cast(feature));
-}
-
-ExperimentalFeatureSet Config::getEnabledExperiments() const {
- return experimentalFeatures_;
-}
-
-void Config::setErrata(Errata errata) {
- errata_ = errata;
-}
-
-void Config::addErrata(Errata errata) {
- errata_ |= errata;
-}
-
-void Config::removeErrata(Errata errata) {
- errata_ &= (~errata);
-}
-
-Errata Config::getErrata() const {
- return errata_;
-}
-
-bool Config::hasErrata(Errata errata) const {
- return (errata_ & errata) != Errata::None;
-}
-
-void Config::setPointScaleFactor(float pointScaleFactor) {
- pointScaleFactor_ = pointScaleFactor;
-}
-
-float Config::getPointScaleFactor() const {
- return pointScaleFactor_;
-}
-
-void Config::setContext(void* context) {
- context_ = context;
-}
-
-void* Config::getContext() const {
- return context_;
-}
-
-void Config::setLogger(YGLogger logger) {
- logger_ = logger;
-}
-
-void Config::log(
- const yoga::Node* node,
- LogLevel logLevel,
- const char* format,
- va_list args) const {
- logger_(this, node, unscopedEnum(logLevel), format, args);
-}
-
-void Config::setCloneNodeCallback(YGCloneNodeFunc cloneNode) {
- cloneNodeCallback_ = cloneNode;
-}
-
-YGNodeRef Config::cloneNode(
- YGNodeConstRef node,
- YGNodeConstRef owner,
- size_t childIndex) const {
- YGNodeRef clone = nullptr;
- if (cloneNodeCallback_ != nullptr) {
- clone = cloneNodeCallback_(node, owner, childIndex);
- }
- if (clone == nullptr) {
- clone = YGNodeClone(node);
- }
- return clone;
-}
-
-/*static*/ const Config& Config::getDefault() {
- static Config config{getDefaultLogger()};
- return config;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Config_Config.h b/Sources/yoga/Config_Config.h
deleted file mode 100644
index 2eff5c3b..00000000
--- a/Sources/yoga/Config_Config.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include
-
-#include "Yoga.h"
-#include "Enums_Errata.h"
-#include "Enums_ExperimentalFeature.h"
-#include "Enums_LogLevel.h"
-
-// Tag struct used to form the opaque YGConfigRef for the public C API
-struct YGConfig {};
-
-namespace facebook::yoga {
-
-class Config;
-class Node;
-
-using ExperimentalFeatureSet = std::bitset()>;
-
-// Whether moving a node from an old to new config should dirty previously
-// calculated layout results.
-bool configUpdateInvalidatesLayout(
- const Config& oldConfig,
- const Config& newConfig);
-
-class YG_EXPORT Config : public ::YGConfig {
- public:
- Config(YGLogger logger);
-
- void setUseWebDefaults(bool useWebDefaults);
- bool useWebDefaults() const;
-
- void setExperimentalFeatureEnabled(ExperimentalFeature feature, bool enabled);
- bool isExperimentalFeatureEnabled(ExperimentalFeature feature) const;
- ExperimentalFeatureSet getEnabledExperiments() const;
-
- void setErrata(Errata errata);
- void addErrata(Errata errata);
- void removeErrata(Errata errata);
- Errata getErrata() const;
- bool hasErrata(Errata errata) const;
-
- void setPointScaleFactor(float pointScaleFactor);
- float getPointScaleFactor() const;
-
- void setContext(void* context);
- void* getContext() const;
-
- void setLogger(YGLogger logger);
- void log(
- const yoga::Node* node,
- LogLevel logLevel,
- const char* format,
- va_list args) const;
-
- void setCloneNodeCallback(YGCloneNodeFunc cloneNode);
- YGNodeRef
- cloneNode(YGNodeConstRef node, YGNodeConstRef owner, size_t childIndex) const;
-
- static const Config& getDefault();
-
- private:
- YGCloneNodeFunc cloneNodeCallback_;
- YGLogger logger_;
-
- bool useWebDefaults_ : 1 = false;
-
- ExperimentalFeatureSet experimentalFeatures_{};
- Errata errata_ = Errata::None;
- float pointScaleFactor_ = 1.0f;
- void* context_ = nullptr;
-};
-
-inline Config* resolveRef(const YGConfigRef ref) {
- return static_cast(ref);
-}
-
-inline const Config* resolveRef(const YGConfigConstRef ref) {
- return static_cast(ref);
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Debug_AssertFatal.cpp b/Sources/yoga/Debug_AssertFatal.cpp
deleted file mode 100644
index d83cd019..00000000
--- a/Sources/yoga/Debug_AssertFatal.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include
-#include
-
-#include "Config_Config.h"
-#include "Debug_AssertFatal.h"
-#include "Debug_Log.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-[[noreturn]] void fatalWithMessage(const char* message) {
-#if defined(__cpp_exceptions)
- throw std::logic_error(message);
-#else
- std::terminate();
-#endif
-}
-
-void assertFatal(const bool condition, const char* message) {
- if (!condition) {
- yoga::log(LogLevel::Fatal, "%s\n", message);
- fatalWithMessage(message);
- }
-}
-
-void assertFatalWithNode(
- const yoga::Node* const node,
- const bool condition,
- const char* message) {
- if (!condition) {
- yoga::log(node, LogLevel::Fatal, "%s\n", message);
- fatalWithMessage(message);
- }
-}
-
-void assertFatalWithConfig(
- const yoga::Config* const config,
- const bool condition,
- const char* message) {
- if (!condition) {
- yoga::log(config, LogLevel::Fatal, "%s\n", message);
- fatalWithMessage(message);
- }
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Debug_AssertFatal.h b/Sources/yoga/Debug_AssertFatal.h
deleted file mode 100644
index b1169e8b..00000000
--- a/Sources/yoga/Debug_AssertFatal.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-
-namespace facebook::yoga {
-
-class Node;
-class Config;
-
-[[noreturn]] void fatalWithMessage(const char* message);
-
-void assertFatal(bool condition, const char* message);
-void assertFatalWithNode(
- const yoga::Node* node,
- bool condition,
- const char* message);
-void assertFatalWithConfig(
- const yoga::Config* config,
- bool condition,
- const char* message);
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Debug_Log.cpp b/Sources/yoga/Debug_Log.cpp
deleted file mode 100644
index fdd0903d..00000000
--- a/Sources/yoga/Debug_Log.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Debug_Log.h"
-
-#ifdef ANDROID
-#include
-#endif
-
-namespace facebook::yoga {
-
-namespace {
-
-void vlog(
- const yoga::Config* config,
- const yoga::Node* node,
- LogLevel level,
- const char* format,
- va_list args) {
- if (config == nullptr) {
- getDefaultLogger()(nullptr, node, unscopedEnum(level), format, args);
- } else {
- config->log(node, level, format, args);
- }
-}
-} // namespace
-
-void log(LogLevel level, const char* format, ...) noexcept {
- va_list args;
- va_start(args, format);
- vlog(nullptr, nullptr, level, format, args);
- va_end(args);
-}
-
-void log(
- const yoga::Node* node,
- LogLevel level,
- const char* format,
- ...) noexcept {
- va_list args;
- va_start(args, format);
- vlog(
- node == nullptr ? nullptr : node->getConfig(), node, level, format, args);
- va_end(args);
-}
-
-void log(
- const yoga::Config* config,
- LogLevel level,
- const char* format,
- ...) noexcept {
- va_list args;
- va_start(args, format);
- vlog(config, nullptr, level, format, args);
- va_end(args);
-}
-
-YGLogger getDefaultLogger() {
- return [](const YGConfigConstRef /*config*/,
- const YGNodeConstRef /*node*/,
- YGLogLevel level,
- const char* format,
- va_list args) -> int {
-#ifdef ANDROID
- int androidLevel = YGLogLevelDebug;
- switch (level) {
- case YGLogLevelFatal:
- androidLevel = ANDROID_LOG_FATAL;
- break;
- case YGLogLevelError:
- androidLevel = ANDROID_LOG_ERROR;
- break;
- case YGLogLevelWarn:
- androidLevel = ANDROID_LOG_WARN;
- break;
- case YGLogLevelInfo:
- androidLevel = ANDROID_LOG_INFO;
- break;
- case YGLogLevelDebug:
- androidLevel = ANDROID_LOG_DEBUG;
- break;
- case YGLogLevelVerbose:
- androidLevel = ANDROID_LOG_VERBOSE;
- break;
- }
- return __android_log_vprint(androidLevel, "yoga", format, args);
-#else
- switch (level) {
- case YGLogLevelError:
- case YGLogLevelFatal:
- return vfprintf(stderr, format, args);
- case YGLogLevelWarn:
- case YGLogLevelInfo:
- case YGLogLevelDebug:
- case YGLogLevelVerbose:
- default:
- return vprintf(format, args);
- }
-#endif
- };
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Debug_Log.h b/Sources/yoga/Debug_Log.h
deleted file mode 100644
index bd53e944..00000000
--- a/Sources/yoga/Debug_Log.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-
-#include "Config_Config.h"
-#include "Enums_LogLevel.h"
-#include "Node_Node.h"
-
-namespace facebook::yoga {
-
-void log(LogLevel level, const char* format, ...) noexcept;
-
-void log(
- const yoga::Node* node,
- LogLevel level,
- const char* message,
- ...) noexcept;
-
-void log(
- const yoga::Config* config,
- LogLevel level,
- const char* format,
- ...) noexcept;
-
-YGLogger getDefaultLogger();
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Align.h b/Sources/yoga/Enums_Align.h
deleted file mode 100644
index 69709413..00000000
--- a/Sources/yoga/Enums_Align.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Align : uint8_t {
- Auto = YGAlignAuto,
- FlexStart = YGAlignFlexStart,
- Center = YGAlignCenter,
- FlexEnd = YGAlignFlexEnd,
- Stretch = YGAlignStretch,
- Baseline = YGAlignBaseline,
- SpaceBetween = YGAlignSpaceBetween,
- SpaceAround = YGAlignSpaceAround,
- SpaceEvenly = YGAlignSpaceEvenly,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 9;
-}
-
-constexpr Align scopedEnum(YGAlign unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGAlign unscopedEnum(Align scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Align e) {
- return YGAlignToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Dimension.h b/Sources/yoga/Enums_Dimension.h
deleted file mode 100644
index 6b336f61..00000000
--- a/Sources/yoga/Enums_Dimension.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Dimension : uint8_t {
- Width = YGDimensionWidth,
- Height = YGDimensionHeight,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 2;
-}
-
-constexpr Dimension scopedEnum(YGDimension unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGDimension unscopedEnum(Dimension scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Dimension e) {
- return YGDimensionToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Direction.h b/Sources/yoga/Enums_Direction.h
deleted file mode 100644
index 3d7511bb..00000000
--- a/Sources/yoga/Enums_Direction.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Direction : uint8_t {
- Inherit = YGDirectionInherit,
- LTR = YGDirectionLTR,
- RTL = YGDirectionRTL,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr Direction scopedEnum(YGDirection unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGDirection unscopedEnum(Direction scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Direction e) {
- return YGDirectionToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Display.h b/Sources/yoga/Enums_Display.h
deleted file mode 100644
index 4022482b..00000000
--- a/Sources/yoga/Enums_Display.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Display : uint8_t {
- Flex = YGDisplayFlex,
- None = YGDisplayNone,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 2;
-}
-
-constexpr Display scopedEnum(YGDisplay unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGDisplay unscopedEnum(Display scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Display e) {
- return YGDisplayToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Edge.h b/Sources/yoga/Enums_Edge.h
deleted file mode 100644
index 0fa3dc4a..00000000
--- a/Sources/yoga/Enums_Edge.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Edge : uint8_t {
- Left = YGEdgeLeft,
- Top = YGEdgeTop,
- Right = YGEdgeRight,
- Bottom = YGEdgeBottom,
- Start = YGEdgeStart,
- End = YGEdgeEnd,
- Horizontal = YGEdgeHorizontal,
- Vertical = YGEdgeVertical,
- All = YGEdgeAll,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 9;
-}
-
-constexpr Edge scopedEnum(YGEdge unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGEdge unscopedEnum(Edge scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Edge e) {
- return YGEdgeToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Errata.h b/Sources/yoga/Enums_Errata.h
deleted file mode 100644
index 92e5ed62..00000000
--- a/Sources/yoga/Enums_Errata.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Errata : uint32_t {
- None = YGErrataNone,
- StretchFlexBasis = YGErrataStretchFlexBasis,
- AbsolutePositioningIncorrect = YGErrataAbsolutePositioningIncorrect,
- AbsolutePercentAgainstInnerSize = YGErrataAbsolutePercentAgainstInnerSize,
- All = YGErrataAll,
- Classic = YGErrataClassic,
-};
-
-YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)
-
-constexpr Errata scopedEnum(YGErrata unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGErrata unscopedEnum(Errata scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Errata e) {
- return YGErrataToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_ExperimentalFeature.h b/Sources/yoga/Enums_ExperimentalFeature.h
deleted file mode 100644
index b68ff25f..00000000
--- a/Sources/yoga/Enums_ExperimentalFeature.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class ExperimentalFeature : uint8_t {
- WebFlexBasis = YGExperimentalFeatureWebFlexBasis,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 1;
-}
-
-constexpr ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(ExperimentalFeature e) {
- return YGExperimentalFeatureToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_FlexDirection.h b/Sources/yoga/Enums_FlexDirection.h
deleted file mode 100644
index 36f1f67f..00000000
--- a/Sources/yoga/Enums_FlexDirection.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class FlexDirection : uint8_t {
- Column = YGFlexDirectionColumn,
- ColumnReverse = YGFlexDirectionColumnReverse,
- Row = YGFlexDirectionRow,
- RowReverse = YGFlexDirectionRowReverse,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 4;
-}
-
-constexpr FlexDirection scopedEnum(YGFlexDirection unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGFlexDirection unscopedEnum(FlexDirection scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(FlexDirection e) {
- return YGFlexDirectionToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Gutter.h b/Sources/yoga/Enums_Gutter.h
deleted file mode 100644
index 2d0c83af..00000000
--- a/Sources/yoga/Enums_Gutter.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Gutter : uint8_t {
- Column = YGGutterColumn,
- Row = YGGutterRow,
- All = YGGutterAll,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr Gutter scopedEnum(YGGutter unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGGutter unscopedEnum(Gutter scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Gutter e) {
- return YGGutterToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Justify.h b/Sources/yoga/Enums_Justify.h
deleted file mode 100644
index 09f74c6a..00000000
--- a/Sources/yoga/Enums_Justify.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Justify : uint8_t {
- FlexStart = YGJustifyFlexStart,
- Center = YGJustifyCenter,
- FlexEnd = YGJustifyFlexEnd,
- SpaceBetween = YGJustifySpaceBetween,
- SpaceAround = YGJustifySpaceAround,
- SpaceEvenly = YGJustifySpaceEvenly,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 6;
-}
-
-constexpr Justify scopedEnum(YGJustify unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGJustify unscopedEnum(Justify scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Justify e) {
- return YGJustifyToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_LogLevel.h b/Sources/yoga/Enums_LogLevel.h
deleted file mode 100644
index aec9bebd..00000000
--- a/Sources/yoga/Enums_LogLevel.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class LogLevel : uint8_t {
- Error = YGLogLevelError,
- Warn = YGLogLevelWarn,
- Info = YGLogLevelInfo,
- Debug = YGLogLevelDebug,
- Verbose = YGLogLevelVerbose,
- Fatal = YGLogLevelFatal,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 6;
-}
-
-constexpr LogLevel scopedEnum(YGLogLevel unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGLogLevel unscopedEnum(LogLevel scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(LogLevel e) {
- return YGLogLevelToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_MeasureMode.h b/Sources/yoga/Enums_MeasureMode.h
deleted file mode 100644
index 79306832..00000000
--- a/Sources/yoga/Enums_MeasureMode.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class MeasureMode : uint8_t {
- Undefined = YGMeasureModeUndefined,
- Exactly = YGMeasureModeExactly,
- AtMost = YGMeasureModeAtMost,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr MeasureMode scopedEnum(YGMeasureMode unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGMeasureMode unscopedEnum(MeasureMode scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(MeasureMode e) {
- return YGMeasureModeToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_NodeType.h b/Sources/yoga/Enums_NodeType.h
deleted file mode 100644
index 92735421..00000000
--- a/Sources/yoga/Enums_NodeType.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class NodeType : uint8_t {
- Default = YGNodeTypeDefault,
- Text = YGNodeTypeText,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 2;
-}
-
-constexpr NodeType scopedEnum(YGNodeType unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGNodeType unscopedEnum(NodeType scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(NodeType e) {
- return YGNodeTypeToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Overflow.h b/Sources/yoga/Enums_Overflow.h
deleted file mode 100644
index 4aa45f9a..00000000
--- a/Sources/yoga/Enums_Overflow.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Overflow : uint8_t {
- Visible = YGOverflowVisible,
- Hidden = YGOverflowHidden,
- Scroll = YGOverflowScroll,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr Overflow scopedEnum(YGOverflow unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGOverflow unscopedEnum(Overflow scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Overflow e) {
- return YGOverflowToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_PhysicalEdge.h b/Sources/yoga/Enums_PhysicalEdge.h
deleted file mode 100644
index bd369954..00000000
--- a/Sources/yoga/Enums_PhysicalEdge.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Enums_Edge.h"
-
-namespace facebook::yoga {
-
-enum class PhysicalEdge : uint32_t {
- Left = yoga::to_underlying(Edge::Left),
- Top = yoga::to_underlying(Edge::Top),
- Right = yoga::to_underlying(Edge::Right),
- Bottom = yoga::to_underlying(Edge::Bottom),
-};
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_PositionType.h b/Sources/yoga/Enums_PositionType.h
deleted file mode 100644
index 269974b0..00000000
--- a/Sources/yoga/Enums_PositionType.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class PositionType : uint8_t {
- Static = YGPositionTypeStatic,
- Relative = YGPositionTypeRelative,
- Absolute = YGPositionTypeAbsolute,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr PositionType scopedEnum(YGPositionType unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGPositionType unscopedEnum(PositionType scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(PositionType e) {
- return YGPositionTypeToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Unit.h b/Sources/yoga/Enums_Unit.h
deleted file mode 100644
index 6b69aa4e..00000000
--- a/Sources/yoga/Enums_Unit.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Unit : uint8_t {
- Undefined = YGUnitUndefined,
- Point = YGUnitPoint,
- Percent = YGUnitPercent,
- Auto = YGUnitAuto,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 4;
-}
-
-constexpr Unit scopedEnum(YGUnit unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGUnit unscopedEnum(Unit scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Unit e) {
- return YGUnitToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_Wrap.h b/Sources/yoga/Enums_Wrap.h
deleted file mode 100644
index 8ffec26f..00000000
--- a/Sources/yoga/Enums_Wrap.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// @generated by enums.py
-// clang-format off
-#pragma once
-
-#include
-#include "YGEnums.h"
-#include "Enums_YogaEnums.h"
-
-namespace facebook::yoga {
-
-enum class Wrap : uint8_t {
- NoWrap = YGWrapNoWrap,
- Wrap = YGWrapWrap,
- WrapReverse = YGWrapWrapReverse,
-};
-
-template <>
-constexpr int32_t ordinalCount() {
- return 3;
-}
-
-constexpr Wrap scopedEnum(YGWrap unscoped) {
- return static_cast(unscoped);
-}
-
-constexpr YGWrap unscopedEnum(Wrap scoped) {
- return static_cast(scoped);
-}
-
-inline const char* toString(Wrap e) {
- return YGWrapToString(unscopedEnum(e));
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Enums_YogaEnums.h b/Sources/yoga/Enums_YogaEnums.h
deleted file mode 100644
index de446621..00000000
--- a/Sources/yoga/Enums_YogaEnums.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace facebook::yoga {
-
-/**
- * Concept for any enum/enum class
- */
-template
-concept Enumeration = std::is_enum_v;
-
-/**
- * Count of ordinals in a Yoga enum which is sequential
- */
-template
-constexpr int32_t ordinalCount();
-
-/**
- * Concept for a yoga enum which is sequential
- */
-template
-concept HasOrdinality = (ordinalCount() > 0);
-
-/**
- * Count of bits needed to represent every ordinal
- */
-template
-constexpr int32_t bitCount() {
- return std::bit_width(
- static_cast>(ordinalCount() - 1));
-}
-
-/**
- * Polyfill of C++ 23 to_underlying()
- * https://en.cppreference.com/w/cpp/utility/to_underlying
- */
-constexpr auto to_underlying(Enumeration auto e) noexcept {
- return static_cast>(e);
-}
-
-/**
- * Convenience function to iterate through every value in a Yoga enum as part of
- * a range-based for loop.
- */
-template
-auto ordinals() {
- struct Iterator {
- EnumT e{};
-
- EnumT operator*() const {
- return e;
- }
-
- Iterator& operator++() {
- e = static_cast(to_underlying(e) + 1);
- return *this;
- }
-
- bool operator==(const Iterator& other) const = default;
- bool operator!=(const Iterator& other) const = default;
- };
-
- struct Range {
- Iterator begin() const {
- return Iterator{};
- }
- Iterator end() const {
- return Iterator{static_cast(ordinalCount())};
- }
- };
-
- return Range{};
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Event_event.cpp b/Sources/yoga/Event_event.cpp
deleted file mode 100644
index 1df7a29c..00000000
--- a/Sources/yoga/Event_event.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include "Event_event.h"
-#include
-#include
-
-namespace facebook::yoga {
-
-const char* LayoutPassReasonToString(const LayoutPassReason value) {
- switch (value) {
- case LayoutPassReason::kInitial:
- return "initial";
- case LayoutPassReason::kAbsLayout:
- return "abs_layout";
- case LayoutPassReason::kStretch:
- return "stretch";
- case LayoutPassReason::kMultilineStretch:
- return "multiline_stretch";
- case LayoutPassReason::kFlexLayout:
- return "flex_layout";
- case LayoutPassReason::kMeasureChild:
- return "measure";
- case LayoutPassReason::kAbsMeasureChild:
- return "abs_measure";
- case LayoutPassReason::kFlexMeasure:
- return "flex_measure";
- default:
- return "unknown";
- }
-}
-
-namespace {
-
-struct Node {
- std::function subscriber = nullptr;
- Node* next = nullptr;
-
- Node(std::function&& subscriber)
- : subscriber{std::move(subscriber)} {}
-};
-
-std::atomic subscribers{nullptr};
-
-Node* push(Node* newHead) {
- Node* oldHead;
- do {
- oldHead = subscribers.load(std::memory_order_relaxed);
- if (newHead != nullptr) {
- newHead->next = oldHead;
- }
- } while (!subscribers.compare_exchange_weak(
- oldHead, newHead, std::memory_order_release, std::memory_order_relaxed));
- return oldHead;
-}
-
-} // namespace
-
-void Event::reset() {
- auto head = push(nullptr);
- while (head != nullptr) {
- auto current = head;
- head = head->next;
- delete current;
- }
-}
-
-void Event::subscribe(std::function&& subscriber) {
- push(new Node{std::move(subscriber)});
-}
-
-void Event::publish(
- YGNodeConstRef node,
- Type eventType,
- const Data& eventData) {
- for (auto subscriber = subscribers.load(std::memory_order_relaxed);
- subscriber != nullptr;
- subscriber = subscriber->next) {
- subscriber->subscriber(node, eventType, eventData);
- }
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Event_event.h b/Sources/yoga/Event_event.h
deleted file mode 100644
index bad21ca9..00000000
--- a/Sources/yoga/Event_event.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include "Yoga.h"
-
-#include
-#include
-#include
-#include
-
-namespace facebook::yoga {
-
-enum struct LayoutType : int {
- kLayout = 0,
- kMeasure = 1,
- kCachedLayout = 2,
- kCachedMeasure = 3
-};
-
-enum struct LayoutPassReason : int {
- kInitial = 0,
- kAbsLayout = 1,
- kStretch = 2,
- kMultilineStretch = 3,
- kFlexLayout = 4,
- kMeasureChild = 5,
- kAbsMeasureChild = 6,
- kFlexMeasure = 7,
- COUNT
-};
-
-struct LayoutData {
- int layouts;
- int measures;
- uint32_t maxMeasureCache;
- int cachedLayouts;
- int cachedMeasures;
- int measureCallbacks;
- std::array(LayoutPassReason::COUNT)>
- measureCallbackReasonsCount;
-};
-
-const char* LayoutPassReasonToString(const LayoutPassReason value);
-
-struct YG_EXPORT Event {
- enum Type {
- NodeAllocation,
- NodeDeallocation,
- NodeLayout,
- LayoutPassStart,
- LayoutPassEnd,
- MeasureCallbackStart,
- MeasureCallbackEnd,
- NodeBaselineStart,
- NodeBaselineEnd,
- };
- class Data;
- using Subscriber = void(YGNodeConstRef, Type, Data);
- using Subscribers = std::vector>;
-
- template
- struct TypedData {};
-
- class Data {
- const void* data_;
-
- public:
- template
- Data(const TypedData& data) : data_{&data} {}
-
- template
- const TypedData& get() const {
- return *static_cast*>(data_);
- }
- };
-
- static void reset();
-
- static void subscribe(std::function&& subscriber);
-
- template
- static void publish(YGNodeConstRef node, const TypedData& eventData = {}) {
- publish(node, E, Data{eventData});
- }
-
- private:
- static void publish(YGNodeConstRef, Type, const Data&);
-};
-
-template <>
-struct Event::TypedData {
- YGConfigConstRef config;
-};
-
-template <>
-struct Event::TypedData {
- YGConfigConstRef config;
-};
-
-template <>
-struct Event::TypedData {
- LayoutData* layoutData;
-};
-
-template <>
-struct Event::TypedData {
- float width;
- YGMeasureMode widthMeasureMode;
- float height;
- YGMeasureMode heightMeasureMode;
- float measuredWidth;
- float measuredHeight;
- const LayoutPassReason reason;
-};
-
-template <>
-struct Event::TypedData {
- LayoutType layoutType;
-};
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Node_CachedMeasurement.h b/Sources/yoga/Node_CachedMeasurement.h
deleted file mode 100644
index 1896f373..00000000
--- a/Sources/yoga/Node_CachedMeasurement.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include
-
-#include "Yoga.h"
-
-#include "Algorithm_SizingMode.h"
-#include "Numeric_Comparison.h"
-
-namespace facebook::yoga {
-
-struct CachedMeasurement {
- float availableWidth{-1};
- float availableHeight{-1};
- SizingMode widthSizingMode{SizingMode::MaxContent};
- SizingMode heightSizingMode{SizingMode::MaxContent};
-
- float computedWidth{-1};
- float computedHeight{-1};
-
- bool operator==(CachedMeasurement measurement) const {
- bool isEqual = widthSizingMode == measurement.widthSizingMode &&
- heightSizingMode == measurement.heightSizingMode;
-
- if (!yoga::isUndefined(availableWidth) ||
- !yoga::isUndefined(measurement.availableWidth)) {
- isEqual = isEqual && availableWidth == measurement.availableWidth;
- }
- if (!yoga::isUndefined(availableHeight) ||
- !yoga::isUndefined(measurement.availableHeight)) {
- isEqual = isEqual && availableHeight == measurement.availableHeight;
- }
- if (!yoga::isUndefined(computedWidth) ||
- !yoga::isUndefined(measurement.computedWidth)) {
- isEqual = isEqual && computedWidth == measurement.computedWidth;
- }
- if (!yoga::isUndefined(computedHeight) ||
- !yoga::isUndefined(measurement.computedHeight)) {
- isEqual = isEqual && computedHeight == measurement.computedHeight;
- }
-
- return isEqual;
- }
-};
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Node_LayoutResults.cpp b/Sources/yoga/Node_LayoutResults.cpp
deleted file mode 100644
index a7609642..00000000
--- a/Sources/yoga/Node_LayoutResults.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#include
-
-#include "Node_LayoutResults.h"
-#include "Numeric_Comparison.h"
-
-namespace facebook::yoga {
-
-bool LayoutResults::operator==(LayoutResults layout) const {
- bool isEqual = yoga::inexactEquals(position_, layout.position_) &&
- yoga::inexactEquals(dimensions_, layout.dimensions_) &&
- yoga::inexactEquals(margin_, layout.margin_) &&
- yoga::inexactEquals(border_, layout.border_) &&
- yoga::inexactEquals(padding_, layout.padding_) &&
- direction() == layout.direction() &&
- hadOverflow() == layout.hadOverflow() &&
- lastOwnerDirection == layout.lastOwnerDirection &&
- nextCachedMeasurementsIndex == layout.nextCachedMeasurementsIndex &&
- cachedLayout == layout.cachedLayout &&
- computedFlexBasis == layout.computedFlexBasis;
-
- for (uint32_t i = 0; i < LayoutResults::MaxCachedMeasurements && isEqual;
- ++i) {
- isEqual = isEqual && cachedMeasurements[i] == layout.cachedMeasurements[i];
- }
-
- if (!yoga::isUndefined(measuredDimensions_[0]) ||
- !yoga::isUndefined(layout.measuredDimensions_[0])) {
- isEqual =
- isEqual && (measuredDimensions_[0] == layout.measuredDimensions_[0]);
- }
- if (!yoga::isUndefined(measuredDimensions_[1]) ||
- !yoga::isUndefined(layout.measuredDimensions_[1])) {
- isEqual =
- isEqual && (measuredDimensions_[1] == layout.measuredDimensions_[1]);
- }
-
- return isEqual;
-}
-
-} // namespace facebook::yoga
diff --git a/Sources/yoga/Node_LayoutResults.h b/Sources/yoga/Node_LayoutResults.h
deleted file mode 100644
index ca39077e..00000000
--- a/Sources/yoga/Node_LayoutResults.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#pragma once
-
-#include
-
-#include "Debug_AssertFatal.h"
-#include "Enums_Dimension.h"
-#include "Enums_Direction.h"
-#include "Enums_Edge.h"
-#include "Enums_PhysicalEdge.h"
-#include "Node_CachedMeasurement.h"
-#include "Numeric_FloatOptional.h"
-
-namespace facebook::yoga {
-
-struct LayoutResults {
- // This value was chosen based on empirical data:
- // 98% of analyzed layouts require less than 8 entries.
- static constexpr int32_t MaxCachedMeasurements = 8;
-
- uint32_t computedFlexBasisGeneration = 0;
- FloatOptional computedFlexBasis = {};
-
- // Instead of recomputing the entire layout every single time, we cache some
- // information to break early when nothing changed
- uint32_t generationCount = 0;
- Direction lastOwnerDirection = Direction::Inherit;
-
- uint32_t nextCachedMeasurementsIndex = 0;
- std::array cachedMeasurements = {};
-
- CachedMeasurement cachedLayout{};
-
- Direction direction() const {
- return direction_;
- }
-
- void setDirection(Direction direction) {
- direction_ = direction;
- }
-
- bool hadOverflow() const {
- return hadOverflow_;
- }
-
- void setHadOverflow(bool hadOverflow) {
- hadOverflow_ = hadOverflow;
- }
-
- float dimension(Dimension axis) const {
- return dimensions_[yoga::to_underlying(axis)];
- }
-
- void setDimension(Dimension axis, float dimension) {
- dimensions_[yoga::to_underlying(axis)] = dimension;
- }
-
- float measuredDimension(Dimension axis) const {
- return measuredDimensions_[yoga::to_underlying(axis)];
- }
-
- void setMeasuredDimension(Dimension axis, float dimension) {
- measuredDimensions_[yoga::to_underlying(axis)] = dimension;
- }
-
- float position(PhysicalEdge physicalEdge) const {
- return position_[yoga::to_underlying(physicalEdge)];
- }
-
- void setPosition(PhysicalEdge physicalEdge, float dimension) {
- position_[yoga::to_underlying(physicalEdge)] = dimension;
- }
-
- float margin(PhysicalEdge physicalEdge) const {
- return margin_[yoga::to_underlying(physicalEdge)];
- }
-
- void setMargin(PhysicalEdge physicalEdge, float dimension) {
- margin_[yoga::to_underlying(physicalEdge)] = dimension;
- }
-
- float border(PhysicalEdge physicalEdge) const {
- return border_[yoga::to_underlying(physicalEdge)];
- }
-
- void setBorder(PhysicalEdge physicalEdge, float dimension) {
- border_[yoga::to_underlying(physicalEdge)] = dimension;
- }
-
- float padding(PhysicalEdge physicalEdge) const {
- return padding_[yoga::to_underlying(physicalEdge)];
- }
-
- void setPadding(PhysicalEdge physicalEdge, float dimension) {
- padding_[yoga::to_underlying(physicalEdge)] = dimension;
- }
-
- bool operator==(LayoutResults layout) const;
- bool operator!=(LayoutResults layout) const {
- return !(*this == layout);
- }
-
- private:
- Direction direction_ : bitCount() = Direction::Inherit;
- bool hadOverflow_ : 1 = false;
-
- std::array