Bug 91038 - When in paginated mode, the layout timer fires continually
Summary: When in paginated mode, the layout timer fires continually
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: mitz
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-07-11 17:59 PDT by Simon Fraser (smfr)
Modified: 2012-08-10 12:40 PDT (History)
4 users (show)

See Also:


Attachments
Change Page::pageCount to only trigger layout if needed (1.41 KB, patch)
2012-08-10 11:44 PDT, mitz
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2012-07-11 17:59:45 PDT
When I put MIniBrowser into paginated mode and load a simple page like http://www.smfr.org, FrameView::layout() is called over and over again; the layout timer keeps firing and never stops. The WebProcess eats over 100% cpu permanently.

mainFrameDidLayout() ends up calling pageCount():

    frame #0: 0x0000000103da1820 WebCore`WebCore::Page::pageCount() const + 16 at Page.cpp:706
    frame #1: 0x0000000101231b9d WebKit2`WebKit::WebPage::mainFrameDidLayout() + 45 at WebPage.cpp:2537
    frame #2: 0x00000001011db93d WebKit2`WebKit::WebFrameLoaderClient::dispatchDidLayout() + 189 at WebFrameLoaderClient.cpp:612
    frame #3: 0x00000001033d9183 WebCore`WebCore::FrameView::performPostLayoutTasks() + 627 at FrameView.cpp:2382
    frame #4: 0x00000001033d89c4 WebCore`WebCore::FrameView::layout(bool) + 4020 at FrameView.cpp:1176
    frame #5: 0x00000001033e1785 WebCore`WebCore::FrameView::forceLayout(bool) + 37 at FrameView.cpp:3241
    frame #6: 0x0000000103da1890 WebCore`WebCore::Page::pageCount() const + 128 at Page.cpp:713
    frame #7: 0x0000000101231b9d WebKit2`WebKit::WebPage::mainFrameDidLayout() + 45 at WebPage.cpp:2537
    frame #8: 0x00000001011db93d WebKit2`WebKit::WebFrameLoaderClient::dispatchDidLayout() + 189 at WebFrameLoaderClient.cpp:612
    frame #9: 0x00000001033d9183 WebCore`WebCore::FrameView::performPostLayoutTasks() + 627 at FrameView.cpp:2382
    frame #10: 0x00000001033d47b9 WebCore`WebCore::FrameView::postLayoutTimerFired(WebCore::Timer<WebCore::FrameView>*) + 25 at FrameView.cpp:2436
    frame #11: 0x00000001033ef043 WebCore`WebCore::Timer<WebCore::FrameView>::fired() + 115 at Timer.h:100
    frame #12: 0x000000010445b4fd WebCore`WebCore::ThreadTimers::sharedTimerFiredInternal() + 285 at ThreadTimers.cpp:115
    frame #13: 0x000000010445b299 WebCore`WebCore::ThreadTimers::sharedTimerFired() + 25 at ThreadTimers.cpp:93
    frame #14: 0x00000001041af8b3 WebCore`timerFired + 67 at SharedTimerMac.mm:166
    frame #15: 0x00007fff95dd44b4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame #16: 0x00007fff95dd3fcd CoreFoundation`__CFRunLoopDoTimer + 557
    frame #17: 0x00007fff95db97b9 CoreFoundation`__CFRunLoopRun + 1513
    frame #18: 0x00007fff95db8dd2 CoreFoundation`CFRunLoopRunSpecific + 290
    frame #19: 0x00007fff950f2774 HIToolbox`RunCurrentEventLoopInMode + 209
    frame #20: 0x00007fff950f2512 HIToolbox`ReceiveNextEventCommon + 356
    frame #21: 0x00007fff950f23a3 HIToolbox`BlockUntilNextEventMatchingListInMode + 62
    frame #22: 0x00007fff90687f73 AppKit`_DPSNextEvent + 685
    frame #23: 0x00007fff90687832 AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    frame #24: 0x00007fff9067ebd3 AppKit`-[NSApplication run] + 517
    frame #25: 0x00000001040fd64c WebCore`WebCore::RunLoop::run() + 92 at RunLoopMac.mm:36
    frame #26: 0x00000001012fbcd8 WebKit2`WebKit::WebProcessMain(WebKit::CommandLine const&) + 3368 at WebProcessMainMac.mm:183
    frame #27: 0x000000010120f7a8 WebKit2`WebKitMain + 200 at WebKitMain.cpp:50
    frame #28: 0x000000010120f6c4 WebKit2`WebKitMain + 148 at WebKitMain.cpp:74
    frame #29: 0x0000000100000da2 WebProcess`main + 274 at MainMac.cpp:68

and Page::pageCount() calls 

    mainFrame()->view()->forceLayout();

which seems to be the cause.
Comment 1 Radar WebKit Bug Importer 2012-07-11 18:00:34 PDT
<rdar://problem/11855229>
Comment 2 mitz 2012-07-11 18:09:41 PDT
This is a WebKit2 bug.
Comment 3 mitz 2012-08-10 11:38:58 PDT
It can be addressed in WebCore.
Comment 4 mitz 2012-08-10 11:44:30 PDT
Created attachment 157777 [details]
Change Page::pageCount to only trigger layout if needed
Comment 5 mitz 2012-08-10 12:40:11 PDT
Fixed in <http://trac.webkit.org/r125314>.