added display property
This commit is contained in:
6
gentest/fixtures/YGDisplayTest.html
Normal file
6
gentest/fixtures/YGDisplayTest.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div id="display_none" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex-grow: 1;"></div>
|
||||
<div style="flex-grow: 1;display:none;"></div>
|
||||
<div style="flex-grow: 1;width: 100px;"></div>
|
||||
<div style="flex-grow: 1;display:none;width: 100px;"></div>
|
||||
</div>
|
@@ -118,6 +118,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YGUndefined'},
|
||||
|
||||
YGDisplayFlex:{value:'YGDisplayFlex'},
|
||||
YGDisplayNone:{value:'YGDisplayNone'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||
this.push('YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');');
|
||||
}},
|
||||
@@ -162,6 +165,10 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push('YGNodeStyleSetDisplay(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push('YGNodeStyleSetFlexBasis' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
@@ -128,6 +128,9 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YogaConstants.Undefined'},
|
||||
|
||||
YGDisplayFlex:{value:'YogaDisplay.Flex'},
|
||||
YGDisplayNone:{value:'YogaDisplay.None'},
|
||||
|
||||
YGWrapNoWrap:{value:'YogaWrap.NoWrap'},
|
||||
YGWrapWrap:{value:'YogaWrap.Wrap'},
|
||||
|
||||
@@ -176,6 +179,10 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(nodeName + '.StyleDirection = ' + toValueCs(value) + ';');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.Display = ' + toValueCs(value) + ';');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.FlexBasis = ' + toCsUnitValue(value) + ';');
|
||||
}},
|
||||
|
@@ -132,6 +132,9 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YogaConstants.UNDEFINED'},
|
||||
|
||||
YGDisplayFlex:{value:'YogaDisplay.FLEX'},
|
||||
YGDisplayNone:{value:'YogaDisplay.NONE'},
|
||||
|
||||
YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'},
|
||||
YGWrapWrap:{value:'YogaWrap.WRAP'},
|
||||
|
||||
@@ -180,6 +183,10 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(nodeName + '.setDirection(' + toValueJava(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setFlexBasis' + toMethodName(value) + '(' + toValueJava(value) + 'f);');
|
||||
}},
|
||||
|
@@ -125,6 +125,9 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'Yoga.UNDEFINED'},
|
||||
|
||||
YGDisplayFlex:{value:'Yoga.DISPLAY_FLEX'},
|
||||
YGDisplayNone:{value:'Yoga.DISPLAY_NONE'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||
this.push(node + '.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, ' + dir + ');');
|
||||
}},
|
||||
@@ -169,6 +172,10 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(nodeName + '.setDirection(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setFlexBasis(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
@@ -140,6 +140,7 @@ function checkDefaultValues() {
|
||||
{style:'top', value:'undefined'},
|
||||
{style:'right', value:'undefined'},
|
||||
{style:'bottom', value:'undefined'},
|
||||
{style:'display', value:'flex'},
|
||||
].forEach(function(item) {
|
||||
assert(item.value === getDefaultStyleValue(item.style),
|
||||
item.style + ' should be ' + item.value);
|
||||
@@ -300,6 +301,9 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
|
||||
case 'max-height':
|
||||
e.YGNodeStyleSetMaxHeight(nodeName, pixelValue(e, node.style[style]));
|
||||
break;
|
||||
case 'display':
|
||||
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,6 +393,13 @@ function pixelValue(e, value) {
|
||||
}
|
||||
}
|
||||
|
||||
function displayValue(e, value){
|
||||
switch(value){
|
||||
case 'flex': return e.YGDisplayFlex;
|
||||
case 'none': return e.YGDisplayNone;
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultStyleValue(style) {
|
||||
if (style == 'position') {
|
||||
return 'relative';
|
||||
@@ -466,6 +477,7 @@ function getYogaStyle(node) {
|
||||
'height',
|
||||
'min-height',
|
||||
'max-height',
|
||||
'display',
|
||||
].reduce(function(map, key) {
|
||||
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||
return map;
|
||||
|
Reference in New Issue
Block a user