Repository: incubator-weex Updated Branches: refs/heads/master d0d4f246e -> 71af7585d
* [Core] Fix max-width problem. http://dotwe.org/vue/4022e76a68de681d423ea49ae434deff Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/71af7585 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/71af7585 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/71af7585 Branch: refs/heads/master Commit: 71af7585dea980e523376449a78a0514b6c234d9 Parents: d0d4f24 Author: YorkShen <[email protected]> Authored: Mon May 14 20:58:51 2018 +0800 Committer: YorkShen <[email protected]> Committed: Tue May 15 11:29:42 2018 +0800 ---------------------------------------------------------------------- weex_core/Source/core/layout/layout.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/71af7585/weex_core/Source/core/layout/layout.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/layout/layout.cpp b/weex_core/Source/core/layout/layout.cpp index 66d331b..a2fc800 100644 --- a/weex_core/Source/core/layout/layout.cpp +++ b/weex_core/Source/core/layout/layout.cpp @@ -175,7 +175,14 @@ namespace WeexCore { (widthMeasureMode == kUnspecified || heightMeasureMode == kUnspecified)) { float constrainsWidth = width; - if(widthMeasureMode == kExactly && !isnan(width)){ + if(isnan(width)){ + if(!isnan(mCssStyle->mMaxWidth)){ + constrainsWidth = mCssStyle->mMaxWidth; + } + } + + if((!isnan(width)&&widthMeasureMode == kExactly) || + (isnan(width) && !isnan(mCssStyle->mMaxWidth))) { constrainsWidth -= sumPaddingBorderAlongAxis(this, true); } WXCoreSize dimension = measureFunc(this, constrainsWidth,
