summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
commit4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch)
tree7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/WebCore/platform
parent3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff)
downloadqtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/Decimal.cpp4
-rw-r--r--Source/WebCore/platform/LocalizedStrings.cpp8
-rw-r--r--Source/WebCore/platform/MemoryPressureHandler.cpp2
-rw-r--r--Source/WebCore/platform/PlatformScreen.h3
-rw-r--r--Source/WebCore/platform/ScrollAnimator.cpp2
-rw-r--r--Source/WebCore/platform/audio/mac/AudioBusMac.mm2
-rw-r--r--Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp5
-rw-r--r--Source/WebCore/platform/blackberry/PageClientBlackBerry.h1
-rw-r--r--Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp2
-rw-r--r--Source/WebCore/platform/chromium/PlatformScreenChromium.cpp3
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp)21
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp)22
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp)20
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp97
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp)37
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp)22
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp)20
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp)22
-rw-r--r--Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp (renamed from Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp)22
-rw-r--r--Source/WebCore/platform/efl/PlatformScreenEfl.cpp2
-rw-r--r--Source/WebCore/platform/graphics/BitmapImage.cpp9
-rw-r--r--Source/WebCore/platform/graphics/BitmapImage.h4
-rw-r--r--Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp10
-rw-r--r--Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h2
-rw-r--r--Source/WebCore/platform/graphics/FractionalLayoutRect.h6
-rw-r--r--Source/WebCore/platform/graphics/Gradient.h2
-rw-r--r--Source/WebCore/platform/graphics/GraphicsContext.cpp5
-rw-r--r--Source/WebCore/platform/graphics/GraphicsContext3D.h5
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayer.cpp5
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayer.h1
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp (renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp)52
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayerAnimation.h (renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h)40
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayerClient.h1
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp (renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.cpp)30
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayerTransform.h (renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.h)10
-rw-r--r--Source/WebCore/platform/graphics/Image.cpp5
-rw-r--r--Source/WebCore/platform/graphics/Image.h1
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayer.cpp14
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayer.h14
-rw-r--r--Source/WebCore/platform/graphics/OpenGLESShims.h2
-rw-r--r--Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h7
-rw-r--r--Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp35
-rw-r--r--Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm2
-rw-r--r--Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp10
-rw-r--r--Source/WebCore/platform/graphics/ca/PlatformCALayer.h2
-rw-r--r--Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm14
-rw-r--r--Source/WebCore/platform/graphics/ca/mac/TileCache.mm8
-rw-r--r--Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h9
-rw-r--r--Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h6
-rw-r--r--Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp13
-rw-r--r--Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h5
-rw-r--r--Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp2
-rw-r--r--Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp8
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp14
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp4
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h4
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageCG.cpp2
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp4
-rw-r--r--Source/WebCore/platform/graphics/cg/PathCG.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp1
-rw-r--r--Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h1
-rw-r--r--Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp1
-rw-r--r--Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp5
-rw-r--r--Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp10
-rw-r--r--Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp5
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerChromium.cpp2
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerChromium.h6
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp98
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h19
-rw-r--r--Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp151
-rw-r--r--Source/WebCore/platform/graphics/chromium/ManagedTexture.h86
-rw-r--r--Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h1
-rw-r--r--Source/WebCore/platform/graphics/chromium/TextureAllocator.h49
-rw-r--r--Source/WebCore/platform/graphics/chromium/TextureManager.cpp325
-rw-r--r--Source/WebCore/platform/graphics/chromium/TextureManager.h140
-rw-r--r--Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp61
-rw-r--r--Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h12
-rw-r--r--Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h14
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h23
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp123
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h87
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h6
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp1
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h20
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp8
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h8
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp20
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp49
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h9
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp23
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp68
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h8
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp47
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h66
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp126
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h20
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h1
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h8
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp22
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h16
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp9
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h36
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h21
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h21
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCTexture.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h26
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp18
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h40
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp16
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp14
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h9
-rw-r--r--Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm10
-rw-r--r--Source/WebCore/platform/graphics/filters/FEBlend.cpp62
-rw-r--r--Source/WebCore/platform/graphics/filters/FEBlend.h5
-rw-r--r--Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h175
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp2
-rw-r--r--Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp2
-rw-r--r--Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp3
-rw-r--r--Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp48
-rw-r--r--Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h3
-rw-r--r--Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp274
-rw-r--r--Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h31
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextController.cpp2
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm4
-rw-r--r--Source/WebCore/platform/graphics/mac/FontCacheMac.mm4
-rw-r--r--Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp6
-rw-r--r--Source/WebCore/platform/graphics/mac/FontMac.mm4
-rw-r--r--Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm2
-rw-r--r--Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm14
-rw-r--r--Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm4
-rw-r--r--Source/WebCore/platform/graphics/mac/WebLayer.h2
-rw-r--r--Source/WebCore/platform/graphics/mac/WebLayer.mm2
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp4
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp24
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h9
-rw-r--r--Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp2
-rw-r--r--Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp71
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp4
-rw-r--r--Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp2
-rw-r--r--Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp2
-rw-r--r--Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp12
-rw-r--r--Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp20
-rw-r--r--Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h10
-rw-r--r--Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp20
-rw-r--r--Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp330
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp2
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h2
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h14
-rw-r--r--Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp2
-rw-r--r--Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp2
-rw-r--r--Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp1
-rw-r--r--Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp1
-rw-r--r--Source/WebCore/platform/gtk/PlatformScreenGtk.cpp2
-rw-r--r--Source/WebCore/platform/image-decoders/ImageDecoder.h2
-rw-r--r--Source/WebCore/platform/mac/CursorMac.mm52
-rw-r--r--Source/WebCore/platform/mac/DisplaySleepDisabler.cpp11
-rw-r--r--Source/WebCore/platform/mac/DisplaySleepDisabler.h6
-rw-r--r--Source/WebCore/platform/mac/EmptyProtocolDefinitions.h4
-rw-r--r--Source/WebCore/platform/mac/HTMLConverter.h2
-rw-r--r--Source/WebCore/platform/mac/HTMLConverter.mm6
-rw-r--r--Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm4
-rw-r--r--Source/WebCore/platform/mac/NSScrollerImpDetails.h4
-rw-r--r--Source/WebCore/platform/mac/PlatformEventFactoryMac.mm6
-rw-r--r--Source/WebCore/platform/mac/PlatformScreenMac.mm2
-rw-r--r--Source/WebCore/platform/mac/PopupMenuMac.mm8
-rw-r--r--Source/WebCore/platform/mac/ScrollAnimatorMac.mm2
-rw-r--r--Source/WebCore/platform/mac/ScrollElasticityController.mm5
-rw-r--r--Source/WebCore/platform/mac/SharedTimerMac.mm4
-rw-r--r--Source/WebCore/platform/mac/SuddenTermination.mm2
-rw-r--r--Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm2
-rw-r--r--Source/WebCore/platform/mac/WebCoreNSCellExtras.h2
-rw-r--r--Source/WebCore/platform/mac/WebCoreSystemInterface.h20
-rw-r--r--Source/WebCore/platform/mac/WebCoreSystemInterface.mm16
-rw-r--r--Source/WebCore/platform/mac/WebFontCache.mm2
-rw-r--r--Source/WebCore/platform/mac/WebVideoFullscreenController.mm4
-rw-r--r--Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm4
-rw-r--r--Source/WebCore/platform/network/Credential.h2
-rw-r--r--Source/WebCore/platform/network/DataURL.cpp4
-rw-r--r--Source/WebCore/platform/network/ResourceHandle.h2
-rw-r--r--Source/WebCore/platform/network/blackberry/NetworkJob.cpp27
-rw-r--r--Source/WebCore/platform/network/blackberry/NetworkJob.h1
-rw-r--r--Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp2
-rw-r--r--Source/WebCore/platform/network/blackberry/SocketStreamHandle.h2
-rw-r--r--Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp5
-rw-r--r--Source/WebCore/platform/network/cf/DNSCFNet.cpp4
-rw-r--r--Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp2
-rw-r--r--Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp2
-rw-r--r--Source/WebCore/platform/network/cf/ResourceRequest.h2
-rw-r--r--Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp4
-rw-r--r--Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp4
-rw-r--r--Source/WebCore/platform/network/mac/AuthenticationMac.mm2
-rw-r--r--Source/WebCore/platform/network/mac/CookieStorageMac.mm2
-rw-r--r--Source/WebCore/platform/network/mac/ResourceHandleMac.mm8
-rw-r--r--Source/WebCore/platform/network/mac/ResourceRequestMac.mm6
-rw-r--r--Source/WebCore/platform/network/mac/WebCoreURLResponse.mm2
-rw-r--r--Source/WebCore/platform/network/soup/CookieStorageSoup.cpp4
-rw-r--r--Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp1
-rw-r--r--Source/WebCore/platform/network/soup/ResourceResponse.h12
-rw-r--r--Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp6
-rw-r--r--Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp114
-rw-r--r--Source/WebCore/platform/qt/PlatformScreenQt.cpp2
-rw-r--r--Source/WebCore/platform/qt/PlatformSupport.h8
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQtMobile.cpp82
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQtMobile.h6
-rw-r--r--Source/WebCore/platform/text/Base64.cpp212
-rw-r--r--Source/WebCore/platform/text/Base64.h71
-rw-r--r--Source/WebCore/platform/text/TextChecking.h6
-rw-r--r--Source/WebCore/platform/text/cf/HyphenationCF.cpp7
-rw-r--r--Source/WebCore/platform/text/mac/HyphenationMac.mm4
-rw-r--r--Source/WebCore/platform/text/mac/LocaleMac.h1
-rw-r--r--Source/WebCore/platform/text/mac/LocaleMac.mm7
-rw-r--r--Source/WebCore/platform/win/PlatformScreenWin.cpp2
-rw-r--r--Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp2
-rw-r--r--Source/WebCore/platform/win/SoftLinking.h59
-rw-r--r--Source/WebCore/platform/wx/PasteboardWx.cpp2
227 files changed, 2371 insertions, 2368 deletions
diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp
index 263cbeebf..3bb6570b5 100644
--- a/Source/WebCore/platform/Decimal.cpp
+++ b/Source/WebCore/platform/Decimal.cpp
@@ -628,7 +628,7 @@ Decimal Decimal::ceiling() const
const int numberOfDigits = countDigits(result);
const int numberOfDropDigits = -exponent();
if (numberOfDigits < numberOfDropDigits)
- return zero(Positive);
+ return isPositive() ? Decimal(1) : zero(Positive);
result = scaleDown(result, numberOfDropDigits - 1);
if (sign() == Positive && result % 10 > 0)
@@ -670,7 +670,7 @@ Decimal Decimal::floor() const
const int numberOfDigits = countDigits(result);
const int numberOfDropDigits = -exponent();
if (numberOfDigits < numberOfDropDigits)
- return zero(Positive);
+ return isPositive() ? zero(Positive) : Decimal(-1);
result = scaleDown(result, numberOfDropDigits - 1);
if (isNegative() && result % 10 > 0)
diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp
index 9c4bdf3f9..e79b518e9 100644
--- a/Source/WebCore/platform/LocalizedStrings.cpp
+++ b/Source/WebCore/platform/LocalizedStrings.cpp
@@ -72,7 +72,7 @@ static String formatLocalizedString(String format, ...)
#endif
}
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static String truncatedStringForLookupMenuItem(const String& original)
{
if (original.isEmpty())
@@ -244,7 +244,7 @@ String contextMenuItemTagSearchInSpotlight()
String contextMenuItemTagSearchWeb()
{
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName());
return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get());
#else
@@ -254,7 +254,7 @@ String contextMenuItemTagSearchWeb()
String contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
UNUSED_PARAM(selectedString);
return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
@@ -755,7 +755,7 @@ String htmlSelectMultipleItems(size_t count)
String imageTitle(const String& filename, const IntSize& size)
{
#if USE(CF)
-#if !defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString());
RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent());
RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
diff --git a/Source/WebCore/platform/MemoryPressureHandler.cpp b/Source/WebCore/platform/MemoryPressureHandler.cpp
index 15e680862..614ec36d6 100644
--- a/Source/WebCore/platform/MemoryPressureHandler.cpp
+++ b/Source/WebCore/platform/MemoryPressureHandler.cpp
@@ -42,7 +42,7 @@ MemoryPressureHandler::MemoryPressureHandler()
{
}
-#if !PLATFORM(MAC) || defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS)
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
void MemoryPressureHandler::install() { }
void MemoryPressureHandler::uninstall() { }
diff --git a/Source/WebCore/platform/PlatformScreen.h b/Source/WebCore/platform/PlatformScreen.h
index df989a10b..1111f9d6a 100644
--- a/Source/WebCore/platform/PlatformScreen.h
+++ b/Source/WebCore/platform/PlatformScreen.h
@@ -52,8 +52,7 @@ namespace WebCore {
FloatRect screenRect(Widget*);
FloatRect screenAvailableRect(Widget*);
- // type can be "monitor" or the name of a profile such as "sRGB" or "Adobe RGB".
- void screenColorProfile(Widget*, ColorProfile&);
+ void screenColorProfile(ColorProfile&);
#if PLATFORM(MAC)
NSScreen *screenForWindow(NSWindow *);
diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp
index 15c46a116..74fd3616e 100644
--- a/Source/WebCore/platform/ScrollAnimator.cpp
+++ b/Source/WebCore/platform/ScrollAnimator.cpp
@@ -91,7 +91,7 @@ bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
bool handled = false;
-#if PLATFORM(CHROMIUM)
+#if PLATFORM(CHROMIUM) && !OS(DARWIN)
ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel;
#else
ScrollGranularity granularity = ScrollByPixel;
diff --git a/Source/WebCore/platform/audio/mac/AudioBusMac.mm b/Source/WebCore/platform/audio/mac/AudioBusMac.mm
index b47f953e2..45fb41755 100644
--- a/Source/WebCore/platform/audio/mac/AudioBusMac.mm
+++ b/Source/WebCore/platform/audio/mac/AudioBusMac.mm
@@ -49,7 +49,7 @@ PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float samp
NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]];
NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"];
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
NSDataReadingOptions options = NSDataReadingMapped;
#else
NSDataReadingOptions options = NSDataReadingMappedIfSafe;
diff --git a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
index a76c04184..770843585 100644
--- a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
+++ b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
@@ -218,6 +218,8 @@ void CookieDatabaseBackingStore::invokeOpen(const String& cookieJar)
// This table schema is compliant with Mozilla's.
createTableQuery += " (" + databaseFields + ", " + primaryKeyFields+");";
+ m_db.setBusyTimeout(1000);
+
if (!m_db.executeCommand(createTableQuery)) {
LOG_ERROR("Could not create the table to store the cookies into. No cookie will be stored!");
LOG_ERROR("SQLite Error Message: %s", m_db.lastErrorMsg());
@@ -346,7 +348,8 @@ void CookieDatabaseBackingStore::getCookiesFromDatabase(Vector<ParsedCookie*>& s
TypedReplyBuffer< Vector<ParsedCookie*>* > replyBuffer(0);
dispatchMessage(createMethodCallMessageWithReturn(&CookieDatabaseBackingStore::invokeGetCookiesWithLimit, &replyBuffer, this, limit));
Vector<ParsedCookie*>* cookies = replyBuffer.pointer();
- stackOfCookies.swap(*cookies);
+ if (cookies)
+ stackOfCookies.swap(*cookies);
delete cookies;
}
diff --git a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
index 8a1f8870f..752bdb693 100644
--- a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
+++ b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
@@ -72,6 +72,7 @@ public:
virtual bool isVisible() const = 0;
virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0;
virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0;
+ virtual void syncProxyCredential(const WebCore::Credential&) = 0;
};
#endif // PageClientBlackBerry_h
diff --git a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp
index 592539cd4..1d8703156 100644
--- a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp
+++ b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp
@@ -64,7 +64,7 @@ FloatRect screenRect(Widget* widget)
return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::primaryScreen()->size())));
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
index 46f33dafd..54d58da13 100644
--- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
+++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
@@ -73,9 +73,8 @@ FloatRect screenAvailableRect(Widget* widget)
return PlatformSupport::screenAvailableRect(widget);
}
-void screenColorProfile(Widget*, ColorProfile& toProfile)
+void screenColorProfile(ColorProfile& toProfile)
{
- // FIXME: Add support for multiple monitors.
WebKit::WebVector<char> profile;
WebKit::Platform::current()->screenColorProfile(&profile);
toProfile.append(profile.data(), profile.size());
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp
index aae033514..970db2b84 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp
@@ -25,18 +25,27 @@
#include "config.h"
-#include "cc/CCCheckerboardDrawQuad.h"
+#include <public/WebCompositorCheckerboardQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorCheckerboardQuad> WebCompositorCheckerboardQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect)
{
- return adoptPtr(new CCCheckerboardDrawQuad(sharedQuadState, quadRect));
+ return adoptPtr(new WebCompositorCheckerboardQuad(sharedQuadState, quadRect));
}
-CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::Checkerboard, quadRect)
+WebCompositorCheckerboardQuad::WebCompositorCheckerboardQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::Checkerboard, quadRect)
{
}
+const WebCompositorCheckerboardQuad* WebCompositorCheckerboardQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::Checkerboard);
+ return static_cast<const WebCompositorCheckerboardQuad*>(quad);
+}
+
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp
index 1527c47c5..179f6c14f 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,17 +25,19 @@
#include "config.h"
-#include "cc/CCDebugBorderDrawQuad.h"
+#include <public/WebCompositorDebugBorderQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorDebugBorderQuad> WebCompositorDebugBorderQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
{
- return adoptPtr(new CCDebugBorderDrawQuad(sharedQuadState, quadRect, color, width));
+ return adoptPtr(new WebCompositorDebugBorderQuad(sharedQuadState, quadRect, color, width));
}
-CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::DebugBorder, quadRect)
+WebCompositorDebugBorderQuad::WebCompositorDebugBorderQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::DebugBorder, quadRect)
, m_color(color)
, m_width(width)
{
@@ -44,4 +46,10 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad
m_needsBlending = true;
}
+const WebCompositorDebugBorderQuad* WebCompositorDebugBorderQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::DebugBorder);
+ return static_cast<const WebCompositorDebugBorderQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp
index 2fdb4efcb..63a29314d 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp
@@ -25,20 +25,28 @@
#include "config.h"
-#include "cc/CCIOSurfaceDrawQuad.h"
+#include <public/WebCompositorIOSurfaceQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCIOSurfaceDrawQuad> CCIOSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
{
- return adoptPtr(new CCIOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId));
+ return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId));
}
-CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::IOSurfaceContent, quadRect)
+WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::IOSurfaceContent, quadRect)
, m_ioSurfaceSize(ioSurfaceSize)
, m_ioSurfaceTextureId(ioSurfaceTextureId)
{
}
+const WebCompositorIOSurfaceQuad* WebCompositorIOSurfaceQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::IOSurfaceContent);
+ return static_cast<const WebCompositorIOSurfaceQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp
new file mode 100644
index 000000000..7a02ca0ea
--- /dev/null
+++ b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <public/WebCompositorQuad.h>
+
+#include "IntRect.h"
+#include <public/WebCompositorCheckerboardQuad.h>
+#include <public/WebCompositorDebugBorderQuad.h>
+#include <public/WebCompositorIOSurfaceQuad.h>
+#include <public/WebCompositorSolidColorQuad.h>
+#include <public/WebCompositorStreamVideoQuad.h>
+#include <public/WebCompositorTextureQuad.h>
+#include <public/WebCompositorTileQuad.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebCompositorQuad::WebCompositorQuad(const WebCompositorSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect)
+ : m_sharedQuadState(sharedQuadState)
+ , m_material(material)
+ , m_quadRect(quadRect)
+ , m_quadVisibleRect(quadRect)
+ , m_quadOpaque(true)
+ , m_needsBlending(false)
+{
+ ASSERT(m_sharedQuadState);
+ ASSERT(m_material != Invalid);
+}
+
+IntRect WebCompositorQuad::opaqueRect() const
+{
+ if (opacity() != 1)
+ return IntRect();
+ if (m_sharedQuadState->opaque && m_quadOpaque)
+ return m_quadRect;
+ return m_opaqueRect;
+}
+
+void WebCompositorQuad::setQuadVisibleRect(const IntRect& quadVisibleRect)
+{
+ IntRect intersection = quadVisibleRect;
+ intersection.intersect(m_quadRect);
+ m_quadVisibleRect = intersection;
+}
+
+unsigned WebCompositorQuad::size() const
+{
+ switch (material()) {
+ case Checkerboard:
+ return sizeof(WebCompositorCheckerboardQuad);
+ case DebugBorder:
+ return sizeof(WebCompositorDebugBorderQuad);
+ case IOSurfaceContent:
+ return sizeof(WebCompositorIOSurfaceQuad);
+ case TextureContent:
+ return sizeof(WebCompositorTextureQuad);
+ case SolidColor:
+ return sizeof(WebCompositorSolidColorQuad);
+ case TiledContent:
+ return sizeof(WebCompositorTileQuad);
+ case StreamVideoContent:
+ return sizeof(WebCompositorStreamVideoQuad);
+ case Invalid:
+ case RenderPass:
+ case YUVVideoContent:
+ break;
+ }
+
+ CRASH();
+ return sizeof(WebCompositorQuad);
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp
index 5e0681ff5..313564c00 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,35 +25,42 @@
#include "config.h"
-#include "cc/CCSharedQuadState.h"
+#include <public/WebCompositorSharedQuadState.h>
+#include "FloatQuad.h"
#include "cc/CCMathUtil.h"
-using WebKit::WebTransformationMatrix;
+using WebCore::FloatQuad;
+using WebCore::IntRect;
-namespace WebCore {
+namespace WebKit {
-PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque)
+WebCompositorSharedQuadState::WebCompositorSharedQuadState()
+ : opacity(0)
+ , opaque(false)
{
- return adoptPtr(new CCSharedQuadState(quadTransform, layerTransform, layerRect, scissorRect, opacity, opaque));
}
-CCSharedQuadState::CCSharedQuadState(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque)
- : m_quadTransform(quadTransform)
- , m_layerTransform(layerTransform)
- , m_layerRect(layerRect)
- , m_scissorRect(scissorRect)
- , m_opacity(opacity)
- , m_opaque(opaque)
+PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque)
{
+ return adoptPtr(new WebCompositorSharedQuadState(quadTransform, visibleContentRect, scissorRect, opacity, opaque));
}
-bool CCSharedQuadState::isLayerAxisAlignedIntRect() const
+WebCompositorSharedQuadState::WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque)
+ : quadTransform(quadTransform)
+ , visibleContentRect(visibleContentRect)
+ , scissorRect(scissorRect)
+ , opacity(opacity)
+ , opaque(opaque)
+{
+}
+
+bool WebCompositorSharedQuadState::isLayerAxisAlignedIntRect() const
{
// Note: this doesn't consider window or projection matrices.
// Assume that they're orthonormal and have integer scales and translations.
bool clipped = false;
- FloatQuad quad = CCMathUtil::mapQuad(quadTransform(), FloatQuad(layerRect()), clipped);
+ FloatQuad quad = WebCore::CCMathUtil::mapQuad(quadTransform, FloatQuad(IntRect(visibleContentRect)), clipped);
return !clipped && quad.isRectilinear() && quad.boundingBox().isExpressibleAsIntRect();
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp
index 8668369b6..782458c72 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,17 +25,19 @@
#include "config.h"
-#include "cc/CCSolidColorDrawQuad.h"
+#include <public/WebCompositorSolidColorQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorSolidColorQuad> WebCompositorSolidColorQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
{
- return adoptPtr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color));
+ return adoptPtr(new WebCompositorSolidColorQuad(sharedQuadState, quadRect, color));
}
-CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect)
+WebCompositorSolidColorQuad::WebCompositorSolidColorQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::SolidColor, quadRect)
, m_color(color)
{
if (SkColorGetA(m_color) < 255)
@@ -44,4 +46,10 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt
m_opaqueRect = quadRect;
}
+const WebCompositorSolidColorQuad* WebCompositorSolidColorQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::SolidColor);
+ return static_cast<const WebCompositorSolidColorQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp
index 6a1ba2992..ae257aaf7 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp
@@ -25,20 +25,28 @@
#include "config.h"
-#include "cc/CCStreamVideoDrawQuad.h"
+#include <public/WebCompositorStreamVideoQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCStreamVideoDrawQuad> CCStreamVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorStreamVideoQuad> WebCompositorStreamVideoQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix)
{
- return adoptPtr(new CCStreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix));
+ return adoptPtr(new WebCompositorStreamVideoQuad(sharedQuadState, quadRect, textureId, matrix));
}
-CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::StreamVideoContent, quadRect)
+WebCompositorStreamVideoQuad::WebCompositorStreamVideoQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::StreamVideoContent, quadRect)
, m_textureId(textureId)
, m_matrix(matrix)
{
}
+const WebCompositorStreamVideoQuad* WebCompositorStreamVideoQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::StreamVideoContent);
+ return static_cast<const WebCompositorStreamVideoQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp
index bdbca95fb..e5f45fdc4 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp
@@ -25,17 +25,19 @@
#include "config.h"
-#include "cc/CCTextureDrawQuad.h"
+#include <public/WebCompositorTextureQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped)
{
- return adoptPtr(new CCTextureDrawQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped));
+ return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped));
}
-CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::TextureContent, quadRect)
+WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TextureContent, quadRect)
, m_textureId(textureId)
, m_premultipliedAlpha(premultipliedAlpha)
, m_uvRect(uvRect)
@@ -43,9 +45,15 @@ CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, c
{
}
-void CCTextureDrawQuad::setNeedsBlending()
+void WebCompositorTextureQuad::setNeedsBlending()
{
m_needsBlending = true;
}
+const WebCompositorTextureQuad* WebCompositorTextureQuad::materialCast(const WebKit::WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::TextureContent);
+ return static_cast<const WebCompositorTextureQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp
index b35b6f69f..27aa77508 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp
+++ b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,17 +25,19 @@
#include "config.h"
-#include "cc/CCTileDrawQuad.h"
+#include <public/WebCompositorTileQuad.h>
-namespace WebCore {
+using namespace WebCore;
-PassOwnPtr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
+namespace WebKit {
+
+PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
{
- return adoptPtr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));
+ return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));
}
-CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect)
+WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TiledContent, quadRect)
, m_textureId(textureId)
, m_textureOffset(textureOffset)
, m_textureSize(textureSize)
@@ -51,4 +53,10 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I
m_opaqueRect = opaqueRect;
}
+const WebCompositorTileQuad* WebCompositorTileQuad::materialCast(const WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::TiledContent);
+ return static_cast<const WebCompositorTileQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp
index 5332c2fbf..394da63f6 100644
--- a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp
+++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp
@@ -100,7 +100,7 @@ FloatRect screenAvailableRect(Widget* widget)
return screenRect(widget);
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp
index 04528591a..45460f8d3 100644
--- a/Source/WebCore/platform/graphics/BitmapImage.cpp
+++ b/Source/WebCore/platform/graphics/BitmapImage.cpp
@@ -304,7 +304,7 @@ NativeImagePtr BitmapImage::frameAtIndex(size_t index)
bool BitmapImage::frameIsCompleteAtIndex(size_t index)
{
if (!ensureFrameIsCached(index))
- return true; // Why would an invalid index return true here?
+ return false;
return m_frames[index].m_isComplete;
}
@@ -563,11 +563,4 @@ Color BitmapImage::solidColor() const
return m_solidColor;
}
-#if !USE(CG)
-void BitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum)
-{
- draw(ctx, dstRect, srcRect, styleColorSpace, op);
-}
-#endif
-
}
diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h
index 21885cdd4..f5bfeb145 100644
--- a/Source/WebCore/platform/graphics/BitmapImage.h
+++ b/Source/WebCore/platform/graphics/BitmapImage.h
@@ -199,7 +199,9 @@ protected:
virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator);
#endif
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
- void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
+#if USE(CG)
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
+#endif
#if (OS(WINCE) && !PLATFORM(QT))
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp
index 1fd52a919..e4e545a1b 100644
--- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp
+++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp
@@ -35,6 +35,16 @@
namespace WebCore {
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const
+{
+ return style->isHorizontalWritingMode() ? m_top : m_left;
+}
+
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const
+{
+ return style->isHorizontalWritingMode() ? m_bottom : m_right;
+}
+
FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const
{
return style->isHorizontalWritingMode() ? m_left : m_top;
diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h
index af9630880..921c84b90 100644
--- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h
+++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h
@@ -53,6 +53,8 @@ public:
inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; }
inline void setLeft(FractionalLayoutUnit value) { m_left = value; }
+ FractionalLayoutUnit logicalTop(const RenderStyle*) const;
+ FractionalLayoutUnit logicalBottom(const RenderStyle*) const;
FractionalLayoutUnit logicalLeft(const RenderStyle*) const;
FractionalLayoutUnit logicalRight(const RenderStyle*) const;
diff --git a/Source/WebCore/platform/graphics/FractionalLayoutRect.h b/Source/WebCore/platform/graphics/FractionalLayoutRect.h
index d91be931a..a06d17508 100644
--- a/Source/WebCore/platform/graphics/FractionalLayoutRect.h
+++ b/Source/WebCore/platform/graphics/FractionalLayoutRect.h
@@ -31,6 +31,7 @@
#ifndef FractionalLayoutRect_h
#define FractionalLayoutRect_h
+#include "FractionalLayoutBoxExtent.h"
#include "FractionalLayoutPoint.h"
#include "IntRect.h"
#include <wtf/Vector.h>
@@ -99,6 +100,11 @@ public:
void move(FractionalLayoutUnit dx, FractionalLayoutUnit dy) { m_location.move(dx, dy); }
void expand(const FractionalLayoutSize& size) { m_size += size; }
+ void expand(const FractionalLayoutBoxExtent& box)
+ {
+ m_location.move(-box.left(), -box.top());
+ m_size.expand(box.left() + box.right(), box.top() + box.bottom());
+ }
void expand(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(dw, dh); }
void contract(const FractionalLayoutSize& size) { m_size -= size; }
void contract(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(-dw, -dh); }
diff --git a/Source/WebCore/platform/graphics/Gradient.h b/Source/WebCore/platform/graphics/Gradient.h
index 5e36ff3c3..6ae483ac8 100644
--- a/Source/WebCore/platform/graphics/Gradient.h
+++ b/Source/WebCore/platform/graphics/Gradient.h
@@ -39,7 +39,7 @@
typedef struct CGContext* CGContextRef;
-#define USE_CG_SHADING defined(BUILDING_ON_LEOPARD)
+#define USE_CG_SHADING (PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050)
#if USE_CG_SHADING
typedef struct CGShading* CGShadingRef;
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
index bf1f8c056..6664b8644 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
@@ -490,10 +490,7 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const
#endif
}
- if (image->isBitmapImage())
- static_cast<BitmapImage*>(image)->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation);
- else
- image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
+ image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation);
if (useLowQualityScale)
setImageInterpolationQuality(previousInterpolationQuality);
diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h
index 51eef09c5..1e6184293 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h
@@ -956,10 +956,7 @@ public:
ANGLEWebKitBridge m_compiler;
#endif
-#if PLATFORM(QT) && defined(QT_OPENGL_ES_2)
- friend class Extensions3DQt;
- OwnPtr<Extensions3DQt> m_extensions;
-#elif PLATFORM(BLACKBERRY)
+#if PLATFORM(BLACKBERRY) || (PLATFORM(QT) && defined(QT_OPENGL_ES_2))
friend class Extensions3DOpenGLES;
OwnPtr<Extensions3DOpenGLES> m_extensions;
#elif !PLATFORM(CHROMIUM)
diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp
index 9a52fb67b..dda637311 100644
--- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp
@@ -79,6 +79,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
, m_acceleratesDrawing(false)
, m_maintainsPixelAlignment(false)
, m_appliesPageScale(false)
+ , m_usingTileCache(false)
, m_paintingPhase(GraphicsLayerPaintAll)
, m_contentsOrientation(CompositingCoordinatesTopDown)
, m_parent(0)
@@ -340,9 +341,7 @@ void GraphicsLayer::updateDebugIndicators()
{
if (GraphicsLayer::showDebugBorders()) {
if (drawsContent()) {
- // FIXME: It's weird to ask the client if this layer is a tile cache layer.
- // Maybe we should just cache that information inside GraphicsLayer?
- if (m_client->shouldUseTileCache(this)) // tile cache layer: dark blue
+ if (m_usingTileCache) // tile cache layer: dark blue
setDebugBorder(Color(0, 0, 128, 128), 0.5);
else if (m_usingTiledLayer)
setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange
diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h
index 7939717fa..ccd61fb9e 100644
--- a/Source/WebCore/platform/graphics/GraphicsLayer.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h
@@ -466,6 +466,7 @@ protected:
bool m_acceleratesDrawing : 1;
bool m_maintainsPixelAlignment : 1;
bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
+ bool m_usingTileCache : 1;
GraphicsLayerPaintingPhase m_paintingPhase;
CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp
index aa022a24e..ef8232c5d 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp
@@ -18,12 +18,11 @@
*/
#include "config.h"
-#include "TextureMapperAnimation.h"
+#include "GraphicsLayerAnimation.h"
#include "UnitBezier.h"
#include <wtf/CurrentTime.h>
-#if USE(TEXTURE_MAPPER)
namespace WebCore {
@@ -145,7 +144,7 @@ static TransformationMatrix applyTransformAnimation(const TransformOperations* f
}
-TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
+GraphicsLayerAnimation::GraphicsLayerAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
: m_keyframes(keyframes)
, m_boxSize(boxSize)
, m_animation(Animation::create(animation))
@@ -156,21 +155,21 @@ TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframe
{
}
-void TextureMapperAnimation::applyInternal(TextureMapperAnimationClient* client, const AnimationValue* from, const AnimationValue* to, float progress)
+void GraphicsLayerAnimation::applyInternal(Client* client, const AnimationValue* from, const AnimationValue* to, float progress)
{
switch (m_keyframes.property()) {
case AnimatedPropertyOpacity:
- client->setOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
+ client->setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
return;
case AnimatedPropertyWebkitTransform:
- client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
+ client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
return;
default:
ASSERT_NOT_REACHED();
}
}
-bool TextureMapperAnimation::isActive() const
+bool GraphicsLayerAnimation::isActive() const
{
if (state() != StoppedState)
return true;
@@ -178,11 +177,11 @@ bool TextureMapperAnimation::isActive() const
return m_animation->fillsForwards();
}
-bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
+bool GraphicsLayerAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
{
- HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end();
- for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
- const Vector<TextureMapperAnimation>& animations = it->second;
+ HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end();
+ for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
+ const Vector<GraphicsLayerAnimation>& animations = it->second;
for (size_t i = 0; i < animations.size(); ++i) {
if (animations[i].isActive() && animations[i].property() == type)
return true;
@@ -191,13 +190,13 @@ bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type)
return false;
}
-bool TextureMapperAnimations::hasRunningAnimations() const
+bool GraphicsLayerAnimations::hasRunningAnimations() const
{
- HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end();
- for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
- const Vector<TextureMapperAnimation>& animations = it->second;
+ HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end();
+ for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
+ const Vector<GraphicsLayerAnimation>& animations = it->second;
for (size_t i = 0; i < animations.size(); ++i) {
- if (animations[i].state() == TextureMapperAnimation::PlayingState)
+ if (animations[i].state() == GraphicsLayerAnimation::PlayingState)
return true;
}
}
@@ -205,7 +204,7 @@ bool TextureMapperAnimations::hasRunningAnimations() const
return false;
}
-void TextureMapperAnimation::apply(TextureMapperAnimationClient* client)
+void GraphicsLayerAnimation::apply(Client* client)
{
if (state() == StoppedState)
return;
@@ -244,29 +243,29 @@ void TextureMapperAnimation::apply(TextureMapperAnimationClient* client)
}
}
-void TextureMapperAnimation::pause(double offset)
+void GraphicsLayerAnimation::pause(double offset)
{
// FIXME: should apply offset here.
setState(PausedState);
m_pauseTime = WTF::currentTime() - offset;
}
-void TextureMapperAnimations::add(const String& name, const TextureMapperAnimation& animation)
+void GraphicsLayerAnimations::add(const String& name, const GraphicsLayerAnimation& animation)
{
- HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name);
+ HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name);
if (it != m_animations.end()) {
it->second.append(animation);
return;
}
- Vector<TextureMapperAnimation> animations;
+ Vector<GraphicsLayerAnimation> animations;
animations.append(animation);
m_animations.add(name, animations);
}
-void TextureMapperAnimations::pause(const String& name, double offset)
+void GraphicsLayerAnimations::pause(const String& name, double offset)
{
- HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name);
+ HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name);
if (it == m_animations.end())
return;
@@ -274,14 +273,13 @@ void TextureMapperAnimations::pause(const String& name, double offset)
it->second[i].pause(offset);
}
-void TextureMapperAnimations::apply(TextureMapperAnimationClient* client)
+void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client)
{
- HashMap<String, Vector<TextureMapperAnimation> >::iterator end = m_animations.end();
- for (HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.begin(); it != end; ++it) {
+ HashMap<String, Vector<GraphicsLayerAnimation> >::iterator end = m_animations.end();
+ for (HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.begin(); it != end; ++it) {
for (size_t i = 0; i < it->second.size(); ++i)
it->second[i].apply(client);
}
}
}
-#endif
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h
index d0e90b518..2fbc05a12 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h
@@ -17,32 +17,30 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef TextureMapperAnimation_h
-#define TextureMapperAnimation_h
+#ifndef GraphicsLayerAnimation_h
+#define GraphicsLayerAnimation_h
#include "GraphicsLayer.h"
#include "TransformationMatrix.h"
#include <wtf/HashMap.h>
#include <wtf/text/StringHash.h>
-#if USE(TEXTURE_MAPPER)
namespace WebCore {
-class TextureMapperAnimationClient {
-public:
- virtual void setTransform(const TransformationMatrix&) = 0;
- virtual void setOpacity(float) = 0;
-};
-
-class TextureMapperAnimation {
+class GraphicsLayerAnimation {
public:
enum AnimationState { PlayingState, PausedState, StoppedState };
+ class Client {
+ public:
+ virtual void setAnimatedTransform(const TransformationMatrix&) = 0;
+ virtual void setAnimatedOpacity(float) = 0;
+ };
- TextureMapperAnimation()
+ GraphicsLayerAnimation()
: m_keyframes(AnimatedPropertyInvalid)
{ }
- TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
- void apply(TextureMapperAnimationClient*);
+ GraphicsLayerAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
+ void apply(Client*);
void pause(double);
AnimationState state() const { return m_state; }
void setState(AnimationState s) { m_state = s; }
@@ -50,7 +48,7 @@ public:
bool isActive() const;
private:
- void applyInternal(TextureMapperAnimationClient*, const AnimationValue* from, const AnimationValue* to, float progress);
+ void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress);
KeyframeValueList m_keyframes;
IntSize m_boxSize;
RefPtr<Animation> m_animation;
@@ -62,24 +60,22 @@ private:
AnimationState m_state;
};
-class TextureMapperAnimations {
+class GraphicsLayerAnimations {
public:
- TextureMapperAnimations() { }
+ GraphicsLayerAnimations() { }
- void add(const String&, const TextureMapperAnimation&);
+ void add(const String&, const GraphicsLayerAnimation&);
void remove(const String& name) { m_animations.remove(name); }
void pause(const String&, double);
- void apply(TextureMapperAnimationClient*);
+ void apply(GraphicsLayerAnimation::Client*);
bool isEmpty() const { return m_animations.isEmpty(); }
bool hasRunningAnimations() const;
bool hasActiveAnimationsOfType(AnimatedPropertyID type) const;
private:
- HashMap<String, Vector<TextureMapperAnimation> > m_animations;
+ HashMap<String, Vector<GraphicsLayerAnimation> > m_animations;
};
}
-#endif // USE(TEXTURE_MAPPER)
-
-#endif // TextureMapperAnimation_h
+#endif // GraphicsLayerAnimation_h
diff --git a/Source/WebCore/platform/graphics/GraphicsLayerClient.h b/Source/WebCore/platform/graphics/GraphicsLayerClient.h
index 36a7f4365..7049e4226 100644
--- a/Source/WebCore/platform/graphics/GraphicsLayerClient.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayerClient.h
@@ -56,6 +56,7 @@ public:
virtual ~GraphicsLayerClient() {}
virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
+ virtual bool usingTileCache(const GraphicsLayer*) const { return false; }
// Callback for when hardware-accelerated animation started.
virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp
index 1c3c02e57..77cac87d6 100644
--- a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp
@@ -18,60 +18,60 @@
*/
#include "config.h"
-#include "LayerTransform.h"
+#include "GraphicsLayerTransform.h"
namespace WebCore {
-LayerTransform::LayerTransform()
-: m_flattening(false)
-, m_dirty(false) // false by default since all default values would be combined as the identity matrix
-, m_childrenDirty(false)
+GraphicsLayerTransform::GraphicsLayerTransform()
+ : m_flattening(false)
+ , m_dirty(false) // false by default since all default values would be combined as the identity matrix
+ , m_childrenDirty(false)
{
}
-void LayerTransform::setPosition(const FloatPoint& position)
+void GraphicsLayerTransform::setPosition(const FloatPoint& position)
{
m_position = position;
m_dirty = true;
}
-void LayerTransform::setSize(const FloatSize& size)
+void GraphicsLayerTransform::setSize(const FloatSize& size)
{
m_size = size;
m_dirty = true;
}
-void LayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint)
+void GraphicsLayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint)
{
m_anchorPoint = anchorPoint;
m_dirty = true;
}
-void LayerTransform::setFlattening(bool flattening)
+void GraphicsLayerTransform::setFlattening(bool flattening)
{
m_flattening = flattening;
m_dirty = true;
}
-void LayerTransform::setLocalTransform(const TransformationMatrix& transform)
+void GraphicsLayerTransform::setLocalTransform(const TransformationMatrix& transform)
{
m_local = transform;
m_dirty = true;
}
-void LayerTransform::setChildrenTransform(const TransformationMatrix& transform)
+void GraphicsLayerTransform::setChildrenTransform(const TransformationMatrix& transform)
{
m_children = transform;
m_dirty = true;
}
-TransformationMatrix LayerTransform::combined()
+TransformationMatrix GraphicsLayerTransform::combined()
{
ASSERT(!m_dirty);
return m_combined;
}
-TransformationMatrix LayerTransform::combinedForChildren()
+TransformationMatrix GraphicsLayerTransform::combinedForChildren()
{
ASSERT(!m_dirty);
if (m_childrenDirty)
@@ -79,7 +79,7 @@ TransformationMatrix LayerTransform::combinedForChildren()
return m_combinedForChildren;
}
-void LayerTransform::combineTransforms(const TransformationMatrix& parentTransform)
+void GraphicsLayerTransform::combineTransforms(const TransformationMatrix& parentTransform)
{
float originX = m_anchorPoint.x() * m_size.width();
float originY = m_anchorPoint.y() * m_size.height();
@@ -96,7 +96,7 @@ void LayerTransform::combineTransforms(const TransformationMatrix& parentTransfo
m_childrenDirty = true;
}
-void LayerTransform::combineTransformsForChildren()
+void GraphicsLayerTransform::combineTransformsForChildren()
{
ASSERT(!m_dirty);
ASSERT(m_childrenDirty);
diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.h b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h
index b73818501..5da25b4d8 100644
--- a/Source/WebCore/platform/graphics/texmap/LayerTransform.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h
@@ -17,8 +17,8 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef LayerTransform_h
-#define LayerTransform_h
+#ifndef GraphicsLayerTransform_h
+#define GraphicsLayerTransform_h
#include "FloatPoint.h"
#include "FloatPoint3D.h"
@@ -27,9 +27,9 @@
namespace WebCore {
-class LayerTransform {
+class GraphicsLayerTransform {
public:
- LayerTransform();
+ GraphicsLayerTransform();
void setPosition(const FloatPoint&);
void setSize(const FloatSize&);
void setAnchorPoint(const FloatPoint3D&);
@@ -59,4 +59,4 @@ private:
}
-#endif // LayerTransform_h
+#endif // GraphicsLayerTransform_h
diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp
index 0ace7ac20..2b19f1349 100644
--- a/Source/WebCore/platform/graphics/Image.cpp
+++ b/Source/WebCore/platform/graphics/Image.cpp
@@ -89,6 +89,11 @@ void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect,
ctxt->setCompositeOperation(previousOperator);
}
+void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum)
+{
+ draw(ctx, dstRect, srcRect, styleColorSpace, op);
+}
+
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op)
{
if (mayFillWithSolidColor()) {
diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h
index 3ff48236a..a6b949047 100644
--- a/Source/WebCore/platform/graphics/Image.h
+++ b/Source/WebCore/platform/graphics/Image.h
@@ -181,6 +181,7 @@ protected:
virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator) { }
#endif
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0;
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator);
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp
index 73aacd496..ec622437e 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -208,7 +208,7 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines()
enginesQueried = true;
#if USE(AVFOUNDATION)
- if (Settings::isAVFoundationEnabled()) {
+ if (1 /* @@Settings::isAVFoundationEnabled() @@ */) {
#if PLATFORM(MAC)
MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngine);
#elif PLATFORM(WIN)
@@ -1068,6 +1068,16 @@ String MediaPlayer::userAgent() const
return m_mediaPlayerClient->mediaPlayerUserAgent();
}
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+GraphicsDeviceAdapter* MediaPlayer::graphicsDeviceAdapter() const
+{
+ if (!m_mediaPlayerClient)
+ return 0;
+
+ return m_mediaPlayerClient->mediaPlayerGraphicsDeviceAdapter(this);
+}
+#endif
+
}
#endif
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h
index 8eb728596..3b382d83a 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.h
+++ b/Source/WebCore/platform/graphics/MediaPlayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -99,6 +99,10 @@ class MediaPlayer;
struct MediaPlayerFactory;
class TimeRanges;
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+struct GraphicsDeviceAdapter;
+#endif
+
class MediaPlayerClient {
public:
enum CORSMode { Unspecified, Anonymous, UseCredentials };
@@ -165,6 +169,10 @@ public:
virtual void mediaPlayerRenderingModeChanged(MediaPlayer*) { }
#endif
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+ virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const { return 0; }
+#endif
+
#if ENABLE(MEDIA_SOURCE)
virtual void mediaPlayerSourceOpened() { }
virtual String mediaPlayerSourceURL() const { return "x-media-source-unsupported:"; }
@@ -356,6 +364,10 @@ public:
void acceleratedRenderingStateChanged();
#endif
+#if PLATFORM(WIN) && USE(AVFOUNDATION)
+ GraphicsDeviceAdapter* graphicsDeviceAdapter() const;
+#endif
+
bool hasSingleSecurityOrigin() const;
bool didPassCORSAccessCheck() const;
diff --git a/Source/WebCore/platform/graphics/OpenGLESShims.h b/Source/WebCore/platform/graphics/OpenGLESShims.h
index 052af5e45..4e0951201 100644
--- a/Source/WebCore/platform/graphics/OpenGLESShims.h
+++ b/Source/WebCore/platform/graphics/OpenGLESShims.h
@@ -26,7 +26,7 @@
#ifndef OpenGLESShims_h
#define OpenGLESShims_h
-#if PLATFORM(BLACKBERRY)
+#if PLATFORM(BLACKBERRY) || PLATFORM(QT)
#define glBindFramebufferEXT glBindFramebuffer
#define glFramebufferTexture2DEXT glFramebufferTexture2D
#define glBindRenderbufferEXT glBindRenderbuffer
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h
index 04098002d..95b9403bf 100644
--- a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h
+++ b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -177,6 +177,8 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCopyAudiovisualMIMETypes, CFArr
SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCreateWithURLAndOptions, AVCFURLAssetRef, __cdecl, (CFAllocatorRef allocator, CFURLRef URL, CFDictionaryRef options, dispatch_queue_t notificationQueue), (allocator, URL, options, notificationQueue))
#define AVCFURLAssetCreateWithURLAndOptions softLink_AVCFURLAssetCreateWithURLAndOptions
+SOFT_LINK_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerSetDirect3DDevice, void, __cdecl, (AVCFPlayerRef player, IDirect3DDevice9* d3dDevice))
+
// Variables
SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetImageGeneratorApertureModeCleanAperture, const CFStringRef);
@@ -244,3 +246,6 @@ SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemTracksChangedNotific
SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerRateChangedNotification, const CFStringRef);
#define AVCFPlayerRateChangedNotification get_AVCFPlayerRateChangedNotification()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, const CFStringRef);
+#define AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey get_AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey()
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
index a9f39a40d..81d862981 100644
--- a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
+++ b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 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 "MediaPlayerPrivateAVFoundationCF.h"
#include "ApplicationCacheResource.h"
+#include "COMPtr.h"
#include "FloatConversion.h"
#include "FrameView.h"
#include "GraphicsContext.h"
@@ -44,9 +45,9 @@
#include <AVFoundationCF/AVCFPlayerLayer.h>
#include <AVFoundationCF/AVFoundationCF.h>
#include <CoreMedia/CoreMedia.h>
-
#include <delayimp.h>
#include <dispatch/dispatch.h>
+#include <WebKitQuartzCoreAdditions/WKCACFTypes.h>
#include <wtf/HashMap.h>
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
@@ -87,7 +88,7 @@ public:
void createAssetForURL(const String& url);
void setAsset(AVCFURLAssetRef);
- void createPlayer();
+ void createPlayer(IDirect3DDevice9*);
void createPlayerItem();
void checkPlayability();
@@ -137,6 +138,7 @@ private:
RefPtr<PlatformCALayer> m_videoLayerWrapper;
OwnPtr<LayerClient> m_layerClient;
+ COMPtr<IDirect3DDevice9Ex> m_d3dDevice;
};
uintptr_t AVFWrapper::s_nextAVFWrapperObjectID;
@@ -339,7 +341,7 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayer()
ASSERT(m_avfWrapper);
setDelayCallbacks(true);
- m_avfWrapper->createPlayer();
+ m_avfWrapper->createPlayer(reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter()));
setDelayCallbacks(false);
}
@@ -355,8 +357,9 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayerItem()
void MediaPlayerPrivateAVFoundationCF::createAVAssetForURL(const String& url)
{
ASSERT(!m_avfWrapper);
-
+
setDelayCallbacks(true);
+
m_avfWrapper = new AVFWrapper(this);
m_avfWrapper->createAssetForURL(url);
setDelayCallbacks(false);
@@ -955,20 +958,36 @@ void AVFWrapper::disconnectAndDeleteAVFWrapper(void* context)
void AVFWrapper::createAssetForURL(const String& url)
{
ASSERT(!avAsset());
-
+
RetainPtr<CFURLRef> urlRef(AdoptCF, KURL(ParsedURLString, url).createCFURL());
+
AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue);
m_avAsset.adoptCF(assetRef);
}
-void AVFWrapper::createPlayer()
+void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
{
ASSERT(!avPlayer() && avPlayerItem());
+ RetainPtr<CFMutableDictionaryRef> optionsRef(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ if (d3dDevice) {
+ // QI for an IDirect3DDevice9Ex interface, it is required to do HW video decoding.
+ COMPtr<IDirect3DDevice9Ex> d3dEx(Query, d3dDevice);
+ m_d3dDevice = d3dEx;
+ } else
+ m_d3dDevice = 0;
+
+ if (m_d3dDevice && AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey)
+ CFDictionarySetValue(optionsRef.get(), AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, kCFBooleanTrue);
+
// FIXME: We need a way to create a AVPlayer without an AVPlayerItem, see <rdar://problem/9877730>.
- AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), 0, m_notificationQueue);
+ AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), optionsRef.get(), m_notificationQueue);
m_avPlayer.adoptCF(playerRef);
+ if (m_d3dDevice && AVCFPlayerSetDirect3DDevicePtr())
+ AVCFPlayerSetDirect3DDevicePtr()(playerRef, m_d3dDevice.get());
+
CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter();
ASSERT(center);
diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
index a26141daf..59a72f789 100644
--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
@@ -258,7 +258,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
[options.get() setObject:[NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote] forKey:AVURLAssetReferenceRestrictionsKey];
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
RetainPtr<NSMutableDictionary> headerFields(AdoptNS, [[NSMutableDictionary alloc] init]);
String referrer = player()->referrer();
diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
index 55d479b8a..e3a565d18 100644
--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
@@ -247,7 +247,7 @@ static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList,
static inline bool supportsAcceleratedFilterAnimations()
{
// <rdar://problem/10907251> - WebKit2 doesn't support CA animations of CI filters on Lion and below
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080)
return true;
#else
return false;
@@ -268,8 +268,10 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client)
, m_uncommittedChanges(0)
{
PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
- if (client && client->shouldUseTileCache(this))
+ if (client && client->shouldUseTileCache(this)) {
layerType = PlatformCALayer::LayerTypeTileCacheLayer;
+ m_usingTileCache = true;
+ }
m_layer = PlatformCALayer::create(layerType, this);
@@ -1881,7 +1883,7 @@ bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValue
int numAnimations = isMatrixAnimation ? 1 : operations->size();
bool reverseAnimationList = true;
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(WIN)
+#if !PLATFORM(IOS) && !PLATFORM(WIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// Old versions of Core Animation apply animations in reverse order (<rdar://problem/7095638>) so we need to flip the list.
// to be non-additive. For binary compatibility, the current version of Core Animation preserves this behavior for applications linked
// on or before Snow Leopard.
@@ -2390,7 +2392,7 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
FloatSize GraphicsLayerCA::constrainedSize() const
{
FloatSize constrainedSize = m_size;
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
float tileColumns = ceilf(m_size.width() / kTiledLayerTileSize);
float tileRows = ceilf(m_size.height() / kTiledLayerTileSize);
double numTiles = tileColumns * tileRows;
diff --git a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
index 002b7a07a..1ed94115c 100644
--- a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
+++ b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
@@ -213,7 +213,7 @@ public:
void printTree() const;
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
void synchronouslyDisplayTilesInRect(const FloatRect&);
#endif
diff --git a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
index 3a7ac781f..f28967c51 100644
--- a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
+++ b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
@@ -93,7 +93,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t)
@end
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
@interface CATiledLayer(GraphicsLayerCAPrivate)
- (void)displayInRect:(CGRect)r levelOfDetail:(int)lod options:(NSDictionary *)dict;
- (BOOL)canDrawConcurrently;
@@ -103,7 +103,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t)
@interface CALayer(Private)
- (void)setContentsChanged;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- (void)setAcceleratesDrawing:(BOOL)flag;
- (BOOL)acceleratesDrawing;
#endif
@@ -554,7 +554,7 @@ void PlatformCALayer::setMasksToBounds(bool value)
bool PlatformCALayer::acceleratesDrawing() const
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
return [m_layer.get() acceleratesDrawing];
#else
return false;
@@ -563,7 +563,7 @@ bool PlatformCALayer::acceleratesDrawing() const
void PlatformCALayer::setAcceleratesDrawing(bool acceleratesDrawing)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
BEGIN_BLOCK_OBJC_EXCEPTIONS
[m_layer.get() setAcceleratesDrawing:acceleratesDrawing];
END_BLOCK_OBJC_EXCEPTIONS
@@ -910,7 +910,7 @@ void PlatformCALayer::setTimeOffset(CFTimeInterval value)
float PlatformCALayer::contentsScale() const
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
return [m_layer.get() contentsScale];
#else
return 1;
@@ -919,7 +919,7 @@ float PlatformCALayer::contentsScale() const
void PlatformCALayer::setContentsScale(float value)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
BEGIN_BLOCK_OBJC_EXCEPTIONS
[m_layer.get() setContentsScale:value];
END_BLOCK_OBJC_EXCEPTIONS
@@ -937,7 +937,7 @@ TiledBacking* PlatformCALayer::tiledBacking()
return [tileCacheLayer tiledBacking];
}
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void PlatformCALayer::synchronouslyDisplayTilesInRect(const FloatRect& rect)
{
if (m_layerType != LayerTypeWebTiledLayer)
diff --git a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm
index 59d8b1f9b..f79c63b29 100644
--- a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm
+++ b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm
@@ -36,7 +36,7 @@
using namespace std;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
@interface CALayer (WebCALayerDetails)
- (void)setAcceleratesDrawing:(BOOL)flag;
@end
@@ -157,7 +157,7 @@ void TileCache::setScale(CGFloat scale)
if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor)
return;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
Vector<FloatRect> dirtyRects;
m_deviceScaleFactor = deviceScaleFactor;
@@ -182,7 +182,7 @@ void TileCache::setScale(CGFloat scale)
void TileCache::setAcceleratesDrawing(bool acceleratesDrawing)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (m_acceleratesDrawing == acceleratesDrawing)
return;
@@ -401,7 +401,7 @@ RetainPtr<WebTileLayer> TileCache::createTileLayer(const IntRect& tileRect)
[layer.get() setName:@"Tile"];
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
[layer.get() setContentsScale:m_deviceScaleFactor];
[layer.get() setAcceleratesDrawing:m_acceleratesDrawing];
#endif
diff --git a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
index 2b82377d8..6628b92be 100644
--- a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
+++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,6 +46,10 @@ struct WKCACFContext;
typedef struct CGImage* CGImageRef;
+#if USE(AVFOUNDATION)
+struct GraphicsDeviceAdapter;
+#endif
+
namespace WebCore {
class CACFLayerTreeHostClient;
@@ -66,6 +70,9 @@ public:
virtual void resize() = 0;
void flushPendingGraphicsLayerChangesSoon();
virtual void setShouldInvertColors(bool);
+#if USE(AVFOUNDATION)
+ virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; }
+#endif
// AbstractCACFLayerTreeHost
virtual void flushPendingLayerChangesNow();
diff --git a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h
index bfa530b92..5662fed5c 100644
--- a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h
+++ b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,6 +64,10 @@ private:
virtual void paint();
virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
+#if USE(AVFOUNDATION)
+ virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE { return 0; }
+#endif
+
Timer<LegacyCACFLayerTreeHost> m_renderTimer;
COMPtr<IDirect3DDevice9> m_d3dDevice;
WKCACFContext* m_context;
diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp
index 2b47a3e1d..d945c3e2e 100644
--- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp
+++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,6 +61,7 @@ SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextDidChangeCallback, void
SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewGetLastCommitTime, CFTimeInterval, __cdecl, (WKCACFViewRef view), (view))
SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextUserData, void, __cdecl, (WKCACFViewRef view, void* userData), (view, userData))
SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewSetShouldInvertColors, void, _cdecl, (WKCACFViewRef view, bool shouldInvertColors))
+SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewGetD3DDevice9, IDirect3DDevice9*, _cdecl, (WKCACFViewRef view))
PassRefPtr<WKCACFViewLayerTreeHost> WKCACFViewLayerTreeHost::create()
{
@@ -175,6 +176,16 @@ void WKCACFViewLayerTreeHost::setShouldInvertColors(bool shouldInvertColors)
WKCACFViewSetShouldInvertColorsPtr()(m_view.get(), shouldInvertColors);
}
+#if USE(AVFOUNDATION)
+GraphicsDeviceAdapter* WKCACFViewLayerTreeHost::graphicsDeviceAdapter() const
+{
+ if (!WKCACFViewGetD3DDevice9Ptr())
+ return 0;
+
+ return reinterpret_cast<GraphicsDeviceAdapter*>(WKCACFViewGetD3DDevice9Ptr()(m_view.get()));
+}
+#endif
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h
index 2660e43d1..567157125 100644
--- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h
+++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,6 +54,9 @@ private:
virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
virtual CFTimeInterval lastCommitTime() const;
virtual void setShouldInvertColors(bool);
+#if USE(AVFOUNDATION)
+ virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE;
+#endif
RetainPtr<WKCACFViewRef> m_view;
bool m_viewNeedsUpdate;
diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
index 5e5f56853..3b4c9ccf3 100644
--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
@@ -29,7 +29,6 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "BitmapImage.h"
#include "CairoUtilities.h"
#include "Color.h"
@@ -43,6 +42,7 @@
#include "RefPtrCairo.h"
#include <cairo.h>
#include <wtf/Vector.h>
+#include <wtf/text/Base64.h>
using namespace std;
diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 748946820..2657d5412 100644
--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -54,12 +54,12 @@
#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
-#ifndef BUILDING_ON_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
// Building on 10.6 or later: kCGInterpolationMedium is defined in the CGInterpolationQuality enum.
#define HAVE_CG_INTERPOLATION_MEDIUM 1
#endif
-#ifndef TARGETING_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// Targeting 10.6 or later: use kCGInterpolationMedium.
#define WTF_USE_CG_INTERPOLATION_MEDIUM 1
#endif
@@ -1181,7 +1181,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con
blurRadius = min(blurRadius, narrowPrecisionToCGFloat(1000.0));
-#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
if (!isAcceleratedContext()) {
// Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
// to the desired integer. Also see: <rdar://problem/10056277>
@@ -1598,7 +1598,7 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
void GraphicsContext::setAllowsFontSmoothing(bool allowsFontSmoothing)
{
UNUSED_PARAM(allowsFontSmoothing);
-#if !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
CGContextRef context = platformContext();
CGContextSetAllowsFontSmoothing(context, allowsFontSmoothing);
#endif
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index 81982a188..21e9db4c2 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -28,7 +28,6 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "BitmapImage.h"
#include "GraphicsContext.h"
#include "GraphicsContextCG.h"
@@ -42,6 +41,7 @@
#include <wtf/OwnArrayPtr.h>
#include <wtf/RetainPtr.h>
#include <wtf/UnusedParam.h>
+#include <wtf/text/Base64.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
@@ -52,7 +52,7 @@
#include <IOSurface/IOSurface.h>
#endif
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
#include <wtf/CurrentTime.h>
#endif
@@ -183,7 +183,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace
m_context->scale(FloatSize(1, -1));
m_context->translate(0, -size.height());
m_context->setIsAcceleratedContext(accelerateRendering);
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
m_data.m_lastFlushTime = currentTimeMS();
#endif
success = true;
@@ -195,7 +195,7 @@ ImageBuffer::~ImageBuffer()
GraphicsContext* ImageBuffer::context() const
{
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
// Force a flush if last flush was more than 20ms ago
if (m_context->isAcceleratedContext()) {
double elapsedTime = currentTimeMS() - m_data.m_lastFlushTime;
@@ -250,7 +250,7 @@ NativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
else {
image = wkIOSurfaceContextCreateImage(context()->platformContext());
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
m_data.m_lastFlushTime = currentTimeMS();
#endif
}
@@ -310,7 +310,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getUnmultipliedImageData(const IntRec
{
if (m_context->isAcceleratedContext()) {
CGContextFlush(context()->platformContext());
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
m_data.m_lastFlushTime = currentTimeMS();
#endif
}
@@ -321,7 +321,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getPremultipliedImageData(const IntRe
{
if (m_context->isAcceleratedContext()) {
CGContextFlush(context()->platformContext());
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
m_data.m_lastFlushTime = currentTimeMS();
#endif
}
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
index 5e3ae78a8..649d9b766 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
@@ -62,7 +62,7 @@ ImageBufferData::ImageBufferData(const IntSize&)
#if USE(ACCELERATE)
-#ifndef TARGETING_SNOW_LEOPARD
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
static bool haveVImageRoundingErrorFix() { return true; }
#else
// The vImage unpremultiply routine had a rounding bug before 10.6.7 <rdar://problem/8631548>
@@ -72,7 +72,7 @@ static bool haveVImageRoundingErrorFix()
static bool result = (Gestalt(gestaltSystemVersion, &version) == noErr && version > 0x1066);
return result;
}
-#endif // TARGETING_SNOW_LEOPARD
+#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
static void convertScanline(void* data, size_t tileNumber, bool premultiply)
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h
index 6233c6c2c..8e61edff9 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h
@@ -30,7 +30,7 @@
#include <wtf/RetainPtr.h>
#include <wtf/Uint8ClampedArray.h>
-#if (PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
+#if (PLATFORM(MAC) && USE(CA) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070))
#define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1
#endif
@@ -54,7 +54,7 @@ public:
Checked<unsigned, RecordOverflow> m_bytesPerRow;
CGColorSpaceRef m_colorSpace;
RetainPtr<IOSurfaceRef> m_surface;
-#if defined(BUILDING_ON_LION)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
mutable double m_lastFlushTime;
#endif
diff --git a/Source/WebCore/platform/graphics/cg/ImageCG.cpp b/Source/WebCore/platform/graphics/cg/ImageCG.cpp
index fed911aeb..2c0cca22b 100644
--- a/Source/WebCore/platform/graphics/cg/ImageCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageCG.cpp
@@ -269,7 +269,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
// FIXME: We cannot use CGContextDrawTiledImage with scaled tiles on Leopard, because it suffers from rounding errors. Snow Leopard is ok.
float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a());
float w = CGImageGetWidth(tileImage);
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
if (w == size().width() && h == size().height() && scaledTileWidth == tileRect.width() && scaledTileHeight == tileRect.height())
#else
if (w == size().width() && h == size().height())
diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
index 43353650c..7cf02968e 100644
--- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -85,7 +85,7 @@ ImageSource::~ImageSource()
void ImageSource::clear(bool destroyAllFrames, size_t, SharedBuffer* data, bool allDataReceived)
{
-#if !defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// Recent versions of ImageIO discard previously decoded image frames if the client
// application no longer holds references to them, so there's no need to throw away
// the decoder unless we're explicitly asked to destroy all of the frames.
@@ -116,7 +116,7 @@ static CFDictionaryRef imageSourceOptions(ImageSource::ShouldSkipMetadata skipMe
if (!options) {
const unsigned numOptions = 3;
-#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
// Lion and Snow Leopard only return Orientation when kCGImageSourceSkipMetaData is false,
// and incorrectly return cached metadata if an image is queried once with kCGImageSourceSkipMetaData true
// and then subsequently with kCGImageSourceSkipMetaData false.
diff --git a/Source/WebCore/platform/graphics/cg/PathCG.cpp b/Source/WebCore/platform/graphics/cg/PathCG.cpp
index 6cc937836..e7dee39d3 100644
--- a/Source/WebCore/platform/graphics/cg/PathCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/PathCG.cpp
@@ -175,7 +175,7 @@ FloatRect Path::boundingRect() const
// does not, but only exists on 10.6 and above.
CGRect bound = CGRectZero;
-#if !defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
bound = CGPathGetPathBoundingBox(m_path);
#else
bound = CGPathGetBoundingBox(m_path);
@@ -236,7 +236,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
void Path::platformAddPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
{
-#if PLATFORM(MAC) && (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width());
bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height());
diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp
index f869c58a2..d75cf054d 100644
--- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp
+++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp
@@ -33,6 +33,7 @@
#include "LayerPainterChromium.h"
#include "PlatformColor.h"
#include "PlatformContextSkia.h"
+#include "TextureAllocator.h"
#include "cc/CCGraphicsContext.h"
#include "skia/ext/platform_canvas.h"
diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h
index d97968c03..276e2b391 100644
--- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h
+++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h
@@ -38,6 +38,7 @@ namespace WebCore {
class LayerPainterChromium;
class CCGraphicsContext;
+class TextureAllocator;
// This class rasterizes the contentRect into a skia bitmap canvas. It then updates
// textures by copying from the canvas into the texture, using MapSubImage if
diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp
index 23cffea94..86fb2c8c3 100644
--- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp
+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp
@@ -34,6 +34,7 @@
#include "PlatformColor.h"
#include "SkCanvas.h"
#include "SkDevice.h"
+#include "TextureAllocator.h"
#include "cc/CCGraphicsContext.h"
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h
index 787b39937..9f1388827 100644
--- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h
+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h
@@ -34,6 +34,8 @@
namespace WebCore {
+class TextureAllocator;
+
// This class records the contentRect into an SkPicture, then software rasterizes
// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting.
class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp
index be8484b75..782780a40 100644
--- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp
+++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp
@@ -75,8 +75,9 @@ void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c
m_painter->paint(canvas, layerRect, opaqueLayerRect);
canvas->restore();
- opaqueLayerRect.scale(contentsWidthScale, contentsHeightScale);
- resultingOpaqueRect = enclosedIntRect(opaqueLayerRect);
+ FloatRect opaqueContentRect = opaqueLayerRect;
+ opaqueContentRect.scale(contentsWidthScale, contentsHeightScale);
+ resultingOpaqueRect = enclosedIntRect(opaqueContentRect);
m_contentRect = contentRect;
}
diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 078d377d0..9f40f7fe1 100644
--- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -97,14 +97,14 @@ void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr
{
createTextureUpdaterIfNeeded();
- IntRect layerRect;
+ IntRect contentRect;
- // Always call updateLayerRect() but with an empty layer rectangle when
+ // Always call updateContentRect() but with an empty layer rectangle when
// layer doesn't draw contents.
if (drawsContent())
- layerRect = visibleLayerRect();
+ contentRect = visibleContentRect();
- updateLayerRect(updater, layerRect, occlusion);
+ updateContentRect(updater, contentRect, occlusion);
m_needsDisplay = false;
}
@@ -112,7 +112,7 @@ bool ContentLayerChromium::needMoreUpdates()
{
if (!drawsContent())
return false;
- return needsIdlePaint(visibleLayerRect());
+ return needsIdlePaint(visibleContentRect());
}
void ContentLayerChromium::createTextureUpdaterIfNeeded()
diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
index 14164133d..696563acf 100644
--- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
@@ -36,7 +36,6 @@
#include "LayerTextureSubImage.h"
#include "LayerTextureUpdater.h"
-#include "ManagedTexture.h"
#include "PlatformColor.h"
#include "cc/CCLayerTreeHost.h"
@@ -155,11 +154,11 @@ void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTrac
if (m_needsDisplay) {
m_textureUpdater->setBitmap(m_bitmap);
updateTileSizeAndTilingOption();
- invalidateRect(IntRect(IntPoint(), contentBounds()));
+ invalidateContentRect(IntRect(IntPoint(), contentBounds()));
m_needsDisplay = false;
}
- updateLayerRect(updater, visibleLayerRect(), occlusion);
+ updateContentRect(updater, visibleContentRect(), occlusion);
}
void ImageLayerChromium::createTextureUpdaterIfNeeded()
diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
index 38b856e63..4ae8db39c 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -732,7 +732,7 @@ void LayerChromium::notifyAnimationFinished(double wallClockTime)
Region LayerChromium::visibleContentOpaqueRegion() const
{
if (opaque())
- return visibleLayerRect();
+ return visibleContentRect();
return Region();
}
diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h
index e3ceb94d0..40668f556 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -154,8 +154,8 @@ public:
void setTransform(const WebKit::WebTransformationMatrix&);
bool transformIsAnimating() const;
- const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
- void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
+ const IntRect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
const IntRect& scissorRect() const { return m_scissorRect; }
void setScissorRect(const IntRect& scissorRect) { m_scissorRect = scissorRect; }
@@ -344,7 +344,7 @@ private:
IntSize m_bounds;
// Uses layer's content space.
- IntRect m_visibleLayerRect;
+ IntRect m_visibleContentRect;
// During drawing, identifies the region outside of which nothing should be drawn.
// Currently this is set to layer's clipRect if usesLayerClipping is true, otherwise
diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 55b5929a3..a72674140 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -43,28 +43,18 @@
#include "SharedGraphicsContext3D.h"
#include "SkBitmap.h"
#include "SkColor.h"
-#include "TextureManager.h"
#include "ThrottledTextureUploader.h"
#include "TraceEvent.h"
#include "TrackingTextureAllocator.h"
-#include "cc/CCCheckerboardDrawQuad.h"
-#include "cc/CCDebugBorderDrawQuad.h"
-#include "cc/CCIOSurfaceDrawQuad.h"
#include "cc/CCLayerQuad.h"
#include "cc/CCMathUtil.h"
#include "cc/CCProxy.h"
#include "cc/CCRenderPass.h"
-#include "cc/CCRenderPassDrawQuad.h"
#include "cc/CCRenderSurfaceFilters.h"
#include "cc/CCScopedTexture.h"
#include "cc/CCSettings.h"
#include "cc/CCSingleThreadProxy.h"
-#include "cc/CCSolidColorDrawQuad.h"
-#include "cc/CCStreamVideoDrawQuad.h"
-#include "cc/CCTextureDrawQuad.h"
-#include "cc/CCTileDrawQuad.h"
#include "cc/CCVideoLayerImpl.h"
-#include "cc/CCYUVVideoDrawQuad.h"
#include <public/WebGraphicsContext3D.h>
#include <public/WebVideoFrame.h>
#include <wtf/CurrentTime.h>
@@ -218,8 +208,6 @@ bool LayerRendererChromium::initialize()
m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager");
if (m_capabilities.usingGpuMemoryManager)
m_context->setMemoryAllocationChangedCallbackCHROMIUM(this);
- else
- m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
m_capabilities.usingDiscardFramebuffer = extensions.contains("GL_CHROMIUM_discard_framebuffer");
@@ -327,7 +315,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa
{
HashMap<int, const CCRenderPass*> passesInFrame;
for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i)
- passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i].get());
+ passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]);
Vector<int> passesToDelete;
HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator;
@@ -414,7 +402,7 @@ void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass, const
drawQuad(it->get());
}
-void LayerRendererChromium::drawQuad(const CCDrawQuad* quad)
+void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad)
{
IntRect scissorRect = quad->scissorRect();
@@ -430,35 +418,35 @@ void LayerRendererChromium::drawQuad(const CCDrawQuad* quad)
GLC(m_context, m_context->disable(GraphicsContext3D::BLEND));
switch (quad->material()) {
- case CCDrawQuad::Invalid:
+ case WebKit::WebCompositorQuad::Invalid:
ASSERT_NOT_REACHED();
break;
- case CCDrawQuad::Checkerboard:
- drawCheckerboardQuad(quad->toCheckerboardDrawQuad());
+ case WebKit::WebCompositorQuad::Checkerboard:
+ drawCheckerboardQuad(CCCheckerboardDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::DebugBorder:
- drawDebugBorderQuad(quad->toDebugBorderDrawQuad());
+ case WebKit::WebCompositorQuad::DebugBorder:
+ drawDebugBorderQuad(CCDebugBorderDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::IOSurfaceContent:
- drawIOSurfaceQuad(quad->toIOSurfaceDrawQuad());
+ case WebKit::WebCompositorQuad::IOSurfaceContent:
+ drawIOSurfaceQuad(CCIOSurfaceDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::RenderPass:
- drawRenderPassQuad(quad->toRenderPassDrawQuad());
+ case WebKit::WebCompositorQuad::RenderPass:
+ drawRenderPassQuad(CCRenderPassDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::SolidColor:
- drawSolidColorQuad(quad->toSolidColorDrawQuad());
+ case WebKit::WebCompositorQuad::SolidColor:
+ drawSolidColorQuad(WebKit::WebCompositorSolidColorQuad::materialCast(quad));
break;
- case CCDrawQuad::StreamVideoContent:
- drawStreamVideoQuad(quad->toStreamVideoDrawQuad());
+ case WebKit::WebCompositorQuad::StreamVideoContent:
+ drawStreamVideoQuad(CCStreamVideoDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::TextureContent:
- drawTextureQuad(quad->toTextureDrawQuad());
+ case WebKit::WebCompositorQuad::TextureContent:
+ drawTextureQuad(WebKit::WebCompositorTextureQuad::materialCast(quad));
break;
- case CCDrawQuad::TiledContent:
- drawTileQuad(quad->toTileDrawQuad());
+ case WebKit::WebCompositorQuad::TiledContent:
+ drawTileQuad(CCTileDrawQuad::materialCast(quad));
break;
- case CCDrawQuad::YUVVideoContent:
- drawYUVVideoQuad(quad->toYUVVideoDrawQuad());
+ case WebKit::WebCompositorQuad::YUVVideoContent:
+ drawYUVVideoQuad(CCYUVVideoDrawQuad::materialCast(quad));
break;
}
}
@@ -610,7 +598,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad)
if (!contentsTexture || !contentsTexture->id())
return;
- WebTransformationMatrix renderTransform = quad->layerTransform();
+ WebTransformationMatrix renderTransform = quad->drawTransform();
// Apply a scaling factor to size the quad from 1x1 to its intended size.
renderTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1);
WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * renderTransform).to2dTransform();
@@ -633,7 +621,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad)
// Draw the background texture if there is one.
if (backgroundTexture) {
ASSERT(backgroundTexture->size() == quad->quadRect().size());
- copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->layerTransform());
+ copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->drawTransform());
}
bool clipped = false;
@@ -711,11 +699,11 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad)
GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge));
}
- // Map device space quad to surface space. contentsDeviceTransform has no perspective since it was generated with to2dTransform() so we don't need to project.
+ // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project.
FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped);
ASSERT(!clipped);
- drawTexturedQuad(quad->layerTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad,
+ drawTexturedQuad(quad->drawTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad,
shaderMatrixLocation, shaderAlphaLocation, shaderQuadLocation);
}
@@ -807,7 +795,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad)
return;
bool clipped = false;
- FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->layerRect()), clipped);
+ FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped);
ASSERT(!clipped);
TileProgramUniforms uniforms;
@@ -891,10 +879,12 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad)
// Create device space quad.
CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
- // Map quad to layer space.
+ // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project.
WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse();
localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped);
- ASSERT(!clipped);
+
+ // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
+ // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case.
} else {
// Move fragment shader transform to vertex shader. We can do this while
// still producing correct results as fragmentTexTransformLocation
@@ -968,11 +958,12 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad)
};
GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocation(), 1, yuvAdjust));
- const IntSize& bounds = quad->quadRect().size();
- drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), FloatQuad(),
- program->vertexShader().matrixLocation(),
- program->fragmentShader().alphaLocation(),
- -1);
+ WebTransformationMatrix quadTransform = quad->quadTransform();
+ IntRect quadRect = quad->quadRect();
+ quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0);
+
+ drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), FloatQuad(),
+ program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1);
// Reset active texture back to texture 0.
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
@@ -995,11 +986,12 @@ void LayerRendererChromium::drawStreamVideoQuad(const CCStreamVideoDrawQuad* qua
GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0));
- const IntSize& bounds = quad->quadRect().size();
- drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(),
- program->vertexShader().matrixLocation(),
- program->fragmentShader().alphaLocation(),
- -1);
+ WebTransformationMatrix quadTransform = quad->quadTransform();
+ IntRect quadRect = quad->quadRect();
+ quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0);
+
+ drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(),
+ program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1);
}
struct TextureProgramBinding {
@@ -1092,9 +1084,11 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad)
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
- const IntSize& bounds = quad->quadRect().size();
+ WebTransformationMatrix quadTransform = quad->quadTransform();
+ IntRect quadRect = quad->quadRect();
+ quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0);
- drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1);
+ drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1);
GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0));
}
diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index 6afe66806..415520d7f 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -37,7 +37,16 @@
#include "Extensions3DChromium.h"
#include "TextureCopier.h"
#include "TrackingTextureAllocator.h"
+#include "cc/CCCheckerboardDrawQuad.h"
+#include "cc/CCDebugBorderDrawQuad.h"
+#include "cc/CCIOSurfaceDrawQuad.h"
+#include "cc/CCRenderPassDrawQuad.h"
#include "cc/CCRenderer.h"
+#include "cc/CCSolidColorDrawQuad.h"
+#include "cc/CCStreamVideoDrawQuad.h"
+#include "cc/CCTextureDrawQuad.h"
+#include "cc/CCTileDrawQuad.h"
+#include "cc/CCYUVVideoDrawQuad.h"
#include <wtf/PassOwnPtr.h>
namespace WebKit {
@@ -46,17 +55,7 @@ class WebGraphicsContext3D;
namespace WebCore {
-class CCCheckerboardDrawQuad;
-class CCDebugBorderDrawQuad;
-class CCDrawQuad;
-class CCIOSurfaceDrawQuad;
-class CCRenderPassDrawQuad;
class CCScopedTexture;
-class CCSolidColorDrawQuad;
-class CCStreamVideoDrawQuad;
-class CCTextureDrawQuad;
-class CCTileDrawQuad;
-class CCYUVVideoDrawQuad;
class GeometryBinding;
class ScopedEnsureFramebufferAllocation;
diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp b/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp
deleted file mode 100644
index 4dabf1beb..000000000
--- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "ManagedTexture.h"
-
-#include "GraphicsContext3D.h"
-#include "cc/CCGraphicsContext.h"
-#include <public/WebGraphicsContext3D.h>
-
-using WebKit::WebGraphicsContext3D;
-
-namespace WebCore {
-
-ManagedTexture::ManagedTexture(TextureManager* manager)
- : m_textureManager(manager)
- , m_token(0)
- , m_format(0)
- , m_textureId(0)
-{
- m_textureManager->registerTexture(this);
-}
-
-ManagedTexture::ManagedTexture(TextureManager* manager, TextureToken token, IntSize size, unsigned format, unsigned textureId)
- : m_textureManager(manager)
- , m_token(token)
- , m_size(size)
- , m_format(format)
- , m_textureId(textureId)
-{
- m_textureManager->registerTexture(this);
-}
-
-ManagedTexture::~ManagedTexture()
-{
- if (!m_textureManager)
- return;
- m_textureManager->unregisterTexture(this);
- if (m_token)
- m_textureManager->releaseToken(m_token);
-}
-
-void ManagedTexture::setTextureManager(TextureManager* manager)
-{
- if (manager == m_textureManager)
- return;
-
- if (m_textureManager)
- m_textureManager->unregisterTexture(this);
- m_textureManager = manager;
- clear();
- if (m_textureManager)
- m_textureManager->registerTexture(this);
-}
-
-bool ManagedTexture::isValid(const IntSize& size, unsigned format)
-{
- return m_token && size == m_size && format == m_format && m_textureManager && m_textureManager->hasTexture(m_token);
-}
-
-bool ManagedTexture::reserve(const IntSize& size, unsigned format)
-{
- if (!m_textureManager)
- return false;
-
- if (!m_token)
- m_token = m_textureManager->getToken();
-
- bool reserved = true;
- if (size == m_size && format == m_format && m_textureManager->hasTexture(m_token))
- m_textureManager->protectTexture(m_token);
- else {
- m_textureId = 0;
- reserved = m_textureManager->requestTexture(m_token, size, format);
- if (reserved) {
- m_size = size;
- m_format = format;
- }
- }
-
- return reserved;
-}
-
-void ManagedTexture::unreserve()
-{
- if (!m_token || !m_textureManager)
- return;
-
- m_textureManager->unprotectTexture(m_token);
-}
-
-void ManagedTexture::allocate(TextureAllocator* allocator)
-{
- ASSERT(m_textureManager->hasTexture(m_token));
- if (!m_textureId)
- m_textureId = m_textureManager->allocateTexture(allocator, m_token);
-}
-
-void ManagedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator)
-{
- allocate(allocator);
- WebGraphicsContext3D* context3d = context->context3D();
- if (!context3d) {
- // FIXME: Implement this path for software compositing.
- return;
- }
- context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
-}
-
-PassOwnPtr<ManagedTexture> ManagedTexture::steal()
-{
- OwnPtr<ManagedTexture> texture = adoptPtr(new ManagedTexture(m_textureManager, m_token, m_size, m_format, m_textureId));
- clear();
- return texture.release();
-}
-
-void ManagedTexture::clear()
-{
- m_token = 0;
- m_size = IntSize();
- m_format = 0;
- m_textureId = 0;
-}
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h b/Source/WebCore/platform/graphics/chromium/ManagedTexture.h
deleted file mode 100644
index 6e67ebf68..000000000
--- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ManagedTexture_h
-#define ManagedTexture_h
-
-#include "IntSize.h"
-#include "TextureManager.h"
-
-#include <wtf/FastAllocBase.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class CCGraphicsContext;
-
-class ManagedTexture {
- WTF_MAKE_NONCOPYABLE(ManagedTexture);
-public:
- static PassOwnPtr<ManagedTexture> create(TextureManager* manager)
- {
- return adoptPtr(new ManagedTexture(manager));
- }
- ~ManagedTexture();
-
- void setTextureManager(TextureManager*);
- void clearManager() { m_textureManager = 0; }
-
- bool isValid(const IntSize&, unsigned format);
- bool reserve(const IntSize&, unsigned format);
- void unreserve();
- bool isReserved()
- {
- return m_textureManager && m_textureManager->isProtected(m_token);
- }
-
- void allocate(TextureAllocator*);
- void bindTexture(CCGraphicsContext*, TextureAllocator*);
-
- IntSize size() const { return m_size; }
- unsigned format() const { return m_format; }
- unsigned textureId() const { return m_textureId; }
-
- // Steal token and textureId by instantiates a new texture using existing
- // member variables.
- PassOwnPtr<ManagedTexture> steal();
-
-private:
- explicit ManagedTexture(TextureManager*);
- ManagedTexture(TextureManager*, TextureToken, IntSize, unsigned format, unsigned textureId);
-
- void clear();
-
- TextureManager* m_textureManager;
- TextureToken m_token;
- IntSize m_size;
- unsigned m_format;
- unsigned m_textureId;
-};
-
-}
-
-#endif // ManagedTexture_h
diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
index 0e7d4e38c..2b608f4e7 100644
--- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
@@ -40,7 +40,6 @@ namespace WebCore {
class FilterOperations;
class LayerChromium;
class LayerRendererChromium;
-class ManagedTexture;
class RenderSurfaceChromium {
WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium);
diff --git a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h
new file mode 100644
index 000000000..58de11522
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef TextureAllocator_h
+#define TextureAllocator_h
+
+#include "GraphicsContext3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+
+namespace WebCore {
+
+class TextureAllocator {
+public:
+ virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0;
+ virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0;
+ virtual void deleteAllTextures() = 0;
+
+protected:
+ virtual ~TextureAllocator() { }
+};
+
+}
+
+#endif
+
+
diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp
deleted file mode 100644
index 485c72228..000000000
--- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (C) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "TextureManager.h"
-
-#include "ManagedTexture.h"
-#include "TraceEvent.h"
-
-using namespace std;
-
-namespace WebCore {
-
-
-namespace {
-size_t memoryLimitBytes(size_t viewportMultiplier, const IntSize& viewportSize, size_t minMegabytes, size_t maxMegabytes)
-{
- if (!viewportMultiplier)
- return maxMegabytes * 1024 * 1024;
- if (viewportSize.isEmpty())
- return minMegabytes * 1024 * 1024;
- return max(minMegabytes * 1024 * 1024, min(maxMegabytes * 1024 * 1024, viewportMultiplier * TextureManager::memoryUseBytes(viewportSize, GraphicsContext3D::RGBA)));
-}
-}
-
-size_t TextureManager::highLimitBytes(const IntSize& viewportSize)
-{
- size_t viewportMultiplier, minMegabytes, maxMegabytes;
-#if OS(ANDROID)
- viewportMultiplier = 16;
- minMegabytes = 32;
- maxMegabytes = 64;
-#else
- viewportMultiplier = 0;
- minMegabytes = 0;
- maxMegabytes = 128;
-#endif
- return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes);
-}
-
-size_t TextureManager::reclaimLimitBytes(const IntSize& viewportSize)
-{
- size_t viewportMultiplier, minMegabytes, maxMegabytes;
-#if OS(ANDROID)
- viewportMultiplier = 8;
- minMegabytes = 16;
- maxMegabytes = 32;
-#else
- viewportMultiplier = 0;
- minMegabytes = 0;
- maxMegabytes = 64;
-#endif
- return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes);
-}
-
-size_t TextureManager::memoryUseBytes(const IntSize& size, GC3Denum textureFormat)
-{
- // FIXME: This assumes all textures are 1 byte/component.
- const GC3Denum type = GraphicsContext3D::UNSIGNED_BYTE;
- unsigned int componentsPerPixel = 4;
- unsigned int bytesPerComponent = 1;
- if (!GraphicsContext3D::computeFormatAndTypeParameters(textureFormat, type, &componentsPerPixel, &bytesPerComponent))
- ASSERT_NOT_REACHED();
-
- return size.width() * size.height() * componentsPerPixel * bytesPerComponent;
-}
-
-
-TextureManager::TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize)
- : m_maxMemoryLimitBytes(maxMemoryLimitBytes)
- , m_preferredMemoryLimitBytes(preferredMemoryLimitBytes)
- , m_memoryUseBytes(0)
- , m_maxTextureSize(maxTextureSize)
- , m_nextToken(1)
-{
-}
-
-TextureManager::~TextureManager()
-{
- for (HashSet<ManagedTexture*>::iterator it = m_registeredTextures.begin(); it != m_registeredTextures.end(); ++it)
- (*it)->clearManager();
-}
-
-void TextureManager::setMemoryAllocationLimitBytes(size_t memoryLimitBytes)
-{
- setMaxMemoryLimitBytes(memoryLimitBytes);
-#if defined(OS_ANDROID)
- // On android, we are setting the preferred memory limit to half of our
- // maximum allocation, because we would like to stay significantly below
- // the absolute memory limit whenever we can. Specifically, by limitting
- // prepainting only to the halfway memory mark.
- setPreferredMemoryLimitBytes(memoryLimitBytes / 2);
-#else
- setPreferredMemoryLimitBytes(memoryLimitBytes);
-#endif
-}
-
-void TextureManager::setMaxMemoryLimitBytes(size_t memoryLimitBytes)
-{
- reduceMemoryToLimit(memoryLimitBytes);
- ASSERT(currentMemoryUseBytes() <= memoryLimitBytes);
- m_maxMemoryLimitBytes = memoryLimitBytes;
-}
-
-void TextureManager::setPreferredMemoryLimitBytes(size_t memoryLimitBytes)
-{
- m_preferredMemoryLimitBytes = memoryLimitBytes;
-}
-
-void TextureManager::registerTexture(ManagedTexture* texture)
-{
- ASSERT(texture);
- ASSERT(!m_registeredTextures.contains(texture));
-
- m_registeredTextures.add(texture);
-}
-
-void TextureManager::unregisterTexture(ManagedTexture* texture)
-{
- ASSERT(texture);
- ASSERT(m_registeredTextures.contains(texture));
-
- m_registeredTextures.remove(texture);
-}
-
-TextureToken TextureManager::getToken()
-{
- return m_nextToken++;
-}
-
-void TextureManager::releaseToken(TextureToken token)
-{
- TextureMap::iterator it = m_textures.find(token);
- if (it != m_textures.end())
- removeTexture(token, it->second);
-}
-
-bool TextureManager::hasTexture(TextureToken token)
-{
- return m_textures.contains(token);
-}
-
-bool TextureManager::isProtected(TextureToken token)
-{
- return token && hasTexture(token) && m_textures.get(token).isProtected;
-}
-
-void TextureManager::protectTexture(TextureToken token)
-{
- ASSERT(hasTexture(token));
- TextureInfo info = m_textures.take(token);
- info.isProtected = true;
- m_textures.add(token, info);
- // If someone protects a texture, put it at the end of the LRU list.
- m_textureLRUSet.remove(token);
- m_textureLRUSet.add(token);
-}
-
-void TextureManager::unprotectTexture(TextureToken token)
-{
- TextureMap::iterator it = m_textures.find(token);
- if (it != m_textures.end())
- it->second.isProtected = false;
-}
-
-void TextureManager::unprotectAllTextures()
-{
- for (TextureMap::iterator it = m_textures.begin(); it != m_textures.end(); ++it)
- it->second.isProtected = false;
-}
-
-void TextureManager::evictTexture(TextureToken token, TextureInfo info)
-{
- TRACE_EVENT0("cc", "TextureManager::evictTexture");
- removeTexture(token, info);
-}
-
-void TextureManager::reduceMemoryToLimit(size_t limit)
-{
- while (m_memoryUseBytes > limit) {
- ASSERT(!m_textureLRUSet.isEmpty());
- bool foundCandidate = false;
- for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) {
- TextureToken token = *lruIt;
- TextureInfo info = m_textures.get(token);
- if (info.isProtected)
- continue;
- evictTexture(token, info);
- foundCandidate = true;
- break;
- }
- if (!foundCandidate)
- return;
- }
-}
-
-void TextureManager::addTexture(TextureToken token, TextureInfo info)
-{
- ASSERT(!m_textureLRUSet.contains(token));
- ASSERT(!m_textures.contains(token));
- m_memoryUseBytes += memoryUseBytes(info.size, info.format);
- m_textures.set(token, info);
- m_textureLRUSet.add(token);
-}
-
-void TextureManager::deleteEvictedTextures(TextureAllocator* allocator)
-{
- if (allocator) {
- for (size_t i = 0; i < m_evictedTextures.size(); ++i) {
- if (m_evictedTextures[i].textureId) {
-#ifndef NDEBUG
- ASSERT(m_evictedTextures[i].allocator == allocator);
-#endif
- allocator->deleteTexture(m_evictedTextures[i].textureId, m_evictedTextures[i].size, m_evictedTextures[i].format);
- }
- }
- }
- m_evictedTextures.clear();
-}
-
-void TextureManager::evictAndRemoveAllDeletedTextures()
-{
- unprotectAllTextures();
- reduceMemoryToLimit(0);
- m_evictedTextures.clear();
-}
-
-void TextureManager::evictAndDeleteAllTextures(TextureAllocator* allocator)
-{
- unprotectAllTextures();
- reduceMemoryToLimit(0);
- deleteEvictedTextures(allocator);
-}
-
-void TextureManager::removeTexture(TextureToken token, TextureInfo info)
-{
- ASSERT(m_textureLRUSet.contains(token));
- ASSERT(m_textures.contains(token));
- m_memoryUseBytes -= memoryUseBytes(info.size, info.format);
- m_textures.remove(token);
- ASSERT(m_textureLRUSet.contains(token));
- m_textureLRUSet.remove(token);
- EvictionEntry entry;
- entry.textureId = info.textureId;
- entry.size = info.size;
- entry.format = info.format;
-#ifndef NDEBUG
- entry.allocator = info.allocator;
-#endif
- m_evictedTextures.append(entry);
-}
-
-unsigned TextureManager::allocateTexture(TextureAllocator* allocator, TextureToken token)
-{
- TextureMap::iterator it = m_textures.find(token);
- ASSERT(it != m_textures.end());
- TextureInfo* info = &it.get()->second;
- ASSERT(info->isProtected);
-
- unsigned textureId = allocator->createTexture(info->size, info->format);
- info->textureId = textureId;
-#ifndef NDEBUG
- info->allocator = allocator;
-#endif
- return textureId;
-}
-
-bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format)
-{
- if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize)
- return false;
-
- TextureMap::iterator it = m_textures.find(token);
- if (it != m_textures.end()) {
- ASSERT(it->second.size != size || it->second.format != format);
- removeTexture(token, it->second);
- }
-
- size_t memoryRequiredBytes = memoryUseBytes(size, format);
- if (memoryRequiredBytes > m_maxMemoryLimitBytes)
- return false;
-
- reduceMemoryToLimit(m_maxMemoryLimitBytes - memoryRequiredBytes);
- if (m_memoryUseBytes + memoryRequiredBytes > m_maxMemoryLimitBytes)
- return false;
-
- TextureInfo info;
- info.size = size;
- info.format = format;
- info.textureId = 0;
- info.isProtected = true;
-#ifndef NDEBUG
- info.allocator = 0;
-#endif
- addTexture(token, info);
- return true;
-}
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h
deleted file mode 100644
index 47a189bcc..000000000
--- a/Source/WebCore/platform/graphics/chromium/TextureManager.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TextureManager_h
-#define TextureManager_h
-
-#include "GraphicsContext3D.h"
-#include "IntRect.h"
-#include "IntSize.h"
-#include <wtf/FastAllocBase.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class ManagedTexture;
-typedef int TextureToken;
-
-class TextureAllocator {
-public:
- virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0;
- virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0;
- virtual void deleteAllTextures() = 0;
-
-protected:
- virtual ~TextureAllocator() { }
-};
-
-class TextureManager {
- WTF_MAKE_NONCOPYABLE(TextureManager);
-public:
- static PassOwnPtr<TextureManager> create(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize)
- {
- return adoptPtr(new TextureManager(maxMemoryLimitBytes, preferredMemoryLimitBytes, maxTextureSize));
- }
- ~TextureManager();
-
- // Absolute maximum limit for texture allocations for this instance.
- static size_t highLimitBytes(const IntSize& viewportSize);
- // Preferred texture size limit given the viewport size.
- static size_t reclaimLimitBytes(const IntSize& viewportSize);
-
- static size_t memoryUseBytes(const IntSize&, GC3Denum format);
-
- void setMemoryAllocationLimitBytes(size_t);
- void setMaxMemoryLimitBytes(size_t);
- size_t maxMemoryLimitBytes() { return m_maxMemoryLimitBytes; }
- void setPreferredMemoryLimitBytes(size_t);
- size_t preferredMemoryLimitBytes() { return m_preferredMemoryLimitBytes; }
-
- void registerTexture(ManagedTexture*);
- void unregisterTexture(ManagedTexture*);
-
- TextureToken getToken();
- void releaseToken(TextureToken);
- bool hasTexture(TextureToken);
-
- bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat);
-
- void protectTexture(TextureToken);
- void unprotectTexture(TextureToken);
- void unprotectAllTextures();
- bool isProtected(TextureToken);
-
- unsigned allocateTexture(TextureAllocator*, TextureToken);
- void deleteEvictedTextures(TextureAllocator*);
-
- void evictAndRemoveAllDeletedTextures();
- void evictAndDeleteAllTextures(TextureAllocator*);
-
- void reduceMemoryToLimit(size_t);
- size_t currentMemoryUseBytes() const { return m_memoryUseBytes; }
-
-private:
- TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize);
-
- struct TextureInfo {
- IntSize size;
- GC3Denum format;
- unsigned textureId;
- bool isProtected;
-#ifndef NDEBUG
- TextureAllocator* allocator;
-#endif
- };
-
- void addTexture(TextureToken, TextureInfo);
- void removeTexture(TextureToken, TextureInfo);
- void evictTexture(TextureToken, TextureInfo);
-
- HashSet<ManagedTexture*> m_registeredTextures;
-
- typedef HashMap<TextureToken, TextureInfo> TextureMap;
- TextureMap m_textures;
- ListHashSet<TextureToken> m_textureLRUSet;
-
- size_t m_maxMemoryLimitBytes;
- size_t m_preferredMemoryLimitBytes;
- size_t m_memoryUseBytes;
- int m_maxTextureSize;
- TextureToken m_nextToken;
-
- struct EvictionEntry {
- unsigned textureId;
- IntSize size;
- GC3Denum format;
-#ifndef NDEBUG
- TextureAllocator* allocator;
-#endif
- };
-
- Vector<EvictionEntry> m_evictedTextures;
-};
-
-}
-
-#endif
diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
index 5c4bc05ce..d085c9dd1 100644
--- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
@@ -30,7 +30,6 @@
#include "TiledLayerChromium.h"
#include "GraphicsContext3D.h"
-#include "ManagedTexture.h"
#include "Region.h"
#include "TextStream.h"
@@ -156,7 +155,7 @@ void TiledLayerChromium::updateBounds()
newRegion.subtract(oldRegion);
Vector<IntRect> rects = newRegion.rects();
for (size_t i = 0; i < rects.size(); ++i)
- invalidateRect(rects[i]);
+ invalidateContentRect(rects[i]);
}
void TiledLayerChromium::setTileSize(const IntSize& size)
@@ -288,7 +287,7 @@ void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
FloatRect scaledDirtyRect(dirtyRect);
scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale);
IntRect dirty = enclosingIntRect(scaledDirtyRect);
- invalidateRect(dirty);
+ invalidateContentRect(dirty);
LayerChromium::setNeedsDisplayRect(dirtyRect);
}
@@ -306,10 +305,10 @@ void TiledLayerChromium::setIsNonCompositedContent(bool isNonCompositedContent)
setBorderTexelOption(borderTexelOption);
}
-void TiledLayerChromium::invalidateRect(const IntRect& layerRect)
+void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect)
{
updateBounds();
- if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw)
+ if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw)
return;
for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) {
@@ -319,7 +318,7 @@ void TiledLayerChromium::invalidateRect(const IntRect& layerRect)
if (!tile)
continue;
IntRect bound = m_tiler->tileRect(tile);
- bound.intersect(layerRect);
+ bound.intersect(contentRect);
tile->dirtyRect.unite(bound);
}
}
@@ -356,7 +355,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in
// Create tiles as needed, expanding a dirty rect to contain all
// the dirty regions currently being drawn. All dirty tiles that are to be painted
// get their updateRect set to dirtyRect and dirtyRect cleared. This way if
- // invalidateRect is invoked during updateLayerRect we don't lose the request.
+ // invalidateContentRect is invoked during updateContentRect we don't lose the request.
IntRect paintRect;
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
@@ -377,7 +376,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in
// When not idle painting, if the visible region of the tile is occluded, don't reserve a texture or update the tile.
// If any part of the tile is visible, then we need to update it so the tile is pushed to the impl thread.
if (!idle && occlusion) {
- IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect());
+ IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect());
if (occlusion->occluded(this, visibleTileRect)) {
ASSERT(!tile->updated);
continue;
@@ -517,21 +516,21 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in
void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)
{
- setTexturePrioritiesInRect(priorityCalc, visibleLayerRect());
+ setTexturePrioritiesInRect(priorityCalc, visibleContentRect());
}
-void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleRect)
+void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleContentRect)
{
updateBounds();
resetUpdateState();
- IntRect prepaintRect = idlePaintRect(visibleRect);
+ IntRect prepaintRect = idlePaintRect(visibleContentRect);
bool drawsToRootSurface = !targetRenderSurface()->targetRenderSurface();
// Minimally create the tiles in the desired pre-paint rect.
if (!prepaintRect.isEmpty()) {
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(prepaintRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(prepaintRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j)
for (int i = left; i <= right; ++i)
if (!tileAt(i, j))
@@ -542,9 +541,9 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator&
// These textures must stay alive while the updated textures are incrementally
// uploaded, swapped atomically via pushProperties, and finally deleted
// after the commit is complete, after which they can be recycled.
- if (!visibleRect.isEmpty()) {
+ if (!visibleContentRect.isEmpty()) {
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(visibleRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(visibleContentRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
@@ -581,10 +580,10 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator&
// can be removed soon with better priorities, but for now paint these layers after
// 512 pixels of pre-painting. Later we can just pass an animating flag etc. to the
// calculator and it can take care of this special case if we still need it.
- if (visibleRect.isEmpty() && !prepaintRect.isEmpty())
+ if (visibleContentRect.isEmpty() && !prepaintRect.isEmpty())
tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(512, drawsToRootSurface));
- else if (!visibleRect.isEmpty())
- tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleRect, tileRect, drawsToRootSurface));
+ else if (!visibleContentRect.isEmpty())
+ tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleContentRect, tileRect, drawsToRootSurface));
}
}
@@ -593,8 +592,8 @@ Region TiledLayerChromium::visibleContentOpaqueRegion() const
if (m_skipsDraw)
return Region();
if (opaque())
- return visibleLayerRect();
- return m_tiler->opaqueRegionInLayerRect(visibleLayerRect());
+ return visibleContentRect();
+ return m_tiler->opaqueRegionInContentRect(visibleContentRect());
}
void TiledLayerChromium::resetUpdateState()
@@ -611,7 +610,7 @@ void TiledLayerChromium::resetUpdateState()
}
}
-void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion)
+void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion)
{
m_skipsDraw = false;
m_skipsIdlePaint = false;
@@ -625,7 +624,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec
// Visible painting. Only paint visible tiles if the visible rect isn't empty.
if (!contentRect.isEmpty()) {
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
updateTiles(false, left, top, right, bottom, updater, occlusion);
}
@@ -639,7 +638,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec
return;
int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom;
- m_tiler->layerRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
+ m_tiler->contentRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
// If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles.
if (contentRect.isEmpty()) {
@@ -657,7 +656,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec
}
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
// Otherwise, prepaint anything that was occluded but inside the layer's visible region.
updateTiles(true, left, top, right, bottom, updater, 0);
@@ -693,7 +692,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec
}
}
-bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect)
+bool TiledLayerChromium::needsIdlePaint(const IntRect& visibleContentRect)
{
if (m_skipsIdlePaint)
return false;
@@ -701,17 +700,17 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect)
if (m_tiler->hasEmptyBounds())
return false;
- IntRect idlePaintContentRect = idlePaintRect(contentRect);
+ IntRect idlePaintContentRect = idlePaintRect(visibleContentRect);
if (idlePaintContentRect.isEmpty())
return false;
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(idlePaintContentRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
- // If the layerRect is empty, then we are painting the outer-most set of tiles only.
- if (contentRect.isEmpty() && i != left && i != right && j != top && j != bottom)
+ // If the visibleContentRect is empty, then we are painting the outer-most set of tiles only.
+ if (visibleContentRect.isEmpty() && i != left && i != right && j != top && j != bottom)
continue;
UpdatableTile* tile = tileAt(i, j);
ASSERT(tile); // Did setTexturePriorities get skipped?
@@ -728,14 +727,14 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect)
return false;
}
-IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect)
+IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleContentRect)
{
IntRect contentRect(IntPoint::zero(), contentBounds());
// For layers that are animating transforms but not visible at all, we don't know what part
// of them is going to become visible. For small layers we return the entire layer, for larger
// ones we avoid prepainting the layer at all.
- if (visibleRect.isEmpty()) {
+ if (visibleContentRect.isEmpty()) {
bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9;
if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer)
return contentRect;
@@ -744,7 +743,7 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect)
// FIXME: This can be made a lot larger now! We should increase
// this slowly while insuring it doesn't cause any perf issues.
- IntRect prepaintRect = visibleRect;
+ IntRect prepaintRect = visibleContentRect;
prepaintRect.inflateX(m_tiler->tileSize().width());
prepaintRect.inflateY(m_tiler->tileSize().height() * 2);
prepaintRect.intersect(contentRect);
diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
index d2ed45c04..c80c422f9 100644
--- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
@@ -77,18 +77,18 @@ protected:
virtual void createTextureUpdaterIfNeeded() = 0;
// Set invalidations to be potentially repainted during update().
- void invalidateRect(const IntRect& layerRect);
+ void invalidateContentRect(const IntRect& contentRect);
// Reset state on tiles that will be used for updating the layer.
void resetUpdateState();
- // Prepare data needed to update textures that intersect with layerRect.
- void updateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*);
+ // Prepare data needed to update textures that intersect with contentRect.
+ void updateContentRect(CCTextureUpdater&, const IntRect& contentRect, const CCOcclusionTracker*);
// After preparing an update, returns true if more painting is needed.
- bool needsIdlePaint(const IntRect& layerRect);
+ bool needsIdlePaint(const IntRect& visibleContentRect);
- IntRect idlePaintRect(const IntRect& visibleLayerRect);
+ IntRect idlePaintRect(const IntRect& visibleContentRect);
bool skipsDraw() const { return m_skipsDraw; }
@@ -104,7 +104,7 @@ private:
bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
bool tileNeedsBufferedUpdate(UpdatableTile*);
- void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleLayerRect);
+ void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect);
void updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater&, const CCOcclusionTracker*);
diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp
index c589a3c6e..7ae29f912 100644
--- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp
+++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp
@@ -75,7 +75,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f
if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize)
return 0;
- m_currentMemoryUseBytes += TextureManager::memoryUseBytes(size, format);
+ m_currentMemoryUseBytes += CCTexture::memorySizeBytes(size, format);
unsigned textureId = 0;
GLC(m_context, textureId = m_context->createTexture());
@@ -100,7 +100,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f
void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format)
{
- m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format);
+ m_currentMemoryUseBytes -= CCTexture::memorySizeBytes(size, format);
GLC(m_context, m_context->deleteTexture(textureId));
GLC(m_context, m_context->deleteTexture(textureId));
ASSERT(m_allocatedTextureIds.contains(textureId));
diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h
index 78ef40d1b..38f7ca043 100644
--- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h
+++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h
@@ -25,7 +25,7 @@
#ifndef TrackingTextureAllocator_h
#define TrackingTextureAllocator_h
-#include "TextureManager.h"
+#include "TextureAllocator.h"
#include <wtf/HashSet.h>
#include <wtf/PassRefPtr.h>
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h
index 27f8c56bd..35104dcf5 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h
@@ -26,20 +26,10 @@
#ifndef CCCheckerboardDrawQuad_h
#define CCCheckerboardDrawQuad_h
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorCheckerboardQuad.h>
namespace WebCore {
-
-class CCCheckerboardDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCCheckerboardDrawQuad);
-public:
- static PassOwnPtr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&);
-
-private:
- CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&);
-};
-
+typedef WebKit::WebCompositorCheckerboardQuad CCCheckerboardDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h
index ea1cf8476..a72c27417 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,27 +26,10 @@
#ifndef CCDebugBorderDrawQuad_h
#define CCDebugBorderDrawQuad_h
-#include "SkColor.h"
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorDebugBorderQuad.h>
namespace WebCore {
-
-class CCDebugBorderDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCDebugBorderDrawQuad);
-public:
- static PassOwnPtr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width);
-
- SkColor color() const { return m_color; };
- int width() const { return m_width; }
-
-private:
- CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width);
-
- SkColor m_color;
- int m_width;
-};
-
+typedef WebKit::WebCompositorDebugBorderQuad CCDebugBorderDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp
deleted file mode 100644
index 601f5621d..000000000
--- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "cc/CCDrawQuad.h"
-
-#include "cc/CCCheckerboardDrawQuad.h"
-#include "cc/CCDebugBorderDrawQuad.h"
-#include "cc/CCIOSurfaceDrawQuad.h"
-#include "cc/CCRenderPassDrawQuad.h"
-#include "cc/CCSolidColorDrawQuad.h"
-#include "cc/CCStreamVideoDrawQuad.h"
-#include "cc/CCTextureDrawQuad.h"
-#include "cc/CCTileDrawQuad.h"
-#include "cc/CCYUVVideoDrawQuad.h"
-
-namespace WebCore {
-
-CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect)
- : m_sharedQuadState(sharedQuadState)
- , m_material(material)
- , m_quadRect(quadRect)
- , m_quadVisibleRect(quadRect)
- , m_quadOpaque(true)
- , m_needsBlending(false)
-{
- ASSERT(m_sharedQuadState);
- ASSERT(m_material != Invalid);
-}
-
-IntRect CCDrawQuad::opaqueRect() const
-{
- if (opacity() != 1)
- return IntRect();
- if (m_sharedQuadState->isOpaque() && m_quadOpaque)
- return m_quadRect;
- return m_opaqueRect;
-}
-
-void CCDrawQuad::setQuadVisibleRect(const IntRect& quadVisibleRect)
-{
- m_quadVisibleRect = quadVisibleRect;
- m_quadVisibleRect.intersect(m_quadRect);
-}
-
-const CCCheckerboardDrawQuad* CCDrawQuad::toCheckerboardDrawQuad() const
-{
- ASSERT(m_material == Checkerboard);
- return static_cast<const CCCheckerboardDrawQuad*>(this);
-}
-
-const CCDebugBorderDrawQuad* CCDrawQuad::toDebugBorderDrawQuad() const
-{
- ASSERT(m_material == DebugBorder);
- return static_cast<const CCDebugBorderDrawQuad*>(this);
-}
-
-const CCIOSurfaceDrawQuad* CCDrawQuad::toIOSurfaceDrawQuad() const
-{
- ASSERT(m_material == IOSurfaceContent);
- return static_cast<const CCIOSurfaceDrawQuad*>(this);
-}
-
-const CCRenderPassDrawQuad* CCDrawQuad::toRenderPassDrawQuad() const
-{
- ASSERT(m_material == RenderPass);
- return static_cast<const CCRenderPassDrawQuad*>(this);
-}
-
-const CCSolidColorDrawQuad* CCDrawQuad::toSolidColorDrawQuad() const
-{
- ASSERT(m_material == SolidColor);
- return static_cast<const CCSolidColorDrawQuad*>(this);
-}
-
-const CCStreamVideoDrawQuad* CCDrawQuad::toStreamVideoDrawQuad() const
-{
- ASSERT(m_material == StreamVideoContent);
- return static_cast<const CCStreamVideoDrawQuad*>(this);
-}
-
-const CCTextureDrawQuad* CCDrawQuad::toTextureDrawQuad() const
-{
- ASSERT(m_material == TextureContent);
- return static_cast<const CCTextureDrawQuad*>(this);
-}
-const CCTileDrawQuad* CCDrawQuad::toTileDrawQuad() const
-{
- ASSERT(m_material == TiledContent);
- return static_cast<const CCTileDrawQuad*>(this);
-}
-
-const CCYUVVideoDrawQuad* CCDrawQuad::toYUVVideoDrawQuad() const
-{
- ASSERT(m_material == YUVVideoContent);
- return static_cast<const CCYUVVideoDrawQuad*>(this);
-}
-
-
-}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h
index 756b68036..5f536a85a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,91 +26,10 @@
#ifndef CCDrawQuad_h
#define CCDrawQuad_h
-#include "cc/CCSharedQuadState.h"
+#include <public/WebCompositorQuad.h>
namespace WebCore {
-
-class CCCheckerboardDrawQuad;
-class CCDebugBorderDrawQuad;
-class CCIOSurfaceDrawQuad;
-class CCRenderPassDrawQuad;
-class CCSolidColorDrawQuad;
-class CCStreamVideoDrawQuad;
-class CCTextureDrawQuad;
-class CCTileDrawQuad;
-class CCYUVVideoDrawQuad;
-
-// CCDrawQuad is a bag of data used for drawing a quad. Because different
-// materials need different bits of per-quad data to render, classes that derive
-// from CCDrawQuad store additional data in their derived instance. The Material
-// enum is used to "safely" upcast to the derived class.
-class CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCDrawQuad);
-public:
- const IntRect& quadRect() const { return m_quadRect; }
- const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform(); }
- const WebKit::WebTransformationMatrix& layerTransform() const { return m_sharedQuadState->layerTransform(); }
- const IntRect& layerRect() const { return m_sharedQuadState->layerRect(); }
- const IntRect& scissorRect() const { return m_sharedQuadState->scissorRect(); }
- float opacity() const { return m_sharedQuadState->opacity(); }
- // For the purposes of blending, what part of the contents of this quad are opaque?
- IntRect opaqueRect() const;
- bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); }
- bool isLayerAxisAlignedIntRect() const { return m_sharedQuadState->isLayerAxisAlignedIntRect(); }
-
- // Allows changing the rect that gets drawn to make it smaller. Parameter passed
- // in will be clipped to quadRect().
- void setQuadVisibleRect(const IntRect&);
- const IntRect& quadVisibleRect() const { return m_quadVisibleRect; }
-
- enum Material {
- Invalid,
- Checkerboard,
- DebugBorder,
- IOSurfaceContent,
- RenderPass,
- TextureContent,
- SolidColor,
- TiledContent,
- YUVVideoContent,
- StreamVideoContent,
- };
-
- Material material() const { return m_material; }
- bool isDebugQuad() const { return m_material == DebugBorder; }
-
- const CCCheckerboardDrawQuad* toCheckerboardDrawQuad() const;
- const CCDebugBorderDrawQuad* toDebugBorderDrawQuad() const;
- const CCIOSurfaceDrawQuad* toIOSurfaceDrawQuad() const;
- const CCRenderPassDrawQuad* toRenderPassDrawQuad() const;
- const CCSolidColorDrawQuad* toSolidColorDrawQuad() const;
- const CCStreamVideoDrawQuad* toStreamVideoDrawQuad() const;
- const CCTextureDrawQuad* toTextureDrawQuad() const;
- const CCTileDrawQuad* toTileDrawQuad() const;
- const CCYUVVideoDrawQuad* toYUVVideoDrawQuad() const;
-
- const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
-
-protected:
- CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&);
-
- const CCSharedQuadState* m_sharedQuadState;
-
- Material m_material;
- IntRect m_quadRect;
- IntRect m_quadVisibleRect;
-
- // By default, the shared quad state determines whether or not this quad is
- // opaque or needs blending. Derived classes can override with these
- // variables.
- bool m_quadOpaque;
- bool m_needsBlending;
-
- // Be default, this rect is empty. It is used when the shared quad state and above
- // variables determine that the quad is not fully opaque but may be partially opaque.
- IntRect m_opaqueRect;
-};
-
+typedef WebKit::WebCompositorQuad CCDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h
index 405885ffb..be8c8a557 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h
@@ -48,6 +48,12 @@ public:
WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); }
+ void flush()
+ {
+ if (m_context3D)
+ m_context3D->flush();
+ }
+
private:
CCGraphicsContext() { }
explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
index 731f770c0..be19983ef 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
@@ -31,7 +31,6 @@
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
#include "PlatformCanvas.h"
-#include "TextureManager.h"
#include "cc/CCDebugRectHistory.h"
#include "cc/CCFrameRateCounter.h"
#include "cc/CCLayerTreeHostImpl.h"
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h
index 27f863ee6..77d326cbd 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h
@@ -26,26 +26,10 @@
#ifndef CCIOSurfaceDrawQuad_h
#define CCIOSurfaceDrawQuad_h
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorIOSurfaceQuad.h>
namespace WebCore {
-
-class CCIOSurfaceDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCIOSurfaceDrawQuad);
-public:
- static PassOwnPtr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
-
- const IntSize& ioSurfaceSize() const { return m_ioSurfaceSize; }
- unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; }
-
-private:
- CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
-
- IntSize m_ioSurfaceSize;
- unsigned m_ioSurfaceTextureId;
-};
-
+typedef WebKit::WebCompositorIOSurfaceQuad CCIOSurfaceDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
index 44772156d..9a88376c2 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
@@ -147,7 +147,7 @@ bool CCLayerImpl::descendantDrawsContent()
PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const
{
- return CCSharedQuadState::create(quadTransform(), drawTransform(), visibleLayerRect(), m_scissorRect, drawOpacity(), opaque());
+ return CCSharedQuadState::create(quadTransform(), m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque);
}
void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*)
@@ -172,8 +172,8 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu
if (!hasDebugBorders())
return;
- IntRect layerRect(IntPoint(), contentBounds());
- quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, debugBorderColor(), debugBorderWidth()));
+ IntRect contentRect(IntPoint(), contentBounds());
+ quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()));
}
unsigned CCLayerImpl::contentsTextureId() const
@@ -613,7 +613,7 @@ void CCLayerImpl::setDoubleSided(bool doubleSided)
Region CCLayerImpl::visibleContentOpaqueRegion() const
{
if (opaque())
- return visibleLayerRect();
+ return visibleContentRect();
return Region();
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
index 00a351b22..2b9a49bd3 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
@@ -34,6 +34,7 @@
#include "cc/CCInputHandler.h"
#include "cc/CCLayerAnimationController.h"
#include "cc/CCRenderSurface.h"
+#include "cc/CCSharedQuadState.h"
#include <public/WebFilterOperations.h>
#include <public/WebTransformationMatrix.h>
#include <wtf/OwnPtr.h>
@@ -48,7 +49,6 @@ class CCLayerSorter;
class CCLayerTreeHostImpl;
class CCQuadCuller;
class CCRenderer;
-class CCSharedQuadState;
class LayerChromium;
class CCLayerImpl : public CCLayerAnimationControllerClient {
@@ -227,8 +227,8 @@ public:
CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const;
- const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
- void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
+ const IntRect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
bool doubleSided() const { return m_doubleSided; }
void setDoubleSided(bool);
@@ -332,7 +332,7 @@ private:
bool m_layerSurfacePropertyChanged;
// Uses layer's content space.
- IntRect m_visibleLayerRect;
+ IntRect m_visibleContentRect;
bool m_masksToBounds;
bool m_opaque;
float m_opacity;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp
index 823a316a3..49d23366c 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp
@@ -99,12 +99,12 @@ void CCLayerTilingData::reset()
m_tiles.clear();
}
-void CCLayerTilingData::layerRectToTileIndices(const IntRect& layerRect, int& left, int& top, int& right, int& bottom) const
+void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const
{
- left = m_tilingData.tileXIndexFromSrcCoord(layerRect.x());
- top = m_tilingData.tileYIndexFromSrcCoord(layerRect.y());
- right = m_tilingData.tileXIndexFromSrcCoord(layerRect.maxX() - 1);
- bottom = m_tilingData.tileYIndexFromSrcCoord(layerRect.maxY() - 1);
+ left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x());
+ top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y());
+ right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1);
+ bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1);
}
IntRect CCLayerTilingData::tileRect(const Tile* tile) const
@@ -114,21 +114,21 @@ IntRect CCLayerTilingData::tileRect(const Tile* tile) const
return tileRect;
}
-Region CCLayerTilingData::opaqueRegionInLayerRect(const IntRect& layerRect) const
+Region CCLayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const
{
- if (layerRect.isEmpty())
+ if (contentRect.isEmpty())
return Region();
Region opaqueRegion;
int left, top, right, bottom;
- layerRectToTileIndices(layerRect, left, top, right, bottom);
+ contentRectToTileIndices(contentRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
Tile* tile = tileAt(i, j);
if (!tile)
continue;
- IntRect tileOpaqueRect = intersection(layerRect, tile->opaqueRect());
+ IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect());
opaqueRegion.unite(tileOpaqueRect);
}
}
@@ -141,7 +141,7 @@ void CCLayerTilingData::setBounds(const IntSize& size)
// Any tiles completely outside our new bounds are invalid and should be dropped.
int left, top, right, bottom;
- layerRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
+ contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
Vector<TileMapKey> invalidTileKeys;
for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) {
if (it->first.first > right || it->first.second > bottom)
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h
index 081fe844e..25ff179ca 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h
@@ -98,10 +98,10 @@ public:
void setBounds(const IntSize&);
IntSize bounds() const;
- void layerRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
+ void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
IntRect tileRect(const Tile*) const;
- Region opaqueRegionInLayerRect(const IntRect&) const;
+ Region opaqueRegionInContentRect(const IntRect&) const;
void reset();
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
index 414b20526..da2cb32a0 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
@@ -27,7 +27,6 @@
#include "cc/CCLayerTreeHost.h"
#include "LayerChromium.h"
-#include "ManagedTexture.h"
#include "Region.h"
#include "TraceEvent.h"
#include "TreeSynchronizer.h"
@@ -153,6 +152,7 @@ void CCLayerTreeHost::initializeLayerRenderer()
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize);
+ m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA);
m_layerRendererInitialized = true;
@@ -490,8 +490,6 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u
// Reset partial texture update requests.
m_partialTextureUpdateRequests = 0;
- prioritizeTextures(updateList);
-
bool needMoreUpdates = paintLayerContents(updateList, updater);
if (m_triggerIdleUpdates && needMoreUpdates)
setNeedsCommit();
@@ -500,13 +498,20 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u
updateList[i]->clearRenderSurface();
}
-void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList)
+void CCLayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes)
+{
+ // Surfaces have a place holder for their memory since they are managed
+ // independantly but should still be tracked and reduce other memory usage.
+ m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get());
+ m_surfaceMemoryPlaceholder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority());
+ m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryBytes);
+}
+
+void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList)
{
// Use BackToFront since it's cheap and this isn't order-dependent.
typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
- m_contentsTextureManager->clearPriorities();
-
CCPriorityCalculator calculator;
CCLayerIteratorType end = CCLayerIteratorType::end(&updateList);
for (CCLayerIteratorType it = CCLayerIteratorType::begin(&updateList); it != end; ++it) {
@@ -519,7 +524,25 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList)
it->replicaLayer()->maskLayer()->setTexturePriorities(calculator);
}
}
+}
+
+void CCLayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, CCOverdrawMetrics& metrics)
+{
+ m_contentsTextureManager->clearPriorities();
+
+ size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(renderSurfaceLayerList);
+
+ setPrioritiesForLayers(renderSurfaceLayerList);
+ setPrioritiesForSurfaces(memoryForRenderSurfacesMetric);
+ metrics.didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes());
+ metrics.didUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric);
+
+ m_contentsTextureManager->prioritizeTextures();
+}
+
+size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList)
+{
size_t readbackBytes = 0;
size_t maxBackgroundTextureBytes = 0;
size_t contentsTextureBytes = 0;
@@ -529,7 +552,7 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList)
LayerChromium* renderSurfaceLayer = updateList[i].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
- size_t bytes = TextureManager::memoryUseBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA);
+ size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA);
contentsTextureBytes += bytes;
if (renderSurface->backgroundFilters().isEmpty())
@@ -538,11 +561,9 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList)
if (bytes > maxBackgroundTextureBytes)
maxBackgroundTextureBytes = bytes;
if (!readbackBytes)
- readbackBytes = TextureManager::memoryUseBytes(m_deviceViewportSize, GraphicsContext3D::RGBA);
+ readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GraphicsContext3D::RGBA);
}
- size_t renderSurfacesBytes = readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes;
-
- m_contentsTextureManager->prioritizeTextures(renderSurfacesBytes);
+ return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes;
}
bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdater& updater)
@@ -574,7 +595,9 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList
bool needMoreUpdates = false;
bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off.
CCOcclusionTracker occlusionTracker(IntRect(IntPoint(), deviceViewportSize()), recordMetricsForFrame);
- occlusionTracker.setMinimumTrackingSize(CCOcclusionTracker::preferredMinimumTrackingSize());
+ occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize);
+
+ prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics());
CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
@@ -592,8 +615,6 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList
occlusionTracker.leaveLayer(it);
}
- occlusionTracker.overdrawMetrics().didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes());
- occlusionTracker.overdrawMetrics().didUseRenderSurfaceTextureMemoryBytes(m_contentsTextureManager->memoryForRenderSurfacesBytes());
occlusionTracker.overdrawMetrics().recordMetrics(this);
return needMoreUpdates;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
index c2143eae5..bd65650f4 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
@@ -51,7 +51,6 @@ class CCLayerChromium;
class CCLayerTreeHostImpl;
class CCLayerTreeHostImplClient;
class CCTextureUpdater;
-class ManagedTexture;
class Region;
class TextureAllocator;
class CCPrioritizedTextureManager;
@@ -96,6 +95,7 @@ struct CCLayerTreeSettings {
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
, defaultTileSize(IntSize(256, 256))
, maxUntiledLayerSize(IntSize(512, 512))
+ , minimumOcclusionTrackingSize(IntSize(160, 160))
{ }
bool acceleratePainting;
@@ -112,6 +112,7 @@ struct CCLayerTreeSettings {
size_t maxPartialTextureUpdates;
IntSize defaultTileSize;
IntSize maxUntiledLayerSize;
+ IntSize minimumOcclusionTrackingSize;
};
// Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost
@@ -284,7 +285,10 @@ private:
void updateLayers(LayerChromium*, CCTextureUpdater&);
- void prioritizeTextures(const LayerList& updateList);
+ void prioritizeTextures(const LayerList&, CCOverdrawMetrics&);
+ void setPrioritiesForSurfaces(size_t surfaceMemoryBytes);
+ void setPrioritiesForLayers(const LayerList&);
+ size_t calculateMemoryForRenderSurfaces(const LayerList& updateList);
void animateLayers(double monotonicTime);
bool animateLayersRecursive(LayerChromium* current, double monotonicTime);
@@ -308,6 +312,7 @@ private:
RefPtr<LayerChromium> m_rootLayer;
OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager;
+ OwnPtr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder;
CCLayerTreeSettings m_settings;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
index 51ae04802..1c677555a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
@@ -153,7 +153,7 @@ static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMa
}
template<typename LayerType>
-static IntRect calculateVisibleLayerRect(LayerType* layer)
+static IntRect calculateVisibleContentRect(LayerType* layer)
{
ASSERT(layer->targetRenderSurface());
@@ -176,8 +176,8 @@ static IntRect calculateVisibleLayerRect(LayerType* layer)
bounds.height() / static_cast<double>(contentBounds.height()));
transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0);
- IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform);
- return visibleLayerRect;
+ IntRect visibleContentRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform);
+ return visibleContentRect;
}
static bool isScaleOrTranslation(const WebTransformationMatrix& m)
@@ -219,7 +219,7 @@ static bool layerShouldBeSkipped(LayerType* layer)
//
// Some additional conditions need to be computed at a later point after the recursion is finished.
// - the intersection of render surface content and layer clipRect is empty
- // - the visibleLayerRect is empty
+ // - the visibleContentRect is empty
//
// Note, if the layer should not have been drawn due to being fully transparent,
// we would have skipped the entire subtree and never made it into this function,
@@ -261,6 +261,11 @@ static inline bool subtreeShouldBeSkipped(LayerChromium* layer)
template<typename LayerType>
static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent)
{
+ // The root layer has a special render surface that is set up externally, so
+ // it shouldn't be treated as a surface in this code.
+ if (!layer->parent())
+ return false;
+
// Cache this value, because otherwise it walks the entire subtree several times.
bool descendantDrawsContent = layer->descendantDrawsContent();
@@ -833,7 +838,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
}
// FIXME: Instead of using the following function to set visibility rects on a second
-// tree pass, revise calculateVisibleLayerRect() so that this can be done in a single
+// tree pass, revise calculateVisibleContentRect() so that this can be done in a single
// pass inside calculateDrawTransformsInternal<>().
template<typename LayerType, typename LayerList, typename RenderSurfaceType>
static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfaceLayerList, const FloatRect& rootScissorRect)
@@ -846,13 +851,13 @@ static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfa
if (it.representsTargetRenderSurface()) {
LayerType* maskLayer = it->maskLayer();
if (maskLayer)
- maskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds()));
+ maskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds()));
LayerType* replicaMaskLayer = it->replicaLayer() ? it->replicaLayer()->maskLayer() : 0;
if (replicaMaskLayer)
- replicaMaskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds()));
+ replicaMaskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds()));
} else if (it.representsItself()) {
- IntRect visibleLayerRect = calculateVisibleLayerRect(*it);
- it->setVisibleLayerRect(visibleLayerRect);
+ IntRect visibleContentRect = calculateVisibleContentRect(*it);
+ it->setVisibleContentRect(visibleContentRect);
IntRect scissorRect = calculateLayerScissorRect<LayerType, RenderSurfaceType>(*it, rootScissorRect);
it->setScissorRect(scissorRect);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
index 26a09e70f..ada3c8e3b 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
@@ -42,6 +42,7 @@
#include "cc/CCLayerTreeHostCommon.h"
#include "cc/CCOverdrawMetrics.h"
#include "cc/CCPageScaleAnimation.h"
+#include "cc/CCPrioritizedTextureManager.h"
#include "cc/CCRenderPassDrawQuad.h"
#include "cc/CCSettings.h"
#include "cc/CCSingleThreadProxy.h"
@@ -122,7 +123,7 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC
, m_deviceScaleFactor(1)
, m_visible(true)
, m_contentsTexturesWerePurgedSinceLastCommit(false)
- , m_memoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()))
+ , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit())
, m_headsUpDisplay(CCHeadsUpDisplay::create())
, m_pageScale(1)
, m_pageScaleDelta(1)
@@ -295,17 +296,16 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
CCLayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex];
CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
- // FIXME: Make this unique across all CCLayerTreeHostImpls.
- int globalRenderPassId = renderSurfaceLayer->id();
-
- OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, globalRenderPassId);
+ int renderPassId = renderSurfaceLayer->id();
+ OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId);
surfacePassMap.add(renderSurface, pass.get());
- frame.renderPasses.append(pass.release());
+ frame.renderPasses.append(pass.get());
+ frame.renderPassesById.add(renderPassId, pass.release());
}
bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off.
CCOcclusionTrackerImpl occlusionTracker(enclosingIntRect(m_rootScissorRect), recordMetricsForFrame);
- occlusionTracker.setMinimumTrackingSize(CCOcclusionTrackerImpl::preferredMinimumTrackingSize());
+ occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize);
if (settings().showOccludingRects)
occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingScreenSpaceRects);
@@ -329,7 +329,7 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
if (it.representsContributingRenderSurface() && !it->renderSurface()->scissorRect().isEmpty()) {
CCRenderPass* contributingRenderPass = surfacePassMap.get(it->renderSurface());
pass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker);
- } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleLayerRect()) && !it->visibleLayerRect().isEmpty() && !it->scissorRect().isEmpty()) {
+ } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleContentRect()) && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) {
it->willDraw(m_layerRenderer.get(), context());
frame.willDrawLayers.append(*it);
@@ -406,19 +406,26 @@ IntSize CCLayerTreeHostImpl::contentSize() const
return m_rootScrollLayerImpl->children()[0]->contentBounds();
}
-// static
-void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses)
+static inline CCRenderPass* findRenderPassById(int renderPassId, const CCLayerTreeHostImpl::FrameData& frame)
+{
+ CCRenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId);
+ ASSERT(it != frame.renderPassesById.end());
+ return it->second.get();
+}
+
+static void removeRenderPassesRecursive(int removeRenderPassId, CCLayerTreeHostImpl::FrameData& frame)
{
- size_t removeIndex = passes.find(firstToRemove);
+ CCRenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame);
+ size_t removeIndex = frame.renderPasses.find(removeRenderPass);
// The pass was already removed by another quad - probably the original, and we are the replica.
if (removeIndex == notFound)
return;
- OwnPtr<CCRenderPass> removedPass = passes[removeIndex].release();
- passes.remove(removeIndex);
+ const CCRenderPass* removedPass = frame.renderPasses[removeIndex];
+ frame.renderPasses.remove(removeIndex);
- // Now follow up for all RenderPass quads and remove their render passes recursively.
+ // Now follow up for all RenderPass quads and remove their RenderPasses recursively.
const CCQuadList& quadList = removedPass->quadList();
CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin();
for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) {
@@ -426,36 +433,32 @@ void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes,
if (currentQuad->material() != CCDrawQuad::RenderPass)
continue;
- CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad);
- const CCRenderPass* nextRenderPass = renderPassQuad->renderPass();
-
- // Our search is now limited up to the pass that we just removed.
- // Substitute removeIndex for bottomPass now.
- removeRenderPassesRecursive(passes, removeIndex, nextRenderPass, skippedPasses);
+ int nextRemoveRenderPassId = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId();
+ removeRenderPassesRecursive(nextRemoveRenderPassId, frame);
}
- skippedPasses.append(removedPass.release());
}
-bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad& quad) const
+bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData&) const
{
return quad.contentsChangedSinceLastFrame().isEmpty() && m_renderer.haveCachedResourcesForRenderPassId(quad.renderPassId());
}
-bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassList& passList, const CCRenderPassDrawQuad& quad) const
+bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData& frame) const
{
- size_t passIndex = passList.find(quad.renderPass());
+ const CCRenderPass* renderPass = findRenderPassById(quad.renderPassId(), frame);
+ size_t passIndex = frame.renderPasses.find(renderPass);
ASSERT(passIndex != notFound);
// If any quad or RenderPass draws into this RenderPass, then keep it.
- const CCQuadList& quadList = passList[passIndex]->quadList();
+ const CCQuadList& quadList = frame.renderPasses[passIndex]->quadList();
for (CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) {
CCDrawQuad* currentQuad = quadListIterator->get();
if (currentQuad->material() != CCDrawQuad::RenderPass)
return false;
- const CCRenderPassDrawQuad* quadInPass = static_cast<CCRenderPassDrawQuad*>(currentQuad);
- if (passList.contains(quadInPass->renderPass()))
+ const CCRenderPass* contributingPass = findRenderPassById(CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(), frame);
+ if (frame.renderPasses.contains(contributingPass))
return false;
}
return true;
@@ -470,7 +473,7 @@ template<typename RenderPassCuller>
void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame)
{
for (size_t it = culler.renderPassListBegin(frame.renderPasses); it != culler.renderPassListEnd(frame.renderPasses); it = culler.renderPassListNext(it)) {
- CCRenderPass* currentPass = frame.renderPasses[it].get();
+ const CCRenderPass* currentPass = frame.renderPasses[it];
const CCQuadList& quadList = currentPass->quadList();
CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin();
@@ -481,7 +484,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData&
continue;
CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad);
- if (!culler.shouldRemoveRenderPass(frame.renderPasses, *renderPassQuad))
+ if (!culler.shouldRemoveRenderPass(*renderPassQuad, frame))
continue;
// We are changing the vector in the middle of iteration. Because we
@@ -490,7 +493,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData&
// change. So, capture the iterator position from the end of the
// list, and restore it after the change.
int positionFromEnd = frame.renderPasses.size() - it;
- removeRenderPassesRecursive(frame.renderPasses, it, renderPassQuad->renderPass(), frame.skippedPasses);
+ removeRenderPassesRecursive(renderPassQuad->renderPassId(), frame);
it = frame.renderPasses.size() - positionFromEnd;
ASSERT(it >= 0);
}
@@ -504,6 +507,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame)
frame.renderSurfaceLayerList = &m_renderSurfaceLayerList;
frame.renderPasses.clear();
+ frame.renderPassesById.clear();
frame.renderSurfaceLayerList->clear();
frame.willDrawLayers.clear();
@@ -542,13 +546,13 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
// RenderWidget.
// The root RenderPass is the last one to be drawn.
- CCRenderPass* rootRenderPass = frame.renderPasses.last().get();
+ const CCRenderPass* rootRenderPass = frame.renderPasses.last();
m_fpsCounter->markBeginningOfFrame(currentTime());
m_layerRenderer->beginDrawingFrame(rootRenderPass);
for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
- CCRenderPass* renderPass = frame.renderPasses[i].get();
+ const CCRenderPass* renderPass = frame.renderPasses[i];
FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(m_rootScissorRect);
m_layerRenderer->drawRenderPass(renderPass, rootScissorRectInCurrentSurface);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
index 49f2fc62b..753aa384a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
@@ -85,7 +85,7 @@ public:
struct FrameData {
Vector<IntRect> occludingScreenSpaceRects;
CCRenderPassList renderPasses;
- CCRenderPassList skippedPasses;
+ CCRenderPassIdHashMap renderPassesById;
CCLayerList* renderSurfaceLayerList;
CCLayerList willDrawLayers;
};
@@ -180,7 +180,7 @@ public:
class CullRenderPassesWithCachedTextures {
public:
- bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const;
+ bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
// Iterates from the root first, in order to remove the surfaces closest
// to the root with cached textures, and all surfaces that draw into
@@ -196,7 +196,7 @@ public:
class CullRenderPassesWithNoQuads {
public:
- bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const;
+ bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
// Iterates in draw order, so that when a surface is removed, and its
// target becomes empty, then its target can be removed also.
@@ -244,8 +244,6 @@ private:
void setBackgroundTickingEnabled(bool);
IntSize contentSize() const;
- static void removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses);
-
void sendDidLoseContextRecursive(CCLayerImpl*);
void clearRenderSurfaces();
bool ensureRenderSurfaceLayerList();
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
index b49ff9083..6124ddc9c 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
@@ -310,10 +310,10 @@ static inline WebTransformationMatrix contentToTargetSurfaceTransform(const Laye
template<typename LayerType>
static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize, Vector<IntRect>* occludingScreenSpaceRects)
{
- ASSERT(layer->visibleLayerRect().contains(opaqueContents.bounds()));
+ ASSERT(layer->visibleContentRect().contains(opaqueContents.bounds()));
bool clipped;
- FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleLayerRect()), clipped);
+ FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped);
// FIXME: Find a rect interior to each transformed quad.
if (clipped || !visibleTransformedQuad.isRectilinear())
return;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
index 027fab71d..0ca966d96 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
@@ -70,8 +70,6 @@ public:
void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; }
- static IntSize preferredMinimumTrackingSize() { return IntSize(160, 160); }
-
// The following is used for visualization purposes.
void setOccludingScreenSpaceRectsContainer(Vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; }
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp
index d8cc17485..1df771386 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp
@@ -29,6 +29,7 @@
#include "CCPrioritizedTextureManager.h"
#include "CCPriorityCalculator.h"
#include "LayerRendererChromium.h"
+#include "TextureAllocator.h"
#include <algorithm>
using namespace std;
@@ -38,16 +39,17 @@ namespace WebCore {
CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format)
: m_size(size)
, m_format(format)
- , m_memorySizeBytes(0)
+ , m_bytes(0)
, m_priority(CCPriorityCalculator::lowestPriority())
, m_isAbovePriorityCutoff(false)
- , m_currentBacking(0)
+ , m_isSelfManaged(false)
+ , m_backing(0)
, m_manager(0)
{
// m_manager is set in registerTexture() so validity can be checked.
ASSERT(format || size.isEmpty());
if (format)
- m_memorySizeBytes = TextureManager::memoryUseBytes(size, format);
+ m_bytes = CCTexture::memorySizeBytes(size, format);
if (manager)
manager->registerTexture(this);
}
@@ -74,8 +76,8 @@ void CCPrioritizedTexture::setDimensions(IntSize size, GC3Denum format)
m_isAbovePriorityCutoff = false;
m_format = format;
m_size = size;
- m_memorySizeBytes = TextureManager::memoryUseBytes(size, format);
- ASSERT(m_manager || !m_currentBacking);
+ m_bytes = CCTexture::memorySizeBytes(size, format);
+ ASSERT(m_manager || !m_backing);
if (m_manager)
m_manager->returnBackingTexture(this);
}
@@ -97,8 +99,8 @@ void CCPrioritizedTexture::acquireBackingTexture(TextureAllocator* allocator)
unsigned CCPrioritizedTexture::textureId()
{
- if (m_currentBacking)
- return m_currentBacking->textureId();
+ if (m_backing)
+ return m_backing->id();
return 0;
}
@@ -107,7 +109,7 @@ void CCPrioritizedTexture::bindTexture(CCGraphicsContext* context, TextureAlloca
ASSERT(m_isAbovePriorityCutoff);
if (m_isAbovePriorityCutoff)
acquireBackingTexture(allocator);
- ASSERT(m_currentBacking);
+ ASSERT(m_backing);
WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
@@ -121,7 +123,7 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text
ASSERT(m_isAbovePriorityCutoff);
if (m_isAbovePriorityCutoff)
acquireBackingTexture(allocator);
- ASSERT(m_currentBacking);
+ ASSERT(m_backing);
WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
@@ -130,11 +132,30 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text
context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId(), 0);
}
-void CCPrioritizedTexture::setCurrentBacking(CCPrioritizedTexture::Backing* backing)
+void CCPrioritizedTexture::link(Backing* backing)
{
- if (m_currentBacking == backing)
- return;
- m_currentBacking = backing;
+ ASSERT(backing);
+ ASSERT(!backing->m_owner);
+ ASSERT(!m_backing);
+
+ m_backing = backing;
+ m_backing->m_owner = this;
+}
+
+void CCPrioritizedTexture::unlink()
+{
+ ASSERT(m_backing);
+ ASSERT(m_backing->m_owner == this);
+
+ m_backing->m_owner = 0;
+ m_backing = 0;
+}
+
+void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes)
+{
+ setDimensions(IntSize(), GraphicsContext3D::RGBA);
+ setIsSelfManaged(true);
+ m_bytes = bytes;
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h
index 9ea2fb1e4..46073c5f3 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h
@@ -26,16 +26,17 @@
#define CCPrioritizedTexture_h
#include "CCPriorityCalculator.h"
+#include "CCTexture.h"
#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "IntSize.h"
-#include "TextureManager.h"
namespace WebCore {
class CCPrioritizedTextureManager;
class CCPriorityCalculator;
class CCGraphicsContext;
+class TextureAllocator;
class CCPrioritizedTexture {
WTF_MAKE_NONCOPYABLE(CCPrioritizedTexture);
@@ -57,7 +58,7 @@ public:
void setDimensions(IntSize, GC3Denum format);
GC3Denum format() const { return m_format; }
IntSize size() const { return m_size; }
- size_t memorySizeBytes() const { return m_memorySizeBytes; }
+ size_t bytes() const { return m_bytes; }
// Set priority for the requested texture.
void setRequestPriority(int priority) { m_priority = priority; }
@@ -68,12 +69,12 @@ public:
bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
// This returns whether we still have a backing texture. This can continue
- // to be true even after canAquireBackingTexture() becomes false. In this
+ // to be true even after canAcquireBackingTexture() becomes false. In this
// case the texture can be used but shouldn't be updated since it will get
// taken away "soon".
- bool haveBackingTexture() const { return !!currentBacking(); }
+ bool haveBackingTexture() const { return !!backing(); }
- // If canAquireBackingTexture() is true acquireBackingTexture() will acquire
+ // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire
// a backing texture for use. Call this whenever the texture is actually needed.
void acquireBackingTexture(TextureAllocator*);
@@ -81,48 +82,39 @@ public:
// (all textures are visible) but we can still squeeze into the limit
// by not painting occluded textures. In this case the manager
// refuses all visible textures and requestLate() will enable
- // canAquireBackingTexture() on a call-order basis. We might want to
+ // canAcquireBackingTexture() on a call-order basis. We might want to
// just remove this in the future (carefully) and just make sure we don't
// regress OOMs situations.
bool requestLate();
- // These functions will aquire the texture if possible. If neither haveBackingTexture()
- // nor canAquireBackingTexture() is true, an ID of zero will be used/returned.
+ // These functions will acquire the texture if possible. If neither haveBackingTexture()
+ // nor canAcquireBackingTexture() is true, an ID of zero will be used/returned.
void bindTexture(CCGraphicsContext*, TextureAllocator*);
void framebufferTexture2D(CCGraphicsContext*, TextureAllocator*);
unsigned textureId();
+ // Self-managed textures are accounted for when prioritizing other textures,
+ // but they are not allocated/recycled/deleted, so this needs to be done
+ // externally. canAcquireBackingTexture() indicates if the texture would have
+ // been allowed given its priority.
+ void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; }
+ bool isSelfManaged() { return m_isSelfManaged; }
+ void setToSelfManagedMemoryPlaceholder(size_t bytes);
+
private:
friend class CCPrioritizedTextureManager;
- class Backing {
+ class Backing : public CCTexture {
WTF_MAKE_NONCOPYABLE(Backing);
public:
- IntSize size() const { return m_size; }
- GC3Denum format() const { return m_format; }
- size_t memorySizeBytes() const { return m_memorySizeBytes; }
- unsigned textureId() const { return m_textureId; }
- CCPrioritizedTexture* currentTexture() const { return m_currentTexture; }
- void setCurrentTexture(CCPrioritizedTexture* current) { m_currentTexture = current; }
+ Backing(unsigned id, IntSize size, GC3Denum format)
+ : CCTexture(id, size, format), m_owner(0) { }
+ ~Backing() { ASSERT(!m_owner); }
+ CCPrioritizedTexture* owner() { return m_owner; }
private:
- friend class CCPrioritizedTextureManager;
-
- Backing(IntSize size, GC3Denum format, unsigned textureId)
- : m_size(size)
- , m_format(format)
- , m_memorySizeBytes(TextureManager::memoryUseBytes(size, format))
- , m_textureId(textureId)
- , m_priority(CCPriorityCalculator::lowestPriority())
- , m_currentTexture(0) { }
- ~Backing() { ASSERT(!m_currentTexture); }
-
- IntSize m_size;
- GC3Denum m_format;
- size_t m_memorySizeBytes;
- unsigned m_textureId;
- int m_priority;
- CCPrioritizedTexture* m_currentTexture;
+ friend class CCPrioritizedTexture;
+ CCPrioritizedTexture* m_owner;
};
CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format);
@@ -131,17 +123,19 @@ private:
void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; }
void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; }
- Backing* currentBacking() const { return m_currentBacking; }
- void setCurrentBacking(Backing*);
+ Backing* backing() const { return m_backing; }
+ void link(Backing*);
+ void unlink();
IntSize m_size;
GC3Denum m_format;
- size_t m_memorySizeBytes;
+ size_t m_bytes;
size_t m_priority;
bool m_isAbovePriorityCutoff;
+ bool m_isSelfManaged;
- Backing* m_currentBacking;
+ Backing* m_backing;
CCPrioritizedTextureManager* m_manager;
};
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
index 5af53df04..d19e5aa19 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
@@ -55,7 +55,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager()
destroyBacking(*m_backings.begin(), 0);
}
-void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemoryBytes)
+void CCPrioritizedTextureManager::prioritizeTextures()
{
TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures");
@@ -79,31 +79,29 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory
m_memoryAvailableBytes = m_maxMemoryLimitBytes;
m_priorityCutoff = CCPriorityCalculator::lowestPriority();
- bool reservedRenderSurfaces = false;
size_t memoryBytes = 0;
for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) {
if ((*it)->requestPriority() == CCPriorityCalculator::lowestPriority())
break;
- // FIXME: We can make placeholder objects similar to textures to represent the render surface memory request.
- if (!reservedRenderSurfaces && CCPriorityCalculator::priorityIsLower((*it)->requestPriority(), CCPriorityCalculator::renderSurfacePriority())) {
- size_t newMemoryBytes = memoryBytes + renderSurfacesMemoryBytes;
+ if ((*it)->isSelfManaged()) {
+ // Account for self-managed memory immediately by reducing the memory
+ // available (since it never gets acquired).
+ size_t newMemoryBytes = memoryBytes + (*it)->bytes();
if (newMemoryBytes > m_memoryAvailableBytes) {
m_priorityCutoff = (*it)->requestPriority();
m_memoryAvailableBytes = memoryBytes;
break;
}
- m_memoryAvailableBytes -= renderSurfacesMemoryBytes;
- reservedRenderSurfaces = true;
- }
-
- size_t newMemoryBytes = memoryBytes + (*it)->memorySizeBytes();
- if (newMemoryBytes > m_memoryAvailableBytes) {
- m_priorityCutoff = (*it)->requestPriority();
- break;
+ m_memoryAvailableBytes -= (*it)->bytes();
+ } else {
+ size_t newMemoryBytes = memoryBytes + (*it)->bytes();
+ if (newMemoryBytes > m_memoryAvailableBytes) {
+ m_priorityCutoff = (*it)->requestPriority();
+ break;
+ }
+ memoryBytes = newMemoryBytes;
}
-
- memoryBytes = newMemoryBytes;
}
// Only allow textures if they are higher than the cutoff. All textures
@@ -113,8 +111,8 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory
for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) {
bool isAbovePriorityCutoff = CCPriorityCalculator::priorityIsHigher((*it)->requestPriority(), m_priorityCutoff);
(*it)->setAbovePriorityCutoff(isAbovePriorityCutoff);
- if (isAbovePriorityCutoff)
- m_memoryAboveCutoffBytes += (*it)->memorySizeBytes();
+ if (isAbovePriorityCutoff && !(*it)->isSelfManaged())
+ m_memoryAboveCutoffBytes += (*it)->bytes();
}
ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes);
@@ -157,23 +155,24 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture)
if (CCPriorityCalculator::priorityIsLower(texture->requestPriority(), m_priorityCutoff))
return false;
- size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->memorySizeBytes();
+ size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->bytes();
if (newMemoryBytes > m_memoryAvailableBytes)
return false;
m_memoryAboveCutoffBytes = newMemoryBytes;
texture->setAbovePriorityCutoff(true);
- if (texture->currentBacking()) {
- m_backings.remove(texture->currentBacking());
- m_backings.add(texture->currentBacking());
+ if (texture->backing()) {
+ m_backings.remove(texture->backing());
+ m_backings.add(texture->backing());
}
return true;
}
void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, TextureAllocator* allocator)
{
+ ASSERT(!texture->isSelfManaged());
ASSERT(texture->isAbovePriorityCutoff());
- if (texture->currentBacking() || !texture->isAbovePriorityCutoff())
+ if (texture->backing() || !texture->isAbovePriorityCutoff())
return;
// Find a backing below, by either recycling or allocating.
@@ -181,7 +180,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex
// First try to recycle
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff())
+ if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff())
break;
if ((*it)->size() == texture->size() && (*it)->format() == texture->format()) {
backing = (*it);
@@ -191,14 +190,14 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex
// Otherwise reduce memory and just allocate a new backing texures.
if (!backing) {
- reduceMemory(m_memoryAvailableBytes - texture->memorySizeBytes(), allocator);
+ reduceMemory(m_memoryAvailableBytes - texture->bytes(), allocator);
backing = createBacking(texture->size(), texture->format(), allocator);
}
// Move the used backing texture to the end of the eviction list.
- if (backing->currentTexture())
- unlink(backing->currentTexture(), backing);
- link(texture, backing);
+ if (backing->owner())
+ backing->owner()->unlink();
+ texture->link(backing);
m_backings.remove(backing);
m_backings.add(backing);
}
@@ -211,7 +210,7 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocat
// or until all backings remaining are above the cutoff.
while (memoryUseBytes() > limitBytes && m_backings.size() > 0) {
BackingSet::iterator it = m_backings.begin();
- if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff())
+ if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff())
break;
destroyBacking((*it), allocator);
}
@@ -229,9 +228,9 @@ void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator)
// backing textures (any more than 10%).
size_t wastedMemory = 0;
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- if ((*it)->currentTexture())
+ if ((*it)->owner())
break;
- wastedMemory += (*it)->memorySizeBytes();
+ wastedMemory += (*it)->bytes();
}
size_t tenPercentOfMemory = m_memoryAvailableBytes / 10;
if (wastedMemory <= tenPercentOfMemory)
@@ -244,8 +243,8 @@ void CCPrioritizedTextureManager::clearAllMemory(TextureAllocator* allocator)
// Unlink and destroy all backing textures.
while (m_backings.size() > 0) {
BackingSet::iterator it = m_backings.begin();
- if ((*it)->currentTexture())
- unlink((*it)->currentTexture(), (*it));
+ if ((*it)->owner())
+ (*it)->owner()->unlink();
destroyBacking((*it), allocator);
}
}
@@ -258,32 +257,11 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted()
clearAllMemory(0);
}
-void CCPrioritizedTextureManager::unlink(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing)
-{
- ASSERT(texture && backing);
- ASSERT(texture->currentBacking() == backing);
- ASSERT(backing->currentTexture() == texture);
-
- texture->setCurrentBacking(0);
- backing->setCurrentTexture(0);
-}
-
-void CCPrioritizedTextureManager::link(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing)
-{
- ASSERT(texture && backing);
- ASSERT(!texture->currentBacking());
- ASSERT(!backing->currentTexture());
-
- texture->setCurrentBacking(backing);
- backing->setCurrentTexture(texture);
-}
-
-
void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture)
{
ASSERT(texture);
ASSERT(!texture->textureManager());
- ASSERT(!texture->currentBacking());
+ ASSERT(!texture->backing());
ASSERT(m_textures.find(texture) == m_textures.end());
texture->setManagerInternal(this);
@@ -305,11 +283,11 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur
void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture)
{
- if (texture->currentBacking()) {
+ if (texture->backing()) {
// Move the backing texture to the front for eviction/recycling and unlink it.
- m_backings.remove(texture->currentBacking());
- m_backings.insertBefore(m_backings.begin(), texture->currentBacking());
- unlink(texture, texture->currentBacking());
+ m_backings.remove(texture->backing());
+ m_backings.insertBefore(m_backings.begin(), texture->backing());
+ texture->unlink();
}
}
@@ -317,9 +295,8 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz
{
ASSERT(allocator);
- unsigned textureId = allocator->createTexture(size, format);
- CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(size, format, textureId);
- m_memoryUseBytes += backing->memorySizeBytes();
+ CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(allocator->createTexture(size, format), size, format);
+ m_memoryUseBytes += backing->bytes();
// Put backing texture at the front for eviction, since it isn't in use yet.
m_backings.insertBefore(m_backings.begin(), backing);
return backing;
@@ -328,14 +305,15 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz
void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, TextureAllocator* allocator)
{
ASSERT(backing);
- ASSERT(!backing->currentTexture() || !backing->currentTexture()->isAbovePriorityCutoff());
+ ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff());
+ ASSERT(!backing->owner() || !backing->owner()->isSelfManaged());
ASSERT(m_backings.find(backing) != m_backings.end());
if (allocator)
- allocator->deleteTexture(backing->textureId(), backing->size(), backing->format());
- if (backing->currentTexture())
- unlink(backing->currentTexture(), backing);
- m_memoryUseBytes -= backing->memorySizeBytes();
+ allocator->deleteTexture(backing->id(), backing->size(), backing->format());
+ if (backing->owner())
+ backing->owner()->unlink();
+ m_memoryUseBytes -= backing->bytes();
m_backings.remove(backing);
delete backing;
@@ -351,15 +329,15 @@ void CCPrioritizedTextureManager::assertInvariants()
// Backings/textures must be doubly-linked and only to other backings/textures in this manager.
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- if ((*it)->currentTexture()) {
- ASSERT(m_textures.find((*it)->currentTexture()) != m_textures.end());
- ASSERT((*it)->currentTexture()->currentBacking() == (*it));
+ if ((*it)->owner()) {
+ ASSERT(m_textures.find((*it)->owner()) != m_textures.end());
+ ASSERT((*it)->owner()->backing() == (*it));
}
}
for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
- if ((*it)->currentBacking()) {
- ASSERT(m_backings.find((*it)->currentBacking()) != m_backings.end());
- ASSERT((*it)->currentBacking()->currentTexture() == (*it));
+ if ((*it)->backing()) {
+ ASSERT(m_backings.find((*it)->backing()) != m_backings.end());
+ ASSERT((*it)->backing()->owner() == (*it));
}
}
@@ -368,10 +346,10 @@ void CCPrioritizedTextureManager::assertInvariants()
// reduceMemory will not find all textures available for eviction/recycling).
bool reachedProtected = false;
for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff())
+ if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff())
reachedProtected = true;
if (reachedProtected)
- ASSERT((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff());
+ ASSERT((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff());
}
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
index 3c70b2b2a..019c45cf4 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
@@ -27,10 +27,10 @@
#include "CCPrioritizedTexture.h"
#include "CCPriorityCalculator.h"
+#include "CCTexture.h"
#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "IntSize.h"
-#include "TextureManager.h"
namespace WebCore {
@@ -50,18 +50,25 @@ public:
}
~CCPrioritizedTextureManager();
+ // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the
+ // old texture manager and is just to give us a default memory allocation before
+ // we get a callback from the GPU memory manager. We should probaby either:
+ // - wait for the callback before rendering anything instead
+ // - push this into the GPU memory manager somehow.
+ static size_t defaultMemoryAllocationLimit() { return 64 * 1024 * 1024; }
+
// memoryUseBytes() describes the number of bytes used by existing allocated textures.
// memoryAboveCutoffBytes() describes the number of bytes that would be used if all
// textures that are above the cutoff were allocated.
// memoryUseBytes() <= memoryAboveCutoffBytes() should always be true.
size_t memoryUseBytes() const { return m_memoryUseBytes; }
size_t memoryAboveCutoffBytes() const { return m_memoryAboveCutoffBytes; }
- size_t memoryForRenderSurfacesBytes() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; }
+ size_t memoryForSelfManagedTextures() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; }
void setMaxMemoryLimitBytes(size_t bytes) { m_maxMemoryLimitBytes = bytes; }
size_t maxMemoryLimitBytes() const { return m_maxMemoryLimitBytes; }
- void prioritizeTextures(size_t renderSurfacesMemoryBytes);
+ void prioritizeTextures();
void clearPriorities();
bool requestLate(CCPrioritizedTexture*);
@@ -91,8 +98,8 @@ private:
// Compare backings. Lowest priority first.
static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b)
{
- int priorityA = a->currentTexture() ? a->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority();
- int priorityB = b->currentTexture() ? b->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority();
+ int priorityA = a->owner() ? a->owner()->requestPriority() : CCPriorityCalculator::lowestPriority();
+ int priorityB = b->owner() ? b->owner()->requestPriority() : CCPriorityCalculator::lowestPriority();
if (priorityA == priorityB)
return a < b;
return CCPriorityCalculator::priorityIsLower(priorityA, priorityB);
@@ -102,9 +109,6 @@ private:
void reduceMemory(size_t limit, TextureAllocator*);
- void link(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*);
- void unlink(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*);
-
CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, TextureAllocator*);
void destroyBacking(CCPrioritizedTexture::Backing*, TextureAllocator*);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h
index 68a225be0..a90a07390 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h
@@ -28,7 +28,6 @@
#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "IntSize.h"
-#include "TextureManager.h"
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp
index 90a6ee60a..b11100af3 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp
@@ -72,7 +72,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC
OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState();
bool isReplica = false;
- surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass);
+ surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id());
m_sharedQuadStateList.append(sharedQuadState.release());
if (!surface->hasReplica())
@@ -81,7 +81,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC
// Add replica after the surface so that it appears below the surface.
OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState();
isReplica = true;
- surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass);
+ surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id());
m_sharedQuadStateList.append(replicaSharedQuadState.release());
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h
index 47ae2f747..010a7674b 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h
@@ -27,16 +27,17 @@
#define CCRenderPass_h
#include "SkColor.h"
+#include "cc/CCDrawQuad.h"
#include "cc/CCOcclusionTracker.h"
+#include "cc/CCSharedQuadState.h"
+#include <wtf/HashMap.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
-class CCDrawQuad;
class CCLayerImpl;
class CCRenderSurface;
-class CCSharedQuadState;
// A list of CCDrawQuad objects, sorted internally in front-to-back order.
class CCQuadList : public Vector<OwnPtr<CCDrawQuad> > {
@@ -81,7 +82,8 @@ protected:
bool m_hasTransparentBackground;
};
-typedef Vector<OwnPtr<CCRenderPass> > CCRenderPassList;
+typedef Vector<CCRenderPass*> CCRenderPassList;
+typedef HashMap<int, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap;
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp
index 75bd761d1..59abfbbcc 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp
@@ -27,26 +27,32 @@
#include "cc/CCRenderPassDrawQuad.h"
-#include "cc/CCRenderPass.h"
+using WebKit::WebCompositorQuad;
namespace WebCore {
-PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame)
+PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame)
{
- return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPass, isReplica, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame));
+ return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame));
}
-CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderPass, quadRect)
- , m_renderPass(renderPass)
- , m_renderPassId(renderPass->id())
+CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect)
+ , m_renderPassId(renderPassId)
, m_isReplica(isReplica)
+ , m_drawTransform(drawTransform)
, m_filters(filters)
, m_backgroundFilters(backgroundFilters)
, m_maskTextureId(maskTextureId)
, m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame)
{
- ASSERT(m_renderPass);
+ ASSERT(m_renderPassId > 0);
+}
+
+const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::RenderPass);
+ return static_cast<const CCRenderPassDrawQuad*>(quad);
}
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h
index b63a76446..a12f204ca 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h
@@ -26,34 +26,38 @@
#ifndef CCRenderPassDrawQuad_h
#define CCRenderPassDrawQuad_h
-#include "cc/CCDrawQuad.h"
+#include <public/WebCompositorQuad.h>
#include <public/WebFilterOperations.h>
+#include <public/WebTransformationMatrix.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class CCRenderPass;
-class CCRenderPassDrawQuad : public CCDrawQuad {
+class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad {
WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad);
public:
- static PassOwnPtr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame);
+ static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame);
- const CCRenderPass* renderPass() const { return m_renderPass; }
int renderPassId() const { return m_renderPassId; }
bool isReplica() const { return m_isReplica; }
unsigned maskTextureId() const { return m_maskTextureId; }
const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; }
+ // FIXME: This should be removed and we should draw the RenderPass with the quadTransform.
+ const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
+
const WebKit::WebFilterOperations& filters() const { return m_filters; }
const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
+ static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*);
private:
- CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame);
+ CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame);
- const CCRenderPass* m_renderPass;
int m_renderPassId;
bool m_isReplica;
+ WebKit::WebTransformationMatrix m_drawTransform;
WebKit::WebFilterOperations m_filters;
WebKit::WebFilterOperations m_backgroundFilters;
unsigned m_maskTextureId;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
index d3a85d2da..8bd46bf00 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
@@ -188,13 +188,13 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const
PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState() const
{
bool isOpaque = false;
- return CCSharedQuadState::create(originTransform(), drawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque);
+ return CCSharedQuadState::create(m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque);
}
PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() const
{
bool isOpaque = false;
- return CCSharedQuadState::create(replicaOriginTransform(), replicaDrawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque);
+ return CCSharedQuadState::create(m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque);
}
FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const
@@ -203,7 +203,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec
return CCMathUtil::projectClippedRect(inverseScreenSpaceTransform, rootScissorRect);
}
-void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, const CCRenderPass* renderPass)
+void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId)
{
ASSERT(!forReplica || hasReplica());
@@ -232,9 +232,10 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha
}
int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0;
+ WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();
- quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPass, forReplica, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame));
+ quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame));
}
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
index 894ea5aea..5410befed 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
@@ -31,6 +31,7 @@
#include "FloatRect.h"
#include "IntRect.h"
+#include "cc/CCSharedQuadState.h"
#include <public/WebFilterOperations.h>
#include <public/WebTransformationMatrix.h>
#include <wtf/Noncopyable.h>
@@ -41,7 +42,6 @@ namespace WebCore {
class CCDamageTracker;
class CCQuadCuller;
class CCRenderPass;
-class CCSharedQuadState;
class CCLayerImpl;
class LayerRendererChromium;
class TextStream;
@@ -130,7 +130,7 @@ public:
PassOwnPtr<CCSharedQuadState> createSharedQuadState() const;
PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const;
- void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, const CCRenderPass*);
+ void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, int renderPassId);
FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp
index 80f831541..b9f75d184 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp
@@ -24,10 +24,9 @@
*/
#include "config.h"
-
#include "cc/CCScopedTexture.h"
-#include "TextureManager.h" // For TextureAllocator
+#include "TextureAllocator.h"
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h
index 5a3c4e964..9f7241f51 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h
@@ -26,6 +26,7 @@
#ifndef CCScopedTexture_h
#define CCScopedTexture_h
+#include "TextureAllocator.h"
#include "cc/CCTexture.h"
#if !ASSERT_DISABLED
@@ -34,7 +35,6 @@
namespace WebCore {
-class TextureAllocator;
class CCScopedTexture : protected CCTexture {
WTF_MAKE_NONCOPYABLE(CCScopedTexture);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h
index 4540a06f8..79036ddd4 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,40 +26,10 @@
#ifndef CCSharedQuadState_h
#define CCSharedQuadState_h
-#include "FloatQuad.h"
-#include "IntRect.h"
-#include <public/WebTransformationMatrix.h>
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorSharedQuadState.h>
namespace WebCore {
-
-class CCSharedQuadState {
- WTF_MAKE_NONCOPYABLE(CCSharedQuadState);
-public:
- static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque);
-
- // The transform that quads in a CCDrawQuad should be transformed with.
- const WebKit::WebTransformationMatrix& quadTransform() const { return m_quadTransform; }
- // The transform that layerRect() should be transformed with.
- const WebKit::WebTransformationMatrix& layerTransform() const { return m_layerTransform; }
- const IntRect& layerRect() const { return m_layerRect; }
- const IntRect& scissorRect() const { return m_scissorRect; }
-
- float opacity() const { return m_opacity; }
- bool isOpaque() const { return m_opaque; }
- bool isLayerAxisAlignedIntRect() const;
-
-private:
- CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque);
-
- WebKit::WebTransformationMatrix m_quadTransform;
- WebKit::WebTransformationMatrix m_layerTransform;
- IntRect m_layerRect;
- IntRect m_scissorRect;
- float m_opacity;
- bool m_opaque;
-};
-
+typedef WebKit::WebCompositorSharedQuadState CCSharedQuadState;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h
index 83ea34066..b6c0ee025 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,25 +26,10 @@
#ifndef CCSolidColorDrawQuad_h
#define CCSolidColorDrawQuad_h
-#include "SkColor.h"
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorSolidColorQuad.h>
namespace WebCore {
-
-class CCSolidColorDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCSolidColorDrawQuad);
-public:
- static PassOwnPtr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor color() const { return m_color; };
-
-private:
- CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor m_color;
-};
-
+typedef WebKit::WebCompositorSolidColorQuad CCSolidColorDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h
index 3037348d3..a1890611a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h
@@ -26,27 +26,10 @@
#ifndef CCStreamVideoDrawQuad_h
#define CCStreamVideoDrawQuad_h
-#include "cc/CCDrawQuad.h"
-#include <public/WebTransformationMatrix.h>
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorStreamVideoQuad.h>
namespace WebCore {
-
-class CCStreamVideoDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCStreamVideoDrawQuad);
-public:
- static PassOwnPtr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
-
- unsigned textureId() const { return m_textureId; }
- const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; }
-
-private:
- CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
-
- unsigned m_textureId;
- WebKit::WebTransformationMatrix m_matrix;
-};
-
+typedef WebKit::WebCompositorStreamVideoQuad CCStreamVideoDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h
index a29610469..0d5d9f768 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h
@@ -35,6 +35,10 @@ namespace WebCore {
class CCTexture {
public:
CCTexture() : m_id(0) { }
+ CCTexture(unsigned id, IntSize size, GC3Denum format)
+ : m_id(id)
+ , m_size(size)
+ , m_format(format) { }
unsigned id() const { return m_id; }
const IntSize& size() const { return m_size; }
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h
index a4baefa13..28c3d9132 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h
@@ -26,32 +26,10 @@
#ifndef CCTextureDrawQuad_h
#define CCTextureDrawQuad_h
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorTextureQuad.h>
namespace WebCore {
-
-class CCTextureDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCTextureDrawQuad);
-public:
- static PassOwnPtr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
-
- unsigned textureId() const { return m_textureId; }
- bool premultipliedAlpha() const { return m_premultipliedAlpha; }
- FloatRect uvRect() const { return m_uvRect; }
- bool flipped() const { return m_flipped; }
-
- void setNeedsBlending();
-
-private:
- CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned texture_id, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
-
- unsigned m_textureId;
- bool m_premultipliedAlpha;
- FloatRect m_uvRect;
- bool m_flipped;
-};
-
+typedef WebKit::WebCompositorTextureQuad CCTextureDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp
index 3190d82ff..bc1ed75af 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp
@@ -39,6 +39,8 @@ using namespace std;
namespace WebCore {
+static const int kUploadFlushPeriod = 4;
+
CCTextureUpdater::CCTextureUpdater()
: m_entryIndex(0)
{
@@ -93,12 +95,20 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo
uploader->beginUploads();
+ int fullUploadCount = 0;
size_t maxIndex = min(m_entryIndex + count, m_fullEntries.size());
for (index = m_entryIndex; index < maxIndex; ++index) {
UpdateEntry& entry = m_fullEntries[index];
uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect);
+ fullUploadCount++;
+ if (!(fullUploadCount % kUploadFlushPeriod))
+ context->flush();
}
+ // Make sure there are no dangling uploads without a flush.
+ if (fullUploadCount % kUploadFlushPeriod)
+ context->flush();
+
bool moreUploads = maxIndex < m_fullEntries.size();
ASSERT(m_partialEntries.size() <= count);
@@ -116,8 +126,16 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo
for (index = 0; index < m_partialEntries.size(); ++index) {
UpdateEntry& entry = m_partialEntries[index];
uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect);
+ if (!((index+1) % kUploadFlushPeriod))
+ context->flush();
}
+ // Make sure there are no dangling partial uploads without a flush.
+ // Note: We don't need to use (index+1) in this case because index was
+ // incremented at the end of the for loop.
+ if (index % kUploadFlushPeriod)
+ context->flush();
+
uploader->endUploads();
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h
index 33501a806..d530f4a48 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,44 +26,10 @@
#ifndef CCTileDrawQuad_h
#define CCTileDrawQuad_h
-#include "GraphicsTypes3D.h"
-#include "cc/CCDrawQuad.h"
-#include <wtf/PassOwnPtr.h>
+#include <public/WebCompositorTileQuad.h>
namespace WebCore {
-
-class CCTileDrawQuad : public CCDrawQuad {
- WTF_MAKE_NONCOPYABLE(CCTileDrawQuad);
-public:
- static PassOwnPtr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
-
- Platform3DObject textureId() const { return m_textureId; }
- IntPoint textureOffset() const { return m_textureOffset; }
- IntSize textureSize() const { return m_textureSize; }
- GC3Dint textureFilter() const { return m_textureFilter; }
- bool swizzleContents() const { return m_swizzleContents; }
-
- bool leftEdgeAA() const { return m_leftEdgeAA; }
- bool topEdgeAA() const { return m_topEdgeAA; }
- bool rightEdgeAA() const { return m_rightEdgeAA; }
- bool bottomEdgeAA() const { return m_bottomEdgeAA; }
-
- bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); }
-
-private:
- CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
-
- Platform3DObject m_textureId;
- IntPoint m_textureOffset;
- IntSize m_textureSize;
- GC3Dint m_textureFilter;
- bool m_swizzleContents;
- bool m_leftEdgeAA;
- bool m_topEdgeAA;
- bool m_rightEdgeAA;
- bool m_bottomEdgeAA;
-};
-
+typedef WebKit::WebCompositorTileQuad CCTileDrawQuad;
}
#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
index 564e3696b..1b2108912 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
@@ -54,8 +54,6 @@ static const int debugTileBorderMissingTileColorRed = 255;
static const int debugTileBorderMissingTileColorGreen = 0;
static const int debugTileBorderMissingTileColorBlue = 0;
-class ManagedTexture;
-
class DrawableTile : public CCLayerTilingData::Tile {
WTF_MAKE_NONCOPYABLE(DrawableTile);
public:
@@ -142,13 +140,13 @@ WebTransformationMatrix CCTiledLayerImpl::quadTransform() const
void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles)
{
- const IntRect& layerRect = visibleLayerRect();
+ const IntRect& contentRect = visibleContentRect();
- if (!m_tiler || m_tiler->hasEmptyBounds() || layerRect.isEmpty())
+ if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty())
return;
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
if (hasDebugBorders()) {
for (int j = top; j <= bottom; ++j) {
@@ -174,7 +172,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta
DrawableTile* tile = tileAt(i, j);
IntRect tileRect = m_tiler->tileBounds(i, j);
IntRect displayRect = tileRect;
- tileRect.intersect(layerRect);
+ tileRect.intersect(contentRect);
// Skip empty tiles.
if (tileRect.isEmpty())
@@ -189,7 +187,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta
}
IntRect tileOpaqueRect = tile->opaqueRect();
- tileOpaqueRect.intersect(layerRect);
+ tileOpaqueRect.intersect(contentRect);
// Keep track of how the top left has moved, so the texture can be
// offset the same amount.
@@ -235,8 +233,8 @@ Region CCTiledLayerImpl::visibleContentOpaqueRegion() const
if (m_skipsDraw)
return Region();
if (opaque())
- return visibleLayerRect();
- return m_tiler->opaqueRegionInLayerRect(visibleLayerRect());
+ return visibleContentRect();
+ return m_tiler->opaqueRegionInContentRect(visibleContentRect());
}
void CCTiledLayerImpl::didLoseContext()
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
index 3e1f58135..cc349c8e5 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
@@ -35,7 +35,7 @@
#include "LayerTextureSubImage.h"
#include "NotImplemented.h"
#include "TextStream.h"
-#include "TextureManager.h" // For TextureAllocator
+#include "TextureAllocator.h"
#include "cc/CCGraphicsContext.h"
#include "cc/CCLayerTreeHostImpl.h"
#include "cc/CCProxy.h"
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
index b2e088fcf..cd5db09bc 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp
index a2d62ba44..43f2e2f6f 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp
@@ -27,19 +27,27 @@
#include "cc/CCYUVVideoDrawQuad.h"
+using WebKit::WebCompositorQuad;
+
namespace WebCore {
-PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane)
+PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane)
{
return adoptPtr(new CCYUVVideoDrawQuad(sharedQuadState, quadRect, yPlane, uPlane, vPlane));
}
-CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane)
- : CCDrawQuad(sharedQuadState, CCDrawQuad::YUVVideoContent, quadRect)
+CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane)
+ : WebCompositorQuad(sharedQuadState, WebCompositorQuad::YUVVideoContent, quadRect)
, m_yPlane(yPlane)
, m_uPlane(uPlane)
, m_vPlane(vPlane)
{
}
+const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad)
+{
+ ASSERT(quad->material() == WebCompositorQuad::YUVVideoContent);
+ return static_cast<const CCYUVVideoDrawQuad*>(quad);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h
index 0cd758c5b..6684ad897 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h
@@ -26,23 +26,24 @@
#ifndef CCYUVVideoDrawQuad_h
#define CCYUVVideoDrawQuad_h
-#include "cc/CCDrawQuad.h"
#include "cc/CCVideoLayerImpl.h"
+#include <public/WebCompositorQuad.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
-class CCYUVVideoDrawQuad : public CCDrawQuad {
+class CCYUVVideoDrawQuad : public WebKit::WebCompositorQuad {
WTF_MAKE_NONCOPYABLE(CCYUVVideoDrawQuad);
public:
- static PassOwnPtr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
+ static PassOwnPtr<CCYUVVideoDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; }
const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; }
const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; }
+ static const CCYUVVideoDrawQuad* materialCast(const WebKit::WebCompositorQuad*);
private:
- CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
+ CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
CCVideoLayerImpl::FramePlane m_yPlane;
CCVideoLayerImpl::FramePlane m_uPlane;
diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
index f30b181f6..fbfe6379f 100644
--- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
+++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
@@ -59,13 +59,13 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon
CGFontRef cgFont = 0;
loadFont(nsFont, size, m_font, cgFont);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// FIXME: Chromium: The following code isn't correct for the Chromium port since the sandbox might
// have blocked font loading, in which case we'll only have the real loaded font file after the call to loadFont().
{
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait;
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
m_isCompositeFontReference = traits & kCTFontCompositeTrait;
#endif
}
@@ -150,11 +150,11 @@ void FontPlatformData::setFont(NSFont *font)
#endif
m_cgFont.adoptCF(cgFont);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
{
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait;
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
m_isCompositeFontReference = traits & kCTFontCompositeTrait;
#endif
}
@@ -251,7 +251,7 @@ static bool canSetCascadeListForCustomFont()
}
return systemVersion >= 0x1060;
-#elif !defined(BUILDING_ON_LEOPARD)
+#elif PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
return true;
#else
return false;
diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.cpp b/Source/WebCore/platform/graphics/filters/FEBlend.cpp
index aa733d90f..363a75b7f 100644
--- a/Source/WebCore/platform/graphics/filters/FEBlend.cpp
+++ b/Source/WebCore/platform/graphics/filters/FEBlend.cpp
@@ -24,6 +24,7 @@
#if ENABLE(FILTERS)
#include "FEBlend.h"
+#include "FEBlendNEON.h"
#include "Filter.h"
#include "FloatPoint.h"
@@ -86,26 +87,12 @@ static inline unsigned char lighten(unsigned char colorA, unsigned char colorB,
return ((std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)) / 255);
}
-void FEBlend::platformApplySoftware()
+void FEBlend::platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB,
+ Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength)
{
- FilterEffect* in = inputEffect(0);
- FilterEffect* in2 = inputEffect(1);
-
- ASSERT(m_mode > FEBLEND_MODE_UNKNOWN);
- ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN);
+ RefPtr<Uint8ClampedArray> srcPixelArrayA = pixelArrayA;
+ RefPtr<Uint8ClampedArray> srcPixelArrayB = pixelArrayB;
- Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult();
- if (!dstPixelArray)
- return;
-
- IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
- RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect);
-
- IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect());
- RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect);
-
- unsigned pixelArrayLength = srcPixelArrayA->length();
- ASSERT(pixelArrayLength == srcPixelArrayB->length());
for (unsigned pixelOffset = 0; pixelOffset < pixelArrayLength; pixelOffset += 4) {
unsigned char alphaA = srcPixelArrayA->item(pixelOffset + 3);
unsigned char alphaB = srcPixelArrayB->item(pixelOffset + 3);
@@ -143,6 +130,45 @@ void FEBlend::platformApplySoftware()
}
}
+void FEBlend::platformApplySoftware()
+{
+ FilterEffect* in = inputEffect(0);
+ FilterEffect* in2 = inputEffect(1);
+
+ ASSERT(m_mode > FEBLEND_MODE_UNKNOWN);
+ ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN);
+
+ Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult();
+ if (!dstPixelArray)
+ return;
+
+ IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
+ RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect);
+
+ IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect());
+ RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect);
+
+ unsigned pixelArrayLength = srcPixelArrayA->length();
+ ASSERT(pixelArrayLength == srcPixelArrayB->length());
+
+#if HAVE(ARM_NEON_INTRINSICS)
+ if (pixelArrayLength >= 8)
+ platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength);
+ else { // If there is just one pixel we expand it to two.
+ ASSERT(pixelArrayLength > 0);
+ uint32_t sourceA[2] = {0, 0};
+ uint32_t sourceBAndDest[2] = {0, 0};
+
+ sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0];
+ sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0];
+ platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8);
+ reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0];
+ }
+#else
+ platformApplyGeneric(srcPixelArrayA, srcPixelArrayB, dstPixelArray, pixelArrayLength);
+#endif
+}
+
void FEBlend::dump()
{
}
diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.h b/Source/WebCore/platform/graphics/filters/FEBlend.h
index 68cd1d37a..cc72e4aca 100644
--- a/Source/WebCore/platform/graphics/filters/FEBlend.h
+++ b/Source/WebCore/platform/graphics/filters/FEBlend.h
@@ -45,6 +45,11 @@ public:
BlendModeType blendMode() const;
bool setBlendMode(BlendModeType);
+ void platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB,
+ Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength);
+ void platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray,
+ unsigned colorArrayLength);
+
virtual void platformApplySoftware();
virtual void dump();
diff --git a/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h
new file mode 100644
index 000000000..97418f2c1
--- /dev/null
+++ b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2012 University of Szeged
+ * Copyright (C) 2012 Gabor Rapcsanyi
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FEBlendNEON_h
+#define FEBlendNEON_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS)
+
+#include "FEBlend.h"
+#include <arm_neon.h>
+
+namespace WebCore {
+
+class FEBlendUtilitiesNEON {
+public:
+ static inline uint16x8_t div255(uint16x8_t num, uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t quotient = vshrq_n_u16(num, 8);
+ uint16x8_t remainder = vaddq_u16(vsubq_u16(num, vmulq_u16(sixteenConst255, quotient)), sixteenConstOne);
+ return vaddq_u16(quotient, vshrq_n_u16(remainder, 8));
+ }
+
+ static inline uint16x8_t normal(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t,
+ uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA);
+ uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB);
+ uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne);
+ return vaddq_u16(tmp3, pixelA);
+ }
+
+ static inline uint16x8_t multiply(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB,
+ uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA);
+ uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB);
+ uint16x8_t tmp3 = vaddq_u16(vsubq_u16(sixteenConst255, alphaB), pixelB);
+ uint16x8_t tmp4 = vmulq_u16(tmp3, pixelA);
+ uint16x8_t tmp5 = vaddq_u16(tmp2, tmp4);
+ return div255(tmp5, sixteenConst255, sixteenConstOne);
+ }
+
+ static inline uint16x8_t screen(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t, uint16x8_t,
+ uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t tmp1 = vaddq_u16(pixelA, pixelB);
+ uint16x8_t tmp2 = vmulq_u16(pixelA, pixelB);
+ uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne);
+ return vsubq_u16(tmp1, tmp3);
+ }
+
+ static inline uint16x8_t darken(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB,
+ uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA);
+ uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB);
+ uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne);
+ uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA);
+
+ uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB);
+ uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA);
+ uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne);
+ uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB);
+
+ return vminq_u16(tmp4, tmp8);
+ }
+
+ static inline uint16x8_t lighten(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB,
+ uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne)
+ {
+ uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA);
+ uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB);
+ uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne);
+ uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA);
+
+ uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB);
+ uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA);
+ uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne);
+ uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB);
+
+ return vmaxq_u16(tmp4, tmp8);
+ }
+};
+
+void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray,
+ unsigned colorArrayLength)
+{
+ uint8_t* sourcePixelA = reinterpret_cast<uint8_t*>(srcPixelArrayA);
+ uint8_t* sourcePixelB = reinterpret_cast<uint8_t*>(srcPixelArrayB);
+ uint8_t* destinationPixel = reinterpret_cast<uint8_t*>(dstPixelArray);
+
+ uint16x8_t sixteenConst255 = vdupq_n_u16(255);
+ uint16x8_t sixteenConstOne = vdupq_n_u16(1);
+
+ unsigned colorOffset = 0;
+ while (colorOffset < colorArrayLength) {
+ unsigned char alphaA1 = srcPixelArrayA[colorOffset + 3];
+ unsigned char alphaB1 = srcPixelArrayB[colorOffset + 3];
+ unsigned char alphaA2 = srcPixelArrayA[colorOffset + 7];
+ unsigned char alphaB2 = srcPixelArrayB[colorOffset + 7];
+
+ uint16x8_t doubblePixelA = vmovl_u8(vld1_u8(sourcePixelA + colorOffset));
+ uint16x8_t doubblePixelB = vmovl_u8(vld1_u8(sourcePixelB + colorOffset));
+ uint16x8_t alphaA = vcombine_u16(vdup_n_u16(alphaA1), vdup_n_u16(alphaA2));
+ uint16x8_t alphaB = vcombine_u16(vdup_n_u16(alphaB1), vdup_n_u16(alphaB2));
+
+ uint16x8_t result;
+ switch (m_mode) {
+ case FEBLEND_MODE_NORMAL:
+ result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
+ break;
+ case FEBLEND_MODE_MULTIPLY:
+ result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
+ break;
+ case FEBLEND_MODE_SCREEN:
+ result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
+ break;
+ case FEBLEND_MODE_DARKEN:
+ result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
+ break;
+ case FEBLEND_MODE_LIGHTEN:
+ result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
+ break;
+ case FEBLEND_MODE_UNKNOWN:
+ default:
+ result = vdupq_n_u16(0);
+ break;
+ }
+
+ vst1_u8(destinationPixel + colorOffset, vmovn_u16(result));
+
+ unsigned char alphaR1 = 255 - ((255 - alphaA1) * (255 - alphaB1)) / 255;
+ unsigned char alphaR2 = 255 - ((255 - alphaA2) * (255 - alphaB2)) / 255;
+
+ dstPixelArray[colorOffset + 3] = alphaR1;
+ dstPixelArray[colorOffset + 7] = alphaR2;
+
+ colorOffset += 8;
+ if (colorOffset > colorArrayLength) {
+ ASSERT(colorOffset - 4 == colorArrayLength);
+ colorOffset = colorArrayLength - 8;
+ }
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS)
+
+#endif // FEBlendNEON_h
diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index f2b86b27e..fba8252da 100644
--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -1624,7 +1624,7 @@ bool MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin() const
bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
{
-#if defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
// See <rdar://problem/7389945>
return false;
#else
diff --git a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp
index ea3430aa5..46ff53b4f 100644
--- a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp
+++ b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp
@@ -19,13 +19,13 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "GdkCairoUtilities.h"
#include <wtf/gobject/GOwnPtr.h>
#include "GRefPtrGtk.h"
#include "MIMETypeRegistry.h"
#include <cairo.h>
#include <gtk/gtk.h>
+#include <wtf/text/Base64.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp
index cc8efeb43..19a0b9a6d 100644
--- a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp
+++ b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp
@@ -187,7 +187,8 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
HarfBuzzShaper shaper(this, run);
if (!shaper.shape(&glyphBuffer))
return;
- drawGlyphBuffer(gc, run, glyphBuffer, point);
+ FloatPoint adjustedPoint = shaper.adjustStartPoint(point);
+ drawGlyphBuffer(gc, run, glyphBuffer, adjustedPoint);
#else
SkCanvas* canvas = gc->platformContext()->canvas();
ComplexTextController controller(this, run, point.x(), point.y());
diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
index 695531cc1..48b162474 100644
--- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
+++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
@@ -175,31 +175,19 @@ String FontPlatformData::description() const
void FontPlatformData::setupPaint(SkPaint* paint) const
{
- const float ts = m_textSize >= 0 ? m_textSize : 12;
+ paint->setAntiAlias(m_style.useAntiAlias);
+ paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle));
+ paint->setEmbeddedBitmapText(m_style.useBitmaps);
+ paint->setAutohinted(m_style.useAutoHint);
+ paint->setSubpixelText(m_style.useSubpixelPositioning);
+ if (m_style.useAntiAlias)
+ paint->setLCDRenderText(m_style.useSubpixelRendering);
- paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? useSkiaAntiAlias : m_style.useAntiAlias);
- switch (m_style.useHinting) {
- case FontRenderStyle::NoPreference:
- paint->setHinting(skiaHinting);
- break;
- case 0:
- paint->setHinting(SkPaint::kNo_Hinting);
- break;
- default:
- paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle));
- break;
- }
-
- paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? useSkiaBitmaps : m_style.useBitmaps);
+ const float ts = m_textSize >= 0 ? m_textSize : 12;
paint->setTextSize(SkFloatToScalar(ts));
paint->setTypeface(m_typeface);
paint->setFakeBoldText(m_fakeBold);
paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0);
- paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? useSkiaAutoHint : m_style.useAutoHint);
- paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? useSkiaSubpixelPositioning : m_style.useSubpixelPositioning);
-
- if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && useSkiaAntiAlias))
- paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? useSkiaSubpixelRendering : m_style.useSubpixelRendering);
}
SkFontID FontPlatformData::uniqueID() const
@@ -272,6 +260,26 @@ HarfbuzzFace* FontPlatformData::harfbuzzFace() const
void FontPlatformData::querySystemForRenderStyle()
{
PlatformSupport::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style);
+
+ // Fix FontRenderStyle::NoPreference to actual styles.
+ if (m_style.useAntiAlias == FontRenderStyle::NoPreference)
+ m_style.useAntiAlias = useSkiaAntiAlias;
+
+ if (!m_style.useHinting)
+ m_style.hintStyle = SkPaint::kNo_Hinting;
+ else if (m_style.useHinting == FontRenderStyle::NoPreference)
+ m_style.hintStyle = skiaHinting;
+
+ if (m_style.useBitmaps == FontRenderStyle::NoPreference)
+ m_style.useBitmaps = useSkiaBitmaps;
+ if (m_style.useAutoHint == FontRenderStyle::NoPreference)
+ m_style.useAutoHint = useSkiaAutoHint;
+ if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference)
+ m_style.useSubpixelPositioning = useSkiaSubpixelPositioning;
+ if (m_style.useAntiAlias == FontRenderStyle::NoPreference)
+ m_style.useAntiAlias = useSkiaAntiAlias;
+ if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference)
+ m_style.useSubpixelRendering = useSkiaSubpixelRendering;
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
index b4423f400..6f4eca331 100644
--- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
+++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
@@ -139,6 +139,9 @@ public:
HarfbuzzFace* harfbuzzFace() const;
#endif
+ // The returned styles are all actual styles without FontRenderStyle::NoPreference.
+ const FontRenderStyle& fontRenderStyle() const { return m_style; }
+
// -------------------------------------------------------------------------
// Global font preferences...
diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp
index 3eed897ba..68d196df1 100644
--- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp
+++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp
@@ -32,6 +32,7 @@
#include "HarfBuzzShaper.h"
#include "Font.h"
+#include "HarfBuzzFace.h"
#include "SurrogatePairAwareTextIterator.h"
#include "TextRun.h"
#include "hb-icu.h"
@@ -43,19 +44,47 @@
namespace WebCore {
+template<typename T>
+class HarfBuzzScopedPtr {
+public:
+ typedef void (*DestroyFunction)(T*);
+
+ HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy)
+ : m_ptr(ptr)
+ , m_destroy(destroy)
+ {
+ ASSERT(m_destroy);
+ }
+ ~HarfBuzzScopedPtr()
+ {
+ if (m_ptr)
+ (*m_destroy)(m_ptr);
+ }
+
+ T* get() { return m_ptr; }
+private:
+ T* m_ptr;
+ DestroyFunction m_destroy;
+};
+
static inline float harfbuzzPositionToFloat(hb_position_t value)
{
return static_cast<float>(value) / (1 << 16);
}
-HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection direction, hb_buffer_t* harfbuzzBuffer)
- : m_numCharacters(numCharacters)
+HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction)
+ : m_fontData(fontData)
+ , m_startIndex(startIndex)
+ , m_numCharacters(numCharacters)
, m_direction(direction)
{
+}
+
+void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfbuzzBuffer)
+{
m_numGlyphs = hb_buffer_get_length(harfbuzzBuffer);
m_glyphs.resize(m_numGlyphs);
m_advances.resize(m_numGlyphs);
- m_offsets.resize(m_numGlyphs);
m_glyphToCharacterIndex.resize(m_numGlyphs);
m_logClusters.resize(m_numCharacters);
@@ -82,10 +111,9 @@ HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection d
}
}
-void HarfBuzzShaper::HarfBuzzRun::setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float advance)
+void HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance)
{
m_glyphs[index] = glyphId;
- m_offsets[index].set(x, y);
m_advances[index] = advance;
}
@@ -106,31 +134,49 @@ int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(int targetX)
return rtl() ? 0 : m_numCharacters;
}
-int HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset)
+float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset)
{
ASSERT(offset < m_numCharacters);
unsigned glyphIndex = m_logClusters[offset];
- ASSERT(glyphIndex < m_numGlyphs);
- float position = m_offsets[glyphIndex].x();
+ ASSERT(glyphIndex <= m_numGlyphs);
+ float position = 0;
+ for (unsigned i = 0; i < glyphIndex; ++i)
+ position += m_advances[i];
if (rtl())
position += m_advances[glyphIndex];
- return roundf(position);
+ return position;
+}
+
+static void normalizeCharacters(const UChar* source, UChar* destination, int length)
+{
+ int position = 0;
+ bool error = false;
+ while (position < length) {
+ UChar32 character;
+ int nextPosition = position;
+ U16_NEXT(source, nextPosition, length, character);
+ if (Font::treatAsSpace(character))
+ character = ' ';
+ else if (Font::treatAsZeroWidthSpaceInComplexScript(character))
+ character = zeroWidthSpace;
+ U16_APPEND(destination, position, length, character, error);
+ ASSERT_UNUSED(error, !error);
+ position = nextPosition;
+ }
}
HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run)
: HarfBuzzShaperBase(font, run)
- , m_startIndexOfCurrentRun(0)
- , m_numCharactersOfCurrentRun(0)
- , m_harfbuzzBuffer(0)
{
- setNormalizedBuffer();
+ m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
+ m_normalizedBufferLength = m_run.length();
+ normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength);
+ setPadding(m_run.expansion());
setFontFeatures();
}
HarfBuzzShaper::~HarfBuzzShaper()
{
- if (m_harfbuzzBuffer)
- hb_buffer_destroy(m_harfbuzzBuffer);
}
void HarfBuzzShaper::setFontFeatures()
@@ -152,101 +198,101 @@ void HarfBuzzShaper::setFontFeatures()
bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer)
{
- m_totalWidth = 0;
- while (setupHarfBuzzRun()) {
- if (!shapeHarfBuzzRun())
- return false;
- setGlyphPositionsForHarfBuzzRun(glyphBuffer);
- }
-
- if (!m_harfbuzzRuns.size())
+ if (!collectHarfBuzzRuns())
return false;
+ m_totalWidth = 0;
+ if (!shapeHarfBuzzRuns(glyphBuffer))
+ return false;
+ m_totalWidth = roundf(m_totalWidth);
return true;
}
-bool HarfBuzzShaper::setupHarfBuzzRun()
+FloatPoint HarfBuzzShaper::adjustStartPoint(const FloatPoint& point)
{
- m_startIndexOfCurrentRun += m_numCharactersOfCurrentRun;
+ return point + m_startOffset;
+}
- // Iterate through the text to take the largest range that stays within
- // a single font.
- int endOfRunIndex = m_normalizedBufferLength - m_startIndexOfCurrentRun;
- SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, 0, endOfRunIndex, endOfRunIndex);
+bool HarfBuzzShaper::collectHarfBuzzRuns()
+{
+ SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get(), 0, m_normalizedBufferLength, m_normalizedBufferLength);
UChar32 character;
unsigned clusterLength = 0;
+ unsigned startIndexOfCurrentRun = 0;
if (!iterator.consume(character, clusterLength))
return false;
- m_currentFontData = m_font->glyphDataForCharacter(character, false).fontData;
+ const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
UErrorCode errorCode = U_ZERO_ERROR;
- UScriptCode currentScript = uscript_getScript(character, &errorCode);
+ UScriptCode nextScript = uscript_getScript(character, &errorCode);
if (U_FAILURE(errorCode))
return false;
- if (currentScript == USCRIPT_INHERITED)
- currentScript = USCRIPT_COMMON;
- for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) {
- const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
- if (nextFontData != m_currentFontData)
- break;
- UScriptCode nextScript = uscript_getScript(character, &errorCode);
- if (U_FAILURE(errorCode))
- return false;
- if (currentScript == nextScript || nextScript == USCRIPT_INHERITED || nextScript == USCRIPT_COMMON)
- continue;
- if (currentScript == USCRIPT_COMMON)
- currentScript = nextScript;
- else
- break;
- }
- m_numCharactersOfCurrentRun = iterator.currentCharacter();
-
- if (!m_harfbuzzBuffer) {
- m_harfbuzzBuffer = hb_buffer_create();
- hb_buffer_set_unicode_funcs(m_harfbuzzBuffer, hb_icu_get_unicode_funcs());
- } else
- hb_buffer_reset(m_harfbuzzBuffer);
- hb_buffer_set_script(m_harfbuzzBuffer, hb_icu_script_to_script(currentScript));
-
- // WebKit always sets direction to LTR during width calculation.
- // We only set direction when direction is explicitly set to RTL so that
- // preventng wrong width calculation.
- if (m_run.rtl())
- hb_buffer_set_direction(m_harfbuzzBuffer, HB_DIRECTION_RTL);
-
- // Determine whether this run needs to be converted to small caps.
- // nextScriptRun() will always send us a run of the same case, because a
- // case change while in small-caps mode always results in different
- // FontData, so we only need to check the first character's case.
- if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[m_startIndexOfCurrentRun])) {
- String upperText = String(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun);
- upperText.makeUpper();
- m_currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
- hb_buffer_add_utf16(m_harfbuzzBuffer, upperText.characters(), m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun);
- } else
- hb_buffer_add_utf16(m_harfbuzzBuffer, m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun);
- return true;
+ do {
+ const SimpleFontData* currentFontData = nextFontData;
+ UScriptCode currentScript = nextScript;
+
+ for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) {
+ nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
+ if (nextFontData != currentFontData)
+ break;
+ nextScript = uscript_getScript(character, &errorCode);
+ if (U_FAILURE(errorCode))
+ return false;
+ if ((currentScript != nextScript) && (currentScript != USCRIPT_INHERITED))
+ break;
+ }
+ unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun;
+ m_harfbuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction()));
+ currentFontData = nextFontData;
+ startIndexOfCurrentRun = iterator.currentCharacter();
+ } while (iterator.consume(character, clusterLength));
+
+ return !m_harfbuzzRuns.isEmpty();
}
-bool HarfBuzzShaper::shapeHarfBuzzRun()
+bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer)
{
- FontPlatformData* platformData = const_cast<FontPlatformData*>(&m_currentFontData->platformData());
- HarfBuzzFace* face = platformData->harfbuzzFace();
- if (!face)
- return false;
- hb_font_t* harfbuzzFont = face->createFont();
- hb_shape(harfbuzzFont, m_harfbuzzBuffer, m_features.size() > 0 ? m_features.data() : 0, m_features.size());
- hb_font_destroy(harfbuzzFont);
- m_harfbuzzRuns.append(HarfBuzzRun::create(m_numCharactersOfCurrentRun, m_run.direction(), m_harfbuzzBuffer));
+ HarfBuzzScopedPtr<hb_buffer_t> harfbuzzBuffer(hb_buffer_create(), hb_buffer_destroy);
+ hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs());
+ if (m_run.directionalOverride())
+ hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
+
+ for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) {
+ unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i;
+ HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get();
+ const SimpleFontData* currentFontData = currentRun->fontData();
+
+ if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) {
+ String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters());
+ upperText.makeUpper();
+ currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
+ hb_buffer_add_utf16(harfbuzzBuffer.get(), upperText.characters(), currentRun->numCharacters(), 0, currentRun->numCharacters());
+ } else
+ hb_buffer_add_utf16(harfbuzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters());
+
+ FontPlatformData* platformData = const_cast<FontPlatformData*>(&currentFontData->platformData());
+ HarfBuzzFace* face = platformData->harfbuzzFace();
+ if (!face)
+ return false;
+ HarfBuzzScopedPtr<hb_font_t> harfbuzzFont(face->createFont(), hb_font_destroy);
+ hb_shape(harfbuzzFont.get(), harfbuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size());
+
+ currentRun->applyShapeResult(harfbuzzBuffer.get());
+ setGlyphPositionsForHarfBuzzRun(currentRun, i, harfbuzzBuffer.get(), glyphBuffer);
+
+ hb_buffer_reset(harfbuzzBuffer.get());
+ if (m_run.directionalOverride())
+ hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
+ }
return true;
}
-void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer)
+void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, unsigned runIndexInVisualOrder, hb_buffer_t* harfbuzzBuffer, GlyphBuffer* glyphBuffer)
{
- hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(m_harfbuzzBuffer, 0);
- hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(m_harfbuzzBuffer, 0);
- HarfBuzzRun* currentRun = m_harfbuzzRuns.last().get();
+ const SimpleFontData* currentFontData = currentRun->fontData();
+ hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfbuzzBuffer, 0);
+ hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfbuzzBuffer, 0);
unsigned numGlyphs = currentRun->numGlyphs();
float totalAdvance = 0;
@@ -262,26 +308,29 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer)
nextOffsetX = runEnd ? 0 : harfbuzzPositionToFloat(glyphPositions[i + 1].x_offset);
nextOffsetY = runEnd ? 0 : -harfbuzzPositionToFloat(glyphPositions[i + 1].y_offset);
- unsigned currentCharacterIndex = m_startIndexOfCurrentRun + glyphInfos[i].cluster;
+ unsigned currentCharacterIndex = currentRun->startIndex() + glyphInfos[i].cluster;
bool isClusterEnd = runEnd || glyphInfos[i].cluster != glyphInfos[i + 1].cluster;
float spacing = isClusterEnd ? m_letterSpacing : 0;
if (isClusterEnd && isWordEnd(currentCharacterIndex))
spacing += determineWordBreakSpacing();
- if (m_currentFontData->isZeroWidthSpaceGlyph(glyph)) {
- currentRun->setGlyphAndPositions(i, glyph, 0, 0, 0);
+ if (currentFontData->isZeroWidthSpaceGlyph(glyph)) {
+ currentRun->setGlyphAndAdvance(i, glyph, 0);
if (glyphBuffer)
- glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(0, 0));
+ glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(0, 0));
continue;
}
advance += spacing;
- currentRun->setGlyphAndPositions(i, glyph, totalAdvance + offsetX, offsetY, advance);
+
+ currentRun->setGlyphAndAdvance(i, glyph, advance);
if (glyphBuffer) {
+ if (!i && !runIndexInVisualOrder)
+ m_startOffset.set(offsetX, offsetY);
float glyphAdvanceX = advance + nextOffsetX - offsetX;
float glyphAdvanceY = nextOffsetY - offsetY;
- glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY));
+ glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY));
}
totalAdvance += advance;
@@ -324,37 +373,46 @@ int HarfBuzzShaper::offsetForPosition(float targetX)
FloatRect HarfBuzzShaper::selectionRect(const FloatPoint& point, int height, int from, int to)
{
- int fromX = -1, toX = -1;
- int currentX = 0;
- // Iterate through the script runs in logical order, searching for the run covering the positions of interest.
+ float currentX = 0;
+ float fromX;
+ float toX;
+ bool foundFromX = false;
+ bool foundToX = false;
+
+ if (m_run.rtl())
+ currentX = m_totalWidth;
for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) {
+ if (m_run.rtl())
+ currentX -= m_harfbuzzRuns[i]->width();
int numCharacters = m_harfbuzzRuns[i]->numCharacters();
- if (fromX == -1 && from >= 0 && from < numCharacters)
+ if (!foundFromX && from >= 0 && from < numCharacters) {
fromX = m_harfbuzzRuns[i]->xPositionForOffset(from) + currentX;
- else
+ foundFromX = true;
+ } else
from -= numCharacters;
- if (toX == -1 && to >= 0 && to < numCharacters)
+ if (!foundToX && to >= 0 && to < numCharacters) {
toX = m_harfbuzzRuns[i]->xPositionForOffset(to) + currentX;
- else
+ foundToX = true;
+ } else
to -= numCharacters;
- if (fromX != -1 && toX != -1)
+ if (foundFromX && foundToX)
break;
- currentX += m_harfbuzzRuns[i]->width();
+ if (!m_run.rtl())
+ currentX += m_harfbuzzRuns[i]->width();
}
// The position in question might be just after the text.
- if (fromX == -1)
+ if (!foundFromX)
fromX = 0;
- if (toX == -1)
+ if (!foundToX)
toX = m_run.rtl() ? 0 : m_totalWidth;
- ASSERT(fromX != -1 && toX != -1);
-
+ // Using floorf() and roundf() as the same as mac port.
if (fromX < toX)
- return FloatRect(point.x() + fromX, point.y(), toX - fromX, height);
- return FloatRect(point.x() + toX, point.y(), fromX - toX, height);
+ return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - fromX), height);
+ return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), height);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h
index 7beff5d72..eb3935db1 100644
--- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h
+++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h
@@ -52,6 +52,7 @@ public:
virtual ~HarfBuzzShaper();
bool shape(GlyphBuffer* = 0);
+ FloatPoint adjustStartPoint(const FloatPoint&);
float totalWidth() { return m_totalWidth; }
int offsetForPosition(float targetX);
FloatRect selectionRect(const FloatPoint&, int height, int from, int to);
@@ -59,31 +60,37 @@ public:
private:
class HarfBuzzRun {
public:
- static PassOwnPtr<HarfBuzzRun> create(unsigned numCharacters, TextDirection direction, hb_buffer_t* buffer)
+ static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction)
{
- return adoptPtr(new HarfBuzzRun(numCharacters, direction, buffer));
+ return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction));
}
- void setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float);
+ void applyShapeResult(hb_buffer_t*);
+ void setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance);
void setWidth(float width) { m_width = width; }
int characterIndexForXPosition(int targetX);
- int xPositionForOffset(unsigned offset);
+ float xPositionForOffset(unsigned offset);
+ const SimpleFontData* fontData() { return m_fontData; }
+ unsigned startIndex() const { return m_startIndex; }
unsigned numCharacters() const { return m_numCharacters; }
unsigned numGlyphs() const { return m_numGlyphs; }
+ uint16_t* glyphs() { return &m_glyphs[0]; }
+ float* advances() { return &m_advances[0]; }
float width() { return m_width; }
private:
- HarfBuzzRun(unsigned numCharacters, TextDirection, hb_buffer_t*);
+ HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection);
bool rtl() { return m_direction == RTL; }
+ const SimpleFontData* m_fontData;
+ unsigned m_startIndex;
size_t m_numCharacters;
unsigned m_numGlyphs;
TextDirection m_direction;
Vector<uint16_t, 256> m_glyphs;
Vector<float, 256> m_advances;
- Vector<FloatPoint, 256> m_offsets;
Vector<uint16_t, 256> m_logClusters;
Vector<uint16_t, 256> m_glyphToCharacterIndex;
float m_width;
@@ -91,19 +98,17 @@ private:
void setFontFeatures();
- bool setupHarfBuzzRun();
- bool shapeHarfBuzzRun();
- void setGlyphPositionsForHarfBuzzRun(GlyphBuffer*);
+ bool collectHarfBuzzRuns();
+ bool shapeHarfBuzzRuns(GlyphBuffer*);
+ void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, unsigned runIndexInVisualOrder, hb_buffer_t*, GlyphBuffer*);
GlyphBufferAdvance createGlyphBufferAdvance(float, float);
Vector<hb_feature_t, 4> m_features;
- unsigned m_startIndexOfCurrentRun;
- unsigned m_numCharactersOfCurrentRun;
- const SimpleFontData* m_currentFontData;
- hb_buffer_t* m_harfbuzzBuffer;
Vector<OwnPtr<HarfBuzzRun>, 16> m_harfbuzzRuns;
+ FloatPoint m_startOffset;
+
float m_totalWidth;
};
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
index a9324d37f..f09cb1303 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -33,7 +33,7 @@
#include <wtf/StdLibExtras.h>
#include <wtf/unicode/CharacterNames.h>
-#if defined(BUILDING_ON_LEOPARD)
+#if (PLATFORM(MAC) || PLATFORM(CHROMIUM)) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
// Undefined when compiling agains the 10.5 SDK.
#define kCTVersionNumber10_6 0x00030000
#endif
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
index e5304533e..83173db61 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
@@ -39,7 +39,7 @@
#include <CoreText/CoreText.h>
#endif
-#if defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
// The following symbols are SPI in 10.5.
extern "C" {
void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]);
@@ -218,7 +218,7 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
ProviderInfo info = { cp, length, stringAttributes.get() };
RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
#else
diff --git a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
index 91dd426fe..6b2e05474 100644
--- a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
+++ b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
@@ -52,7 +52,7 @@ static void invalidateFontCache(void*)
fontCache()->invalidate();
}
-#if !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
{
ASSERT_UNUSED(observer, observer == fontCache());
@@ -69,7 +69,7 @@ static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*)
void FontCache::platformInit()
{
wkSetUpFontCache();
-#if !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
#else
// kCTFontManagerRegisteredFontsChangedNotification does not exist on Leopard and earlier.
diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
index cfddf363f..d3d872153 100644
--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
@@ -78,7 +78,7 @@ private:
FontCustomPlatformData::~FontCustomPlatformData()
{
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
if (m_atsContainer)
ATSFontDeactivate(m_atsContainer, NULL, kATSOptionFlagsDefault);
#endif
@@ -119,7 +119,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
RetainPtr<CGFontRef> cgFontRef;
-#ifndef BUILDING_ON_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData());
RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
@@ -157,7 +157,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault);
return 0;
}
-#endif // !defined(BUILDING_ON_LEOPARD)
+#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(containerRef, cgFontRef.leakRef());
#if USE(SKIA_ON_MAC_CHROMIUM)
diff --git a/Source/WebCore/platform/graphics/mac/FontMac.mm b/Source/WebCore/platform/graphics/mac/FontMac.mm
index 4afb5fbdb..608123cbd 100644
--- a/Source/WebCore/platform/graphics/mac/FontMac.mm
+++ b/Source/WebCore/platform/graphics/mac/FontMac.mm
@@ -71,7 +71,7 @@ static bool hasBrokenCTFontGetVerticalTranslationsForGlyphs()
isCached = true;
}
return result;
-#elif defined(BUILDING_ON_SNOW_LEOPARD)
+#elif !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
return true;
#else
return false;
@@ -119,7 +119,7 @@ static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData
} else
CGContextShowGlyphsWithAdvances(context, glyphs, advances, count);
}
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
else {
if (!count)
return;
diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
index e08591df4..e3d4f3346 100644
--- a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
+++ b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
@@ -129,7 +129,7 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
patternColor = grammarPatternColor.get();
break;
}
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
// To support correction panel.
case DocumentMarkerAutocorrectionReplacementLineStyle:
case DocumentMarkerDictationAlternativesLineStyle:
diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
index cd161a3f2..2e849af61 100644
--- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
+++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
@@ -267,7 +267,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(const String& url)
NSMutableDictionary *movieAttributes = commonMovieAttributes();
[movieAttributes setValue:cocoaURL forKey:QTMovieURLAttribute];
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings();
CFArrayRef proxiesForURL = CFNetworkCopyProxiesForURL((CFURLRef)cocoaURL, proxySettings);
BOOL willUseProxy = YES;
@@ -392,7 +392,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttri
selector:@selector(didEnd:)
name:QTMovieDidEndNotification
object:m_qtMovie.get()];
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
[[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
selector:@selector(layerHostChanged:)
name:@"WebKitLayerHostChanged"
@@ -876,7 +876,7 @@ bool MediaPlayerPrivateQTKit::hasAudio() const
bool MediaPlayerPrivateQTKit::supportsFullscreen() const
{
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
return true;
#else
// See <rdar://problem/7389945>
@@ -903,7 +903,7 @@ void MediaPlayerPrivateQTKit::setClosedCaptionsVisible(bool closedCaptionsVisibl
if (metaDataAvailable()) {
wkQTMovieSetShowClosedCaptions(m_qtMovie.get(), closedCaptionsVisible);
-#if USE(ACCELERATED_COMPOSITING) && !defined(BUILDING_ON_LEOPARD)
+#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
if (closedCaptionsVisible && m_qtVideoLayer) {
// Captions will be rendered upside down unless we flag the movie as flipped (again). See <rdar://7408440>.
[m_qtVideoLayer.get() setGeometryFlipped:YES];
@@ -1001,7 +1001,7 @@ void MediaPlayerPrivateQTKit::cacheMovieScale()
NSSize initialSize = NSZeroSize;
NSSize naturalSize = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// QTMovieCurrentSizeAttribute is not allowed with instances of QTMovie that have been
// opened with QTMovieOpenForPlaybackAttribute, so ask for the display transform attribute instead.
NSAffineTransform *displayTransform = [m_qtMovie.get() attributeForKey:@"QTMoviePreferredTransformAttribute"];
@@ -1236,7 +1236,7 @@ void MediaPlayerPrivateQTKit::didEnd()
}
#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT))
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent)
{
if (!child || !descendent)
@@ -1253,7 +1253,7 @@ static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent)
void MediaPlayerPrivateQTKit::layerHostChanged(PlatformLayer* rootLayer)
{
-#if defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060
if (!rootLayer)
return;
diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index d5d55606d..487591a74 100644
--- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -82,7 +82,7 @@ static NSString *webFallbackFontFamily(void)
}
#if !ERROR_DISABLED
-#if defined(__LP64__) || (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
+#if defined(__LP64__) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static NSString* pathFromFont(NSFont*)
{
// FMGetATSFontRefFromFont is not available. As pathFromFont is only used for debugging purposes,
@@ -233,7 +233,7 @@ void SimpleFontData::platformInit()
NSString *familyName = [m_platformData.font() familyName];
if ([familyName isEqualToString:@"Times"] || [familyName isEqualToString:@"Helvetica"] || [familyName isEqualToString:@"Courier"])
ascent += floorf(((ascent + descent) * 0.15f) + 0.5f);
-#if defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
else if ([familyName isEqualToString:@"Geeza Pro"]) {
// Geeza Pro has glyphs that draw slightly above the ascent or far below the descent. Adjust
// those vertical metrics to better match reality, so that diacritics at the bottom of one line
diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.h b/Source/WebCore/platform/graphics/mac/WebLayer.h
index bb0f444bc..1266bb749 100644
--- a/Source/WebCore/platform/graphics/mac/WebLayer.h
+++ b/Source/WebCore/platform/graphics/mac/WebLayer.h
@@ -36,7 +36,7 @@ namespace WebCore {
class PlatformCALayerClient;
}
-#if defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
@interface CALayer(WebLayerInternal)
- (CGAffineTransform)contentsTransform;
- (void)setContentsTransform:(CGAffineTransform)t;
diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.mm b/Source/WebCore/platform/graphics/mac/WebLayer.mm
index 97e9f2882..d783e494a 100644
--- a/Source/WebCore/platform/graphics/mac/WebLayer.mm
+++ b/Source/WebCore/platform/graphics/mac/WebLayer.mm
@@ -84,7 +84,7 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA
AffineTransform transform = CGContextGetCTM(context);
ThemeMac::setFocusRingClipRect(transform.mapRect(clipBounds));
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
__block GraphicsContext* ctx = &graphicsContext;
wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
index 57723560c..5a628810d 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
@@ -26,7 +26,7 @@
#include "config.h"
-#if ENABLE(WEBGL)
+#if USE(3D_GRAPHICS)
#include "Extensions3DOpenGLCommon.h"
#include "ANGLEWebKitBridge.h"
@@ -145,4 +145,4 @@ void Extensions3DOpenGLCommon::initializeAvailableExtensions()
} // namespace WebCore
-#endif // ENABLE(WEBGL)
+#endif // USE(3D_GRAPHICS)
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
index e21f559ad..fed5492c6 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
@@ -25,10 +25,11 @@
*/
#include "config.h"
-#if ENABLE(WEBGL)
+#if USE(3D_GRAPHICS)
#include "Extensions3DOpenGLES.h"
#include "GraphicsContext3D.h"
+#include "NotImplemented.h"
#include <EGL/egl.h>
#include <wtf/Vector.h>
@@ -68,6 +69,21 @@ void Extensions3DOpenGLES::renderbufferStorageMultisampleIMG(unsigned long targe
m_context->synthesizeGLError(GL_INVALID_OPERATION);
}
+void Extensions3DOpenGLES::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
+{
+ notImplemented();
+}
+
+void Extensions3DOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+{
+ notImplemented();
+}
+
+void Extensions3DOpenGLES::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum)
+{
+ notImplemented();
+}
+
Platform3DObject Extensions3DOpenGLES::createVertexArrayOES()
{
m_context->makeContextCurrent();
@@ -129,8 +145,8 @@ bool Extensions3DOpenGLES::supportsExtension(const String& name)
m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES"));
m_supportsOESvertexArrayObject = true;
} else if (name == "GL_IMG_multisampled_render_to_texture" && !m_supportsIMGMultisampledRenderToTexture) {
- m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
- m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
+ m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
+ m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
m_supportsIMGMultisampledRenderToTexture = true;
}
return true;
@@ -146,4 +162,4 @@ String Extensions3DOpenGLES::getExtensions()
} // namespace WebCore
-#endif // ENABLE(WEBGL)
+#endif // USE(3D_GRAPHICS)
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h
index 3c460f9e2..c3cc59571 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h
@@ -41,6 +41,11 @@ public:
virtual void framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned int texture, int level, unsigned long samples);
virtual void renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
+ // Extension3D methods
+ virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter);
+ virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
+ virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
+
virtual Platform3DObject createVertexArrayOES();
virtual void deleteVertexArrayOES(Platform3DObject);
virtual GC3Dboolean isVertexArrayOES(Platform3DObject);
@@ -57,8 +62,8 @@ protected:
bool m_supportsOESvertexArrayObject;
bool m_supportsIMGMultisampledRenderToTexture;
- PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC m_glFramebufferTexture2DMultisampleIMG;
- PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC m_glRenderbufferStorageMultisampleIMG;
+ PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG m_glFramebufferTexture2DMultisampleIMG;
+ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG m_glRenderbufferStorageMultisampleIMG;
PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES;
PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES;
PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES;
diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
index 6753444f8..fd450141c 100644
--- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
@@ -284,7 +284,7 @@ void GraphicsContext3D::clearDepth(GC3Dclampf depth)
bool GraphicsContext3D::systemAllowsMultisamplingOnATICards() const
{
#if PLATFORM(MAC)
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
return true;
#else
ASSERT(isMainThread());
diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
index e4ac6876e..26281909b 100644
--- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
+++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
@@ -34,7 +34,9 @@
#include "Extensions3DOpenGLES.h"
#include "IntRect.h"
#include "IntSize.h"
+#if PLATFORM(BLACKBERRY)
#include "LayerWebKitThread.h"
+#endif
#include "NotImplemented.h"
#include "OpenGLESShims.h"
@@ -113,6 +115,75 @@ void GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary(int x, int y, int
}
}
+bool GraphicsContext3D::reshapeFBOs(const IntSize& size)
+{
+ const int width = size.width();
+ const int height = size.height();
+ GLuint colorFormat = 0, pixelDataType = 0;
+ if (m_attrs.alpha) {
+ m_internalColorFormat = GL_RGBA;
+ colorFormat = GL_RGBA;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ } else {
+ m_internalColorFormat = GL_RGB;
+ colorFormat = GL_RGB;
+ pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
+ }
+
+ // We don't allow the logic where stencil is required and depth is not.
+ // See GraphicsContext3D::validateAttributes.
+ bool supportPackedDepthStencilBuffer = (m_attrs.stencil || m_attrs.depth) && getExtensions()->supports("GL_OES_packed_depth_stencil");
+
+ // Resize regular FBO.
+ bool mustRestoreFBO = false;
+ if (m_boundFBO != m_fbo) {
+ mustRestoreFBO = true;
+ ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+ }
+
+ ::glBindTexture(GL_TEXTURE_2D, m_texture);
+ ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0);
+ ::glFramebufferTexture2DEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
+
+ ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
+ ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+ ::glBindTexture(GL_TEXTURE_2D, 0);
+
+ // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes.
+ ASSERT(!m_attrs.antialias);
+
+ if (m_attrs.stencil || m_attrs.depth) {
+ // Use a 24 bit depth buffer where we know we have it.
+ if (supportPackedDepthStencilBuffer) {
+ ::glBindTexture(GL_TEXTURE_2D, m_depthStencilBuffer);
+ ::glTexImage2D(GL_TEXTURE_2D, 0, GraphicsContext3D::DEPTH_STENCIL, width, height, 0, GraphicsContext3D::DEPTH_STENCIL, GraphicsContext3D::UNSIGNED_INT_24_8, 0);
+ if (m_attrs.stencil)
+ ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0);
+ if (m_attrs.depth)
+ ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0);
+ ::glBindTexture(GL_TEXTURE_2D, 0);
+ } else {
+ if (m_attrs.stencil) {
+ ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+ ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_STENCIL_INDEX8, width, height);
+ ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+ }
+ if (m_attrs.depth) {
+ ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+ ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
+ ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+ }
+ ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, 0);
+ }
+ }
+ if (glCheckFramebufferStatusEXT(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
+ // FIXME: cleanup
+ notImplemented();
+ }
+
+ return mustRestoreFBO;
+}
+
void GraphicsContext3D::resolveMultisamplingIfNecessary(const IntRect& rect)
{
// FIXME: We don't support antialiasing yet.
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index c7191e35b..84729d992 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -19,7 +19,11 @@
#include "config.h"
#include "GraphicsContext3D.h"
+#if USE(OPENGL_ES_2)
+#include "Extensions3DOpenGLES.h"
+#else
#include "Extensions3DOpenGL.h"
+#endif
#include "GraphicsContext.h"
#include "GraphicsSurface.h"
#include "HostWindow.h"
diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
index 1ce1efc08..e7e8fc909 100644
--- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
@@ -34,7 +34,6 @@
#include "FontCustomPlatformData.h"
#if OS(WINDOWS)
-#include "Base64.h"
#include "OpenTypeUtilities.h"
#include "PlatformSupport.h"
#elif OS(UNIX)
@@ -48,6 +47,7 @@
#if OS(WINDOWS)
#include <objbase.h>
+#include <wtf/text/Base64.h>
#elif OS(UNIX)
#include <cstring>
#endif
diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index ac3d929bc..b5490c656 100644
--- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -33,7 +33,6 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "BitmapImage.h"
#include "BitmapImageSingleFrameSkia.h"
#include "Extensions3D.h"
@@ -56,6 +55,7 @@
#include "Canvas2DLayerBridge.h"
#endif
+#include <wtf/text/Base64.h>
#include <wtf/text/WTFString.h>
using namespace std;
diff --git a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp
index b4d20b03a..54486c3aa 100644
--- a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp
@@ -86,7 +86,7 @@ void SimpleFontData::platformInit()
float descent;
// Beware those who step here: This code is designed to match Win32 font
- // metrics *exactly*.
+ // metrics *exactly* (except the adjustment of ascent/descent on Linux/Android).
if (isVDMXValid) {
ascent = vdmxAscent;
descent = -vdmxDescent;
@@ -94,6 +94,16 @@ void SimpleFontData::platformInit()
SkScalar height = -metrics.fAscent + metrics.fDescent + metrics.fLeading;
ascent = SkScalarRound(-metrics.fAscent);
descent = SkScalarRound(height) - ascent;
+#if OS(LINUX) || OS(ANDROID)
+ // When subpixel positioning is enabled, if the descent is rounded down, the descent part
+ // of the glyph may be truncated when displayed in a 'overflow: hidden' container.
+ // To avoid that, borrow 1 unit from the ascent when possible.
+ // FIXME: This can be removed if sub-pixel ascent/descent is supported.
+ if (platformData().fontRenderStyle().useSubpixelPositioning && descent < SkScalarToFloat(metrics.fDescent) && ascent >= 1) {
+ ++descent;
+ --ascent;
+ }
+#endif
}
m_fontMetrics.setAscent(ascent);
diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
index 018a89c9b..2b8cd6591 100644
--- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
+++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
@@ -27,18 +27,12 @@ namespace WebCore {
PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, Flags flags, uint32_t token)
{
- RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
- if (!surface->platformImport(token))
- return PassRefPtr<GraphicsSurface>();
- return surface;
+ return platformImport(size, flags, token);
}
PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, GraphicsSurface::Flags flags)
{
- RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
- if (!surface->platformCreate(size, flags))
- return PassRefPtr<GraphicsSurface>();
- return surface;
+ return platformCreate(size, flags);
}
uint32_t GraphicsSurface::exportToken()
@@ -70,13 +64,19 @@ void GraphicsSurface::copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRec
}
GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags)
- : m_size(size)
- , m_flags(flags)
+ : m_flags(flags)
+ , m_size(size)
, m_platformSurface(0)
, m_texture(0)
, m_fbo(0)
+ , m_private(0)
{
}
+GraphicsSurface::~GraphicsSurface()
+{
+ platformDestroy();
+}
+
}
#endif
diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
index ff71fcd8c..7aeed792c 100644
--- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
+++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
@@ -32,10 +32,14 @@
#if OS(DARWIN)
typedef struct __IOSurface* IOSurfaceRef;
typedef IOSurfaceRef PlatformGraphicsSurface;
+#else
+typedef uint32_t PlatformGraphicsSurface;
#endif
namespace WebCore {
+struct GraphicsSurfacePrivate;
+
class GraphicsSurface : public RefCounted<GraphicsSurface> {
public:
enum Flag {
@@ -69,10 +73,11 @@ public:
uint32_t getTextureID();
PassOwnPtr<GraphicsContext> beginPaint(const IntRect&, LockOptions);
PassRefPtr<Image> createReadOnlyImage(const IntRect&);
+ ~GraphicsSurface();
protected:
- bool platformCreate(const IntSize&, Flags);
- bool platformImport(uint32_t);
+ static PassRefPtr<GraphicsSurface> platformCreate(const IntSize&, Flags);
+ static PassRefPtr<GraphicsSurface> platformImport(const IntSize&, Flags, uint32_t);
uint32_t platformExport();
void platformDestroy();
@@ -100,6 +105,7 @@ private:
PlatformGraphicsSurface m_platformSurface;
uint32_t m_texture;
uint32_t m_fbo;
+ GraphicsSurfacePrivate* m_private;
};
}
diff --git a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp
index 84312def2..7131b8276 100644
--- a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp
+++ b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp
@@ -30,6 +30,8 @@
namespace WebCore {
+struct GraphicsSurfacePrivate { };
+
uint32_t GraphicsSurface::platformExport()
{
return IOSurfaceGetID(m_platformSurface);
@@ -118,7 +120,7 @@ void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntR
glFlush();
}
-bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags)
+PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags)
{
unsigned pixelFormat = 'BGRA';
unsigned bytesPerElement = 4;
@@ -154,14 +156,20 @@ bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags)
for (unsigned i = 0; i < 7; i++)
CFRelease(values[i]);
- m_platformSurface = IOSurfaceCreate(dict);
- return !!m_platformSurface;
+ RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
+ surface->m_platformSurface = IOSurfaceCreate(dict);
+ if (!surface->m_platformSurface)
+ return PassRefPtr<GraphicsSurface>();
+ return surface;
}
-bool GraphicsSurface::platformImport(uint32_t token)
+PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token)
{
- m_platformSurface = IOSurfaceLookup(token);
- return !!m_platformSurface;
+ RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
+ surface->m_platformSurface = IOSurfaceLookup(token);
+ if (!surface->m_platformSurface)
+ return PassRefPtr<GraphicsSurface>();
+ return surface;
}
static int ioSurfaceLockOptions(int lockOptions)
diff --git a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
new file mode 100644
index 000000000..afc3a84f2
--- /dev/null
+++ b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
@@ -0,0 +1,330 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "GraphicsSurface.h"
+
+#if USE(GRAPHICS_SURFACE)
+
+// Qt headers must be included before glx headers.
+#include <QCoreApplication>
+#include <QOpenGLContext>
+#include <QVector>
+#include <QWindow>
+#include <qpa/qplatformwindow.h>
+#include <GL/glext.h>
+#include <GL/glx.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/Xrender.h>
+
+namespace WebCore {
+
+static long X11OverrideRedirect = 1L << 9;
+
+static PFNGLXBINDTEXIMAGEEXTPROC pGlXBindTexImageEXT = 0;
+static PFNGLXRELEASETEXIMAGEEXTPROC pGlXReleaseTexImageEXT = 0;
+static PFNGLBINDFRAMEBUFFERPROC pGlBindFramebuffer = 0;
+static PFNGLBLITFRAMEBUFFERPROC pGlBlitFramebuffer = 0;
+
+class OffScreenRootWindow {
+public:
+ OffScreenRootWindow()
+ {
+ ++refCount;
+ }
+
+ QWindow* get(Display* dpy)
+ {
+ if (!window) {
+ window = new QWindow;
+ window->setGeometry(QRect(-1, -1, 1, 1));
+ window->create();
+ XSetWindowAttributes attributes;
+ attributes.override_redirect = true;
+ XChangeWindowAttributes(dpy, window->handle()->winId(), X11OverrideRedirect, &attributes);
+ window->show();
+ }
+ return window;
+ }
+
+ ~OffScreenRootWindow()
+ {
+ if (!--refCount) {
+ delete window;
+ window = 0;
+ }
+ }
+
+private:
+ static int refCount;
+ static QWindow* window;
+};
+
+int OffScreenRootWindow::refCount = 0;
+QWindow* OffScreenRootWindow::window = 0;
+
+static const int glxSpec[] = {
+ // The specification is a set key value pairs stored in a simple array.
+ GLX_LEVEL, 0,
+ GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_WINDOW_BIT,
+ GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
+ GLX_BIND_TO_TEXTURE_RGB_EXT, TRUE,
+ 0
+};
+
+static const int glxAttributes[] = {
+ GLX_TEXTURE_FORMAT_EXT,
+ GLX_TEXTURE_FORMAT_RGB_EXT,
+ GLX_TEXTURE_TARGET_EXT,
+ GLX_TEXTURE_2D_EXT,
+ 0
+};
+
+struct GraphicsSurfacePrivate {
+ GraphicsSurfacePrivate()
+ : m_display(0)
+ , m_xPixmap(0)
+ , m_glxPixmap(0)
+ , m_glContext(adoptPtr(new QOpenGLContext))
+ , m_textureIsYInverted(false)
+ , m_hasAlpha(false)
+ {
+ m_display = XOpenDisplay(0);
+ m_glContext->create();
+ }
+
+ ~GraphicsSurfacePrivate()
+ {
+ if (m_glxPixmap)
+ glXDestroyPixmap(m_display, m_glxPixmap);
+ m_glxPixmap = 0;
+
+ if (m_xPixmap)
+ XFreePixmap(m_display, m_xPixmap);
+ m_xPixmap = 0;
+
+ if (m_display)
+ XCloseDisplay(m_display);
+ m_display = 0;
+ }
+
+ uint32_t createSurface(const IntSize& size)
+ {
+ m_surface = adoptPtr(new QWindow(m_offScreenWindow.get(m_display)));
+ m_surface->setSurfaceType(QSurface::OpenGLSurface);
+ m_surface->setGeometry(0, 0, size.width(), size.height());
+ m_surface->create();
+ XCompositeRedirectWindow(m_display, m_surface->handle()->winId(), CompositeRedirectManual);
+
+ // Make sure the XRender Extension is available.
+ int eventBasep, errorBasep;
+ if (!XRenderQueryExtension(m_display, &eventBasep, &errorBasep))
+ return 0;
+
+ m_surface->show();
+
+ return m_surface->handle()->winId();
+ }
+
+ void createPixmap(uint32_t winId)
+ {
+ XWindowAttributes attr;
+ XGetWindowAttributes(m_display, winId, &attr);
+
+ XRenderPictFormat* format = XRenderFindVisualFormat(m_display, attr.visual);
+ m_hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask);
+ m_size = IntSize(attr.width, attr.height);
+
+ int numberOfConfigs;
+ GLXFBConfig* configs = glXChooseFBConfig(m_display, XDefaultScreen(m_display), glxSpec, &numberOfConfigs);
+
+ m_xPixmap = XCompositeNameWindowPixmap(m_display, winId);
+ m_glxPixmap = glXCreatePixmap(m_display, *configs, m_xPixmap, glxAttributes);
+
+ uint inverted = 0;
+ glXQueryDrawable(m_display, m_glxPixmap, GLX_Y_INVERTED_EXT, &inverted);
+ m_textureIsYInverted = !!inverted;
+
+ XFree(configs);
+ }
+
+ void makeCurrent()
+ {
+ QOpenGLContext* glContext = QOpenGLContext::currentContext();
+ if (m_surface && glContext)
+ glContext->makeCurrent(m_surface.get());
+ }
+
+ void swapBuffers()
+ {
+ if (!m_surface->isVisible())
+ return;
+
+ // Creating and exposing the surface is asynchronous. Therefore we have to wait here
+ // before swapping the buffers. This should only be the case for the very first frame.
+ while (!m_surface->isExposed())
+ QCoreApplication::processEvents();
+
+ QOpenGLContext* glContext = QOpenGLContext::currentContext();
+ if (m_surface && glContext)
+ glContext->swapBuffers(m_surface.get());
+ }
+
+
+ Display* display() const { return m_display; }
+
+ GLXPixmap glxPixmap() const { return m_glxPixmap; }
+
+ IntSize size() const { return m_size; }
+
+ QOpenGLContext* glContext() { return m_glContext.get(); }
+
+private:
+ OffScreenRootWindow m_offScreenWindow;
+ IntSize m_size;
+ Display* m_display;
+ Pixmap m_xPixmap;
+ GLXPixmap m_glxPixmap;
+ OwnPtr<QWindow> m_surface;
+ OwnPtr<QOpenGLContext> m_glContext;
+ bool m_textureIsYInverted;
+ bool m_hasAlpha;
+};
+
+static bool resolveGLMethods(GraphicsSurfacePrivate* p)
+{
+ static bool resolved = false;
+ if (resolved)
+ return true;
+
+ QOpenGLContext* glContext = p->glContext();
+ pGlXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
+ pGlXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
+ pGlBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(glContext->getProcAddress("glBindFramebuffer"));
+ pGlBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(glContext->getProcAddress("glBlitFramebuffer"));
+
+ resolved = pGlBlitFramebuffer && pGlBindFramebuffer && pGlXBindTexImageEXT && pGlXReleaseTexImageEXT;
+
+ return resolved;
+}
+
+uint32_t GraphicsSurface::platformExport()
+{
+ return m_platformSurface;
+}
+
+uint32_t GraphicsSurface::platformGetTextureID()
+{
+ if (!m_texture)
+ glGenTextures(1, &m_texture);
+
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ pGlXBindTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT, 0);
+
+ return m_texture;
+}
+
+void GraphicsSurface::platformCopyToGLTexture(uint32_t target, uint32_t id, const IntRect& targetRect, const IntPoint& offset)
+{
+ // This is not supported by GLX/Xcomposite.
+}
+
+void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntRect& sourceRect)
+{
+ m_private->makeCurrent();
+ int width = m_size.width();
+ int height = m_size.height();
+
+ glPushAttrib(GL_ALL_ATTRIB_BITS);
+ GLint oldFBO;
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO);
+ pGlBindFramebuffer(GL_READ_FRAMEBUFFER, originFbo);
+ pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_private->glContext()->defaultFramebufferObject());
+ pGlBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
+ pGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
+ glPopAttrib();
+
+ m_private->swapBuffers();
+}
+
+PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags)
+{
+ // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested.
+ if (flags & SupportsCopyToTexture)
+ return PassRefPtr<GraphicsSurface>();
+
+ RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
+
+ surface->m_private = new GraphicsSurfacePrivate();
+ if (!resolveGLMethods(surface->m_private))
+ return PassRefPtr<GraphicsSurface>();
+
+ surface->m_platformSurface = surface->m_private->createSurface(size);
+
+ return surface;
+}
+
+PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token)
+{
+ // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested.
+ if (flags & SupportsCopyToTexture)
+ return PassRefPtr<GraphicsSurface>();
+
+ RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
+
+ surface->m_private = new GraphicsSurfacePrivate();
+ if (!resolveGLMethods(surface->m_private))
+ return PassRefPtr<GraphicsSurface>();
+
+ surface->m_platformSurface = token;
+
+ surface->m_private->createPixmap(surface->m_platformSurface);
+ surface->m_size = surface->m_private->size();
+
+ return surface;
+}
+
+char* GraphicsSurface::platformLock(const IntRect& rect, int* outputStride, LockOptions lockOptions)
+{
+ // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism.
+ return 0;
+}
+
+void GraphicsSurface::platformUnlock()
+{
+ // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism.
+}
+
+void GraphicsSurface::platformDestroy()
+{
+ if (m_texture) {
+ pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT);
+ glDeleteTextures(1, &m_texture);
+ }
+
+ delete m_private;
+ m_private = 0;
+}
+
+}
+#endif
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
index 4ca56c6c1..2802933a9 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
@@ -368,7 +368,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList
if (valueList.property() == AnimatedPropertyWebkitTransform)
listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
- m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
+ m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
notifyChange(TextureMapperLayer::AnimationChange);
m_animationStartedTimer.startOneShot(0);
return true;
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
index 403e5492b..c5cbbac04 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
@@ -106,7 +106,7 @@ private:
bool m_fixedToViewport;
TextureMapperPlatformLayer* m_contentsLayer;
FloatRect m_needsDisplayRect;
- TextureMapperAnimations m_animations;
+ GraphicsLayerAnimations m_animations;
void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
Timer<GraphicsLayerTextureMapper> m_animationStartedTimer;
};
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
index de2d67f73..45042ca8d 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
@@ -24,11 +24,11 @@
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
+#include "GraphicsLayerAnimation.h"
+#include "GraphicsLayerTransform.h"
#include "Image.h"
#include "IntPointHash.h"
-#include "LayerTransform.h"
#include "TextureMapper.h"
-#include "TextureMapperAnimation.h"
#include "TextureMapperBackingStore.h"
#include "Timer.h"
#include "TransformOperations.h"
@@ -56,7 +56,7 @@ public:
{ }
};
-class TextureMapperLayer : public TextureMapperAnimationClient {
+class TextureMapperLayer : public GraphicsLayerAnimation::Client {
public:
// This set of flags help us defer which properties of the layer have been
@@ -157,6 +157,10 @@ private:
void drawRepaintCounter(GraphicsContext*, GraphicsLayer*);
+ // GraphicsLayerAnimation::Client
+ void setAnimatedTransform(const TransformationMatrix& matrix) { setTransform(matrix); }
+ void setAnimatedOpacity(float opacity) { setOpacity(opacity); }
+
void syncAnimations();
bool isVisible() const;
enum ContentsLayerCount {
@@ -168,7 +172,7 @@ private:
ContentsLayerCount countPotentialLayersWithContents() const;
bool shouldPaintToIntermediateSurface() const;
- LayerTransform m_transform;
+ GraphicsLayerTransform m_transform;
inline FloatRect layerRect() const
{
@@ -230,7 +234,7 @@ private:
State m_state;
TextureMapper* m_textureMapper;
- TextureMapperAnimations m_animations;
+ GraphicsLayerAnimations m_animations;
IntPoint m_scrollPositionDelta;
bool m_fixedToViewport;
Color m_debugBorderColor;
diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
index 8348acb39..b9d90fef9 100644
--- a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
@@ -21,7 +21,6 @@
#include "config.h"
#include "FontCustomPlatformData.h"
-#include "Base64.h"
#include "FontPlatformData.h"
#include "OpenTypeUtilities.h"
#include "SharedBuffer.h"
@@ -30,6 +29,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <wtf/RetainPtr.h>
+#include <wtf/text/Base64.h>
// From t2embapi.h, which is missing from the Microsoft Platform SDK.
typedef unsigned long(WINAPIV *READEMBEDPROC) (void*, void*, unsigned long);
diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
index 07a875624..844f8ec04 100644
--- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
@@ -22,11 +22,11 @@
#include "config.h"
#include "FontCustomPlatformData.h"
-#include "Base64.h"
#include "CachedFont.h"
#include "FontPlatformData.h"
#include "SharedBuffer.h"
#include <wtf/RandomNumber.h>
+#include <wtf/text/Base64.h>
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
index 9c4225a3e..572070553 100644
--- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
@@ -21,7 +21,6 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "GraphicsContext.h"
#include "Image.h"
#include "ImageData.h"
diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
index 0cdbc7b3b..57874832e 100644
--- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
+++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "ImageBuffer.h"
-#include "Base64.h"
#include "BitmapImage.h"
#include "GraphicsContext.h"
#include "Image.h"
diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
index 5762a8fc7..712540356 100644
--- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
+++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
@@ -137,7 +137,7 @@ FloatRect screenAvailableRect(Widget* widget)
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h
index 760ac93f8..911878e1d 100644
--- a/Source/WebCore/platform/image-decoders/ImageDecoder.h
+++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h
@@ -315,7 +315,7 @@ namespace WebCore {
#else
// FIXME: add support for multiple monitors.
ColorProfile profile;
- screenColorProfile(0, profile);
+ screenColorProfile(profile);
if (!profile.isEmpty())
outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size());
#endif
diff --git a/Source/WebCore/platform/mac/CursorMac.mm b/Source/WebCore/platform/mac/CursorMac.mm
index d2085339b..ac24b88c4 100644
--- a/Source/WebCore/platform/mac/CursorMac.mm
+++ b/Source/WebCore/platform/mac/CursorMac.mm
@@ -85,7 +85,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Hand:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = [NSCursor pointingHandCursor];
#else
// The pointingHandCursor from NSCursor does not have a shadow on
@@ -99,7 +99,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Wait:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("BusyButClickable");
#else
m_platformCursor = createNamedCursor("waitCursor", 7, 7);
@@ -107,7 +107,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Help:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("Help");
if (m_platformCursor)
break;
@@ -117,7 +117,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::Move:
case Cursor::MiddlePanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("Move");
#else
m_platformCursor = createNamedCursor("moveCursor", 7, 7);
@@ -126,7 +126,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::EastResize:
case Cursor::EastPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeEast");
#else
m_platformCursor = createNamedCursor("eastResizeCursor", 14, 7);
@@ -135,7 +135,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::NorthResize:
case Cursor::NorthPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNorth");
#else
m_platformCursor = createNamedCursor("northResizeCursor", 7, 1);
@@ -144,7 +144,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::NorthEastResize:
case Cursor::NorthEastPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNortheast");
#else
m_platformCursor = createNamedCursor("northEastResizeCursor", 14, 1);
@@ -153,7 +153,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::NorthWestResize:
case Cursor::NorthWestPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNorthwest");
#else
m_platformCursor = createNamedCursor("northWestResizeCursor", 0, 0);
@@ -162,7 +162,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::SouthResize:
case Cursor::SouthPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeSouth");
#else
m_platformCursor = createNamedCursor("southResizeCursor", 7, 14);
@@ -171,7 +171,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::SouthEastResize:
case Cursor::SouthEastPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeSoutheast");
#else
m_platformCursor = createNamedCursor("southEastResizeCursor", 14, 14);
@@ -180,7 +180,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::SouthWestResize:
case Cursor::SouthWestPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeSouthwest");
#else
m_platformCursor = createNamedCursor("southWestResizeCursor", 1, 14);
@@ -188,7 +188,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::WestResize:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeWest");
#else
m_platformCursor = createNamedCursor("westResizeCursor", 1, 7);
@@ -196,7 +196,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::NorthSouthResize:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNorthSouth");
#else
m_platformCursor = createNamedCursor("northSouthResizeCursor", 7, 7);
@@ -205,7 +205,7 @@ void Cursor::ensurePlatformCursor() const
case Cursor::EastWestResize:
case Cursor::WestPanning:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeEastWest");
#else
m_platformCursor = createNamedCursor("eastWestResizeCursor", 7, 7);
@@ -213,7 +213,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::NorthEastSouthWestResize:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNortheastSouthwest");
#else
m_platformCursor = createNamedCursor("northEastSouthWestResizeCursor", 7, 7);
@@ -221,7 +221,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::NorthWestSouthEastResize:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ResizeNorthwestSoutheast");
#else
m_platformCursor = createNamedCursor("northWestSouthEastResizeCursor", 7, 7);
@@ -237,7 +237,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::VerticalText:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = [NSCursor IBeamCursorForVerticalLayout];
#else
m_platformCursor = createNamedCursor("verticalTextCursor", 7, 7);
@@ -245,7 +245,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Cell:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("Cell");
if (m_platformCursor)
break;
@@ -254,7 +254,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::ContextMenu:
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
m_platformCursor = [NSCursor contextualMenuCursor];
#else
m_platformCursor = createNamedCursor("contextMenuCursor", 3, 2);
@@ -262,7 +262,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Alias:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("MakeAlias");
#else
m_platformCursor = createNamedCursor("aliasCursor", 11, 3);
@@ -270,7 +270,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Progress:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("BusyButClickable");
#else
m_platformCursor = createNamedCursor("progressCursor", 3, 2);
@@ -278,7 +278,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::NoDrop:
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
m_platformCursor = [NSCursor operationNotAllowedCursor];
#else
m_platformCursor = createNamedCursor("noDropCursor", 3, 1);
@@ -286,7 +286,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::Copy:
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
m_platformCursor = [NSCursor dragCopyCursor];
#else
m_platformCursor = createNamedCursor("copyCursor", 3, 2);
@@ -298,7 +298,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::NotAllowed:
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
m_platformCursor = [NSCursor operationNotAllowedCursor];
#else
m_platformCursor = createNamedCursor("notAllowedCursor", 11, 11);
@@ -306,7 +306,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::ZoomIn:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ZoomIn");
if (m_platformCursor)
break;
@@ -315,7 +315,7 @@ void Cursor::ensurePlatformCursor() const
break;
case Cursor::ZoomOut:
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
m_platformCursor = wkCursor("ZoomOut");
if (m_platformCursor)
break;
diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp
index 10730871b..ae0cf5763 100644
--- a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp
+++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp
@@ -29,8 +29,9 @@
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <wtf/RetainPtr.h>
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
#include <wtf/UnusedParam.h>
+#include <CoreServices/CoreServices.h>
#endif
namespace WebCore {
@@ -39,11 +40,11 @@ static const double systemActivityInterval = 1;
DisplaySleepDisabler::DisplaySleepDisabler(const char* reason)
: m_disableDisplaySleepAssertion(0)
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
, m_systemActivityTimer(this, &DisplaySleepDisabler::systemActivityTimerFired)
#endif
{
-#ifndef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<CFStringRef> reasonCF(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion);
#else
@@ -57,8 +58,8 @@ DisplaySleepDisabler::~DisplaySleepDisabler()
{
IOPMAssertionRelease(m_disableDisplaySleepAssertion);
}
-
-#ifdef BUILDING_ON_LEOPARD
+
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
void DisplaySleepDisabler::systemActivityTimerFired(Timer<DisplaySleepDisabler>*)
{
UpdateSystemActivity(OverallAct);
diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.h b/Source/WebCore/platform/mac/DisplaySleepDisabler.h
index 2e466dc16..a2d44a1e7 100644
--- a/Source/WebCore/platform/mac/DisplaySleepDisabler.h
+++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.h
@@ -29,7 +29,7 @@
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
#include "Timer.h"
#endif
@@ -44,12 +44,12 @@ public:
private:
DisplaySleepDisabler(const char* reason);
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
void systemActivityTimerFired(Timer<DisplaySleepDisabler>*);
#endif
uint32_t m_disableDisplaySleepAssertion;
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
Timer<DisplaySleepDisabler> m_systemActivityTimer;
#endif
};
diff --git a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h
index c11b05fb5..65a35d19b 100644
--- a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h
+++ b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h
@@ -29,7 +29,7 @@
@protocol NAME <NSObject> \
@end
-#ifdef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MAX_ALLOWED == 1050
EMPTY_PROTOCOL(NSTableViewDataSource)
EMPTY_PROTOCOL(NSTableViewDelegate)
@@ -38,7 +38,7 @@ EMPTY_PROTOCOL(NSAnimationDelegate)
#endif
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
EMPTY_PROTOCOL(NSURLConnectionDelegate)
EMPTY_PROTOCOL(NSURLDownloadDelegate)
diff --git a/Source/WebCore/platform/mac/HTMLConverter.h b/Source/WebCore/platform/mac/HTMLConverter.h
index ea1b85db5..26bf317c3 100644
--- a/Source/WebCore/platform/mac/HTMLConverter.h
+++ b/Source/WebCore/platform/mac/HTMLConverter.h
@@ -79,7 +79,7 @@ namespace WebCore {
} _flags;
}
-#if !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- (id)init;
- (id)initWithDOMRange:(DOMRange *)domRange;
diff --git a/Source/WebCore/platform/mac/HTMLConverter.mm b/Source/WebCore/platform/mac/HTMLConverter.mm
index 22db81c38..67be0059c 100644
--- a/Source/WebCore/platform/mac/HTMLConverter.mm
+++ b/Source/WebCore/platform/mac/HTMLConverter.mm
@@ -50,7 +50,7 @@ using namespace HTMLNames;
static NSFileWrapper *fileWrapperForURL(DocumentLoader *, NSURL *);
static NSFileWrapper *fileWrapperForElement(Element*);
-#ifndef BUILDING_ON_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// Additional control Unicode characters
const unichar WebNextLineCharacter = 0x0085;
@@ -100,7 +100,7 @@ static NSFont *WebDefaultFont()
@implementation WebHTMLConverter
-#ifndef BUILDING_ON_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
static NSFont *_fontForNameAndSize(NSString *fontName, CGFloat size, NSMutableDictionary *cache)
{
@@ -1657,7 +1657,7 @@ static NSInteger _colCompare(id block1, id block2, void *)
return (0 == _errorCode) ? [[_attrStr retain] autorelease] : nil;
}
-#endif // !defined(BUILDING_ON_LEOPARD)
+#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// This function uses TextIterator, which makes offsets in its result compatible with HTML editing.
+ (NSAttributedString *)editingAttributedStringFromRange:(Range*)range
diff --git a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm
index 8d1d10f67..2791feb5d 100644
--- a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm
+++ b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm
@@ -33,7 +33,7 @@
#import <wtf/CurrentTime.h>
#import <wtf/FastMalloc.h>
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import "WebCoreSystemInterface.h"
#import <notify.h>
#endif
@@ -42,7 +42,7 @@ using std::max;
namespace WebCore {
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#if !PLATFORM(IOS)
static dispatch_source_t _cache_event_source = 0;
diff --git a/Source/WebCore/platform/mac/NSScrollerImpDetails.h b/Source/WebCore/platform/mac/NSScrollerImpDetails.h
index 0c956c6eb..5e2e1ae01 100644
--- a/Source/WebCore/platform/mac/NSScrollerImpDetails.h
+++ b/Source/WebCore/platform/mac/NSScrollerImpDetails.h
@@ -29,7 +29,7 @@
#include "config.h"
// Public APIs not available on versions of Mac on which we build
-#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD))
+#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
enum {
NSScrollerStyleLegacy = 0,
NSScrollerStyleOverlay = 1
@@ -44,7 +44,7 @@ enum {
typedef NSInteger NSScrollerKnobStyle;
#endif
-#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD))
+#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
@interface NSScroller(NSObject)
+ (NSScrollerStyle)preferredScrollerStyle;
@end
diff --git a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
index f0ebf5cae..2ec524c20 100644
--- a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
+++ b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
@@ -156,7 +156,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event)
{
uint32_t phase = PlatformWheelEventPhaseNone;
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if ([event momentumPhase] & NSEventPhaseBegan)
phase |= PlatformWheelEventPhaseBegan;
if ([event momentumPhase] & NSEventPhaseStationary)
@@ -189,7 +189,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event)
static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
{
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
uint32_t phase = PlatformWheelEventPhaseNone;
if ([event phase] & NSEventPhaseBegan)
phase |= PlatformWheelEventPhaseBegan;
@@ -201,7 +201,7 @@ static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
phase |= PlatformWheelEventPhaseEnded;
if ([event phase] & NSEventPhaseCancelled)
phase |= PlatformWheelEventPhaseCancelled;
-#if !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
if ([event momentumPhase] & NSEventPhaseMayBegin)
phase |= PlatformWheelEventPhaseMayBegin;
#endif
diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm
index 203418b87..71cc4a149 100644
--- a/Source/WebCore/platform/mac/PlatformScreenMac.mm
+++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm
@@ -76,7 +76,7 @@ FloatRect screenAvailableRect(Widget* widget)
return toUserSpace([screenForWindow(window) visibleFrame], window);
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/mac/PopupMenuMac.mm b/Source/WebCore/platform/mac/PopupMenuMac.mm
index 855784470..c0f19745c 100644
--- a/Source/WebCore/platform/mac/PopupMenuMac.mm
+++ b/Source/WebCore/platform/mac/PopupMenuMac.mm
@@ -75,10 +75,10 @@ void PopupMenuMac::populate()
if (!client()->shouldPopOver())
[m_popup.get() addItemWithTitle:@""];
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
TextDirection menuTextDirection = client()->menuStyle().textDirection();
[m_popup.get() setUserInterfaceLayoutDirection:menuTextDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
-#endif // !defined(BUILDING_ON_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
ASSERT(client());
int size = client()->listSize();
@@ -98,7 +98,7 @@ void PopupMenuMac::populate()
[attributes setObject:font forKey:NSFontAttributeName];
}
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]);
[paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment];
NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft;
@@ -109,7 +109,7 @@ void PopupMenuMac::populate()
[attributes setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName];
}
[attributes setObject:paragraphStyle.get() forKey:NSParagraphStyleAttributeName];
-#endif // !defined(BUILDING_ON_LEOPARD)
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
// FIXME: Add support for styling the foreground and background colors.
// FIXME: Find a way to customize text color when an item is highlighted.
diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
index 9688c0aaf..600dee583 100644
--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
@@ -635,7 +635,7 @@ ScrollAnimatorMac::~ScrollAnimatorMac()
static bool scrollAnimationEnabledForSystem()
{
-#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM)
return [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollAnimationEnabled"];
#else
return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];
diff --git a/Source/WebCore/platform/mac/ScrollElasticityController.mm b/Source/WebCore/platform/mac/ScrollElasticityController.mm
index 7a753846b..f2845134e 100644
--- a/Source/WebCore/platform/mac/ScrollElasticityController.mm
+++ b/Source/WebCore/platform/mac/ScrollElasticityController.mm
@@ -33,7 +33,7 @@
#if ENABLE(RUBBER_BANDING)
-#ifdef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
@interface NSProcessInfo (ScrollAnimatorMacExt)
- (NSTimeInterval)systemUptime;
@end
@@ -71,8 +71,7 @@ static const float scrollVelocityZeroingTimeout = 0.10f;
static const float rubberbandDirectionLockStretchRatio = 1;
static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10;
-#if defined(BUILDING_ON_LEOPARD) || defined(BULDING_ON_SNOW_LEOPARD) || \
- defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM)
static const float rubberbandStiffness = 20;
static const float rubberbandAmplitude = 0.31f;
static const float rubberbandPeriod = 1.6f;
diff --git a/Source/WebCore/platform/mac/SharedTimerMac.mm b/Source/WebCore/platform/mac/SharedTimerMac.mm
index d7c501dc0..3d01a33c7 100644
--- a/Source/WebCore/platform/mac/SharedTimerMac.mm
+++ b/Source/WebCore/platform/mac/SharedTimerMac.mm
@@ -36,7 +36,7 @@
#include <stdio.h>
// On Snow Leopard and newer we'll ask IOKit to deliver notifications on a queue.
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
#define IOKIT_WITHOUT_LIBDISPATCH 1
#endif
@@ -46,7 +46,7 @@ static CFRunLoopTimerRef sharedTimer;
static void (*sharedTimerFiredFunction)();
static void timerFired(CFRunLoopTimerRef, void*);
-#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && defined(BUILDING_ON_SNOW_LEOPARD)
+#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MAX_ALLOWED == 1060
extern "C" void IONotificationPortSetDispatchQueue(IONotificationPortRef notify, dispatch_queue_t queue);
#endif
diff --git a/Source/WebCore/platform/mac/SuddenTermination.mm b/Source/WebCore/platform/mac/SuddenTermination.mm
index f62411652..406b3bb23 100644
--- a/Source/WebCore/platform/mac/SuddenTermination.mm
+++ b/Source/WebCore/platform/mac/SuddenTermination.mm
@@ -26,7 +26,7 @@
#import "config.h"
#import "SuddenTermination.h"
-#ifndef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
namespace WebCore {
diff --git a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm
index f62d14a03..cc6ea34d1 100644
--- a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm
+++ b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm
@@ -42,7 +42,7 @@
[self setAcceptsMouseMovedEvents:YES];
[self setReleasedWhenClosed:NO];
[self setHasShadow:NO];
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
[self setMovable:NO];
#else
[self setMovableByWindowBackground:NO];
diff --git a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h
index 26be462e1..7894d3de8 100644
--- a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h
+++ b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h
@@ -25,7 +25,7 @@
#import <AppKit/AppKit.h>
-#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM))
+#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM))
#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index 908dd95a9..ea7c215ca 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -58,7 +58,7 @@ typedef UInt32 FMFont;
typedef FMFont ATSUFontID;
typedef UInt16 ATSGlyphRef;
-#if PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && USE(CA) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
typedef struct __IOSurface *IOSurfaceRef;
#endif
@@ -109,7 +109,7 @@ extern "C" {
// In alphabetical order.
extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef, void (^block)(CGRect rect));
#endif
@@ -215,7 +215,7 @@ extern bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGl
extern BOOL (*wkUseSharedMediaUI)();
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern void* wkGetHyphenationLocationBeforeIndex;
#else
extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
@@ -232,7 +232,7 @@ extern int (*wkGetNSEventMomentumPhase)(NSEvent *);
extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
@@ -264,7 +264,7 @@ extern CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
extern AXUIElementRef (*wkCreateAXUIElementRef)(id element);
-#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
#else
typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
@@ -296,27 +296,27 @@ extern void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRe
#endif
extern void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import <dispatch/dispatch.h>
extern dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
extern NSString *(*wkGetMacOSXVersionString)(void);
extern bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
#endif
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
extern void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS)
extern BOOL (*wkFilterIsManagedSession)(void);
extern WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *);
extern void (*wkFilterRelease)(WebFilterEvaluator *);
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index c087a5d87..6a6cc4b1d 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -28,7 +28,7 @@
#import <Foundation/Foundation.h>
void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
#endif
BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
@@ -125,7 +125,7 @@ void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRe
void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void* wkGetHyphenationLocationBeforeIndex;
#else
CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
@@ -133,7 +133,7 @@ int (*wkGetNSEventMomentumPhase)(NSEvent *);
#endif
CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
@@ -178,24 +178,24 @@ CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path);
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
NSString *(*wkGetMacOSXVersionString)(void);
bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
#endif
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
#endif
-#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS)
BOOL (*wkFilterIsManagedSession)(void);
WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *);
void (*wkFilterRelease)(WebFilterEvaluator *);
diff --git a/Source/WebCore/platform/mac/WebFontCache.mm b/Source/WebCore/platform/mac/WebFontCache.mm
index be666cf5f..c9692b287 100644
--- a/Source/WebCore/platform/mac/WebFontCache.mm
+++ b/Source/WebCore/platform/mac/WebFontCache.mm
@@ -104,7 +104,7 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight,
// Workaround for <rdar://problem/5781372>.
static inline void fixUpWeight(NSInteger& weight, NSString *fontName)
{
-#ifndef BUILDING_ON_LEOPARD
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
UNUSED_PARAM(weight);
UNUSED_PARAM(fontName);
#else
diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
index 47c5391c6..ce35fb1d8 100644
--- a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
+++ b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
@@ -53,7 +53,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *)
#define QTMovieRateDidChangeNotification getQTMovieRateDidChangeNotification()
@interface WebVideoFullscreenWindow : NSWindow
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
<NSAnimationDelegate>
#endif
{
@@ -339,7 +339,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
- (void)updateMenuAndDockForFullscreen
{
// NSApplicationPresentationOptions is available on > 10.6 only:
-#ifndef BUILDING_ON_LEOPARD
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
NSScreen* fullscreenScreen = [[self window] screen];
diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm
index 631828acc..90f691d7c 100644
--- a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm
+++ b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm
@@ -44,10 +44,10 @@ static inline CGFloat webkit_CGFloor(CGFloat value)
return floor(value);
}
-#define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_LEOPARD))
+#define HAVE_MEDIA_CONTROL (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
@interface WebVideoFullscreenHUDWindowController (Private)
-#if !defined(BUILDING_ON_LEOPARD)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
<NSWindowDelegate>
#endif
diff --git a/Source/WebCore/platform/network/Credential.h b/Source/WebCore/platform/network/Credential.h
index aae4d52eb..d43ae8fb8 100644
--- a/Source/WebCore/platform/network/Credential.h
+++ b/Source/WebCore/platform/network/Credential.h
@@ -27,7 +27,7 @@
#include "PlatformString.h"
-#define CERTIFICATE_CREDENTIALS_SUPPORTED ((PLATFORM(MAC) || PLATFORM(IOS)) && !defined(BUILDING_ON_LEOPARD))
+#define CERTIFICATE_CREDENTIALS_SUPPORTED (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060))
#if CERTIFICATE_CREDENTIALS_SUPPORTED
#include <Security/SecBase.h>
diff --git a/Source/WebCore/platform/network/DataURL.cpp b/Source/WebCore/platform/network/DataURL.cpp
index 25a443e83..aae525c25 100644
--- a/Source/WebCore/platform/network/DataURL.cpp
+++ b/Source/WebCore/platform/network/DataURL.cpp
@@ -27,13 +27,13 @@
#include "config.h"
#include "DataURL.h"
-#include "Base64.h"
#include "HTTPParsers.h"
#include "ResourceHandle.h"
#include "ResourceHandleClient.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "TextEncoding.h"
+#include <wtf/text/Base64.h>
#include <wtf/text/CString.h>
namespace WebCore {
@@ -75,7 +75,7 @@ void handleDataURL(ResourceHandle* handle)
handle->client()->didReceiveResponse(handle, response);
Vector<char> out;
- if (base64Decode(data, out, IgnoreWhitespace) && out.size() > 0) {
+ if (base64Decode(data, out, Base64IgnoreWhitespace) && out.size() > 0) {
response.setExpectedContentLength(out.size());
handle->client()->didReceiveData(handle, out.data(), out.size(), 0);
}
diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h
index ddca0d22f..840097006 100644
--- a/Source/WebCore/platform/network/ResourceHandle.h
+++ b/Source/WebCore/platform/network/ResourceHandle.h
@@ -67,7 +67,7 @@ typedef int CFHTTPCookieStorageAcceptPolicy;
typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
#endif
-#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD))
+#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
#elif USE(CFURLSTORAGESESSIONS)
typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
index c64fdc8aa..a48324763 100644
--- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
+++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
@@ -20,6 +20,7 @@
#include "NetworkJob.h"
#include "AboutData.h"
+#include "AboutTemplate.html.cpp"
#include "Chrome.h"
#include "ChromeClient.h"
#include "CookieManager.h"
@@ -480,7 +481,8 @@ void NetworkJob::handleNotifyClose(int status)
sendResponseIfNeeded();
if (isClientAvailable()) {
-
+ if (isError(status))
+ m_extendedStatusCode = status;
RecursionGuard guard(m_callingClient);
if (shouldNotifyClientFailed()) {
String domain = m_extendedStatusCode < 0 ? ResourceError::platformErrorDomain : ResourceError::httpErrorDomain;
@@ -800,6 +802,12 @@ void NetworkJob::storeCredentials()
CredentialStorage::set(challenge.proposedCredential(), challenge.protectionSpace(), m_response.url());
challenge.setStored(true);
+
+ if (challenge.protectionSpace().serverType() == ProtectionSpaceProxyHTTP) {
+ BlackBerry::Platform::Client::get()->setProxyCredential(challenge.proposedCredential().user().utf8().data(),
+ challenge.proposedCredential().password().utf8().data());
+ m_frame->page()->chrome()->client()->platformPageClient()->syncProxyCredential(challenge.proposedCredential());
+ }
}
void NetworkJob::purgeCredentials()
@@ -837,7 +845,8 @@ void NetworkJob::handleAbout()
if (equalIgnoringCase(aboutWhat, "blank")) {
handled = true;
} else if (equalIgnoringCase(aboutWhat, "credits")) {
- result.append(String("<html><head><title>Open Source Credits</title> <style> .about {padding:14px;} </style> <meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>"));
+ result.append(writeHeader("Credits"));
+ result.append(String("<style> .about {padding:14px;} </style>"));
result.append(String(BlackBerry::Platform::WEBKITCREDITS));
result.append(String("</body></html>"));
handled = true;
@@ -877,16 +886,18 @@ void NetworkJob::handleAbout()
result.append(String("</body></html>"));
handled = true;
} else if (equalIgnoringCase(aboutWhat, "version")) {
- result.append(String("<html><meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>"));
+ result.append(writeHeader("Version"));
+ result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>"));
result.append(String(BlackBerry::Platform::BUILDTIME));
- result.append(String("</body></html>"));
+ result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>"));
handled = true;
} else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) {
result = configPage();
handled = true;
} else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) {
- result.append(String("<html><head><title>BlackBerry Browser Build Information</title></head><body><table>"));
- result.append(String("<tr><td>Build Computer: </td><td>"));
+ result.append(writeHeader("Build"));
+ result.append(String("<div class='box'><div class='box-title'>Basic</div><table>"));
+ result.append(String("<tr><td>Built On: </td><td>"));
result.append(String(BlackBerry::Platform::BUILDCOMPUTER));
result.append(String("</td></tr>"));
result.append(String("<tr><td>Build User: </td><td>"));
@@ -894,11 +905,11 @@ void NetworkJob::handleAbout()
result.append(String("</td></tr>"));
result.append(String("<tr><td>Build Time: </td><td>"));
result.append(String(BlackBerry::Platform::BUILDTIME));
- result.append(String("</td></tr><tr><td></td><td></td></tr>"));
+ result.append(String("</table></div><br>"));
result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT));
result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM));
result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW));
- result.append(String("</table></body></html>"));
+ result.append(String("</body></html>"));
handled = true;
} else if (equalIgnoringCase(aboutWhat, "memory")) {
result = memoryPage();
diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h
index a9a7b881b..acc07dcbf 100644
--- a/Source/WebCore/platform/network/blackberry/NetworkJob.h
+++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h
@@ -80,6 +80,7 @@ public:
void handleNotifyDataSent(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
virtual void notifyClose(int status);
void handleNotifyClose(int status);
+ virtual int status() const { return m_extendedStatusCode; }
private:
bool isClientAvailable() const { return !m_cancelled && m_handle && m_handle->client(); }
diff --git a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp
index 5cffde039..3c439d91f 100644
--- a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp
+++ b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp
@@ -55,6 +55,8 @@ static inline NetworkRequest::TargetType platformTargetTypeForRequest(const Reso
{
if (request.isXMLHTTPRequest())
return NetworkRequest::TargetIsXMLHTTPRequest;
+ if (request.forceDownload())
+ return NetworkRequest::TargetIsDownload;
switch (request.targetType()) {
case ResourceRequest::TargetIsMainFrame:
diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h
index 73b118fef..fce05f1c4 100644
--- a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h
+++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h
@@ -57,6 +57,7 @@ public:
virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer*);
virtual void notifyReadyToSendData();
virtual void notifyClose(int status);
+ virtual int status() const { return m_status; }
protected:
virtual int platformSend(const char* data, int length);
@@ -66,6 +67,7 @@ private:
SocketStreamHandle(const String& groupName, const KURL&, SocketStreamHandleClient*);
OwnPtr<BlackBerry::Platform::FilterStream> m_socketStream;
+ int m_status;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
index 0fd0e6961..90ed528a7 100644
--- a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
+++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
@@ -105,7 +105,7 @@ void SocketStreamHandle::notifyStatusReceived(int status, const char* message)
// The client can close the handle, potentially removing the last reference.
RefPtr<SocketStreamHandle> protect(this);
-
+ m_status = status;
if (FilterStream::StatusSuccess != status)
m_client->didFailSocketStream(this, SocketStreamError(status));
else {
@@ -135,6 +135,9 @@ void SocketStreamHandle::notifyClose(int status)
// The client can close the handle, potentially removing the last reference.
RefPtr<SocketStreamHandle> protect(this);
+ if (status < 0 || (400 <= status && status < 600))
+ m_status = status;
+
if (FilterStream::StatusSuccess != status)
m_client->didFailSocketStream(this, SocketStreamError(status));
diff --git a/Source/WebCore/platform/network/cf/DNSCFNet.cpp b/Source/WebCore/platform/network/cf/DNSCFNet.cpp
index 28c95df97..3f901a541 100644
--- a/Source/WebCore/platform/network/cf/DNSCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/DNSCFNet.cpp
@@ -42,7 +42,7 @@
#include <CFNetwork/CFNetwork.h>
#endif
-#if defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
#include <SystemConfiguration/SystemConfiguration.h>
#endif
@@ -56,7 +56,7 @@ bool DNSResolveQueue::platformProxyIsEnabledInSystemPreferences()
// as it doesn't necessarily look up the actual external IP. Also, if DNS returns a fake internal address,
// local caches may keep it even after re-connecting to another network.
-#if !defined(BUILDING_ON_LEOPARD)
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, CFNetworkCopySystemProxySettings());
#else
RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, SCDynamicStoreCopyProxies(0));
diff --git a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp
index 6b0c8b0c5..74db9ee6b 100644
--- a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp
@@ -37,7 +37,7 @@
namespace WebCore {
-#ifndef BUILDING_ON_LEOPARD
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
static void processProxyServers(Vector<ProxyServer>& proxyServers, CFArrayRef proxies, CFURLRef url);
diff --git a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
index 677eee6c1..f6d1f3821 100644
--- a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -29,7 +29,6 @@
#include "AuthenticationCF.h"
#include "AuthenticationChallenge.h"
-#include "Base64.h"
#include "CookieStorageCFNet.h"
#include "CredentialStorage.h"
#include "CachedResourceLoader.h"
@@ -48,6 +47,7 @@
#include <sys/types.h>
#include <wtf/HashMap.h>
#include <wtf/Threading.h>
+#include <wtf/text/Base64.h>
#include <wtf/text/CString.h>
#if PLATFORM(MAC)
diff --git a/Source/WebCore/platform/network/cf/ResourceRequest.h b/Source/WebCore/platform/network/cf/ResourceRequest.h
index 72522d9ed..64be955f6 100644
--- a/Source/WebCore/platform/network/cf/ResourceRequest.h
+++ b/Source/WebCore/platform/network/cf/ResourceRequest.h
@@ -36,7 +36,7 @@ typedef const struct _CFURLRequest* CFURLRequestRef;
OBJC_CLASS NSURLRequest;
-#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD))
+#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
#elif USE(CFURLSTORAGESESSIONS)
typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
index 7ce9b6039..520d68578 100644
--- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
@@ -265,7 +265,7 @@ void ResourceRequest::setHTTPPipeliningEnabled(bool flag)
s_httpPipeliningEnabled = flag;
}
-#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static inline bool readBooleanPreference(CFStringRef key)
{
Boolean keyExistsAndHasValidFormat;
@@ -281,7 +281,7 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
// Always set the connection count per host, even when pipelining.
unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
-#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static const unsigned unlimitedConnectionCount = 10000;
if (!ResourceRequest::httpPipeliningEnabled() && readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining")))
diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
index 9033340d8..d86c76bc6 100644
--- a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
@@ -41,7 +41,7 @@
#include <wtf/MainThread.h>
#include <wtf/text/WTFString.h>
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
#include <SystemConfiguration/SystemConfiguration.h>
#endif
@@ -176,7 +176,7 @@ void SocketStreamHandle::removePACRunLoopSource()
void SocketStreamHandle::chooseProxy()
{
-#ifndef BUILDING_ON_LEOPARD
+#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, CFNetworkCopySystemProxySettings());
#else
// We don't need proxy information often, so there is no need to set up a permanent dynamic store session.
diff --git a/Source/WebCore/platform/network/mac/AuthenticationMac.mm b/Source/WebCore/platform/network/mac/AuthenticationMac.mm
index 82c660a6e..050268931 100644
--- a/Source/WebCore/platform/network/mac/AuthenticationMac.mm
+++ b/Source/WebCore/platform/network/mac/AuthenticationMac.mm
@@ -165,7 +165,7 @@ NSURLCredential *mac(const Credential& coreCredential)
#else
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
// There is no constant in headers, but NTLM is supported.
NSString * const NSURLAuthenticationMethodNTLM = @"NSURLAuthenticationMethodNTLM";
#endif
diff --git a/Source/WebCore/platform/network/mac/CookieStorageMac.mm b/Source/WebCore/platform/network/mac/CookieStorageMac.mm
index 25b4d44f2..1de6888a2 100644
--- a/Source/WebCore/platform/network/mac/CookieStorageMac.mm
+++ b/Source/WebCore/platform/network/mac/CookieStorageMac.mm
@@ -79,7 +79,7 @@ namespace WebCore {
void setCookieStoragePrivateBrowsingEnabled(bool enabled)
{
-#if defined(BUILDING_ON_SNOW_LEOPARD) && USE(CFURLSTORAGESESSIONS)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 && USE(CFURLSTORAGESESSIONS)
// Don't call wkSetCookieStoragePrivateBrowsingEnabled() when cookie storage is set up via sessions.
// That would make NSURLConnect use global private browsing cookie storage regardless of request session.
// The global private cookie storage has different semantics - it makes new cookies non-persistent,
diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
index 4ac33ccdc..7e226e259 100644
--- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -30,7 +30,6 @@
#import "AuthenticationChallenge.h"
#import "AuthenticationMac.h"
-#import "Base64.h"
#import "BlobRegistry.h"
#import "BlockExceptions.h"
#import "CookieStorage.h"
@@ -52,8 +51,9 @@
#import "SubresourceLoader.h"
#import "WebCoreSystemInterface.h"
#import "WebCoreURLResponse.h"
-#import <wtf/text/CString.h>
#import <wtf/UnusedParam.h>
+#import <wtf/text/Base64.h>
+#import <wtf/text/CString.h>
using namespace WebCore;
@@ -214,7 +214,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential
nsRequest = mutableRequest;
}
-#if !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
ASSERT([NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)]);
static bool supportsSettingConnectionProperties = true;
#else
@@ -512,7 +512,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
// we make sure that is actually present
ASSERT(challenge.nsURLAuthenticationChallenge());
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOWLEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels
// CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case.
if (challenge.protectionSpace().isProxy()) {
diff --git a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
index 262fdb446..96c497d50 100644
--- a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
+++ b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
@@ -82,7 +82,7 @@ void ResourceRequest::doUpdateResourceRequest()
m_httpMethod = method;
m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (ResourceRequest::httpPipeliningEnabled())
m_priority = toResourceLoadPriority(wkGetHTTPPipeliningPriority([m_nsRequest.get() _CFURLRequest]));
#endif
@@ -129,13 +129,13 @@ void ResourceRequest::doUpdatePlatformRequest()
nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (ResourceRequest::httpPipeliningEnabled())
wkSetHTTPPipeliningPriority([nsRequest _CFURLRequest], toHTTPPipeliningPriority(m_priority));
#endif
[nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]);
#endif
diff --git a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
index be2e2767f..6aa76f6dd 100644
--- a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
+++ b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
@@ -497,7 +497,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
}
}
-#ifdef BUILDING_ON_LEOPARD
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
// Workaround for <rdar://problem/5539824>
if (CFStringCompare(result.get(), CFSTR("text/xml"), 0) == kCFCompareEqualTo)
result = CFSTR("application/xml");
diff --git a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp
index 2d7174799..f309e5d84 100644
--- a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp
+++ b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp
@@ -37,8 +37,10 @@ void setCookieStoragePrivateBrowsingEnabled(bool enabled)
}
#if USE(PLATFORM_STRATEGIES)
-static void soupCookiesChanged(SoupCookieJar*, SoupCookie*, SoupCookie*, gpointer)
+static void soupCookiesChanged(SoupCookieJar* jar, SoupCookie*, SoupCookie*, gpointer)
{
+ if (jar != soupCookieJar())
+ return;
platformStrategies()->cookiesStrategy()->notifyCookiesChanged();
}
#endif
diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 60e4e1532..35d41abfb 100644
--- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "ResourceHandle.h"
-#include "Base64.h"
#include "CachedResourceLoader.h"
#include "ChromeClient.h"
#include "CookieJarSoup.h"
diff --git a/Source/WebCore/platform/network/soup/ResourceResponse.h b/Source/WebCore/platform/network/soup/ResourceResponse.h
index 8624c0591..b8084cff4 100644
--- a/Source/WebCore/platform/network/soup/ResourceResponse.h
+++ b/Source/WebCore/platform/network/soup/ResourceResponse.h
@@ -29,6 +29,7 @@
#include "ResourceResponseBase.h"
#include <libsoup/soup.h>
+#include <wtf/gobject/GRefPtr.h>
namespace WebCore {
@@ -37,18 +38,21 @@ public:
ResourceResponse()
: ResourceResponseBase()
, m_soupFlags(static_cast<SoupMessageFlags>(0))
+ , m_tlsErrors(static_cast<GTlsCertificateFlags>(0))
{
}
ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
: ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
+ , m_tlsErrors(static_cast<GTlsCertificateFlags>(0))
{
}
ResourceResponse(SoupMessage* soupMessage)
: ResourceResponseBase()
, m_soupFlags(static_cast<SoupMessageFlags>(0))
+ , m_tlsErrors(static_cast<GTlsCertificateFlags>(0))
{
updateFromSoupMessage(soupMessage);
}
@@ -62,11 +66,19 @@ public:
const String& sniffedContentType() const { return m_sniffedContentType; }
void setSniffedContentType(const String& value) { m_sniffedContentType = value; }
+ GTlsCertificate* soupMessageCertificate() const { return m_certificate.get(); }
+ void setSoupMessageCertificate(GTlsCertificate* certificate) { m_certificate = certificate; }
+
+ GTlsCertificateFlags soupMessageTLSErrors() const { return m_tlsErrors; }
+ void setSoupMessageTLSErrors(GTlsCertificateFlags tlsErrors) { m_tlsErrors = tlsErrors; }
+
private:
friend class ResourceResponseBase;
SoupMessageFlags m_soupFlags;
String m_sniffedContentType;
+ GRefPtr<GTlsCertificate> m_certificate;
+ GTlsCertificateFlags m_tlsErrors;
void doUpdateResourceResponse() { }
diff --git a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
index 155048b2b..ddaa893b6 100644
--- a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
+++ b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
@@ -51,6 +51,8 @@ SoupMessage* ResourceResponse::toSoupMessage() const
soup_message_set_flags(soupMessage, m_soupFlags);
+ g_object_set(G_OBJECT(soupMessage), "tls-certificate", m_certificate.get(), "tls-errors", m_tlsErrors, NULL);
+
// Body data is not in the message.
return soupMessage;
}
@@ -84,6 +86,10 @@ void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage)
setExpectedContentLength(soup_message_headers_get_content_length(soupMessage->response_headers));
setHTTPStatusText(soupMessage->reason_phrase);
setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition")));
+
+ GTlsCertificate* certificate = 0;
+ soup_message_get_https_status(soupMessage, &certificate, &m_tlsErrors);
+ m_certificate = certificate;
}
}
diff --git a/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp
new file mode 100644
index 000000000..40eafb214
--- /dev/null
+++ b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "MemoryUsageSupport.h"
+
+#include "JSDOMWindow.h"
+#include <runtime/MemoryStatistics.h>
+#include <wtf/FastMalloc.h>
+
+#if OS(LINUX)
+#include <malloc.h>
+#endif
+
+namespace WebCore {
+
+#if OS(LINUX)
+static size_t mallocMemoryUsage(bool inuse)
+{
+ // Return how much memory (in bytes) has been allocated on the system heap.
+ struct mallinfo minfo = ::mallinfo();
+
+ // If we want the internal memory usage, we subtract the memory used by
+ // free blocks. That is memory allocated from the system by malloc but
+ // which malloc considers free.
+ return minfo.arena - (inuse ? minfo.fordblks : 0);
+}
+#else
+static size_t mallocMemoryUsage(bool)
+{
+ // FIXME: Implement for other supported OS's.
+ return 0;
+}
+#endif
+
+// This is how much system-memory we use.
+static int memoryUsageKB()
+{
+ size_t mallocUsage = mallocMemoryUsage(false);
+ WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics();
+
+ // Extract memory statistics from JavaScriptCore:
+ JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics();
+ size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.capacity();
+ return (mallocUsage + fmStats.committedVMBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10;
+}
+
+// This is how much memory we use internally, not including memory only reserved from the system.
+static int actualMemoryUsageKB()
+{
+ size_t mallocUsage = mallocMemoryUsage(true);
+ WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics();
+
+ // Extract memory statistics from JavaScriptCore:
+ JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics();
+ size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.size();
+ return (mallocUsage + fmStats.committedVMBytes - fmStats.freeListBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10;
+}
+
+int MemoryUsageSupport::memoryUsageMB()
+{
+ return memoryUsageKB() >> 10;
+}
+
+int MemoryUsageSupport::actualMemoryUsageMB()
+{
+ return actualMemoryUsageKB() >> 10;
+}
+
+// FIXME: These values should be determined based on hardware or set by the application.
+
+static const unsigned normalMemoryWatermark = 128; // Chromium default: 256
+static const unsigned highMemoryWatermark = 256; // Chromium default: 1024
+static const unsigned highMemoryDelta = 64; // Chromium default: 128
+
+int MemoryUsageSupport::lowMemoryUsageMB()
+{
+ return normalMemoryWatermark;
+}
+
+int MemoryUsageSupport::highMemoryUsageMB()
+{
+ return highMemoryWatermark;
+}
+
+int MemoryUsageSupport::highUsageDeltaMB()
+{
+ return highMemoryDelta;
+}
+
+bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*)
+{
+ // FIXME: Not implemented.
+ return false;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp
index cf381ee68..f30472a0b 100644
--- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp
+++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp
@@ -143,7 +143,7 @@ FloatRect screenAvailableRect(Widget* widget)
return FloatRect(r.x(), r.y(), r.width(), r.height());
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/qt/PlatformSupport.h b/Source/WebCore/platform/qt/PlatformSupport.h
index 0e188db8f..d0bf1549a 100644
--- a/Source/WebCore/platform/qt/PlatformSupport.h
+++ b/Source/WebCore/platform/qt/PlatformSupport.h
@@ -92,14 +92,6 @@ public:
// Plugin
static NPObject* pluginScriptableObject(Widget*);
- // If memory usage is below this threshold, do not bother forcing GC.
- static int lowMemoryUsageMB() { return 256; }
-
- // If memory usage is above this threshold, force GC more aggressively.
- static int highMemoryUsageMB() { return 1024; }
-
- // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high.
- static int highUsageDeltaMB() { return 128; }
};
}
diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp
index 170d39b59..3d1f94245 100644
--- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp
+++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp
@@ -66,7 +66,7 @@ static const float buttonPaddingRight = 18;
static const float buttonPaddingTop = 2;
static const float buttonPaddingBottom = 3;
static const float menuListPadding = 9;
-static const float textFieldPadding = 5;
+static const float textFieldPadding = 10;
static const float radiusFactor = 0.36;
static const float progressBarChunkPercentage = 0.2;
#if ENABLE(PROGRESS_TAG)
@@ -108,6 +108,44 @@ uint qHash(const KeyIdentifier& id)
return hash;
}
+/*
+ * The octants' indices are identified below, for each point (x,y)
+ * in the first octant, we can populate the 7 others with the corresponding
+ * point.
+ *
+ * index | xpos | ypos
+ * xd ---------------------------
+ * 4 |<--->| 3 0 | xd + x | y
+ * __________________ 1 | xd + y | x
+ * / \ 2 | xd + y | -x
+ * 5 | .(c) | 2 3 | xd + x | -y
+ * 6 | | 1 4 | -xd - x | -y
+ * \__________________/ 5 | -xd - y | -x
+ * 6 | -xd - y | x
+ * 7 0 7 | -xd - x | y
+ *
+ **/
+
+static void addPointToOctants(QVector<QPainterPath>& octants, const QPointF& center, qreal x, qreal y , int xDelta = 0)
+{
+ ASSERT(octants.count() == 8);
+
+ for (short i = 0; i < 8; ++i) {
+ QPainterPath& octant = octants[i];
+ QPointF pos(center);
+ // The Gray code corresponding to the octant's index helps doing the math in a more generic way.
+ const short gray = (i >> 1) ^ i;
+ const qreal xOffset = xDelta + ((gray & 1) ? y : x);
+ pos.ry() += ((gray & 2)? -1 : 1) * ((gray & 1) ? x : y);
+ pos.rx() += (i < 4) ? xOffset : -xOffset;
+
+ if (octant.elementCount())
+ octant.lineTo(pos);
+ else // The path is empty. Initialize the start point.
+ octant.moveTo(pos);
+ }
+}
+
static void drawControlBackground(QPainter* painter, const QPen& pen, const QRect& rect, const QBrush& brush)
{
QPen oldPen = painter->pen();
@@ -116,28 +154,32 @@ static void drawControlBackground(QPainter* painter, const QPen& pen, const QRec
painter->setPen(pen);
painter->setBrush(brush);
- const int line = 1;
- const QRect paddedRect = rect.adjusted(line, line, -line, -line);
+ static const qreal line = 1.5;
+ const QRectF paddedRect = rect.adjusted(line, line, -line, -line);
- const int n = 3;
+ static const int n = 3;
const qreal invPow = 1 / double(n);
ASSERT(paddedRect.width() >= paddedRect.height());
const int radius = paddedRect.height() / 2;
const int xDelta = paddedRect.width() / 2 - radius;
- const QPoint center = paddedRect.topLeft() + QPoint(xDelta + radius, radius);
- qreal x, y;
- QPainterPath path;
- path.moveTo(-xDelta, -radius);
- for (y = -radius ; y <= radius; ++y) {
- x = -xDelta - radius * pow(1 - pow(qAbs(y) / radius , n), invPow);
- path.lineTo(x, y);
+ const QPointF center = paddedRect.center();
+ qreal x = 0;
+ qreal y;
+ QVector<QPainterPath> octants(8);
+ // Stay within reasonable distance from edge values, which can cause artifacts at certain zoom levels.
+ static const float epsilon = 0.02;
+ for (y = radius - epsilon; y - epsilon > x; y -= 0.5) {
+ x = radius * pow(1 - pow(qAbs(y) / radius , n), invPow);
+ addPointToOctants(octants, center, x, y, xDelta);
}
- for (y = radius ; y >= -radius; --y) {
- x = xDelta + radius * pow(1 - pow(qAbs(y) / radius , n), invPow);
- path.lineTo(x, y);
+
+ QPainterPath path = octants.first();
+ for (int i = 1; i < 8; ++i) {
+ // Due to the orientation of the arcs, we need to reverse the paths with odd indices.
+ QPainterPath subPath = (i % 2) ? octants.at(i).toReversed() : octants.at(i);
+ path.connectPath(subPath);
}
path.closeSubpath();
- path.translate(center);
painter->drawPath(path);
painter->setPen(oldPen);
@@ -152,7 +194,7 @@ static inline QRect shrinkRectToSquare(const QRect& rect)
static inline QPen borderPen(QPainter* painter = 0)
{
- return QPen(darkColor, 0.4 * painterScale(painter), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
+ return QPen(darkColor, qMin(1.0, 0.4 * painterScale(painter)));
}
QSharedPointer<StylePainter> RenderThemeQtMobile::getStylePainter(const PaintInfo& pi)
@@ -383,14 +425,14 @@ QPixmap StylePainterMobile::findLineEdit(const QSize & size, bool focused) const
if (!findCachedControl(id, &result)) {
const int focusFrame = painterScale(painter);
- result = QPixmap(size + QSize(2 * focusFrame, 2 * focusFrame));
+ result = QPixmap(size);
result.fill(Qt::transparent);
const QRect rect = result.rect().adjusted(focusFrame, focusFrame, -focusFrame, -focusFrame);
QPainter cachePainter(&result);
drawControlBackground(&cachePainter, borderPen(painter), rect, Qt::white);
if (focused) {
- QPen focusPen(highlightColor, focusFrame, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
+ QPen focusPen(highlightColor, 1.2 * painterScale(painter), Qt::SolidLine);
drawControlBackground(&cachePainter, focusPen, rect, Qt::NoBrush);
}
insertIntoCache(id, result);
@@ -697,6 +739,10 @@ void RenderThemeQtMobile::adjustTextFieldStyle(StyleResolver*, RenderStyle* styl
// padding. Just worth keeping in mind!
style->setBackgroundColor(Color::transparent);
style->resetBorder();
+ style->setBorderTopWidth(frameWidth);
+ style->setBorderRightWidth(frameWidth);
+ style->setBorderBottomWidth(frameWidth);
+ style->setBorderLeftWidth(frameWidth);
style->resetPadding();
computeSizeBasedOnStyle(style);
style->setPaddingLeft(Length(textFieldPadding, Fixed));
diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.h b/Source/WebCore/platform/qt/RenderThemeQtMobile.h
index bc2036c79..2d1e53dad 100644
--- a/Source/WebCore/platform/qt/RenderThemeQtMobile.h
+++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.h
@@ -53,8 +53,10 @@ public:
virtual bool delegatesMenuListRendering() const { return true; }
- // drawFocusRing() will return early if the color is invalid.
- virtual Color platformFocusRingColor() const { return Color(); }
+ // We don't want the focus ring to be drawn by the graphics context so we
+ // always claim to support it in the theme.
+ // FIXME: This could be a usability problem in the case of contenteditable divs.
+ virtual bool supportsFocusRing(const RenderStyle*) const { return true; }
protected:
diff --git a/Source/WebCore/platform/text/Base64.cpp b/Source/WebCore/platform/text/Base64.cpp
deleted file mode 100644
index bf706f68b..000000000
--- a/Source/WebCore/platform/text/Base64.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org>
- Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
- Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License (LGPL)
- version 2 as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- This code is based on the java implementation in HTTPClient
- package by Ronald Tschalär Copyright (C) 1996-1999.
-*/
-
-#include "config.h"
-#include "Base64.h"
-
-#include <limits.h>
-#include <wtf/StringExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-static const char base64EncMap[64] = {
- 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
- 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
-};
-
-static const char base64DecMap[128] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3F,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
- 0x3C, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
- 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
- 0x17, 0x18, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
- 0x31, 0x32, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-String base64Encode(const char* data, unsigned length, bool insertLFs)
-{
- Vector<char> result;
- base64Encode(data, length, result, insertLFs);
- return String(result.data(), result.size());
-}
-
-void base64Encode(const char* data, unsigned len, Vector<char>& out, bool insertLFs)
-{
- out.clear();
- if (!len)
- return;
-
- // If the input string is pathologically large, just return nothing.
- // Note: Keep this in sync with the "outLength" computation below.
- // Rather than being perfectly precise, this is a bit conservative.
- const unsigned maxInputBufferSize = UINT_MAX / 77 * 76 / 4 * 3 - 2;
- if (len > maxInputBufferSize)
- return;
-
- unsigned sidx = 0;
- unsigned didx = 0;
-
- unsigned outLength = ((len + 2) / 3) * 4;
-
- // Deal with the 76 character per line limit specified in RFC 2045.
- insertLFs = (insertLFs && outLength > 76);
- if (insertLFs)
- outLength += ((outLength - 1) / 76);
-
- int count = 0;
- out.grow(outLength);
-
- // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
- if (len > 1) {
- while (sidx < len - 2) {
- if (insertLFs) {
- if (count && !(count % 76))
- out[didx++] = '\n';
- count += 4;
- }
- out[didx++] = base64EncMap[(data[sidx] >> 2) & 077];
- out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)];
- out[didx++] = base64EncMap[((data[sidx + 2] >> 6) & 003) | ((data[sidx + 1] << 2) & 077)];
- out[didx++] = base64EncMap[data[sidx + 2] & 077];
- sidx += 3;
- }
- }
-
- if (sidx < len) {
- if (insertLFs && (count > 0) && !(count % 76))
- out[didx++] = '\n';
-
- out[didx++] = base64EncMap[(data[sidx] >> 2) & 077];
- if (sidx < len - 1) {
- out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)];
- out[didx++] = base64EncMap[(data[sidx + 1] << 2) & 077];
- } else
- out[didx++] = base64EncMap[(data[sidx] << 4) & 077];
- }
-
- // Add padding
- while (didx < out.size()) {
- out[didx] = '=';
- didx++;
- }
-}
-
-bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy policy)
-{
- out.clear();
-
- // If the input string is pathologically large, just return nothing.
- if (in.size() > UINT_MAX)
- return false;
-
- return base64Decode(in.data(), in.size(), out, policy);
-}
-
-template<typename T>
-static inline bool base64DecodeInternal(const T* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy)
-{
- out.clear();
- if (!len)
- return true;
-
- out.grow(len);
-
- bool sawEqualsSign = false;
- unsigned outLength = 0;
- for (unsigned idx = 0; idx < len; idx++) {
- unsigned ch = data[idx];
- if (ch == '=')
- sawEqualsSign = true;
- else if (('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ch == '+' || ch == '/') {
- if (sawEqualsSign)
- return false;
- out[outLength] = base64DecMap[ch];
- outLength++;
- } else if (policy == FailOnInvalidCharacter || (policy == IgnoreWhitespace && !isSpaceOrNewline(ch)))
- return false;
- }
-
- if (!outLength)
- return !sawEqualsSign;
-
- // Valid data is (n * 4 + [0,2,3]) characters long.
- if ((outLength % 4) == 1)
- return false;
-
- // 4-byte to 3-byte conversion
- outLength -= (outLength + 3) / 4;
- if (!outLength)
- return false;
-
- unsigned sidx = 0;
- unsigned didx = 0;
- if (outLength > 1) {
- while (didx < outLength - 2) {
- out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003));
- out[didx + 1] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017));
- out[didx + 2] = (((out[sidx + 2] << 6) & 255) | (out[sidx + 3] & 077));
- sidx += 4;
- didx += 3;
- }
- }
-
- if (didx < outLength)
- out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003));
-
- if (++didx < outLength)
- out[didx] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017));
-
- if (outLength < out.size())
- out.shrink(outLength);
-
- return true;
-}
-
-bool base64Decode(const char* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy)
-{
- return base64DecodeInternal<char>(data, len, out, policy);
-}
-
-bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy)
-{
- return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy);
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/text/Base64.h b/Source/WebCore/platform/text/Base64.h
deleted file mode 100644
index 70855de04..000000000
--- a/Source/WebCore/platform/text/Base64.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
- * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Base64_h
-#define Base64_h
-
-#include <wtf/Vector.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-enum Base64DecodePolicy { FailOnInvalidCharacter, IgnoreWhitespace, IgnoreInvalidCharacters };
-
-void base64Encode(const char*, unsigned, Vector<char>&, bool insertLFs = false);
-void base64Encode(const Vector<char>&, Vector<char>&, bool insertLFs = false);
-void base64Encode(const CString&, Vector<char>&, bool insertLFs = false);
-String base64Encode(const char*, unsigned, bool insertLFs = false);
-String base64Encode(const Vector<char>&, bool insertLFs = false);
-String base64Encode(const CString&, bool insertLFs = false);
-
-bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter);
-bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter);
-bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter);
-
-inline void base64Encode(const Vector<char>& in, Vector<char>& out, bool insertLFs)
-{
- base64Encode(in.data(), in.size(), out, insertLFs);
-}
-
-inline void base64Encode(const CString& in, Vector<char>& out, bool insertLFs)
-{
- base64Encode(in.data(), in.length(), out, insertLFs);
-}
-
-inline String base64Encode(const Vector<char>& in, bool insertLFs)
-{
- return base64Encode(in.data(), in.size(), insertLFs);
-}
-
-inline String base64Encode(const CString& in, bool insertLFs)
-{
- return base64Encode(in.data(), in.length(), insertLFs);
-}
-
-} // namespace WebCore
-
-#endif // Base64_h
diff --git a/Source/WebCore/platform/text/TextChecking.h b/Source/WebCore/platform/text/TextChecking.h
index 0742cb32d..53364397f 100644
--- a/Source/WebCore/platform/text/TextChecking.h
+++ b/Source/WebCore/platform/text/TextChecking.h
@@ -39,18 +39,18 @@ namespace WebCore {
#define WTF_USE_GRAMMAR_CHECKING 1
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
#define WTF_USE_UNIFIED_TEXT_CHECKING 1
#define WTF_USE_AUTOMATIC_TEXT_REPLACEMENT 1
#endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
// Some platforms provide UI for suggesting autocorrection.
#define WTF_USE_AUTOCORRECTION_PANEL 1
// Some platforms use spelling and autocorrection markers to provide visual cue.
// On such platform, if word with marker is edited, we need to remove the marker.
#define WTF_USE_MARKER_REMOVAL_UPON_EDITING 1
-#endif // #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // #if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
enum TextCheckingType {
TextCheckingTypeSpelling = 1 << 1,
diff --git a/Source/WebCore/platform/text/cf/HyphenationCF.cpp b/Source/WebCore/platform/text/cf/HyphenationCF.cpp
index f170b8afa..4e3fced44 100644
--- a/Source/WebCore/platform/text/cf/HyphenationCF.cpp
+++ b/Source/WebCore/platform/text/cf/HyphenationCF.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "Hyphenation.h"
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#include "AtomicStringKeyedMRUCache.h"
#include "TextBreakIteratorInternalICU.h"
@@ -70,10 +70,11 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI
RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier);
ASSERT(locale);
- CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0);
+ CFOptionFlags searchAcrossWordBoundaries = 1;
+ CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), searchAcrossWordBoundaries, locale.get(), 0);
return result == kCFNotFound ? 0 : result;
}
} // namespace WebCore
-#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
diff --git a/Source/WebCore/platform/text/mac/HyphenationMac.mm b/Source/WebCore/platform/text/mac/HyphenationMac.mm
index 4c8676892..40b77c815 100644
--- a/Source/WebCore/platform/text/mac/HyphenationMac.mm
+++ b/Source/WebCore/platform/text/mac/HyphenationMac.mm
@@ -26,7 +26,7 @@
#import "config.h"
#import "Hyphenation.h"
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
#import "AtomicStringKeyedMRUCache.h"
#import "TextBreakIteratorInternalICU.h"
@@ -67,4 +67,4 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI
} // namespace WebCore
-#endif // defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+#endif // !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
diff --git a/Source/WebCore/platform/text/mac/LocaleMac.h b/Source/WebCore/platform/text/mac/LocaleMac.h
index 6f1365f79..074fe3e12 100644
--- a/Source/WebCore/platform/text/mac/LocaleMac.h
+++ b/Source/WebCore/platform/text/mac/LocaleMac.h
@@ -65,6 +65,7 @@ public:
#endif
private:
+ explicit LocaleMac(NSLocale*);
explicit LocaleMac(const String&);
NSDateFormatter *createShortDateFormatter();
diff --git a/Source/WebCore/platform/text/mac/LocaleMac.mm b/Source/WebCore/platform/text/mac/LocaleMac.mm
index 219e95c84..35b64de6a 100644
--- a/Source/WebCore/platform/text/mac/LocaleMac.mm
+++ b/Source/WebCore/platform/text/mac/LocaleMac.mm
@@ -55,6 +55,11 @@ static NSDateFormatter* createDateTimeFormatter(NSLocale* locale, NSDateFormatte
return formatter;
}
+LocaleMac::LocaleMac(NSLocale* locale)
+ : m_locale(locale)
+{
+}
+
LocaleMac::LocaleMac(const String& localeIdentifier)
: m_locale([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier])
{
@@ -71,7 +76,7 @@ PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier)
LocaleMac* LocaleMac::currentLocale()
{
- static LocaleMac* currentLocale = LocaleMac::create([[NSLocale currentLocale] localeIdentifier]).leakPtr();
+ static LocaleMac* currentLocale = new LocaleMac([NSLocale currentLocale]);
return currentLocale;
}
diff --git a/Source/WebCore/platform/win/PlatformScreenWin.cpp b/Source/WebCore/platform/win/PlatformScreenWin.cpp
index 21bf23c63..5ea24b414 100644
--- a/Source/WebCore/platform/win/PlatformScreenWin.cpp
+++ b/Source/WebCore/platform/win/PlatformScreenWin.cpp
@@ -118,7 +118,7 @@ FloatRect screenAvailableRect(Widget* widget)
return monitorInfo.rcWork;
}
-void screenColorProfile(Widget*, ColorProfile&)
+void screenColorProfile(ColorProfile&)
{
notImplemented();
}
diff --git a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
index b10961b79..da68de780 100644
--- a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
+++ b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
@@ -20,7 +20,7 @@
#include "config.h"
#include "SSLKeyGenerator.h"
-#include "Base64.h"
+#include <wtf/text/Base64.h>
#include <wtf/text/CString.h>
#include <windows.h>
diff --git a/Source/WebCore/platform/win/SoftLinking.h b/Source/WebCore/platform/win/SoftLinking.h
index 4124d5fc5..cd5c2c1bf 100644
--- a/Source/WebCore/platform/win/SoftLinking.h
+++ b/Source/WebCore/platform/win/SoftLinking.h
@@ -79,6 +79,23 @@
return ptr; \
}\
+#define SOFT_LINK_LOADED_LIBRARY(library, functionName, resultType, callingConvention, parameterDeclarations) \
+ typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
+ static functionName##PtrType functionName##Ptr() \
+ { \
+ static functionName##PtrType ptr; \
+ static bool initialized; \
+ \
+ if (initialized) \
+ return ptr; \
+ initialized = true; \
+ \
+ static HINSTANCE libraryInstance = ::GetModuleHandle(L#library); \
+ \
+ ptr = reinterpret_cast<functionName##PtrType>(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName)); \
+ return ptr; \
+ }\
+
/*
In order to soft link against functions decorated with __declspec(dllimport), we prepend "softLink_" to the function names.
If you use SOFT_LINK_DLL_IMPORT(), you will also need to #define the function name to account for this, e.g.:
@@ -102,6 +119,36 @@
return softLink##functionName parameterNames; \
}
+#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \
+ typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
+ static functionName##PtrType functionName##Ptr() \
+ { \
+ static functionName##PtrType ptr; \
+ static bool initialized; \
+ \
+ if (initialized) \
+ return ptr; \
+ initialized = true; \
+ \
+ ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \
+ return ptr; \
+ }\
+
+#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \
+ typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
+ static functionName##PtrType functionName##Ptr() \
+ { \
+ static functionName##PtrType ptr; \
+ static bool initialized; \
+ \
+ if (initialized) \
+ return ptr; \
+ initialized = true; \
+ \
+ ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \
+ return ptr; \
+ }\
+
/*
Variables exported by a DLL need to be accessed through a function.
If you use SOFT_LINK_VARIABLE_DLL_IMPORT(), you will also need to #define the variable name to account for this, e.g.:
@@ -117,4 +164,16 @@
return *ptr; \
}\
+/*
+ Note that this will only work for variable types for which a return value of 0 can signal an error.
+ */
+#define SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(library, variableName, variableType) \
+ static variableType get_##variableName() \
+ { \
+ static variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #variableName)); \
+ if (!ptr) \
+ return 0; \
+ return *ptr; \
+ }\
+
#endif // SoftLinking_h
diff --git a/Source/WebCore/platform/wx/PasteboardWx.cpp b/Source/WebCore/platform/wx/PasteboardWx.cpp
index 752fdaccf..48183fa6f 100644
--- a/Source/WebCore/platform/wx/PasteboardWx.cpp
+++ b/Source/WebCore/platform/wx/PasteboardWx.cpp
@@ -99,7 +99,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
wxHTMLDataObject data;
wxTheClipboard->GetData(data);
chosePlainText = false;
- fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", FragmentScriptingNotAllowed);
+ fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", DisallowScriptingContent);
} else
#endif
{