BREAKING - Change measure() api to remove need for MeasureOutput allocation
Summary: This is an API breaking change done to allow us to avoid an allocation during measurement. Instead we do the same trick as is done when passing measure results to C, we path them into a long. Reviewed By: splhack Differential Revision: D4081037 fbshipit-source-id: 28adbcdd160cbd3f59a0fdd4b9f1200ae18678f1
This commit is contained in:
committed by
Facebook Github Bot
parent
c34299edc9
commit
b59ce09109
@@ -23,18 +23,18 @@ namespace Facebook.CSSLayout
|
||||
{
|
||||
CSSNode parent = new CSSNode();
|
||||
CSSNode child = new CSSNode();
|
||||
|
||||
|
||||
Assert.IsNull(child.Parent);
|
||||
Assert.AreEqual(0, parent.Count);
|
||||
|
||||
|
||||
parent.Insert(0, child);
|
||||
|
||||
|
||||
Assert.AreEqual(1, parent.Count);
|
||||
Assert.AreEqual(child, parent[0]);
|
||||
Assert.AreEqual(parent, child.Parent);
|
||||
|
||||
|
||||
parent.RemoveAt(0);
|
||||
|
||||
|
||||
Assert.IsNull(child.Parent);
|
||||
Assert.AreEqual(0, parent.Count);
|
||||
}
|
||||
@@ -152,9 +152,8 @@ namespace Facebook.CSSLayout
|
||||
public void TestMeasureFunc()
|
||||
{
|
||||
CSSNode node = new CSSNode();
|
||||
node.SetMeasureFunction((_, width, widthMode, height, heightMode, measureResult) => {
|
||||
measureResult.Width = 100;
|
||||
measureResult.Height = 150;
|
||||
node.SetMeasureFunction((_, width, widthMode, height, heightMode) => {
|
||||
return MeasureOutput.Make(100, 150);
|
||||
});
|
||||
node.CalculateLayout();
|
||||
Assert.AreEqual(100, (int)node.LayoutWidth);
|
||||
|
Reference in New Issue
Block a user