Commit 1c331706 authored by kenneth@webkit.org's avatar kenneth@webkit.org

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d3270020
2011-11-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
Make use-fixed-layout work reliable
https://bugs.webkit.org/show_bug.cgi?id=72511
Reviewed by Simon Hausmann.
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):
2011-11-16 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: inspector follows javascript: hrefs as relative
......@@ -404,7 +404,7 @@ void Page::setNeedsRecalcStyleInAllFrames()
void Page::updateViewportArguments()
{
if (!mainFrame() || !mainFrame()->document() || mainFrame()->document()->viewportArguments() == m_viewportArguments)
if (!mainFrame() || !mainFrame()->document())
return;
m_viewportArguments = mainFrame()->document()->viewportArguments();
......
2011-11-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
Make use-fixed-layout work reliable
https://bugs.webkit.org/show_bug.cgi?id=72511
Reviewed by Simon Hausmann.
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
crashed.
* 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.
2011-11-17 Zalan Bujtas <zbujtas@gmail.com>
[Qt][WK2] Do not apply new viewport properties until after the first visually non-empty layout.
......
......@@ -1139,35 +1139,16 @@ void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
void WebFrameLoaderClient::transitionToCommittedForNewPage()
{
WebPage* webPage = m_frame->page();
Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
bool isMainFrame = webPage->mainWebFrame() == m_frame;
#if USE(TILED_BACKING_STORE)
IntSize currentVisibleContentSize;
IntSize fixedLayoutSize;
if (FrameView* view = m_frame->coreFrame()->view()) {
currentVisibleContentSize = view->visibleContentRect().size();
fixedLayoutSize = view->fixedLayoutSize();
}
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, fixedLayoutSize, !fixedLayoutSize.isEmpty());
if (isMainFrame && !fixedLayoutSize.isEmpty()) {
m_frame->coreFrame()->view()->setDelegatesScrolling(true);
m_frame->coreFrame()->view()->setPaintsEntireContents(true);
// The HistoryController will update the scroll position later if needed.
m_frame->coreFrame()->view()->setFixedVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize));
}
Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
bool shouldUseFixedLayout = webPage->mainWebFrame() == m_frame && webPage->useFixedLayout();
#else
#if !USE(TILED_BACKING_STORE)
const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, IntSize(), false);
#endif
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, /* transparent */ false, IntSize(), shouldUseFixedLayout);
m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground());
}
......
......@@ -172,6 +172,7 @@ PassRefPtr<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParame
WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
: m_viewSize(parameters.viewSize)
, m_useFixedLayout(false)
, m_drawsBackground(true)
, m_drawsTransparentBackground(false)
, m_isInRedo(false)
......@@ -708,18 +709,18 @@ void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSiz
{
FrameView* view = m_page->mainFrame()->view();
if (view->fixedLayoutSize() == targetLayoutSize)
return;
m_useFixedLayout = !targetLayoutSize.isEmpty();
bool fixedLayout = !targetLayoutSize.isEmpty();
// Set view attributes based on whether fixed layout is used.
view->setDelegatesScrolling(m_useFixedLayout);
view->setUseFixedLayout(m_useFixedLayout);
view->setPaintsEntireContents(m_useFixedLayout);
if (fixedLayout)
view->setFixedLayoutSize(targetLayoutSize);
if (view->fixedLayoutSize() == targetLayoutSize)
return;
// Set view attributes based on whether fixed layout is used.
view->setDelegatesScrolling(fixedLayout);
view->setUseFixedLayout(fixedLayout);
view->setPaintsEntireContents(fixedLayout);
// Always reset even when empty.
view->setFixedLayoutSize(targetLayoutSize);
// Schedule a layout to use the new target size.
if (!view->layoutPending()) {
......@@ -893,6 +894,8 @@ float WebPage::deviceScaleFactor() const
void WebPage::setUseFixedLayout(bool fixed)
{
m_useFixedLayout = fixed;
Frame* frame = m_mainFrame->coreFrame();
if (!frame)
return;
......
......@@ -263,6 +263,7 @@ public:
double pageScaleFactor() const;
void setUseFixedLayout(bool);
bool useFixedLayout() const { return m_useFixedLayout; }
void setFixedLayoutSize(const WebCore::IntSize&);
void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
......@@ -609,6 +610,7 @@ private:
WebCore::IntSize m_viewSize;
OwnPtr<DrawingArea> m_drawingArea;
bool m_useFixedLayout;
bool m_drawsBackground;
bool m_drawsTransparentBackground;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment