Title: [139822] trunk/Source
Revision
139822
Author
[email protected]
Date
2013-01-15 18:51:17 -0800 (Tue, 15 Jan 2013)

Log Message

Clamp TileCache visibleRect to WKView's visibleRect
https://bugs.webkit.org/show_bug.cgi?id=106601
<rdar://problem/12843164>

Reviewed by Simon Fraser.

Some clients expand the WKView to be much larger than what is visible on screen, and
control scrolling with their own view. Currently, we will create tiles for the entire
view, consuming a great deal of memory, and can sometimes factor scrollbars which can
never exist into layout. Piggyback on WKView SPI (the property minimumWidthForAutoLayout,
renamed from minimumLayoutWidth) to drop into a mode where we disable main frame scrolling
and respect the WKView's visibleRect when creating tiles.

* UIProcess/API/mac/WKView.mm:
(-[WKView setFrameSize:]): Update the page's viewExposedRect from our visibleRect.
(-[WKView _updateWindowAndViewFrames]): Update the page's viewExposedRect from our visibleRect.
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): The main frame is scrollable by default.
(-[WKView enableFrameSizeUpdates]): If frame size updates become enabled, update the
page's viewExposedRect from our visibleRect.
(-[WKView setMinimumLayoutWidth:]): Rename minimumLayoutWidth property to minimumWidthForAutoLayout.
Warn once if the old one is used.
(-[WKView minimumWidthForAutoLayout]):
(-[WKView setMinimumWidthForAutoLayout:]): Adjust the minimum layout width, whether the main frame
is scrollable, and update the page's viewExposedRect if needed.
* UIProcess/API/mac/WKViewPrivate.h: Added minimumWidthForAutoLayout property.
* UIProcess/WebPageProxy.h:
(WebPageProxy): Add viewExposedRectChanged/setMainFrameIsScrollable.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::viewExposedRectChanged): Forward viewExposedRectChanged to WebPage.
(WebKit::WebPageProxy::setMainFrameIsScrollable): Forward setMainFrameIsScrollable to WebPage.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Disable scrollbars and scrolling if
main frame scrollability is disabled.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setExposedRect): Added empty default implementation.
(WebKit::DrawingArea::mainFrameScrollabilityChanged): Added empty default implementation.
(DrawingArea):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::windowAndViewFramesChanged): We don't need the WebCore:: namespace.
(WebKit::WebPage::viewExposedRectChanged): Forward exposed rect changes to DrawingArea (only TiledCoreAnimationDrawingArea cares, for now).
(WebKit::WebPage::setMainFrameIsScrollable): Forward scrollability changes to DrawingArea and the main FrameView.
(WebKit::WebPage::drawRectToImage): We don't need the WebCore:: namespace.
* WebProcess/WebPage/WebPage.h:
(WebPage): Add mainFrameIsScrollable, viewExposedRectChanged, setMainFrameIsScrollable, and storage for m_mainFrameIsScrollable.
(WebKit::WebPage::mainFrameIsScrollable):
* WebProcess/WebPage/WebPage.messages.in: Add ViewExposedRectChanged and SetMainFrameIsScrollable messages.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
(TiledCoreAnimationDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::setExposedRect): Forward new exposed rect to TiledBacking (only TileCache cares, for now).
(WebKit::TiledCoreAnimationDrawingArea::mainFrameScrollabilityChanged): Ask TiledBacking to clip to the exposedRect if main frame scrolling is disabled.
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry): Use size instead of viewSize in case we've changed it because of m_minimumLayoutWidth.
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Update exposedRect and clipsToExposedRect.

* platform/graphics/TiledBacking.h:
(TiledBacking): Add setExposedRect and setClipsToExposedRect.
* platform/graphics/ca/mac/TileCache.h:
(TileCache): Add setExposedRect, setClipsToExposedRect, and storage for their respective values.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache): Initialize m_clipsToExposedRect to false.
(WebCore::TileCache::setExposedRect): Update exposedRect and revalidate tiles.
(WebCore::TileCache::setClipsToExposedRect): Update clipsToExposedRect and revalidate tiles;
if we're going from unclipped to clipped, we already have tiles, so we can skip tile revalidation.
(WebCore::TileCache::computeTileCoverageRect): Intersect exisiting visible rect with
exposed rect to get the visible rect we actually care about.
(WebCore::TileCache::revalidateTiles): Ditto.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresOverhangAreasLayer): Don't create an overhang layer if the frame isn't scrollable.
(WebCore::RenderLayerCompositor::requiresContentShadowLayer): Don't create a shadow layer if the frame isn't scrollable.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139821 => 139822)


--- trunk/Source/WebCore/ChangeLog	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebCore/ChangeLog	2013-01-16 02:51:17 UTC (rev 139822)
@@ -1,3 +1,27 @@
+2013-01-15  Tim Horton  <[email protected]>
+
+        Clamp TileCache visibleRect to WKView's visibleRect
+        https://bugs.webkit.org/show_bug.cgi?id=106601
+        <rdar://problem/12843164>
+
+        Reviewed by Simon Fraser.
+
+        * platform/graphics/TiledBacking.h:
+        (TiledBacking): Add setExposedRect and setClipsToExposedRect.
+        * platform/graphics/ca/mac/TileCache.h:
+        (TileCache): Add setExposedRect, setClipsToExposedRect, and storage for their respective values.
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::TileCache): Initialize m_clipsToExposedRect to false.
+        (WebCore::TileCache::setExposedRect): Update exposedRect and revalidate tiles.
+        (WebCore::TileCache::setClipsToExposedRect): Update clipsToExposedRect and revalidate tiles;
+        if we're going from unclipped to clipped, we already have tiles, so we can skip tile revalidation.
+        (WebCore::TileCache::computeTileCoverageRect): Intersect exisiting visible rect with
+        exposed rect to get the visible rect we actually care about.
+        (WebCore::TileCache::revalidateTiles): Ditto.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer): Don't create an overhang layer if the frame isn't scrollable.
+        (WebCore::RenderLayerCompositor::requiresContentShadowLayer): Don't create a shadow layer if the frame isn't scrollable.
+
 2013-01-15  Roger Fong  <[email protected]>
 
         Get rid of a straggling dependency on SafariThemeConstants in RenderThemeWin.

Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (139821 => 139822)


--- trunk/Source/WebCore/platform/graphics/TiledBacking.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -47,6 +47,9 @@
     virtual void setVisibleRect(const IntRect&) = 0;
     virtual IntRect visibleRect() const = 0;
 
+    virtual void setExposedRect(const IntRect&) = 0;
+    virtual void setClipsToExposedRect(bool) = 0;
+
     virtual void prepopulateRect(const IntRect&) = 0;
 
     virtual void setIsInWindow(bool) = 0;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (139821 => 139822)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -106,6 +106,8 @@
 
     // TiledBacking member functions.
     virtual void setVisibleRect(const IntRect&) OVERRIDE;
+    virtual void setExposedRect(const IntRect&) OVERRIDE;
+    virtual void setClipsToExposedRect(bool) OVERRIDE;
     virtual void prepopulateRect(const IntRect&) OVERRIDE;
     virtual void setIsInWindow(bool) OVERRIDE;
     virtual void setTileCoverage(TileCoverage) OVERRIDE;
@@ -168,6 +170,7 @@
     IntSize m_tileSize;
     IntRect m_visibleRect;
     IntRect m_visibleRectAtLastRevalidate;
+    IntRect m_exposedRect; // The exposed area of containing platform views.
 
     typedef HashMap<TileIndex, TileInfo> TileMap;
     TileMap m_tiles;
@@ -197,6 +200,7 @@
     bool m_unparentsOffscreenTiles;
     bool m_acceleratesDrawing;
     bool m_tilesAreOpaque;
+    bool m_clipsToExposedRect;
 
     RetainPtr<CGColorRef> m_tileDebugBorderColor;
     float m_tileDebugBorderWidth;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (139821 => 139822)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2013-01-16 02:51:17 UTC (rev 139822)
@@ -109,6 +109,7 @@
     , m_unparentsOffscreenTiles(false)
     , m_acceleratesDrawing(false)
     , m_tilesAreOpaque(false)
+    , m_clipsToExposedRect(false)
     , m_tileDebugBorderWidth(0)
     , m_indicatorMode(ThreadedScrollingIndication)
 {
@@ -305,6 +306,27 @@
     revalidateTiles();
 }
 
+void TileCache::setExposedRect(const IntRect& exposedRect)
+{
+    if (m_exposedRect == exposedRect)
+        return;
+
+    m_exposedRect = exposedRect;
+    revalidateTiles();
+}
+
+void TileCache::setClipsToExposedRect(bool clipsToExposedRect)
+{
+    if (m_clipsToExposedRect == clipsToExposedRect)
+        return;
+
+    m_clipsToExposedRect = clipsToExposedRect;
+
+    // Going from not clipping to clipping, we don't need to revalidate right away.
+    if (clipsToExposedRect)
+        revalidateTiles();
+}
+
 void TileCache::prepopulateRect(const IntRect& rect)
 {
     ensureTilesForRect(rect);
@@ -393,17 +415,22 @@
 
 IntRect TileCache::computeTileCoverageRect(const IntRect& previousVisibleRect) const
 {
+    IntRect visibleRect = m_visibleRect;
+
+    if (m_clipsToExposedRect)
+        visibleRect.intersect(m_exposedRect);
+
     // If the page is not in a window (for example if it's in a background tab), we limit the tile coverage rect to the visible rect.
     // Furthermore, if the page can't have scrollbars (for example if its body element has overflow:hidden) it's very unlikely that the
     // page will ever be scrolled so we limit the tile coverage rect as well.
     if (!m_isInWindow || m_tileCoverage & CoverageForSlowScrolling)
-        return m_visibleRect;
+        return visibleRect;
 
-    bool largeVisibleRectChange = !previousVisibleRect.isEmpty() && !m_visibleRect.intersects(previousVisibleRect);
+    bool largeVisibleRectChange = !previousVisibleRect.isEmpty() && !visibleRect.intersects(previousVisibleRect);
     
     // FIXME: look at how far the document can scroll in each dimension.
-    int coverageHorizontalSize = m_visibleRect.width();
-    int coverageVerticalSize = m_visibleRect.height();
+    int coverageHorizontalSize = visibleRect.width();
+    int coverageVerticalSize = visibleRect.height();
     
     // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
     // These values were chosen because it's more common to have tall pages and to scroll vertically,
@@ -416,11 +443,11 @@
 
     // Don't extend coverage before 0 or after the end.
     IntRect coverageBounds = bounds();
-    int coverageLeft = m_visibleRect.x() - (coverageHorizontalSize - m_visibleRect.width()) / 2;
+    int coverageLeft = visibleRect.x() - (coverageHorizontalSize - visibleRect.width()) / 2;
     coverageLeft = min(coverageLeft, coverageBounds.maxX() - coverageHorizontalSize);
     coverageLeft = max(coverageLeft, coverageBounds.x());
 
-    int coverageTop = m_visibleRect.y() - (coverageVerticalSize - m_visibleRect.height()) / 2;
+    int coverageTop = visibleRect.y() - (coverageVerticalSize - visibleRect.height()) / 2;
     coverageTop = min(coverageTop, coverageBounds.maxY() - coverageVerticalSize);
     coverageTop = max(coverageTop, coverageBounds.y());
 
@@ -547,7 +574,12 @@
     if (!platformLayer)
         return;
 
-    if (m_visibleRect.isEmpty() || bounds().isEmpty())
+    IntRect visibleRect = m_visibleRect;
+
+    if (m_clipsToExposedRect)
+        visibleRect.intersect(m_exposedRect);
+
+    if (visibleRect.isEmpty() || bounds().isEmpty())
         return;
     
     TileValidationPolicyFlags validationPolicy = m_isInWindow ? foregroundValidationPolicy : backgroundValidationPolicy;
@@ -653,7 +685,7 @@
     if (m_tiledScrollingIndicatorLayer)
         updateTileCoverageMap();
 
-    m_visibleRectAtLastRevalidate = m_visibleRect;
+    m_visibleRectAtLastRevalidate = visibleRect;
 
     if (dirtyRects.isEmpty())
         return;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (139821 => 139822)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-16 02:51:17 UTC (rev 139822)
@@ -2222,8 +2222,8 @@
     if (m_renderView->document()->ownerElement())
         return false;
 
-    // We do want a layer if we have a scrolling coordinator.
-    if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground())
+    // We do want a layer if we have a scrolling coordinator and can scroll.
+    if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground() && !m_renderView->frameView()->prohibitsScrolling())
         return true;
 
     // Chromium always wants a layer.
@@ -2241,8 +2241,8 @@
         return false;
 
 #if PLATFORM(MAC)
-    // On Mac, we want a content shadow layer if we have a scrolling coordinator.
-    if (scrollingCoordinator())
+    // On Mac, we want a content shadow layer if we have a scrolling coordinator and can scroll.
+    if (scrollingCoordinator() && !m_renderView->frameView()->prohibitsScrolling())
         return true;
 #endif
 

Modified: trunk/Source/WebKit2/ChangeLog (139821 => 139822)


--- trunk/Source/WebKit2/ChangeLog	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-16 02:51:17 UTC (rev 139822)
@@ -1,3 +1,59 @@
+2013-01-15  Tim Horton  <[email protected]>
+
+        Clamp TileCache visibleRect to WKView's visibleRect
+        https://bugs.webkit.org/show_bug.cgi?id=106601
+        <rdar://problem/12843164>
+
+        Reviewed by Simon Fraser.
+
+        Some clients expand the WKView to be much larger than what is visible on screen, and
+        control scrolling with their own view. Currently, we will create tiles for the entire
+        view, consuming a great deal of memory, and can sometimes factor scrollbars which can
+        never exist into layout. Piggyback on WKView SPI (the property minimumWidthForAutoLayout,
+        renamed from minimumLayoutWidth) to drop into a mode where we disable main frame scrolling
+        and respect the WKView's visibleRect when creating tiles.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView setFrameSize:]): Update the page's viewExposedRect from our visibleRect.
+        (-[WKView _updateWindowAndViewFrames]): Update the page's viewExposedRect from our visibleRect.
+        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): The main frame is scrollable by default.
+        (-[WKView enableFrameSizeUpdates]): If frame size updates become enabled, update the
+        page's viewExposedRect from our visibleRect.
+        (-[WKView setMinimumLayoutWidth:]): Rename minimumLayoutWidth property to minimumWidthForAutoLayout.
+        Warn once if the old one is used.
+        (-[WKView minimumWidthForAutoLayout]):
+        (-[WKView setMinimumWidthForAutoLayout:]): Adjust the minimum layout width, whether the main frame
+        is scrollable, and update the page's viewExposedRect if needed.
+        * UIProcess/API/mac/WKViewPrivate.h: Added minimumWidthForAutoLayout property.
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy): Add viewExposedRectChanged/setMainFrameIsScrollable.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::viewExposedRectChanged): Forward viewExposedRectChanged to WebPage.
+        (WebKit::WebPageProxy::setMainFrameIsScrollable): Forward setMainFrameIsScrollable to WebPage.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Disable scrollbars and scrolling if
+        main frame scrollability is disabled.
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::setExposedRect): Added empty default implementation.
+        (WebKit::DrawingArea::mainFrameScrollabilityChanged): Added empty default implementation.
+        (DrawingArea):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::windowAndViewFramesChanged): We don't need the WebCore:: namespace.
+        (WebKit::WebPage::viewExposedRectChanged): Forward exposed rect changes to DrawingArea (only TiledCoreAnimationDrawingArea cares, for now).
+        (WebKit::WebPage::setMainFrameIsScrollable): Forward scrollability changes to DrawingArea and the main FrameView.
+        (WebKit::WebPage::drawRectToImage): We don't need the WebCore:: namespace.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): Add mainFrameIsScrollable, viewExposedRectChanged, setMainFrameIsScrollable, and storage for m_mainFrameIsScrollable.
+        (WebKit::WebPage::mainFrameIsScrollable):
+        * WebProcess/WebPage/WebPage.messages.in: Add ViewExposedRectChanged and SetMainFrameIsScrollable messages.
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        (TiledCoreAnimationDrawingArea):
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::setExposedRect): Forward new exposed rect to TiledBacking (only TileCache cares, for now).
+        (WebKit::TiledCoreAnimationDrawingArea::mainFrameScrollabilityChanged): Ask TiledBacking to clip to the exposedRect if main frame scrolling is disabled.
+        (WebKit::TiledCoreAnimationDrawingArea::updateGeometry): Use size instead of viewSize in case we've changed it because of m_minimumLayoutWidth.
+        (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Update exposedRect and clipsToExposedRect.
+
 2013-01-15  Enrica Casucci  <[email protected]>
 
         Add a new set of WebKit2 APIs for text search and

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (139821 => 139822)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-01-16 02:51:17 UTC (rev 139822)
@@ -210,6 +210,7 @@
     String _promisedURL;
 
     NSSize _intrinsicContentSize;
+    BOOL _expandsToFitContentViaAutoLayout;
 }
 
 @end
@@ -362,9 +363,12 @@
         _data->_windowHasValidBackingStore = NO;
 
     [super setFrameSize:size];
-    
-    if (![self frameSizeUpdatesDisabled])
+
+    if (![self frameSizeUpdatesDisabled]) {
+        if (_data->_expandsToFitContentViaAutoLayout)
+            _data->_page->viewExposedRectChanged(enclosingIntRect([self visibleRect]));
         [self _setDrawingAreaSize:size];
+    }
 }
 
 - (void)_updateWindowAndViewFrames
@@ -377,6 +381,8 @@
     NSPoint accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
     
     _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates), IntPoint(accessibilityPosition));
+    if (_data->_expandsToFitContentViaAutoLayout)
+        _data->_page->viewExposedRectChanged(enclosingIntRect([self visibleRect]));
 }
 
 - (void)renewGState
@@ -2944,6 +2950,7 @@
 #endif
     _data->_mouseDownEvent = nil;
     _data->_ignoringMouseDraggedEvents = NO;
+    _data->_expandsToFitContentViaAutoLayout = NO;
 
     _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
 
@@ -3030,8 +3037,11 @@
     if (!_data->_frameSizeUpdatesDisabledCount)
         return;
     
-    if (!(--_data->_frameSizeUpdatesDisabledCount))
+    if (!(--_data->_frameSizeUpdatesDisabledCount)) {
+        if (_data->_expandsToFitContentViaAutoLayout)
+            _data->_page->viewExposedRectChanged(enclosingIntRect([self visibleRect]));
         [self _setDrawingAreaSize:[self frame].size];
+    }
 }
 
 - (BOOL)frameSizeUpdatesDisabled
@@ -3055,12 +3065,44 @@
 
 - (CGFloat)minimumLayoutWidth
 {
+    static BOOL loggedDeprecationWarning = NO;
+
+    if (!loggedDeprecationWarning) {
+        NSLog(@"Please use minimumWidthForAutoLayout instead of minimumLayoutWidth.");
+        loggedDeprecationWarning = YES;
+    }
+
     return _data->_page->minimumLayoutWidth();
 }
 
 - (void)setMinimumLayoutWidth:(CGFloat)minimumLayoutWidth
 {
+    static BOOL loggedDeprecationWarning = NO;
+
+    if (!loggedDeprecationWarning) {
+        NSLog(@"Please use minimumWidthForAutoLayout instead of minimumLayoutWidth.");
+        loggedDeprecationWarning = YES;
+    }
+
+    [self setMinimumWidthForAutoLayout:minimumLayoutWidth];
+}
+
+- (CGFloat)minimumWidthForAutoLayout
+{
+    return _data->_page->minimumLayoutWidth();
+}
+
+- (void)setMinimumWidthForAutoLayout:(CGFloat)minimumLayoutWidth
+{
+    BOOL expandsToFit = minimumLayoutWidth > 0;
+
+    _data->_expandsToFitContentViaAutoLayout = expandsToFit;
     _data->_page->setMinimumLayoutWidth(minimumLayoutWidth);
+
+    if (expandsToFit)
+        _data->_page->viewExposedRectChanged(enclosingIntRect([self visibleRect]));
+
+    _data->_page->setMainFrameIsScrollable(!expandsToFit);
 }
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h (139821 => 139822)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -51,5 +51,6 @@
 + (void)hideWordDefinitionWindow;
 
 @property (readwrite) CGFloat minimumLayoutWidth;
+@property (readwrite) CGFloat minimumWidthForAutoLayout;
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (139821 => 139822)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -389,6 +389,8 @@
 #if PLATFORM(MAC)
     void updateWindowIsVisible(bool windowIsVisible);
     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
+    void viewExposedRectChanged(const WebCore::IntRect& exposedRect);
+    void setMainFrameIsScrollable(bool);
 
     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
     void confirmComposition();

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (139821 => 139822)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-01-16 02:51:17 UTC (rev 139822)
@@ -137,6 +137,22 @@
     process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
 }
 
+void WebPageProxy::viewExposedRectChanged(const IntRect& exposedRect)
+{
+    if (!isValid())
+        return;
+
+    process()->send(Messages::WebPage::ViewExposedRectChanged(exposedRect), m_pageID);
+}
+
+void WebPageProxy::setMainFrameIsScrollable(bool isScrollable)
+{
+    if (!isValid())
+        return;
+
+    process()->send(Messages::WebPage::SetMainFrameIsScrollable(isScrollable), m_pageID);
+}
+
 void WebPageProxy::setComposition(const String& text, Vector<CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
 {
     if (!isValid()) {

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-01-16 02:51:17 UTC (rev 139822)
@@ -1228,26 +1228,29 @@
     bool isMainFrame = webPage->mainWebFrame() == m_frame;
     bool isTransparent = !webPage->drawsBackground();
     bool shouldUseFixedLayout = isMainFrame && webPage->useFixedLayout();
+    bool shouldDisableScrolling = isMainFrame && !webPage->mainFrameIsScrollable();
+    bool shouldHideScrollbars = shouldUseFixedLayout || shouldDisableScrolling;
     IntRect currentFixedVisibleContentRect = m_frame->coreFrame()->view() ? m_frame->coreFrame()->view()->fixedVisibleContentRect() : IntRect();
 
     const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
     m_frameHasCustomRepresentation = isMainFrame && webPage->shouldUseCustomRepresentationForResponse(response);
     m_frameCameFromPageCache = false;
 
+    ScrollbarMode defaultScrollbarMode = shouldHideScrollbars ? ScrollbarAlwaysOff : ScrollbarAuto;
+
+    m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
+        IntSize(), currentFixedVisibleContentRect, shouldUseFixedLayout,
+        defaultScrollbarMode, /* lock */ shouldHideScrollbars, defaultScrollbarMode, /* lock */ shouldHideScrollbars);
+
+    m_frame->coreFrame()->view()->setProhibitsScrolling(shouldDisableScrolling);
+
 #if USE(TILED_BACKING_STORE)
     if (shouldUseFixedLayout) {
-        m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
-            IntSize(), currentFixedVisibleContentRect, shouldUseFixedLayout,
-            ScrollbarAlwaysOff, /* lock */ true, ScrollbarAlwaysOff, /* lock */ true);
-
         m_frame->coreFrame()->view()->setDelegatesScrolling(shouldUseFixedLayout);
         m_frame->coreFrame()->view()->setPaintsEntireContents(shouldUseFixedLayout);
         return;
     }
 #endif
-
-    m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
-        IntSize(), currentFixedVisibleContentRect, shouldUseFixedLayout);
 }
 
 void WebFrameLoaderClient::didSaveToPageCache()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -84,6 +84,9 @@
     virtual void updatePreferences(const WebPreferencesStore&) { }
     virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { }
 
+    virtual void setExposedRect(const WebCore::IntRect&) { }
+    virtual void mainFrameScrollabilityChanged(bool) { }
+
 #if USE(ACCELERATED_COMPOSITING)
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-16 02:51:17 UTC (rev 139822)
@@ -239,6 +239,7 @@
     , m_asynchronousPluginInitializationEnabledForAllPlugins(false)
     , m_artificialPluginInitializationDelayEnabled(false)
     , m_scrollingPerformanceLoggingEnabled(false)
+    , m_mainFrameIsScrollable(true)
 #if PLATFORM(MAC)
     , m_pdfPluginEnabled(false)
     , m_windowIsVisible(false)
@@ -2914,7 +2915,7 @@
         (*it)->setWindowIsVisible(windowIsVisible);
 }
 
-void WebPage::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates)
+void WebPage::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
 {
     m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates;
     m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates;
@@ -2926,6 +2927,22 @@
 }
 #endif
 
+void WebPage::viewExposedRectChanged(const IntRect& exposedRect)
+{
+    m_drawingArea->setExposedRect(exposedRect);
+}
+
+void WebPage::setMainFrameIsScrollable(bool isScrollable)
+{
+    m_mainFrameIsScrollable = isScrollable;
+    m_drawingArea->mainFrameScrollabilityChanged(isScrollable);
+
+    if (FrameView* frameView = m_mainFrame->coreFrame()->view()) {
+        frameView->setCanHaveScrollbars(isScrollable);
+        frameView->setProhibitsScrolling(!isScrollable);
+    }
+}
+
 bool WebPage::windowIsFocused() const
 {
     return m_page->focusController()->isActive();
@@ -3298,7 +3315,7 @@
 }
 
 #if PLATFORM(MAC)
-void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, const WebCore::IntRect& rect, const WebCore::IntSize& imageSize, uint64_t callbackID)
+void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, const IntRect& rect, const WebCore::IntSize& imageSize, uint64_t callbackID)
 {
     WebFrame* frame = WebProcess::shared().webFrame(frameID);
     Frame* coreFrame = frame ? frame->coreFrame() : 0;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -604,6 +604,8 @@
     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
 #endif
 
+    bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -724,6 +726,9 @@
     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
 #endif
 
+    void viewExposedRectChanged(const WebCore::IntRect& exposedRect);
+    void setMainFrameIsScrollable(bool);
+
     void unapplyEditCommand(uint64_t commandID);
     void reapplyEditCommand(uint64_t commandID);
     void didRemoveEditCommand(uint64_t commandID);
@@ -814,6 +819,8 @@
 
     bool m_scrollingPerformanceLoggingEnabled;
 
+    bool m_mainFrameIsScrollable;
+
 #if PLATFORM(MAC)
     bool m_pdfPluginEnabled;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-01-16 02:51:17 UTC (rev 139822)
@@ -262,6 +262,8 @@
 
     SetWindowIsVisible(bool windowIsVisible)
     WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates, WebCore::IntPoint accessibilityViewCoordinates)
+    ViewExposedRectChanged(WebCore::IntRect exposedRect)
+    SetMainFrameIsScrollable(bool isScrollable)
     RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken)
     GetStringSelectionForPasteboard() -> (WTF::String stringValue)
     GetDataSelectionForPasteboard(WTF::String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-01-16 02:51:17 UTC (rev 139822)
@@ -71,6 +71,9 @@
     virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE;
     virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) OVERRIDE;
 
+    virtual void setExposedRect(const WebCore::IntRect&) OVERRIDE;
+    virtual void mainFrameScrollabilityChanged(bool) OVERRIDE;
+
     virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&) OVERRIDE;
 
     // WebCore::GraphicsLayerClient
@@ -113,6 +116,8 @@
 
     bool m_isPaintingSuspended;
 
+    WebCore::IntRect m_exposedRect;
+
     double m_minimumLayoutWidth;
     WebCore::IntSize m_lastSentIntrinsicContentSize;
     bool m_inUpdateGeometry;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (139821 => 139822)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-01-16 02:39:17 UTC (rev 139821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-01-16 02:51:17 UTC (rev 139822)
@@ -341,6 +341,19 @@
         m_webPage->corePage()->resumeScriptedAnimations();
 }
 
+void TiledCoreAnimationDrawingArea::setExposedRect(const IntRect& exposedRect)
+{
+    // FIXME: This should be mapped through the scroll offset, but we need to keep it up to date.
+    m_exposedRect = exposedRect;
+
+    mainFrameTiledBacking()->setExposedRect(exposedRect);
+}
+
+void TiledCoreAnimationDrawingArea::mainFrameScrollabilityChanged(bool isScrollable)
+{
+    mainFrameTiledBacking()->setClipsToExposedRect(!isScrollable);
+}
+
 void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, double minimumLayoutWidth)
 {
     m_inUpdateGeometry = true;
@@ -362,7 +375,7 @@
     m_webPage->layoutIfNeeded();
 
     if (m_pageOverlayLayer)
-        m_pageOverlayLayer->setSize(viewSize);
+        m_pageOverlayLayer->setSize(size);
 
     if (!m_layerTreeStateIsFrozen)
         flushLayers();
@@ -370,7 +383,7 @@
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    m_rootLayer.get().frame = CGRectMake(0, 0, viewSize.width(), viewSize.height());
+    m_rootLayer.get().frame = CGRectMake(0, 0, size.width(), size.height());
 
     [CATransaction commit];
     
@@ -450,8 +463,11 @@
     if (m_pageOverlayLayer)
         [m_rootLayer.get() addSublayer:m_pageOverlayLayer->platformLayer()];
 
-    if (TiledBacking* tiledBacking = mainFrameTiledBacking())
+    if (TiledBacking* tiledBacking = mainFrameTiledBacking()) {
         tiledBacking->setAggressivelyRetainsTiles(m_webPage->corePage()->settings()->aggressiveTileRetentionEnabled());
+        tiledBacking->setExposedRect(m_exposedRect);
+        tiledBacking->setClipsToExposedRect(!m_webPage->mainFrameIsScrollable());
+    }
 
     updateDebugInfoLayer(m_webPage->corePage()->settings()->showTiledScrollingIndicator());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to