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/10/24 10:16:05 UTC
[incubator-weex] branch master updated: * [Android] Fix layout
problem for item with position:absolute style and align-item:center in its
parent. (#1667)
This is an automated email from the ASF dual-hosted git repository.
kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new e0e81e0 * [Android] Fix layout problem for item with position:absolute style and align-item:center in its parent. (#1667)
e0e81e0 is described below
commit e0e81e03661dff9ace2b5f34bd229412d217d0a0
Author: YorkShen <sh...@gmail.com>
AuthorDate: Wed Oct 24 18:15:59 2018 +0800
* [Android] Fix layout problem for item with position:absolute style and align-item:center in its parent. (#1667)
http://dotwe.org/vue/016485161d20f06bf1060af9ca66db4b
---
weex_core/Source/core/layout/layout.cpp | 32 +++++++++++++++++++-------------
weex_core/Source/core/layout/layout.h | 3 +++
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/weex_core/Source/core/layout/layout.cpp b/weex_core/Source/core/layout/layout.cpp
index 2310ec1..2a2c3b1 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 5f7460e..0d62edd 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);