[webkit-dev] How to flatten frames?

Patrick Hanna phanna at email.unc.edu
Wed Jul 1 05:07:29 PDT 2009


I'm not sure what to make of the trace. Is it looping over something  
or is it recursively calling layout?

On Jun 30, 2009, at 11:15 PM, Seo K wrote:

> Hi,
>
> Thank you for the reply. I tried view->resize(width(), height(), but
> it does not make any difference.
>
> The stack trace is like the following when GTKLauncher hangs.
>
> #0  0xb74e80ac in WTF::PairFirstExtractor<std::pair<unsigned int,
> unsigned long> >::extract (p=@0x90c8860) at
> JavaScriptCore/wtf/HashMap.h:93
> #1  0xb74e811a in WTF::HashTable<unsigned int, std::pair<unsigned int,
> unsigned long>, WTF::PairFirstExtractor<std::pair<unsigned int,
> unsigned long> >, WTF::IntHash<unsigned int>,
> WTF::PairHashTraits<WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >, WTF::HashTraits<unsigned int>
>> ::isEmptyBucket (value=@0x90c8860) at
> JavaScriptCore/wtf/HashTable.h:336
> #2  0xb74e813d in WTF::HashTable<unsigned int, std::pair<unsigned int,
> unsigned long>, WTF::PairFirstExtractor<std::pair<unsigned int,
> unsigned long> >, WTF::IntHash<unsigned int>,
> WTF::PairHashTraits<WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >, WTF::HashTraits<unsigned int>
>> ::isEmptyOrDeletedBucket (value=@0x90c8860) at
> JavaScriptCore/wtf/HashTable.h:338
> #3  0xb74e8191 in WTF::HashTableConstIterator<unsigned int,
> std::pair<unsigned int, unsigned long>,
> WTF::PairFirstExtractor<std::pair<unsigned int, unsigned long> >,
> WTF::IntHash<unsigned int>,
> WTF::PairHashTraits<WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >, WTF::HashTraits<unsigned int>
>> ::skipEmptyBuckets (this=0xbfe5bbcc) at
> JavaScriptCore/wtf/HashTable.h:107
> #4  0xb74e91de in HashTableConstIterator (this=0xbfe5bbcc,
> table=0x90c5870, position=0x90c8798, endPosition=0x90c8998) at
> JavaScriptCore/wtf/HashTable.h:115
> #5  0xb74e920a in HashTableIterator (this=0xbfe5bbcc, table=0x90c5870,
> pos=0x90c8798, end=0x90c8998) at JavaScriptCore/wtf/HashTable.h:232
> #6  0xb74e9243 in WTF::HashTable<unsigned int, std::pair<unsigned int,
> unsigned long>, WTF::PairFirstExtractor<std::pair<unsigned int,
> unsigned long> >, WTF::IntHash<unsigned int>,
> WTF::PairHashTraits<WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >, WTF::HashTraits<unsigned int>
>> ::makeIterator (this=0x90c5870, pos=0x90c8798) at
> JavaScriptCore/wtf/HashTable.h:381
> #7  0xb74e9274 in WTF::HashTable<unsigned int, std::pair<unsigned int,
> unsigned long>, WTF::PairFirstExtractor<std::pair<unsigned int,
> unsigned long> >, WTF::IntHash<unsigned int>,
> WTF::PairHashTraits<WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >, WTF::HashTraits<unsigned int>
>> ::begin (this=0x90c5870) at JavaScriptCore/wtf/HashTable.h:306
> #8  0xb74e95d1 in WTF::HashMap<unsigned int, unsigned long,
> WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>,
> WTF::HashTraits<unsigned long> >::begin (this=0x90c5870) at
> JavaScriptCore/wtf/HashMap.h:137
> #9  0xb74e7d96 in identifierByPthreadHandle
> (pthreadHandle=@0xbfe5bc60) at
> JavaScriptCore/wtf/ThreadingPthreads.cpp:99
> #10 0xb74e7f3d in WTF::currentThread () at
> JavaScriptCore/wtf/ThreadingPthreads.cpp:221
> #11 0xb74e7f7c in WTF::isMainThread () at
> JavaScriptCore/wtf/ThreadingPthreads.cpp:231
> #12 0xb798f01f in WebCore::FontFallbackList::primarySimpleFontData
> (this=0x9b89c48, f=0x9b89d60) at
> WebCore/platform/graphics/FontFallbackList.h:63
> #13 0xb798e431 in WebCore::Font::primaryFont (this=0x9b89d60) at
> WebCore/platform/graphics/Font.cpp:130
> #14 0xb78076b5 in WebCore::Font::ascent (this=0x9b89d60) at
> ./WebCore/platform/graphics/Font.h:108
> #15 0xb7a92e6f in WebCore::RenderObject::baselinePosition
> (this=0x9b8a1a4, firstLine=false, isRootLineBox=false) at
> WebCore/rendering/RenderObject.cpp:1955
> #16 0xb7a0b9a8 in WebCore::InlineFlowBox::computeLogicalBoxHeights
> (this=0x9f7e43c, maxPositionTop=@0xbfe5bf48,
> maxPositionBottom=@0xbfe5bf44, maxAscent=@0xbfe5bf40,
> maxDescent=@0xbfe5bf3c, strictMode=false) at
> WebCore/rendering/InlineFlowBox.cpp:460
> #17 0xb7a0bb0e in WebCore::InlineFlowBox::computeLogicalBoxHeights
> (this=0x99216d4, maxPositionTop=@0xbfe5bf48,
> maxPositionBottom=@0xbfe5bf44, maxAscent=@0xbfe5bf40,
> maxDescent=@0xbfe5bf3c, strictMode=false) at
> WebCore/rendering/InlineFlowBox.cpp:480
> #18 0xb7a0bb0e in WebCore::InlineFlowBox::computeLogicalBoxHeights
> (this=0x9f97a94, maxPositionTop=@0xbfe5bf48,
> maxPositionBottom=@0xbfe5bf44, maxAscent=@0xbfe5bf40,
> maxDescent=@0xbfe5bf3c, strictMode=false) at
> WebCore/rendering/InlineFlowBox.cpp:480
> #19 0xb7a0bc0c in WebCore::InlineFlowBox::verticallyAlignBoxes
> (this=0x9f97a94, heightOfBlock=57) at
> WebCore/rendering/InlineFlowBox.cpp:345
> #20 0xb7ae3076 in
> WebCore::RenderBlock::computeVerticalPositionsForLine (this=0x9b89794,
> lineBox=0x9f97a94, firstRun=0x9f9507c) at
> WebCore/rendering/bidi.cpp:752
> #21 0xb7ae8fa0 in WebCore::RenderBlock::layoutInlineChildren
> (this=0x9b89794, relayoutChildren=true, repaintTop=@0xbfe5c38c,
> repaintBottom=@0xbfe5c388) at WebCore/rendering/bidi.cpp:1019
> #22 0xb7a2b9e5 in WebCore::RenderBlock::layoutBlock (this=0x9b89794,
> relayoutChildren=true) at WebCore/rendering/RenderBlock.cpp:779
> #23 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x9b89794) at
> WebCore/rendering/RenderBlock.cpp:698
> #24 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x9b8916c, relayoutChildren=true, maxFloatBottom=@0xbfe5c604) at
> WebCore/rendering/RenderBlock.cpp:1373
> #25 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x9b8916c,
> relayoutChildren=true) at WebCore/rendering/RenderBlock.cpp:781
> #26 0xb7ab0f9d in WebCore::RenderTableCell::layout (this=0x9b8916c) at
> WebCore/rendering/RenderTableCell.cpp:137
> #27 0xb7ab5fb0 in WebCore::RenderTableRow::layout (this=0x9b88ecc) at
> WebCore/rendering/RenderTableRow.cpp:127
> #28 0xb75bc09b in WebCore::RenderObject::layoutIfNeeded
> (this=0x9b88ecc) at ./WebCore/rendering/RenderObject.h:483
> #29 0xb7ab9e9a in WebCore::RenderTableSection::layout (this=0x9b88e1c)
> at WebCore/rendering/RenderTableSection.cpp:400
> #30 0xb75bc09b in WebCore::RenderObject::layoutIfNeeded
> (this=0x9b88e1c) at ./WebCore/rendering/RenderObject.h:483
> #31 0xb7aade17 in WebCore::RenderTable::layout (this=0x9b88c7c) at
> WebCore/rendering/RenderTable.cpp:282
> #32 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x976b0a4, relayoutChildren=true, maxFloatBottom=@0xbfe5cad4) at
> WebCore/rendering/RenderBlock.cpp:1373
> #33 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x976b0a4,
> relayoutChildren=true) at WebCore/rendering/RenderBlock.cpp:781
> #34 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x976b0a4) at
> WebCore/rendering/RenderBlock.cpp:698
> #35 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x968b70c, relayoutChildren=true, maxFloatBottom=@0xbfe5cd54) at
> WebCore/rendering/RenderBlock.cpp:1373
> #36 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x968b70c,
> relayoutChildren=true) at WebCore/rendering/RenderBlock.cpp:781
> #37 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x968b70c) at
> WebCore/rendering/RenderBlock.cpp:698
> #38 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x962ba54, relayoutChildren=true, maxFloatBottom=@0xbfe5cfd4) at
> WebCore/rendering/RenderBlock.cpp:1373
> #39 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x962ba54,
> relayoutChildren=true) at WebCore/rendering/RenderBlock.cpp:781
> #40 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x962ba54) at
> WebCore/rendering/RenderBlock.cpp:698
> #41 0xb7ad1b65 in WebCore::RenderView::layout (this=0x962ba54) at
> WebCore/rendering/RenderView.cpp:122
> #42 0xb7934391 in WebCore::FrameView::layout (this=0x9904618,
> allowSubtree=true) at WebCore/page/FrameView.cpp:610
> #43 0xb7939b4c in WebCore::FrameView::visibleContentsResized
> (this=0x9904618) at WebCore/page/FrameView.h:215
> #44 0xb797bced in WebCore::ScrollView::updateScrollbars
> (this=0x9904618, desiredOffset=@0x9904684) at
> WebCore/platform/ScrollView.cpp:392
> #45 0xb797c562 in WebCore::ScrollView::setFrameRect (this=0x9904618,
> newRect=@0xbfe5d2a0) at WebCore/platform/ScrollView.cpp:700
> #46 0xb7436c52 in WebCore::Widget::resize (this=0x9904618, w=345,
> h=3336) at ./WebCore/platform/Widget.h:128
> #47 0xb7a62d01 in WebCore::RenderFrame::layout (this=0x967d524) at
> WebCore/rendering/RenderFrame.cpp:78
> #48 0xb7a64205 in WebCore::RenderFrameSet::positionFrames
> (this=0x9687f24) at WebCore/rendering/RenderFrameSet.cpp:618
> #49 0xb7a65741 in WebCore::RenderFrameSet::layout (this=0x9687f24) at
> WebCore/rendering/RenderFrameSet.cpp:499
> #50 0xb7a63d5e in WebCore::RenderFrameSet::positionFrames
> (this=0x968a94c) at WebCore/rendering/RenderFrameSet.cpp:554
> #51 0xb7a65741 in WebCore::RenderFrameSet::layout (this=0x968a94c) at
> WebCore/rendering/RenderFrameSet.cpp:499
> #52 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x98d356c, relayoutChildren=false, maxFloatBottom=@0xbfe5d794)
> at WebCore/rendering/RenderBlock.cpp:1373
> #53 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x98d356c,
> relayoutChildren=false) at WebCore/rendering/RenderBlock.cpp:781
> #54 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x98d356c) at
> WebCore/rendering/RenderBlock.cpp:698
> #55 0xb7a2a592 in WebCore::RenderBlock::layoutBlockChildren
> (this=0x968a484, relayoutChildren=false, maxFloatBottom=@0xbfe5da14)
> at WebCore/rendering/RenderBlock.cpp:1373
> #56 0xb7a2ba04 in WebCore::RenderBlock::layoutBlock (this=0x968a484,
> relayoutChildren=false) at WebCore/rendering/RenderBlock.cpp:781
> #57 0xb7a18d64 in WebCore::RenderBlock::layout (this=0x968a484) at
> WebCore/rendering/RenderBlock.cpp:698
> #58 0xb7ad1b65 in WebCore::RenderView::layout (this=0x968a484) at
> WebCore/rendering/RenderView.cpp:122
> #59 0xb7934391 in WebCore::FrameView::layout (this=0x90dcb00,
> allowSubtree=true) at WebCore/page/FrameView.cpp:610
> #60 0xb793460d in WebCore::FrameView::layout (this=0x90dcb00,
> allowSubtree=false) at WebCore/page/FrameView.cpp:664
> #61 0xb79346f3 in WebCore::FrameView::forceLayout (this=0x90dcb00,
> allowSubtree=false) at WebCore/page/FrameView.cpp:1473
> #62 0xb74351e3 in webkit_web_view_size_allocate (widget=0x90ce820,
> allocation=0xbfe5dfec) at WebKit/gtk/webkit/webkitwebview.cpp:558
> #63 0xb5a67a3c in g_cclosure_marshal_VOID__BOXED () from
> /usr/lib/libgobject-2.0.so.0
> #64 0xb5a593c9 in ?? () from /usr/lib/libgobject-2.0.so.0
> #65 0xb5a5ab78 in g_closure_invoke () from /usr/lib/ 
> libgobject-2.0.so.0
> #66 0xb5a708ee in ?? () from /usr/lib/libgobject-2.0.so.0
> #67 0xb5a727ac in g_signal_emit_valist () from /usr/lib/ 
> libgobject-2.0.so.0
> #68 0xb5a72c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
> #69 0xb6159454 in gtk_widget_size_allocate () from /usr/lib/libgtk- 
> x11-2.0.so.0
> #70 0xb609aadb in ?? () from /usr/lib/libgtk-x11-2.0.so.0
> #71 0xb5a67a3c in g_cclosure_marshal_VOID__BOXED () from
> /usr/lib/libgobject-2.0.so.0
> #72 0xb5a593c9 in ?? () from /usr/lib/libgobject-2.0.so.0
> #73 0xb5a5ab78 in g_closure_invoke () from /usr/lib/ 
> libgobject-2.0.so.0
> #74 0xb5a708ee in ?? () from /usr/lib/libgobject-2.0.so.0
> #75 0xb5a727ac in g_signal_emit_valist () from /usr/lib/ 
> libgobject-2.0.so.0
> #76 0xb5a72c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
> #77 0xb6159454 in gtk_widget_size_allocate () from /usr/lib/libgtk- 
> x11-2.0.so.0
> #78 0xb614de26 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
> #79 0xb5a67a3c in g_cclosure_marshal_VOID__BOXED () from
> /usr/lib/libgobject-2.0.so.0
> #80 0xb5a593c9 in ?? () from /usr/lib/libgobject-2.0.so.0
> #81 0xb5a5ab78 in g_closure_invoke () from /usr/lib/ 
> libgobject-2.0.so.0
> #82 0xb5a708ee in ?? () from /usr/lib/libgobject-2.0.so.0
> #83 0xb5a727ac in g_signal_emit_valist () from /usr/lib/ 
> libgobject-2.0.so.0
> #84 0xb5a72c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
> #85 0xb6159454 in gtk_widget_size_allocate () from /usr/lib/libgtk- 
> x11-2.0.so.0
> #86 0xb616b63b in ?? () from /usr/lib/libgtk-x11-2.0.so.0
> #87 0xb5a67a3c in g_cclosure_marshal_VOID__BOXED () from
> /usr/lib/libgobject-2.0.so.0
> #88 0xb5a593c9 in ?? () from /usr/lib/libgobject-2.0.so.0
> #89 0xb5a5ac4b in g_closure_invoke () from /usr/lib/ 
> libgobject-2.0.so.0
> #90 0xb5a708ee in ?? () from /usr/lib/libgobject-2.0.so.0
> #91 0xb5a727ac in g_signal_emit_valist () from /usr/lib/ 
> libgobject-2.0.so.0
> #92 0xb5a72c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
> #93 0xb6159454 in gtk_widget_size_allocate () from /usr/lib/libgtk- 
> x11-2.0.so.0
> #94 0xb5fb3dcf in gtk_container_resize_children () from
> /usr/lib/libgtk-x11-2.0.so.0
> #95 0xb616b886 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
> #96 0xb5a683d4 in g_cclosure_marshal_VOID__VOID () from
> /usr/lib/libgobject-2.0.so.0
> #97 0xb5a593c9 in ?? () from /usr/lib/libgobject-2.0.so.0
> #98 0xb5a5ac4b in g_closure_invoke () from /usr/lib/ 
> libgobject-2.0.so.0
> #99 0xb5a70d3d in ?? () from /usr/lib/libgobject-2.0.so.0
> #100 0xb5a727ac in g_signal_emit_valist () from /usr/lib/ 
> libgobject-2.0.so.0
> #101 0xb5a72c26 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
> #102 0xb5fb3e6a in gtk_container_check_resize () from
> /usr/lib/libgtk-x11-2.0.so.0
> #103 0xb5fb3ec0 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
> #104 0xb5e9946b in ?? () from /usr/lib/libgdk-x11-2.0.so.0
> #105 0xb59c17e1 in ?? () from /usr/lib/libglib-2.0.so.0
> #106 0xb59c3718 in g_main_context_dispatch () from /usr/lib/ 
> libglib-2.0.so.0
> #107 0xb59c6dc3 in ?? () from /usr/lib/libglib-2.0.so.0
> #108 0xb59c72e2 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #109 0xb60373a9 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> #110 0x08049ede in main (argc=1, argv=0xbfe5f324) at
> WebKitTools/GtkLauncher/main.c:205
>
>
> I know some changes in rendering between the latest version of WebKit
> and the Android WebKit makes this difference. I suspect that two lines
> are causing infinite layouts, but I don't have any detailed knowledge
> on the rendering process of WebKit.
>
> Thanks,
> K Seo
>
> 2009/7/1 Patrick Hanna <phanna at email.unc.edu>:
>> The patch on Android is against a different webkit revision so who  
>> knows
>> what will happen when patching against the latest webkit.
>> My first thought is to try view->resize(width(), height()) instead  
>> of using
>> m_width and m_height but I don't know what that will change.
>> Have you looked at the stack trace when GtkLauncher hangs to find  
>> out why
>> those 2 lines are the culprit?
>> On Jun 30, 2009, at 10:34 AM, Seo K wrote:
>>
>> Hi,
>>
>> I want to flatten frames within a frameset so that no individual  
>> scrollbars
>> of frames would appear. This is the behavior of most mobile browsers
>> including iPhone and Android.
>>
>> I found the patch from the Android WebKit source code with  
>> FLATTEN_FRAMESET.
>> I applied the patch to the latest version of WebKit and adjusted it  
>> the
>> latest changes, but it does not seem to work.
>>
>> WebCore/rendering/RenderFrame.cpp
>>
>> +#if USE(FLATTEN_FRAMESET)
>> +void RenderFrame::layout()
>> +{
>> +    if (widget() && widget()->isFrameView()) {
>> +        FrameView* view = static_cast<FrameView*>(widget());
>> +        RenderView* root = NULL;
>> +        if (view->frame() && view->frame()->document() &&
>> +            view->frame()->document()->renderer() &&
>> view->frame()->document()->renderer()->isRenderView())
>> +            root =
>> static_cast<RenderView*>(view->frame()->document()->renderer());
>> +        if (root) {
>> +            // Resize the widget so that the RenderView will layout
>> according to those dimensions.
>> +            view->resize(m_width, m_height);
>> +            view->layout();
>> +            // We can only grow in width and height because if
>> positionFrames gives us a width and we become smaller,
>> +            // then the fixup process of forcing the frame to fill  
>> extra
>> space will fail.
>> +            if (m_width > root->docWidth()) {
>> +                view->resize(root->docWidth(), 0);
>> +                view->layout();
>> +            }
>> +            // Honor the height set by  
>> RenderFrameSet::positionFrames
>> unless our document height is larger.
>> +            setHeight(max(root->docHeight(), height()));
>> +            setWidth(max(root->docWidth(), width()));
>> +        }
>> +    }
>> +    setNeedsLayout(false);
>> +}
>> +#endif
>> +
>>
>>
>> I tested it with http://java.sun.com/j2se/1.5.0/docs/api/ which has  
>> three
>> frames within a frameset.
>>
>> GtkLauncher hangs when it loads the Java API page. However, after I  
>> remove
>> the following two lines from the patch, it seems to work and frames  
>> are
>> correctly flattened.
>>
>>         if (root) {
>>             // Resize the widget so that the RenderView will layout
>> according to those dimensions.
>> -            view->resize(m_width, m_height);
>> -            view->layout();
>>             // We can only grow in width and height because if
>> positionFrames gives us a width and we become smaller,
>>             // then the fixup process of forcing the frame to fill  
>> extra
>> space will fail.
>>
>>
>> What's the problem here? I attached the whole patch.
>>
>> Thanks,
>> K Seo
>>
>>
>> <FlattenFrameSet.diff>_______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>



More information about the webkit-dev mailing list