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/06/07 03:20:00 UTC

incubator-weex git commit: * [core] fix bug that styles 'marginBottom' and 'bottom' cannot take effect meanwhile

Repository: incubator-weex
Updated Branches:
  refs/heads/master 600d3b139 -> a1fb5a971


* [core] fix bug that styles 'marginBottom' and 'bottom' cannot take effect meanwhile


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a1fb5a97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a1fb5a97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a1fb5a97

Branch: refs/heads/master
Commit: a1fb5a971e72dd326c17651457bc097b8b0cfbc7
Parents: 600d3b1
Author: zouming.zm <zo...@alibaba-inc.com>
Authored: Fri Jun 1 18:39:53 2018 +0800
Committer: YorkShen <sh...@gmail.com>
Committed: Thu Jun 7 11:19:52 2018 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp | 12 ++++++++++++
 weex_core/Source/core/layout/layout.cpp         | 12 ++++++++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a1fb5a97/ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp b/ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp
index d51fcff..1d771ab 100644
--- a/ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp
+++ b/ios/sdk/WeexSDK/Sources/Layout/WXCoreLayout.cpp
@@ -101,6 +101,12 @@ namespace WeexCore {
         width = containingBlockWidth -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeLeft) -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeRight);
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginLeft))) {
+            width -= mCssStyle->mMargin.getMargin(kMarginLeft);
+        }
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginRight))) {
+            width -= mCssStyle->mMargin.getMargin(kMarginRight);
+        }
         setWidthMeasureMode(kExactly);
         sizeChanged = true;
       }
@@ -132,6 +138,12 @@ namespace WeexCore {
         height = containingBlockHeight -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeTop) -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeBottom);
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginTop))) {
+          height -= mCssStyle->mMargin.getMargin(kMarginTop);
+        }
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginBottom))) {
+          height -= mCssStyle->mMargin.getMargin(kMarginBottom);
+        }
         setHeightMeasureMode(kExactly);
         sizeChanged = true;
       }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a1fb5a97/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 cbccbab..eeac11c 100644
--- a/weex_core/Source/core/layout/layout.cpp
+++ b/weex_core/Source/core/layout/layout.cpp
@@ -99,6 +99,12 @@ namespace WeexCore {
         width = containingBlockWidth -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeLeft) -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeRight);
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginLeft))) {
+          width -= mCssStyle->mMargin.getMargin(kMarginLeft);
+        }
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginRight))) {
+          width -= mCssStyle->mMargin.getMargin(kMarginRight);
+        }
         setWidthMeasureMode(kExactly);
         sizeChanged = true;
       }
@@ -128,6 +134,12 @@ namespace WeexCore {
         height = containingBlockHeight -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeTop) -
             mCssStyle->mStylePosition.getPosition(kPositionEdgeBottom);
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginTop))) {
+          height -= mCssStyle->mMargin.getMargin(kMarginTop);
+        }
+        if (!isnan(mCssStyle->mMargin.getMargin(kMarginBottom))) {
+          height -= mCssStyle->mMargin.getMargin(kMarginBottom);
+        }
         setHeightMeasureMode(kExactly);
         sizeChanged = true;
       }