Changeset 100594 in webkit


Ignore:
Timestamp:
Nov 17, 2011 3:26:29 AM (12 years ago)
Author:
kenneth@webkit.org
Message:

Make use-fixed-layout work reliable
https://bugs.webkit.org/show_bug.cgi?id=72511

Reviewed by Simon Hausmann.

Source/WebCore:

Always send a viewport update per page load as we depend on that,
to reset all viewport handling before doing layout.

  • page/Page.cpp:

(WebCore::Page::updateViewportArguments):

Source/WebKit2:

The code handling use-fixed-layout wasn't 100% reliable. The code
was changed to make sure the value is always correct.

It also doesn't set the value by looking at the previous FrameView,
as that wouldn't work in cases, such as when the web process has
crashes.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::setResizesToContentsUsingLayoutSize):
(WebKit::WebPage::setUseFixedLayout):

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::useFixedLayout):

Store the state as m_useFixedLayout so that it can be used
from the WebFrameLoaderClient.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r100588 r100594  
     12011-11-16  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Make use-fixed-layout work reliable
     4        https://bugs.webkit.org/show_bug.cgi?id=72511
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Always send a viewport update per page load as we depend on that,
     9        to reset all viewport handling before doing layout.
     10
     11        * page/Page.cpp:
     12        (WebCore::Page::updateViewportArguments):
     13
    1142011-11-16  Alexander Pavlov  <apavlov@chromium.org>
    215
  • trunk/Source/WebCore/page/Page.cpp

    r100555 r100594  
    405405void Page::updateViewportArguments()
    406406{
    407     if (!mainFrame() || !mainFrame()->document() || mainFrame()->document()->viewportArguments() == m_viewportArguments)
     407    if (!mainFrame() || !mainFrame()->document())
    408408        return;
    409409
  • trunk/Source/WebKit2/ChangeLog

    r100590 r100594  
     12011-11-16  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Make use-fixed-layout work reliable
     4        https://bugs.webkit.org/show_bug.cgi?id=72511
     5
     6        Reviewed by Simon Hausmann.
     7
     8        The code handling use-fixed-layout wasn't 100% reliable. The code
     9        was changed to make sure the value is always correct.
     10
     11        It also doesn't set the value by looking at the previous FrameView,
     12        as that wouldn't work in cases, such as when the web process has
     13        crashed.
     14
     15        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     16        (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::WebPage):
     19        (WebKit::WebPage::setResizesToContentsUsingLayoutSize):
     20        (WebKit::WebPage::setUseFixedLayout):
     21        * WebProcess/WebPage/WebPage.h:
     22        (WebKit::WebPage::useFixedLayout):
     23
     24            Store the state as m_useFixedLayout so that it can be used
     25            from the WebFrameLoaderClient.
     26
    1272011-11-17  Zalan Bujtas  <zbujtas@gmail.com>
    228
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r100534 r100594  
    11401140{
    11411141    WebPage* webPage = m_frame->page();
     1142
    11421143    Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
    1143 
    1144     bool isMainFrame = webPage->mainWebFrame() == m_frame;
    1145 
    1146 #if USE(TILED_BACKING_STORE)
    1147     IntSize currentVisibleContentSize;
    1148     IntSize fixedLayoutSize;
    1149 
    1150     if (FrameView* view = m_frame->coreFrame()->view()) {
    1151         currentVisibleContentSize = view->visibleContentRect().size();
    1152         fixedLayoutSize = view->fixedLayoutSize();
    1153     }
    1154 
    1155     m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, fixedLayoutSize, !fixedLayoutSize.isEmpty());
    1156 
    1157     if (isMainFrame && !fixedLayoutSize.isEmpty()) {
    1158         m_frame->coreFrame()->view()->setDelegatesScrolling(true);
    1159         m_frame->coreFrame()->view()->setPaintsEntireContents(true);
    1160         // The HistoryController will update the scroll position later if needed.
    1161         m_frame->coreFrame()->view()->setFixedVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize));
    1162     }
    1163 
    1164 #else
     1144    bool shouldUseFixedLayout = webPage->mainWebFrame() == m_frame && webPage->useFixedLayout();
     1145
     1146#if !USE(TILED_BACKING_STORE)
    11651147    const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
    11661148    m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
    1167 
    1168     m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, IntSize(), false);
    11691149#endif
    11701150
     1151    m_frame->coreFrame()->createView(webPage->size(), backgroundColor, /* transparent */ false, IntSize(), shouldUseFixedLayout);
    11711152    m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground());
    11721153}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r100534 r100594  
    173173WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
    174174    : m_viewSize(parameters.viewSize)
     175    , m_useFixedLayout(false)
    175176    , m_drawsBackground(true)
    176177    , m_drawsTransparentBackground(false)
     
    709710    FrameView* view = m_page->mainFrame()->view();
    710711
     712    m_useFixedLayout = !targetLayoutSize.isEmpty();
     713
     714    // Set view attributes based on whether fixed layout is used.
     715    view->setDelegatesScrolling(m_useFixedLayout);
     716    view->setUseFixedLayout(m_useFixedLayout);
     717    view->setPaintsEntireContents(m_useFixedLayout);
     718
    711719    if (view->fixedLayoutSize() == targetLayoutSize)
    712720        return;
    713721
    714     bool fixedLayout = !targetLayoutSize.isEmpty();
    715 
    716     if (fixedLayout)
    717         view->setFixedLayoutSize(targetLayoutSize);
    718 
    719     // Set view attributes based on whether fixed layout is used.
    720     view->setDelegatesScrolling(fixedLayout);
    721     view->setUseFixedLayout(fixedLayout);
    722     view->setPaintsEntireContents(fixedLayout);
     722    // Always reset even when empty.
     723    view->setFixedLayoutSize(targetLayoutSize);
    723724
    724725    // Schedule a layout to use the new target size.
     
    894895void WebPage::setUseFixedLayout(bool fixed)
    895896{
     897    m_useFixedLayout = fixed;
     898
    896899    Frame* frame = m_mainFrame->coreFrame();
    897900    if (!frame)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r100534 r100594  
    264264
    265265    void setUseFixedLayout(bool);
     266    bool useFixedLayout() const { return m_useFixedLayout; }
    266267    void setFixedLayoutSize(const WebCore::IntSize&);
    267268
     
    610611    WebCore::IntSize m_viewSize;
    611612    OwnPtr<DrawingArea> m_drawingArea;
     613    bool m_useFixedLayout;
    612614
    613615    bool m_drawsBackground;
Note: See TracChangeset for help on using the changeset viewer.