You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/05/15 03:29:50 UTC

incubator-weex git commit: * [Core] Fix max-width problem. http://dotwe.org/vue/4022e76a68de681d423ea49ae434deff

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 <sh...@gmail.com>
Authored: Mon May 14 20:58:51 2018 +0800
Committer: YorkShen <sh...@gmail.com>
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,