[WK2] Minimum layout width auto-sizing should use...

[WK2] Minimum layout width auto-sizing should use FrameView::enableAutoSizeMode so that it can shrink the viewport
https://bugs.webkit.org/show_bug.cgi?id=107200
<rdar://problem/12849029>

Reviewed by Simon Fraser.

Make use of FrameView's auto-size mode to allow WKView's computed intrinsic content
size to shrink below the current viewport size.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setMinimumLayoutWidth): Forward minimumLayoutWidth changes to WebPage.
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): Remove minimumLayoutWidth argument on updateGeometry.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Enable auto-size mode on the new FrameView if needed.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::updateGeometry): Remove minimumLayoutWidth argument.
* WebProcess/WebPage/DrawingArea.messages.in: Remove minimumLayoutWidth argument on updateGeometry.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize m_minimumLayoutWidth to 0.
(WebKit::WebPage::setMinimumLayoutWidth): Keep track of minimumLayoutWidth on WebPage. Update auto-sizing state if needed.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::minimumLayoutWidth):
* WebProcess/WebPage/WebPage.messages.in: Add SetMinimumLayoutWidth.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
(TiledCoreAnimationDrawingArea): Remove storage for m_minimumLayoutWidth. We can get it from WebPage instead.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Grab minimumLayoutWidth from WebPage.
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry): Don't setSize() if auto-sizing is enabled; FrameView will do the right thing.

* WebCore.exp.in: Export FrameView::enableAutoSize(...).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 953b3bf2
2013-01-17 Tim Horton <timothy_horton@apple.com>
[WK2] Minimum layout width auto-sizing should use FrameView::enableAutoSizeMode so that it can shrink the viewport
https://bugs.webkit.org/show_bug.cgi?id=107200
<rdar://problem/12849029>
Reviewed by Simon Fraser.
* WebCore.exp.in: Export FrameView::enableAutoSize(...).
2013-01-17 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r139402.
......@@ -1022,6 +1022,7 @@ __ZN7WebCore9FrameView17addScrollableAreaEPNS_14ScrollableAreaE
__ZN7WebCore9FrameView17paintControlTintsEv
__ZN7WebCore9FrameView17setScrollPositionERKNS_8IntPointE
__ZN7WebCore9FrameView18updateControlTintsEv
__ZN7WebCore9FrameView18enableAutoSizeModeEbRKNS_7IntSizeES3_
__ZN7WebCore9FrameView19scrollElementToRectEPNS_7ElementERKNS_7IntRectE
__ZN7WebCore9FrameView20enterCompositingModeEv
__ZN7WebCore9FrameView20removeScrollableAreaEPNS_14ScrollableAreaE
......
2013-01-17 Tim Horton <timothy_horton@apple.com>
[WK2] Minimum layout width auto-sizing should use FrameView::enableAutoSizeMode so that it can shrink the viewport
https://bugs.webkit.org/show_bug.cgi?id=107200
<rdar://problem/12849029>
Reviewed by Simon Fraser.
Make use of FrameView's auto-size mode to allow WKView's computed intrinsic content
size to shrink below the current viewport size.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setMinimumLayoutWidth): Forward minimumLayoutWidth changes to WebPage.
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): Remove minimumLayoutWidth argument on updateGeometry.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Enable auto-size mode on the new FrameView if needed.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::updateGeometry): Remove minimumLayoutWidth argument.
* WebProcess/WebPage/DrawingArea.messages.in: Remove minimumLayoutWidth argument on updateGeometry.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize m_minimumLayoutWidth to 0.
(WebKit::WebPage::setMinimumLayoutWidth): Keep track of minimumLayoutWidth on WebPage. Update auto-sizing state if needed.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::minimumLayoutWidth):
* WebProcess/WebPage/WebPage.messages.in: Add SetMinimumLayoutWidth.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
(TiledCoreAnimationDrawingArea): Remove storage for m_minimumLayoutWidth. We can get it from WebPage instead.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Grab minimumLayoutWidth from WebPage.
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry): Don't setSize() if auto-sizing is enabled; FrameView will do the right thing.
2013-01-17 Jon Lee <jonlee@apple.com>
Do not track user interaction for plugins that are not snapshotted
......@@ -4213,6 +4213,7 @@ void WebPageProxy::setMinimumLayoutWidth(double minimumLayoutWidth)
return;
m_minimumLayoutWidth = minimumLayoutWidth;
m_process->send(Messages::WebPage::SetMinimumLayoutWidth(minimumLayoutWidth), m_pageID, 0);
m_drawingArea->minimumLayoutWidthDidChange();
#if PLATFORM(MAC)
......
......@@ -162,7 +162,7 @@ void TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry()
m_lastSentMinimumLayoutWidth = m_webPageProxy->minimumLayoutWidth();
m_lastSentSize = m_size;
m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size, m_lastSentMinimumLayoutWidth), m_webPageProxy->pageID());
m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size), m_webPageProxy->pageID());
m_isWaitingForDidUpdateGeometry = true;
}
......
......@@ -1242,6 +1242,10 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
IntSize(), currentFixedVisibleContentRect, shouldUseFixedLayout,
defaultScrollbarMode, /* lock */ shouldHideScrollbars, defaultScrollbarMode, /* lock */ shouldHideScrollbars);
int minimumLayoutWidth = webPage->minimumLayoutWidth();
if (minimumLayoutWidth)
m_frame->coreFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(minimumLayoutWidth, INT_MAX));
m_frame->coreFrame()->view()->setProhibitsScrolling(shouldDisableScrolling);
#if USE(TILED_BACKING_STORE)
......
......@@ -117,7 +117,7 @@ private:
#if PLATFORM(MAC)
// Used by TiledCoreAnimationDrawingArea.
virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) { }
virtual void updateGeometry(const WebCore::IntSize& viewSize) { }
virtual void setDeviceScaleFactor(float) { }
virtual void setColorSpace(const ColorSpaceData&) { }
#endif
......
......@@ -30,7 +30,7 @@ messages -> DrawingArea {
#if PLATFORM(MAC)
// Used by TiledCoreAnimationDrawingArea.
UpdateGeometry(WebCore::IntSize viewSize, double minimumLayoutWidth)
UpdateGeometry(WebCore::IntSize viewSize)
SetDeviceScaleFactor(float deviceScaleFactor)
SetColorSpace(WebKit::ColorSpaceData colorSpace)
#endif
......
......@@ -273,6 +273,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_canShortCircuitHorizontalWheelEvents(false)
, m_numWheelEventHandlers(0)
, m_cachedPageCount(0)
, m_minimumLayoutWidth(0)
#if ENABLE(CONTEXT_MENUS)
, m_isShowingContextMenu(false)
#endif
......@@ -3780,4 +3781,17 @@ void WebPage::setMainFrameInViewSourceMode(bool inViewSourceMode)
m_mainFrame->coreFrame()->setInViewSourceMode(inViewSourceMode);
}
void WebPage::setMinimumLayoutWidth(double minimumLayoutWidth)
{
if (m_minimumLayoutWidth == minimumLayoutWidth)
return;
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());
}
} // namespace WebKit
......@@ -606,6 +606,9 @@ public:
bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
void setMinimumLayoutWidth(double);
double minimumLayoutWidth() const { return m_minimumLayoutWidth; }
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
......@@ -933,6 +936,8 @@ private:
unsigned m_cachedPageCount;
double m_minimumLayoutWidth;
#if ENABLE(CONTEXT_MENUS)
bool m_isShowingContextMenu;
#endif
......
......@@ -284,6 +284,9 @@ messages -> WebPage {
AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result)
InsertDictatedText(WTF::String text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, WTF::Vector<WebCore::DictationAlternative> dictationAlternatives) -> (bool handled, WebKit::EditorState newState)
#endif
SetMinimumLayoutWidth(double minimumLayoutWidth)
#if PLATFORM(EFL)
ConfirmComposition(WTF::String compositionString)
SetComposition(WTF::String compositionString, WTF::Vector<WebCore::CompositionUnderline> underlines, uint64_t cursorPosition)
......
......@@ -88,7 +88,7 @@ private:
// Message handlers.
virtual void suspendPainting() OVERRIDE;
virtual void resumePainting() OVERRIDE;
virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) OVERRIDE;
virtual void updateGeometry(const WebCore::IntSize& viewSize) OVERRIDE;
virtual void setDeviceScaleFactor(float) OVERRIDE;
virtual void setLayerHostingMode(uint32_t) OVERRIDE;
virtual void setColorSpace(const ColorSpaceData&) OVERRIDE;
......@@ -118,7 +118,6 @@ private:
WebCore::IntRect m_exposedRect;
double m_minimumLayoutWidth;
WebCore::IntSize m_lastSentIntrinsicContentSize;
bool m_inUpdateGeometry;
};
......
......@@ -70,7 +70,6 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c
, m_layerTreeStateIsFrozen(false)
, m_layerFlushScheduler(this)
, m_isPaintingSuspended(!parameters.isVisible)
, m_minimumLayoutWidth(0)
{
Page* page = m_webPage->corePage();
......@@ -220,7 +219,7 @@ void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore&
void TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged(const IntSize& contentSize)
{
if (!m_minimumLayoutWidth)
if (!m_webPage->minimumLayoutWidth())
return;
if (m_inUpdateGeometry)
......@@ -347,26 +346,23 @@ void TiledCoreAnimationDrawingArea::mainFrameScrollabilityChanged(bool isScrolla
mainFrameTiledBacking()->setClipsToExposedRect(!isScrollable);
}
void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, double minimumLayoutWidth)
void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize)
{
m_inUpdateGeometry = true;
m_minimumLayoutWidth = minimumLayoutWidth;
IntSize size = viewSize;
IntSize contentSize = IntSize(-1, -1);
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();
if (m_pageOverlayLayer)
m_pageOverlayLayer->setSize(size);
......
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