Merge pull request #203 from emilsjolander/at-most-root-js

Add missing js implementation for PR #200
This commit is contained in:
Emil Sjölander
2016-07-08 15:52:19 +01:00
committed by GitHub
6 changed files with 49 additions and 18 deletions

9
TestResult.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This file represents the results of running a test suite-->
<test-results name="src/csharp/Facebook.CSSLayout.Tests/bin/Release/Facebook.CSSLayout.Tests.dll" total="0" failures="0" not-run="0" date="2016-07-08" time="14:42:41">
<environment nunit-version="2.4.8.0" clr-version="4.0.30319.17020" os-version="Unix 15.5.0.0" platform="Unix" cwd="/Volumes/Source/css-layout" machine-name="emilsj-pro" user="emilsj" user-domain="emilsj-pro" />
<culture-info current-culture="en-US" current-uiculture="en-US" />
<test-suite name="src/csharp/Facebook.CSSLayout.Tests/bin/Release/Facebook.CSSLayout.Tests.dll" success="True" time="0.001" asserts="0">
<results />
</test-suite>
</test-results>

BIN
dist/css-layout.jar vendored

Binary file not shown.

27
dist/css-layout.js vendored
View File

@@ -1683,17 +1683,28 @@ var computeLayout = (function() {
// parameters don't change.
gCurrentGenerationCount++;
// If the caller didn't specify a height/width, use the dimensions
// specified in the style.
if (isUndefined(availableWidth) && isStyleDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {
var widthMeasureMode = CSS_MEASURE_MODE_UNDEFINED;
var heightMeasureMode = CSS_MEASURE_MODE_UNDEFINED;
if (!isUndefined(availableWidth)) {
widthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {
availableWidth = node.style.width + getMarginAxis(node, CSS_FLEX_DIRECTION_ROW);
}
if (isUndefined(availableHeight) && isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {
availableHeight = node.style.height + getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN);
widthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (node.style.maxWidth >= 0.0) {
availableWidth = node.style.maxWidth;
widthMeasureMode = CSS_MEASURE_MODE_AT_MOST;
}
var widthMeasureMode = isUndefined(availableWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_EXACTLY;
var heightMeasureMode = isUndefined(availableHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_EXACTLY;
if (!isUndefined(availableHeight)) {
heightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {
availableHeight = node.style.height + getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN);
heightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (node.style.maxHeight >= 0.0) {
availableHeight = node.style.maxHeight;
heightMeasureMode = CSS_MEASURE_MODE_AT_MOST;
}
if (layoutNodeInternal(node, availableWidth, availableHeight, parentDirection, widthMeasureMode, heightMeasureMode, true, 'initial')) {
setPosition(node, node.layout.direction);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1664,17 +1664,28 @@ var computeLayout = (function() {
// parameters don't change.
gCurrentGenerationCount++;
// If the caller didn't specify a height/width, use the dimensions
// specified in the style.
if (isUndefined(availableWidth) && isStyleDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {
var widthMeasureMode = CSS_MEASURE_MODE_UNDEFINED;
var heightMeasureMode = CSS_MEASURE_MODE_UNDEFINED;
if (!isUndefined(availableWidth)) {
widthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {
availableWidth = node.style.width + getMarginAxis(node, CSS_FLEX_DIRECTION_ROW);
}
if (isUndefined(availableHeight) && isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {
availableHeight = node.style.height + getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN);
widthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (node.style.maxWidth >= 0.0) {
availableWidth = node.style.maxWidth;
widthMeasureMode = CSS_MEASURE_MODE_AT_MOST;
}
var widthMeasureMode = isUndefined(availableWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_EXACTLY;
var heightMeasureMode = isUndefined(availableHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_EXACTLY;
if (!isUndefined(availableHeight)) {
heightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {
availableHeight = node.style.height + getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN);
heightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
} else if (node.style.maxHeight >= 0.0) {
availableHeight = node.style.maxHeight;
heightMeasureMode = CSS_MEASURE_MODE_AT_MOST;
}
if (layoutNodeInternal(node, availableWidth, availableHeight, parentDirection, widthMeasureMode, heightMeasureMode, true, 'initial')) {
setPosition(node, node.layout.direction);