Automatic lint fixes
Summary: @public A round of automatic lint fixes. Reviewed By: SidharthGuglani Differential Revision: D14590396 fbshipit-source-id: f0b4a0ce503a1d9d46ea7ae788f9f2eac09c2ac7
This commit is contained in:
committed by
Facebook Github Bot
parent
7d7b7b9e18
commit
85352c4e45
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import java.io.File;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,11 +1,9 @@
|
||||
/**
|
||||
* Copyright 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE-examples file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import android.content.Context;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import android.content.Context;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.proguard.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@@ -8,37 +8,30 @@
|
||||
|
||||
#include "./Config.hh"
|
||||
|
||||
/* static */ Config * Config::create(void)
|
||||
{
|
||||
return new Config();
|
||||
/* static */ Config* Config::create(void) {
|
||||
return new Config();
|
||||
}
|
||||
|
||||
/* static */ void Config::destroy(Config * node)
|
||||
{
|
||||
delete node;
|
||||
/* static */ void Config::destroy(Config* node) {
|
||||
delete node;
|
||||
}
|
||||
|
||||
Config::Config(void)
|
||||
: m_config(YGConfigNew())
|
||||
{
|
||||
Config::Config(void) : m_config(YGConfigNew()) {}
|
||||
|
||||
Config::~Config(void) {
|
||||
YGConfigFree(m_config);
|
||||
}
|
||||
|
||||
Config::~Config(void)
|
||||
{
|
||||
YGConfigFree(m_config);
|
||||
void Config::setExperimentalFeatureEnabled(int feature, bool enabled) {
|
||||
YGConfigSetExperimentalFeatureEnabled(
|
||||
m_config, static_cast<YGExperimentalFeature>(feature), enabled);
|
||||
}
|
||||
|
||||
void Config::setExperimentalFeatureEnabled(int feature, bool enabled)
|
||||
{
|
||||
YGConfigSetExperimentalFeatureEnabled(m_config, static_cast<YGExperimentalFeature>(feature), enabled);
|
||||
void Config::setPointScaleFactor(float pixelsInPoint) {
|
||||
YGConfigSetPointScaleFactor(m_config, pixelsInPoint);
|
||||
}
|
||||
|
||||
void Config::setPointScaleFactor(float pixelsInPoint)
|
||||
{
|
||||
YGConfigSetPointScaleFactor(m_config, pixelsInPoint);
|
||||
}
|
||||
|
||||
bool Config::isExperimentalFeatureEnabled(int feature) const
|
||||
{
|
||||
return YGConfigIsExperimentalFeatureEnabled(m_config, static_cast<YGExperimentalFeature>(feature));
|
||||
bool Config::isExperimentalFeatureEnabled(int feature) const {
|
||||
return YGConfigIsExperimentalFeatureEnabled(
|
||||
m_config, static_cast<YGExperimentalFeature>(feature));
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* 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 <nbind/api.h>
|
||||
@@ -13,39 +12,31 @@
|
||||
|
||||
class Config {
|
||||
|
||||
friend class Node;
|
||||
friend class Node;
|
||||
|
||||
public:
|
||||
public:
|
||||
static Config* create(void);
|
||||
|
||||
static Config * create(void);
|
||||
static void destroy(Config* config);
|
||||
|
||||
static void destroy(Config * config);
|
||||
private:
|
||||
Config(void);
|
||||
|
||||
private:
|
||||
public:
|
||||
~Config(void);
|
||||
|
||||
Config(void);
|
||||
public: // Prevent accidental copy
|
||||
Config(Config const&) = delete;
|
||||
|
||||
public:
|
||||
Config const& operator=(Config const&) = delete;
|
||||
|
||||
~Config(void);
|
||||
public: // Setters
|
||||
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
||||
void setPointScaleFactor(float pixelsInPoint);
|
||||
|
||||
public: // Prevent accidental copy
|
||||
|
||||
Config(Config const &) = delete;
|
||||
|
||||
Config const & operator=(Config const &) = delete;
|
||||
|
||||
public: // Setters
|
||||
|
||||
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
||||
void setPointScaleFactor(float pixelsInPoint);
|
||||
|
||||
public: // Getters
|
||||
|
||||
bool isExperimentalFeatureEnabled(int feature) const;
|
||||
|
||||
private:
|
||||
|
||||
YGConfigRef m_config;
|
||||
public: // Getters
|
||||
bool isExperimentalFeatureEnabled(int feature) const;
|
||||
|
||||
private:
|
||||
YGConfigRef m_config;
|
||||
};
|
||||
|
@@ -1,28 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* 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 <nbind/api.h>
|
||||
#include <nbind/BindDefiner.h>
|
||||
|
||||
struct Layout
|
||||
{
|
||||
double left;
|
||||
double right;
|
||||
struct Layout {
|
||||
double left;
|
||||
double right;
|
||||
|
||||
double top;
|
||||
double bottom;
|
||||
double top;
|
||||
double bottom;
|
||||
|
||||
double width;
|
||||
double height;
|
||||
double width;
|
||||
double height;
|
||||
|
||||
void toJS(nbind::cbOutput expose) const
|
||||
{
|
||||
expose(left, right, top, bottom, width, height);
|
||||
}
|
||||
void toJS(nbind::cbOutput expose) const {
|
||||
expose(left, right, top, bottom, width, height);
|
||||
}
|
||||
};
|
||||
|
@@ -13,521 +13,445 @@
|
||||
#include "./Size.hh"
|
||||
#include "./Config.hh"
|
||||
|
||||
static YGSize globalMeasureFunc(YGNodeRef nodeRef, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
|
||||
{
|
||||
Node const & node = *reinterpret_cast<Node const *>(YGNodeGetContext(nodeRef));
|
||||
static YGSize globalMeasureFunc(
|
||||
YGNodeRef nodeRef,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
Node const& node = *reinterpret_cast<Node const*>(YGNodeGetContext(nodeRef));
|
||||
|
||||
Size size = node.callMeasureFunc(width, widthMode, height, heightMode);
|
||||
YGSize ygSize = { static_cast<float>(size.width), static_cast<float>(size.height) };
|
||||
Size size = node.callMeasureFunc(width, widthMode, height, heightMode);
|
||||
YGSize ygSize = {static_cast<float>(size.width),
|
||||
static_cast<float>(size.height)};
|
||||
|
||||
return ygSize;
|
||||
return ygSize;
|
||||
}
|
||||
|
||||
static void globalDirtiedFunc(YGNodeRef nodeRef)
|
||||
{
|
||||
Node const & node = *reinterpret_cast<Node const *>(YGNodeGetContext(nodeRef));
|
||||
static void globalDirtiedFunc(YGNodeRef nodeRef) {
|
||||
Node const& node = *reinterpret_cast<Node const*>(YGNodeGetContext(nodeRef));
|
||||
|
||||
node.callDirtiedFunc();
|
||||
node.callDirtiedFunc();
|
||||
}
|
||||
|
||||
/* static */ Node * Node::createDefault(void)
|
||||
{
|
||||
return new Node(nullptr);
|
||||
/* static */ Node* Node::createDefault(void) {
|
||||
return new Node(nullptr);
|
||||
}
|
||||
|
||||
/* static */ Node * Node::createWithConfig(Config * config)
|
||||
{
|
||||
return new Node(config);
|
||||
/* static */ Node* Node::createWithConfig(Config* config) {
|
||||
return new Node(config);
|
||||
}
|
||||
|
||||
/* static */ void Node::destroy(Node * node)
|
||||
{
|
||||
delete node;
|
||||
/* static */ void Node::destroy(Node* node) {
|
||||
delete node;
|
||||
}
|
||||
|
||||
/* static */ Node * Node::fromYGNode(YGNodeRef nodeRef)
|
||||
{
|
||||
return reinterpret_cast<Node *>(YGNodeGetContext(nodeRef));
|
||||
/* static */ Node* Node::fromYGNode(YGNodeRef nodeRef) {
|
||||
return reinterpret_cast<Node*>(YGNodeGetContext(nodeRef));
|
||||
}
|
||||
|
||||
Node::Node(Config * config)
|
||||
: m_node(config != nullptr ? YGNodeNewWithConfig(config->m_config) : YGNodeNew())
|
||||
, m_measureFunc(nullptr)
|
||||
, m_dirtiedFunc(nullptr)
|
||||
{
|
||||
YGNodeSetContext(m_node, reinterpret_cast<void *>(this));
|
||||
Node::Node(Config* config)
|
||||
: m_node(
|
||||
config != nullptr ? YGNodeNewWithConfig(config->m_config)
|
||||
: YGNodeNew()),
|
||||
m_measureFunc(nullptr),
|
||||
m_dirtiedFunc(nullptr) {
|
||||
YGNodeSetContext(m_node, reinterpret_cast<void*>(this));
|
||||
}
|
||||
|
||||
Node::~Node(void)
|
||||
{
|
||||
YGNodeFree(m_node);
|
||||
Node::~Node(void) {
|
||||
YGNodeFree(m_node);
|
||||
}
|
||||
|
||||
void Node::reset(void)
|
||||
{
|
||||
m_measureFunc.reset(nullptr);
|
||||
m_dirtiedFunc.reset(nullptr);
|
||||
void Node::reset(void) {
|
||||
m_measureFunc.reset(nullptr);
|
||||
m_dirtiedFunc.reset(nullptr);
|
||||
|
||||
YGNodeReset(m_node);
|
||||
YGNodeReset(m_node);
|
||||
}
|
||||
|
||||
void Node::copyStyle(Node const & other)
|
||||
{
|
||||
YGNodeCopyStyle(m_node, other.m_node);
|
||||
void Node::copyStyle(Node const& other) {
|
||||
YGNodeCopyStyle(m_node, other.m_node);
|
||||
}
|
||||
|
||||
void Node::setPositionType(int positionType)
|
||||
{
|
||||
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
||||
void Node::setPositionType(int positionType) {
|
||||
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
||||
}
|
||||
|
||||
void Node::setPosition(int edge, double position)
|
||||
{
|
||||
YGNodeStyleSetPosition(m_node, static_cast<YGEdge>(edge), position);
|
||||
void Node::setPosition(int edge, double position) {
|
||||
YGNodeStyleSetPosition(m_node, static_cast<YGEdge>(edge), position);
|
||||
}
|
||||
|
||||
void Node::setPositionPercent(int edge, double position)
|
||||
{
|
||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||
void Node::setPositionPercent(int edge, double position) {
|
||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||
}
|
||||
|
||||
void Node::setAlignContent(int alignContent)
|
||||
{
|
||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||
void Node::setAlignContent(int alignContent) {
|
||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||
}
|
||||
|
||||
void Node::setAlignItems(int alignItems)
|
||||
{
|
||||
YGNodeStyleSetAlignItems(m_node, static_cast<YGAlign>(alignItems));
|
||||
void Node::setAlignItems(int alignItems) {
|
||||
YGNodeStyleSetAlignItems(m_node, static_cast<YGAlign>(alignItems));
|
||||
}
|
||||
|
||||
void Node::setAlignSelf(int alignSelf)
|
||||
{
|
||||
YGNodeStyleSetAlignSelf(m_node, static_cast<YGAlign>(alignSelf));
|
||||
void Node::setAlignSelf(int alignSelf) {
|
||||
YGNodeStyleSetAlignSelf(m_node, static_cast<YGAlign>(alignSelf));
|
||||
}
|
||||
|
||||
void Node::setFlexDirection(int flexDirection)
|
||||
{
|
||||
YGNodeStyleSetFlexDirection(m_node, static_cast<YGFlexDirection>(flexDirection));
|
||||
void Node::setFlexDirection(int flexDirection) {
|
||||
YGNodeStyleSetFlexDirection(
|
||||
m_node, static_cast<YGFlexDirection>(flexDirection));
|
||||
}
|
||||
|
||||
void Node::setFlexWrap(int flexWrap)
|
||||
{
|
||||
YGNodeStyleSetFlexWrap(m_node, static_cast<YGWrap>(flexWrap));
|
||||
void Node::setFlexWrap(int flexWrap) {
|
||||
YGNodeStyleSetFlexWrap(m_node, static_cast<YGWrap>(flexWrap));
|
||||
}
|
||||
|
||||
void Node::setJustifyContent(int justifyContent)
|
||||
{
|
||||
YGNodeStyleSetJustifyContent(m_node, static_cast<YGJustify>(justifyContent));
|
||||
void Node::setJustifyContent(int justifyContent) {
|
||||
YGNodeStyleSetJustifyContent(m_node, static_cast<YGJustify>(justifyContent));
|
||||
}
|
||||
|
||||
void Node::setMargin(int edge, double margin)
|
||||
{
|
||||
YGNodeStyleSetMargin(m_node, static_cast<YGEdge>(edge), margin);
|
||||
void Node::setMargin(int edge, double margin) {
|
||||
YGNodeStyleSetMargin(m_node, static_cast<YGEdge>(edge), margin);
|
||||
}
|
||||
|
||||
void Node::setMarginPercent(int edge, double margin)
|
||||
{
|
||||
YGNodeStyleSetMarginPercent(m_node, static_cast<YGEdge>(edge), margin);
|
||||
void Node::setMarginPercent(int edge, double margin) {
|
||||
YGNodeStyleSetMarginPercent(m_node, static_cast<YGEdge>(edge), margin);
|
||||
}
|
||||
|
||||
void Node::setMarginAuto(int edge)
|
||||
{
|
||||
YGNodeStyleSetMarginAuto(m_node, static_cast<YGEdge>(edge));
|
||||
void Node::setMarginAuto(int edge) {
|
||||
YGNodeStyleSetMarginAuto(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
void Node::setOverflow(int overflow)
|
||||
{
|
||||
YGNodeStyleSetOverflow(m_node, static_cast<YGOverflow>(overflow));
|
||||
void Node::setOverflow(int overflow) {
|
||||
YGNodeStyleSetOverflow(m_node, static_cast<YGOverflow>(overflow));
|
||||
}
|
||||
|
||||
void Node::setDisplay(int display)
|
||||
{
|
||||
YGNodeStyleSetDisplay(m_node, static_cast<YGDisplay>(display));
|
||||
void Node::setDisplay(int display) {
|
||||
YGNodeStyleSetDisplay(m_node, static_cast<YGDisplay>(display));
|
||||
}
|
||||
|
||||
void Node::setFlex(double flex)
|
||||
{
|
||||
YGNodeStyleSetFlex(m_node, flex);
|
||||
void Node::setFlex(double flex) {
|
||||
YGNodeStyleSetFlex(m_node, flex);
|
||||
}
|
||||
|
||||
void Node::setFlexBasis(double flexBasis)
|
||||
{
|
||||
YGNodeStyleSetFlexBasis(m_node, flexBasis);
|
||||
void Node::setFlexBasis(double flexBasis) {
|
||||
YGNodeStyleSetFlexBasis(m_node, flexBasis);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisPercent(double flexBasis)
|
||||
{
|
||||
YGNodeStyleSetFlexBasisPercent(m_node, flexBasis);
|
||||
void Node::setFlexBasisPercent(double flexBasis) {
|
||||
YGNodeStyleSetFlexBasisPercent(m_node, flexBasis);
|
||||
}
|
||||
|
||||
void Node::setFlexGrow(double flexGrow)
|
||||
{
|
||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||
void Node::setFlexGrow(double flexGrow) {
|
||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||
}
|
||||
|
||||
void Node::setFlexShrink(double flexShrink)
|
||||
{
|
||||
YGNodeStyleSetFlexShrink(m_node, flexShrink);
|
||||
void Node::setFlexShrink(double flexShrink) {
|
||||
YGNodeStyleSetFlexShrink(m_node, flexShrink);
|
||||
}
|
||||
|
||||
void Node::setWidth(double width)
|
||||
{
|
||||
YGNodeStyleSetWidth(m_node, width);
|
||||
void Node::setWidth(double width) {
|
||||
YGNodeStyleSetWidth(m_node, width);
|
||||
}
|
||||
|
||||
void Node::setWidthPercent(double width)
|
||||
{
|
||||
YGNodeStyleSetWidthPercent(m_node, width);
|
||||
void Node::setWidthPercent(double width) {
|
||||
YGNodeStyleSetWidthPercent(m_node, width);
|
||||
}
|
||||
|
||||
void Node::setWidthAuto()
|
||||
{
|
||||
YGNodeStyleSetWidthAuto(m_node);
|
||||
void Node::setWidthAuto() {
|
||||
YGNodeStyleSetWidthAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeight(double height)
|
||||
{
|
||||
YGNodeStyleSetHeight(m_node, height);
|
||||
void Node::setHeight(double height) {
|
||||
YGNodeStyleSetHeight(m_node, height);
|
||||
}
|
||||
|
||||
void Node::setHeightPercent(double height)
|
||||
{
|
||||
YGNodeStyleSetHeightPercent(m_node, height);
|
||||
void Node::setHeightPercent(double height) {
|
||||
YGNodeStyleSetHeightPercent(m_node, height);
|
||||
}
|
||||
|
||||
void Node::setHeightAuto()
|
||||
{
|
||||
YGNodeStyleSetHeightAuto(m_node);
|
||||
void Node::setHeightAuto() {
|
||||
YGNodeStyleSetHeightAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidth(double minWidth)
|
||||
{
|
||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||
void Node::setMinWidth(double minWidth) {
|
||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||
}
|
||||
|
||||
void Node::setMinWidthPercent(double minWidth)
|
||||
{
|
||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||
void Node::setMinWidthPercent(double minWidth) {
|
||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||
}
|
||||
|
||||
void Node::setMinHeight(double minHeight)
|
||||
{
|
||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||
void Node::setMinHeight(double minHeight) {
|
||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||
}
|
||||
|
||||
void Node::setMinHeightPercent(double minHeight)
|
||||
{
|
||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||
void Node::setMinHeightPercent(double minHeight) {
|
||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||
}
|
||||
|
||||
void Node::setMaxWidth(double maxWidth)
|
||||
{
|
||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||
void Node::setMaxWidth(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthPercent(double maxWidth)
|
||||
{
|
||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||
void Node::setMaxWidthPercent(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||
}
|
||||
|
||||
void Node::setMaxHeight(double maxHeight)
|
||||
{
|
||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||
void Node::setMaxHeight(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightPercent(double maxHeight)
|
||||
{
|
||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||
void Node::setMaxHeightPercent(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||
}
|
||||
|
||||
void Node::setAspectRatio(double aspectRatio)
|
||||
{
|
||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||
void Node::setAspectRatio(double aspectRatio) {
|
||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||
}
|
||||
|
||||
void Node::setBorder(int edge, double border)
|
||||
{
|
||||
YGNodeStyleSetBorder(m_node, static_cast<YGEdge>(edge), border);
|
||||
void Node::setBorder(int edge, double border) {
|
||||
YGNodeStyleSetBorder(m_node, static_cast<YGEdge>(edge), border);
|
||||
}
|
||||
|
||||
void Node::setPadding(int edge, double padding)
|
||||
{
|
||||
YGNodeStyleSetPadding(m_node, static_cast<YGEdge>(edge), padding);
|
||||
void Node::setPadding(int edge, double padding) {
|
||||
YGNodeStyleSetPadding(m_node, static_cast<YGEdge>(edge), padding);
|
||||
}
|
||||
|
||||
void Node::setPaddingPercent(int edge, double padding)
|
||||
{
|
||||
YGNodeStyleSetPaddingPercent(m_node, static_cast<YGEdge>(edge), padding);
|
||||
void Node::setPaddingPercent(int edge, double padding) {
|
||||
YGNodeStyleSetPaddingPercent(m_node, static_cast<YGEdge>(edge), padding);
|
||||
}
|
||||
|
||||
void Node::setIsReferenceBaseline(bool isReferenceBaseline) {
|
||||
YGNodeSetIsReferenceBaseline(m_node, isReferenceBaseline);
|
||||
}
|
||||
|
||||
int Node::getPositionType(void) const
|
||||
{
|
||||
return YGNodeStyleGetPositionType(m_node);
|
||||
int Node::getPositionType(void) const {
|
||||
return YGNodeStyleGetPositionType(m_node);
|
||||
}
|
||||
|
||||
Value Node::getPosition(int edge) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetPosition(m_node, static_cast<YGEdge>(edge)));
|
||||
Value Node::getPosition(int edge) const {
|
||||
return Value::fromYGValue(
|
||||
YGNodeStyleGetPosition(m_node, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
int Node::getAlignContent(void) const
|
||||
{
|
||||
return YGNodeStyleGetAlignContent(m_node);
|
||||
int Node::getAlignContent(void) const {
|
||||
return YGNodeStyleGetAlignContent(m_node);
|
||||
}
|
||||
|
||||
int Node::getAlignItems(void) const
|
||||
{
|
||||
return YGNodeStyleGetAlignItems(m_node);
|
||||
int Node::getAlignItems(void) const {
|
||||
return YGNodeStyleGetAlignItems(m_node);
|
||||
}
|
||||
|
||||
int Node::getAlignSelf(void) const
|
||||
{
|
||||
return YGNodeStyleGetAlignSelf(m_node);
|
||||
int Node::getAlignSelf(void) const {
|
||||
return YGNodeStyleGetAlignSelf(m_node);
|
||||
}
|
||||
|
||||
int Node::getFlexDirection(void) const
|
||||
{
|
||||
return YGNodeStyleGetFlexDirection(m_node);
|
||||
int Node::getFlexDirection(void) const {
|
||||
return YGNodeStyleGetFlexDirection(m_node);
|
||||
}
|
||||
|
||||
int Node::getFlexWrap(void) const
|
||||
{
|
||||
return YGNodeStyleGetFlexWrap(m_node);
|
||||
int Node::getFlexWrap(void) const {
|
||||
return YGNodeStyleGetFlexWrap(m_node);
|
||||
}
|
||||
|
||||
int Node::getJustifyContent(void) const
|
||||
{
|
||||
return YGNodeStyleGetJustifyContent(m_node);
|
||||
int Node::getJustifyContent(void) const {
|
||||
return YGNodeStyleGetJustifyContent(m_node);
|
||||
}
|
||||
|
||||
Value Node::getMargin(int edge) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetMargin(m_node, static_cast<YGEdge>(edge)));
|
||||
Value Node::getMargin(int edge) const {
|
||||
return Value::fromYGValue(
|
||||
YGNodeStyleGetMargin(m_node, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
int Node::getOverflow(void) const
|
||||
{
|
||||
return YGNodeStyleGetOverflow(m_node);
|
||||
int Node::getOverflow(void) const {
|
||||
return YGNodeStyleGetOverflow(m_node);
|
||||
}
|
||||
|
||||
int Node::getDisplay(void) const
|
||||
{
|
||||
return YGNodeStyleGetDisplay(m_node);
|
||||
int Node::getDisplay(void) const {
|
||||
return YGNodeStyleGetDisplay(m_node);
|
||||
}
|
||||
|
||||
Value Node::getFlexBasis(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node));
|
||||
Value Node::getFlexBasis(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node));
|
||||
}
|
||||
|
||||
double Node::getFlexGrow(void) const
|
||||
{
|
||||
return YGNodeStyleGetFlexGrow(m_node);
|
||||
double Node::getFlexGrow(void) const {
|
||||
return YGNodeStyleGetFlexGrow(m_node);
|
||||
}
|
||||
|
||||
double Node::getFlexShrink(void) const
|
||||
{
|
||||
return YGNodeStyleGetFlexShrink(m_node);
|
||||
double Node::getFlexShrink(void) const {
|
||||
return YGNodeStyleGetFlexShrink(m_node);
|
||||
}
|
||||
|
||||
Value Node::getWidth(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetWidth(m_node));
|
||||
Value Node::getWidth(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetWidth(m_node));
|
||||
}
|
||||
|
||||
Value Node::getHeight(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetHeight(m_node));
|
||||
Value Node::getHeight(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetHeight(m_node));
|
||||
}
|
||||
|
||||
Value Node::getMinWidth(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node));
|
||||
Value Node::getMinWidth(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node));
|
||||
}
|
||||
|
||||
Value Node::getMinHeight(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node));
|
||||
Value Node::getMinHeight(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node));
|
||||
}
|
||||
|
||||
Value Node::getMaxWidth(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node));
|
||||
Value Node::getMaxWidth(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node));
|
||||
}
|
||||
|
||||
Value Node::getMaxHeight(void) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node));
|
||||
Value Node::getMaxHeight(void) const {
|
||||
return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node));
|
||||
}
|
||||
|
||||
double Node::getAspectRatio(void) const
|
||||
{
|
||||
return YGNodeStyleGetAspectRatio(m_node);
|
||||
double Node::getAspectRatio(void) const {
|
||||
return YGNodeStyleGetAspectRatio(m_node);
|
||||
}
|
||||
|
||||
double Node::getBorder(int edge) const
|
||||
{
|
||||
return YGNodeStyleGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||
double Node::getBorder(int edge) const {
|
||||
return YGNodeStyleGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
Value Node::getPadding(int edge) const
|
||||
{
|
||||
return Value::fromYGValue(YGNodeStyleGetPadding(m_node, static_cast<YGEdge>(edge)));
|
||||
Value Node::getPadding(int edge) const {
|
||||
return Value::fromYGValue(
|
||||
YGNodeStyleGetPadding(m_node, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
bool Node::isReferenceBaseline() {
|
||||
return YGNodeIsReferenceBaseline(m_node);
|
||||
}
|
||||
|
||||
void Node::insertChild(Node * child, unsigned index)
|
||||
{
|
||||
YGNodeInsertChild(m_node, child->m_node, index);
|
||||
void Node::insertChild(Node* child, unsigned index) {
|
||||
YGNodeInsertChild(m_node, child->m_node, index);
|
||||
}
|
||||
|
||||
void Node::removeChild(Node * child)
|
||||
{
|
||||
YGNodeRemoveChild(m_node, child->m_node);
|
||||
void Node::removeChild(Node* child) {
|
||||
YGNodeRemoveChild(m_node, child->m_node);
|
||||
}
|
||||
|
||||
unsigned Node::getChildCount(void) const
|
||||
{
|
||||
return YGNodeGetChildCount(m_node);
|
||||
unsigned Node::getChildCount(void) const {
|
||||
return YGNodeGetChildCount(m_node);
|
||||
}
|
||||
|
||||
Node * Node::getParent(void)
|
||||
{
|
||||
auto nodePtr = YGNodeGetParent(m_node);
|
||||
Node* Node::getParent(void) {
|
||||
auto nodePtr = YGNodeGetParent(m_node);
|
||||
|
||||
if (nodePtr == nullptr)
|
||||
return nullptr;
|
||||
if (nodePtr == nullptr)
|
||||
return nullptr;
|
||||
|
||||
return Node::fromYGNode(nodePtr);
|
||||
return Node::fromYGNode(nodePtr);
|
||||
}
|
||||
|
||||
Node * Node::getChild(unsigned index)
|
||||
{
|
||||
auto nodePtr = YGNodeGetChild(m_node, index);
|
||||
Node* Node::getChild(unsigned index) {
|
||||
auto nodePtr = YGNodeGetChild(m_node, index);
|
||||
|
||||
if (nodePtr == nullptr)
|
||||
return nullptr;
|
||||
if (nodePtr == nullptr)
|
||||
return nullptr;
|
||||
|
||||
return Node::fromYGNode(nodePtr);
|
||||
return Node::fromYGNode(nodePtr);
|
||||
}
|
||||
|
||||
void Node::setMeasureFunc(nbind::cbFunction & measureFunc)
|
||||
{
|
||||
m_measureFunc.reset(new nbind::cbFunction(measureFunc));
|
||||
void Node::setMeasureFunc(nbind::cbFunction& measureFunc) {
|
||||
m_measureFunc.reset(new nbind::cbFunction(measureFunc));
|
||||
|
||||
YGNodeSetMeasureFunc(m_node, &globalMeasureFunc);
|
||||
YGNodeSetMeasureFunc(m_node, &globalMeasureFunc);
|
||||
}
|
||||
|
||||
void Node::unsetMeasureFunc(void)
|
||||
{
|
||||
m_measureFunc.reset(nullptr);
|
||||
void Node::unsetMeasureFunc(void) {
|
||||
m_measureFunc.reset(nullptr);
|
||||
|
||||
YGNodeSetMeasureFunc(m_node, nullptr);
|
||||
YGNodeSetMeasureFunc(m_node, nullptr);
|
||||
}
|
||||
|
||||
Size Node::callMeasureFunc(double width, int widthMode, double height, int heightMode) const
|
||||
{
|
||||
return m_measureFunc->call<Size>(width, widthMode, height, heightMode);
|
||||
Size Node::callMeasureFunc(
|
||||
double width,
|
||||
int widthMode,
|
||||
double height,
|
||||
int heightMode) const {
|
||||
return m_measureFunc->call<Size>(width, widthMode, height, heightMode);
|
||||
}
|
||||
|
||||
void Node::setDirtiedFunc(nbind::cbFunction & dirtiedFunc)
|
||||
{
|
||||
m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc));
|
||||
void Node::setDirtiedFunc(nbind::cbFunction& dirtiedFunc) {
|
||||
m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc));
|
||||
|
||||
YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc);
|
||||
YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc);
|
||||
}
|
||||
|
||||
void Node::unsetDirtiedFunc(void) {
|
||||
m_dirtiedFunc.reset(nullptr);
|
||||
m_dirtiedFunc.reset(nullptr);
|
||||
|
||||
YGNodeSetDirtiedFunc(m_node, nullptr);
|
||||
YGNodeSetDirtiedFunc(m_node, nullptr);
|
||||
}
|
||||
|
||||
void Node::callDirtiedFunc(void) const
|
||||
{
|
||||
m_dirtiedFunc->call<void>();
|
||||
void Node::callDirtiedFunc(void) const {
|
||||
m_dirtiedFunc->call<void>();
|
||||
}
|
||||
|
||||
void Node::markDirty(void)
|
||||
{
|
||||
YGNodeMarkDirty(m_node);
|
||||
void Node::markDirty(void) {
|
||||
YGNodeMarkDirty(m_node);
|
||||
}
|
||||
|
||||
bool Node::isDirty(void) const
|
||||
{
|
||||
return YGNodeIsDirty(m_node);
|
||||
bool Node::isDirty(void) const {
|
||||
return YGNodeIsDirty(m_node);
|
||||
}
|
||||
|
||||
void Node::calculateLayout(double width, double height, int direction)
|
||||
{
|
||||
YGNodeCalculateLayout(m_node, width, height, static_cast<YGDirection>(direction));
|
||||
void Node::calculateLayout(double width, double height, int direction) {
|
||||
YGNodeCalculateLayout(
|
||||
m_node, width, height, static_cast<YGDirection>(direction));
|
||||
}
|
||||
|
||||
double Node::getComputedLeft(void) const
|
||||
{
|
||||
return YGNodeLayoutGetLeft(m_node);
|
||||
double Node::getComputedLeft(void) const {
|
||||
return YGNodeLayoutGetLeft(m_node);
|
||||
}
|
||||
|
||||
double Node::getComputedRight(void) const
|
||||
{
|
||||
return YGNodeLayoutGetRight(m_node);
|
||||
double Node::getComputedRight(void) const {
|
||||
return YGNodeLayoutGetRight(m_node);
|
||||
}
|
||||
|
||||
double Node::getComputedTop(void) const
|
||||
{
|
||||
return YGNodeLayoutGetTop(m_node);
|
||||
double Node::getComputedTop(void) const {
|
||||
return YGNodeLayoutGetTop(m_node);
|
||||
}
|
||||
|
||||
double Node::getComputedBottom(void) const
|
||||
{
|
||||
return YGNodeLayoutGetBottom(m_node);
|
||||
double Node::getComputedBottom(void) const {
|
||||
return YGNodeLayoutGetBottom(m_node);
|
||||
}
|
||||
|
||||
double Node::getComputedWidth(void) const
|
||||
{
|
||||
return YGNodeLayoutGetWidth(m_node);
|
||||
double Node::getComputedWidth(void) const {
|
||||
return YGNodeLayoutGetWidth(m_node);
|
||||
}
|
||||
|
||||
double Node::getComputedHeight(void) const
|
||||
{
|
||||
return YGNodeLayoutGetHeight(m_node);
|
||||
double Node::getComputedHeight(void) const {
|
||||
return YGNodeLayoutGetHeight(m_node);
|
||||
}
|
||||
|
||||
Layout Node::getComputedLayout(void) const
|
||||
{
|
||||
Layout layout;
|
||||
Layout Node::getComputedLayout(void) const {
|
||||
Layout layout;
|
||||
|
||||
layout.left = YGNodeLayoutGetLeft(m_node);
|
||||
layout.right = YGNodeLayoutGetRight(m_node);
|
||||
layout.left = YGNodeLayoutGetLeft(m_node);
|
||||
layout.right = YGNodeLayoutGetRight(m_node);
|
||||
|
||||
layout.top = YGNodeLayoutGetTop(m_node);
|
||||
layout.bottom = YGNodeLayoutGetBottom(m_node);
|
||||
layout.top = YGNodeLayoutGetTop(m_node);
|
||||
layout.bottom = YGNodeLayoutGetBottom(m_node);
|
||||
|
||||
layout.width = YGNodeLayoutGetWidth(m_node);
|
||||
layout.height = YGNodeLayoutGetHeight(m_node);
|
||||
layout.width = YGNodeLayoutGetWidth(m_node);
|
||||
layout.height = YGNodeLayoutGetHeight(m_node);
|
||||
|
||||
return layout;
|
||||
return layout;
|
||||
}
|
||||
|
||||
double Node::getComputedMargin(int edge) const
|
||||
{
|
||||
return YGNodeLayoutGetMargin(m_node, static_cast<YGEdge>(edge));
|
||||
double Node::getComputedMargin(int edge) const {
|
||||
return YGNodeLayoutGetMargin(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
double Node::getComputedBorder(int edge) const
|
||||
{
|
||||
return YGNodeLayoutGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||
double Node::getComputedBorder(int edge) const {
|
||||
return YGNodeLayoutGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
double Node::getComputedPadding(int edge) const
|
||||
{
|
||||
return YGNodeLayoutGetPadding(m_node, static_cast<YGEdge>(edge));
|
||||
double Node::getComputedPadding(int edge) const {
|
||||
return YGNodeLayoutGetPadding(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* 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 <memory>
|
||||
@@ -20,188 +19,176 @@
|
||||
|
||||
class Node {
|
||||
|
||||
public:
|
||||
public:
|
||||
static Node* createDefault(void);
|
||||
static Node* createWithConfig(Config* config);
|
||||
|
||||
static Node * createDefault(void);
|
||||
static Node * createWithConfig(Config * config);
|
||||
static void destroy(Node* node);
|
||||
|
||||
static void destroy(Node * node);
|
||||
public:
|
||||
static Node* fromYGNode(YGNodeRef nodeRef);
|
||||
|
||||
public:
|
||||
private:
|
||||
Node(Config* config);
|
||||
|
||||
static Node * fromYGNode(YGNodeRef nodeRef);
|
||||
public:
|
||||
~Node(void);
|
||||
|
||||
private:
|
||||
public: // Prevent accidental copy
|
||||
Node(Node const&) = delete;
|
||||
|
||||
Node(Config * config);
|
||||
Node const& operator=(Node const&) = delete;
|
||||
|
||||
public:
|
||||
public:
|
||||
void reset(void);
|
||||
|
||||
~Node(void);
|
||||
public: // Style setters
|
||||
void copyStyle(Node const& other);
|
||||
|
||||
public: // Prevent accidental copy
|
||||
void setPositionType(int positionType);
|
||||
void setPosition(int edge, double position);
|
||||
void setPositionPercent(int edge, double position);
|
||||
|
||||
Node(Node const &) = delete;
|
||||
void setAlignContent(int alignContent);
|
||||
void setAlignItems(int alignItems);
|
||||
void setAlignSelf(int alignSelf);
|
||||
void setFlexDirection(int flexDirection);
|
||||
void setFlexWrap(int flexWrap);
|
||||
void setJustifyContent(int justifyContent);
|
||||
|
||||
Node const & operator=(Node const &) = delete;
|
||||
void setMargin(int edge, double margin);
|
||||
void setMarginPercent(int edge, double margin);
|
||||
void setMarginAuto(int edge);
|
||||
|
||||
public:
|
||||
void setOverflow(int overflow);
|
||||
void setDisplay(int display);
|
||||
|
||||
void reset(void);
|
||||
void setFlex(double flex);
|
||||
void setFlexBasis(double flexBasis);
|
||||
void setFlexBasisPercent(double flexBasis);
|
||||
void setFlexBasisAuto();
|
||||
void setFlexGrow(double flexGrow);
|
||||
void setFlexShrink(double flexShrink);
|
||||
|
||||
public: // Style setters
|
||||
void setWidth(double width);
|
||||
void setWidthPercent(double width);
|
||||
void setWidthAuto();
|
||||
void setHeight(double height);
|
||||
void setHeightPercent(double height);
|
||||
void setHeightAuto();
|
||||
|
||||
void copyStyle(Node const & other);
|
||||
void setMinWidth(double minWidth);
|
||||
void setMinWidthPercent(double minWidth);
|
||||
void setMinHeight(double minHeight);
|
||||
void setMinHeightPercent(double minHeight);
|
||||
|
||||
void setPositionType(int positionType);
|
||||
void setPosition(int edge, double position);
|
||||
void setPositionPercent(int edge, double position);
|
||||
void setMaxWidth(double maxWidth);
|
||||
void setMaxWidthPercent(double maxWidth);
|
||||
void setMaxHeight(double maxHeight);
|
||||
void setMaxHeightPercent(double maxHeight);
|
||||
|
||||
void setAlignContent(int alignContent);
|
||||
void setAlignItems(int alignItems);
|
||||
void setAlignSelf(int alignSelf);
|
||||
void setFlexDirection(int flexDirection);
|
||||
void setFlexWrap(int flexWrap);
|
||||
void setJustifyContent(int justifyContent);
|
||||
void setAspectRatio(double aspectRatio);
|
||||
|
||||
void setMargin(int edge, double margin);
|
||||
void setMarginPercent(int edge, double margin);
|
||||
void setMarginAuto(int edge);
|
||||
void setBorder(int edge, double border);
|
||||
|
||||
void setOverflow(int overflow);
|
||||
void setDisplay(int display);
|
||||
void setPadding(int edge, double padding);
|
||||
void setPaddingPercent(int edge, double padding);
|
||||
|
||||
void setFlex(double flex);
|
||||
void setFlexBasis(double flexBasis);
|
||||
void setFlexBasisPercent(double flexBasis);
|
||||
void setFlexBasisAuto();
|
||||
void setFlexGrow(double flexGrow);
|
||||
void setFlexShrink(double flexShrink);
|
||||
public: // Style getters
|
||||
int getPositionType(void) const;
|
||||
Value getPosition(int edge) const;
|
||||
|
||||
void setWidth(double width);
|
||||
void setWidthPercent(double width);
|
||||
void setWidthAuto();
|
||||
void setHeight(double height);
|
||||
void setHeightPercent(double height);
|
||||
void setHeightAuto();
|
||||
int getAlignContent(void) const;
|
||||
int getAlignItems(void) const;
|
||||
int getAlignSelf(void) const;
|
||||
int getFlexDirection(void) const;
|
||||
int getFlexWrap(void) const;
|
||||
int getJustifyContent(void) const;
|
||||
|
||||
void setMinWidth(double minWidth);
|
||||
void setMinWidthPercent(double minWidth);
|
||||
void setMinHeight(double minHeight);
|
||||
void setMinHeightPercent(double minHeight);
|
||||
Value getMargin(int edge) const;
|
||||
|
||||
void setMaxWidth(double maxWidth);
|
||||
void setMaxWidthPercent(double maxWidth);
|
||||
void setMaxHeight(double maxHeight);
|
||||
void setMaxHeightPercent(double maxHeight);
|
||||
int getOverflow(void) const;
|
||||
int getDisplay(void) const;
|
||||
|
||||
void setAspectRatio(double aspectRatio);
|
||||
Value getFlexBasis(void) const;
|
||||
double getFlexGrow(void) const;
|
||||
double getFlexShrink(void) const;
|
||||
|
||||
void setBorder(int edge, double border);
|
||||
Value getWidth(void) const;
|
||||
Value getHeight(void) const;
|
||||
|
||||
void setPadding(int edge, double padding);
|
||||
void setPaddingPercent(int edge, double padding);
|
||||
Value getMinWidth(void) const;
|
||||
Value getMinHeight(void) const;
|
||||
|
||||
public: // Style getters
|
||||
Value getMaxWidth(void) const;
|
||||
Value getMaxHeight(void) const;
|
||||
|
||||
int getPositionType(void) const;
|
||||
Value getPosition(int edge) const;
|
||||
double getAspectRatio(void) const;
|
||||
|
||||
int getAlignContent(void) const;
|
||||
int getAlignItems(void) const;
|
||||
int getAlignSelf(void) const;
|
||||
int getFlexDirection(void) const;
|
||||
int getFlexWrap(void) const;
|
||||
int getJustifyContent(void) const;
|
||||
double getBorder(int edge) const;
|
||||
|
||||
Value getMargin(int edge) const;
|
||||
Value getPadding(int edge) const;
|
||||
|
||||
int getOverflow(void) const;
|
||||
int getDisplay(void) const;
|
||||
public: // Tree hierarchy mutators
|
||||
void insertChild(Node* child, unsigned index);
|
||||
void removeChild(Node* child);
|
||||
|
||||
Value getFlexBasis(void) const;
|
||||
double getFlexGrow(void) const;
|
||||
double getFlexShrink(void) const;
|
||||
public: // Tree hierarchy inspectors
|
||||
unsigned getChildCount(void) const;
|
||||
|
||||
Value getWidth(void) const;
|
||||
Value getHeight(void) const;
|
||||
// The following functions cannot be const because they could discard const
|
||||
// qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const)
|
||||
|
||||
Value getMinWidth(void) const;
|
||||
Value getMinHeight(void) const;
|
||||
Node* getParent(void);
|
||||
Node* getChild(unsigned index);
|
||||
|
||||
Value getMaxWidth(void) const;
|
||||
Value getMaxHeight(void) const;
|
||||
public: // Measure func mutators
|
||||
void setMeasureFunc(nbind::cbFunction& measureFunc);
|
||||
void unsetMeasureFunc(void);
|
||||
|
||||
double getAspectRatio(void) const;
|
||||
public: // Measure func inspectors
|
||||
Size callMeasureFunc(
|
||||
double width,
|
||||
int widthMode,
|
||||
double height,
|
||||
int heightMode) const;
|
||||
|
||||
double getBorder(int edge) const;
|
||||
public: // Dirtied func mutators
|
||||
void setDirtiedFunc(nbind::cbFunction& dirtiedFunc);
|
||||
void unsetDirtiedFunc(void);
|
||||
|
||||
Value getPadding(int edge) const;
|
||||
public: // Dirtied func inspectors
|
||||
void callDirtiedFunc(void) const;
|
||||
|
||||
public: // Tree hierarchy mutators
|
||||
public: // Dirtiness accessors
|
||||
void markDirty(void);
|
||||
bool isDirty(void) const;
|
||||
|
||||
void insertChild(Node * child, unsigned index);
|
||||
void removeChild(Node * child);
|
||||
public: // Layout mutators
|
||||
void calculateLayout(double width, double height, int direction);
|
||||
|
||||
public: // Tree hierarchy inspectors
|
||||
public: // Layout inspectors
|
||||
double getComputedLeft(void) const;
|
||||
double getComputedRight(void) const;
|
||||
|
||||
unsigned getChildCount(void) const;
|
||||
double getComputedTop(void) const;
|
||||
double getComputedBottom(void) const;
|
||||
|
||||
// The following functions cannot be const because they could discard const qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const)
|
||||
double getComputedWidth(void) const;
|
||||
double getComputedHeight(void) const;
|
||||
|
||||
Node * getParent(void);
|
||||
Node * getChild(unsigned index);
|
||||
Layout getComputedLayout(void) const;
|
||||
|
||||
public: // Measure func mutators
|
||||
double getComputedMargin(int edge) const;
|
||||
double getComputedBorder(int edge) const;
|
||||
double getComputedPadding(int edge) const;
|
||||
|
||||
void setMeasureFunc(nbind::cbFunction & measureFunc);
|
||||
void unsetMeasureFunc(void);
|
||||
public:
|
||||
void setIsReferenceBaseline(bool isReferenceBaseline);
|
||||
bool isReferenceBaseline();
|
||||
|
||||
public: // Measure func inspectors
|
||||
YGNodeRef m_node;
|
||||
|
||||
Size callMeasureFunc(double width, int widthMode, double height, int heightMode) const;
|
||||
|
||||
public: // Dirtied func mutators
|
||||
|
||||
void setDirtiedFunc(nbind::cbFunction & dirtiedFunc);
|
||||
void unsetDirtiedFunc(void);
|
||||
|
||||
public: // Dirtied func inspectors
|
||||
|
||||
void callDirtiedFunc(void) const;
|
||||
|
||||
public: // Dirtiness accessors
|
||||
|
||||
void markDirty(void);
|
||||
bool isDirty(void) const;
|
||||
|
||||
public: // Layout mutators
|
||||
|
||||
void calculateLayout(double width, double height, int direction);
|
||||
|
||||
public: // Layout inspectors
|
||||
|
||||
double getComputedLeft(void) const;
|
||||
double getComputedRight(void) const;
|
||||
|
||||
double getComputedTop(void) const;
|
||||
double getComputedBottom(void) const;
|
||||
|
||||
double getComputedWidth(void) const;
|
||||
double getComputedHeight(void) const;
|
||||
|
||||
Layout getComputedLayout(void) const;
|
||||
|
||||
double getComputedMargin(int edge) const;
|
||||
double getComputedBorder(int edge) const;
|
||||
double getComputedPadding(int edge) const;
|
||||
|
||||
public:
|
||||
void setIsReferenceBaseline(bool isReferenceBaseline);
|
||||
bool isReferenceBaseline();
|
||||
|
||||
YGNodeRef m_node;
|
||||
|
||||
std::unique_ptr<nbind::cbFunction> m_measureFunc;
|
||||
std::unique_ptr<nbind::cbFunction> m_dirtiedFunc;
|
||||
std::unique_ptr<nbind::cbFunction> m_measureFunc;
|
||||
std::unique_ptr<nbind::cbFunction> m_dirtiedFunc;
|
||||
};
|
||||
|
@@ -1,34 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* 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 <nbind/api.h>
|
||||
#include <nbind/BindDefiner.h>
|
||||
|
||||
struct Size
|
||||
{
|
||||
double width;
|
||||
double height;
|
||||
struct Size {
|
||||
double width;
|
||||
double height;
|
||||
|
||||
Size(void)
|
||||
: width(0.0)
|
||||
, height(0.0)
|
||||
{
|
||||
}
|
||||
Size(void) : width(0.0), height(0.0) {}
|
||||
|
||||
Size(double width, double height)
|
||||
: width(width)
|
||||
, height(height)
|
||||
{
|
||||
}
|
||||
Size(double width, double height) : width(width), height(height) {}
|
||||
|
||||
void toJS(nbind::cbOutput expose) const
|
||||
{
|
||||
expose(width, height);
|
||||
}
|
||||
void toJS(nbind::cbOutput expose) const {
|
||||
expose(width, height);
|
||||
}
|
||||
};
|
||||
|
@@ -1,38 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* 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/Yoga.h>
|
||||
|
||||
struct Value
|
||||
{
|
||||
static Value fromYGValue(YGValue const & ygValue)
|
||||
{
|
||||
return Value(static_cast<int>(ygValue.unit), ygValue.value);
|
||||
}
|
||||
struct Value {
|
||||
static Value fromYGValue(YGValue const& ygValue) {
|
||||
return Value(static_cast<int>(ygValue.unit), ygValue.value);
|
||||
}
|
||||
|
||||
int unit;
|
||||
double value;
|
||||
int unit;
|
||||
double value;
|
||||
|
||||
Value(void)
|
||||
: unit(YGUnitUndefined)
|
||||
, value(0.0)
|
||||
{
|
||||
}
|
||||
Value(void) : unit(YGUnitUndefined), value(0.0) {}
|
||||
|
||||
Value(int unit, double value)
|
||||
: unit(unit)
|
||||
, value(value)
|
||||
{
|
||||
}
|
||||
Value(int unit, double value) : unit(unit), value(value) {}
|
||||
|
||||
void toJS(nbind::cbOutput expose) const
|
||||
{
|
||||
expose(unit, value);
|
||||
}
|
||||
void toJS(nbind::cbOutput expose) const {
|
||||
expose(unit, value);
|
||||
}
|
||||
};
|
||||
|
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "./global.hh"
|
||||
|
||||
unsigned getInstanceCount(void)
|
||||
{
|
||||
return YGNodeGetInstanceCount();
|
||||
unsigned getInstanceCount(void) {
|
||||
return YGNodeGetInstanceCount();
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
unsigned getInstanceCount(void);
|
||||
|
@@ -15,166 +15,160 @@
|
||||
|
||||
#include <nbind/nbind.h>
|
||||
|
||||
NBIND_GLOBAL()
|
||||
{
|
||||
function(getInstanceCount);
|
||||
NBIND_GLOBAL() {
|
||||
function(getInstanceCount);
|
||||
}
|
||||
|
||||
NBIND_CLASS(Size)
|
||||
{
|
||||
construct<>();
|
||||
construct<double, double>();
|
||||
NBIND_CLASS(Size) {
|
||||
construct<>();
|
||||
construct<double, double>();
|
||||
}
|
||||
|
||||
NBIND_CLASS(Layout)
|
||||
{
|
||||
construct<>();
|
||||
NBIND_CLASS(Layout) {
|
||||
construct<>();
|
||||
}
|
||||
|
||||
NBIND_CLASS(Value)
|
||||
{
|
||||
construct<>();
|
||||
construct<int, double>();
|
||||
NBIND_CLASS(Value) {
|
||||
construct<>();
|
||||
construct<int, double>();
|
||||
}
|
||||
|
||||
NBIND_CLASS(Config)
|
||||
{
|
||||
method(create);
|
||||
NBIND_CLASS(Config) {
|
||||
method(create);
|
||||
|
||||
method(destroy);
|
||||
method(destroy);
|
||||
|
||||
method(setExperimentalFeatureEnabled);
|
||||
method(setPointScaleFactor);
|
||||
method(setExperimentalFeatureEnabled);
|
||||
method(setPointScaleFactor);
|
||||
|
||||
method(isExperimentalFeatureEnabled);
|
||||
method(isExperimentalFeatureEnabled);
|
||||
}
|
||||
|
||||
NBIND_CLASS(Node)
|
||||
{
|
||||
method(createDefault);
|
||||
method(createWithConfig);
|
||||
method(destroy);
|
||||
NBIND_CLASS(Node) {
|
||||
method(createDefault);
|
||||
method(createWithConfig);
|
||||
method(destroy);
|
||||
|
||||
method(reset);
|
||||
method(reset);
|
||||
|
||||
method(copyStyle);
|
||||
method(copyStyle);
|
||||
|
||||
method(setPositionType);
|
||||
method(setPosition);
|
||||
method(setPositionPercent);
|
||||
method(setPositionType);
|
||||
method(setPosition);
|
||||
method(setPositionPercent);
|
||||
|
||||
method(setAlignContent);
|
||||
method(setAlignItems);
|
||||
method(setAlignSelf);
|
||||
method(setFlexDirection);
|
||||
method(setFlexWrap);
|
||||
method(setJustifyContent);
|
||||
method(setAlignContent);
|
||||
method(setAlignItems);
|
||||
method(setAlignSelf);
|
||||
method(setFlexDirection);
|
||||
method(setFlexWrap);
|
||||
method(setJustifyContent);
|
||||
|
||||
method(setMargin);
|
||||
method(setMarginPercent);
|
||||
method(setMarginAuto);
|
||||
method(setMargin);
|
||||
method(setMarginPercent);
|
||||
method(setMarginAuto);
|
||||
|
||||
method(setOverflow);
|
||||
method(setDisplay);
|
||||
method(setOverflow);
|
||||
method(setDisplay);
|
||||
|
||||
method(setFlex);
|
||||
method(setFlexBasis);
|
||||
method(setFlexBasisPercent);
|
||||
method(setFlexGrow);
|
||||
method(setFlexShrink);
|
||||
method(setFlex);
|
||||
method(setFlexBasis);
|
||||
method(setFlexBasisPercent);
|
||||
method(setFlexGrow);
|
||||
method(setFlexShrink);
|
||||
|
||||
method(setWidth);
|
||||
method(setWidthPercent);
|
||||
method(setWidthAuto);
|
||||
method(setHeight);
|
||||
method(setHeightPercent);
|
||||
method(setHeightAuto);
|
||||
method(setWidth);
|
||||
method(setWidthPercent);
|
||||
method(setWidthAuto);
|
||||
method(setHeight);
|
||||
method(setHeightPercent);
|
||||
method(setHeightAuto);
|
||||
|
||||
method(setMinWidth);
|
||||
method(setMinWidthPercent);
|
||||
method(setMinHeight);
|
||||
method(setMinHeightPercent);
|
||||
method(setMinWidth);
|
||||
method(setMinWidthPercent);
|
||||
method(setMinHeight);
|
||||
method(setMinHeightPercent);
|
||||
|
||||
method(setMaxWidth);
|
||||
method(setMaxWidthPercent);
|
||||
method(setMaxHeight);
|
||||
method(setMaxHeightPercent);
|
||||
method(setMaxWidth);
|
||||
method(setMaxWidthPercent);
|
||||
method(setMaxHeight);
|
||||
method(setMaxHeightPercent);
|
||||
|
||||
method(setAspectRatio);
|
||||
method(setAspectRatio);
|
||||
|
||||
method(setBorder);
|
||||
method(setBorder);
|
||||
|
||||
method(setPadding);
|
||||
method(setPaddingPercent);
|
||||
method(setPadding);
|
||||
method(setPaddingPercent);
|
||||
|
||||
method(getPositionType);
|
||||
method(getPosition);
|
||||
method(getPositionType);
|
||||
method(getPosition);
|
||||
|
||||
method(getAlignContent);
|
||||
method(getAlignItems);
|
||||
method(getAlignSelf);
|
||||
method(getFlexDirection);
|
||||
method(getFlexWrap);
|
||||
method(getJustifyContent);
|
||||
method(getAlignContent);
|
||||
method(getAlignItems);
|
||||
method(getAlignSelf);
|
||||
method(getFlexDirection);
|
||||
method(getFlexWrap);
|
||||
method(getJustifyContent);
|
||||
|
||||
method(getMargin);
|
||||
method(getMargin);
|
||||
|
||||
method(getFlexBasis);
|
||||
method(getFlexGrow);
|
||||
method(getFlexShrink);
|
||||
method(getFlexBasis);
|
||||
method(getFlexGrow);
|
||||
method(getFlexShrink);
|
||||
|
||||
method(getWidth);
|
||||
method(getHeight);
|
||||
method(getWidth);
|
||||
method(getHeight);
|
||||
|
||||
method(getMinWidth);
|
||||
method(getMinHeight);
|
||||
method(getMinWidth);
|
||||
method(getMinHeight);
|
||||
|
||||
method(getMaxWidth);
|
||||
method(getMaxHeight);
|
||||
method(getMaxWidth);
|
||||
method(getMaxHeight);
|
||||
|
||||
method(getAspectRatio);
|
||||
method(getAspectRatio);
|
||||
|
||||
method(getBorder);
|
||||
method(getBorder);
|
||||
|
||||
method(getOverflow);
|
||||
method(getDisplay);
|
||||
method(getOverflow);
|
||||
method(getDisplay);
|
||||
|
||||
method(getPadding);
|
||||
method(getPadding);
|
||||
|
||||
method(insertChild);
|
||||
method(removeChild);
|
||||
method(insertChild);
|
||||
method(removeChild);
|
||||
|
||||
method(getChildCount);
|
||||
method(getChildCount);
|
||||
|
||||
method(getParent);
|
||||
method(getChild);
|
||||
method(getParent);
|
||||
method(getChild);
|
||||
|
||||
method(isReferenceBaseline);
|
||||
method(setIsReferenceBaseline);
|
||||
method(isReferenceBaseline);
|
||||
method(setIsReferenceBaseline);
|
||||
|
||||
method(setMeasureFunc);
|
||||
method(unsetMeasureFunc);
|
||||
method(setMeasureFunc);
|
||||
method(unsetMeasureFunc);
|
||||
|
||||
method(setDirtiedFunc);
|
||||
method(unsetDirtiedFunc);
|
||||
method(setDirtiedFunc);
|
||||
method(unsetDirtiedFunc);
|
||||
|
||||
method(markDirty);
|
||||
method(isDirty);
|
||||
method(markDirty);
|
||||
method(isDirty);
|
||||
|
||||
method(calculateLayout);
|
||||
method(calculateLayout);
|
||||
|
||||
method(getComputedLeft);
|
||||
method(getComputedRight);
|
||||
method(getComputedLeft);
|
||||
method(getComputedRight);
|
||||
|
||||
method(getComputedTop);
|
||||
method(getComputedBottom);
|
||||
method(getComputedTop);
|
||||
method(getComputedBottom);
|
||||
|
||||
method(getComputedWidth);
|
||||
method(getComputedHeight);
|
||||
method(getComputedWidth);
|
||||
method(getComputedHeight);
|
||||
|
||||
method(getComputedLayout);
|
||||
method(getComputedLayout);
|
||||
|
||||
method(getComputedMargin);
|
||||
method(getComputedBorder);
|
||||
method(getComputedPadding);
|
||||
method(getComputedMargin);
|
||||
method(getComputedBorder);
|
||||
method(getComputedPadding);
|
||||
}
|
||||
|
@@ -325,10 +325,10 @@ TEST(YogaTest, can_be_assigned_from_YGValue) {
|
||||
|
||||
YGValue v{2.0f, YGUnitPercent};
|
||||
c = v;
|
||||
ASSERT_EQ((YGValue)c, v);
|
||||
ASSERT_EQ((YGValue) c, v);
|
||||
|
||||
c = YGValue{123, YGUnitPoint};
|
||||
ASSERT_EQ((YGValue)c, (YGValue{123, YGUnitPoint}));
|
||||
ASSERT_EQ((YGValue) c, (YGValue{123, YGUnitPoint}));
|
||||
}
|
||||
|
||||
TEST(YogaTest, compact_value_bound_representations) {
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -183,7 +184,9 @@ TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -575,7 +578,9 @@ TEST(YogaTest, absolute_layout_align_items_center_on_child_only) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_position) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_top_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -620,7 +625,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_po
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -665,7 +672,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_position) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_left_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
@@ -710,7 +719,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_p
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_right_position) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
absolute_layout_align_items_and_justify_content_center_and_right_position) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
@@ -8,8 +8,10 @@
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static float
|
||||
_baselineFunc(YGNodeRef node, const float width, const float height) {
|
||||
static float _baselineFunc(
|
||||
YGNodeRef node,
|
||||
const float width,
|
||||
const float height) {
|
||||
return height / 2;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
@@ -8,11 +8,12 @@
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static YGSize _measure(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
static YGSize _measure(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
.width = widthMode == YGMeasureModeExactly ? width : 50,
|
||||
.height = heightMode == YGMeasureModeExactly ? height : 50,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static float _baseline(YGNodeRef node, const float width, const float height) {
|
||||
float* baseline = (float*)node->getContext();
|
||||
float* baseline = (float*) node->getContext();
|
||||
return *baseline;
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ TEST(YogaTest, assert_default_values) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, assert_webdefault_values) {
|
||||
YGConfig *config = YGConfigNew();
|
||||
YGConfig* config = YGConfigNew();
|
||||
YGConfigSetUseWebDefaults(config, true);
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
@@ -102,7 +102,7 @@ TEST(YogaTest, assert_webdefault_values) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, assert_webdefault_values_reset) {
|
||||
YGConfig *config = YGConfigNew();
|
||||
YGConfig* config = YGConfigNew();
|
||||
YGConfigSetUseWebDefaults(config, true);
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeReset(root);
|
||||
@@ -116,7 +116,7 @@ TEST(YogaTest, assert_webdefault_values_reset) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, assert_legacy_stretch_behaviour) {
|
||||
YGConfig *config = YGConfigNew();
|
||||
YGConfig* config = YGConfigNew();
|
||||
YGConfigSetUseLegacyStretchBehaviour(config, true);
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 500);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <yoga/YGNode.h>
|
||||
|
||||
static void _dirtied(YGNodeRef node) {
|
||||
int* dirtiedCount = (int*)node->getContext();
|
||||
int* dirtiedCount = (int*) node->getContext();
|
||||
(*dirtiedCount)++;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
@@ -29,7 +29,9 @@ protected:
|
||||
YGConfigRef config;
|
||||
};
|
||||
|
||||
TEST_F(YogaTest_HadOverflowTests, children_overflow_no_wrap_and_no_flex_children) {
|
||||
TEST_F(
|
||||
YogaTest_HadOverflowTests,
|
||||
children_overflow_no_wrap_and_no_flex_children) {
|
||||
const YGNodeRef child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(child0, 80);
|
||||
YGNodeStyleSetHeight(child0, 40);
|
||||
@@ -47,7 +49,9 @@ TEST_F(YogaTest_HadOverflowTests, children_overflow_no_wrap_and_no_flex_children
|
||||
ASSERT_TRUE(YGNodeLayoutGetHadOverflow(root));
|
||||
}
|
||||
|
||||
TEST_F(YogaTest_HadOverflowTests, spacing_overflow_no_wrap_and_no_flex_children) {
|
||||
TEST_F(
|
||||
YogaTest_HadOverflowTests,
|
||||
spacing_overflow_no_wrap_and_no_flex_children) {
|
||||
const YGNodeRef child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(child0, 80);
|
||||
YGNodeStyleSetHeight(child0, 40);
|
||||
|
@@ -9,7 +9,8 @@
|
||||
|
||||
// This test isn't correct from the Flexbox standard standpoint,
|
||||
// because percentages are calculated with parent constraints.
|
||||
// However, we need to make sure we fail gracefully in this case, not returning NaN
|
||||
// However, we need to make sure we fail gracefully in this case, not returning
|
||||
// NaN
|
||||
TEST(YogaTest, percent_absolute_position_infinite_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
|
@@ -10,17 +10,19 @@
|
||||
|
||||
namespace {
|
||||
char writeBuffer[4096];
|
||||
int _unmanagedLogger(const YGConfigRef config,
|
||||
const YGNodeRef node,
|
||||
YGLogLevel level,
|
||||
const char *format,
|
||||
va_list args) {
|
||||
return vsnprintf(writeBuffer + strlen(writeBuffer),
|
||||
sizeof(writeBuffer) - strlen(writeBuffer),
|
||||
format,
|
||||
args);
|
||||
}
|
||||
int _unmanagedLogger(
|
||||
const YGConfigRef config,
|
||||
const YGNodeRef node,
|
||||
YGLogLevel level,
|
||||
const char* format,
|
||||
va_list args) {
|
||||
return vsnprintf(
|
||||
writeBuffer + strlen(writeBuffer),
|
||||
sizeof(writeBuffer) - strlen(writeBuffer),
|
||||
format,
|
||||
args);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(YogaTest, config_print_tree_enabled) {
|
||||
writeBuffer[0] = '\0';
|
||||
@@ -68,13 +70,16 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
||||
YGConfigSetLogger(config, _unmanagedLogger);
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(root,
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||
YGPrintOptionsStyle));
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" ></div>";
|
||||
const char* expected =
|
||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
||||
"></div>";
|
||||
ASSERT_STREQ(expected, writeBuffer);
|
||||
}
|
||||
|
||||
@@ -90,15 +95,17 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
||||
YGNodeStyleSetMargin(root, YGEdgeRight, 10);
|
||||
YGNodeStyleSetMarginAuto(root, YGEdgeLeft);
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(root,
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||
YGPrintOptionsStyle));
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
|
||||
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
|
||||
"position: absolute; \" ></div>";
|
||||
const char* expected =
|
||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
|
||||
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
|
||||
"position: absolute; \" ></div>";
|
||||
ASSERT_STREQ(expected, writeBuffer);
|
||||
}
|
||||
|
||||
@@ -112,15 +119,17 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
||||
YGNodeInsertChild(root, child0, 0);
|
||||
YGNodeInsertChild(root, child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(root,
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||
YGPrintOptionsStyle));
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
|
||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
||||
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
|
||||
"style=\"\" ></div>\n</div>";
|
||||
const char* expected =
|
||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
|
||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
||||
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
|
||||
"style=\"\" ></div>\n</div>";
|
||||
ASSERT_STREQ(expected, writeBuffer);
|
||||
}
|
||||
|
@@ -8,12 +8,13 @@
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static YGSize _measureMax(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*)node->getContext();
|
||||
static YGSize _measureMax(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) node->getContext();
|
||||
(*measureCount)++;
|
||||
|
||||
return YGSize{
|
||||
@@ -22,37 +23,40 @@ static YGSize _measureMax(YGNodeRef node,
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize _measureMin(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*)node->getContext();
|
||||
static YGSize _measureMin(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) node->getContext();
|
||||
*measureCount = *measureCount + 1;
|
||||
return YGSize{
|
||||
.width =
|
||||
widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10)
|
||||
? 10
|
||||
: width,
|
||||
.height =
|
||||
heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10)
|
||||
? 10
|
||||
: height,
|
||||
.width = widthMode == YGMeasureModeUndefined ||
|
||||
(widthMode == YGMeasureModeAtMost && width > 10)
|
||||
? 10
|
||||
: width,
|
||||
.height = heightMode == YGMeasureModeUndefined ||
|
||||
(heightMode == YGMeasureModeAtMost && height > 10)
|
||||
? 10
|
||||
: height,
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize _measure_84_49(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*)node->getContext();
|
||||
static YGSize _measure_84_49(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) node->getContext();
|
||||
if (measureCount) {
|
||||
(*measureCount)++;
|
||||
}
|
||||
|
||||
return YGSize{
|
||||
.width = 84.f, .height = 49.f,
|
||||
.width = 84.f,
|
||||
.height = 49.f,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -149,7 +153,9 @@ TEST(YogaTest, remeasure_with_atmost_computed_width_undefined_height) {
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
TEST(YogaTest, remeasure_with_already_measured_value_smaller_but_still_float_equal) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
remeasure_with_already_measured_value_smaller_but_still_float_equal) {
|
||||
int measureCount = 0;
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
@@ -17,17 +17,18 @@ struct _MeasureConstraint {
|
||||
|
||||
struct _MeasureConstraintList {
|
||||
uint32_t length;
|
||||
struct _MeasureConstraint *constraints;
|
||||
struct _MeasureConstraint* constraints;
|
||||
};
|
||||
|
||||
static YGSize _measure(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
static YGSize _measure(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
struct _MeasureConstraintList* constraintList =
|
||||
(struct _MeasureConstraintList*)node->getContext();
|
||||
struct _MeasureConstraint *constraints = constraintList->constraints;
|
||||
(struct _MeasureConstraintList*) node->getContext();
|
||||
struct _MeasureConstraint* constraints = constraintList->constraints;
|
||||
uint32_t currentIndex = constraintList->length;
|
||||
(&constraints[currentIndex])->width = width;
|
||||
(&constraints[currentIndex])->widthMode = widthMode;
|
||||
@@ -44,7 +45,8 @@ static YGSize _measure(YGNodeRef node,
|
||||
TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -72,7 +74,8 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -100,7 +103,8 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
TEST(YogaTest, at_most_main_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -126,7 +130,8 @@ TEST(YogaTest, at_most_main_axis_column) {
|
||||
TEST(YogaTest, at_most_cross_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -153,7 +158,8 @@ TEST(YogaTest, at_most_cross_axis_column) {
|
||||
TEST(YogaTest, at_most_main_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -180,7 +186,8 @@ TEST(YogaTest, at_most_main_axis_row) {
|
||||
TEST(YogaTest, at_most_cross_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -208,7 +215,8 @@ TEST(YogaTest, at_most_cross_axis_row) {
|
||||
TEST(YogaTest, flex_child) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -237,7 +245,8 @@ TEST(YogaTest, flex_child) {
|
||||
TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -264,7 +273,8 @@ TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
TEST(YogaTest, overflow_scroll_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
@@ -295,7 +305,8 @@ TEST(YogaTest, overflow_scroll_column) {
|
||||
TEST(YogaTest, overflow_scroll_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
.length = 0,
|
||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
||||
.constraints = (struct _MeasureConstraint*) malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
@@ -647,7 +647,9 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
@@ -9,7 +9,8 @@
|
||||
|
||||
TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureWebFlexBasis, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(
|
||||
config, YGExperimentalFeatureWebFlexBasis, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeightPercent(root, 100);
|
||||
|
@@ -24,7 +24,8 @@ TEST(YogaTest, rounding_value) {
|
||||
ASSERT_FLOAT_EQ(-6.0, YGRoundValueToPixelGrid(-5.999999, 2.0, true, false));
|
||||
ASSERT_FLOAT_EQ(-6.0, YGRoundValueToPixelGrid(-5.999999, 2.0, false, true));
|
||||
|
||||
// Test that numbers with fraction are rounded correctly accounting for ceil/floor flags
|
||||
// Test that numbers with fraction are rounded correctly accounting for
|
||||
// ceil/floor flags
|
||||
ASSERT_FLOAT_EQ(6.0, YGRoundValueToPixelGrid(6.01, 2.0, false, false));
|
||||
ASSERT_FLOAT_EQ(6.5, YGRoundValueToPixelGrid(6.01, 2.0, true, false));
|
||||
ASSERT_FLOAT_EQ(6.0, YGRoundValueToPixelGrid(6.01, 2.0, false, true));
|
||||
|
@@ -8,33 +8,39 @@
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static YGSize _measureFloor(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
static YGSize _measureFloor(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
width = 10.2f, height = 10.2f,
|
||||
width = 10.2f,
|
||||
height = 10.2f,
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize _measureCeil(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
static YGSize _measureCeil(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
width = 10.5f, height = 10.5f,
|
||||
width = 10.5f,
|
||||
height = 10.5f,
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize _measureFractial(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
static YGSize _measureFractial(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return YGSize{
|
||||
width = 0.5f, height = 0.5f,
|
||||
width = 0.5f,
|
||||
height = 0.5f,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -106,7 +112,9 @@ TEST(YogaTest, rounding_feature_with_custom_measure_func_ceil) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, rounding_feature_with_custom_measure_and_fractial_matching_scale) {
|
||||
TEST(
|
||||
YogaTest,
|
||||
rounding_feature_with_custom_measure_and_fractial_matching_scale) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
// @Generated by gentest/gentest.rb from
|
||||
// gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
@@ -12,21 +12,16 @@ TEST(YogaTest, pre_order_traversal) {
|
||||
YGNodeRef const root_child0 = YGNodeNew();
|
||||
YGNodeRef const root_child1 = YGNodeNew();
|
||||
YGNodeRef const root_child0_child0 = YGNodeNew();
|
||||
|
||||
|
||||
YGNodeSetChildren(root, {root_child0, root_child1});
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
|
||||
std::vector<YGNodeRef> visited;
|
||||
YGTraversePreOrder(root, [&visited](YGNodeRef node) {
|
||||
visited.push_back(node);
|
||||
});
|
||||
|
||||
YGTraversePreOrder(
|
||||
root, [&visited](YGNodeRef node) { visited.push_back(node); });
|
||||
|
||||
const std::vector<YGNodeRef> expected = {
|
||||
root,
|
||||
root_child0,
|
||||
root_child0_child0,
|
||||
root_child1
|
||||
};
|
||||
root, root_child0, root_child0_child0, root_child1};
|
||||
ASSERT_EQ(visited, expected);
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
@@ -7,12 +7,11 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static std::vector<YGNodeRef> getChildren(YGNodeRef const node)
|
||||
{
|
||||
static std::vector<YGNodeRef> getChildren(YGNodeRef const node) {
|
||||
const uint32_t count = YGNodeGetChildCount(node);
|
||||
std::vector<YGNodeRef> children;
|
||||
children.reserve(count);
|
||||
for (uint32_t i = 0 ; i < count ; i++) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
children.push_back(YGNodeGetChild(node, i));
|
||||
}
|
||||
return children;
|
||||
@@ -29,7 +28,8 @@ TEST(YogaTest, set_children_adds_children_to_parent) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child0, root_child1};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -48,7 +48,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -71,7 +72,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -93,15 +95,14 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) {
|
||||
YGNodeSetChildren(root, {root_child2, root_child1, root_child3});
|
||||
|
||||
const std::vector<YGNodeRef> children = getChildren(root);
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child1, root_child3};
|
||||
const std::vector<YGNodeRef> expectedChildren = {
|
||||
root_child2, root_child1, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)
|
||||
};
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, root, root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
|
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include "Yoga.h"
|
||||
|
Reference in New Issue
Block a user