- Revision
- 100594
- Author
- kenn...@webkit.org
- Date
- 2011-11-17 03:26:29 -0800 (Thu, 17 Nov 2011)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (100593 => 100594)
--- trunk/Source/WebCore/ChangeLog 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebCore/ChangeLog 2011-11-17 11:26:29 UTC (rev 100594)
@@ -1,3 +1,16 @@
+2011-11-16 Kenneth Rohde Christiansen <kenn...@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 <apav...@chromium.org>
Web Inspector: inspector follows _javascript_: hrefs as relative
Modified: trunk/Source/WebCore/page/Page.cpp (100593 => 100594)
--- trunk/Source/WebCore/page/Page.cpp 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebCore/page/Page.cpp 2011-11-17 11:26:29 UTC (rev 100594)
@@ -404,7 +404,7 @@
void Page::updateViewportArguments()
{
- if (!mainFrame() || !mainFrame()->document() || mainFrame()->document()->viewportArguments() == m_viewportArguments)
+ if (!mainFrame() || !mainFrame()->document())
return;
m_viewportArguments = mainFrame()->document()->viewportArguments();
Modified: trunk/Source/WebKit2/ChangeLog (100593 => 100594)
--- trunk/Source/WebKit2/ChangeLog 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebKit2/ChangeLog 2011-11-17 11:26:29 UTC (rev 100594)
@@ -1,3 +1,29 @@
+2011-11-16 Kenneth Rohde Christiansen <kenn...@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 <zbuj...@gmail.com>
[Qt][WK2] Do not apply new viewport properties until after the first visually non-empty layout.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (100593 => 100594)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2011-11-17 11:26:29 UTC (rev 100594)
@@ -1139,35 +1139,16 @@
void WebFrameLoaderClient::transitionToCommittedForNewPage()
{
WebPage* webPage = m_frame->page();
+
Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
+ bool shouldUseFixedLayout = webPage->mainWebFrame() == m_frame && webPage->useFixedLayout();
- 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));
- }
-
-#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());
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (100593 => 100594)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-11-17 11:26:29 UTC (rev 100594)
@@ -172,6 +172,7 @@
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,19 +709,19 @@
{
FrameView* view = m_page->mainFrame()->view();
+ m_useFixedLayout = !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 (view->fixedLayoutSize() == targetLayoutSize)
return;
- bool fixedLayout = !targetLayoutSize.isEmpty();
+ // Always reset even when empty.
+ view->setFixedLayoutSize(targetLayoutSize);
- if (fixedLayout)
- view->setFixedLayoutSize(targetLayoutSize);
-
- // Set view attributes based on whether fixed layout is used.
- view->setDelegatesScrolling(fixedLayout);
- view->setUseFixedLayout(fixedLayout);
- view->setPaintsEntireContents(fixedLayout);
-
// Schedule a layout to use the new target size.
if (!view->layoutPending()) {
view->setNeedsLayout();
@@ -893,6 +894,8 @@
void WebPage::setUseFixedLayout(bool fixed)
{
+ m_useFixedLayout = fixed;
+
Frame* frame = m_mainFrame->coreFrame();
if (!frame)
return;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (100593 => 100594)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2011-11-17 11:13:48 UTC (rev 100593)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2011-11-17 11:26:29 UTC (rev 100594)
@@ -263,6 +263,7 @@
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 @@
WebCore::IntSize m_viewSize;
OwnPtr<DrawingArea> m_drawingArea;
+ bool m_useFixedLayout;
bool m_drawsBackground;
bool m_drawsTransparentBackground;