From e84737b451ede5bfe5ea407e219d9e9beae296fe Mon Sep 17 00:00:00 2001 From: foo Date: Sat, 7 May 2022 18:09:42 +0800 Subject: [PATCH] [core] fix containing block size of absolutely positioned element Fix http://dotwe.org/vue/8d92197521649a17842fddf7cf67cc76 --- weex_core/Source/core/layout/layout.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/weex_core/Source/core/layout/layout.cpp b/weex_core/Source/core/layout/layout.cpp index f43d5f2103..3016fbccc3 100644 --- a/weex_core/Source/core/layout/layout.cpp +++ b/weex_core/Source/core/layout/layout.cpp @@ -90,6 +90,12 @@ namespace WeexCore { switch (mCssStyle->mPositionType) { case kAbsolute: containingBlockWidth = mParent->mLayoutResult->mLayoutSize.width; + if (!isnan(mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthLeft))) { + containingBlockWidth -= mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthLeft); + } + if (!isnan(mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthRight))) { + containingBlockWidth -= mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthRight); + } break; case kFixed: if (!isnan(renderPageWidth)) { @@ -126,6 +132,12 @@ namespace WeexCore { switch (mCssStyle->mPositionType) { case kAbsolute: containingBlockHeight = mParent->mLayoutResult->mLayoutSize.height; + if (!isnan(mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthTop))) { + containingBlockHeight -= mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthTop); + } + if (!isnan(mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthBottom))) { + containingBlockHeight -= mParent->mCssStyle->mBorderWidth.getBorderWidth(kBorderWidthBottom); + } break; case kFixed: if (!isnan(renderPageHeight)) {