Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Add clearBFCs method and clear BFCs after self-layout of scroller node.
Browse files Browse the repository at this point in the history
  • Loading branch information
qianyuan.wqy committed Oct 9, 2019
1 parent 07d2295 commit 43f5edb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,11 @@ - (void)_layoutPlatform
_flexCssNode->calculateLayout(renderPageSize);
_flexCssNode->setParent(parent, _flexCssNode);

/* We must clear BFCs becuase we have set parent of _flexCSSNode to nullptr and
manually called its calculateLayout method. This will cause a non-bfc layout node
to have items in its BFCs vector. Later, a wild pointer may cause crash. */
_flexCssNode->clearBFCs();

// set origin and size back
_flexCssNode->rewriteLayoutResult(left, top, width, height);
}
Expand Down
4 changes: 4 additions & 0 deletions weex_core/Source/core/layout/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ namespace WeexCore {

markDirty();
}

inline void clearBFCs() {
BFCs.clear();
}

inline void addChildAt(WXCoreLayoutNode* const child, Index index) {
mChildList.insert(mChildList.begin() + index, child);
Expand Down

0 comments on commit 43f5edb

Please sign in to comment.