Changeset 156472 in webkit


Ignore:
Timestamp:
Sep 26, 2013 10:34:33 AM (11 years ago)
Author:
timothy_horton@apple.com
Message:

Tiled drawing should not imply threaded scrolling
https://bugs.webkit.org/show_bug.cgi?id=121874
<rdar://problem/15071494>

Reviewed by Sam Weinig.

  • Shared/DrawingAreaInfo.h:

We can have DrawingAreaTypeTiledCoreAnimation without threaded scrolling.

  • Shared/WebPreferencesStore.h:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetThreadedScrollingEnabled):
(WKPreferencesGetThreadedScrollingEnabled):

  • UIProcess/API/C/WKPreferencesPrivate.h:

Add a preference for threaded scrolling.

  • UIProcess/API/mac/WKView.mm:

(-[WKView WebKit::]):

  • UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
  • UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
  • WebProcess/WebPage/DrawingArea.cpp:

(WebKit::DrawingArea::create):

  • WebProcess/WebPage/DrawingArea.h:

Make it so we can use TiledCoreAnimationDrawingArea without ENABLE(THREADED_SCROLLING).

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::shouldUseTiledBackingForFrame):

  • WebProcess/WebCoreSupport/WebChromeClient.h:

Override shouldUseTiledBackingForFrame; ask the drawing area if we want a tiled backing for the given frame.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::~WebPage):

  • WebProcess/WebPage/WebPage.h:

Move attaching and detaching the scrolling tree into WebPage.
Store whether or not this page is going to use threaded scrolling once, as this
cannot change through the life of a page.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea):
Move attaching and detaching the scrolling tree into WebPage.

(WebKit::TiledCoreAnimationDrawingArea::didInstallPageOverlay):
(WebKit::TiledCoreAnimationDrawingArea::didUninstallPageOverlay):
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
Only do scrolling coordinator work if we have a scrolling coordinator.

(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrame):
TiledCoreAnimationDrawingArea always wants a tiled backing for the main frame.

No new tests; a near-future patch is going to put the majority of layout
tests into the tiled-drawing-without-threaded-scrolling mode.

  • page/ChromeClient.h:

(WebCore::ChromeClient::shouldUseTiledBackingForFrame):
Add a ChromeClient callback to determine whether a given frame wants a TiledBacking for its contents.

  • page/FrameView.h:
  • WebCore.exp.in:

Make isMainFrameView public and export it for use in WebKit2.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::RenderLayerBacking):
Make use of shouldUseTiledBackingForFrame instead of predicating the
main frame using a tile cache on whether we have a scrolling coordinator.

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::mainFrameBackingIsTiled): Added.

(WebCore::RenderLayerCompositor::shouldCompositeOverflowControls):
(WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
(WebCore::RenderLayerCompositor::requiresContentShadowLayer):
All of these checks for existence of a scrollingCoordinator should actually
key off whether we're using tiled drawing at the root; they have nothing
to do with threaded scrolling.

  • rendering/RenderLayerCompositor.h:
  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::PlatformWebView):
The existing tiled-drawing layout tests require threaded scrolling to be enabled.

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156471 r156472  
     12013-09-26  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tiled drawing should not imply threaded scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=121874
     5        <rdar://problem/15071494>
     6
     7        Reviewed by Sam Weinig.
     8
     9        No new tests; a near-future patch is going to put the majority of layout
     10        tests into the tiled-drawing-without-threaded-scrolling mode.
     11
     12        * page/ChromeClient.h:
     13        (WebCore::ChromeClient::shouldUseTiledBackingForFrame):
     14        Add a ChromeClient callback to determine whether a given frame wants a TiledBacking for its contents.
     15
     16        * page/FrameView.h:
     17        * WebCore.exp.in:
     18        Make isMainFrameView public and export it for use in WebKit2.
     19
     20        * rendering/RenderLayerBacking.cpp:
     21        (WebCore::RenderLayerBacking::RenderLayerBacking):
     22        Make use of shouldUseTiledBackingForFrame instead of predicating the
     23        main frame using a tile cache on whether we have a scrolling coordinator.
     24
     25        * rendering/RenderLayerCompositor.cpp:
     26        (WebCore::RenderLayerCompositor::mainFrameBackingIsTiled): Added.
     27
     28        (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls):
     29        (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
     30        (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
     31        All of these checks for existence of a scrollingCoordinator should actually
     32        key off whether we're using tiled drawing at the root; they have nothing
     33        to do with threaded scrolling.
     34
     35        * rendering/RenderLayerCompositor.h:
     36
    1372013-09-26  Brady Eidson  <beidson@apple.com>
    238
  • trunk/Source/WebCore/WebCore.exp.in

    r156435 r156472  
    16941694__ZNK7WebCore9FrameView13paintBehaviorEv
    16951695__ZNK7WebCore9FrameView14didFirstLayoutEv
     1696__ZNK7WebCore9FrameView15isMainFrameViewEv
    16961697__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_7IntRectE
    16971698__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_8IntPointE
  • trunk/Source/WebCore/page/ChromeClient.h

    r156158 r156472  
    366366    virtual void didAddFooterLayer(GraphicsLayer*) { }
    367367
     368    virtual bool shouldUseTiledBackingForFrameView(const FrameView*) const { return false; }
     369
    368370    // These methods are used to report pages that are performing
    369371    // some task that we consider to be "active", and so the user
  • trunk/Source/WebCore/page/FrameView.h

    r156201 r156472  
    443443    void willRemoveWidgetFromRenderTree(Widget&);
    444444
     445    bool isMainFrameView() const;
     446
    445447protected:
    446448    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) OVERRIDE;
     
    459461
    460462    virtual bool isFrameView() const OVERRIDE { return true; }
    461 
    462     bool isMainFrameView() const;
    463463
    464464    friend class RenderWidget;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r156451 r156472  
    121121    , m_didSwitchToFullTileCoverageDuringLoading(false)
    122122{
    123     if (layer->isRootLayer()) {
    124         Page* page = renderer().frame().page();
    125         if (page && page->frameIsMainFrame(&renderer().frame())) {
     123    Page* page = renderer().frame().page();
     124
     125    if (layer->isRootLayer() && page) {
     126        if (page->frameIsMainFrame(&renderer().frame()))
    126127            m_isMainFrameRenderViewLayer = true;
    127128
    128 #if PLATFORM(MAC)
    129             // FIXME: It's a little weird that we base this decision on whether there's a scrolling coordinator or not.
    130             if (page->scrollingCoordinator())
    131                 m_usingTiledCacheLayer = true;
    132 #endif
    133         }
     129        m_usingTiledCacheLayer = page->chrome().client().shouldUseTiledBackingForFrameView(renderer().frame().view());
    134130    }
    135131   
    136132    createPrimaryGraphicsLayer();
    137133
    138     if (m_usingTiledCacheLayer) {
     134    if (m_usingTiledCacheLayer && page) {
    139135        TiledBacking* tiledBacking = this->tiledBacking();
    140         if (Page* page = renderer().frame().page()) {
    141             tiledBacking->setIsInWindow(page->isInWindow());
    142 
    143             if (m_isMainFrameRenderViewLayer)
    144                 tiledBacking->setUnparentsOffscreenTiles(true);
    145 
    146             tiledBacking->setScrollingPerformanceLoggingEnabled(page->settings().scrollingPerformanceLoggingEnabled());
    147             adjustTiledBackingCoverage();
    148         }
     136
     137        tiledBacking->setIsInWindow(page->isInWindow());
     138
     139        if (m_isMainFrameRenderViewLayer)
     140            tiledBacking->setUnparentsOffscreenTiles(true);
     141
     142        tiledBacking->setScrollingPerformanceLoggingEnabled(page->settings().scrollingPerformanceLoggingEnabled());
     143        adjustTiledBackingCoverage();
    149144    }
    150145}
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r156451 r156472  
    25252525}
    25262526
     2527bool RenderLayerCompositor::mainFrameBackingIsTiled() const
     2528{
     2529    RenderLayer* layer = m_renderView.layer();
     2530    if (!layer)
     2531        return false;
     2532
     2533    RenderLayerBacking* backing = layer->backing();
     2534    if (!backing)
     2535        return false;
     2536
     2537    return backing->usingTiledBacking();
     2538}
     2539
    25272540bool RenderLayerCompositor::shouldCompositeOverflowControls() const
    25282541{
     
    25322545        return false;
    25332546
    2534     if (hasCoordinatedScrolling())
     2547    if (mainFrameBackingIsTiled())
    25352548        return true;
    25362549
     
    25632576        return false;
    25642577
    2565     // We do want a layer if we have a scrolling coordinator and can scroll.
    2566     if (scrollingCoordinator() && m_renderView.frameView().hasOpaqueBackground() && !m_renderView.frameView().prohibitsScrolling())
     2578    // We do want a layer if we're using tiled drawing and can scroll.
     2579    if (mainFrameBackingIsTiled() && m_renderView.frameView().hasOpaqueBackground() && !m_renderView.frameView().prohibitsScrolling())
    25672580        return true;
    25682581
     
    25802593        return false;
    25812594
    2582     // On Mac, we want a content shadow layer if we have a scrolling coordinator and can scroll.
    2583     if (scrollingCoordinator() && !m_renderView.frameView().prohibitsScrolling())
     2595    // On Mac, we want a content shadow layer if we're using tiled drawing and can scroll.
     2596    if (mainFrameBackingIsTiled() && !m_renderView.frameView().prohibitsScrolling())
    25842597        return true;
    25852598#endif
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r156451 r156472  
    413413#endif
    414414
     415    bool mainFrameBackingIsTiled() const;
     416
    415417private:
    416418    RenderView& m_renderView;
     
    438440
    439441    bool m_isTrackingRepaints; // Used for testing.
    440    
     442
    441443    unsigned m_layersWithTiledBackingCount;
    442444
  • trunk/Source/WebKit2/ChangeLog

    r156449 r156472  
     12013-09-26  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tiled drawing should not imply threaded scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=121874
     5        <rdar://problem/15071494>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * Shared/DrawingAreaInfo.h:
     10        We can have DrawingAreaTypeTiledCoreAnimation without threaded scrolling.
     11
     12        * Shared/WebPreferencesStore.h:
     13        * UIProcess/API/C/WKPreferences.cpp:
     14        (WKPreferencesSetThreadedScrollingEnabled):
     15        (WKPreferencesGetThreadedScrollingEnabled):
     16        * UIProcess/API/C/WKPreferencesPrivate.h:
     17        Add a preference for threaded scrolling.
     18
     19        * UIProcess/API/mac/WKView.mm:
     20        (-[WKView WebKit::]):
     21        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
     22        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
     23        * WebProcess/WebPage/DrawingArea.cpp:
     24        (WebKit::DrawingArea::create):
     25        * WebProcess/WebPage/DrawingArea.h:
     26        Make it so we can use TiledCoreAnimationDrawingArea without ENABLE(THREADED_SCROLLING).
     27
     28        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     29        (WebKit::WebChromeClient::shouldUseTiledBackingForFrame):
     30        * WebProcess/WebCoreSupport/WebChromeClient.h:
     31        Override shouldUseTiledBackingForFrame; ask the drawing area if we want a tiled backing for the given frame.
     32
     33        * WebProcess/WebPage/WebPage.cpp:
     34        (WebKit::WebPage::WebPage):
     35        (WebKit::WebPage::~WebPage):
     36        * WebProcess/WebPage/WebPage.h:
     37        Move attaching and detaching the scrolling tree into WebPage.
     38        Store whether or not this page is going to use threaded scrolling once, as this
     39        cannot change through the life of a page.
     40
     41        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     42        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     43        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
     44        (WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea):
     45        Move attaching and detaching the scrolling tree into WebPage.
     46
     47        (WebKit::TiledCoreAnimationDrawingArea::didInstallPageOverlay):
     48        (WebKit::TiledCoreAnimationDrawingArea::didUninstallPageOverlay):
     49        (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
     50        (WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
     51        Only do scrolling coordinator work if we have a scrolling coordinator.
     52
     53        (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrame):
     54        TiledCoreAnimationDrawingArea always wants a tiled backing for the main frame.
     55
    1562013-09-25  Minju Kim  <pmuarteo@gmail.com>
    257
  • trunk/Source/WebKit2/Shared/DrawingAreaInfo.h

    r133530 r156472  
    3131enum DrawingAreaType {
    3232    DrawingAreaTypeImpl,
    33 #if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING)
     33#if PLATFORM(MAC)
    3434    DrawingAreaTypeTiledCoreAnimation,
    35 #endif
    36 #if PLATFORM(MAC)
    3735    DrawingAreaTypeRemoteLayerTree,
    3836#endif
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r155409 r156472  
    165165    macro(HiddenPageCSSAnimationSuspensionEnabled, hiddenPageCSSAnimationSuspensionEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED) \
    166166    macro(LowPowerVideoAudioBufferSizeEnabled, lowPowerVideoAudioBufferSizeEnabled, Bool, bool, false) \
     167    macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true) \
    167168    \
    168169
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r155409 r156472  
    11551155    return toAPI(toImpl(preferencesRef)->incrementalRenderingSuppressionTimeout());
    11561156}
     1157
     1158void WKPreferencesSetThreadedScrollingEnabled(WKPreferencesRef preferencesRef, bool enabled)
     1159{
     1160    toImpl(preferencesRef)->setThreadedScrollingEnabled(enabled);
     1161}
     1162
     1163bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef preferencesRef)
     1164{
     1165    return toImpl(preferencesRef)->threadedScrollingEnabled();
     1166}
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h

    r155409 r156472  
    288288WK_EXPORT bool WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef);
    289289
     290// Defaults to true
     291WK_EXPORT void WKPreferencesSetThreadedScrollingEnabled(WKPreferencesRef preferencesRef, bool enabled);
     292WK_EXPORT bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef preferencesRef);
     293
    290294// Defaults to 5 seconds.
    291295WK_EXPORT void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout);
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r155888 r156472  
    23682368- (OwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
    23692369{
    2370 #if ENABLE(THREADED_SCROLLING)
    23712370    if ([self _shouldUseTiledDrawingArea]) {
    23722371        if (getenv("WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA"))
     
    23752374        return createOwned<TiledCoreAnimationDrawingAreaProxy>(_data->_page.get());
    23762375    }
    2377 #endif
    23782376
    23792377    return createOwned<DrawingAreaProxyImpl>(_data->_page.get());
  • trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h

    r155888 r156472  
    2626#ifndef TiledCoreAnimationDrawingAreaProxy_h
    2727#define TiledCoreAnimationDrawingAreaProxy_h
    28 
    29 #if ENABLE(THREADED_SCROLLING)
    3028
    3129#include "DrawingAreaProxy.h"
     
    7270} // namespace WebKit
    7371
    74 #endif // ENABLE(THREADED_SCROLLING)
    75 
    7672#endif // TiledCoreAnimationDrawingAreaProxy_h
  • trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm

    r155888 r156472  
    2626#import "config.h"
    2727#import "TiledCoreAnimationDrawingAreaProxy.h"
    28 
    29 #if ENABLE(THREADED_SCROLLING)
    3028
    3129#import "ColorSpaceData.h"
     
    158156
    159157} // namespace WebKit
    160 
    161 #endif // ENABLE(THREADED_SCROLLING)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r154877 r156472  
    905905}
    906906
     907bool WebChromeClient::shouldUseTiledBackingForFrameView(const FrameView* frameView) const
     908{
     909    return m_page->drawingArea()->shouldUseTiledBackingForFrameView(frameView);
     910}
     911
    907912void WebChromeClient::incrementActivePageCount()
    908913{
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r153356 r156472  
    236236    virtual void didAddFooterLayer(WebCore::GraphicsLayer*) OVERRIDE;
    237237
     238    virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) const OVERRIDE;
     239
    238240    virtual void incrementActivePageCount() OVERRIDE;
    239241    virtual void decrementActivePageCount() OVERRIDE;
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp

    r133530 r156472  
    3030#include "DrawingAreaImpl.h"
    3131
    32 #if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING)
    33 #include "TiledCoreAnimationDrawingArea.h"
    34 #endif
    35 
    3632#if PLATFORM(MAC)
    3733#include "RemoteLayerTreeDrawingArea.h"
     34#include "TiledCoreAnimationDrawingArea.h"
    3835#endif
    3936
     
    4744    case DrawingAreaTypeImpl:
    4845        return DrawingAreaImpl::create(webPage, parameters);
    49 #if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING)
     46#if PLATFORM(MAC)
    5047    case DrawingAreaTypeTiledCoreAnimation:
    5148        return TiledCoreAnimationDrawingArea::create(webPage, parameters);
    52 #endif
    53 #if PLATFORM(MAC)
    5449    case DrawingAreaTypeRemoteLayerTree:
    5550        return RemoteLayerTreeDrawingArea::create(webPage, parameters);
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h

    r153692 r156472  
    3535
    3636namespace CoreIPC {
    37     class Connection;
    38     class MessageDecoder;
     37class Connection;
     38class MessageDecoder;
    3939}
    4040
    4141namespace WebCore {
    42     class GraphicsLayer;
    43     class GraphicsLayerFactory;
     42class FrameView;
     43class GraphicsLayer;
     44class GraphicsLayerFactory;
    4445}
    4546
     
    8990    virtual void didChangeScrollOffsetForAnyFrame() { }
    9091
     92    virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) { return false; }
     93
    9194#if USE(ACCELERATED_COMPOSITING)
    9295    virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r156424 r156472  
    3434#include "DrawingArea.h"
    3535#include "DrawingAreaMessages.h"
     36#include "EventDispatcher.h"
    3637#include "InjectedBundle.h"
    3738#include "InjectedBundleBackForwardList.h"
     
    292293    , m_maximumRenderingSuppressionToken(0)
    293294    , m_scrollPinningBehavior(DoNotPin)
     295    , m_useThreadedScrolling(false)
    294296{
    295297    ASSERT(m_pageID);
     
    319321
    320322    m_page = adoptPtr(new Page(pageClients));
     323
     324    m_useThreadedScrolling = parameters.store.getBoolValueForKey(WebPreferencesKey::threadedScrollingEnabledKey());
     325    m_page->settings().setScrollingCoordinatorEnabled(m_useThreadedScrolling);
    321326
    322327    m_drawingArea = DrawingArea::create(this, parameters);
     
    419424    webPageCounter.increment();
    420425#endif
     426
     427#if ENABLE(THREADED_SCROLLING)
     428    if (m_useThreadedScrolling)
     429        WebProcess::shared().eventDispatcher().addScrollingTreeForPage(this);
     430#endif
    421431}
    422432
     
    427437
    428438    ASSERT(!m_page);
     439
     440#if ENABLE(THREADED_SCROLLING)
     441    if (m_useThreadedScrolling)
     442        WebProcess::shared().eventDispatcher().removeScrollingTreeForPage(this);
     443#endif
    429444
    430445    m_sandboxExtensionTracker.invalidate();
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r156354 r156472  
    10301030   
    10311031    WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
     1032
     1033    bool m_useThreadedScrolling;
    10321034};
    10331035
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r153692 r156472  
    2727#define TiledCoreAnimationDrawingArea_h
    2828
    29 #if ENABLE(THREADED_SCROLLING)
    30 
    3129#include "DrawingArea.h"
    3230#include "LayerTreeContext.h"
     
    4341
    4442namespace WebCore {
     43class FrameView;
    4544class TiledBacking;
    4645}
     
    8382
    8483    virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&) OVERRIDE;
     84
     85    virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*);
    8586
    8687    // WebCore::GraphicsLayerClient
     
    145146} // namespace WebKit
    146147
    147 #endif // ENABLE(THREADED_SCROLLING)
    148 
    149148#endif // TiledCoreAnimationDrawingArea_h
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r154658 r156472  
    2727#import "TiledCoreAnimationDrawingArea.h"
    2828
    29 #if ENABLE(THREADED_SCROLLING)
    30 
    3129#import "ColorSpaceData.h"
    3230#import "DrawingAreaProxyMessages.h"
    33 #import "EventDispatcher.h"
    3431#import "LayerHostingContext.h"
    3532#import "LayerTreeContext.h"
     
    4643#import <WebCore/Page.h>
    4744#import <WebCore/RenderView.h>
     45#import <WebCore/Settings.h>
     46#import <WebCore/TiledBacking.h>
     47#import <wtf/MainThread.h>
     48
     49#if ENABLE(THREADED_SCROLLING)
    4850#import <WebCore/ScrollingCoordinator.h>
    4951#import <WebCore/ScrollingThread.h>
    5052#import <WebCore/ScrollingTree.h>
    51 #import <WebCore/Settings.h>
    52 #import <WebCore/TiledBacking.h>
    53 #import <wtf/MainThread.h>
     53#endif
    5454
    5555@interface CATransaction (Details)
     
    7474    , m_updateIntrinsicContentSizeTimer(this, &TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeTimerFired)
    7575{
    76     Page* page = m_webPage->corePage();
    77 
    78     page->settings().setScrollingCoordinatorEnabled(true);
    79     page->settings().setForceCompositingMode(true);
    80 
    81     WebProcess::shared().eventDispatcher().addScrollingTreeForPage(webPage);
     76    m_webPage->corePage()->settings().setForceCompositingMode(true);
    8277
    8378    m_rootLayer = [CALayer layer];
     
    9893TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea()
    9994{
    100     WebProcess::shared().eventDispatcher().removeScrollingTreeForPage(m_webPage);
    101 
    10295    m_layerFlushScheduler.invalidate();
    10396}
     
    193186void TiledCoreAnimationDrawingArea::didInstallPageOverlay(PageOverlay* pageOverlay)
    194187{
    195     m_webPage->corePage()->scrollingCoordinator()->setForceMainThreadScrollLayerPositionUpdates(true);
     188#if ENABLE(THREADED_SCROLLING)
     189    if (ScrollingCoordinator* scrollingCoordinator = m_webPage->corePage()->scrollingCoordinator())
     190        scrollingCoordinator->setForceMainThreadScrollLayerPositionUpdates(true);
     191#endif
    196192
    197193    createPageOverlayLayer(pageOverlay);
     
    206202        return;
    207203
    208     if (Page* page = m_webPage->corePage())
    209         page->scrollingCoordinator()->setForceMainThreadScrollLayerPositionUpdates(false);
     204#if ENABLE(THREADED_SCROLLING)
     205    if (Page* page = m_webPage->corePage()) {
     206        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
     207            scrollingCoordinator->setForceMainThreadScrollLayerPositionUpdates(false);
     208    }
     209#endif
    210210}
    211211
     
    240240{
    241241    Settings& settings = m_webPage->corePage()->settings();
    242     bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
    243     ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), scrollingPerformanceLoggingEnabled));
     242
     243#if ENABLE(THREADED_SCROLLING)
     244    if (ScrollingCoordinator* scrollingCoordinator = m_webPage->corePage()->scrollingCoordinator()) {
     245        bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
     246        ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, scrollingCoordinator->scrollingTree(), scrollingPerformanceLoggingEnabled));
     247    }
     248#endif
    244249
    245250    if (TiledBacking* tiledBacking = mainFrameTiledBacking())
     
    294299void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>& functionRef)
    295300{
     301    Function<void ()> function = functionRef;
     302
     303#if ENABLE(THREADED_SCROLLING)
     304    if (!m_webPage->corePage()->scrollingCoordinator()) {
     305        function();
     306        return;
     307    }
     308
    296309    m_webPage->ref();
    297310    m_webPage->corePage()->scrollingCoordinator()->commitTreeStateIfNeeded();
     
    299312    if (!m_layerTreeStateIsFrozen)
    300313        m_layerFlushScheduler.suspend();
    301 
    302     Function<void ()> function = functionRef;
    303314
    304315    // It is possible for the drawing area to be destroyed before the bound block
     
    319330        webPage->deref();
    320331    }));
     332#else
     333    function();
     334#endif
    321335}
    322336
     
    691705}
    692706
     707bool TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView(const FrameView* frameView)
     708{
     709    return frameView && frameView->isMainFrameView();
     710}
     711
    693712} // namespace WebKit
    694 
    695 #endif // ENABLE(THREADED_SCROLLING)
  • trunk/Tools/ChangeLog

    r156461 r156472  
     12013-09-26  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tiled drawing should not imply threaded scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=121874
     5        <rdar://problem/15071494>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     10        (WTR::PlatformWebView::PlatformWebView):
     11        The existing tiled-drawing layout tests require threaded scrolling to be enabled.
     12
    1132013-09-26  Commit Queue  <commit-queue@webkit.org>
    214
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r154949 r156472  
    3030#import "WebKitTestRunnerDraggingInfo.h"
    3131#import <WebKit2/WKImageCG.h>
     32#import <WebKit2/WKPreferencesPrivate.h>
    3233#import <WebKit2/WKViewPrivate.h>
    3334#import <wtf/RetainPtr.h>
     
    133134    WKTypeRef useTiledDrawingValue = options ? WKDictionaryGetItemForKey(options, useTiledDrawingKey.get()) : NULL;
    134135    bool useTiledDrawing = useTiledDrawingValue && WKBooleanGetValue(static_cast<WKBooleanRef>(useTiledDrawingValue));
     136
     137    // The tiled drawing specific tests also depend on threaded scrolling.
     138    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroupRef);
     139    WKPreferencesSetThreadedScrollingEnabled(preferences, useTiledDrawing);
    135140
    136141    NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight);
Note: See TracChangeset for help on using the changeset viewer.