[Win] Use TileController on Windows
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 23:56:50 +0000 (23:56 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 23:56:50 +0000 (23:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133895

Reviewed by Tim Horton.

../WebCore:
* WebCore.vcxproj/WebCore.vcxproj: Add Tiled Drawing files.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* platform/graphics/TiledBacking.h: No longer Cocoa-only.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): Windows
now uses the same layer type as Mac.
* platform/graphics/ca/LayerPool.cpp:
(WebCore::LayerPool::takeLayerWithSize): Use nullptr
rather than nil for C++ code.
* platform/graphics/ca/PlatformCALayer.cpp:
* platform/graphics/ca/PlatformCALayer.h: Expose necessary
drawing functions for Windows port.
* platform/graphics/ca/TileController.cpp: Remove unneeded
header include for WebLayer.
* platform/graphics/ca/TileCoverageMap.cpp: Correct #includes.
* platform/graphics/ca/TileGrid.h: Not just for Cococa.
* platform/graphics/ca/mac/PlatformCALayerMac.mm: Remove
extra whitespace.
* platform/graphics/ca/mac/PlatformCALayerMac.h: Remove
unneeded overload.
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayer::collectRectsToPaint): Added stub.
(PlatformCALayer::drawLayerContents): Added.
(PlatformCALayer::frameForLayer): Added.
(PlatformCALayerWin::PlatformCALayerWin): Remove unneeded
assert now that we support these types. Add TileController
support.
(PlatformCALayerWin::setEdgeAntialiasingMask): Added.
(printLayer): Add newly-supported tile types.
(PlatformCALayerWin::tiledBacking): Added.
* platform/graphics/ca/win/PlatformCALayerWin.h: Update to
support Tiled Drawing.
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::PlatformCALayerWinInternal): Update to
recognize newly-supported layer types.
(PlatformCALayerWinInternal::setNeedsDisplay): Ditto.
(PlatformCALayerWinInternal::setSublayers): Ditto.
(PlatformCALayerWinInternal::getSublayers): Ditto.
(PlatformCALayerWinInternal::removeAllSublayers): Ditto.
(PlatformCALayerWinInternal::insertSublayer): Ditto.
(PlatformCALayerWinInternal::sublayerCount): Ditto.
(PlatformCALayerWinInternal::indexOfSublayer): Ditto.
(PlatformCALayerWinInternal::sublayerAtIndex): Ditto.
(PlatformCALayerWinInternal::setBounds): Ditto.
(PlatformCALayerWinInternal::setFrame): Ditto.
(PlatformCALayerWinInternal::drawTile): Ditto.
(PlatformCALayerWinInternal::createTileController): Ditto.
(PlatformCALayerWinInternal::tiledBacking): Ditto.
* platform/graphics/ca/win/PlatformCALayerWinInternal.h: Update to use
TileController.

../WebKit2:
* WebProcess/WebPage/mac/PlatformCALayerRemote.h: Remove
unneeded overload.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170037 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/platform/graphics/TiledBacking.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/LayerPool.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/TileController.cpp
Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp
Source/WebCore/platform/graphics/ca/TileGrid.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

index 16b58f6..e4edf9a 100644 (file)
@@ -1,3 +1,61 @@
+2014-06-16  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Use TileController on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=133895
+
+        Reviewed by Tim Horton.
+
+        * WebCore.vcxproj/WebCore.vcxproj: Add Tiled Drawing files.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
+        * platform/graphics/TiledBacking.h: No longer Cocoa-only.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): Windows
+        now uses the same layer type as Mac.
+        * platform/graphics/ca/LayerPool.cpp:
+        (WebCore::LayerPool::takeLayerWithSize): Use nullptr
+        rather than nil for C++ code.
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        * platform/graphics/ca/PlatformCALayer.h: Expose necessary
+        drawing functions for Windows port.
+        * platform/graphics/ca/TileController.cpp: Remove unneeded
+        header include for WebLayer.
+        * platform/graphics/ca/TileCoverageMap.cpp: Correct #includes.
+        * platform/graphics/ca/TileGrid.h: Not just for Cococa.
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm: Remove
+        extra whitespace.
+        * platform/graphics/ca/mac/PlatformCALayerMac.h: Remove
+        unneeded overload.
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayer::collectRectsToPaint): Added stub.
+        (PlatformCALayer::drawLayerContents): Added.
+        (PlatformCALayer::frameForLayer): Added.
+        (PlatformCALayerWin::PlatformCALayerWin): Remove unneeded
+        assert now that we support these types. Add TileController
+        support.
+        (PlatformCALayerWin::setEdgeAntialiasingMask): Added.
+        (printLayer): Add newly-supported tile types.
+        (PlatformCALayerWin::tiledBacking): Added.
+        * platform/graphics/ca/win/PlatformCALayerWin.h: Update to
+        support Tiled Drawing.
+        * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+        (PlatformCALayerWinInternal::PlatformCALayerWinInternal): Update to
+        recognize newly-supported layer types.
+        (PlatformCALayerWinInternal::setNeedsDisplay): Ditto.
+        (PlatformCALayerWinInternal::setSublayers): Ditto.
+        (PlatformCALayerWinInternal::getSublayers): Ditto.
+        (PlatformCALayerWinInternal::removeAllSublayers): Ditto.
+        (PlatformCALayerWinInternal::insertSublayer): Ditto.
+        (PlatformCALayerWinInternal::sublayerCount): Ditto.
+        (PlatformCALayerWinInternal::indexOfSublayer): Ditto.
+        (PlatformCALayerWinInternal::sublayerAtIndex): Ditto.
+        (PlatformCALayerWinInternal::setBounds): Ditto.
+        (PlatformCALayerWinInternal::setFrame): Ditto.
+        (PlatformCALayerWinInternal::drawTile): Ditto.
+        (PlatformCALayerWinInternal::createTileController): Ditto.
+        (PlatformCALayerWinInternal::tiledBacking): Ditto.
+        * platform/graphics/ca/win/PlatformCALayerWinInternal.h: Update to use
+        TileController.
+
 2014-06-16  Andreas Kling  <akling@apple.com>
 
         Remove unnecessary style invalidation in RenderTextControl::styleDidChange().
index ccf9590..53d3f1f 100644 (file)
     <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.cpp" />
     <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.cpp" />
     <ClCompile Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp" />
+    <ClCompile Include="..\platform\graphics\ca\LayerPool.cpp" />
     <ClCompile Include="..\platform\graphics\ca\PlatformCALayer.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\platform\graphics\ca\TileController.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\ca\TileCoverageMap.cpp" />
+    <ClCompile Include="..\platform\graphics\ca\TileGrid.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\platform\graphics\GLContext.cpp" />
     <ClCompile Include="..\platform\graphics\cairo\GraphicsContext3DCairo.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     <ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.h" />
     <ClInclude Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.h" />
     <ClInclude Include="..\platform\graphics\cairo\TileCairo.h" />
+    <ClInclude Include="..\platform\graphics\ca\LayerPool.h" />
     <ClInclude Include="..\platform\graphics\ca\PlatformCAFilters.h" />
+    <ClInclude Include="..\platform\graphics\ca\TileController.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\ca\TileCoverageMap.h" />
+    <ClInclude Include="..\platform\graphics\ca\TileGrid.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+    </ClInclude>
     <ClInclude Include="..\platform\graphics\ca\win\PlatformCAAnimationWin.h" />
     <ClInclude Include="..\platform\graphics\ca\win\PlatformCALayerWin.h" />
     <ClInclude Include="..\platform\graphics\GLContext.h" />
   <ImportGroup Label="ExtensionTargets">
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index 7a83880..8a49a35 100644 (file)
     <ClCompile Include="..\rendering\shapes\Shape.cpp">
       <Filter>rendering\shapes</Filter>
     </ClCompile>
-    <ClCompile Include="..\rendering\shapes\ShapeInsideInfo.cpp">
-      <Filter>rendering\shapes</Filter>
-    </ClCompile>
     <ClCompile Include="..\rendering\shapes\ShapeOutsideInfo.cpp">
       <Filter>rendering\shapes</Filter>
     </ClCompile>
     <ClCompile Include="..\html\track\VTTRegionList.cpp">
       <Filter>html\track</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTTPHeaderNames.cpp" />
+    <ClCompile Include="..\platform\DisplaySleepDisabler.cpp" />
+    <ClCompile Include="..\platform\SystemSleepListener.cpp" />
+    <ClCompile Include="..\platform\network\BlobRegistry.cpp" />
+    <ClCompile Include="..\platform\network\BlobRegistryImpl.cpp" />
+    <ClCompile Include="..\css\CSSToLengthConversionData.cpp" />
+    <ClCompile Include="..\html\PublicURLManager.cpp" />
+    <ClCompile Include="..\platform\graphics\ca\TileController.cpp">
+      <Filter>platform\graphics\ca</Filter>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\ca\TileGrid.cpp">
+      <Filter>platform\graphics\ca</Filter>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\ca\LayerPool.cpp">
+      <Filter>platform\graphics\ca</Filter>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\ca\TileCoverageMap.cpp">
+      <Filter>platform\graphics\ca</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\Modules\geolocation\Coordinates.h">
     <ClInclude Include="..\platform\graphics\avfoundation\MediaPlayerPrivateAVFoundation.h">
       <Filter>platform\graphics\avfoundation</Filter>
     </ClInclude>
-    <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.h">
-      <Filter>platform\graphics\win</Filter>
-    </ClCompile>
     <ClInclude Include="..\platform\graphics\avfoundation\cf\AVFoundationCFSoftLinking.h">
       <Filter>platform\graphics\avfoundation\cf</Filter>
     </ClInclude>
     <ClInclude Include="..\rendering\shapes\Shape.h">
       <Filter>rendering\shapes</Filter>
     </ClInclude>
-    <ClInclude Include="..\rendering\shapes\ShapeInsideInfo.h">
-      <Filter>rendering\shapes</Filter>
-    </ClInclude>
     <ClInclude Include="..\rendering\shapes\ShapeInterval.h">
       <Filter>rendering\shapes</Filter>
     </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSVTTRegion.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSVTTRegionList.cpp" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSVTTRegionList.h" />
+    <ClInclude Include="..\platform\DisplaySleepDisabler.h" />
+    <ClInclude Include="..\platform\graphics\ca\win\PlatformCAAnimationWin.h" />
+    <ClInclude Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.h" />
+    <ClInclude Include="..\platform\SystemSleepListener.h" />
+    <ClInclude Include="..\css\CSSToLengthConversionData.h" />
+    <ClInclude Include="..\platform\graphics\ca\TileController.h">
+      <Filter>platform\graphics\ca</Filter>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\ca\TileGrid.h">
+      <Filter>platform\graphics\ca</Filter>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\ca\LayerPool.h">
+      <Filter>platform\graphics\ca</Filter>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\ca\TileCoverageMap.h">
+      <Filter>platform\graphics\ca</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\css\CSSGrammar.y.in">
     <None Include="..\Modules\mediacontrols\mediaControlsApple.js">
       <Filter>Modules\mediacontrols</Filter>
     </None>
+    <None Include="..\platform\network\HTTPHeaderNames.in" />
   </ItemGroup>
   <ItemGroup>
     <CustomBuildStep Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.h">
       <Filter>platform\win</Filter>
     </MASM>
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
index c914fa6..9cb3ee9 100644 (file)
@@ -32,9 +32,7 @@ static const int defaultTileWidth = 512;
 static const int defaultTileHeight = 512;
 
 class IntRect;
-#if PLATFORM(COCOA)
 class PlatformCALayer;
-#endif
 
 enum ScrollingModeIndication {
     SynchronousScrollingBecauseOfStyleIndication,
@@ -103,7 +101,7 @@ public:
     virtual IntRect tileGridExtent() const = 0;
     virtual void setScrollingModeIndication(ScrollingModeIndication) = 0;
 
-#if PLATFORM(COCOA)
+#if USE(CA)
     virtual PlatformCALayer* tiledScrollingIndicatorLayer() = 0;
 #endif
 };
index f3695cf..caf69af 100644 (file)
@@ -2998,11 +2998,7 @@ void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)
     ASSERT(useTiledLayer != m_usingTiledBacking);
     RefPtr<PlatformCALayer> oldLayer = m_layer;
 
-#if PLATFORM(WIN)
-    PlatformCALayer::LayerType layerType = useTiledLayer ? PlatformCALayer::LayerTypeWebTiledLayer : PlatformCALayer::LayerTypeWebLayer;
-#else
     PlatformCALayer::LayerType layerType = useTiledLayer ? PlatformCALayer::LayerTypeTiledBackingLayer : PlatformCALayer::LayerTypeWebLayer;
-#endif
 
     m_layer = createPlatformCALayer(layerType, this);
 
index 1588009..29b6f7c 100644 (file)
@@ -81,10 +81,10 @@ void LayerPool::addLayer(const RefPtr<PlatformCALayer>& layer)
 RefPtr<PlatformCALayer> LayerPool::takeLayerWithSize(const IntSize& size)
 {
     if (!canReuseLayerWithSize(size))
-        return nil;
+        return nullptr;
     LayerList& reuseList = listOfLayersWithSize(size, MarkAsUsed);
     if (reuseList.isEmpty())
-        return nil;
+        return nullptr;
     m_totalBytes -= backingStoreBytesForSize(size);
     return reuseList.takeFirst();
 }
index 6794609..9ef8202 100644 (file)
@@ -37,6 +37,10 @@ static GraphicsLayer::PlatformLayerID generateLayerID()
     return ++layerID;
 }
 
+#if COMPILER(MSVC)
+const float PlatformCALayer::webLayerWastedSpaceThreshold = 0.75f;
+#endif
+
 PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
     : m_layerType(layerType)
     , m_layerID(generateLayerID())
index e64b09f..c4076fa 100644 (file)
@@ -93,7 +93,7 @@ public:
 
     virtual PlatformLayer* platformLayer() const { return m_layer.get(); }
 
-    virtual bool usesTiledBackingLayer() const = 0;
+    bool usesTiledBackingLayer() const { return layerType() == LayerTypePageTiledBackingLayer || layerType() == LayerTypeTiledBackingLayer; }
 
     PlatformCALayerClient* owner() const { return m_owner; }
     virtual void setOwner(PlatformCALayerClient* owner) { m_owner = owner; }
@@ -226,16 +226,20 @@ public:
 
 #if PLATFORM(COCOA)
     virtual void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) = 0;
+#endif
 
     static const unsigned webLayerMaxRectsToPaint = 5;
+#if COMPILER(MSVC)
+    static const float webLayerWastedSpaceThreshold;
+#else
     constexpr static const float webLayerWastedSpaceThreshold = 0.75f;
+#endif
 
     typedef Vector<FloatRect, webLayerMaxRectsToPaint> RepaintRectList;
         
     // Functions allows us to share implementation across WebTiledLayer and WebLayer
     static RepaintRectList collectRectsToPaint(CGContextRef, PlatformCALayer*);
     static void drawLayerContents(CGContextRef, PlatformCALayer*, RepaintRectList& dirtyRects);
-#endif
     static void drawRepaintIndicator(CGContextRef, PlatformCALayer*, int repaintCount, CGColorRef customBackgroundColor);
     static CGRect frameForLayer(const PlatformLayer*);
 
index cdbcdd7..2e00cb8 100644 (file)
@@ -32,7 +32,6 @@
 #include "Region.h"
 #include "TileCoverageMap.h"
 #include "TileGrid.h"
-#include "WebLayer.h"
 #include <utility>
 #include <wtf/MainThread.h>
 
index 517acf3..d776947 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "config.h"
-#import "TileCoverageMap.h"
+#include "config.h"
+#include "TileCoverageMap.h"
 
-#import "GraphicsContext.h"
-#import "TileController.h"
-#import "TileGrid.h"
+#include "GraphicsContext.h"
+#include "TileController.h"
+#include "TileGrid.h"
 
 namespace WebCore {
 
index 9dabe8a..bb0a58c 100644 (file)
@@ -35,7 +35,7 @@
 #include <wtf/Noncopyable.h>
 #include <wtf/Ref.h>
 
-#if PLATFORM(COCOA)
+#if USE(CG)
 typedef struct CGContext *CGContextRef;
 #endif
 
index e4d8c7f..0bc5c85 100644 (file)
@@ -42,8 +42,6 @@ public:
 
     ~PlatformCALayerMac();
 
-    virtual bool usesTiledBackingLayer() const override { return layerType() == LayerTypePageTiledBackingLayer || layerType() == LayerTypeTiledBackingLayer; }
-
     virtual void setOwner(PlatformCALayerClient*) override;
 
     virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) override;
index 4e4b3ea..9aefb98 100644 (file)
@@ -957,7 +957,6 @@ CGRect PlatformCALayer::frameForLayer(const PlatformLayer* tileLayer)
     return [tileLayer frame];
 }
 
-
 PassRefPtr<PlatformCALayer> PlatformCALayerMac::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
     return PlatformCALayerMac::create(layerType, client);
index 4d979fd..566c4fe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
 #include "GraphicsContext.h"
 #include "PlatformCAAnimationWin.h"
 #include "PlatformCALayerWinInternal.h"
+#include "TileController.h"
 #include <QuartzCore/CoreAnimationCF.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/CurrentTime.h>
@@ -93,6 +94,24 @@ PlatformCALayer* PlatformCALayer::platformCALayer(void* platformLayer)
     return layerIntern ? layerIntern->owner() : 0;
 }
 
+PlatformCALayer::RepaintRectList PlatformCALayer::collectRectsToPaint(CGContextRef, PlatformCALayer*)
+{
+    // FIXME: We should actually collect rects to use instead of defaulting to Windows'
+    // normal drawing path.
+    PlatformCALayer::RepaintRectList dirtyRects;
+    return dirtyRects;
+}
+
+void PlatformCALayer::drawLayerContents(CGContextRef context, WebCore::PlatformCALayer* platformCALayer, RepaintRectList&)
+{
+    intern(platformCALayer)->displayCallback(platformCALayer->platformLayer(), context);
+}
+
+CGRect PlatformCALayer::frameForLayer(const PlatformLayer* tileLayer)
+{
+    return CACFLayerGetFrame(static_cast<CACFLayerRef>(const_cast<PlatformLayer*>(tileLayer)));
+}
+
 static void displayCallback(CACFLayerRef caLayer, CGContextRef context)
 {
     ASSERT_ARG(caLayer, CACFLayerGetUserData(caLayer));
@@ -116,7 +135,6 @@ PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer
         return;
     }
 
-    ASSERT((layerType != LayerTypeTiledBackingLayer) && (layerType != LayerTypePageTiledBackingLayer));
     m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
 
     // Create the PlatformCALayerWinInternal object and point to it in the userdata.
@@ -126,6 +144,11 @@ PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer
     // Set the display callback
     CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
     CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);
+
+    if (usesTiledBackingLayer()) {
+        TileController* tileController = intern->createTileController(this);
+        m_customSublayers = std::make_unique<PlatformCALayerList>(tileController->containerLayers());
+    }
 }
 
 PlatformCALayerWin::~PlatformCALayerWin()
@@ -541,6 +564,12 @@ void PlatformCALayerWin::setTimeOffset(CFTimeInterval value)
     setNeedsCommit();
 }
 
+void PlatformCALayerWin::setEdgeAntialiasingMask(unsigned mask)
+{
+    CACFLayerSetEdgeAntialiasingMask(m_layer.get(), mask);
+    setNeedsCommit();
+}
+
 float PlatformCALayerWin::contentsScale() const
 {
     return 1;
@@ -579,6 +608,7 @@ static void printLayer(const PlatformCALayer* layer, int indent)
     case PlatformCALayer::LayerTypeWebLayer: layerTypeName = "web-layer"; break;
     case PlatformCALayer::LayerTypeTransformLayer: layerTypeName = "transform-layer"; break;
     case PlatformCALayer::LayerTypeWebTiledLayer: layerTypeName = "web-tiled-layer"; break;
+    case PlatformCALayer::LayerTypeTiledBackingLayer: layerTypeName = "tiled-backing-layer"; break;
     case PlatformCALayer::LayerTypeRootLayer: layerTypeName = "root-layer"; break;
     case PlatformCALayer::LayerTypeCustom: layerTypeName = "custom-layer"; break;
     }
@@ -675,3 +705,11 @@ PassRefPtr<PlatformCALayer> PlatformCALayerWin::createCompatibleLayer(PlatformCA
 {
     return PlatformCALayerWin::create(layerType, client);
 }
+
+TiledBacking* PlatformCALayerWin::tiledBacking()
+{
+    if (!usesTiledBackingLayer())
+        return nullptr;
+
+    return intern(this)->tiledBacking();
+}
index 2008532..ff52051 100644 (file)
@@ -37,8 +37,6 @@ public:
     
     ~PlatformCALayerWin();
 
-    virtual bool usesTiledBackingLayer() const override { return false; }
-
     virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) override;
 
     virtual void setContentsChanged() override;
@@ -50,7 +48,7 @@ public:
     virtual void appendSublayer(PlatformCALayer*) override;
     virtual void insertSublayer(PlatformCALayer*, size_t index) override;
     virtual void replaceSublayer(PlatformCALayer* reference, PlatformCALayer*) override;
-    virtual const PlatformCALayerList* customSublayers() const override { return nullptr; }
+    virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
     virtual void adoptSublayers(PlatformCALayer* source) override;
 
     virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
@@ -124,7 +122,7 @@ public:
     virtual float contentsScale() const override;
     virtual void setContentsScale(float) override;
 
-    virtual void setEdgeAntialiasingMask(unsigned) override { ASSERT_NOT_REACHED(); }
+    virtual void setEdgeAntialiasingMask(unsigned) override;
 
     virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
@@ -132,7 +130,7 @@ public:
     virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
     virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior) override { m_customBehavior = customBehavior; }
 
-    virtual TiledBacking* tiledBacking() override { return nullptr; }
+    virtual TiledBacking* tiledBacking() override;
     
     virtual PlatformCALayer* rootLayer() const override;
     virtual void setNeedsLayout() override;
@@ -150,6 +148,7 @@ private:
     PlatformCALayerWin(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
 
     HashMap<String, RefPtr<PlatformCAAnimation>> m_animations;
+    std::unique_ptr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
     GraphicsLayer::CustomBehavior m_customBehavior;
 };
index 39f39fa..ac37185 100644 (file)
@@ -32,6 +32,8 @@
 #include "GraphicsContext.h"
 #include "PlatformCALayer.h"
 #include "TextRun.h"
+#include "TileController.h"
+#include "TiledBacking.h"
 #include <QuartzCore/CACFLayer.h>
 #include <wtf/MainThread.h>
 
@@ -43,12 +45,19 @@ using namespace WebCore;
 // to keep the overall tile cost low.
 static const int cTiledLayerTileSize = 512;
 
+static bool layerTypeIsTiled(const PlatformCALayer::LayerType layerType)
+{
+    return layerType == PlatformCALayer::LayerTypeWebTiledLayer
+        || layerType == PlatformCALayer::LayerTypePageTiledBackingLayer
+        || layerType == PlatformCALayer::LayerTypeTiledBackingLayer;
+}
+
 PlatformCALayerWinInternal::PlatformCALayerWinInternal(PlatformCALayer* owner)
     : m_tileSize(CGSizeMake(cTiledLayerTileSize, cTiledLayerTileSize))
     , m_constrainedSize(constrainedSize(owner->bounds().size()))
     , m_owner(owner)
 {
-    if (m_owner->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Tiled layers are placed in a child layer that is always the first child of the TiledLayer
         m_tileParent = adoptCF(CACFLayerCreate(kCACFLayer));
         CACFLayerInsertSublayer(m_owner->platformLayer(), m_tileParent.get(), 0);
@@ -153,7 +162,7 @@ void PlatformCALayerWinInternal::internalSetNeedsDisplay(const FloatRect* dirtyR
 
 void PlatformCALayerWinInternal::setNeedsDisplay(const FloatRect* dirtyRect)
 {
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // FIXME: Only setNeedsDisplay for tiles that are currently visible
         int numTileLayers = tileCount();
         CGRect rect;
@@ -208,7 +217,7 @@ void PlatformCALayerWinInternal::setSublayers(const PlatformCALayerList& list)
 
     owner()->setNeedsCommit();
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Preserve the tile parent after set
         CACFLayerInsertSublayer(owner()->platformLayer(), m_tileParent.get(), 0);
     }
@@ -225,7 +234,7 @@ void PlatformCALayerWinInternal::getSublayers(PlatformCALayerList& list) const
     size_t count = CFArrayGetCount(sublayers);
 
     size_t layersToSkip = 0;
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Exclude the tile parent layer.
         layersToSkip = 1;
     }
@@ -240,7 +249,7 @@ void PlatformCALayerWinInternal::removeAllSublayers()
     CACFLayerSetSublayers(owner()->platformLayer(), 0);
     owner()->setNeedsCommit();
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Restore the tile parent after removal
         CACFLayerInsertSublayer(owner()->platformLayer(), m_tileParent.get(), 0);
     }
@@ -249,7 +258,7 @@ void PlatformCALayerWinInternal::removeAllSublayers()
 void PlatformCALayerWinInternal::insertSublayer(PlatformCALayer* layer, size_t index)
 {
     index = min(index, sublayerCount());
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Add 1 to account for the tile parent layer
         index++;
     }
@@ -264,7 +273,7 @@ size_t PlatformCALayerWinInternal::sublayerCount() const
     CFArrayRef sublayers = CACFLayerGetSublayers(owner()->platformLayer());
     size_t count = sublayers ? CFArrayGetCount(sublayers) : 0;
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Subtract 1 to account for the tile parent layer
         ASSERT(count > 0);
         count--;
@@ -285,7 +294,7 @@ int PlatformCALayerWinInternal::indexOfSublayer(const PlatformCALayer* reference
 
     size_t n = CFArrayGetCount(sublayers);
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         for (size_t i = 1; i < n; ++i) {
             if (CFArrayGetValueAtIndex(sublayers, i) == ref)
                 return i - 1;
@@ -302,7 +311,7 @@ int PlatformCALayerWinInternal::indexOfSublayer(const PlatformCALayer* reference
 
 PlatformCALayer* PlatformCALayerWinInternal::sublayerAtIndex(int index) const
 {
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         // Add 1 to account for the tile parent layer
         index++;
     }
@@ -322,7 +331,7 @@ void PlatformCALayerWinInternal::setBounds(const FloatRect& rect)
     CACFLayerSetBounds(owner()->platformLayer(), rect);
     owner()->setNeedsCommit();
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
+    if (layerTypeIsTiled(m_owner->layerType())) {
         m_constrainedSize = constrainedSize(rect.size());
         updateTiles();
     }
@@ -337,7 +346,7 @@ void PlatformCALayerWinInternal::setFrame(const FloatRect& rect)
     CACFLayerSetFrame(owner()->platformLayer(), rect);
     owner()->setNeedsCommit();
 
-    if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer)
+    if (layerTypeIsTiled(m_owner->layerType()))
         updateTiles();
 }
 
@@ -487,3 +496,15 @@ void PlatformCALayerWinInternal::drawTile(CACFLayerRef tile, CGContextRef contex
 
     CGContextRestoreGState(context);
 }
+
+TileController* PlatformCALayerWinInternal::createTileController(PlatformCALayer* rootLayer)
+{
+    ASSERT(!m_tileController);
+    m_tileController = TileController::create(rootLayer);
+    return m_tileController.get();
+}
+
+TiledBacking* PlatformCALayerWinInternal::tiledBacking()
+{
+    return m_tileController.get();
+}
index c9c77e5..41e15fa 100644 (file)
@@ -37,6 +37,8 @@ namespace WebCore {
 
 class FloatRect;
 class PlatformCALayer;
+class TileController;
+class TiledBacking;
 
 typedef Vector<RefPtr<PlatformCALayer> > PlatformCALayerList;
 
@@ -59,6 +61,9 @@ public:
     void setBounds(const FloatRect&);
     void setFrame(const FloatRect&);
 
+    TileController* createTileController(PlatformCALayer* rootLayer);
+    TiledBacking* tiledBacking();
+
 private:
     void internalSetNeedsDisplay(const FloatRect*);
     PlatformCALayer* sublayerAtIndex(int) const;
@@ -78,6 +83,7 @@ private:
     CGSize m_tileSize;
     CGSize m_constrainedSize;
     RetainPtr<CACFLayerRef> m_tileParent;
+    OwnPtr<TileController> m_tileController;
 };
 
 }
index 3cffa76..8fbf715 100644 (file)
@@ -1,3 +1,13 @@
+2014-06-16  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Use TileController on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=133895
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h: Remove
+        unneeded overload.
+
 2014-06-16  Timothy Horton  <timothy_horton@apple.com>
 
         [iOS][wk2] Swipe snapshots are removed too quickly if there is no saved render tree size
index f3d15b4..75f95fc 100644 (file)
@@ -43,8 +43,6 @@ public:
 
     virtual ~PlatformCALayerRemote();
 
-    virtual bool usesTiledBackingLayer() const override { return layerType() == LayerTypePageTiledBackingLayer || layerType() == LayerTypeTiledBackingLayer; }
-
     virtual PlatformLayer* platformLayer() const override { return nullptr; }
 
     void recursiveBuildTransaction(RemoteLayerTreeTransaction&);