Changeset 97462 in webkit


Ignore:
Timestamp:
Oct 14, 2011 7:09:43 AM (13 years ago)
Author:
kenneth@webkit.org
Message:

Do not cache m_resizesToContentsLayoutSize on WebKit2's WebPage
https://bugs.webkit.org/show_bug.cgi?id=66134

Reviewed by Simon Hausmann.

Do the resize to contents on the web process side.

Based on patch by Zalan Bujtas.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setSize):
(WebKit::WebPage::setResizesToContentsUsingLayoutSize):
(WebKit::WebPage::resizeToContentsIfNeeded):

  • WebProcess/WebPage/WebPage.h:
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r97458 r97462  
     12011-10-14  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Do not cache m_resizesToContentsLayoutSize on WebKit2's WebPage
     4        https://bugs.webkit.org/show_bug.cgi?id=66134
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Do the resize to contents on the web process side.
     9
     10        Based on patch by Zalan Bujtas.
     11
     12        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     13        (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
     14        * WebProcess/WebPage/WebPage.cpp:
     15        (WebKit::WebPage::setSize):
     16        (WebKit::WebPage::setResizesToContentsUsingLayoutSize):
     17        (WebKit::WebPage::resizeToContentsIfNeeded):
     18        * WebProcess/WebPage/WebPage.h:
     19
    1202011-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r95968 r97462  
    11141114    WebPage* webPage = m_frame->page();
    11151115    Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
     1116    FrameView* view = m_frame->coreFrame()->view();
    11161117
    11171118    bool isMainFrame = webPage->mainWebFrame() == m_frame;
    11181119
    11191120#if ENABLE(TILED_BACKING_STORE)
    1120     IntSize currentVisibleContentSize = m_frame->coreFrame()->view() ? m_frame->coreFrame()->view()->visibleContentRect().size() : IntSize();
    1121     m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, webPage->resizesToContentsLayoutSize(), isMainFrame && webPage->resizesToContentsEnabled());
    1122 
    1123     if (isMainFrame && webPage->resizesToContentsEnabled()) {
     1121    IntSize currentVisibleContentSize;
     1122    IntSize fixedLayoutSize;
     1123
     1124    if (view) {
     1125        currentVisibleContentSize = view->visibleContentRect().size();
     1126        fixedLayoutSize = view->fixedLayoutSize();
     1127    }
     1128
     1129    m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, fixedLayoutSize, !fixedLayoutSize.isEmpty());
     1130
     1131    if (isMainFrame && !fixedLayoutSize.isEmpty()) {
    11241132        m_frame->coreFrame()->view()->setDelegatesScrolling(true);
    11251133        m_frame->coreFrame()->view()->setPaintsEntireContents(true);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r97405 r97462  
    666666void WebPage::setSize(const WebCore::IntSize& viewSize)
    667667{
     668    FrameView* view = m_page->mainFrame()->view();
     669
    668670#if ENABLE(TILED_BACKING_STORE)
    669671    // If we are resizing to content ignore external attempts.
    670     if (!m_resizesToContentsLayoutSize.isEmpty())
     672    if (view->useFixedLayout())
    671673        return;
    672674#endif
     
    675677        return;
    676678
    677     Frame* frame = m_page->mainFrame();
    678    
    679     frame->view()->resize(viewSize);
    680     frame->view()->setNeedsLayout();
     679    view->resize(viewSize);
     680    view->setNeedsLayout();
    681681    m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), viewSize));
    682682   
     
    694694void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSize)
    695695{
    696     if (m_resizesToContentsLayoutSize == targetLayoutSize)
    697         return;
    698 
    699     m_resizesToContentsLayoutSize = targetLayoutSize;
    700 
    701     Frame* frame = m_page->mainFrame();
    702     if (m_resizesToContentsLayoutSize.isEmpty()) {
    703         frame->view()->setDelegatesScrolling(false);
    704         frame->view()->setUseFixedLayout(false);
    705         frame->view()->setPaintsEntireContents(false);
    706     } else {
    707         frame->view()->setDelegatesScrolling(true);
    708         frame->view()->setUseFixedLayout(true);
    709         frame->view()->setPaintsEntireContents(true);
    710         frame->view()->setFixedLayoutSize(m_resizesToContentsLayoutSize);
    711     }
    712     frame->view()->forceLayout();
     696    FrameView* view = m_page->mainFrame()->view();
     697
     698    if (view->fixedLayoutSize() == targetLayoutSize)
     699        return;
     700
     701    bool fixedLayout = !targetLayoutSize.isEmpty();
     702
     703    if (fixedLayout)
     704        view->setFixedLayoutSize(targetLayoutSize);
     705
     706    // Set view attributes based on whether fixed layout is used.
     707    view->setDelegatesScrolling(fixedLayout);
     708    view->setUseFixedLayout(fixedLayout);
     709    view->setPaintsEntireContents(fixedLayout);
     710
     711    // Schedule a layout to use the new target size.
     712    if (!view->layoutPending()) {
     713        view->setNeedsLayout();
     714        view->scheduleRelayout();
     715    }
    713716}
    714717
    715718void WebPage::resizeToContentsIfNeeded()
    716719{
    717     if (m_resizesToContentsLayoutSize.isEmpty())
    718         return;
    719 
    720     Frame* frame = m_page->mainFrame();
    721 
    722     IntSize contentSize = frame->view()->contentsSize();
     720    FrameView* view = m_page->mainFrame()->view();
     721
     722    if (!view->useFixedLayout())
     723        return;
     724
     725    IntSize contentSize = view->contentsSize();
    723726    if (contentSize == m_viewSize)
    724727        return;
    725728
    726729    m_viewSize = contentSize;
    727     frame->view()->resize(m_viewSize);
    728     frame->view()->setNeedsLayout();
     730    view->resize(m_viewSize);
     731    view->setNeedsLayout();
    729732}
    730733#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r97405 r97462  
    309309    void pageDidRequestScroll(const WebCore::IntPoint&);
    310310    void setFixedVisibleContentRect(const WebCore::IntRect&);
    311 
    312     bool resizesToContentsEnabled() const { return !m_resizesToContentsLayoutSize.isEmpty(); }
    313     WebCore::IntSize resizesToContentsLayoutSize() const { return m_resizesToContentsLayoutSize; }
    314311    void setResizesToContentsUsingLayoutSize(const WebCore::IntSize& targetLayoutSize);
    315312    void resizeToContentsIfNeeded();
Note: See TracChangeset for help on using the changeset viewer.