Fix typos. #1629
@@ -21,9 +21,9 @@ namespace facebook::yoga {
|
||||
using namespace nlohmann;
|
||||
using namespace std::chrono;
|
||||
|
||||
constexpr uint32_t kNumRepititions = 100;
|
||||
constexpr uint32_t kNumRepetitions = 100;
|
||||
using SteadyClockDurations =
|
||||
std::array<steady_clock::duration, kNumRepititions>;
|
||||
std::array<steady_clock::duration, kNumRepetitions>;
|
||||
|
||||
static bool inputsMatch(
|
||||
float actualWidth,
|
||||
@@ -333,23 +333,23 @@ BenchmarkResult generateBenchmark(json& capture) {
|
||||
static void printBenchmarkResult(
|
||||
const std::string& name,
|
||||
SteadyClockDurations& durations) {
|
||||
std::array<double, kNumRepititions> timesInMs{};
|
||||
std::array<double, kNumRepetitions> timesInMs{};
|
||||
double mean = 0;
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
auto ms = duration<double, std::milli>(durations[i]).count();
|
||||
timesInMs[i] = ms;
|
||||
mean += ms;
|
||||
}
|
||||
mean /= kNumRepititions;
|
||||
mean /= kNumRepetitions;
|
||||
|
||||
std::sort(timesInMs.begin(), timesInMs.end());
|
||||
double median = timesInMs[kNumRepititions / 2];
|
||||
double median = timesInMs[kNumRepetitions / 2];
|
||||
|
||||
double variance = 0;
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
variance += std::pow(timesInMs[i] - mean, 2);
|
||||
}
|
||||
variance /= kNumRepititions;
|
||||
variance /= kNumRepetitions;
|
||||
double stddev = std::sqrt(variance);
|
||||
|
||||
printf("%s: median: %lf ms, stddev: %lf ms\n", name.c_str(), median, stddev);
|
||||
@@ -370,7 +370,7 @@ void benchmark(std::filesystem::path& capturesDir) {
|
||||
std::string captureName = capture.path().stem().string();
|
||||
|
||||
std::cout << "Starting benchmark for " << captureName << std::endl;
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
BenchmarkResult result = generateBenchmark(j);
|
||||
treeCreationDurations[i] = result.treeCreationDuration;
|
||||
layoutDurations[i] = result.layoutDuration;
|
||||
|
@@ -70,7 +70,7 @@
|
||||
<div style="height: 20px; width: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_colunn_max_height_and_margin" style="height: 100px; max-height: 80px; margin-top: 100px; justify-content: center; flex-direction: column;">
|
||||
<div id="justify_content_column_max_height_and_margin" style="height: 100px; max-height: 80px; margin-top: 100px; justify-content: center; flex-direction: column;">
|
||||
<div style="height: 20px; width: 20px;"></div>
|
||||
</div>
|
||||
|
||||
|
@@ -60,13 +60,13 @@
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="margin_auto_mutiple_children_column" style="width: 200px; height: 200px; flex-direction: column; align-items: center;">
|
||||
<div id="margin_auto_multiple_children_column" style="width: 200px; height: 200px; flex-direction: column; align-items: center;">
|
||||
<div style="width: 50px; height: 50px; margin-top:auto;"></div>
|
||||
<div style="width: 50px; height: 50px; margin-top:auto;"></div>
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="margin_auto_mutiple_children_row" style="width: 200px; height: 200px; flex-direction:row; align-items: center;">
|
||||
<div id="margin_auto_multiple_children_row" style="width: 200px; height: 200px; flex-direction:row; align-items: center;">
|
||||
<div style="width: 50px; height: 50px; margin-right:auto;"></div>
|
||||
<div style="width: 50px; height: 50px; margin-right:auto;"></div>
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
|
@@ -33,7 +33,7 @@ namespace facebook::yoga::vanillajni {
|
||||
*
|
||||
* This class is very explicit in its behavior, and it does not allow to perform
|
||||
* unexpected conversions or unexpected ownership transfer. In practice, this
|
||||
* class acts as a unique pointer where the underying JNI reference can have one
|
||||
* class acts as a unique pointer where the underlying JNI reference can have one
|
||||
* and just one owner. Transferring ownership is allowed but it is an explicit
|
||||
* operation (implemented via move semantics and also via explicitly API calls).
|
||||
*
|
||||
|
@@ -35,7 +35,7 @@ namespace facebook::yoga::vanillajni {
|
||||
*
|
||||
* This class is very explicit in its behavior, and it does not allow to perform
|
||||
* unexpected conversions or unexpected ownership transfer. In practice, this
|
||||
* class acts as a unique pointer where the underying JNI reference can have one
|
||||
* class acts as a unique pointer where the underlying JNI reference can have one
|
||||
* and just one owner. Transferring ownership is allowed but it is an explicit
|
||||
* operation (implemented via move semantics and also via explicitly API calls).
|
||||
*
|
||||
|
@@ -836,7 +836,7 @@ public class YGJustifyContentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_colunn_max_height_and_margin() {
|
||||
public void test_justify_content_column_max_height_and_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
|
@@ -696,7 +696,7 @@ public class YGMarginTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_margin_auto_mutiple_children_column() {
|
||||
public void test_margin_auto_multiple_children_column() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
@@ -769,7 +769,7 @@ public class YGMarginTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_margin_auto_mutiple_children_row() {
|
||||
public void test_margin_auto_multiple_children_row() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
|
@@ -900,7 +900,7 @@ test('justify_content_column_min_height_and_margin', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('justify_content_colunn_max_height_and_margin', () => {
|
||||
test('justify_content_column_max_height_and_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
|
@@ -765,7 +765,7 @@ test('margin_auto_bottom_and_top_justify_center', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('margin_auto_mutiple_children_column', () => {
|
||||
test('margin_auto_multiple_children_column', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
@@ -843,7 +843,7 @@ test('margin_auto_mutiple_children_column', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('margin_auto_mutiple_children_row', () => {
|
||||
test('margin_auto_multiple_children_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
|
@@ -834,7 +834,7 @@ TEST(YogaTest, justify_content_column_min_height_and_margin) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, justify_content_colunn_max_height_and_margin) {
|
||||
TEST(YogaTest, justify_content_column_max_height_and_margin) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
@@ -695,7 +695,7 @@ TEST(YogaTest, margin_auto_bottom_and_top_justify_center) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_auto_mutiple_children_column) {
|
||||
TEST(YogaTest, margin_auto_multiple_children_column) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -769,7 +769,7 @@ TEST(YogaTest, margin_auto_mutiple_children_column) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_auto_mutiple_children_row) {
|
||||
TEST(YogaTest, margin_auto_multiple_children_row) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
@@ -21,7 +21,7 @@ Yoga 3.0 is a new major (breaking) version of Yoga, used by React Native 0.74.
|
||||
|
||||
We added full support for the `static` position type which has existed in an incomplete state for some time now. With this release `static` is now web-compliant in the context of Flexbox. Some things that were added/changed:
|
||||
|
||||
* The default position type is now `relative` [again](https://github.com/facebook/yoga/commit/fc88b2f774f0ab9090d7ca15de6680f26d7285ad) and not `static`. This should not have any effect on layout as the previously introduced `YGPostitionTypeStatic` was not being used within Yoga, so it behaved just like `relative`.
|
||||
* The default position type is now `relative` [again](https://github.com/facebook/yoga/commit/fc88b2f774f0ab9090d7ca15de6680f26d7285ad) and not `static`. This should not have any effect on layout as the previously introduced `YGPositionTypeStatic` was not being used within Yoga, so it behaved just like `relative`.
|
||||
* `static` nodes ignore insets (`left`, `right`, `top`, `bottom`, etc.)
|
||||
* The idea of a[ containing block](../../docs/advanced/containing-block) was introduced. For `absolute` nodes this is usually the nearest non-`static` ancestor. For every other position type this is just the parent since Yoga is a Flexbox implementation.
|
||||
* A new public API `YGNodeSetAlwaysFormsContainingBlock` which takes a boolean indicating if the node should always form a containing block for any descendant. This is useful for properly supporting things like [transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_transforms), which will force the node to form a containing block but is outside the scope of Yoga.
|
||||
|
@@ -29,7 +29,7 @@ containing blocks is much more streamlined and it is helpful to frame it differe
|
||||
is helpful for supporting things outside of Yoga which would form a containing block
|
||||
on the web, such as [filters](https://developer.mozilla.org/en-US/docs/Web/CSS/filter)
|
||||
or [transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform). This
|
||||
is done by calling the corresponding API for the lanuage you are working in.
|
||||
is done by calling the corresponding API for the language you are working in.
|
||||
<Tabs groupId="language">
|
||||
<TabItem value="cpp" label="C/C++">
|
||||
```cpp
|
||||
|
@@ -61,7 +61,7 @@ void applyLayout(YogaNode node) {
|
||||
|
||||
:::danger
|
||||
|
||||
Yoga's JavaScript bindings are missing support for acessing the `HasNewLayout` flag. https://github.com/facebook/yoga/issues/681
|
||||
Yoga's JavaScript bindings are missing support for accessing the `HasNewLayout` flag. https://github.com/facebook/yoga/issues/681
|
||||
|
||||
:::
|
||||
|
||||
|
@@ -22,7 +22,7 @@ remaining space between the lines.
|
||||
|
||||
**Space around**: Evenly space wrapped lines across the container's main axis, distributing
|
||||
remaining space around the lines. Compared to space between using
|
||||
space around will result in space being distributed to the begining of
|
||||
space around will result in space being distributed to the beginning of
|
||||
the first lines and end of the last line.
|
||||
|
||||
**Space evenly**: Evenly space wrapped lines across the container's main axis, distributing
|
||||
|
@@ -36,7 +36,7 @@ what [position type](/docs/styling/position) the node has.
|
||||
from where the node would normally be in the container. Each inset property
|
||||
is relative to the node's corresponding physical edge. So `YGNodeStyleSetPosition(node, YGEdgeRight, 10.0f)` will offset the node
|
||||
so that the right edge is 10 units away from where the right edge would be originally.
|
||||
* If the node is aboslute then insets will move the node the designated amount away from
|
||||
* If the node is absolute then insets will move the node the designated amount away from
|
||||
the node's [containing block](/docs/advanced/containing-block). So `YGNodeStyleSetPosition(node, YGEdgeRight, 10.0f)`
|
||||
will offset the node so that the right edge is 10 units away from the [containing block's](/docs/advanced/containing-block)
|
||||
right edge.
|
||||
|
@@ -16,7 +16,7 @@ of its parent if the parent is auto sized.
|
||||
of an element if it has an explicit size set. For auto sized nodes padding will increase
|
||||
the size of the node as well as offset the location of any children.
|
||||
|
||||
**Border**: in Yoga acts exactly like padding and only exists as a seperate property so
|
||||
**Border**: in Yoga acts exactly like padding and only exists as a separate property so
|
||||
that higher level frameworks get a hint as to how thick to draw a border. Yoga however
|
||||
does not do any drawing so just uses this information during layout where border
|
||||
acts exactly like padding.
|
||||
|
@@ -25,7 +25,7 @@ typedef const struct YGNode* YGNodeConstRef;
|
||||
typedef struct YGConfig* YGConfigRef;
|
||||
|
||||
/**
|
||||
* Handle to an immutable Yoga configruation.
|
||||
* Handle to an immutable Yoga configuration.
|
||||
*/
|
||||
typedef const struct YGConfig* YGConfigConstRef;
|
||||
|
||||
@@ -60,7 +60,7 @@ YG_EXPORT void YGConfigSetUseWebDefaults(YGConfigRef config, bool enabled);
|
||||
YG_EXPORT bool YGConfigGetUseWebDefaults(YGConfigConstRef config);
|
||||
|
||||
/**
|
||||
* Yoga will by deafult round final layout positions and dimensions to the
|
||||
* Yoga will by default round final layout positions and dimensions to the
|
||||
* nearst point. `pointScaleFactor` controls the density of the grid used for
|
||||
* layout rounding (e.g. to round to the closest display pixel).
|
||||
*
|
||||
@@ -79,11 +79,11 @@ YG_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config);
|
||||
* Configures how Yoga balances W3C conformance vs compatibility with layouts
|
||||
* created against earlier versions of Yoga.
|
||||
*
|
||||
* By deafult Yoga will prioritize W3C conformance. `Errata` may be set to ask
|
||||
* By default Yoga will prioritize W3C conformance. `Errata` may be set to ask
|
||||
* Yoga to produce specific incorrect behaviors. E.g. `YGConfigSetErrata(config,
|
||||
* YGErrataStretchFlexBasis)`.
|
||||
*
|
||||
* YGErrata is a bitmask, and multiple errata may be set at once. Predfined
|
||||
* YGErrata is a bitmask, and multiple errata may be set at once. Predefined
|
||||
* constants exist for convenience:
|
||||
* 1. YGErrataNone: No errata
|
||||
* 2. YGErrataClassic: Match layout behaviors of Yoga 1.x
|
||||
|
@@ -56,7 +56,7 @@ YG_EXPORT void YGNodeFreeRecursive(YGNodeRef node);
|
||||
/**
|
||||
* Frees the Yoga node without disconnecting it from its owner or children.
|
||||
* Allows garbage collecting Yoga nodes in parallel when the entire tree is
|
||||
* unrechable.
|
||||
* unreachable.
|
||||
*/
|
||||
YG_EXPORT void YGNodeFinalize(YGNodeRef node);
|
||||
|
||||
@@ -186,7 +186,7 @@ typedef struct YGSize {
|
||||
} YGSize;
|
||||
|
||||
/**
|
||||
* Returns the computed dimensions of the node, following the contraints of
|
||||
* Returns the computed dimensions of the node, following the constraints of
|
||||
* `widthMode` and `heightMode`:
|
||||
*
|
||||
* YGMeasureModeUndefined: The parent has not imposed any constraint on the
|
||||
@@ -199,7 +199,7 @@ typedef struct YGSize {
|
||||
* child. The child is going to be given those bounds regardless of how big it
|
||||
* wants to be.
|
||||
*
|
||||
* @returns the size of the leaf node, measured under the given contraints.
|
||||
* @returns the size of the leaf node, measured under the given constraints.
|
||||
*/
|
||||
typedef YGSize (*YGMeasureFunc)(
|
||||
YGNodeConstRef node,
|
||||
@@ -221,7 +221,7 @@ YG_EXPORT void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc);
|
||||
YG_EXPORT bool YGNodeHasMeasureFunc(YGNodeConstRef node);
|
||||
|
||||
/**
|
||||
* @returns a defined offet to baseline (ascent).
|
||||
* @returns a defined offset to baseline (ascent).
|
||||
*/
|
||||
typedef float (*YGBaselineFunc)(YGNodeConstRef node, float width, float height);
|
||||
|
||||
|
Reference in New Issue
Block a user