Bug 107200 - [WK2] Minimum layout width auto-sizing should use FrameView::enableAutoSizeMode so that it can shrink the viewport
Summary: [WK2] Minimum layout width auto-sizing should use FrameView::enableAutoSizeMo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-01-17 16:35 PST by Tim Horton
Modified: 2013-01-18 00:52 PST (History)
3 users (show)

See Also:


Attachments
patch (9.53 KB, patch)
2013-01-17 16:50 PST, Tim Horton
no flags Details | Formatted Diff | Diff
patch with a const and WebPage will disable the mode if needed (9.70 KB, patch)
2013-01-17 16:59 PST, Tim Horton
simon.fraser: review-
Details | Formatted Diff | Diff
patch (12.93 KB, patch)
2013-01-17 18:22 PST, Tim Horton
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 Tim Horton 2013-01-17 16:35:22 PST
<rdar://problem/12849029>

Using minimum layout width auto-sizing currently doesn't shrink past the current viewport size, so it can only get *taller*, never shorter. FrameView::enableAutoSizeMode already fiddles with layout to fix this, so we should make use of it!
Comment 1 Tim Horton 2013-01-17 16:50:26 PST
Created attachment 183316 [details]
patch
Comment 2 Tim Horton 2013-01-17 16:51:48 PST
Hmm, I should probably support falling back out of auto-sizing mode.
Comment 3 Tim Horton 2013-01-17 16:59:44 PST
Created attachment 183319 [details]
patch with a const and WebPage will disable the mode if needed
Comment 4 Simon Fraser (smfr) 2013-01-17 17:12:53 PST
Comment on attachment 183319 [details]
patch with a const and WebPage will disable the mode if needed

View in context: https://bugs.webkit.org/attachment.cgi?id=183319&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3787
> +    if (!m_minimumLayoutWidth)
> +        corePage()->mainFrame()->view()->enableAutoSizeMode(false, IntSize(), IntSize());

It's weird that you disable auto size mode here, but enable it in the drawing area. I think this should be fixed; this mode should be indpendent of what kind of drawing area is being used.
Comment 5 Tim Horton 2013-01-17 18:22:25 PST
Created attachment 183341 [details]
patch
Comment 6 Simon Fraser (smfr) 2013-01-17 18:30:04 PST
Comment on attachment 183341 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=183341&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3789
> +    m_minimumLayoutWidth = minimumLayoutWidth;
> +
> +    if (minimumLayoutWidth > 0)
> +        corePage()->mainFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(minimumLayoutWidth, INT_MAX));
> +    else
> +        corePage()->mainFrame()->view()->enableAutoSizeMode(false, IntSize(), IntSize());

Do we have to call enableAutoSizeMode() even when m_minimumLayoutWidth doesn't change?

> Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:-375
> -    if (m_minimumLayoutWidth > 0) {
> -        m_webPage->setSize(IntSize(m_minimumLayoutWidth, 0));
> -        m_webPage->layoutIfNeeded();
> +    if (!m_webPage->minimumLayoutWidth())
> +        m_webPage->setSize(size);
> +
> +    m_webPage->layoutIfNeeded();
>  
> +    if (m_webPage->minimumLayoutWidth()) {
>          contentSize = m_webPage->mainWebFrame()->contentBounds().size();
>          size = contentSize;
>      }
>  
> -    m_webPage->setSize(size);
> -    m_webPage->layoutIfNeeded();

This is pretty confusing. I don't know whose responsibility it is to set the size of the WebPage.
Comment 7 Tim Horton 2013-01-17 18:41:02 PST
http://trac.webkit.org/changeset/140087
Comment 8 Tim Horton 2013-01-17 23:19:11 PST
Aahhhh, all the random assertion failures. I'm investigating.
Comment 9 Tim Horton 2013-01-18 00:52:59 PST
(In reply to comment #8)
> Aahhhh, all the random assertion failures. I'm investigating.

I can reproduce with this rolled out, must be something else.