FrameView::performLayout
-》如果该FrameView对应的是Document的mainframe, 那么就取出其RenderView,并调用RenderView::layout(),如果不是mainframe, 那么就取出subtree root, 我理解应该是renderobject tree中某个子树layout,我们不可能每次都layout整棵树。
RenderView是RenderObject子类,他是树根,他有layout的逻辑:
->RenderView::layout()
通过SubtreeLayoutScope将需要layout的childRenderObject标记起来。
-》voidRenderView::layoutContent
-》RenderBlockFlow::layout,blockflow就是css中的块flow的意思
->void RenderBlock::layout()
->void RenderBlockFlow::layoutBlock(bool relayoutChildren)
->RenderBlockFlow::layoutBlockFlow
->RenderBlockFlow::layoutInlineChildren, 如果本block是inlineflow
RenderBlockFlow::layoutBlockChildren如果本block是blockflow
据说一个blockflow中的所有chiildern,要么都是inlineflow的要么都是blockflow的,如果有不符合此规定的,会自动加入一些wrappernode,转换成正确的。
会遍历调用各个子RenderObject的layoutIfNeeded()。如果有必要还会调用:
RenderBlock::layoutPositionedObjects,其实也是对一些RenderObject执行layoutIfNeeded.
那么具体的layout究竟干什么事情?找一个具体的RendreObject的layout看看。
从RenderImage的layoutIfNeeded实现看出来,主要是更新本对象的位置,坐标,尺寸。以及受到位置影响的layer的transformation.
在layout之前,rendertee的object都没有自己的位置和尺寸。