Simplify memory model between managed and unmanaged memory
Summary: Instead of having different lifetimes for java and c memory we can can tie them together and make them much easier to manage. This also leads to automatically pooling native memory if pooling java memory. Differential Revision: D4051454 fbshipit-source-id: 8f5d010be520b3d1c981a7f85e5e6d95773ea6c1
This commit is contained in:
committed by
Facebook Github Bot
parent
4c57029a28
commit
69c374e74e
@@ -169,6 +169,15 @@ void CSSNodeFreeRecursive(const CSSNodeRef root) {
|
|||||||
CSSNodeFree(root);
|
CSSNodeFree(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSSNodeReset(const CSSNodeRef node) {
|
||||||
|
CSS_ASSERT(CSSNodeChildCount(node) == 0, "Cannot reset a node which still has children attached");
|
||||||
|
CSS_ASSERT(node->parent == NULL, "Cannot reset a node still attached to a parent");
|
||||||
|
|
||||||
|
CSSNodeListFree(node->children);
|
||||||
|
memset(node, 0, sizeof(CSSNode));
|
||||||
|
CSSNodeInit(node);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CSSNodeGetInstanceCount(void) {
|
int32_t CSSNodeGetInstanceCount(void) {
|
||||||
return gNodeInstanceCount;
|
return gNodeInstanceCount;
|
||||||
}
|
}
|
||||||
|
@@ -133,6 +133,7 @@ WIN_EXPORT CSSNodeRef CSSNodeNew(void);
|
|||||||
WIN_EXPORT void CSSNodeInit(const CSSNodeRef node);
|
WIN_EXPORT void CSSNodeInit(const CSSNodeRef node);
|
||||||
WIN_EXPORT void CSSNodeFree(const CSSNodeRef node);
|
WIN_EXPORT void CSSNodeFree(const CSSNodeRef node);
|
||||||
WIN_EXPORT void CSSNodeFreeRecursive(const CSSNodeRef node);
|
WIN_EXPORT void CSSNodeFreeRecursive(const CSSNodeRef node);
|
||||||
|
WIN_EXPORT void CSSNodeReset(const CSSNodeRef node);
|
||||||
WIN_EXPORT int32_t CSSNodeGetInstanceCount(void);
|
WIN_EXPORT int32_t CSSNodeGetInstanceCount(void);
|
||||||
|
|
||||||
WIN_EXPORT void CSSNodeInsertChild(const CSSNodeRef node,
|
WIN_EXPORT void CSSNodeInsertChild(const CSSNodeRef node,
|
||||||
|
@@ -17,7 +17,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
public class CSSNode : IDisposable, IEnumerable<CSSNode>
|
public class CSSNode : IDisposable, IEnumerable<CSSNode>
|
||||||
{
|
{
|
||||||
private bool _isDisposed;
|
|
||||||
private IntPtr _cssNode;
|
private IntPtr _cssNode;
|
||||||
|
|
||||||
private WeakReference _parent;
|
private WeakReference _parent;
|
||||||
@@ -27,118 +26,38 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public CSSNode()
|
public CSSNode()
|
||||||
{
|
{
|
||||||
Reinitialize();
|
CSSAssert.Initialize();
|
||||||
}
|
CSSLogger.Initialize();
|
||||||
|
_children = new List<CSSNode>(4);
|
||||||
private void AssertNativeInstance()
|
|
||||||
{
|
|
||||||
if (_isDisposed)
|
|
||||||
{
|
|
||||||
throw new ObjectDisposedException("CSSNode");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_cssNode = Native.CSSNodeNew();
|
||||||
if (_cssNode == IntPtr.Zero)
|
if (_cssNode == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Null native pointer");
|
throw new InvalidOperationException("Failed to allocate native memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~CSSNode()
|
~CSSNode()
|
||||||
{
|
{
|
||||||
Dispose(false);
|
Native.CSSNodeFree(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Reset()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
Native.CSSNodeReset(_cssNode);
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (!_isDisposed)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
FreeManaged();
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeUnmanaged();
|
|
||||||
_isDisposed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FreeManaged()
|
|
||||||
{
|
|
||||||
if (_children != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _children.Count; ++i)
|
|
||||||
{
|
|
||||||
var child = _children[i];
|
|
||||||
child.AssertNativeInstance();
|
|
||||||
child._parent = null;
|
|
||||||
Native.CSSNodeRemoveChild(_cssNode, child._cssNode);
|
|
||||||
}
|
|
||||||
_children = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_parent != null)
|
|
||||||
{
|
|
||||||
var parent = _parent.Target as CSSNode;
|
|
||||||
parent.AssertNativeInstance();
|
|
||||||
parent._children.Remove(this);
|
|
||||||
Native.CSSNodeRemoveChild(parent._cssNode, _cssNode);
|
|
||||||
_parent = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_measureFunction = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FreeUnmanaged()
|
|
||||||
{
|
|
||||||
if (_cssNode != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
Native.CSSNodeFree(_cssNode);
|
|
||||||
_cssNode = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Reinitialize()
|
|
||||||
{
|
|
||||||
if (_cssNode != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Allready initialized node");
|
|
||||||
}
|
|
||||||
|
|
||||||
CSSAssert.Initialize();
|
|
||||||
CSSLogger.Initialize();
|
|
||||||
_cssNode = Native.CSSNodeNew();
|
|
||||||
_children = new List<CSSNode>(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Free()
|
|
||||||
{
|
|
||||||
AssertNativeInstance();
|
|
||||||
if (_parent != null || (_children != null && _children.Count > 0))
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("You should not free an attached CSSNode");
|
|
||||||
}
|
|
||||||
FreeManaged();
|
|
||||||
FreeUnmanaged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsDirty
|
public bool IsDirty
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeIsDirty(_cssNode);
|
return Native.CSSNodeIsDirty(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void MarkDirty()
|
public virtual void MarkDirty()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeMarkDirty(_cssNode);
|
Native.CSSNodeMarkDirty(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,13 +65,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeGetIsTextnode(_cssNode);
|
return Native.CSSNodeGetIsTextnode(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeSetIsTextnode(_cssNode, value);
|
Native.CSSNodeSetIsTextnode(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,14 +78,12 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeGetHasNewLayout(_cssNode);
|
return Native.CSSNodeGetHasNewLayout(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkHasNewLayout()
|
public void MarkHasNewLayout()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeSetHasNewLayout(_cssNode, true);
|
Native.CSSNodeSetHasNewLayout(_cssNode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +91,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return _parent != null ? _parent.Target as CSSNode : null;
|
return _parent != null ? _parent.Target as CSSNode : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,12 +107,10 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetDirection(_cssNode);
|
return Native.CSSNodeStyleGetDirection(_cssNode);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetDirection(_cssNode, value);
|
Native.CSSNodeStyleSetDirection(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,13 +119,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetFlexDirection(_cssNode);
|
return Native.CSSNodeStyleGetFlexDirection(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlexDirection(_cssNode, value);
|
Native.CSSNodeStyleSetFlexDirection(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,13 +132,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetJustifyContent(_cssNode);
|
return Native.CSSNodeStyleGetJustifyContent(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetJustifyContent(_cssNode, value);
|
Native.CSSNodeStyleSetJustifyContent(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,13 +145,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetAlignItems(_cssNode);
|
return Native.CSSNodeStyleGetAlignItems(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetAlignItems(_cssNode, value);
|
Native.CSSNodeStyleSetAlignItems(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,13 +158,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetAlignSelf(_cssNode);
|
return Native.CSSNodeStyleGetAlignSelf(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetAlignSelf(_cssNode, value);
|
Native.CSSNodeStyleSetAlignSelf(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,13 +171,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetAlignContent(_cssNode);
|
return Native.CSSNodeStyleGetAlignContent(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetAlignContent(_cssNode, value);
|
Native.CSSNodeStyleSetAlignContent(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,13 +184,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetPositionType(_cssNode);
|
return Native.CSSNodeStyleGetPositionType(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetPositionType(_cssNode, value);
|
Native.CSSNodeStyleSetPositionType(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,13 +197,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetFlexWrap(_cssNode);
|
return Native.CSSNodeStyleGetFlexWrap(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlexWrap(_cssNode, value);
|
Native.CSSNodeStyleSetFlexWrap(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +210,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlex(_cssNode, value);
|
Native.CSSNodeStyleSetFlex(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,13 +218,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetFlexGrow(_cssNode);
|
return Native.CSSNodeStyleGetFlexGrow(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlexGrow(_cssNode, value);
|
Native.CSSNodeStyleSetFlexGrow(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,13 +231,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetFlexShrink(_cssNode);
|
return Native.CSSNodeStyleGetFlexShrink(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlexShrink(_cssNode, value);
|
Native.CSSNodeStyleSetFlexShrink(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,20 +244,17 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetFlexBasis(_cssNode);
|
return Native.CSSNodeStyleGetFlexBasis(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetFlexBasis(_cssNode, value);
|
Native.CSSNodeStyleSetFlexBasis(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spacing GetMargin()
|
public Spacing GetMargin()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
|
|
||||||
var margin = new Spacing();
|
var margin = new Spacing();
|
||||||
margin.Set(Spacing.Left, Native.CSSNodeStyleGetMargin(_cssNode, CSSEdge.Left));
|
margin.Set(Spacing.Left, Native.CSSNodeStyleGetMargin(_cssNode, CSSEdge.Left));
|
||||||
@@ -379,13 +269,11 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void SetMargin(CSSEdge edge, float value)
|
public void SetMargin(CSSEdge edge, float value)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetMargin(_cssNode, edge, value);
|
Native.CSSNodeStyleSetMargin(_cssNode, edge, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spacing GetPadding()
|
public Spacing GetPadding()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
|
|
||||||
var padding = new Spacing();
|
var padding = new Spacing();
|
||||||
padding.Set(Spacing.Left, Native.CSSNodeStyleGetPadding(_cssNode, CSSEdge.Left));
|
padding.Set(Spacing.Left, Native.CSSNodeStyleGetPadding(_cssNode, CSSEdge.Left));
|
||||||
@@ -400,13 +288,11 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void SetPadding(CSSEdge edge, float padding)
|
public void SetPadding(CSSEdge edge, float padding)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetPadding(_cssNode, edge, padding);
|
Native.CSSNodeStyleSetPadding(_cssNode, edge, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spacing GetBorder()
|
public Spacing GetBorder()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
|
|
||||||
var border = new Spacing();
|
var border = new Spacing();
|
||||||
border.Set(Spacing.Left, Native.CSSNodeStyleGetBorder(_cssNode, CSSEdge.Left));
|
border.Set(Spacing.Left, Native.CSSNodeStyleGetBorder(_cssNode, CSSEdge.Left));
|
||||||
@@ -421,13 +307,11 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void SetBorder(CSSEdge edge, float border)
|
public void SetBorder(CSSEdge edge, float border)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetBorder(_cssNode, edge, border);
|
Native.CSSNodeStyleSetBorder(_cssNode, edge, border);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spacing GetPosition()
|
public Spacing GetPosition()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
|
|
||||||
var position = new Spacing();
|
var position = new Spacing();
|
||||||
position.Set(Spacing.Left, Native.CSSNodeStyleGetPosition(_cssNode, CSSEdge.Left));
|
position.Set(Spacing.Left, Native.CSSNodeStyleGetPosition(_cssNode, CSSEdge.Left));
|
||||||
@@ -442,7 +326,6 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void SetPosition(CSSEdge edge, float position)
|
public void SetPosition(CSSEdge edge, float position)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetPosition(_cssNode, edge, position);
|
Native.CSSNodeStyleSetPosition(_cssNode, edge, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,13 +333,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetWidth(_cssNode);
|
return Native.CSSNodeStyleGetWidth(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetWidth(_cssNode, value);
|
Native.CSSNodeStyleSetWidth(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,13 +346,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetHeight(_cssNode);
|
return Native.CSSNodeStyleGetHeight(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetHeight(_cssNode, value);
|
Native.CSSNodeStyleSetHeight(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,13 +359,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetMaxWidth(_cssNode);
|
return Native.CSSNodeStyleGetMaxWidth(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetMaxWidth(_cssNode, value);
|
Native.CSSNodeStyleSetMaxWidth(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,13 +372,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetMaxHeight(_cssNode);
|
return Native.CSSNodeStyleGetMaxHeight(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetMaxHeight(_cssNode, value);
|
Native.CSSNodeStyleSetMaxHeight(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,13 +385,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetMinWidth(_cssNode);
|
return Native.CSSNodeStyleGetMinWidth(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetMinWidth(_cssNode, value);
|
Native.CSSNodeStyleSetMinWidth(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,13 +398,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetMinHeight(_cssNode);
|
return Native.CSSNodeStyleGetMinHeight(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetMinHeight(_cssNode, value);
|
Native.CSSNodeStyleSetMinHeight(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,7 +411,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeLayoutGetLeft(_cssNode);
|
return Native.CSSNodeLayoutGetLeft(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -549,7 +419,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeLayoutGetTop(_cssNode);
|
return Native.CSSNodeLayoutGetTop(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,7 +427,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeLayoutGetWidth(_cssNode);
|
return Native.CSSNodeLayoutGetWidth(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -567,7 +435,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeLayoutGetHeight(_cssNode);
|
return Native.CSSNodeLayoutGetHeight(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,7 +443,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeLayoutGetDirection(_cssNode);
|
return Native.CSSNodeLayoutGetDirection(_cssNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -585,13 +451,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return Native.CSSNodeStyleGetOverflow(_cssNode);
|
return Native.CSSNodeStyleGetOverflow(_cssNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeStyleSetOverflow(_cssNode, value);
|
Native.CSSNodeStyleSetOverflow(_cssNode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -600,13 +464,11 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
_data = value;
|
_data = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,7 +477,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return _children[index];
|
return _children[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,14 +485,12 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return _children.Count;
|
return _children.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkLayoutSeen()
|
public void MarkLayoutSeen()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeSetHasNewLayout(_cssNode, false);
|
Native.CSSNodeSetHasNewLayout(_cssNode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +506,6 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void Insert(int index, CSSNode node)
|
public void Insert(int index, CSSNode node)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
_children.Insert(index, node);
|
_children.Insert(index, node);
|
||||||
node._parent = new WeakReference(this);
|
node._parent = new WeakReference(this);
|
||||||
Native.CSSNodeInsertChild(_cssNode, node._cssNode, (uint)index);
|
Native.CSSNodeInsertChild(_cssNode, node._cssNode, (uint)index);
|
||||||
@@ -655,7 +513,6 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public void RemoveAt(int index)
|
public void RemoveAt(int index)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
var child = _children[index];
|
var child = _children[index];
|
||||||
child._parent = null;
|
child._parent = null;
|
||||||
_children.RemoveAt(index);
|
_children.RemoveAt(index);
|
||||||
@@ -664,20 +521,17 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public int IndexOf(CSSNode node)
|
public int IndexOf(CSSNode node)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
return _children.IndexOf(node);
|
return _children.IndexOf(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMeasureFunction(MeasureFunction measureFunction)
|
public void SetMeasureFunction(MeasureFunction measureFunction)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
_measureFunction = measureFunction;
|
_measureFunction = measureFunction;
|
||||||
Native.CSSNodeSetMeasureFunc(_cssNode, measureFunction != null ? MeasureInternal : (CSSMeasureFunc)null);
|
Native.CSSNodeSetMeasureFunc(_cssNode, measureFunction != null ? MeasureInternal : (CSSMeasureFunc)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CalculateLayout()
|
public void CalculateLayout()
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
Native.CSSNodeCalculateLayout(_cssNode, CSSConstants.Undefined, CSSConstants.Undefined, Native.CSSNodeStyleGetDirection(_cssNode));
|
Native.CSSNodeCalculateLayout(_cssNode, CSSConstants.Undefined, CSSConstants.Undefined, Native.CSSNodeStyleGetDirection(_cssNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,7 +555,6 @@ namespace Facebook.CSSLayout
|
|||||||
|
|
||||||
public string Print(CSSPrintOptions options = CSSPrintOptions.Layout|CSSPrintOptions.Style|CSSPrintOptions.Children)
|
public string Print(CSSPrintOptions options = CSSPrintOptions.Layout|CSSPrintOptions.Style|CSSPrintOptions.Children)
|
||||||
{
|
{
|
||||||
AssertNativeInstance();
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
CSSLogger.Logger = (message) => {sb.Append(message);};
|
CSSLogger.Logger = (message) => {sb.Append(message);};
|
||||||
Native.CSSNodePrint(_cssNode, options);
|
Native.CSSNodePrint(_cssNode, options);
|
||||||
|
@@ -37,6 +37,9 @@ namespace Facebook.CSSLayout
|
|||||||
[DllImport(DllName)]
|
[DllImport(DllName)]
|
||||||
public static extern void CSSNodeFree(IntPtr cssNode);
|
public static extern void CSSNodeFree(IntPtr cssNode);
|
||||||
|
|
||||||
|
[DllImport(DllName)]
|
||||||
|
public static extern void CSSNodeReset(IntPtr cssNode);
|
||||||
|
|
||||||
[DllImport(DllName)]
|
[DllImport(DllName)]
|
||||||
public static extern int CSSNodeGetInstanceCount();
|
public static extern int CSSNodeGetInstanceCount();
|
||||||
|
|
||||||
|
@@ -40,40 +40,30 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private long mNativePointer;
|
private long mNativePointer;
|
||||||
private Object mData;
|
private Object mData;
|
||||||
|
|
||||||
public CSSNode() {
|
|
||||||
reinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertNativeInstance() {
|
|
||||||
if (mNativePointer == 0) {
|
|
||||||
throw new IllegalStateException("Null native pointer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private native long jni_CSSNodeNew();
|
private native long jni_CSSNodeNew();
|
||||||
@Override
|
public CSSNode() {
|
||||||
public void reinit() {
|
mNativePointer = jni_CSSNodeNew();
|
||||||
if (mNativePointer != 0) {
|
if (mNativePointer == 0) {
|
||||||
throw new IllegalStateException("Allready initialized node");
|
throw new IllegalStateException("Failed to allocate native memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
mNativePointer = jni_CSSNodeNew();
|
|
||||||
mChildren = new ArrayList<>(4);
|
mChildren = new ArrayList<>(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeFree(long nativePointer);
|
private native void jni_CSSNodeFree(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public void free() {
|
protected void finalize() throws Throwable {
|
||||||
assertNativeInstance();
|
try {
|
||||||
if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
|
jni_CSSNodeFree(mNativePointer);
|
||||||
throw new IllegalStateException("You should not free an attached CSSNode");
|
} finally {
|
||||||
|
super.finalize();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
jni_CSSNodeFree(mNativePointer);
|
private native void jni_CSSNodeReset(long nativePointer);
|
||||||
mNativePointer = 0;
|
@Override
|
||||||
mChildren = null;
|
public void reset() {
|
||||||
mParent = null;
|
jni_CSSNodeReset(mNativePointer);
|
||||||
mMeasureFunction = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -89,7 +79,6 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeInsertChild(long nativePointer, long childPointer, int index);
|
private native void jni_CSSNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||||
@Override
|
@Override
|
||||||
public void addChildAt(CSSNode child, int i) {
|
public void addChildAt(CSSNode child, int i) {
|
||||||
assertNativeInstance();
|
|
||||||
if (child.mParent != null) {
|
if (child.mParent != null) {
|
||||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
||||||
}
|
}
|
||||||
@@ -102,7 +91,6 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeRemoveChild(long nativePointer, long childPointer);
|
private native void jni_CSSNodeRemoveChild(long nativePointer, long childPointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSNode removeChildAt(int i) {
|
public CSSNode removeChildAt(int i) {
|
||||||
assertNativeInstance();
|
|
||||||
|
|
||||||
final CSSNode child = mChildren.remove(i);
|
final CSSNode child = mChildren.remove(i);
|
||||||
child.mParent = null;
|
child.mParent = null;
|
||||||
@@ -124,35 +112,30 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeSetIsTextNode(long nativePointer, boolean isTextNode);
|
private native void jni_CSSNodeSetIsTextNode(long nativePointer, boolean isTextNode);
|
||||||
@Override
|
@Override
|
||||||
public void setIsTextNode(boolean isTextNode) {
|
public void setIsTextNode(boolean isTextNode) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeSetIsTextNode(mNativePointer, isTextNode);
|
jni_CSSNodeSetIsTextNode(mNativePointer, isTextNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_CSSNodeGetIsTextNode(long nativePointer);
|
private native boolean jni_CSSNodeGetIsTextNode(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public boolean isTextNode() {
|
public boolean isTextNode() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeGetIsTextNode(mNativePointer);
|
return jni_CSSNodeGetIsTextNode(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeCalculateLayout(long nativePointer);
|
private native void jni_CSSNodeCalculateLayout(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public void calculateLayout(CSSLayoutContext layoutContext) {
|
public void calculateLayout(CSSLayoutContext layoutContext) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeCalculateLayout(mNativePointer);
|
jni_CSSNodeCalculateLayout(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_CSSNodeHasNewLayout(long nativePointer);
|
private native boolean jni_CSSNodeHasNewLayout(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNewLayout() {
|
public boolean hasNewLayout() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeHasNewLayout(mNativePointer);
|
return jni_CSSNodeHasNewLayout(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeMarkDirty(long nativePointer);
|
private native void jni_CSSNodeMarkDirty(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public void dirty() {
|
public void dirty() {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeMarkDirty(mNativePointer);
|
jni_CSSNodeMarkDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,189 +148,162 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeMarkLayoutSeen(long nativePointer);
|
private native void jni_CSSNodeMarkLayoutSeen(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public void markLayoutSeen() {
|
public void markLayoutSeen() {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeMarkLayoutSeen(mNativePointer);
|
jni_CSSNodeMarkLayoutSeen(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
|
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSDirection getStyleDirection() {
|
public CSSDirection getStyleDirection() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
|
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
|
||||||
@Override
|
@Override
|
||||||
public void setDirection(CSSDirection direction) {
|
public void setDirection(CSSDirection direction) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetDirection(mNativePointer, direction.ordinal());
|
jni_CSSNodeStyleSetDirection(mNativePointer, direction.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeLayoutGetDirection(long nativePointer);
|
private native int jni_CSSNodeLayoutGetDirection(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSDirection getLayoutDirection() {
|
public CSSDirection getLayoutDirection() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSDirection.values()[jni_CSSNodeLayoutGetDirection(mNativePointer)];
|
return CSSDirection.values()[jni_CSSNodeLayoutGetDirection(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
|
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSFlexDirection getFlexDirection() {
|
public CSSFlexDirection getFlexDirection() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||||
@Override
|
@Override
|
||||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.ordinal());
|
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
|
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSJustify getJustifyContent() {
|
public CSSJustify getJustifyContent() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||||
@Override
|
@Override
|
||||||
public void setJustifyContent(CSSJustify justifyContent) {
|
public void setJustifyContent(CSSJustify justifyContent) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.ordinal());
|
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
|
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSAlign getAlignItems() {
|
public CSSAlign getAlignItems() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||||
@Override
|
@Override
|
||||||
public void setAlignItems(CSSAlign alignItems) {
|
public void setAlignItems(CSSAlign alignItems) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.ordinal());
|
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
|
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSAlign getAlignSelf() {
|
public CSSAlign getAlignSelf() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||||
@Override
|
@Override
|
||||||
public void setAlignSelf(CSSAlign alignSelf) {
|
public void setAlignSelf(CSSAlign alignSelf) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.ordinal());
|
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
|
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSAlign getAlignContent() {
|
public CSSAlign getAlignContent() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||||
@Override
|
@Override
|
||||||
public void setAlignContent(CSSAlign alignContent) {
|
public void setAlignContent(CSSAlign alignContent) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.ordinal());
|
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
|
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSPositionType getPositionType() {
|
public CSSPositionType getPositionType() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
|
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||||
@Override
|
@Override
|
||||||
public void setPositionType(CSSPositionType positionType) {
|
public void setPositionType(CSSPositionType positionType) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.ordinal());
|
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||||
@Override
|
@Override
|
||||||
public void setWrap(CSSWrap flexWrap) {
|
public void setWrap(CSSWrap flexWrap) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.ordinal());
|
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
|
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public CSSOverflow getOverflow() {
|
public CSSOverflow getOverflow() {
|
||||||
assertNativeInstance();
|
|
||||||
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
|
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||||
@Override
|
@Override
|
||||||
public void setOverflow(CSSOverflow overflow) {
|
public void setOverflow(CSSOverflow overflow) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.ordinal());
|
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);
|
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);
|
||||||
@Override
|
@Override
|
||||||
public void setFlex(float flex) {
|
public void setFlex(float flex) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlex(mNativePointer, flex);
|
jni_CSSNodeStyleSetFlex(mNativePointer, flex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetFlexGrow(long nativePointer);
|
private native float jni_CSSNodeStyleGetFlexGrow(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getFlexGrow() {
|
public float getFlexGrow() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetFlexGrow(mNativePointer);
|
return jni_CSSNodeStyleGetFlexGrow(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
private native void jni_CSSNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||||
@Override
|
@Override
|
||||||
public void setFlexGrow(float flexGrow) {
|
public void setFlexGrow(float flexGrow) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
jni_CSSNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetFlexShrink(long nativePointer);
|
private native float jni_CSSNodeStyleGetFlexShrink(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getFlexShrink() {
|
public float getFlexShrink() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetFlexShrink(mNativePointer);
|
return jni_CSSNodeStyleGetFlexShrink(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
private native void jni_CSSNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||||
@Override
|
@Override
|
||||||
public void setFlexShrink(float flexShrink) {
|
public void setFlexShrink(float flexShrink) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
jni_CSSNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetFlexBasis(long nativePointer);
|
private native float jni_CSSNodeStyleGetFlexBasis(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getFlexBasis() {
|
public float getFlexBasis() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetFlexBasis(mNativePointer);
|
return jni_CSSNodeStyleGetFlexBasis(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
private native void jni_CSSNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||||
@Override
|
@Override
|
||||||
public void setFlexBasis(float flexBasis) {
|
public void setFlexBasis(float flexBasis) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
jni_CSSNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public Spacing getMargin() {
|
public Spacing getMargin() {
|
||||||
assertNativeInstance();
|
|
||||||
Spacing margin = new Spacing();
|
Spacing margin = new Spacing();
|
||||||
margin.set(Spacing.LEFT, jni_CSSNodeStyleGetMargin(mNativePointer, Spacing.LEFT));
|
margin.set(Spacing.LEFT, jni_CSSNodeStyleGetMargin(mNativePointer, Spacing.LEFT));
|
||||||
margin.set(Spacing.TOP, jni_CSSNodeStyleGetMargin(mNativePointer, Spacing.TOP));
|
margin.set(Spacing.TOP, jni_CSSNodeStyleGetMargin(mNativePointer, Spacing.TOP));
|
||||||
@@ -361,14 +317,12 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||||
@Override
|
@Override
|
||||||
public void setMargin(int spacingType, float margin) {
|
public void setMargin(int spacingType, float margin) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetMargin(mNativePointer, spacingType, margin);
|
jni_CSSNodeStyleSetMargin(mNativePointer, spacingType, margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public Spacing getPadding() {
|
public Spacing getPadding() {
|
||||||
assertNativeInstance();
|
|
||||||
Spacing padding = new Spacing();
|
Spacing padding = new Spacing();
|
||||||
padding.set(Spacing.LEFT, jni_CSSNodeStyleGetPadding(mNativePointer, Spacing.LEFT));
|
padding.set(Spacing.LEFT, jni_CSSNodeStyleGetPadding(mNativePointer, Spacing.LEFT));
|
||||||
padding.set(Spacing.TOP, jni_CSSNodeStyleGetPadding(mNativePointer, Spacing.TOP));
|
padding.set(Spacing.TOP, jni_CSSNodeStyleGetPadding(mNativePointer, Spacing.TOP));
|
||||||
@@ -382,14 +336,12 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||||
@Override
|
@Override
|
||||||
public void setPadding(int spacingType, float padding) {
|
public void setPadding(int spacingType, float padding) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetPadding(mNativePointer, spacingType, padding);
|
jni_CSSNodeStyleSetPadding(mNativePointer, spacingType, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public Spacing getBorder() {
|
public Spacing getBorder() {
|
||||||
assertNativeInstance();
|
|
||||||
Spacing border = new Spacing();
|
Spacing border = new Spacing();
|
||||||
border.set(Spacing.LEFT, jni_CSSNodeStyleGetBorder(mNativePointer, Spacing.LEFT));
|
border.set(Spacing.LEFT, jni_CSSNodeStyleGetBorder(mNativePointer, Spacing.LEFT));
|
||||||
border.set(Spacing.TOP, jni_CSSNodeStyleGetBorder(mNativePointer, Spacing.TOP));
|
border.set(Spacing.TOP, jni_CSSNodeStyleGetBorder(mNativePointer, Spacing.TOP));
|
||||||
@@ -403,14 +355,12 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||||
@Override
|
@Override
|
||||||
public void setBorder(int spacingType, float border) {
|
public void setBorder(int spacingType, float border) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetBorder(mNativePointer, spacingType, border);
|
jni_CSSNodeStyleSetBorder(mNativePointer, spacingType, border);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public Spacing getPosition() {
|
public Spacing getPosition() {
|
||||||
assertNativeInstance();
|
|
||||||
Spacing position = new Spacing();
|
Spacing position = new Spacing();
|
||||||
position.set(Spacing.LEFT, jni_CSSNodeStyleGetPosition(mNativePointer, Spacing.LEFT));
|
position.set(Spacing.LEFT, jni_CSSNodeStyleGetPosition(mNativePointer, Spacing.LEFT));
|
||||||
position.set(Spacing.TOP, jni_CSSNodeStyleGetPosition(mNativePointer, Spacing.TOP));
|
position.set(Spacing.TOP, jni_CSSNodeStyleGetPosition(mNativePointer, Spacing.TOP));
|
||||||
@@ -424,133 +374,114 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
|||||||
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(int spacingType, float position) {
|
public void setPosition(int spacingType, float position) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetPosition(mNativePointer, spacingType, position);
|
jni_CSSNodeStyleSetPosition(mNativePointer, spacingType, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
|
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleWidth() {
|
public float getStyleWidth() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetWidth(mNativePointer);
|
return jni_CSSNodeStyleGetWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetWidth(long nativePointer, float width);
|
private native void jni_CSSNodeStyleSetWidth(long nativePointer, float width);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleWidth(float width) {
|
public void setStyleWidth(float width) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetWidth(mNativePointer, width);
|
jni_CSSNodeStyleSetWidth(mNativePointer, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetHeight(long nativePointer);
|
private native float jni_CSSNodeStyleGetHeight(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleHeight() {
|
public float getStyleHeight() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetHeight(mNativePointer);
|
return jni_CSSNodeStyleGetHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetHeight(long nativePointer, float height);
|
private native void jni_CSSNodeStyleSetHeight(long nativePointer, float height);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleHeight(float height) {
|
public void setStyleHeight(float height) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetHeight(mNativePointer, height);
|
jni_CSSNodeStyleSetHeight(mNativePointer, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMinWidth(long nativePointer);
|
private native float jni_CSSNodeStyleGetMinWidth(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleMinWidth() {
|
public float getStyleMinWidth() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetMinWidth(mNativePointer);
|
return jni_CSSNodeStyleGetMinWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
private native void jni_CSSNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleMinWidth(float minWidth) {
|
public void setStyleMinWidth(float minWidth) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetMinWidth(mNativePointer, minWidth);
|
jni_CSSNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMinHeight(long nativePointer);
|
private native float jni_CSSNodeStyleGetMinHeight(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleMinHeight() {
|
public float getStyleMinHeight() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetMinHeight(mNativePointer);
|
return jni_CSSNodeStyleGetMinHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
private native void jni_CSSNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleMinHeight(float minHeight) {
|
public void setStyleMinHeight(float minHeight) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetMinHeight(mNativePointer, minHeight);
|
jni_CSSNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMaxWidth(long nativePointer);
|
private native float jni_CSSNodeStyleGetMaxWidth(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleMaxWidth() {
|
public float getStyleMaxWidth() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetMaxWidth(mNativePointer);
|
return jni_CSSNodeStyleGetMaxWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
private native void jni_CSSNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleMaxWidth(float maxWidth) {
|
public void setStyleMaxWidth(float maxWidth) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
jni_CSSNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeStyleGetMaxHeight(long nativePointer);
|
private native float jni_CSSNodeStyleGetMaxHeight(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getStyleMaxHeight() {
|
public float getStyleMaxHeight() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeStyleGetMaxHeight(mNativePointer);
|
return jni_CSSNodeStyleGetMaxHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
private native void jni_CSSNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||||
@Override
|
@Override
|
||||||
public void setStyleMaxHeight(float maxheight) {
|
public void setStyleMaxHeight(float maxheight) {
|
||||||
assertNativeInstance();
|
|
||||||
jni_CSSNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
jni_CSSNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeLayoutGetLeft(long nativePointer);
|
private native float jni_CSSNodeLayoutGetLeft(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getLayoutX() {
|
public float getLayoutX() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeLayoutGetLeft(mNativePointer);
|
return jni_CSSNodeLayoutGetLeft(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeLayoutGetTop(long nativePointer);
|
private native float jni_CSSNodeLayoutGetTop(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getLayoutY() {
|
public float getLayoutY() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeLayoutGetTop(mNativePointer);
|
return jni_CSSNodeLayoutGetTop(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeLayoutGetWidth(long nativePointer);
|
private native float jni_CSSNodeLayoutGetWidth(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getLayoutWidth() {
|
public float getLayoutWidth() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeLayoutGetWidth(mNativePointer);
|
return jni_CSSNodeLayoutGetWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_CSSNodeLayoutGetHeight(long nativePointer);
|
private native float jni_CSSNodeLayoutGetHeight(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getLayoutHeight() {
|
public float getLayoutHeight() {
|
||||||
assertNativeInstance();
|
|
||||||
return jni_CSSNodeLayoutGetHeight(mNativePointer);
|
return jni_CSSNodeLayoutGetHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
@Override
|
@Override
|
||||||
public void setMeasureFunction(MeasureFunction measureFunction) {
|
public void setMeasureFunction(MeasureFunction measureFunction) {
|
||||||
assertNativeInstance();
|
|
||||||
mMeasureFunction = measureFunction;
|
mMeasureFunction = measureFunction;
|
||||||
jni_CSSNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
jni_CSSNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public long measure(float width, int widthMode, float height, int heightMode) {
|
public long measure(float width, int widthMode, float height, int heightMode) {
|
||||||
assertNativeInstance();
|
|
||||||
if (!isMeasureDefined()) {
|
if (!isMeasureDefined()) {
|
||||||
throw new RuntimeException("Measure function isn't defined!");
|
throw new RuntimeException("Measure function isn't defined!");
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,5 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
|||||||
void setOverflow(CSSOverflow overflow);
|
void setOverflow(CSSOverflow overflow);
|
||||||
void setData(Object data);
|
void setData(Object data);
|
||||||
Object getData();
|
Object getData();
|
||||||
void reinit();
|
void reset();
|
||||||
void free();
|
|
||||||
}
|
}
|
||||||
|
@@ -61,11 +61,6 @@ public class CSSNodeDEPRECATED implements CSSNodeAPI<CSSNodeDEPRECATED> {
|
|||||||
private boolean mIsTextNode = false;
|
private boolean mIsTextNode = false;
|
||||||
private Object mData;
|
private Object mData;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reinit() {
|
|
||||||
free();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getChildCount() {
|
public int getChildCount() {
|
||||||
return mChildren == null ? 0 : mChildren.size();
|
return mChildren == null ? 0 : mChildren.size();
|
||||||
@@ -626,7 +621,7 @@ public class CSSNodeDEPRECATED implements CSSNodeAPI<CSSNodeDEPRECATED> {
|
|||||||
* recycling {@link CSSNodeDEPRECATED} instances.
|
* recycling {@link CSSNodeDEPRECATED} instances.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void free() {
|
public void reset() {
|
||||||
if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
|
if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
|
||||||
throw new IllegalStateException("You should not free an attached CSSNodeDEPRECATED");
|
throw new IllegalStateException("You should not free an attached CSSNodeDEPRECATED");
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,14 @@ void jni_CSSNodeFree(alias_ref<jobject> thiz, jlong nativePointer) {
|
|||||||
CSSNodeFree(_jlong2CSSNodeRef(nativePointer));
|
CSSNodeFree(_jlong2CSSNodeRef(nativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void jni_CSSNodeReset(alias_ref<jobject> thiz, jlong nativePointer) {
|
||||||
|
const CSSNodeRef node = _jlong2CSSNodeRef(nativePointer);
|
||||||
|
void *context = CSSNodeGetContext(node);
|
||||||
|
CSSNodeReset(node);
|
||||||
|
CSSNodeSetContext(node, context);
|
||||||
|
CSSNodeSetPrintFunc(node, _jniPrint);
|
||||||
|
}
|
||||||
|
|
||||||
void jni_CSSNodeInsertChild(alias_ref<jobject>,
|
void jni_CSSNodeInsertChild(alias_ref<jobject>,
|
||||||
jlong nativePointer,
|
jlong nativePointer,
|
||||||
jlong childPointer,
|
jlong childPointer,
|
||||||
@@ -179,6 +187,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
{
|
{
|
||||||
CSSMakeNativeMethod(jni_CSSNodeNew),
|
CSSMakeNativeMethod(jni_CSSNodeNew),
|
||||||
CSSMakeNativeMethod(jni_CSSNodeFree),
|
CSSMakeNativeMethod(jni_CSSNodeFree),
|
||||||
|
CSSMakeNativeMethod(jni_CSSNodeReset),
|
||||||
CSSMakeNativeMethod(jni_CSSNodeInsertChild),
|
CSSMakeNativeMethod(jni_CSSNodeInsertChild),
|
||||||
CSSMakeNativeMethod(jni_CSSNodeRemoveChild),
|
CSSMakeNativeMethod(jni_CSSNodeRemoveChild),
|
||||||
CSSMakeNativeMethod(jni_CSSNodeSetIsTextNode),
|
CSSMakeNativeMethod(jni_CSSNodeSetIsTextNode),
|
||||||
|
@@ -22,23 +22,6 @@ public class CSSNodeTest {
|
|||||||
assertEquals(refCount + 1, CSSNode.jni_CSSNodeGetInstanceCount());
|
assertEquals(refCount + 1, CSSNode.jni_CSSNodeGetInstanceCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFree() {
|
|
||||||
final int refCount = CSSNode.jni_CSSNodeGetInstanceCount();
|
|
||||||
final CSSNode node = new CSSNode();
|
|
||||||
node.free();
|
|
||||||
assertEquals(refCount, CSSNode.jni_CSSNodeGetInstanceCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testReinit() {
|
|
||||||
final int refCount = CSSNode.jni_CSSNodeGetInstanceCount();
|
|
||||||
final CSSNode node = new CSSNode();
|
|
||||||
node.free();
|
|
||||||
node.reinit();
|
|
||||||
assertEquals(refCount + 1, CSSNode.jni_CSSNodeGetInstanceCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMeasure() {
|
public void testMeasure() {
|
||||||
final CSSNode node = new CSSNode();
|
final CSSNode node = new CSSNode();
|
||||||
|
Reference in New Issue
Block a user