From 46c96ee2cbc6260a1ef9398dd750973e427b9984 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 26 Jun 2018 04:57:04 -0700 Subject: [PATCH 1/5] Upgrade fbjni Summary: Sync fbjni with `libaries/fbjni`. This includes a hack to fix a deadlock we found for cmake-debug variants only. This still gets us back in sync with other fbjni consumers which is going to save us trouble in the future if Yoga ever wants to make use of a newer feature. Manual changes made in addition to the hand-crafted CMakeLists and cxx buck rules: - `jni::isObjectRefType` has SDK lookup disabled. - `fbjni/` path is changed back to `fb/` to retain compatibility with Yoga. Reviewed By: priteshrnandgaonkar Differential Revision: D8531991 fbshipit-source-id: 776f519e2e5f9bea37f55990348f7ed81c4860b4 --- java/jni/YGJNI.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index 69cbb381..2bc0ee8b 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -1,10 +1,10 @@ -/** - * Copyright (c) 2014-present, Facebook, Inc. +/* + * Copyright (c) 2014-present, Facebook, Inc. + * + * 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. */ - #include #include #include From 77ea79490f245e67c1b255b155b6ed66ee2ca05f Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Wed, 27 Jun 2018 03:22:49 -0700 Subject: [PATCH 2/5] Upgrade Prettier to 1.13.6 on fbsource Reviewed By: zertosh Differential Revision: D8638504 fbshipit-source-id: c6991b2e884e14868ddc1d9047a78191219d673f --- website/package.json | 2 +- website/yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/website/package.json b/website/package.json index ef18bb57..e112591c 100644 --- a/website/package.json +++ b/website/package.json @@ -31,6 +31,6 @@ "develop": "gatsby develop" }, "devDependencies": { - "prettier": "1.13.4" + "prettier": "1.13.6" } } diff --git a/website/yarn.lock b/website/yarn.lock index 31fa92be..68a93f6c 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -6862,9 +6862,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.13.4: - version "1.13.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.4.tgz#31bbae6990f13b1093187c731766a14036fa72e6" +prettier@1.13.6: + version "1.13.6" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" pretty-bytes@^4.0.2: version "4.0.2" From f4d29e6f11486540b9efddf0d7cd16c903de7132 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 28 Jun 2018 22:38:42 -0700 Subject: [PATCH 3/5] Avoid cleaning up Owner of YGNode during clonning Summary: This diff refactors the cloning mechanism for YogaNode used from Fabric UI renderer and RN iOS graphs. Previously, we were cleaning the owner of the child's cloned node inside the C++ implementation of YogaNode. This was a mistake because this modified the last commited YogaTree, causing side effect in RN iOS graphs. Reviewed By: shergin Differential Revision: D8672627 fbshipit-source-id: c9902d00690e0361fd58aed84b506c42258bd995 --- java/com/facebook/yoga/YogaNode.java | 10 ++++++++++ java/jni/YGJNI.cpp | 11 +++++++++++ yoga/Yoga.cpp | 3 --- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/java/com/facebook/yoga/YogaNode.java b/java/com/facebook/yoga/YogaNode.java index f8b895b1..1565d4bb 100644 --- a/java/com/facebook/yoga/YogaNode.java +++ b/java/com/facebook/yoga/YogaNode.java @@ -175,6 +175,8 @@ public class YogaNode implements Cloneable { jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i); } + private native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer); + private native long jni_YGNodeClone(long nativePointer, Object newNode); @Override @@ -182,6 +184,14 @@ public class YogaNode implements Cloneable { try { YogaNode clonedYogaNode = (YogaNode) super.clone(); long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode); + + if (mChildren != null) { + for (YogaNode child : mChildren) { + child.jni_YGNodeSetOwner(child.mNativePointer, 0); + child.mOwner = null; + } + } + clonedYogaNode.mNativePointer = clonedNativePointer; clonedYogaNode.mOwner = null; clonedYogaNode.mChildren = diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index 2bc0ee8b..5649ef7e 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -268,6 +268,16 @@ jlong jni_YGNodeNewWithConfig(alias_ref thiz, jlong configPointer) { return reinterpret_cast(node); } +void jni_YGNodeSetOwner( + alias_ref thiz, + jlong nativePointer, + jlong newOwnerNativePointer) { + const YGNodeRef node = _jlong2YGNodeRef(nativePointer); + const YGNodeRef newOwnerNode = _jlong2YGNodeRef(newOwnerNativePointer); + + node->setOwner(newOwnerNode); +} + jlong jni_YGNodeClone( alias_ref thiz, jlong nativePointer, @@ -667,6 +677,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) { YGMakeNativeMethod(jni_YGNodeGetInstanceCount), YGMakeNativeMethod(jni_YGNodePrint), YGMakeNativeMethod(jni_YGNodeClone), + YGMakeNativeMethod(jni_YGNodeSetOwner), }); registerNatives( "com/facebook/yoga/YogaConfig", diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 3c83ce08..e5d1aabb 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -244,9 +244,6 @@ YGNodeRef YGNodeClone(YGNodeRef oldNode) { oldNode->getConfig(), node != nullptr, "Could not allocate memory for node"); - for (auto &item : oldNode->getChildren()) { - item->setOwner(nullptr); - } gNodeInstanceCount++; node->setOwner(nullptr); return node; From 7c4319181bc86442019321cbf9246dd284d654fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Tue, 3 Jul 2018 10:05:28 -0700 Subject: [PATCH 4/5] fixing landing page layout on server render Summary: On the first render the landing page was missing a CSS class. This ls probably related to https://github.com/gatsbyjs/gatsby/issues/5136 It is fixed by wrapping the page in a
Reviewed By: priteshrnandgaonkar Differential Revision: D8660801 fbshipit-source-id: dd1ac4145831f2556e2c7ceeaddb2a423447f833 --- website/package.json | 1 + website/src/components/Playground/index.js | 1 + website/src/pages/index.js | 18 ++++++++++-------- website/yarn.lock | 4 ++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/website/package.json b/website/package.json index e112591c..33ba8cd0 100644 --- a/website/package.json +++ b/website/package.json @@ -6,6 +6,7 @@ "dependencies": { "antd": "^3.2.0", "atob": "^2.0.3", + "btoa": "^1.2.1", "gatsby": "^1.9.158", "gatsby-link": "^1.6.34", "gatsby-plugin-antd": "^1.0.10", diff --git a/website/src/components/Playground/index.js b/website/src/components/Playground/index.js index 26e1734e..ec8c4cf8 100644 --- a/website/src/components/Playground/index.js +++ b/website/src/components/Playground/index.js @@ -19,6 +19,7 @@ import PositionRecord from './PositionRecord'; import LayoutRecord from './LayoutRecord'; import Sidebar from './Sidebar'; import {Row, Col, Button} from 'antd'; +import btoa from 'btoa'; import type {LayoutRecordT} from './LayoutRecord'; import type {Yoga$Direction} from 'yoga-layout'; import './index.css'; diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 334bcaa5..c8b6287a 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -183,12 +183,14 @@ const AboutSectionTwo = () => ( ); export default () => ( - - - - -
- -