You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/10/24 10:16:01 UTC

[GitHub] YorkShen closed pull request #1667: * [Android] Fix layout problem for position:absolute

YorkShen closed pull request #1667: * [Android] Fix layout problem for position:absolute
URL: https://github.com/apache/incubator-weex/pull/1667
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/weex_core/Source/core/layout/layout.cpp b/weex_core/Source/core/layout/layout.cpp
index 2310ec153e..2a2c3b14dc 100644
--- a/weex_core/Source/core/layout/layout.cpp
+++ b/weex_core/Source/core/layout/layout.cpp
@@ -252,25 +252,28 @@ namespace WeexCore {
    */
     void WXCoreLayoutNode::determineCrossSize(const float width, const float height, const bool stretch) {
       if (mFlexLines.size() == 1 && isCrossExactly()) {
-        bool horizontal = isMainAxisHorizontal(this);
-        float size = mFlexLines[0]->mCrossSize;
-        float paddingAlongCrossAxis = sumPaddingBorderAlongAxis(this, !horizontal);
-        if (horizontal) {
-          if (heightMeasureMode == kExactly) {
-            size = height - paddingAlongCrossAxis;
-          }
-        } else {
-          if (widthMeasureMode == kExactly) {
-            size = width - paddingAlongCrossAxis;
-          }
-        }
-        mFlexLines[0]->mCrossSize = size;
+        determineCrossSize(width, height, mFlexLines[0]);
       }
       if (stretch) {
         stretchViewCrossSize();
       }
     }
 
+    void WXCoreLayoutNode::determineCrossSize(const float width, const float height, WXCoreFlexLine* const flexLine){
+      bool horizontal = isMainAxisHorizontal(this);
+      float size = flexLine->mCrossSize;
+      float paddingAlongCrossAxis = sumPaddingBorderAlongAxis(this, !horizontal);
+      if (horizontal) {
+        if (heightMeasureMode == kExactly) {
+          size = height - paddingAlongCrossAxis;
+        }
+      } else {
+        if (widthMeasureMode == kExactly) {
+          size = width - paddingAlongCrossAxis;
+        }
+      }
+      flexLine->mCrossSize = size;
+    }
 
     void WXCoreLayoutNode::measureInternalNode(const float width, const float height, const bool needMeasure,
                                                const bool hypotheticalMeasurment) {
@@ -633,6 +636,9 @@ namespace WeexCore {
                           absoluteFlexItem->getLayoutWidth() + absoluteFlexItem->getMarginLeft()
                               + absoluteFlexItem->getMarginRight();
     flexLine->mItemCount = 1;
+    determineCrossSize(getLayoutWidth(),
+                       getLayoutHeight(),
+                       flexLine);
   }
 
   void WXCoreLayoutNode::onLayout(const float left, const float top, const float right, const float bottom,
diff --git a/weex_core/Source/core/layout/layout.h b/weex_core/Source/core/layout/layout.h
index 5f7460e913..0d62edd1df 100644
--- a/weex_core/Source/core/layout/layout.h
+++ b/weex_core/Source/core/layout/layout.h
@@ -588,6 +588,9 @@ namespace WeexCore {
     void
     determineCrossSize(float, float, bool);
 
+    void
+    determineCrossSize(float, float, WXCoreFlexLine *);
+
     void setFrame(float, float, float, float);
 
     void setFrame(WXCorePosition*,float, float, float, float);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services