blink里layout的几个触发点

当文档加载完毕后的触发FrameView::Layout()的一个callstack:



#0 WebCore::FrameView::layout(this=this@entry=0x2e61c500, allowSubtree=allowSubtree@entry=true) at../../third_party/WebKit/Source/core/frame/FrameView.cpp:852

#1 0x612ddcd4 in WebCore::Document::implicitClose(this=0x36204fa0) at../../third_party/WebKit/Source/core/dom/Document.cpp:2633

implicitclose这个函数先调用updateRenderTreeIfNeeded,会可能触发renderstyle的从新计算。然后才调用FrameView::layout().

#2 0x618c72de in WebCore::FrameLoader::checkCompleted(this=0x64deb698) at../../third_party/WebKit/Source/core/loader/FrameLoader.cpp:490

#3 0x618c7350 in WebCore::FrameLoader::finishedParsing(this=0x64deb698) at../../third_party/WebKit/Source/core/loader/FrameLoader.cpp:420

#4 0x612de752 in WebCore::Document::finishedParsing(this=0x36204fa0) at../../third_party/WebKit/Source/core/dom/Document.cpp:4707

#5 0x611781bc in WebCore::HTMLConstructionSite::finishedParsing(this=<optimized out>) at../../third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp:543

#6 0x61188026 in WebCore::HTMLTreeBuilder::finished(this=<optimized out>) at../../third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp:2796

#7 0x6117971c in WebCore::HTMLDocumentParser::end(this=this@entry=0x2e953e00) at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:828

#8 0x61179730 inWebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd(this=this@entry=0x2e953e00) at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:839

#9 0x6117a08c inWebCore::HTMLDocumentParser::prepareToStopParsing (this=0x2e953e00)at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:240

#10 0x6117b3d6 inWebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser(this=this@entry=0x2e953e00, popChunk=...) at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:491

#11 0x6117b538 inWebCore::HTMLDocumentParser::pumpPendingSpeculations(this=this@entry=0x2e953e00) at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:530

#12 0x6117b770 inWebCore::HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser(this=0x2e953e00, chunk=...) at../../third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp:363

#13 0x611756c2 in operator() (p1=..., c=..., this=<optimizedout>) at ../../third_party/WebKit/Source/wtf/Functional.h:210

#14 WTF::BoundFunctionImpl<WTF::FunctionWrapper<void(WebCore::HTMLDocumentParser::*)(WTF::PassOwnPtr<WebCore::HTMLDocumentParser::ParsedChunk>)>,void (WTF::WeakPtr<WebCore::HTMLDocumentParser>,WTF::PassOwnPtr<W

ebCore::HTMLDocumentParser::ParsedChunk>)>::operator()()(this=<optimized out>) at../../third_party/WebKit/Source/wtf/Functional.h:420

#15 0x61b277fc in operator() (this=0x597b12c8) at../../third_party/WebKit/Source/wtf/Functional.h:577

#16 WTF::callFunctionObject (context=0x597b12c8) at../../third_party/WebKit/Source/wtf/MainThread.cpp:62









其他一些触发FrameView::layout的场景:

收到resize的事件:



#0 WebCore::FrameView::layout(this=this@entry=0x2e61c500,allowSubtree=allowSubtree@entry=true) at../../third_party/WebKit/Source/core/frame/FrameView.cpp:852

#1 0x60f1d6cc in blink::WebViewImpl::resize(this=0x64da41e0, newSize=...) at../../third_party/WebKit/Source/web/WebViewImpl.cpp:1699

#2 0x61b9607a in content::RenderWidget::Resize(this=this@entry=0x60c85630, new_size=..., physical_backing_size=...,overdraw_bottom_height=<optimized out>,visible_viewport_size=..., resizer_rect=...,

is_fullscreen=false,resize_ack=resize_ack@entry=content::RenderWidget::SEND_RESIZE_ACK)at ../../content/renderer/render_widget.cc:660

#3 0x61b96858 in content::RenderWidget::OnResize(this=this@entry=0x60c85630, params=...) at../../content/renderer/render_widget.cc:750

#4 0x61b8d2c4 in content::RenderViewImpl::OnResize(this=0x60c85630, params=...) at../../content/renderer/render_view_impl.cc:3252

#5 0x61b97966 in DispatchToMethod<content::RenderWidget, void(content::RenderWidget::*)(ViewMsg_Resize_Params const&),ViewMsg_Resize_Params> (arg=...,

method=&virtualcontent::RenderWidget::OnResize(ViewMsg_Resize_Params const&),obj=0x60c85630) at ../../base/tuple.h:548

#6 Dispatch<content::RenderWidget, content::RenderWidget,void, void (content::RenderWidget::*)(ViewMsg_Resize_Params const&)>(sender=0x60c85630, parameter=0x0,

func=&virtualcontent::RenderWidget::OnResize(ViewMsg_Resize_Paramsconst&), obj=0x60c85630, msg=0x5acfadf4) at../../content/common/view_messages.h:615

#7 content::RenderWidget::OnMessageReceived(this=this@entry=0x60c85630, message=...) at../../content/renderer/render_widget.cc:578

#8 0x61b9294c in content::RenderViewImpl::OnMessageReceived(this=0x60c85630, message=...) at../../content/renderer/render_view_impl.cc:1330





还有一种场景,收到设置backgroundcolor的消息:

#0 WebCore::FrameView::layout(this=this@entry=0x2e61c000, allowSubtree=allowSubtree@entry=true) at../../third_party/WebKit/Source/core/frame/FrameView.cpp:852

#1 0x61870002 inWebCore::FrameView::updateLayoutAndStyleIfNeededRecursive(this=this@entry=0x2e61c000) at../../third_party/WebKit/Source/core/frame/FrameView.cpp:2866

#2 0x618700da inWebCore::FrameView::updateLayoutAndStyleForPainting (this=0x2e61c000)at ../../third_party/WebKit/Source/core/frame/FrameView.cpp:2836

#3 0x618de9f4 inWebCore::PageAnimator::updateLayoutAndStyleForPainting(this=0x59aeb800) at../../third_party/WebKit/Source/core/page/PageAnimator.cpp:79

#4 0x60ef62f2 in blink::PageWidgetDelegate::layout(page=<optimized out>) at../../third_party/WebKit/Source/web/PageWidgetDelegate.cpp:75

#5 0x60f1b41e in blink::WebViewImpl::layout(this=0x64da4000) at../../third_party/WebKit/Source/web/WebViewImpl.cpp:1790

#6 0x60f1b38e in blink::WebViewImpl::setBaseBackgroundColor(this=0x64da4000, color=4294967295) at../../third_party/WebKit/Source/web/WebViewImpl.cpp:3692

#7 0x612c0c2c inandroid_webview::AwRenderViewExt::OnSetBackgroundColor(this=this@entry=0x5962f0d8, c=4294967295) at../../android_webview/renderer/aw_render_view_ext.cc:312

#8 0x612c0dda inDispatchToMethod<android_webview::AwRenderViewExt, void(android_webview::AwRenderViewExt::*)(unsigned int), unsigned int>(arg=..., method=<optimized out>, obj=0x5962f0d8)

at ../../base/tuple.h:548

#9 Dispatch<android_webview::AwRenderViewExt,android_webview::AwRenderViewExt, void, void(android_webview::AwRenderViewExt::*)(unsigned int)>(sender=0x5962f0d8, parameter=0x0, func=<optimized out>,

obj=0x5962f0d8, msg=0x59c350cc) at../../android_webview/common/render_view_messages.h:73

#10 android_webview::AwRenderViewExt::OnMessageReceived(this=0x5962f0d8, message=...) at../../android_webview/renderer/aw_render_view_ext.cc:162

#11 0x61b91380 in content::RenderViewImpl::OnMessageReceived(this=0x60c85630, message=...) at../../content/renderer/render_view_impl.









收到focus也会:

#0 WebCore::FrameView::layout(this=this@entry=0x2e61c000,allowSubtree=allowSubtree@entry=true) at../../third_party/WebKit/Source/core/frame/FrameView.cpp:852

#1 0x612ddab6 in WebCore::Document::updateLayout(this=0x36204000) at../../third_party/WebKit/Source/core/dom/Document.cpp:2000

#2 0x612de852 inWebCore::Document::updateLayoutIgnorePendingStylesheets(this=0x36204000,runPostLayoutTasks=runPostLayoutTasks@entry=WebCore::Document::RunPostLayoutTasksAsyhnchronously)

at ../../third_party/WebKit/Source/core/dom/Document.cpp:2056

#3 0x61839126 in WebCore::FrameSelection::setCaretVisibility(this=this@entry=0x64df17a0, visibility=WebCore::CaretBase::Visible)at../../third_party/WebKit/Source/core/editing/FrameSelection.cpp:1598

#4 0x6183ac32 inWebCore::FrameSelection::focusedOrActiveStateChanged(this=0x64df17a0) at../../third_party/WebKit/Source/core/editing/FrameSelection.cpp:1469

#5 0x6183ac60 in WebCore::FrameSelection::pageActivationChanged(this=<optimized out>) at../../third_party/WebKit/Source/core/editing/FrameSelection.cpp:1486

#6 0x618db2b4 in WebCore::FocusController::setActive(this=<optimized out>, active=active@entry=true) at../../third_party/WebKit/Source/core/page/FocusController.cpp:730

#7 0x60f1dcc2 in blink::WebViewImpl::setFocus(this=0x64da4000, enable=<optimized out>) at../../third_party/WebKit/Source/web/WebViewImpl.cpp:2014

#8 0x61b951a8 in content::RenderWidget::OnSetFocus(this=this@entry=0x60c85630, enable=enable@entry=true) at../../content/renderer/render_widget.cc:1130

#9 0x61b8e49c in content::RenderViewImpl::OnSetFocus(this=0x60c85630, enable=<optimized out>) at../../content/renderer/render_view_impl.cc:3547

#10 0x6172b0a4 in DispatchToMethod<content::RenderViewHostImpl,void (content::RenderViewHostImpl::*)(bool), bool>(obj=obj@entry=0x60c85630, method=&virtualcontent::RenderViewHostImpl::GetMainFrame(), arg=...)

at ../../base/tuple.h:548

#11 0x61b97a1a in Dispatch<content::RenderWidget,content::RenderWidget, void, void (content::RenderWidget::*)(bool)>(sender=<optimized out>, parameter=<optimized out>, func=

(void (content::RenderWidget::*)(content::RenderWidget *const, bool)) 0x60b80594, this adjustment 866453464, obj=<optimizedout>, msg=<optimized out>) at../../content/common/view_messages.h:630

#12 content::RenderWidget::OnMessageReceived(this=this@entry=0x60c85630, message=...) at../../content/renderer/render_widget.cc:581

#13 0x61b9294c in content::RenderViewImpl::OnMessageReceived(this=0x60c85630, message=...) at../../content/renderer/render_view_impl.cc:1330



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值