[webkit-dev] How to flatten frames?

Patrick Hanna phanna at email.unc.edu
Tue Jun 30 10:05:21 PDT 2009


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090630/2dc3652b/attachment.html>


More information about the webkit-dev mailing list