summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebCore/platform
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/AsyncFileSystem.h3
-rw-r--r--Source/WebCore/platform/AsyncFileSystemCallbacks.h5
-rw-r--r--Source/WebCore/platform/AutodrainedPool.h3
-rw-r--r--Source/WebCore/platform/ContextMenu.h4
-rw-r--r--Source/WebCore/platform/ContextMenuItem.h3
-rw-r--r--Source/WebCore/platform/DeprecatedPtrList.h3
-rw-r--r--Source/WebCore/platform/DeprecatedPtrListImpl.cpp5
-rw-r--r--Source/WebCore/platform/EventLoop.h3
-rw-r--r--Source/WebCore/platform/GeolocationService.h3
-rw-r--r--Source/WebCore/platform/HostWindow.h9
-rw-r--r--Source/WebCore/platform/KillRing.h1
-rw-r--r--Source/WebCore/platform/Length.h4
-rw-r--r--Source/WebCore/platform/Pasteboard.h3
-rw-r--r--Source/WebCore/platform/PlatformKeyboardEvent.h3
-rw-r--r--Source/WebCore/platform/PopupMenuClient.h4
-rw-r--r--Source/WebCore/platform/PurgeableBuffer.h4
-rw-r--r--Source/WebCore/platform/RunLoopTimer.h5
-rw-r--r--Source/WebCore/platform/ScrollAnimator.cpp39
-rw-r--r--Source/WebCore/platform/ScrollAnimator.h23
-rw-r--r--Source/WebCore/platform/ScrollAnimatorWin.cpp41
-rw-r--r--Source/WebCore/platform/ScrollAnimatorWin.h8
-rw-r--r--Source/WebCore/platform/ScrollView.cpp80
-rw-r--r--Source/WebCore/platform/ScrollView.h18
-rw-r--r--Source/WebCore/platform/ScrollableArea.cpp123
-rw-r--r--Source/WebCore/platform/ScrollableArea.h (renamed from Source/WebCore/platform/ScrollbarClient.h)45
-rw-r--r--Source/WebCore/platform/Scrollbar.cpp110
-rw-r--r--Source/WebCore/platform/Scrollbar.h35
-rw-r--r--Source/WebCore/platform/ScrollbarClient.cpp57
-rw-r--r--Source/WebCore/platform/ScrollbarTheme.h5
-rw-r--r--Source/WebCore/platform/ScrollbarThemeComposite.cpp4
-rw-r--r--Source/WebCore/platform/SharedTimer.h5
-rw-r--r--Source/WebCore/platform/ThreadGlobalData.h3
-rw-r--r--Source/WebCore/platform/ThreadTimers.h3
-rw-r--r--Source/WebCore/platform/Timer.h3
-rw-r--r--Source/WebCore/platform/TreeShared.h3
-rw-r--r--Source/WebCore/platform/android/PlatformBridge.h2
-rw-r--r--Source/WebCore/platform/animation/AnimationList.h3
-rw-r--r--Source/WebCore/platform/audio/AudioBus.h3
-rw-r--r--Source/WebCore/platform/audio/AudioChannel.h4
-rw-r--r--Source/WebCore/platform/audio/FFTFrameStub.cpp103
-rw-r--r--Source/WebCore/platform/audio/HRTFDatabase.h3
-rw-r--r--Source/WebCore/platform/audio/HRTFElevation.h3
-rw-r--r--Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp14
-rw-r--r--Source/WebCore/platform/chromium/ChromiumBridge.h356
-rw-r--r--Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp6
-rw-r--r--Source/WebCore/platform/chromium/ClipboardChromium.h1
-rw-r--r--Source/WebCore/platform/chromium/DragDataChromium.cpp6
-rw-r--r--Source/WebCore/platform/chromium/FileSystemChromium.cpp32
-rw-r--r--Source/WebCore/platform/chromium/FramelessScrollView.h2
-rw-r--r--Source/WebCore/platform/chromium/LanguageChromium.cpp4
-rw-r--r--Source/WebCore/platform/chromium/LinkHashChromium.cpp6
-rw-r--r--Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp14
-rw-r--r--Source/WebCore/platform/chromium/PasteboardChromium.cpp26
-rw-r--r--Source/WebCore/platform/chromium/PlatformBridge.h379
-rw-r--r--Source/WebCore/platform/chromium/PlatformScreenChromium.cpp12
-rw-r--r--Source/WebCore/platform/chromium/PopupMenuChromium.cpp1
-rw-r--r--Source/WebCore/platform/chromium/ReadableDataObject.cpp16
-rw-r--r--Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp4
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp6
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp52
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm28
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp14
-rw-r--r--Source/WebCore/platform/chromium/SharedTimerChromium.cpp8
-rw-r--r--Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp96
-rw-r--r--Source/WebCore/platform/chromium/SystemTimeChromium.cpp4
-rw-r--r--Source/WebCore/platform/chromium/WidgetChromium.cpp7
-rw-r--r--Source/WebCore/platform/chromium/WritableDataObject.cpp4
-rw-r--r--Source/WebCore/platform/efl/ScrollbarEfl.cpp10
-rw-r--r--Source/WebCore/platform/efl/ScrollbarEfl.h2
-rw-r--r--Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp61
-rw-r--r--Source/WebCore/platform/graphics/ANGLEWebKitBridge.h15
-rw-r--r--Source/WebCore/platform/graphics/BitmapImage.h4
-rw-r--r--Source/WebCore/platform/graphics/Color.h3
-rw-r--r--Source/WebCore/platform/graphics/Extensions3D.h6
-rw-r--r--Source/WebCore/platform/graphics/FloatPoint.cpp1
-rw-r--r--Source/WebCore/platform/graphics/Font.cpp1
-rw-r--r--Source/WebCore/platform/graphics/Font.h2
-rw-r--r--Source/WebCore/platform/graphics/FontCache.cpp4
-rw-r--r--Source/WebCore/platform/graphics/FontCache.h3
-rw-r--r--Source/WebCore/platform/graphics/FontData.h4
-rw-r--r--Source/WebCore/platform/graphics/FontFastPath.cpp1
-rw-r--r--Source/WebCore/platform/graphics/GlyphMetricsMap.h3
-rw-r--r--Source/WebCore/platform/graphics/GraphicsContext.cpp17
-rw-r--r--Source/WebCore/platform/graphics/GraphicsContext.h12
-rw-r--r--Source/WebCore/platform/graphics/GraphicsContext3D.h1
-rw-r--r--Source/WebCore/platform/graphics/GraphicsLayer.h8
-rw-r--r--Source/WebCore/platform/graphics/ImageBuffer.h9
-rw-r--r--Source/WebCore/platform/graphics/ImageSource.h3
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayer.cpp4
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayer.h3
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayerPrivate.h4
-rw-r--r--Source/WebCore/platform/graphics/Path.h3
-rw-r--r--Source/WebCore/platform/graphics/RoundedIntRect.cpp141
-rw-r--r--Source/WebCore/platform/graphics/RoundedIntRect.h103
-rw-r--r--Source/WebCore/platform/graphics/StringTruncator.cpp1
-rw-r--r--Source/WebCore/platform/graphics/TiledBackingStore.h3
-rw-r--r--Source/WebCore/platform/graphics/WidthIterator.cpp1
-rw-r--r--Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp10
-rw-r--r--Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp (renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp)153
-rw-r--r--Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h (renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h)44
-rw-r--r--Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp132
-rw-r--r--Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h (renamed from Source/WebCore/platform/graphics/win/WKCACFContextFlusher.h)45
-rw-r--r--Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp38
-rw-r--r--Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp28
-rw-r--r--Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp1
-rw-r--r--Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h3
-rw-r--r--Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp5
-rw-r--r--Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp3
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp5
-rw-r--r--Source/WebCore/platform/graphics/cg/PatternCG.cpp3
-rw-r--r--Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp24
-rw-r--r--Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h7
-rw-r--r--Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm4
-rw-r--r--Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp6
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp8
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontLinux.cpp104
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp354
-rw-r--r--Source/WebCore/platform/graphics/chromium/GLES2Canvas.h20
-rw-r--r--Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp11
-rw-r--r--Source/WebCore/platform/graphics/chromium/ImageChromium.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm4
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp14
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerTexture.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp56
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h15
-rw-r--r--Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h3
-rw-r--r--Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp10
-rw-r--r--Source/WebCore/platform/graphics/chromium/TextureManager.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp4
-rw-r--r--Source/WebCore/platform/graphics/chromium/TransparencyWin.h3
-rw-r--r--Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp5
-rw-r--r--Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp2
-rw-r--r--Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp93
-rw-r--r--Source/WebCore/platform/graphics/gpu/DrawingBuffer.h15
-rw-r--r--Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h4
-rw-r--r--Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h7
-rw-r--r--Source/WebCore/platform/graphics/gpu/PODArena.h3
-rw-r--r--Source/WebCore/platform/graphics/gpu/PODIntervalTree.h4
-rw-r--r--Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h6
-rw-r--r--Source/WebCore/platform/graphics/gpu/Shader.h3
-rw-r--r--Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp11
-rw-r--r--Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h1
-rw-r--r--Source/WebCore/platform/graphics/gpu/TilingData.h3
-rw-r--r--Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm5
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp3
-rw-r--r--Source/WebCore/platform/graphics/gtk/FontGtk.cpp1
-rw-r--r--Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp5
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextController.cpp1
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp1
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp1
-rw-r--r--Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp1
-rw-r--r--Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm10
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp20
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h5
-rw-r--r--Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp2
-rw-r--r--Source/WebCore/platform/graphics/openvg/PainterOpenVG.h3
-rw-r--r--Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h3
-rw-r--r--Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp4
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h6
-rw-r--r--Source/WebCore/platform/graphics/qt/FontPlatformData.h7
-rw-r--r--Source/WebCore/platform/graphics/qt/FontQt.cpp1
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp35
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp5
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp7
-rw-r--r--Source/WebCore/platform/graphics/qt/TransparencyLayer.h7
-rw-r--r--Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp4
-rw-r--r--Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h4
-rw-r--r--Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp15
-rw-r--r--Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp5
-rw-r--r--Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp5
-rw-r--r--Source/WebCore/platform/graphics/skia/PlatformContextSkia.h3
-rw-r--r--Source/WebCore/platform/graphics/transforms/AffineTransform.cpp10
-rw-r--r--Source/WebCore/platform/graphics/transforms/AffineTransform.h13
-rw-r--r--Source/WebCore/platform/graphics/transforms/TransformOperations.h3
-rw-r--r--Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp1
-rw-r--r--Source/WebCore/platform/graphics/transforms/TransformationMatrix.h4
-rw-r--r--Source/WebCore/platform/graphics/win/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h4
-rw-r--r--Source/WebCore/platform/graphics/win/FontWin.cpp1
-rw-r--r--Source/WebCore/platform/graphics/win/LocalWindowsContext.h3
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp12
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h7
-rw-r--r--Source/WebCore/platform/graphics/win/QTMovie.cpp3
-rw-r--r--Source/WebCore/platform/graphics/win/QTTrack.cpp3
-rw-r--r--Source/WebCore/platform/graphics/win/UniscribeController.cpp1
-rw-r--r--Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp79
-rw-r--r--Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/wince/FontWinCE.cpp1
-rw-r--r--Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp8
-rw-r--r--Source/WebCore/platform/graphics/wince/ImageBufferData.h19
-rw-r--r--Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp5
-rw-r--r--Source/WebCore/platform/graphics/wince/SharedBitmap.cpp3
-rw-r--r--Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h4
-rw-r--r--Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp6
-rw-r--r--Source/WebCore/platform/gtk/ClipboardGtk.h1
-rw-r--r--Source/WebCore/platform/gtk/DragDataGtk.cpp12
-rw-r--r--Source/WebCore/platform/gtk/KeyEventGtk.cpp3
-rw-r--r--Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp11
-rw-r--r--Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h5
-rw-r--r--Source/WebCore/platform/gtk/RenderThemeGtk.cpp68
-rw-r--r--Source/WebCore/platform/gtk/RenderThemeGtk.h32
-rw-r--r--Source/WebCore/platform/gtk/RenderThemeGtk2.cpp477
-rw-r--r--Source/WebCore/platform/gtk/RenderThemeGtk3.cpp36
-rw-r--r--Source/WebCore/platform/gtk/WidgetRenderingContext.cpp65
-rw-r--r--Source/WebCore/platform/gtk/WidgetRenderingContext.h6
-rw-r--r--Source/WebCore/platform/gtk/gtk2drawing.c820
-rw-r--r--Source/WebCore/platform/gtk/gtkdrawing.h74
-rw-r--r--Source/WebCore/platform/image-decoders/ImageDecoder.h3
-rw-r--r--Source/WebCore/platform/mac/ClipboardMac.h1
-rw-r--r--Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h3
-rw-r--r--Source/WebCore/platform/mac/ScrollAnimatorMac.h6
-rw-r--r--Source/WebCore/platform/mac/ScrollAnimatorMac.mm27
-rw-r--r--Source/WebCore/platform/mac/ScrollbarThemeMac.h1
-rw-r--r--Source/WebCore/platform/mac/ScrollbarThemeMac.mm76
-rw-r--r--Source/WebCore/platform/mac/WebCoreSystemInterface.h4
-rw-r--r--Source/WebCore/platform/mac/WebCoreSystemInterface.mm3
-rw-r--r--Source/WebCore/platform/mock/SpeechInputClientMock.cpp3
-rw-r--r--Source/WebCore/platform/mock/SpeechInputClientMock.h2
-rw-r--r--Source/WebCore/platform/network/BlobData.h1
-rw-r--r--Source/WebCore/platform/network/FormDataBuilder.h4
-rw-r--r--Source/WebCore/platform/network/NetworkStateNotifier.h4
-rw-r--r--Source/WebCore/platform/network/ResourceHandleInternal.h3
-rw-r--r--Source/WebCore/platform/network/ResourceRequestBase.h8
-rw-r--r--Source/WebCore/platform/network/ResourceResponseBase.h8
-rw-r--r--Source/WebCore/platform/network/cf/CookieJarCFNet.cpp63
-rw-r--r--Source/WebCore/platform/network/chromium/CookieJarChromium.cpp14
-rw-r--r--Source/WebCore/platform/network/chromium/DNSChromium.cpp4
-rw-r--r--Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp3
-rw-r--r--Source/WebCore/platform/network/win/ResourceHandleWin.cpp3
-rw-r--r--Source/WebCore/platform/qt/ClipboardQt.h1
-rw-r--r--Source/WebCore/platform/qt/PlatformBridge.h2
-rw-r--r--Source/WebCore/platform/qt/ScrollbarQt.cpp13
-rw-r--r--Source/WebCore/platform/sql/SQLiteDatabase.h3
-rw-r--r--Source/WebCore/platform/sql/SQLiteStatement.h3
-rw-r--r--Source/WebCore/platform/sql/SQLiteTransaction.h5
-rw-r--r--Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp6
-rw-r--r--Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp10
-rw-r--r--Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp8
-rw-r--r--Source/WebCore/platform/text/BidiResolver.h34
-rw-r--r--Source/WebCore/platform/text/RegularExpression.h3
-rw-r--r--Source/WebCore/platform/text/SegmentedString.cpp3
-rw-r--r--Source/WebCore/platform/text/SegmentedString.h2
-rw-r--r--Source/WebCore/platform/text/TextCodec.h4
-rw-r--r--Source/WebCore/platform/text/transcoder/FontTranscoder.h3
-rw-r--r--Source/WebCore/platform/win/ClipboardWin.h1
-rw-r--r--Source/WebCore/platform/win/PopupMenuWin.cpp24
-rw-r--r--Source/WebCore/platform/win/PopupMenuWin.h18
-rw-r--r--Source/WebCore/platform/win/ScrollbarThemeSafari.cpp8
-rw-r--r--Source/WebCore/platform/win/WebCoreTextRenderer.cpp1
-rw-r--r--Source/WebCore/platform/win/WindowMessageBroadcaster.h4
-rw-r--r--Source/WebCore/platform/wx/ScrollbarThemeWx.cpp4
258 files changed, 3381 insertions, 2636 deletions
diff --git a/Source/WebCore/platform/AsyncFileSystem.h b/Source/WebCore/platform/AsyncFileSystem.h
index d96c1ad..c34a644 100644
--- a/Source/WebCore/platform/AsyncFileSystem.h
+++ b/Source/WebCore/platform/AsyncFileSystem.h
@@ -44,7 +44,8 @@ class AsyncFileSystemCallbacks;
class AsyncFileWriterClient;
// This class provides async interface for platform-specific file system implementation. Note that all the methods take platform paths.
-class AsyncFileSystem : public Noncopyable {
+class AsyncFileSystem {
+ WTF_MAKE_NONCOPYABLE(AsyncFileSystem);
public:
virtual ~AsyncFileSystem() { }
diff --git a/Source/WebCore/platform/AsyncFileSystemCallbacks.h b/Source/WebCore/platform/AsyncFileSystemCallbacks.h
index 290a669..cee8d90 100644
--- a/Source/WebCore/platform/AsyncFileSystemCallbacks.h
+++ b/Source/WebCore/platform/AsyncFileSystemCallbacks.h
@@ -41,8 +41,11 @@ class AsyncFileSystem;
class AsyncFileWriter;
struct FileMetadata;
-class AsyncFileSystemCallbacks : public Noncopyable {
+class AsyncFileSystemCallbacks {
+ WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks);
public:
+ AsyncFileSystemCallbacks() { }
+
// Called when a requested operation is completed successfully.
virtual void didSucceed() = 0;
diff --git a/Source/WebCore/platform/AutodrainedPool.h b/Source/WebCore/platform/AutodrainedPool.h
index d44ee1e..f03ec81 100644
--- a/Source/WebCore/platform/AutodrainedPool.h
+++ b/Source/WebCore/platform/AutodrainedPool.h
@@ -39,7 +39,8 @@ class NSAutoreleasePool;
namespace WebCore {
-class AutodrainedPool : public Noncopyable {
+class AutodrainedPool {
+ WTF_MAKE_NONCOPYABLE(AutodrainedPool);
public:
AutodrainedPool(int iterationLimit = 1);
~AutodrainedPool();
diff --git a/Source/WebCore/platform/ContextMenu.h b/Source/WebCore/platform/ContextMenu.h
index 575c86d..2977749 100644
--- a/Source/WebCore/platform/ContextMenu.h
+++ b/Source/WebCore/platform/ContextMenu.h
@@ -41,8 +41,8 @@ namespace WebCore {
class ContextMenuController;
- class ContextMenu : public Noncopyable
- {
+ class ContextMenu {
+ WTF_MAKE_NONCOPYABLE(ContextMenu); WTF_MAKE_FAST_ALLOCATED;
public:
ContextMenu();
diff --git a/Source/WebCore/platform/ContextMenuItem.h b/Source/WebCore/platform/ContextMenuItem.h
index 145d795..6e84131 100644
--- a/Source/WebCore/platform/ContextMenuItem.h
+++ b/Source/WebCore/platform/ContextMenuItem.h
@@ -223,7 +223,8 @@ namespace WebCore {
typedef void* PlatformMenuItemDescription;
#endif
- class ContextMenuItem : public FastAllocBase {
+ class ContextMenuItem {
+ WTF_MAKE_FAST_ALLOCATED;
public:
ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, ContextMenu* subMenu = 0);
ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool enabled, bool checked);
diff --git a/Source/WebCore/platform/DeprecatedPtrList.h b/Source/WebCore/platform/DeprecatedPtrList.h
index 47cd538..c07d173 100644
--- a/Source/WebCore/platform/DeprecatedPtrList.h
+++ b/Source/WebCore/platform/DeprecatedPtrList.h
@@ -33,7 +33,8 @@ namespace WebCore {
template <class T> class DeprecatedPtrListIterator;
-template <class T> class DeprecatedPtrList : public FastAllocBase {
+template <class T> class DeprecatedPtrList {
+ WTF_MAKE_FAST_ALLOCATED;
public:
DeprecatedPtrList() : impl(deleteFunc), del_item(false) { }
~DeprecatedPtrList() { impl.clear(del_item); }
diff --git a/Source/WebCore/platform/DeprecatedPtrListImpl.cpp b/Source/WebCore/platform/DeprecatedPtrListImpl.cpp
index 96fd513..c633741 100644
--- a/Source/WebCore/platform/DeprecatedPtrListImpl.cpp
+++ b/Source/WebCore/platform/DeprecatedPtrListImpl.cpp
@@ -29,12 +29,13 @@
#include <cstddef>
#include <algorithm>
#include <wtf/Assertions.h>
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
-class DeprecatedListNode : public Noncopyable
-{
+class DeprecatedListNode {
+ WTF_MAKE_NONCOPYABLE(DeprecatedListNode); WTF_MAKE_FAST_ALLOCATED;
public:
DeprecatedListNode(void *d) : data(d), next(0), prev(0) { }
diff --git a/Source/WebCore/platform/EventLoop.h b/Source/WebCore/platform/EventLoop.h
index b0507f7..128e92b 100644
--- a/Source/WebCore/platform/EventLoop.h
+++ b/Source/WebCore/platform/EventLoop.h
@@ -30,7 +30,8 @@
namespace WebCore {
- class EventLoop : public Noncopyable {
+ class EventLoop {
+ WTF_MAKE_NONCOPYABLE(EventLoop);
public:
EventLoop()
: m_ended(false)
diff --git a/Source/WebCore/platform/GeolocationService.h b/Source/WebCore/platform/GeolocationService.h
index 2cb70f2..cf51b1e 100644
--- a/Source/WebCore/platform/GeolocationService.h
+++ b/Source/WebCore/platform/GeolocationService.h
@@ -42,7 +42,8 @@ public:
virtual void geolocationServiceErrorOccurred(GeolocationService*) = 0;
};
-class GeolocationService : public Noncopyable {
+class GeolocationService {
+ WTF_MAKE_NONCOPYABLE(GeolocationService);
public:
static GeolocationService* create(GeolocationServiceClient*);
virtual ~GeolocationService() { }
diff --git a/Source/WebCore/platform/HostWindow.h b/Source/WebCore/platform/HostWindow.h
index 7882d48..0d19356 100644
--- a/Source/WebCore/platform/HostWindow.h
+++ b/Source/WebCore/platform/HostWindow.h
@@ -26,15 +26,16 @@
#ifndef HostWindow_h
#define HostWindow_h
-#include <wtf/Noncopyable.h>
#include "Widget.h"
namespace WebCore {
class Cursor;
-class HostWindow : public Noncopyable {
+class HostWindow {
+ WTF_MAKE_NONCOPYABLE(HostWindow); WTF_MAKE_FAST_ALLOCATED;
public:
+ HostWindow() { }
virtual ~HostWindow() { }
// Requests the host invalidate the window, not the contents. If immediate is true do so synchronously, otherwise async.
@@ -66,6 +67,10 @@ public:
// Request that the cursor change.
virtual void setCursor(const Cursor&) = 0;
+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ virtual void scheduleAnimation() = 0;
+#endif
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/KillRing.h b/Source/WebCore/platform/KillRing.h
index 8e27350..b687274 100644
--- a/Source/WebCore/platform/KillRing.h
+++ b/Source/WebCore/platform/KillRing.h
@@ -31,6 +31,7 @@
namespace WebCore {
class KillRing {
+ WTF_MAKE_FAST_ALLOCATED;
public:
void append(const String&);
void prepend(const String&);
diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h
index 7dd875e..9da71c7 100644
--- a/Source/WebCore/platform/Length.h
+++ b/Source/WebCore/platform/Length.h
@@ -35,7 +35,9 @@ const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
-struct Length : FastAllocBase {
+struct Length {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
Length()
: m_value(0)
{
diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h
index 78a40b3..50a9cb6 100644
--- a/Source/WebCore/platform/Pasteboard.h
+++ b/Source/WebCore/platform/Pasteboard.h
@@ -81,7 +81,8 @@ class Node;
class Range;
class ArchiveResource;
-class Pasteboard : public Noncopyable {
+class Pasteboard {
+ WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED;
public:
#if PLATFORM(MAC)
//Helper functions to allow Clipboard to share code
diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h
index 7ce7017..eb144f7 100644
--- a/Source/WebCore/platform/PlatformKeyboardEvent.h
+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h
@@ -75,7 +75,8 @@ typedef unsigned long int uint32;
namespace WebCore {
- class PlatformKeyboardEvent : public FastAllocBase {
+ class PlatformKeyboardEvent {
+ WTF_MAKE_FAST_ALLOCATED;
public:
enum Type {
// KeyDown is sent by platforms such as Mac OS X, gtk and Qt, and has information about both physical pressed key, and its translation.
diff --git a/Source/WebCore/platform/PopupMenuClient.h b/Source/WebCore/platform/PopupMenuClient.h
index 45912a1..f33b9e2 100644
--- a/Source/WebCore/platform/PopupMenuClient.h
+++ b/Source/WebCore/platform/PopupMenuClient.h
@@ -32,7 +32,7 @@ class Color;
class FontSelector;
class HostWindow;
class Scrollbar;
-class ScrollbarClient;
+class ScrollableArea;
class PopupMenuClient {
public:
@@ -66,7 +66,7 @@ public:
virtual FontSelector* fontSelector() const = 0;
virtual HostWindow* hostWindow() const = 0;
- virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize) = 0;
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) = 0;
};
#if ENABLE(NO_LISTBOX_RENDERING)
diff --git a/Source/WebCore/platform/PurgeableBuffer.h b/Source/WebCore/platform/PurgeableBuffer.h
index 9bda2d5..44136c2 100644
--- a/Source/WebCore/platform/PurgeableBuffer.h
+++ b/Source/WebCore/platform/PurgeableBuffer.h
@@ -27,13 +27,13 @@
#define PurgeableBuffer_h
#include "PurgePriority.h"
-#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
- class PurgeableBuffer : public Noncopyable {
+ class PurgeableBuffer {
+ WTF_MAKE_NONCOPYABLE(PurgeableBuffer);
public:
static PassOwnPtr<PurgeableBuffer> create(const char* data, size_t);
diff --git a/Source/WebCore/platform/RunLoopTimer.h b/Source/WebCore/platform/RunLoopTimer.h
index 65f253e..f8c529f 100644
--- a/Source/WebCore/platform/RunLoopTimer.h
+++ b/Source/WebCore/platform/RunLoopTimer.h
@@ -30,15 +30,16 @@
#define RunLoopTimer_h
#include "SchedulePair.h"
-#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
namespace WebCore {
// Time intervals are all in seconds.
-class RunLoopTimerBase : public Noncopyable {
+class RunLoopTimerBase {
+ WTF_MAKE_NONCOPYABLE(RunLoopTimerBase);
public:
+ RunLoopTimerBase() { }
virtual ~RunLoopTimerBase();
void schedule(const SchedulePair*);
diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp
index 583e833..428a79d 100644
--- a/Source/WebCore/platform/ScrollAnimator.cpp
+++ b/Source/WebCore/platform/ScrollAnimator.cpp
@@ -31,20 +31,22 @@
#include "config.h"
#include "ScrollAnimator.h"
-#include "ScrollbarClient.h"
+#include "FloatPoint.h"
+#include "ScrollableArea.h"
#include <algorithm>
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
#if !ENABLE(SMOOTH_SCROLLING)
-ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
{
- return new ScrollAnimator(client);
+ return adoptPtr(new ScrollAnimator(scrollableArea));
}
#endif
-ScrollAnimator::ScrollAnimator(ScrollbarClient* client)
- : m_client(client)
+ScrollAnimator::ScrollAnimator(ScrollableArea* scrollableArea)
+ : m_scrollableArea(scrollableArea)
, m_currentPosX(0)
, m_currentPosY(0)
{
@@ -57,20 +59,33 @@ ScrollAnimator::~ScrollAnimator()
bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier)
{
float* currentPos = (orientation == HorizontalScrollbar) ? &m_currentPosX : &m_currentPosY;
- float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0.0f);
+ float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f);
if (*currentPos == newPos)
return false;
*currentPos = newPos;
- m_client->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY));
+
+ notityPositionChanged();
+
return true;
}
-void ScrollAnimator::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos)
+void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
+{
+ if (m_currentPosX != offset.x() || m_currentPosY != offset.y()) {
+ m_currentPosX = offset.x();
+ m_currentPosY = offset.y();
+ notityPositionChanged();
+ }
+}
+
+FloatPoint ScrollAnimator::currentPosition() const
+{
+ return FloatPoint(m_currentPosX, m_currentPosY);
+}
+
+void ScrollAnimator::notityPositionChanged()
{
- if (orientation == HorizontalScrollbar)
- m_currentPosX = pos;
- else
- m_currentPosY = pos;
+ m_scrollableArea->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY));
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollAnimator.h b/Source/WebCore/platform/ScrollAnimator.h
index e674339..155c6e5 100644
--- a/Source/WebCore/platform/ScrollAnimator.h
+++ b/Source/WebCore/platform/ScrollAnimator.h
@@ -32,16 +32,17 @@
#define ScrollAnimator_h
#include "ScrollTypes.h"
+#include <wtf/Forward.h>
namespace WebCore {
-class ScrollbarClient;
+class FloatPoint;
+class ScrollableArea;
class ScrollAnimator {
public:
- static ScrollAnimator* create(ScrollbarClient*);
+ static PassOwnPtr<ScrollAnimator> create(ScrollableArea*);
- ScrollAnimator(ScrollbarClient* client);
virtual ~ScrollAnimator();
// Computes a scroll destination for the given parameters. Returns false if
@@ -50,16 +51,20 @@ public:
// The base class implementation always scrolls immediately, never animates.
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
- // Stops any animation in the given direction and updates the ScrollAnimator
- // with the current scroll position. This does not cause a callback to the
- // ScrollbarClient.
- virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float);
+ virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
+
+ FloatPoint currentPosition() const;
protected:
- ScrollbarClient* m_client;
+ ScrollAnimator(ScrollableArea*);
+
+ void notityPositionChanged();
+
+ ScrollableArea* m_scrollableArea;
float m_currentPosX; // We avoid using a FloatPoint in order to reduce
float m_currentPosY; // subclass code complexity.
};
} // namespace WebCore
-#endif
+
+#endif // ScrollAnimator_h
diff --git a/Source/WebCore/platform/ScrollAnimatorWin.cpp b/Source/WebCore/platform/ScrollAnimatorWin.cpp
index 025aa71..47a00cb 100644
--- a/Source/WebCore/platform/ScrollAnimatorWin.cpp
+++ b/Source/WebCore/platform/ScrollAnimatorWin.cpp
@@ -34,17 +34,18 @@
#include "ScrollAnimatorWin.h"
-#include "ScrollbarClient.h"
+#include "FloatPoint.h"
+#include "ScrollableArea.h"
#include "ScrollbarTheme.h"
#include <algorithm>
#include <wtf/CurrentTime.h>
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
-// static
-ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
{
- return new ScrollAnimatorWin(client);
+ return adoptPtr(new ScrollAnimatorWin(scrollableArea));
}
const double ScrollAnimatorWin::animationTimerDelay = 0.01;
@@ -60,8 +61,8 @@ ScrollAnimatorWin::PerAxisData::PerAxisData(ScrollAnimatorWin* parent, float* cu
}
-ScrollAnimatorWin::ScrollAnimatorWin(ScrollbarClient* client)
- : ScrollAnimator(client)
+ScrollAnimatorWin::ScrollAnimatorWin(ScrollableArea* scrollableArea)
+ : ScrollAnimator(scrollableArea)
, m_horizontalData(this, &m_currentPosX)
, m_verticalData(this, &m_currentPosY)
{
@@ -81,7 +82,7 @@ bool ScrollAnimatorWin::scroll(ScrollbarOrientation orientation, ScrollGranulari
// This is an animatable scroll. Calculate the scroll delta.
PerAxisData* data = (orientation == VerticalScrollbar) ? &m_verticalData : &m_horizontalData;
- float newPos = std::max(std::min(data->m_desiredPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0.0f);
+ float newPos = std::max(std::min(data->m_desiredPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f);
if (newPos == data->m_desiredPos)
return false;
data->m_desiredPos = newPos;
@@ -177,17 +178,24 @@ bool ScrollAnimatorWin::scroll(ScrollbarOrientation orientation, ScrollGranulari
return true;
}
-void ScrollAnimatorWin::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos)
+void ScrollAnimatorWin::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
{
- PerAxisData* data = (orientation == HorizontalScrollbar) ? &m_horizontalData : &m_verticalData;
- stopAnimationTimerIfNeeded(data);
- *data->m_currentPos = pos;
- data->m_desiredPos = pos;
- data->m_currentVelocity = 0;
- data->m_desiredVelocity = 0;
+ stopAnimationTimerIfNeeded(&m_horizontalData);
+ stopAnimationTimerIfNeeded(&m_verticalData);
+
+ *m_horizontalData.m_currentPos = offset.x();
+ m_horizontalData.m_desiredPos = offset.x();
+ m_horizontalData.m_currentVelocity = 0;
+ m_horizontalData.m_desiredVelocity = 0;
+
+ *m_verticalData.m_currentPos = offset.y();
+ m_verticalData.m_desiredPos = offset.y();
+ m_verticalData.m_currentVelocity = 0;
+ m_verticalData.m_desiredVelocity = 0;
+
+ notityPositionChanged();
}
-// static
double ScrollAnimatorWin::accelerationTime()
{
// We elect to use ScrollbarTheme::nativeTheme()->autoscrollTimerDelay() as
@@ -293,7 +301,8 @@ void ScrollAnimatorWin::animateScroll(PerAxisData* data)
data->m_animationTimer.startOneShot(animationTimerDelay);
data->m_lastAnimationTime = WTF::currentTime();
}
- m_client->setScrollOffsetFromAnimation(IntPoint(*m_horizontalData.m_currentPos, *m_verticalData.m_currentPos));
+
+ notityPositionChanged();
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollAnimatorWin.h b/Source/WebCore/platform/ScrollAnimatorWin.h
index 7043634..6f87e58 100644
--- a/Source/WebCore/platform/ScrollAnimatorWin.h
+++ b/Source/WebCore/platform/ScrollAnimatorWin.h
@@ -40,11 +40,11 @@ namespace WebCore {
class ScrollAnimatorWin : public ScrollAnimator {
public:
- ScrollAnimatorWin(ScrollbarClient*);
+ ScrollAnimatorWin(ScrollableArea*);
virtual ~ScrollAnimatorWin();
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
- virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float);
+ virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
private:
struct PerAxisData {
@@ -69,8 +69,8 @@ private:
PerAxisData m_verticalData;
};
-}
+} // namespace WebCore
#endif // ENABLE(SMOOTH_SCROLLING)
-#endif
+#endif // ScrollAnimatorWin_h
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 6ea60df..b07c743 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -229,9 +229,15 @@ IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
if (paintsEntireContents())
return IntRect(IntPoint(0, 0), contentsSize());
+ bool hasOverlayScrollbars = ScrollbarTheme::nativeTheme()->usesOverlayScrollbars();
+ int verticalScrollbarWidth = verticalScrollbar() && !hasOverlayScrollbars && !includeScrollbars
+ ? verticalScrollbar()->width() : 0;
+ int horizontalScrollbarHeight = horizontalScrollbar() && !hasOverlayScrollbars && !includeScrollbars
+ ? horizontalScrollbar()->height() : 0;
+
return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
- IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)),
- max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0))));
+ IntSize(max(0, width() - verticalScrollbarWidth),
+ max(0, height() - horizontalScrollbarHeight)));
}
#endif
@@ -344,25 +350,20 @@ int ScrollView::scrollSize(ScrollbarOrientation orientation) const
return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0;
}
-void ScrollView::setScrollOffsetFromAnimation(const IntPoint& offset)
+void ScrollView::setScrollOffset(const IntPoint& offset)
{
- if (m_horizontalScrollbar)
- m_horizontalScrollbar->setValue(offset.x(), Scrollbar::FromScrollAnimator);
- if (m_verticalScrollbar)
- m_verticalScrollbar->setValue(offset.y(), Scrollbar::FromScrollAnimator);
-}
+ int horizontalOffset = std::max(std::min(offset.x(), contentsWidth() - visibleWidth()), 0);
+ int verticalOffset = std::max(std::min(offset.y(), contentsHeight() - visibleHeight()), 0);
-void ScrollView::valueChanged(Scrollbar* scrollbar)
-{
- // Figure out if we really moved.
IntSize newOffset = m_scrollOffset;
- if (scrollbar) {
- if (scrollbar->orientation() == HorizontalScrollbar)
- newOffset.setWidth(scrollbar->value() - m_scrollOrigin.x());
- else if (scrollbar->orientation() == VerticalScrollbar)
- newOffset.setHeight(scrollbar->value() - m_scrollOrigin.y());
- }
+ newOffset.setWidth(horizontalOffset - m_scrollOrigin.x());
+ newOffset.setHeight(verticalOffset - m_scrollOrigin.y());
+
+ scrollTo(newOffset);
+}
+void ScrollView::scrollTo(const IntSize& newOffset)
+{
IntSize scrollDelta = newOffset - m_scrollOffset;
if (scrollDelta == IntSize())
return;
@@ -375,13 +376,13 @@ void ScrollView::valueChanged(Scrollbar* scrollbar)
scrollContents(scrollDelta);
}
-void ScrollView::valueChanged(const IntSize& scrollDelta)
+int ScrollView::scrollPosition(Scrollbar* scrollbar) const
{
- if (scrollbarsSuppressed())
- return;
-
- repaintFixedElementsAfterScrolling();
- scrollContents(scrollDelta);
+ if (scrollbar->orientation() == HorizontalScrollbar)
+ return scrollPosition().x() + m_scrollOrigin.x();
+ if (scrollbar->orientation() == VerticalScrollbar)
+ return scrollPosition().y() + m_scrollOrigin.y();
+ return 0;
}
void ScrollView::setScrollPosition(const IntPoint& scrollPoint)
@@ -415,15 +416,8 @@ bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity
{
if (platformWidget())
return platformScroll(direction, granularity);
-
- if (direction == ScrollUp || direction == ScrollDown) {
- if (m_verticalScrollbar)
- return m_verticalScrollbar->scroll(direction, granularity);
- } else {
- if (m_horizontalScrollbar)
- return m_horizontalScrollbar->scroll(direction, granularity);
- }
- return false;
+
+ return ScrollableArea::scroll(direction, granularity);
}
bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity)
@@ -554,7 +548,6 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_horizontalScrollbar->setSuppressInvalidation(true);
m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_horizontalScrollbar->setProportion(clientWidth, contentsWidth());
- m_horizontalScrollbar->setValue(scroll.width() + m_scrollOrigin.x(), Scrollbar::NotFromScrollAnimator);
if (m_scrollbarsSuppressed)
m_horizontalScrollbar->setSuppressInvalidation(false);
}
@@ -576,7 +569,6 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_verticalScrollbar->setSuppressInvalidation(true);
m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
- m_verticalScrollbar->setValue(scroll.height() + m_scrollOrigin.y(), Scrollbar::NotFromScrollAnimator);
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(false);
}
@@ -586,15 +578,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
updateScrollCorner();
}
- // See if our offset has changed in a situation where we might not have scrollbars.
- // This can happen when editing a body with overflow:hidden and scrolling to reveal selection.
- // It can also happen when maximizing a window that has scrollbars (but the new maximized result
- // does not).
- IntSize scrollDelta = scroll - m_scrollOffset;
- if (scrollDelta != IntSize()) {
- m_scrollOffset = scroll;
- valueChanged(scrollDelta);
- }
+ ScrollableArea::scrollToOffsetWithoutAnimation(FloatPoint(scroll.width() + m_scrollOrigin.x(), scroll.height() + m_scrollOrigin.y()));
m_inUpdateScrollbars = false;
}
@@ -781,6 +765,7 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e)
// scroll any further.
float deltaX = m_horizontalScrollbar ? e.deltaX() : 0;
float deltaY = m_verticalScrollbar ? e.deltaY() : 0;
+
IntSize maxForwardScrollDelta = maximumScrollPosition() - scrollPosition();
IntSize maxBackwardScrollDelta = scrollPosition() - minimumScrollPosition();
if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
@@ -797,9 +782,9 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e)
}
if (deltaY)
- m_verticalScrollbar->scroll(ScrollUp, ScrollByPixel, deltaY);
+ ScrollableArea::scroll(ScrollUp, ScrollByPixel, deltaY);
if (deltaX)
- m_horizontalScrollbar->scroll(ScrollLeft, ScrollByPixel, deltaX);
+ ScrollableArea::scroll(ScrollLeft, ScrollByPixel, deltaX);
}
}
@@ -857,7 +842,10 @@ void ScrollView::repaintContentRectangle(const IntRect& rect, bool now)
IntRect ScrollView::scrollCornerRect() const
{
IntRect cornerRect;
-
+
+ if (ScrollbarTheme::nativeTheme()->usesOverlayScrollbars())
+ return cornerRect;
+
if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {
cornerRect.unite(IntRect(m_horizontalScrollbar->width(),
height() - m_horizontalScrollbar->height(),
diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h
index 97b2c47..cb895f6 100644
--- a/Source/WebCore/platform/ScrollView.h
+++ b/Source/WebCore/platform/ScrollView.h
@@ -29,7 +29,7 @@
#include "IntRect.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
+#include "ScrollableArea.h"
#include "ScrollTypes.h"
#include "Widget.h"
@@ -54,16 +54,18 @@ class HostWindow;
class PlatformWheelEvent;
class Scrollbar;
-class ScrollView : public Widget, public ScrollbarClient {
+class ScrollView : public Widget, public ScrollableArea {
public:
~ScrollView();
- // ScrollbarClient functions. FrameView overrides the others.
+ // ScrollableArea functions. FrameView overrides the others.
virtual int scrollSize(ScrollbarOrientation orientation) const;
- virtual void setScrollOffsetFromAnimation(const IntPoint&);
- virtual void valueChanged(Scrollbar*);
- virtual void valueChanged(const IntSize&);
+ virtual int scrollPosition(Scrollbar*) const;
+ virtual void setScrollOffset(const IntPoint&);
+ // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
+ virtual void scrollTo(const IntSize& newOffset);
+
// The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the
// host window in the window's coordinate space.
virtual HostWindow* hostWindow() const = 0;
@@ -78,8 +80,8 @@ public:
// If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions
// can be used to obtain those scrollbars.
- Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); }
- Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); }
+ virtual Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); }
+ virtual Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); }
bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; }
// Functions for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of
diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp
new file mode 100644
index 0000000..176cb7e
--- /dev/null
+++ b/Source/WebCore/platform/ScrollableArea.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2008, 2011 Apple 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+#include "ScrollableArea.h"
+
+#include "FloatPoint.h"
+#include "PlatformWheelEvent.h"
+#include "ScrollAnimator.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+ScrollableArea::ScrollableArea()
+ : m_scrollAnimator(ScrollAnimator::create(this))
+{
+}
+
+ScrollableArea::~ScrollableArea()
+{
+}
+
+bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
+{
+ ScrollbarOrientation orientation;
+ Scrollbar* scrollbar;
+ if (direction == ScrollUp || direction == ScrollDown) {
+ orientation = VerticalScrollbar;
+ scrollbar = verticalScrollbar();
+ } else {
+ orientation = HorizontalScrollbar;
+ scrollbar = horizontalScrollbar();
+ }
+
+ if (!scrollbar)
+ return false;
+
+ float step = 0;
+ switch (granularity) {
+ case ScrollByLine:
+ step = scrollbar->lineStep();
+ break;
+ case ScrollByPage:
+ step = scrollbar->pageStep();
+ break;
+ case ScrollByDocument:
+ step = scrollbar->totalSize();
+ break;
+ case ScrollByPixel:
+ step = scrollbar->pixelStep();
+ break;
+ }
+
+ if (direction == ScrollUp || direction == ScrollLeft)
+ multiplier = -multiplier;
+
+ return m_scrollAnimator->scroll(orientation, granularity, step, multiplier);
+}
+
+void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
+{
+ m_scrollAnimator->scrollToOffsetWithoutAnimation(offset);
+}
+
+void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orientation, float offset)
+{
+ if (orientation == HorizontalScrollbar)
+ scrollToXOffsetWithoutAnimation(offset);
+ else
+ scrollToYOffsetWithoutAnimation(offset);
+}
+
+void ScrollableArea::scrollToXOffsetWithoutAnimation(float x)
+{
+ scrollToOffsetWithoutAnimation(FloatPoint(x, m_scrollAnimator->currentPosition().y()));
+}
+
+void ScrollableArea::scrollToYOffsetWithoutAnimation(float y)
+{
+ scrollToOffsetWithoutAnimation(FloatPoint(m_scrollAnimator->currentPosition().x(), y));
+}
+
+void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset)
+{
+ // Tell the derived class to scroll its contents.
+ setScrollOffset(offset);
+
+ // Tell the scrollbars to update their thumb postions.
+ if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar())
+ horizontalScrollbar->offsetDidChange();
+ if (Scrollbar* verticalScrollbar = this->verticalScrollbar())
+ verticalScrollbar->offsetDidChange();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollbarClient.h b/Source/WebCore/platform/ScrollableArea.h
index ab3b10e..148ecdb 100644
--- a/Source/WebCore/platform/ScrollbarClient.h
+++ b/Source/WebCore/platform/ScrollableArea.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,35 +23,42 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScrollbarClient_h
-#define ScrollbarClient_h
+#ifndef ScrollableArea_h
+#define ScrollableArea_h
-#include "IntPoint.h"
#include "IntRect.h"
#include "Scrollbar.h"
#include <wtf/Vector.h>
namespace WebCore {
+class FloatPoint;
+class PlatformWheelEvent;
class ScrollAnimator;
-class ScrollbarClient {
+class ScrollableArea {
public:
- ScrollbarClient();
- virtual ~ScrollbarClient();
+ ScrollableArea();
+ virtual ~ScrollableArea();
- bool scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier);
- void setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos);
+ bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
+ void scrollToOffsetWithoutAnimation(const FloatPoint&);
+ void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset);
+ void scrollToXOffsetWithoutAnimation(float x);
+ void scrollToYOffsetWithoutAnimation(float x);
- virtual int scrollSize(ScrollbarOrientation orientation) const = 0;
- virtual void setScrollOffsetFromAnimation(const IntPoint&) = 0;
- virtual void valueChanged(Scrollbar*) = 0;
+ virtual int scrollSize(ScrollbarOrientation) const = 0;
+ virtual int scrollPosition(Scrollbar*) const = 0;
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
virtual bool isActive() const = 0;
virtual bool scrollbarCornerPresent() const = 0;
-
virtual void getTickmarks(Vector<IntRect>&) const { }
+ // This function should be overriden by subclasses to perform the actual
+ // scroll of the content.
+ virtual void setScrollOffset(const IntPoint&) = 0;
+
+
// Convert points and rects between the scrollbar and its containing view.
// The client needs to implement these in order to be aware of layout effects
// like CSS transforms.
@@ -72,9 +79,17 @@ public:
return scrollbar->Widget::convertFromContainingView(parentPoint);
}
+ virtual Scrollbar* horizontalScrollbar() const { return 0; }
+ virtual Scrollbar* verticalScrollbar() const { return 0; }
+
private:
+ // NOTE: Only called from the ScrollAnimator.
+ friend class ScrollAnimator;
+ void setScrollOffsetFromAnimation(const IntPoint&);
+
OwnPtr<ScrollAnimator> m_scrollAnimator;
};
-}
-#endif
+} // namespace WebCore
+
+#endif // ScrollableArea_h
diff --git a/Source/WebCore/platform/Scrollbar.cpp b/Source/WebCore/platform/Scrollbar.cpp
index 7fd2651..4c625f4 100644
--- a/Source/WebCore/platform/Scrollbar.cpp
+++ b/Source/WebCore/platform/Scrollbar.cpp
@@ -26,14 +26,14 @@
#include "config.h"
#include "Scrollbar.h"
-#include "AccessibilityScrollbar.h"
#include "AXObjectCache.h"
+#include "AccessibilityScrollbar.h"
#include "EventHandler.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "PlatformMouseEvent.h"
-#include "ScrollbarClient.h"
+#include "ScrollableArea.h"
#include "ScrollbarTheme.h"
#include <algorithm>
@@ -49,9 +49,9 @@ using namespace std;
namespace WebCore {
#if !PLATFORM(EFL)
-PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
{
- return adoptRef(new Scrollbar(client, orientation, size));
+ return adoptRef(new Scrollbar(scrollableArea, orientation, size));
}
#endif
@@ -61,9 +61,9 @@ int Scrollbar::maxOverlapBetweenPages()
return maxOverlapBetweenPages;
}
-Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
+Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
ScrollbarTheme* theme)
- : m_client(client)
+ : m_scrollableArea(scrollableArea)
, m_orientation(orientation)
, m_controlSize(controlSize)
, m_theme(theme)
@@ -104,13 +104,19 @@ Scrollbar::~Scrollbar()
m_theme->unregisterScrollbar(this);
}
-bool Scrollbar::setValue(int v, ScrollSource source)
+void Scrollbar::offsetDidChange()
{
- v = max(min(v, m_totalSize - m_visibleSize), 0);
- if (value() == v)
- return false; // Our value stayed the same.
- setCurrentPos(v, source);
- return true;
+ ASSERT(m_scrollableArea);
+
+ float position = static_cast<float>(m_scrollableArea->scrollPosition(this));
+ if (position == m_currentPos)
+ return;
+
+ int oldThumbPosition = theme()->thumbPosition(this);
+ m_currentPos = position;
+ updateThumbPosition();
+ if (m_pressedPart == ThumbPart)
+ setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosition);
}
void Scrollbar::setProportion(int visibleSize, int totalSize)
@@ -131,31 +137,6 @@ void Scrollbar::setSteps(int lineStep, int pageStep, int pixelsPerStep)
m_pixelStep = 1.0f / pixelsPerStep;
}
-bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
-{
-#if HAVE(ACCESSIBILITY)
- if (AXObjectCache::accessibilityEnabled() && axObjectCache())
- axObjectCache()->postNotification(axObjectCache()->getOrCreate(this), 0, AXObjectCache::AXValueChanged, true);
-#endif
-
- // Ignore perpendicular scrolls.
- if ((m_orientation == HorizontalScrollbar) ? (direction == ScrollUp || direction == ScrollDown) : (direction == ScrollLeft || direction == ScrollRight))
- return false;
- float step = 0;
- switch (granularity) {
- case ScrollByLine: step = m_lineStep; break;
- case ScrollByPage: step = m_pageStep; break;
- case ScrollByDocument: step = m_totalSize; break;
- case ScrollByPixel: step = m_pixelStep; break;
- }
- if (direction == ScrollUp || direction == ScrollLeft)
- multiplier = -multiplier;
- if (client())
- return client()->scroll(m_orientation, granularity, step, multiplier);
-
- return setCurrentPos(max(min(m_currentPos + (step * multiplier), static_cast<float>(m_totalSize - m_visibleSize)), 0.0f), NotFromScrollAnimator);
-}
-
void Scrollbar::updateThumb()
{
#ifdef THUMB_POSITION_AFFECTS_BUTTONS
@@ -215,7 +196,7 @@ void Scrollbar::autoscrollPressedPart(double delay)
}
// Handle the arrows and track.
- if (scroll(pressedPartScrollDirection(), pressedPartScrollGranularity()))
+ if (scrollableArea()->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity()))
startTimerIfNeeded(delay);
}
@@ -284,28 +265,11 @@ void Scrollbar::moveThumb(int pos)
delta = min(maxPos - thumbPos, delta);
else if (delta < 0)
delta = max(-thumbPos, delta);
- if (delta)
- setCurrentPos(static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen), NotFromScrollAnimator);
-}
-
-bool Scrollbar::setCurrentPos(float pos, ScrollSource source)
-{
- if ((source != FromScrollAnimator) && client())
- client()->setScrollPositionAndStopAnimation(m_orientation, pos);
-
- if (pos == m_currentPos)
- return false;
-
- int oldValue = value();
- int oldThumbPos = theme()->thumbPosition(this);
- m_currentPos = pos;
- updateThumbPosition();
- if (m_pressedPart == ThumbPart)
- setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPos);
-
- if (value() != oldValue && client())
- client()->valueChanged(this);
- return true;
+
+ if (delta) {
+ float newPosition = static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen);
+ scrollableArea()->scrollToOffsetWithoutAnimation(m_orientation, newPosition);
+ }
}
void Scrollbar::setHoveredPart(ScrollbarPart part)
@@ -337,7 +301,7 @@ bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
if (m_pressedPart == ThumbPart) {
if (theme()->shouldSnapBackToDragOrigin(this, evt))
- setCurrentPos(m_dragOrigin, NotFromScrollAnimator);
+ scrollableArea()->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
else {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingWindow(evt.pos()).x() :
@@ -469,7 +433,7 @@ void Scrollbar::setEnabled(bool e)
bool Scrollbar::isWindowActive() const
{
- return m_client && m_client->isActive();
+ return m_scrollableArea && m_scrollableArea->isActive();
}
AXObjectCache* Scrollbar::axObjectCache() const
@@ -485,40 +449,40 @@ void Scrollbar::invalidateRect(const IntRect& rect)
{
if (suppressInvalidation())
return;
- if (m_client)
- m_client->invalidateScrollbarRect(this, rect);
+ if (m_scrollableArea)
+ m_scrollableArea->invalidateScrollbarRect(this, rect);
}
IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const
{
- if (m_client)
- return m_client->convertFromScrollbarToContainingView(this, localRect);
+ if (m_scrollableArea)
+ return m_scrollableArea->convertFromScrollbarToContainingView(this, localRect);
return Widget::convertToContainingView(localRect);
}
IntRect Scrollbar::convertFromContainingView(const IntRect& parentRect) const
{
- if (m_client)
- return m_client->convertFromContainingViewToScrollbar(this, parentRect);
+ if (m_scrollableArea)
+ return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentRect);
return Widget::convertFromContainingView(parentRect);
}
IntPoint Scrollbar::convertToContainingView(const IntPoint& localPoint) const
{
- if (m_client)
- return m_client->convertFromScrollbarToContainingView(this, localPoint);
+ if (m_scrollableArea)
+ return m_scrollableArea->convertFromScrollbarToContainingView(this, localPoint);
return Widget::convertToContainingView(localPoint);
}
IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const
{
- if (m_client)
- return m_client->convertFromContainingViewToScrollbar(this, parentPoint);
+ if (m_scrollableArea)
+ return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentPoint);
return Widget::convertFromContainingView(parentPoint);
}
-}
+} // namespace WebCore
diff --git a/Source/WebCore/platform/Scrollbar.h b/Source/WebCore/platform/Scrollbar.h
index 69e94a1..5db191a 100644
--- a/Source/WebCore/platform/Scrollbar.h
+++ b/Source/WebCore/platform/Scrollbar.h
@@ -36,32 +36,30 @@ namespace WebCore {
class GraphicsContext;
class IntRect;
-class ScrollbarClient;
-class ScrollbarTheme;
class PlatformMouseEvent;
+class ScrollableArea;
+class ScrollbarTheme;
class Scrollbar : public Widget {
public:
- enum ScrollSource {
- FromScrollAnimator,
- NotFromScrollAnimator,
- };
+ // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK.
+ static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollableArea*, ScrollbarOrientation orientation, ScrollbarControlSize size);
virtual ~Scrollbar();
- // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK.
- static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size);
+ // Called by the ScrollableArea when the scroll offset changes.
+ void offsetDidChange();
static int pixelsPerLineStep() { return 40; }
static float minFractionToStepWhenPaging() { return 0.875f; }
static int maxOverlapBetweenPages();
- void setClient(ScrollbarClient* client) { m_client = client; }
- ScrollbarClient* client() const { return m_client; }
+ void disconnectFromScrollableArea() { m_scrollableArea = 0; }
+ ScrollableArea* scrollableArea() const { return m_scrollableArea; }
virtual bool isCustomScrollbar() const { return false; }
ScrollbarOrientation orientation() const { return m_orientation; }
-
+
int value() const { return lroundf(m_currentPos); }
float currentPos() const { return m_currentPos; }
int pressedPos() const { return m_pressedPos; }
@@ -73,18 +71,15 @@ public:
int lineStep() const { return m_lineStep; }
int pageStep() const { return m_pageStep; }
float pixelStep() const { return m_pixelStep; }
-
+
ScrollbarPart pressedPart() const { return m_pressedPart; }
ScrollbarPart hoveredPart() const { return m_hoveredPart; }
virtual void setHoveredPart(ScrollbarPart);
virtual void setPressedPart(ScrollbarPart);
void setSteps(int lineStep, int pageStep, int pixelsPerStep = 1);
- bool setValue(int, ScrollSource source);
void setProportion(int visibleSize, int totalSize);
void setPressedPos(int p) { m_pressedPos = p; }
-
- bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
virtual void paint(GraphicsContext*, const IntRect& damageRect);
@@ -130,7 +125,7 @@ public:
virtual IntPoint convertFromContainingView(const IntPoint&) const;
protected:
- Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
+ Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
void updateThumb();
virtual void updateThumbPosition();
@@ -145,7 +140,7 @@ protected:
void moveThumb(int pos);
- ScrollbarClient* m_client;
+ ScrollableArea* m_scrollableArea;
ScrollbarOrientation m_orientation;
ScrollbarControlSize m_controlSize;
ScrollbarTheme* m_theme;
@@ -172,10 +167,8 @@ protected:
private:
virtual bool isScrollbar() const { return true; }
virtual AXObjectCache* axObjectCache() const;
-
- bool setCurrentPos(float pos, ScrollSource source);
};
-}
+} // namespace WebCore
-#endif
+#endif // Scrollbar_h
diff --git a/Source/WebCore/platform/ScrollbarClient.cpp b/Source/WebCore/platform/ScrollbarClient.cpp
deleted file mode 100644
index 2f81a93..0000000
--- a/Source/WebCore/platform/ScrollbarClient.cpp
+++ /dev/null
@@ -1,57 +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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScrollbarClient.h"
-
-#include "ScrollAnimator.h"
-
-namespace WebCore {
-
-ScrollbarClient::ScrollbarClient()
- : m_scrollAnimator(ScrollAnimator::create(this))
-{
-}
-
-ScrollbarClient::~ScrollbarClient()
-{
-}
-
-bool ScrollbarClient::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
-{
- return m_scrollAnimator->scroll(orientation, granularity, step, multiplier);
-}
-
-void ScrollbarClient::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos)
-{
- m_scrollAnimator->setScrollPositionAndStopAnimation(orientation, pos);
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollbarTheme.h b/Source/WebCore/platform/ScrollbarTheme.h
index 0efaf7a..ef52b0d 100644
--- a/Source/WebCore/platform/ScrollbarTheme.h
+++ b/Source/WebCore/platform/ScrollbarTheme.h
@@ -36,8 +36,10 @@ class PlatformMouseEvent;
class Scrollbar;
class ScrollView;
-class ScrollbarTheme : public Noncopyable {
+class ScrollbarTheme {
+ WTF_MAKE_NONCOPYABLE(ScrollbarTheme); WTF_MAKE_FAST_ALLOCATED;
public:
+ ScrollbarTheme() { }
virtual ~ScrollbarTheme() {};
virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& /*damageRect*/) { return false; }
@@ -48,6 +50,7 @@ public:
virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; }
virtual bool supportsControlTints() const { return false; }
+ virtual bool usesOverlayScrollbars() const { return false; }
virtual void themeChanged() {}
diff --git a/Source/WebCore/platform/ScrollbarThemeComposite.cpp b/Source/WebCore/platform/ScrollbarThemeComposite.cpp
index bf00ebb..7bc266f 100644
--- a/Source/WebCore/platform/ScrollbarThemeComposite.cpp
+++ b/Source/WebCore/platform/ScrollbarThemeComposite.cpp
@@ -34,7 +34,7 @@
#include "Page.h"
#include "PlatformMouseEvent.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
+#include "ScrollableArea.h"
#include "Settings.h"
namespace WebCore {
@@ -104,7 +104,7 @@ bool ScrollbarThemeComposite::paint(Scrollbar* scrollbar, GraphicsContext* graph
float proportion = static_cast<float>(scrollbar->visibleSize()) / scrollbar->totalSize();
float value = scrollbar->currentPos() / static_cast<float>(scrollbar->maximum());
ScrollbarControlState s = 0;
- if (scrollbar->client()->isActive())
+ if (scrollbar->scrollableArea()->isActive())
s |= ActiveScrollbarState;
if (scrollbar->enabled())
s |= EnabledScrollbarState;
diff --git a/Source/WebCore/platform/SharedTimer.h b/Source/WebCore/platform/SharedTimer.h
index 5b5cd14..16e0d0b 100644
--- a/Source/WebCore/platform/SharedTimer.h
+++ b/Source/WebCore/platform/SharedTimer.h
@@ -26,6 +26,7 @@
#ifndef SharedTimer_h
#define SharedTimer_h
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
@@ -33,8 +34,10 @@ namespace WebCore {
// Each thread has its own single instance of shared timer, which implements this interface.
// This instance is shared by all timers in the thread.
// Not intended to be used directly; use the Timer class instead.
- class SharedTimer : public Noncopyable {
+ class SharedTimer {
+ WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED;
public:
+ SharedTimer() { }
virtual ~SharedTimer() {}
virtual void setFiredFunction(void (*)()) = 0;
diff --git a/Source/WebCore/platform/ThreadGlobalData.h b/Source/WebCore/platform/ThreadGlobalData.h
index 9f57f00..76377b4 100644
--- a/Source/WebCore/platform/ThreadGlobalData.h
+++ b/Source/WebCore/platform/ThreadGlobalData.h
@@ -45,7 +45,8 @@ namespace WebCore {
struct TECConverterWrapper;
class ThreadTimers;
- class ThreadGlobalData : public Noncopyable {
+ class ThreadGlobalData {
+ WTF_MAKE_NONCOPYABLE(ThreadGlobalData);
public:
ThreadGlobalData();
~ThreadGlobalData();
diff --git a/Source/WebCore/platform/ThreadTimers.h b/Source/WebCore/platform/ThreadTimers.h
index ab42598..3d7b5f9 100644
--- a/Source/WebCore/platform/ThreadTimers.h
+++ b/Source/WebCore/platform/ThreadTimers.h
@@ -37,7 +37,8 @@ namespace WebCore {
class TimerBase;
// A collection of timers per thread. Kept in ThreadGlobalData.
- class ThreadTimers : public Noncopyable {
+ class ThreadTimers {
+ WTF_MAKE_NONCOPYABLE(ThreadTimers); WTF_MAKE_FAST_ALLOCATED;
public:
ThreadTimers();
diff --git a/Source/WebCore/platform/Timer.h b/Source/WebCore/platform/Timer.h
index c4443da..c331e3d 100644
--- a/Source/WebCore/platform/Timer.h
+++ b/Source/WebCore/platform/Timer.h
@@ -35,7 +35,8 @@ namespace WebCore {
class TimerHeapElement;
-class TimerBase : public Noncopyable {
+class TimerBase {
+ WTF_MAKE_NONCOPYABLE(TimerBase); WTF_MAKE_FAST_ALLOCATED;
public:
TimerBase();
virtual ~TimerBase();
diff --git a/Source/WebCore/platform/TreeShared.h b/Source/WebCore/platform/TreeShared.h
index 9d9ac1f..9e27c5e 100644
--- a/Source/WebCore/platform/TreeShared.h
+++ b/Source/WebCore/platform/TreeShared.h
@@ -32,7 +32,8 @@ template<typename T> class TreeShared;
template<typename T> void adopted(TreeShared<T>*);
#endif
-template<typename T> class TreeShared : public Noncopyable {
+template<typename T> class TreeShared {
+ WTF_MAKE_NONCOPYABLE(TreeShared);
public:
TreeShared()
: m_refCount(1)
diff --git a/Source/WebCore/platform/android/PlatformBridge.h b/Source/WebCore/platform/android/PlatformBridge.h
index faa823e..f20a001 100644
--- a/Source/WebCore/platform/android/PlatformBridge.h
+++ b/Source/WebCore/platform/android/PlatformBridge.h
@@ -90,7 +90,7 @@ class Widget;
// An interface to the embedding layer, which has the ability to answer
// questions about the system and so on...
-// This is very similar to ChromiumBridge and the two are likely to converge
+// This is very similar to chromium/PlatformBridge and the two are likely to converge
// in the future.
//
// The methods in this class all need to reach across a JNI layer to the Java VM
diff --git a/Source/WebCore/platform/animation/AnimationList.h b/Source/WebCore/platform/animation/AnimationList.h
index 9a334ca..bf8ff9f 100644
--- a/Source/WebCore/platform/animation/AnimationList.h
+++ b/Source/WebCore/platform/animation/AnimationList.h
@@ -31,7 +31,8 @@
namespace WebCore {
-class AnimationList : public FastAllocBase {
+class AnimationList {
+ WTF_MAKE_FAST_ALLOCATED;
public:
AnimationList() { }
AnimationList(const AnimationList&);
diff --git a/Source/WebCore/platform/audio/AudioBus.h b/Source/WebCore/platform/audio/AudioBus.h
index 4318b81..888f6bf 100644
--- a/Source/WebCore/platform/audio/AudioBus.h
+++ b/Source/WebCore/platform/audio/AudioBus.h
@@ -39,7 +39,8 @@ namespace WebCore {
// An AudioBus represents a collection of one or more AudioChannels.
// The data layout is "planar" as opposed to "interleaved".
// An AudioBus with one channel is mono, an AudioBus with two channels is stereo, etc.
-class AudioBus : public Noncopyable {
+class AudioBus {
+ WTF_MAKE_NONCOPYABLE(AudioBus);
public:
enum {
ChannelLeft = 0,
diff --git a/Source/WebCore/platform/audio/AudioChannel.h b/Source/WebCore/platform/audio/AudioChannel.h
index 6816830..7325e9f 100644
--- a/Source/WebCore/platform/audio/AudioChannel.h
+++ b/Source/WebCore/platform/audio/AudioChannel.h
@@ -30,14 +30,14 @@
#define AudioChannel_h
#include "AudioArray.h"
-#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
// An AudioChannel represents a buffer of non-interleaved floating-point audio samples.
// The PCM samples are normally assumed to be in a nominal range -1.0 -> +1.0
-class AudioChannel : public Noncopyable {
+class AudioChannel {
+ WTF_MAKE_NONCOPYABLE(AudioChannel);
public:
// Memory can be externally referenced, or can be internally allocated with an AudioFloatArray.
diff --git a/Source/WebCore/platform/audio/FFTFrameStub.cpp b/Source/WebCore/platform/audio/FFTFrameStub.cpp
new file mode 100644
index 0000000..17405c9
--- /dev/null
+++ b/Source/WebCore/platform/audio/FFTFrameStub.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+// FFTFrame stub implementation to avoid link errors during bringup
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW)
+
+#include "FFTFrame.h"
+
+namespace WebCore {
+
+// Normal constructor: allocates for a given fftSize.
+FFTFrame::FFTFrame(unsigned fftSize)
+ : m_FFTSize(fftSize)
+ , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
+{
+ ASSERT_NOT_REACHED();
+}
+
+// Creates a blank/empty frame (interpolate() must later be called).
+FFTFrame::FFTFrame()
+ : m_FFTSize(0)
+ , m_log2FFTSize(0)
+{
+ ASSERT_NOT_REACHED();
+}
+
+// Copy constructor.
+FFTFrame::FFTFrame(const FFTFrame& frame)
+ : m_FFTSize(frame.m_FFTSize)
+ , m_log2FFTSize(frame.m_log2FFTSize)
+{
+ ASSERT_NOT_REACHED();
+}
+
+FFTFrame::~FFTFrame()
+{
+ ASSERT_NOT_REACHED();
+}
+
+void FFTFrame::multiply(const FFTFrame& frame)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void FFTFrame::doFFT(float* data)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void FFTFrame::doInverseFFT(float* data)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void FFTFrame::cleanup()
+{
+ ASSERT_NOT_REACHED();
+}
+
+float* FFTFrame::realData() const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+float* FFTFrame::imagData() const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+} // namespace WebCore
+
+#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW)
+
+#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/WebCore/platform/audio/HRTFDatabase.h b/Source/WebCore/platform/audio/HRTFDatabase.h
index c33b38f..bf13a3a 100644
--- a/Source/WebCore/platform/audio/HRTFDatabase.h
+++ b/Source/WebCore/platform/audio/HRTFDatabase.h
@@ -43,7 +43,8 @@ namespace WebCore {
class HRTFKernel;
-class HRTFDatabase : public Noncopyable {
+class HRTFDatabase {
+ WTF_MAKE_NONCOPYABLE(HRTFDatabase);
public:
static PassOwnPtr<HRTFDatabase> create(double sampleRate);
diff --git a/Source/WebCore/platform/audio/HRTFElevation.h b/Source/WebCore/platform/audio/HRTFElevation.h
index b388b34..24b7822 100644
--- a/Source/WebCore/platform/audio/HRTFElevation.h
+++ b/Source/WebCore/platform/audio/HRTFElevation.h
@@ -43,7 +43,8 @@ namespace WebCore {
// HRTFElevation contains all of the HRTFKernels (one left ear and one right ear per azimuth angle) for a particular elevation.
-class HRTFElevation : public Noncopyable {
+class HRTFElevation {
+ WTF_MAKE_NONCOPYABLE(HRTFElevation);
public:
// Loads and returns an HRTFElevation with the given HRTF database subject name and elevation from browser (or WebKit.framework) resources.
// Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names.
diff --git a/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp b/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp
index a93703d..83ab9bf 100644
--- a/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp
+++ b/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp
@@ -29,21 +29,19 @@
#include "AudioBus.h"
#include "AudioFileReader.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
-// We will use this version of loadPlatformResource() once the resources are checked into Chromium.
-
-// PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, double sampleRate)
-// {
-// return ChromiumBridge::loadPlatformAudioResource(name, sampleRate);
-// }
+PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, double sampleRate)
+{
+ return PlatformBridge::loadPlatformAudioResource(name, sampleRate);
+}
PassOwnPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dataSize, bool mixToMono, double sampleRate)
{
- OwnPtr<AudioBus> audioBus = ChromiumBridge::decodeAudioFileData(static_cast<const char*>(data), dataSize, sampleRate);
+ OwnPtr<AudioBus> audioBus = PlatformBridge::decodeAudioFileData(static_cast<const char*>(data), dataSize, sampleRate);
if (audioBus->numberOfChannels() == 2 && mixToMono) {
OwnPtr<AudioBus> monoAudioBus = adoptPtr(new AudioBus(1, audioBus->length()));
diff --git a/Source/WebCore/platform/chromium/ChromiumBridge.h b/Source/WebCore/platform/chromium/ChromiumBridge.h
deleted file mode 100644
index d3b8528..0000000
--- a/Source/WebCore/platform/chromium/ChromiumBridge.h
+++ /dev/null
@@ -1,356 +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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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 ChromiumBridge_h
-#define ChromiumBridge_h
-
-#if ENABLE(WEB_AUDIO)
-#include "AudioBus.h"
-#endif
-
-#include "FileSystem.h"
-#include "ImageSource.h"
-#include "LinkHash.h"
-#include "PassRefPtr.h"
-#include "PasteboardPrivate.h"
-#include "PluginData.h"
-
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
-#include <wtf/Vector.h>
-
-typedef struct NPObject NPObject;
-typedef struct _NPP NPP_t;
-typedef NPP_t* NPP;
-
-#if OS(DARWIN)
-typedef struct CGFont* CGFontRef;
-typedef uintptr_t ATSFontContainerRef;
-#ifdef __OBJC__
-@class NSFont;
-#else
-class NSFont;
-#endif
-#endif // OS(DARWIN)
-
-#if OS(WINDOWS)
-typedef struct HFONT__* HFONT;
-#endif
-
-namespace WebCore {
-
- class ClipboardData;
- class Color;
- class Cursor;
- class Document;
- class Frame;
- class GeolocationServiceBridge;
- class GeolocationServiceChromium;
- class GraphicsContext;
- class Image;
- class IDBFactoryBackendInterface;
- class IDBKey;
- class IntRect;
- class KURL;
- class SerializedScriptValue;
- class Widget;
-
- struct Cookie;
- struct FontRenderStyle;
-
- // An interface to the embedding layer, which has the ability to answer
- // questions about the system and so on...
-
- class ChromiumBridge {
- public:
- // Cache --------------------------------------------------------------
- static void cacheMetadata(const KURL& url, double responseTime, const Vector<char>&);
-
- // Clipboard ----------------------------------------------------------
- static bool clipboardIsFormatAvailable(PasteboardPrivate::ClipboardFormat, PasteboardPrivate::ClipboardBuffer);
-
- static String clipboardReadPlainText(PasteboardPrivate::ClipboardBuffer);
- static void clipboardReadHTML(PasteboardPrivate::ClipboardBuffer, String*, KURL*);
-
- // Only the clipboardRead functions take a buffer argument because
- // Chromium currently uses a different technique to write to alternate
- // clipboard buffers.
- static void clipboardWriteSelection(const String&, const KURL&, const String&, bool);
- static void clipboardWritePlainText(const String&);
- static void clipboardWriteURL(const KURL&, const String&);
- static void clipboardWriteImage(NativeImagePtr, const KURL&, const String&);
- static void clipboardWriteData(const String& type, const String& data, const String& metadata);
-
- // Interface for handling copy and paste, drag and drop, and selection copy.
- static HashSet<String> clipboardReadAvailableTypes(PasteboardPrivate::ClipboardBuffer, bool* containsFilenames);
- static bool clipboardReadData(PasteboardPrivate::ClipboardBuffer, const String& type, String& data, String& metadata);
- static Vector<String> clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer);
-
- // Cookies ------------------------------------------------------------
- static void setCookies(const Document*, const KURL&, const String& value);
- static String cookies(const Document*, const KURL&);
- static String cookieRequestHeaderFieldValue(const Document*, const KURL&);
- static bool rawCookies(const Document*, const KURL& url, Vector<Cookie>&);
- static void deleteCookie(const Document*, const KURL& url, const String& cookieName);
- static bool cookiesEnabled(const Document*);
-
- // DNS ----------------------------------------------------------------
- static void prefetchDNS(const String& hostname);
-
- // File ---------------------------------------------------------------
- static void revealFolderInOS(const String&);
- static bool fileExists(const String&);
- static bool deleteFile(const String&);
- static bool deleteEmptyDirectory(const String&);
- static bool getFileSize(const String&, long long& result);
- static bool getFileModificationTime(const String&, time_t& result);
- static String directoryName(const String& path);
- static String pathByAppendingComponent(const String& path, const String& component);
- static bool makeAllDirectories(const String& path);
- static String getAbsolutePath(const String&);
- static bool isDirectory(const String&);
- static KURL filePathToURL(const String&);
- static PlatformFileHandle openFile(const String& path, FileOpenMode);
- static void closeFile(PlatformFileHandle&);
- static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin);
- static bool truncateFile(PlatformFileHandle, long long offset);
- static int readFromFile(PlatformFileHandle, char* data, int length);
- static int writeToFile(PlatformFileHandle, const char* data, int length);
-
- // Font ---------------------------------------------------------------
-#if OS(WINDOWS)
- static bool ensureFontLoaded(HFONT font);
-#endif
-#if OS(LINUX) || OS(FREEBSD)
- static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
- static String getFontFamilyForCharacters(const UChar*, size_t numCharacters);
-#endif
-#if OS(DARWIN)
- static bool loadFont(NSFont* srcFont, ATSFontContainerRef* out);
-#endif
-
- // Forms --------------------------------------------------------------
- static void notifyFormStateChanged(const Document*);
-
- // Databases ----------------------------------------------------------
- // Returns a handle to the DB file and ooptionally a handle to its containing directory
- static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags);
- // Returns a SQLite code (SQLITE_OK = 0, on success)
- static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false);
- // Returns the attributes of the DB file
- static long databaseGetFileAttributes(const String& vfsFileName);
- // Returns the size of the DB file
- static long long databaseGetFileSize(const String& vfsFileName);
-
- // IndexedDB ----------------------------------------------------------
- static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
- static void idbShutdown();
- // Extracts keyPath from values and returns the corresponding keys.
- static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys);
-
- // JavaScript ---------------------------------------------------------
- static void notifyJSOutOfMemory(Frame*);
- static bool allowScriptDespiteSettings(const KURL& documentURL);
-
- // Keygen -------------------------------------------------------------
- static String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challenge, const KURL& url);
-
- // Language -----------------------------------------------------------
- static String computedDefaultLanguage();
-
- // LayoutTestMode -----------------------------------------------------
- static bool layoutTestMode();
-
- // Memory -------------------------------------------------------------
- // Returns the current space allocated for the pagefile, in MB.
- // That is committed size for Windows and virtual memory size for POSIX
- static int memoryUsageMB();
-
- // Same as above, but always returns actual value, without any caches.
- static int actualMemoryUsageMB();
-
- // MimeType -----------------------------------------------------------
- static bool isSupportedImageMIMEType(const String& mimeType);
- static bool isSupportedJavaScriptMIMEType(const String& mimeType);
- static bool isSupportedNonImageMIMEType(const String& mimeType);
- static String mimeTypeForExtension(const String& fileExtension);
- static String mimeTypeFromFile(const String& filePath);
- static String preferredExtensionForMIMEType(const String& mimeType);
-
- // Plugin -------------------------------------------------------------
- static bool plugins(bool refresh, Vector<PluginInfo>*);
- static NPObject* pluginScriptableObject(Widget*);
- static bool popupsAllowed(NPP);
-
- // Resources ----------------------------------------------------------
- static PassRefPtr<Image> loadPlatformImageResource(const char* name);
-
-#if ENABLE(WEB_AUDIO)
- static PassOwnPtr<AudioBus> loadPlatformAudioResource(const char* name, double sampleRate);
- static PassOwnPtr<AudioBus> decodeAudioFileData(const char* data, size_t size, double sampleRate);
-#endif
-
- // Sandbox ------------------------------------------------------------
- static bool sandboxEnabled();
-
- // Screen -------------------------------------------------------------
- static int screenDepth(Widget*);
- static int screenDepthPerComponent(Widget*);
- static bool screenIsMonochrome(Widget*);
- static IntRect screenRect(Widget*);
- static IntRect screenAvailableRect(Widget*);
-
- // SharedTimers -------------------------------------------------------
- static void setSharedTimerFiredFunction(void (*func)());
- static void setSharedTimerFireTime(double fireTime);
- static void stopSharedTimer();
-
- // StatsCounters ------------------------------------------------------
- static void decrementStatsCounter(const char* name);
- static void incrementStatsCounter(const char* name);
- static void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount);
- static void histogramEnumeration(const char* name, int sample, int boundaryValue);
-
- // Sudden Termination
- static void suddenTerminationChanged(bool enabled);
-
- // SystemTime ---------------------------------------------------------
- static double currentTime();
-
- // Theming ------------------------------------------------------------
-#if OS(WINDOWS)
- static void paintButton(
- GraphicsContext*, int part, int state, int classicState, const IntRect&);
- static void paintMenuList(
- GraphicsContext*, int part, int state, int classicState, const IntRect&);
- static void paintScrollbarArrow(
- GraphicsContext*, int state, int classicState, const IntRect&);
- static void paintScrollbarThumb(
- GraphicsContext*, int part, int state, int classicState, const IntRect&);
- static void paintScrollbarTrack(
- GraphicsContext*, int part, int state, int classicState, const IntRect&, const IntRect& alignRect);
- static void paintSpinButton(
- GraphicsContext*, int part, int state, int classicState, const IntRect&);
- static void paintTextField(
- GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges);
- static void paintTrackbar(
- GraphicsContext*, int part, int state, int classicState, const IntRect&);
- static void paintProgressBar(
- GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds);
-#elif OS(LINUX)
- // The UI part which is being accessed.
- enum ThemePart {
- PartScrollbarDownArrow,
- PartScrollbarLeftArrow,
- PartScrollbarRightArrow,
- PartScrollbarUpArrow,
- PartScrollbarHorizontalThumb,
- PartScrollbarVerticalThumb,
- PartScrollbarHorizontalTrack,
- PartScrollbarVerticalTrack,
- };
-
- // The current state of the associated Part.
- enum ThemePaintState {
- StateDisabled,
- StateHover,
- StateNormal,
- StatePressed,
- };
-
- struct ScrollbarTrackExtraParams {
- // The bounds of the entire track, as opposed to the part being painted.
- int trackX;
- int trackY;
- int trackWidth;
- int trackHeight;
- };
-
- union ThemePaintExtraParams {
- ScrollbarTrackExtraParams scrollbarTrack;
- };
-
- // Gets the size of the given theme part. For variable sized items
- // like vertical scrollbar thumbs, the width will be the required width of
- // the track while the height will be the minimum height.
- static IntSize getThemePartSize(ThemePart);
- // Paint the given the given theme part.
- static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*);
-#elif OS(DARWIN)
- enum ThemePaintState {
- StateDisabled,
- StateInactive,
- StateActive,
- StatePressed,
- };
-
- enum ThemePaintSize {
- SizeRegular,
- SizeSmall,
- };
-
- enum ThemePaintScrollbarOrientation {
- ScrollbarOrientationHorizontal,
- ScrollbarOrientationVertical,
- };
-
- enum ThemePaintScrollbarParent {
- ScrollbarParentScrollView,
- ScrollbarParentRenderLayer,
- };
-
- struct ThemePaintScrollbarInfo {
- ThemePaintScrollbarOrientation orientation;
- ThemePaintScrollbarParent parent;
- int maxValue;
- int currentValue;
- int visibleSize;
- int totalSize;
- };
-
- static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
-#endif
-
- // Trace Event --------------------------------------------------------
- static void traceEventBegin(const char* name, void* id, const char* extra);
- static void traceEventEnd(const char* name, void* id, const char* extra);
-
- // Visited links ------------------------------------------------------
- static LinkHash visitedLinkHash(const UChar* url, unsigned length);
- static LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL);
- static bool isLinkVisited(LinkHash);
-
- // Widget -------------------------------------------------------------
- static void widgetSetCursor(Widget*, const Cursor&);
- };
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp b/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp
index a2952c0..82e47e2 100644
--- a/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp
+++ b/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp
@@ -31,9 +31,9 @@
#include "config.h"
#include "ChromiumDataObjectLegacy.h"
-#include "ChromiumBridge.h"
#include "ClipboardMimeTypes.h"
#include "Pasteboard.h"
+#include "PlatformBridge.h"
namespace WebCore {
@@ -132,7 +132,7 @@ String ChromiumDataObjectLegacy::getData(const String& type, bool& success)
Pasteboard::generalPasteboard()->isSelectionMode() ?
PasteboardPrivate::SelectionBuffer :
PasteboardPrivate::StandardBuffer;
- String text = ChromiumBridge::clipboardReadPlainText(buffer);
+ String text = PlatformBridge::clipboardReadPlainText(buffer);
success = !text.isEmpty();
return text;
}
@@ -158,7 +158,7 @@ String ChromiumDataObjectLegacy::getData(const String& type, bool& success)
PasteboardPrivate::StandardBuffer;
String htmlText;
KURL sourceURL;
- ChromiumBridge::clipboardReadHTML(buffer, &htmlText, &sourceURL);
+ PlatformBridge::clipboardReadHTML(buffer, &htmlText, &sourceURL);
success = !htmlText.isEmpty();
return htmlText;
}
diff --git a/Source/WebCore/platform/chromium/ClipboardChromium.h b/Source/WebCore/platform/chromium/ClipboardChromium.h
index 1d69921..d5ada14 100644
--- a/Source/WebCore/platform/chromium/ClipboardChromium.h
+++ b/Source/WebCore/platform/chromium/ClipboardChromium.h
@@ -42,6 +42,7 @@ namespace WebCore {
class IntPoint;
class ClipboardChromium : public Clipboard, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
~ClipboardChromium() {}
diff --git a/Source/WebCore/platform/chromium/DragDataChromium.cpp b/Source/WebCore/platform/chromium/DragDataChromium.cpp
index 8c20a00..9312505 100644
--- a/Source/WebCore/platform/chromium/DragDataChromium.cpp
+++ b/Source/WebCore/platform/chromium/DragDataChromium.cpp
@@ -30,16 +30,16 @@
#include "config.h"
#include "DragData.h"
-#include "ChromiumBridge.h"
#include "ChromiumDataObject.h"
#include "ClipboardMimeTypes.h"
#include "DocumentFragment.h"
#include "FileSystem.h"
#include "Frame.h"
#include "KURL.h"
-#include "markup.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
#include "PlatformString.h"
+#include "markup.h"
namespace WebCore {
@@ -63,7 +63,7 @@ String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String*
if (title)
*title = m_platformDragData->urlTitle();
} else if (filenamePolicy == ConvertFilenames && containsFiles()) {
- url = ChromiumBridge::filePathToURL(ChromiumBridge::getAbsolutePath(m_platformDragData->filenames()[0]));
+ url = PlatformBridge::filePathToURL(PlatformBridge::getAbsolutePath(m_platformDragData->filenames()[0]));
}
return url;
}
diff --git a/Source/WebCore/platform/chromium/FileSystemChromium.cpp b/Source/WebCore/platform/chromium/FileSystemChromium.cpp
index d8a1e3f..faf5e92 100644
--- a/Source/WebCore/platform/chromium/FileSystemChromium.cpp
+++ b/Source/WebCore/platform/chromium/FileSystemChromium.cpp
@@ -31,85 +31,85 @@
#include "config.h"
#include "FileSystem.h"
-#include "ChromiumBridge.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
#include "PlatformString.h"
namespace WebCore {
bool deleteFile(const String& path)
{
- return ChromiumBridge::deleteFile(path);
+ return PlatformBridge::deleteFile(path);
}
bool deleteEmptyDirectory(const String& path)
{
- return ChromiumBridge::deleteEmptyDirectory(path);
+ return PlatformBridge::deleteEmptyDirectory(path);
}
bool getFileSize(const String& path, long long& result)
{
- return ChromiumBridge::getFileSize(path, result);
+ return PlatformBridge::getFileSize(path, result);
}
bool getFileModificationTime(const String& path, time_t& result)
{
- return ChromiumBridge::getFileModificationTime(path, result);
+ return PlatformBridge::getFileModificationTime(path, result);
}
void revealFolderInOS(const String& path)
{
- ChromiumBridge::revealFolderInOS(path);
+ PlatformBridge::revealFolderInOS(path);
}
String directoryName(const String& path)
{
- return ChromiumBridge::directoryName(path);
+ return PlatformBridge::directoryName(path);
}
String pathByAppendingComponent(const String& path, const String& component)
{
- return ChromiumBridge::pathByAppendingComponent(path, component);
+ return PlatformBridge::pathByAppendingComponent(path, component);
}
bool makeAllDirectories(const String& path)
{
- return ChromiumBridge::makeAllDirectories(path);
+ return PlatformBridge::makeAllDirectories(path);
}
bool fileExists(const String& path)
{
- return ChromiumBridge::fileExists(path);
+ return PlatformBridge::fileExists(path);
}
PlatformFileHandle openFile(const String& path, FileOpenMode mode)
{
- return ChromiumBridge::openFile(path, mode);
+ return PlatformBridge::openFile(path, mode);
}
void closeFile(PlatformFileHandle& handle)
{
- return ChromiumBridge::closeFile(handle);
+ return PlatformBridge::closeFile(handle);
}
long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin)
{
- return ChromiumBridge::seekFile(handle, offset, origin);
+ return PlatformBridge::seekFile(handle, offset, origin);
}
bool truncateFile(PlatformFileHandle handle, long long offset)
{
- return ChromiumBridge::truncateFile(handle, offset);
+ return PlatformBridge::truncateFile(handle, offset);
}
int readFromFile(PlatformFileHandle handle, char* data, int length)
{
- return ChromiumBridge::readFromFile(handle, data, length);
+ return PlatformBridge::readFromFile(handle, data, length);
}
int writeToFile(PlatformFileHandle handle, const char* data, int length)
{
- return ChromiumBridge::writeToFile(handle, data, length);
+ return PlatformBridge::writeToFile(handle, data, length);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.h b/Source/WebCore/platform/chromium/FramelessScrollView.h
index 300f418..033d953 100644
--- a/Source/WebCore/platform/chromium/FramelessScrollView.h
+++ b/Source/WebCore/platform/chromium/FramelessScrollView.h
@@ -61,7 +61,7 @@ namespace WebCore {
virtual bool handleWheelEvent(const PlatformWheelEvent&) = 0;
virtual bool handleKeyEvent(const PlatformKeyboardEvent&) = 0;
- // ScrollbarClient public methods:
+ // ScrollableArea public methods:
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
diff --git a/Source/WebCore/platform/chromium/LanguageChromium.cpp b/Source/WebCore/platform/chromium/LanguageChromium.cpp
index 69fe372..fedc4d5 100644
--- a/Source/WebCore/platform/chromium/LanguageChromium.cpp
+++ b/Source/WebCore/platform/chromium/LanguageChromium.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "Language.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "PlatformString.h"
namespace WebCore {
@@ -40,7 +40,7 @@ String platformDefaultLanguage()
{
static String computedDefaultLanguage;
if (computedDefaultLanguage.isEmpty())
- computedDefaultLanguage = ChromiumBridge::computedDefaultLanguage();
+ computedDefaultLanguage = PlatformBridge::computedDefaultLanguage();
return computedDefaultLanguage;
}
diff --git a/Source/WebCore/platform/chromium/LinkHashChromium.cpp b/Source/WebCore/platform/chromium/LinkHashChromium.cpp
index 9cb93ea..5e1ffa4 100644
--- a/Source/WebCore/platform/chromium/LinkHashChromium.cpp
+++ b/Source/WebCore/platform/chromium/LinkHashChromium.cpp
@@ -31,18 +31,18 @@
#include "config.h"
#include "LinkHash.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
namespace WebCore {
LinkHash visitedLinkHash(const UChar* url, unsigned length)
{
- return ChromiumBridge::visitedLinkHash(url, length);
+ return PlatformBridge::visitedLinkHash(url, length);
}
LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL)
{
- return ChromiumBridge::visitedLinkHash(base, attributeURL);
+ return PlatformBridge::visitedLinkHash(base, attributeURL);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
index 9df8847..fec0e9b 100644
--- a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
+++ b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
@@ -31,20 +31,20 @@
#include "config.h"
#include "MIMETypeRegistry.h"
-#include "ChromiumBridge.h"
#include "MediaPlayer.h"
+#include "PlatformBridge.h"
#include "PluginDataChromium.h"
#include <wtf/text/CString.h>
// NOTE: Unlike other ports, we don't use the shared implementation bits in
// MIMETypeRegistry.cpp. Instead, we need to route most functions via the
-// ChromiumBridge to the embedder.
+// PlatformBridge to the embedder.
namespace WebCore {
String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
{
- return ChromiumBridge::mimeTypeForExtension(ext);
+ return PlatformBridge::mimeTypeForExtension(ext);
}
// Returns the file extension if one is found. Does not include the dot in the
@@ -55,7 +55,7 @@ String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
// FIXME: Is this really necessary??
String mimeType = type.substring(0, static_cast<unsigned>(type.find(';')));
- String ext = ChromiumBridge::preferredExtensionForMIMEType(type);
+ String ext = PlatformBridge::preferredExtensionForMIMEType(type);
if (!ext.isEmpty() && ext[0] == '.')
ext = ext.substring(1);
@@ -81,7 +81,7 @@ String MIMETypeRegistry::getMIMETypeForPath(const String& path)
bool MIMETypeRegistry::isSupportedImageMIMEType(const String& mimeType)
{
- return ChromiumBridge::isSupportedImageMIMEType(mimeType);
+ return PlatformBridge::isSupportedImageMIMEType(mimeType);
}
bool MIMETypeRegistry::isSupportedImageResourceMIMEType(const String& mimeType)
@@ -96,12 +96,12 @@ bool MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(const String& mimeTyp
bool MIMETypeRegistry::isSupportedJavaScriptMIMEType(const String& mimeType)
{
- return ChromiumBridge::isSupportedJavaScriptMIMEType(mimeType);
+ return PlatformBridge::isSupportedJavaScriptMIMEType(mimeType);
}
bool MIMETypeRegistry::isSupportedNonImageMIMEType(const String& mimeType)
{
- return ChromiumBridge::isSupportedNonImageMIMEType(mimeType);
+ return PlatformBridge::isSupportedNonImageMIMEType(mimeType);
}
bool MIMETypeRegistry::isSupportedMediaMIMEType(const String& mimeType)
diff --git a/Source/WebCore/platform/chromium/PasteboardChromium.cpp b/Source/WebCore/platform/chromium/PasteboardChromium.cpp
index 907a4b9..6beb017 100644
--- a/Source/WebCore/platform/chromium/PasteboardChromium.cpp
+++ b/Source/WebCore/platform/chromium/PasteboardChromium.cpp
@@ -31,20 +31,20 @@
#include "config.h"
#include "Pasteboard.h"
-#include "ChromiumBridge.h"
#include "ClipboardUtilitiesChromium.h"
-#include "DocumentFragment.h"
#include "Document.h"
+#include "DocumentFragment.h"
#include "Element.h"
#include "Frame.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "Image.h"
#include "KURL.h"
-#include "markup.h"
#include "NativeImageSkia.h"
+#include "PlatformBridge.h"
#include "Range.h"
#include "RenderImage.h"
+#include "markup.h"
#if ENABLE(SVG)
#include "SVGNames.h"
@@ -91,7 +91,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
#endif
replaceNBSPWithSpace(plainText);
- ChromiumBridge::clipboardWriteSelection(html, url, plainText, canSmartCopyOrDelete);
+ PlatformBridge::clipboardWriteSelection(html, url, plainText, canSmartCopyOrDelete);
}
void Pasteboard::writePlainText(const String& text)
@@ -99,9 +99,9 @@ void Pasteboard::writePlainText(const String& text)
#if OS(WINDOWS)
String plainText(text);
replaceNewlinesWithWindowsStyleNewlines(plainText);
- ChromiumBridge::clipboardWritePlainText(plainText);
+ PlatformBridge::clipboardWritePlainText(plainText);
#else
- ChromiumBridge::clipboardWritePlainText(text);
+ PlatformBridge::clipboardWritePlainText(text);
#endif
}
@@ -116,7 +116,7 @@ void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
title = url.host();
}
- ChromiumBridge::clipboardWriteURL(url, title);
+ PlatformBridge::clipboardWriteURL(url, title);
}
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
@@ -150,17 +150,17 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
}
KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
- ChromiumBridge::clipboardWriteImage(bitmap, url, title);
+ PlatformBridge::clipboardWriteImage(bitmap, url, title);
}
bool Pasteboard::canSmartReplace()
{
- return ChromiumBridge::clipboardIsFormatAvailable(PasteboardPrivate::WebSmartPasteFormat, m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer);
+ return PlatformBridge::clipboardIsFormatAvailable(PasteboardPrivate::WebSmartPasteFormat, m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer);
}
String Pasteboard::plainText(Frame* frame)
{
- return ChromiumBridge::clipboardReadPlainText(m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer);
+ return PlatformBridge::clipboardReadPlainText(m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer);
}
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
@@ -168,10 +168,10 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
chosePlainText = false;
PasteboardPrivate::ClipboardBuffer buffer = m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer;
- if (ChromiumBridge::clipboardIsFormatAvailable(PasteboardPrivate::HTMLFormat, buffer)) {
+ if (PlatformBridge::clipboardIsFormatAvailable(PasteboardPrivate::HTMLFormat, buffer)) {
String markup;
KURL srcURL;
- ChromiumBridge::clipboardReadHTML(buffer, &markup, &srcURL);
+ PlatformBridge::clipboardReadHTML(buffer, &markup, &srcURL);
RefPtr<DocumentFragment> fragment =
createFragmentFromMarkup(frame->document(), markup, srcURL, FragmentScriptingNotAllowed);
@@ -180,7 +180,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
}
if (allowPlainText) {
- String markup = ChromiumBridge::clipboardReadPlainText(buffer);
+ String markup = PlatformBridge::clipboardReadPlainText(buffer);
if (!markup.isEmpty()) {
chosePlainText = true;
diff --git a/Source/WebCore/platform/chromium/PlatformBridge.h b/Source/WebCore/platform/chromium/PlatformBridge.h
index ecb7b45..f6a2564 100644
--- a/Source/WebCore/platform/chromium/PlatformBridge.h
+++ b/Source/WebCore/platform/chromium/PlatformBridge.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
+ * 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
@@ -31,17 +31,378 @@
#ifndef PlatformBridge_h
#define PlatformBridge_h
-#include "ChromiumBridge.h"
+#if ENABLE(WEB_AUDIO)
+#include "AudioBus.h"
+#endif
+
+#include "FileSystem.h"
+#include "ImageSource.h"
+#include "LinkHash.h"
+#include "PassRefPtr.h"
+#include "PasteboardPrivate.h"
+#include "PluginData.h"
+
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+typedef struct NPObject NPObject;
+typedef struct _NPP NPP_t;
+typedef NPP_t* NPP;
+
+#if OS(DARWIN)
+typedef struct CGFont* CGFontRef;
+typedef uintptr_t ATSFontContainerRef;
+#ifdef __OBJC__
+@class NSFont;
+#else
+class NSFont;
+#endif
+#endif // OS(DARWIN)
+
+#if OS(WINDOWS)
+typedef struct HFONT__* HFONT;
+#endif
namespace WebCore {
-// FIXME: A better name for ChromiumBridge is PlatformBridge. Android already
-// uses PlatformBridge so the code that is shared among the Android and Chromium
-// ports is gradually moving towards using PlatformBridge. Once the Android
-// unforking is done, we will change the name of ChromiumBridge to PlatformBridge
-// and merge the two classes into one that will be shared by both ports.
-typedef ChromiumBridge PlatformBridge;
+class ClipboardData;
+class Color;
+class Cursor;
+class Document;
+class Frame;
+class GeolocationServiceBridge;
+class GeolocationServiceChromium;
+class GraphicsContext;
+class Image;
+class IDBFactoryBackendInterface;
+class IDBKey;
+class IntRect;
+class KURL;
+class SerializedScriptValue;
+class Widget;
+
+struct Cookie;
+struct FontRenderStyle;
+
+// An interface to the embedding layer, which has the ability to answer
+// questions about the system and so on...
+
+class PlatformBridge {
+public:
+ // Cache --------------------------------------------------------------
+ static void cacheMetadata(const KURL&, double responseTime, const Vector<char>&);
+
+ // Clipboard ----------------------------------------------------------
+ static bool clipboardIsFormatAvailable(PasteboardPrivate::ClipboardFormat, PasteboardPrivate::ClipboardBuffer);
+
+ static String clipboardReadPlainText(PasteboardPrivate::ClipboardBuffer);
+ static void clipboardReadHTML(PasteboardPrivate::ClipboardBuffer, String*, KURL*);
+
+ // Only the clipboardRead functions take a buffer argument because
+ // Chromium currently uses a different technique to write to alternate
+ // clipboard buffers.
+ static void clipboardWriteSelection(const String&, const KURL&, const String&, bool);
+ static void clipboardWritePlainText(const String&);
+ static void clipboardWriteURL(const KURL&, const String&);
+ static void clipboardWriteImage(NativeImagePtr, const KURL&, const String&);
+ static void clipboardWriteData(const String& type, const String& data, const String& metadata);
+
+ // Interface for handling copy and paste, drag and drop, and selection copy.
+ static HashSet<String> clipboardReadAvailableTypes(PasteboardPrivate::ClipboardBuffer, bool* containsFilenames);
+ static bool clipboardReadData(PasteboardPrivate::ClipboardBuffer, const String& type, String& data, String& metadata);
+ static Vector<String> clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer);
+
+ // Cookies ------------------------------------------------------------
+ static void setCookies(const Document*, const KURL&, const String& value);
+ static String cookies(const Document*, const KURL&);
+ static String cookieRequestHeaderFieldValue(const Document*, const KURL&);
+ static bool rawCookies(const Document*, const KURL&, Vector<Cookie>&);
+ static void deleteCookie(const Document*, const KURL&, const String& cookieName);
+ static bool cookiesEnabled(const Document*);
+
+ // DNS ----------------------------------------------------------------
+ static void prefetchDNS(const String& hostname);
+
+ // File ---------------------------------------------------------------
+ static void revealFolderInOS(const String&);
+ static bool fileExists(const String&);
+ static bool deleteFile(const String&);
+ static bool deleteEmptyDirectory(const String&);
+ static bool getFileSize(const String&, long long& result);
+ static bool getFileModificationTime(const String&, time_t& result);
+ static String directoryName(const String& path);
+ static String pathByAppendingComponent(const String& path, const String& component);
+ static bool makeAllDirectories(const String& path);
+ static String getAbsolutePath(const String&);
+ static bool isDirectory(const String&);
+ static KURL filePathToURL(const String&);
+ static PlatformFileHandle openFile(const String& path, FileOpenMode);
+ static void closeFile(PlatformFileHandle&);
+ static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin);
+ static bool truncateFile(PlatformFileHandle, long long offset);
+ static int readFromFile(PlatformFileHandle, char* data, int length);
+ static int writeToFile(PlatformFileHandle, const char* data, int length);
+
+ // Font ---------------------------------------------------------------
+#if OS(WINDOWS)
+ static bool ensureFontLoaded(HFONT);
+#endif
+#if OS(LINUX) || OS(FREEBSD)
+ static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
+ static String getFontFamilyForCharacters(const UChar*, size_t numCharacters);
+#endif
+#if OS(DARWIN)
+ static bool loadFont(NSFont* srcFont, ATSFontContainerRef* out);
+#endif
+
+ // Forms --------------------------------------------------------------
+ static void notifyFormStateChanged(const Document*);
+
+ // Databases ----------------------------------------------------------
+ // Returns a handle to the DB file and ooptionally a handle to its containing directory
+ static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags);
+ // Returns a SQLite code (SQLITE_OK = 0, on success)
+ static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false);
+ // Returns the attributes of the DB file
+ static long databaseGetFileAttributes(const String& vfsFileName);
+ // Returns the size of the DB file
+ static long long databaseGetFileSize(const String& vfsFileName);
+
+ // IndexedDB ----------------------------------------------------------
+ static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
+ static void idbShutdown();
+ // Extracts keyPath from values and returns the corresponding keys.
+ static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys);
+
+ // JavaScript ---------------------------------------------------------
+ static void notifyJSOutOfMemory(Frame*);
+ static bool allowScriptDespiteSettings(const KURL& documentURL);
+
+ // Keygen -------------------------------------------------------------
+ static String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challenge, const KURL&);
+
+ // Language -----------------------------------------------------------
+ static String computedDefaultLanguage();
+
+ // LayoutTestMode -----------------------------------------------------
+ static bool layoutTestMode();
+
+ // Memory -------------------------------------------------------------
+ // Returns the current space allocated for the pagefile, in MB.
+ // That is committed size for Windows and virtual memory size for POSIX
+ static int memoryUsageMB();
+
+ // Same as above, but always returns actual value, without any caches.
+ static int actualMemoryUsageMB();
+
+ // MimeType -----------------------------------------------------------
+ static bool isSupportedImageMIMEType(const String& mimeType);
+ static bool isSupportedJavaScriptMIMEType(const String& mimeType);
+ static bool isSupportedNonImageMIMEType(const String& mimeType);
+ static String mimeTypeForExtension(const String& fileExtension);
+ static String mimeTypeFromFile(const String& filePath);
+ static String preferredExtensionForMIMEType(const String& mimeType);
+
+ // Plugin -------------------------------------------------------------
+ static bool plugins(bool refresh, Vector<PluginInfo>*);
+ static NPObject* pluginScriptableObject(Widget*);
+ static bool popupsAllowed(NPP);
+
+ // Resources ----------------------------------------------------------
+ static PassRefPtr<Image> loadPlatformImageResource(const char* name);
+
+#if ENABLE(WEB_AUDIO)
+ static PassOwnPtr<AudioBus> loadPlatformAudioResource(const char* name, double sampleRate);
+ static PassOwnPtr<AudioBus> decodeAudioFileData(const char* data, size_t, double sampleRate);
+#endif
+
+ // Sandbox ------------------------------------------------------------
+ static bool sandboxEnabled();
+
+ // Screen -------------------------------------------------------------
+ static int screenDepth(Widget*);
+ static int screenDepthPerComponent(Widget*);
+ static bool screenIsMonochrome(Widget*);
+ static IntRect screenRect(Widget*);
+ static IntRect screenAvailableRect(Widget*);
+
+ // SharedTimers -------------------------------------------------------
+ static void setSharedTimerFiredFunction(void (*func)());
+ static void setSharedTimerFireTime(double);
+ static void stopSharedTimer();
+
+ // StatsCounters ------------------------------------------------------
+ static void decrementStatsCounter(const char* name);
+ static void incrementStatsCounter(const char* name);
+ static void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount);
+ static void histogramEnumeration(const char* name, int sample, int boundaryValue);
+
+ // Sudden Termination
+ static void suddenTerminationChanged(bool enabled);
+
+ // SystemTime ---------------------------------------------------------
+ static double currentTime();
+
+ // Theming ------------------------------------------------------------
+#if OS(WINDOWS)
+ static void paintButton(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&);
+ static void paintMenuList(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&);
+ static void paintScrollbarArrow(
+ GraphicsContext*, int state, int classicState, const IntRect&);
+ static void paintScrollbarThumb(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&);
+ static void paintScrollbarTrack(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&, const IntRect& alignRect);
+ static void paintSpinButton(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&);
+ static void paintTextField(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges);
+ static void paintTrackbar(
+ GraphicsContext*, int part, int state, int classicState, const IntRect&);
+ static void paintProgressBar(
+ GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds);
+#elif OS(LINUX)
+ // The UI part which is being accessed.
+ enum ThemePart {
+ // ScrollbarTheme parts
+ PartScrollbarDownArrow,
+ PartScrollbarLeftArrow,
+ PartScrollbarRightArrow,
+ PartScrollbarUpArrow,
+ PartScrollbarHorizontalThumb,
+ PartScrollbarVerticalThumb,
+ PartScrollbarHorizontalTrack,
+ PartScrollbarVerticalTrack,
+
+ // RenderTheme parts
+ PartCheckbox,
+ PartRadio,
+ PartButton,
+ PartTextField,
+ PartMenuList,
+ PartSliderTrack,
+ PartSliderThumb,
+ PartInnerSpinButton,
+ PartProgressBar
+ };
+
+ // The current state of the associated Part.
+ enum ThemePaintState {
+ StateDisabled,
+ StateHover,
+ StateNormal,
+ StatePressed
+ };
+
+ struct ScrollbarTrackExtraParams {
+ // The bounds of the entire track, as opposed to the part being painted.
+ int trackX;
+ int trackY;
+ int trackWidth;
+ int trackHeight;
+ };
+
+ struct ButtonExtraParams {
+ bool checked;
+ bool indeterminate; // Whether the button state is indeterminate.
+ bool isDefault; // Whether the button is default button.
+ unsigned backgroundColor;
+ };
+
+ struct TextFieldExtraParams {
+ bool isTextArea;
+ bool isListbox;
+ unsigned backgroundColor;
+ };
+
+ struct MenuListExtraParams {
+ int arrowX;
+ int arrowY;
+ unsigned backgroundColor;
+ };
+
+ struct SliderExtraParams {
+ bool vertical;
+ bool inDrag;
+ };
+
+ struct InnerSpinButtonExtraParams {
+ bool spinUp;
+ bool readOnly;
+ };
+
+ struct ProgressBarExtraParams {
+ bool determinate;
+ int valueRectX;
+ int valueRectY;
+ int valueRectWidth;
+ int valueRectHeight;
+ };
+
+ union ThemePaintExtraParams {
+ ScrollbarTrackExtraParams scrollbarTrack;
+ ButtonExtraParams button;
+ TextFieldExtraParams textField;
+ MenuListExtraParams menuList;
+ SliderExtraParams slider;
+ InnerSpinButtonExtraParams innerSpin;
+ ProgressBarExtraParams progressBar;
+ };
+
+ // Gets the size of the given theme part. For variable sized items
+ // like vertical scrollbar thumbs, the width will be the required width of
+ // the track while the height will be the minimum height.
+ static IntSize getThemePartSize(ThemePart);
+ // Paint the given the given theme part.
+ static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*);
+#elif OS(DARWIN)
+ enum ThemePaintState {
+ StateDisabled,
+ StateInactive,
+ StateActive,
+ StatePressed,
+ };
+
+ enum ThemePaintSize {
+ SizeRegular,
+ SizeSmall,
+ };
+
+ enum ThemePaintScrollbarOrientation {
+ ScrollbarOrientationHorizontal,
+ ScrollbarOrientationVertical,
+ };
+
+ enum ThemePaintScrollbarParent {
+ ScrollbarParentScrollView,
+ ScrollbarParentRenderLayer,
+ };
+
+ struct ThemePaintScrollbarInfo {
+ ThemePaintScrollbarOrientation orientation;
+ ThemePaintScrollbarParent parent;
+ int maxValue;
+ int currentValue;
+ int visibleSize;
+ int totalSize;
+ };
+
+ static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
+#endif
+
+ // Trace Event --------------------------------------------------------
+ static void traceEventBegin(const char* name, void*, const char* extra);
+ static void traceEventEnd(const char* name, void*, const char* extra);
+
+ // Visited links ------------------------------------------------------
+ static LinkHash visitedLinkHash(const UChar* url, unsigned length);
+ static LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL);
+ static bool isLinkVisited(LinkHash);
+};
} // namespace WebCore
-#endif // PlatformBridge_h
+#endif
diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
index e659ef5..35d5018 100644
--- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
+++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
@@ -31,34 +31,34 @@
#include "config.h"
#include "PlatformScreen.h"
-#include "ChromiumBridge.h"
#include "IntRect.h"
+#include "PlatformBridge.h"
namespace WebCore {
int screenDepth(Widget* widget)
{
- return ChromiumBridge::screenDepth(widget);
+ return PlatformBridge::screenDepth(widget);
}
int screenDepthPerComponent(Widget* widget)
{
- return ChromiumBridge::screenDepthPerComponent(widget);
+ return PlatformBridge::screenDepthPerComponent(widget);
}
bool screenIsMonochrome(Widget* widget)
{
- return ChromiumBridge::screenIsMonochrome(widget);
+ return PlatformBridge::screenIsMonochrome(widget);
}
FloatRect screenRect(Widget* widget)
{
- return ChromiumBridge::screenRect(widget);
+ return PlatformBridge::screenRect(widget);
}
FloatRect screenAvailableRect(Widget* widget)
{
- return ChromiumBridge::screenAvailableRect(widget);
+ return PlatformBridge::screenAvailableRect(widget);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
index bb45e79..075cef0 100644
--- a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -54,6 +54,7 @@
#include "ScrollbarTheme.h"
#include "StringTruncator.h"
#include "SystemTime.h"
+#include "TextRun.h"
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
diff --git a/Source/WebCore/platform/chromium/ReadableDataObject.cpp b/Source/WebCore/platform/chromium/ReadableDataObject.cpp
index 97c481b..dbf4739 100644
--- a/Source/WebCore/platform/chromium/ReadableDataObject.cpp
+++ b/Source/WebCore/platform/chromium/ReadableDataObject.cpp
@@ -31,10 +31,10 @@
#include "config.h"
#include "ReadableDataObject.h"
-#include "ChromiumBridge.h"
#include "ClipboardMimeTypes.h"
#include "Pasteboard.h"
#include "PasteboardPrivate.h"
+#include "PlatformBridge.h"
namespace WebCore {
@@ -80,19 +80,19 @@ String ReadableDataObject::getData(const String& type, bool& succeeded) const
Pasteboard::generalPasteboard()->isSelectionMode() ?
PasteboardPrivate::SelectionBuffer :
PasteboardPrivate::StandardBuffer;
- data = ChromiumBridge::clipboardReadPlainText(buffer);
+ data = PlatformBridge::clipboardReadPlainText(buffer);
} else if (type == mimeTypeTextHTML) {
PasteboardPrivate::ClipboardBuffer buffer =
Pasteboard::generalPasteboard()->isSelectionMode() ?
PasteboardPrivate::SelectionBuffer :
PasteboardPrivate::StandardBuffer;
KURL ignoredSourceURL;
- ChromiumBridge::clipboardReadHTML(buffer, &data, &ignoredSourceURL);
+ PlatformBridge::clipboardReadHTML(buffer, &data, &ignoredSourceURL);
}
succeeded = !data.isEmpty();
return data;
}
- succeeded = ChromiumBridge::clipboardReadData(
+ succeeded = PlatformBridge::clipboardReadData(
clipboardBuffer(m_clipboardType), type, data, ignoredMetadata);
return data;
}
@@ -101,7 +101,7 @@ String ReadableDataObject::urlTitle() const
{
String ignoredData;
String urlTitle;
- ChromiumBridge::clipboardReadData(
+ PlatformBridge::clipboardReadData(
clipboardBuffer(m_clipboardType), mimeTypeTextURIList, ignoredData, urlTitle);
return urlTitle;
}
@@ -110,7 +110,7 @@ KURL ReadableDataObject::htmlBaseUrl() const
{
String ignoredData;
String htmlBaseUrl;
- ChromiumBridge::clipboardReadData(
+ PlatformBridge::clipboardReadData(
clipboardBuffer(m_clipboardType), mimeTypeTextHTML, ignoredData, htmlBaseUrl);
return KURL(ParsedURLString, htmlBaseUrl);
}
@@ -123,7 +123,7 @@ bool ReadableDataObject::containsFilenames() const
Vector<String> ReadableDataObject::filenames() const
{
- return ChromiumBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType));
+ return PlatformBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType));
}
void ReadableDataObject::ensureTypeCacheInitialized() const
@@ -131,7 +131,7 @@ void ReadableDataObject::ensureTypeCacheInitialized() const
if (m_isTypeCacheInitialized)
return;
- m_types = ChromiumBridge::clipboardReadAvailableTypes(
+ m_types = PlatformBridge::clipboardReadAvailableTypes(
clipboardBuffer(m_clipboardType), &m_containsFilenames);
m_isTypeCacheInitialized = true;
}
diff --git a/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp b/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp
index 49d9517..6467764 100644
--- a/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp
+++ b/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "SSLKeyGenerator.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "PlatformString.h"
namespace WebCore {
@@ -51,7 +51,7 @@ String signedPublicKeyAndChallengeString(unsigned keySizeIndex,
const String& challengeString,
const KURL& url)
{
- return ChromiumBridge::signedPublicKeyAndChallengeString(keySizeIndex,
+ return PlatformBridge::signedPublicKeyAndChallengeString(keySizeIndex,
challengeString,
url);
}
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp
index 234d0ee..b23e625 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp
@@ -27,10 +27,10 @@
#include "config.h"
#include "ScrollbarThemeChromium.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "PlatformMouseEvent.h"
+#include "ScrollableArea.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
#include "ScrollbarThemeComposite.h"
// -----------------------------------------------------------------------------
@@ -110,7 +110,7 @@ void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, Scrollbar*
// Get the tickmarks for the frameview.
Vector<IntRect> tickmarks;
- scrollbar->client()->getTickmarks(tickmarks);
+ scrollbar->scrollableArea()->getTickmarks(tickmarks);
if (!tickmarks.size())
return;
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp
index ba10953..e173dff 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "ScrollbarThemeChromiumLinux.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "PlatformMouseEvent.h"
#include "Scrollbar.h"
@@ -46,22 +46,22 @@ ScrollbarTheme* ScrollbarTheme::nativeTheme()
int ScrollbarThemeChromiumLinux::scrollbarThickness(ScrollbarControlSize controlSize)
{
// Horiz and Vert scrollbars are the same thickness.
- IntSize scrollbarSize = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarVerticalTrack);
+ IntSize scrollbarSize = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarVerticalTrack);
return scrollbarSize.width();
}
void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart partType)
{
- ChromiumBridge::ThemePaintState state = scrollbar->hoveredPart() == partType ? ChromiumBridge::StateHover : ChromiumBridge::StateNormal;
+ PlatformBridge::ThemePaintState state = scrollbar->hoveredPart() == partType ? PlatformBridge::StateHover : PlatformBridge::StateNormal;
IntRect alignRect = trackRect(scrollbar, false);
- ChromiumBridge::ThemePaintExtraParams extraParams;
+ PlatformBridge::ThemePaintExtraParams extraParams;
extraParams.scrollbarTrack.trackX = alignRect.x();
extraParams.scrollbarTrack.trackY = alignRect.y();
extraParams.scrollbarTrack.trackWidth = alignRect.width();
extraParams.scrollbarTrack.trackHeight = alignRect.height();
- ChromiumBridge::paintThemePart(
+ PlatformBridge::paintThemePart(
gc,
- scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::PartScrollbarHorizontalTrack : ChromiumBridge::PartScrollbarVerticalTrack,
+ scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::PartScrollbarHorizontalTrack : PlatformBridge::PartScrollbarVerticalTrack,
state,
rect,
&extraParams);
@@ -69,52 +69,52 @@ void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, Scrollbar
void ScrollbarThemeChromiumLinux::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
{
- ChromiumBridge::ThemePart paintPart;
- ChromiumBridge::ThemePaintState state = ChromiumBridge::StateNormal;
+ PlatformBridge::ThemePart paintPart;
+ PlatformBridge::ThemePaintState state = PlatformBridge::StateNormal;
bool checkMin = false;
bool checkMax = false;
if (scrollbar->orientation() == HorizontalScrollbar) {
if (part == BackButtonStartPart) {
- paintPart = ChromiumBridge::PartScrollbarLeftArrow;
+ paintPart = PlatformBridge::PartScrollbarLeftArrow;
checkMin = true;
} else {
- paintPart = ChromiumBridge::PartScrollbarRightArrow;
+ paintPart = PlatformBridge::PartScrollbarRightArrow;
checkMax = true;
}
} else {
if (part == BackButtonStartPart) {
- paintPart = ChromiumBridge::PartScrollbarUpArrow;
+ paintPart = PlatformBridge::PartScrollbarUpArrow;
checkMin = true;
} else {
- paintPart = ChromiumBridge::PartScrollbarDownArrow;
+ paintPart = PlatformBridge::PartScrollbarDownArrow;
checkMax = true;
}
}
if ((checkMin && (scrollbar->currentPos() <= 0))
|| (checkMax && scrollbar->currentPos() == scrollbar->maximum())) {
- state = ChromiumBridge::StateDisabled;
+ state = PlatformBridge::StateDisabled;
} else {
if (part == scrollbar->pressedPart())
- state = ChromiumBridge::StatePressed;
+ state = PlatformBridge::StatePressed;
else if (part == scrollbar->hoveredPart())
- state = ChromiumBridge::StateHover;
+ state = PlatformBridge::StateHover;
}
- ChromiumBridge::paintThemePart(gc, paintPart, state, rect, 0);
+ PlatformBridge::paintThemePart(gc, paintPart, state, rect, 0);
}
void ScrollbarThemeChromiumLinux::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect)
{
- ChromiumBridge::ThemePaintState state;
+ PlatformBridge::ThemePaintState state;
if (scrollbar->pressedPart() == ThumbPart)
- state = ChromiumBridge::StatePressed;
+ state = PlatformBridge::StatePressed;
else if (scrollbar->hoveredPart() == ThumbPart)
- state = ChromiumBridge::StateHover;
+ state = PlatformBridge::StateHover;
else
- state = ChromiumBridge::StateNormal;
- ChromiumBridge::paintThemePart(
+ state = PlatformBridge::StateNormal;
+ PlatformBridge::paintThemePart(
gc,
- scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::PartScrollbarHorizontalThumb : ChromiumBridge::PartScrollbarVerticalThumb,
+ scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::PartScrollbarHorizontalThumb : PlatformBridge::PartScrollbarVerticalThumb,
state,
rect,
0);
@@ -128,23 +128,23 @@ bool ScrollbarThemeChromiumLinux::shouldCenterOnThumb(Scrollbar*, const Platform
IntSize ScrollbarThemeChromiumLinux::buttonSize(Scrollbar* scrollbar)
{
if (scrollbar->orientation() == VerticalScrollbar) {
- IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarUpArrow);
+ IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarUpArrow);
return IntSize(size.width(), scrollbar->height() < 2 * size.height() ? scrollbar->height() / 2 : size.height());
}
// HorizontalScrollbar
- IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarLeftArrow);
+ IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarLeftArrow);
return IntSize(scrollbar->width() < 2 * size.width() ? scrollbar->width() / 2 : size.width(), size.height());
}
int ScrollbarThemeChromiumLinux::minimumThumbLength(Scrollbar* scrollbar)
{
if (scrollbar->orientation() == VerticalScrollbar) {
- IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarVerticalThumb);
+ IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarVerticalThumb);
return size.height();
}
- IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarHorizontalThumb);
+ IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarHorizontalThumb);
return size.width();
}
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
index 0aa3e10..fe1a422 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
@@ -27,9 +27,9 @@
#include "config.h"
#include "ScrollbarThemeChromiumMac.h"
-#include "ChromiumBridge.h"
#include "FrameView.h"
#include "ImageBuffer.h"
+#include "PlatformBridge.h"
#include "PlatformMouseEvent.h"
#include "ScrollView.h"
#include <Carbon/Carbon.h>
@@ -370,15 +370,15 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part)
}
}
-static ChromiumBridge::ThemePaintState scrollbarStateToThemeState(Scrollbar* scrollbar) {
+static PlatformBridge::ThemePaintState scrollbarStateToThemeState(Scrollbar* scrollbar) {
if (!scrollbar->enabled())
- return ChromiumBridge::StateDisabled;
- if (!scrollbar->client()->isActive())
- return ChromiumBridge::StateInactive;
+ return PlatformBridge::StateDisabled;
+ if (!scrollbar->scrollableArea()->isActive())
+ return PlatformBridge::StateInactive;
if (scrollbar->pressedPart() == ThumbPart)
- return ChromiumBridge::StatePressed;
+ return PlatformBridge::StatePressed;
- return ChromiumBridge::StateActive;
+ return PlatformBridge::StateActive;
}
bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect)
@@ -398,7 +398,7 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con
if (!scrollbar->enabled())
trackInfo.enableState = kThemeTrackDisabled;
else
- trackInfo.enableState = scrollbar->client()->isActive() ? kThemeTrackActive : kThemeTrackInactive;
+ trackInfo.enableState = scrollbar->scrollableArea()->isActive() ? kThemeTrackActive : kThemeTrackInactive;
if (!hasButtons(scrollbar))
trackInfo.enableState = kThemeTrackNothingToScroll;
@@ -428,7 +428,7 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con
HIThemeDrawTrack(&trackInfo, 0, drawingContext->platformContext(), kHIThemeOrientationNormal);
Vector<IntRect> tickmarks;
- scrollbar->client()->getTickmarks(tickmarks);
+ scrollbar->scrollableArea()->getTickmarks(tickmarks);
if (scrollbar->orientation() == VerticalScrollbar && tickmarks.size()) {
drawingContext->save();
drawingContext->setShouldAntialias(false);
@@ -463,18 +463,18 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con
}
if (hasThumb(scrollbar)) {
- ChromiumBridge::ThemePaintScrollbarInfo scrollbarInfo;
- scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::ScrollbarOrientationHorizontal : ChromiumBridge::ScrollbarOrientationVertical;
- scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? ChromiumBridge::ScrollbarParentScrollView : ChromiumBridge::ScrollbarParentRenderLayer;
+ PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo;
+ scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::ScrollbarOrientationVertical;
+ scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::ScrollbarParentRenderLayer;
scrollbarInfo.maxValue = scrollbar->maximum();
scrollbarInfo.currentValue = scrollbar->currentPos();
scrollbarInfo.visibleSize = scrollbar->visibleSize();
scrollbarInfo.totalSize = scrollbar->totalSize();
- ChromiumBridge::paintScrollbarThumb(
+ PlatformBridge::paintScrollbarThumb(
drawingContext,
scrollbarStateToThemeState(scrollbar),
- scrollbar->controlSize() == RegularScrollbar ? ChromiumBridge::SizeRegular : ChromiumBridge::SizeSmall,
+ scrollbar->controlSize() == RegularScrollbar ? PlatformBridge::SizeRegular : PlatformBridge::SizeSmall,
scrollbar->frameRect(),
scrollbarInfo);
}
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp
index ba7e97b..29e8b44 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp
@@ -30,8 +30,8 @@
#include <windows.h>
#include <vsstyle.h>
-#include "ChromiumBridge.h"
#include "GraphicsContext.h"
+#include "PlatformBridge.h"
#include "PlatformContextSkia.h"
#include "PlatformMouseEvent.h"
#include "Scrollbar.h"
@@ -61,7 +61,7 @@ int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSi
{
static int thickness;
if (!thickness) {
- if (ChromiumBridge::layoutTestMode())
+ if (PlatformBridge::layoutTestMode())
return kMacScrollbarSize[controlSize];
thickness = GetSystemMetrics(SM_CXVSCROLL);
}
@@ -104,7 +104,7 @@ void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, Scrollbar*
IntRect alignRect = trackRect(scrollbar, false);
// Draw the track area before/after the thumb on the scroll bar.
- ChromiumBridge::paintScrollbarTrack(
+ PlatformBridge::paintScrollbarTrack(
gc,
partId,
getThemeState(scrollbar, partType),
@@ -124,7 +124,7 @@ void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, Scrollbar* scro
partId = horz ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN;
// Draw the thumb (the box you drag in the scroll bar to scroll).
- ChromiumBridge::paintScrollbarArrow(
+ PlatformBridge::paintScrollbarArrow(
gc,
getThemeArrowState(scrollbar, part),
partId | getClassicThemeState(scrollbar, part),
@@ -136,7 +136,7 @@ void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrol
bool horz = scrollbar->orientation() == HorizontalScrollbar;
// Draw the thumb (the box you drag in the scroll bar to scroll).
- ChromiumBridge::paintScrollbarThumb(
+ PlatformBridge::paintScrollbarThumb(
gc,
horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT,
getThemeState(scrollbar, ThumbPart),
@@ -144,7 +144,7 @@ void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrol
rect);
// Draw the gripper (the three little lines on the thumb).
- ChromiumBridge::paintScrollbarThumb(
+ PlatformBridge::paintScrollbarThumb(
gc,
horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT,
getThemeState(scrollbar, ThumbPart),
@@ -256,7 +256,7 @@ IntSize ScrollbarThemeChromiumWin::buttonSize(Scrollbar* scrollbar)
// test mode so that should be enough to result in repeatable results, but
// preserving this hack avoids having to rebaseline pixel tests.
const int kLayoutTestModeGirth = 17;
- int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness;
+ int girth = PlatformBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness;
if (scrollbar->orientation() == HorizontalScrollbar) {
int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth;
diff --git a/Source/WebCore/platform/chromium/SharedTimerChromium.cpp b/Source/WebCore/platform/chromium/SharedTimerChromium.cpp
index 5a6a000..5acb253 100644
--- a/Source/WebCore/platform/chromium/SharedTimerChromium.cpp
+++ b/Source/WebCore/platform/chromium/SharedTimerChromium.cpp
@@ -26,23 +26,23 @@
#include "config.h"
#include "SharedTimer.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
namespace WebCore {
void setSharedTimerFiredFunction(void (*f)())
{
- ChromiumBridge::setSharedTimerFiredFunction(f);
+ PlatformBridge::setSharedTimerFiredFunction(f);
}
void setSharedTimerFireTime(double fireTime)
{
- ChromiumBridge::setSharedTimerFireTime(fireTime);
+ PlatformBridge::setSharedTimerFireTime(fireTime);
}
void stopSharedTimer()
{
- ChromiumBridge::stopSharedTimer();
+ PlatformBridge::stopSharedTimer();
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp b/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp
index 54b8304..06cc738 100644
--- a/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp
+++ b/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp
@@ -1,48 +1,48 @@
-/*
- * Copyright (C) 2009 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "SuddenTermination.h"
-
-#include "ChromiumBridge.h"
-
-namespace WebCore {
-
-void disableSuddenTermination()
-{
- ChromiumBridge::suddenTerminationChanged(false);
-}
-
-void enableSuddenTermination()
-{
- ChromiumBridge::suddenTerminationChanged(true);
-}
-
-} // namespace WebCore
+/*
+ * Copyright (C) 2009 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#include "config.h"
+#include "SuddenTermination.h"
+
+#include "PlatformBridge.h"
+
+namespace WebCore {
+
+void disableSuddenTermination()
+{
+ PlatformBridge::suddenTerminationChanged(false);
+}
+
+void enableSuddenTermination()
+{
+ PlatformBridge::suddenTerminationChanged(true);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/SystemTimeChromium.cpp b/Source/WebCore/platform/chromium/SystemTimeChromium.cpp
index 52ac262..93ac8b1 100644
--- a/Source/WebCore/platform/chromium/SystemTimeChromium.cpp
+++ b/Source/WebCore/platform/chromium/SystemTimeChromium.cpp
@@ -31,15 +31,15 @@
#include "config.h"
#include "SystemTime.h"
-#include "ChromiumBridge.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
namespace WebCore {
// Get the current time in seconds since epoch.
double currentTime()
{
- return ChromiumBridge::currentTime();
+ return PlatformBridge::currentTime();
}
float userIdleTime()
diff --git a/Source/WebCore/platform/chromium/WidgetChromium.cpp b/Source/WebCore/platform/chromium/WidgetChromium.cpp
index 1b7fef4..ac52244 100644
--- a/Source/WebCore/platform/chromium/WidgetChromium.cpp
+++ b/Source/WebCore/platform/chromium/WidgetChromium.cpp
@@ -32,7 +32,8 @@
#include "Widget.h"
#include "Assertions.h"
-#include "ChromiumBridge.h"
+#include "HostWindow.h"
+#include "ScrollView.h"
namespace WebCore {
@@ -56,7 +57,9 @@ void Widget::hide()
void Widget::setCursor(const Cursor& cursor)
{
- ChromiumBridge::widgetSetCursor(this, cursor);
+ ScrollView* view = root();
+ if (view)
+ view->hostWindow()->setCursor(cursor);
}
void Widget::paint(GraphicsContext*, const IntRect&)
diff --git a/Source/WebCore/platform/chromium/WritableDataObject.cpp b/Source/WebCore/platform/chromium/WritableDataObject.cpp
index 7cbf42c..a1ac7d9 100644
--- a/Source/WebCore/platform/chromium/WritableDataObject.cpp
+++ b/Source/WebCore/platform/chromium/WritableDataObject.cpp
@@ -31,8 +31,8 @@
#include "config.h"
#include "WritableDataObject.h"
-#include "ChromiumBridge.h"
#include "ClipboardMimeTypes.h"
+#include "PlatformBridge.h"
namespace WebCore {
@@ -80,7 +80,7 @@ bool WritableDataObject::setData(const String& type, const String& data)
// FIXME: This is currently unimplemented on the Chromium-side. This is
// "okay" for now since the original implementation didn't support it
// anyway. Going forward, this is something we'll need to fix though.
- ChromiumBridge::clipboardWriteData(type, data, "");
+ PlatformBridge::clipboardWriteData(type, data, "");
return true;
}
m_dataMap.set(type, data);
diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.cpp b/Source/WebCore/platform/efl/ScrollbarEfl.cpp
index 282ca7c..e71d1e3 100644
--- a/Source/WebCore/platform/efl/ScrollbarEfl.cpp
+++ b/Source/WebCore/platform/efl/ScrollbarEfl.cpp
@@ -42,13 +42,13 @@
using namespace std;
using namespace WebCore;
-PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
{
- return adoptRef(new ScrollbarEfl(client, orientation, size));
+ return adoptRef(new ScrollbarEfl(scrollableArea, orientation, size));
}
-ScrollbarEfl::ScrollbarEfl(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
- : Scrollbar(client, orientation, controlSize)
+ScrollbarEfl::ScrollbarEfl(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
+ : Scrollbar(scrollableArea, orientation, controlSize)
, m_lastPos(0)
, m_lastTotalSize(0)
, m_lastVisibleSize(0)
@@ -84,7 +84,7 @@ static void scrollbarEflEdjeMessage(void* data, Evas_Object* o, Edje_Message_Typ
m = static_cast<Edje_Message_Float*>(msg);
v = m->val * (that->totalSize() - that->visibleSize());
- that->setValue(v, Scrollbar::NotFromScrollAnimator);
+ that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), v);
}
void ScrollbarEfl::setParent(ScrollView* view)
diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.h b/Source/WebCore/platform/efl/ScrollbarEfl.h
index 35375a6..09dc64f 100644
--- a/Source/WebCore/platform/efl/ScrollbarEfl.h
+++ b/Source/WebCore/platform/efl/ScrollbarEfl.h
@@ -52,7 +52,7 @@ public:
virtual void paint(GraphicsContext* context, const IntRect& damageRect);
protected:
- ScrollbarEfl(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ ScrollbarEfl(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize);
virtual void updateThumbPositionAndProportion();
virtual void updateThumbPosition();
diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
index 64f19c4..f416b47 100644
--- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
+++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
@@ -28,29 +28,53 @@
#if ENABLE(3D_CANVAS)
#include "ANGLEWebKitBridge.h"
+#include <wtf/OwnArrayPtr.h>
namespace WebCore {
ANGLEWebKitBridge::ANGLEWebKitBridge() :
- builtCompilers(false)
+ builtCompilers(false),
+ m_fragmentCompiler(0),
+ m_vertexCompiler(0)
{
ShInitialize();
}
ANGLEWebKitBridge::~ANGLEWebKitBridge()
{
- if (builtCompilers) {
+ cleanupCompilers();
+}
+
+void ANGLEWebKitBridge::cleanupCompilers()
+{
+ if (m_fragmentCompiler)
ShDestruct(m_fragmentCompiler);
+ m_fragmentCompiler = 0;
+ if (m_vertexCompiler)
ShDestruct(m_vertexCompiler);
- }
+ m_vertexCompiler = 0;
+
+ builtCompilers = false;
+}
+
+void ANGLEWebKitBridge::setResources(ShBuiltInResources resources)
+{
+ // Resources are (possibly) changing - cleanup compilers if we had them already
+ cleanupCompilers();
+
+ m_resources = resources;
}
bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog)
{
if (!builtCompilers) {
- m_fragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecWebGL, &m_resources);
- m_vertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecWebGL, &m_resources);
+ m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, &m_resources);
+ m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, &m_resources);
+ if (!m_fragmentCompiler || !m_vertexCompiler) {
+ cleanupCompilers();
+ return false;
+ }
builtCompilers = true;
}
@@ -64,12 +88,31 @@ bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShad
const char* const shaderSourceStrings[] = { shaderSource };
- bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, EShOptNone, EDebugOpIntermediate);
+ bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE);
+ if (!validateSuccess) {
+ int logSize = 0;
+ ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &logSize);
+ if (logSize > 1) {
+ OwnArrayPtr<char> logBuffer(new char[logSize]);
+ if (logBuffer) {
+ ShGetInfoLog(compiler, logBuffer.get());
+ shaderValidationLog = logBuffer.get();
+ }
+ }
+ return false;
+ }
- translatedShaderSource = ShGetObjectCode(compiler);
- shaderValidationLog = ShGetInfoLog(compiler);
+ int translationLength = 0;
+ ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &translationLength);
+ if (translationLength > 1) {
+ OwnArrayPtr<char> translationBuffer(new char[translationLength]);
+ if (!translationBuffer)
+ return false;
+ ShGetObjectCode(compiler, translationBuffer.get());
+ translatedShaderSource = translationBuffer.get();
+ }
- return validateSuccess;
+ return true;
}
}
diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
index d01de8f..7bddbf4 100644
--- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
+++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
@@ -34,8 +34,8 @@
namespace WebCore {
enum ANGLEShaderType {
- SHADER_TYPE_VERTEX = EShLangVertex,
- SHADER_TYPE_FRAGMENT = EShLangFragment
+ SHADER_TYPE_VERTEX = SH_VERTEX_SHADER,
+ SHADER_TYPE_FRAGMENT = SH_FRAGMENT_SHADER,
};
class ANGLEWebKitBridge {
@@ -44,18 +44,21 @@ public:
ANGLEWebKitBridge();
~ANGLEWebKitBridge();
- void setResources(TBuiltInResource resources) { m_resources = resources; }
+ ShBuiltInResources getResources() { return m_resources; }
+ void setResources(ShBuiltInResources);
bool validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog);
private:
- ShHandle m_fragmentCompiler;
- ShHandle m_vertexCompiler;
+ void cleanupCompilers();
bool builtCompilers;
+
+ ShHandle m_fragmentCompiler;
+ ShHandle m_vertexCompiler;
- TBuiltInResource m_resources;
+ ShBuiltInResources m_resources;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h
index 72f3092..93fc464 100644
--- a/Source/WebCore/platform/graphics/BitmapImage.h
+++ b/Source/WebCore/platform/graphics/BitmapImage.h
@@ -68,7 +68,9 @@ template <typename T> class Timer;
// FrameData Class
// ================================================
-struct FrameData : Noncopyable {
+struct FrameData {
+ WTF_MAKE_NONCOPYABLE(FrameData);
+public:
FrameData()
: m_frame(0)
, m_haveMetadata(false)
diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h
index fa37d32..2a03238 100644
--- a/Source/WebCore/platform/graphics/Color.h
+++ b/Source/WebCore/platform/graphics/Color.h
@@ -78,7 +78,8 @@ inline int greenChannel(RGBA32 color) { return (color >> 8) & 0xFF; }
inline int blueChannel(RGBA32 color) { return color & 0xFF; }
inline int alphaChannel(RGBA32 color) { return (color >> 24) & 0xFF; }
-class Color : public FastAllocBase {
+class Color {
+ WTF_MAKE_FAST_ALLOCATED;
public:
Color() : m_color(0), m_valid(false) { }
Color(RGBA32 col) : m_color(col), m_valid(true) { }
diff --git a/Source/WebCore/platform/graphics/Extensions3D.h b/Source/WebCore/platform/graphics/Extensions3D.h
index 0363a48..1a2b7a1 100644
--- a/Source/WebCore/platform/graphics/Extensions3D.h
+++ b/Source/WebCore/platform/graphics/Extensions3D.h
@@ -51,6 +51,7 @@ public:
// GL_EXT_packed_depth_stencil / GL_OES_packed_depth_stencil
// GL_ANGLE_framebuffer_blit / GL_ANGLE_framebuffer_multisample
// GL_OES_texture_float
+ // GL_OES_standard_derivatives
// Takes full name of extension; for example,
// "GL_EXT_texture_format_BGRA8888".
@@ -82,7 +83,10 @@ public:
// GL_ANGLE_framebuffer_multisample names
RENDERBUFFER_SAMPLES = 0x8CAB,
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56,
- MAX_SAMPLES = 0x8D57
+ MAX_SAMPLES = 0x8D57,
+
+ // GL_OES_standard_derivatives names
+ FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B,
};
// GL_ARB_robustness
diff --git a/Source/WebCore/platform/graphics/FloatPoint.cpp b/Source/WebCore/platform/graphics/FloatPoint.cpp
index 7e85b52..226ae71 100644
--- a/Source/WebCore/platform/graphics/FloatPoint.cpp
+++ b/Source/WebCore/platform/graphics/FloatPoint.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "FloatPoint.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "FloatConversion.h"
#include "IntPoint.h"
diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp
index 887e21d..394de35 100644
--- a/Source/WebCore/platform/graphics/Font.cpp
+++ b/Source/WebCore/platform/graphics/Font.cpp
@@ -29,6 +29,7 @@
#include "FontTranscoder.h"
#include "IntPoint.h"
#include "GlyphBuffer.h"
+#include "TextRun.h"
#include "WidthIterator.h"
#include <wtf/MathExtras.h>
#include <wtf/UnusedParam.h>
diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h
index 40a8828..2957c0a 100644
--- a/Source/WebCore/platform/graphics/Font.h
+++ b/Source/WebCore/platform/graphics/Font.h
@@ -29,7 +29,6 @@
#include "FontDescription.h"
#include "FontFallbackList.h"
#include "SimpleFontData.h"
-#include "TextRun.h"
#include "TypesettingFeatures.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
@@ -51,6 +50,7 @@ class GlyphBuffer;
class GlyphPageTreeNode;
class GraphicsContext;
class SVGFontElement;
+class TextRun;
struct GlyphData;
diff --git a/Source/WebCore/platform/graphics/FontCache.cpp b/Source/WebCore/platform/graphics/FontCache.cpp
index 149ea79..cfca980 100644
--- a/Source/WebCore/platform/graphics/FontCache.cpp
+++ b/Source/WebCore/platform/graphics/FontCache.cpp
@@ -53,7 +53,9 @@ FontCache::FontCache()
{
}
-struct FontPlatformDataCacheKey : FastAllocBase {
+struct FontPlatformDataCacheKey {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false,
bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal)
: m_size(size)
diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h
index e6845d9..86f8c67 100644
--- a/Source/WebCore/platform/graphics/FontCache.h
+++ b/Source/WebCore/platform/graphics/FontCache.h
@@ -50,7 +50,8 @@ class FontDescription;
class FontSelector;
class SimpleFontData;
-class FontCache : public Noncopyable {
+class FontCache {
+ WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED;
public:
friend FontCache* fontCache();
diff --git a/Source/WebCore/platform/graphics/FontData.h b/Source/WebCore/platform/graphics/FontData.h
index ee94a98..3d35d2a 100644
--- a/Source/WebCore/platform/graphics/FontData.h
+++ b/Source/WebCore/platform/graphics/FontData.h
@@ -26,6 +26,7 @@
#ifndef FontData_h
#define FontData_h
+#include <wtf/FastAllocBase.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/unicode/Unicode.h>
@@ -34,7 +35,8 @@ namespace WebCore {
class SimpleFontData;
-class FontData : public Noncopyable {
+class FontData {
+ WTF_MAKE_NONCOPYABLE(FontData); WTF_MAKE_FAST_ALLOCATED;
public:
FontData()
: m_maxGlyphPageTreeLevel(0)
diff --git a/Source/WebCore/platform/graphics/FontFastPath.cpp b/Source/WebCore/platform/graphics/FontFastPath.cpp
index 367c8a2..f927c13 100644
--- a/Source/WebCore/platform/graphics/FontFastPath.cpp
+++ b/Source/WebCore/platform/graphics/FontFastPath.cpp
@@ -30,6 +30,7 @@
#include "GlyphBuffer.h"
#include "GlyphPageTreeNode.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include "WidthIterator.h"
#include <wtf/MathExtras.h>
diff --git a/Source/WebCore/platform/graphics/GlyphMetricsMap.h b/Source/WebCore/platform/graphics/GlyphMetricsMap.h
index fa85bcc..3e13fbb 100644
--- a/Source/WebCore/platform/graphics/GlyphMetricsMap.h
+++ b/Source/WebCore/platform/graphics/GlyphMetricsMap.h
@@ -40,7 +40,8 @@ typedef unsigned short Glyph;
const float cGlyphSizeUnknown = -1;
-template<class T> class GlyphMetricsMap : public Noncopyable {
+template<class T> class GlyphMetricsMap {
+ WTF_MAKE_NONCOPYABLE(GlyphMetricsMap);
public:
GlyphMetricsMap() : m_filledPrimaryPage(false) { }
~GlyphMetricsMap()
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
index c9c1f63..9f94ac9 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
@@ -31,6 +31,8 @@
#include "Generator.h"
#include "ImageBuffer.h"
#include "IntRect.h"
+#include "RoundedIntRect.h"
+#include "TextRun.h"
using namespace std;
@@ -536,25 +538,23 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorS
image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale);
}
-void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
- const IntSize& bottomLeft, const IntSize& bottomRight)
+void GraphicsContext::addRoundedRectClip(const RoundedIntRect& rect)
{
if (paintingDisabled())
return;
Path path;
- path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
+ path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());
clip(path);
}
-void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
- const IntSize& bottomLeft, const IntSize& bottomRight)
+void GraphicsContext::clipOutRoundedRect(const RoundedIntRect& rect)
{
if (paintingDisabled())
return;
Path path;
- path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
+ path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());
clipOut(path);
}
@@ -585,6 +585,11 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator)
generator.fill(this, rect);
}
+void GraphicsContext::fillRoundedRect(const RoundedIntRect& rect, const Color& color, ColorSpace colorSpace)
+{
+ fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
+}
+
void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation)
{
m_state.compositeOperator = compositeOperation;
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h
index a648680..77321e2 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext.h
@@ -128,6 +128,7 @@ namespace WebCore {
class GraphicsContextPlatformPrivate;
class ImageBuffer;
class IntRect;
+ class RoundedIntRect;
class KURL;
class SharedGraphicsContext3D;
class TextRun;
@@ -213,7 +214,8 @@ namespace WebCore {
bool shadowsIgnoreTransforms : 1;
};
- class GraphicsContext : public Noncopyable {
+ class GraphicsContext {
+ WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
public:
GraphicsContext(PlatformGraphicsContext*);
~GraphicsContext();
@@ -317,6 +319,7 @@ namespace WebCore {
void fillRect(const FloatRect&, const Color&, ColorSpace);
void fillRect(const FloatRect&, Generator&);
void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace);
+ void fillRoundedRect(const RoundedIntRect&, const Color&, ColorSpace);
void clearRect(const FloatRect&);
@@ -345,10 +348,10 @@ namespace WebCore {
InterpolationQuality imageInterpolationQuality() const;
void clip(const FloatRect&);
- void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
+ void addRoundedRectClip(const RoundedIntRect&);
void addInnerRoundedRectClip(const IntRect&, int thickness);
void clipOut(const IntRect&);
- void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
+ void clipOutRoundedRect(const RoundedIntRect&);
void clipPath(const Path&, WindRule);
void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
void clipToImageBuffer(ImageBuffer*, const FloatRect&);
@@ -457,7 +460,8 @@ namespace WebCore {
void setShouldIncludeChildWindows(bool);
bool shouldIncludeChildWindows() const;
- class WindowsBitmap : public Noncopyable {
+ class WindowsBitmap {
+ WTF_MAKE_NONCOPYABLE(WindowsBitmap);
public:
WindowsBitmap(HDC, IntSize);
~WindowsBitmap();
diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h
index 10aa0d7..24827e5 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h
@@ -883,6 +883,7 @@ public:
} ShaderSourceEntry;
HashMap<Platform3DObject, ShaderSourceEntry> m_shaderSourceMap;
+ friend class Extensions3DOpenGL;
ANGLEWebKitBridge m_compiler;
OwnPtr<Extensions3DOpenGL> m_extensions;
diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h
index 8943f6c..e3a62b6 100644
--- a/Source/WebCore/platform/graphics/GraphicsLayer.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h
@@ -100,7 +100,8 @@ class TimingFunction;
// Base class for animation values (also used for transitions). Here to
// represent values for properties being animated via the GraphicsLayer,
// without pulling in style-related data from outside of the platform directory.
-class AnimationValue : public Noncopyable {
+class AnimationValue {
+ WTF_MAKE_NONCOPYABLE(AnimationValue); WTF_MAKE_FAST_ALLOCATED;
public:
AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0)
: m_keyTime(keyTime)
@@ -152,7 +153,8 @@ private:
// Used to store a series of values in a keyframe list. Values will all be of the same type,
// which can be inferred from the property.
-class KeyframeValueList : public Noncopyable {
+class KeyframeValueList {
+ WTF_MAKE_NONCOPYABLE(KeyframeValueList); WTF_MAKE_FAST_ALLOCATED;
public:
KeyframeValueList(AnimatedPropertyID property)
@@ -184,8 +186,8 @@ protected:
// which may have associated transformation and animations.
class GraphicsLayer {
+ WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
public:
-
static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*);
virtual ~GraphicsLayer();
diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h
index 338e3f8..48878da 100644
--- a/Source/WebCore/platform/graphics/ImageBuffer.h
+++ b/Source/WebCore/platform/graphics/ImageBuffer.h
@@ -31,7 +31,7 @@
#include "AffineTransform.h"
#include "ColorSpace.h"
#include "FloatRect.h"
-#include "Image.h"
+#include "GraphicsTypes.h"
#include "IntSize.h"
#include "ImageBufferData.h"
#include <wtf/ByteArray.h>
@@ -39,6 +39,7 @@
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
#if (PLATFORM(MAC) && PLATFORM(CA) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
#define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1
@@ -47,6 +48,7 @@
namespace WebCore {
class GraphicsContext;
+ class Image;
class ImageData;
class IntPoint;
class IntRect;
@@ -61,7 +63,8 @@ namespace WebCore {
Accelerated
};
- class ImageBuffer : public Noncopyable {
+ class ImageBuffer {
+ WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
public:
// Will return a null pointer on allocation failure.
static PassOwnPtr<ImageBuffer> create(const IntSize& size, ColorSpace colorSpace = ColorSpaceDeviceRGB, RenderingMode renderingMode = Unaccelerated)
@@ -79,6 +82,8 @@ namespace WebCore {
int width() const { return m_size.width(); }
int height() const { return m_size.height(); }
+ size_t dataSize() const;
+
GraphicsContext* context() const;
bool drawsUsingCopy() const; // If the image buffer has to render using a copied image, it will return true.
diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h
index 1452b71..70b2cf5 100644
--- a/Source/WebCore/platform/graphics/ImageSource.h
+++ b/Source/WebCore/platform/graphics/ImageSource.h
@@ -136,7 +136,8 @@ const int cAnimationLoopOnce = 0;
const int cAnimationLoopInfinite = -1;
const int cAnimationNone = -2;
-class ImageSource : public Noncopyable {
+class ImageSource {
+ WTF_MAKE_NONCOPYABLE(ImageSource);
public:
enum AlphaOption {
AlphaPremultiplied,
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp
index 4a39e9e..60f55a5 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp
@@ -150,7 +150,9 @@ static MediaPlayerPrivateInterface* createNullMediaPlayer(MediaPlayer* player)
// engine support
-struct MediaPlayerFactory : Noncopyable {
+struct MediaPlayerFactory {
+ WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED;
+public:
MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs)
: constructor(constructor)
, getSupportedTypes(getSupportedTypes)
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h
index 6525ca6..ef0b3eb 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.h
+++ b/Source/WebCore/platform/graphics/MediaPlayer.h
@@ -149,7 +149,8 @@ public:
#endif
};
-class MediaPlayer : public Noncopyable {
+class MediaPlayer {
+ WTF_MAKE_NONCOPYABLE(MediaPlayer); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<MediaPlayer> create(MediaPlayerClient* client)
diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
index d956286..6abe258 100644
--- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -36,8 +36,10 @@ namespace WebCore {
class IntRect;
class IntSize;
-class MediaPlayerPrivateInterface : public Noncopyable {
+class MediaPlayerPrivateInterface {
+ WTF_MAKE_NONCOPYABLE(MediaPlayerPrivateInterface); WTF_MAKE_FAST_ALLOCATED;
public:
+ MediaPlayerPrivateInterface() { }
virtual ~MediaPlayerPrivateInterface() { }
virtual void load(const String& url) = 0;
diff --git a/Source/WebCore/platform/graphics/Path.h b/Source/WebCore/platform/graphics/Path.h
index 423a792..852d88e 100644
--- a/Source/WebCore/platform/graphics/Path.h
+++ b/Source/WebCore/platform/graphics/Path.h
@@ -100,7 +100,8 @@ namespace WebCore {
typedef void (*PathApplierFunction)(void* info, const PathElement*);
- class Path : public FastAllocBase {
+ class Path {
+ WTF_MAKE_FAST_ALLOCATED;
public:
Path();
~Path();
diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.cpp b/Source/WebCore/platform/graphics/RoundedIntRect.cpp
new file mode 100644
index 0000000..4e80c9a
--- /dev/null
+++ b/Source/WebCore/platform/graphics/RoundedIntRect.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
+ * 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 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 "RoundedIntRect.h"
+
+#include "IntRect.h"
+#include <algorithm>
+
+namespace WebCore {
+
+bool RoundedIntRect::Radii::isZero() const
+{
+ return m_topLeft.isZero() && m_topRight.isZero() && m_bottomLeft.isZero() && m_bottomRight.isZero();
+}
+
+void RoundedIntRect::Radii::scale(float factor)
+{
+ if (factor == 1)
+ return;
+
+ // If either radius on a corner becomes zero, reset both radii on that corner.
+ m_topLeft.scale(factor);
+ if (!m_topLeft.width() || !m_topLeft.height())
+ m_topLeft = IntSize();
+ m_topRight.scale(factor);
+ if (!m_topRight.width() || !m_topRight.height())
+ m_topRight = IntSize();
+ m_bottomLeft.scale(factor);
+ if (!m_bottomLeft.width() || !m_bottomLeft.height())
+ m_bottomLeft = IntSize();
+ m_bottomRight.scale(factor);
+ if (!m_bottomRight.width() || !m_bottomRight.height())
+ m_bottomRight = IntSize();
+
+}
+
+void RoundedIntRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth)
+{
+ m_topLeft.setWidth(std::max(0, m_topLeft.width() + leftWidth));
+ m_topLeft.setHeight(std::max(0, m_topLeft.height() + topWidth));
+
+ m_topRight.setWidth(std::max(0, m_topRight.width() + rightWidth));
+ m_topRight.setHeight(std::max(0, m_topRight.height() + topWidth));
+
+ m_bottomLeft.setWidth(std::max(0, m_bottomLeft.width() + leftWidth));
+ m_bottomLeft.setHeight(std::max(0, m_bottomLeft.height() + bottomWidth));
+
+ m_bottomRight.setWidth(std::max(0, m_bottomRight.width() + rightWidth));
+ m_bottomRight.setHeight(std::max(0, m_bottomRight.height() + bottomWidth));
+}
+
+void RoundedIntRect::Radii::includeLogicalEdges(const RoundedIntRect::Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+{
+ if (includeLogicalLeftEdge) {
+ if (isHorizontal)
+ m_bottomLeft = edges.bottomLeft();
+ else
+ m_topRight = edges.topRight();
+ m_topLeft = edges.topLeft();
+ }
+
+ if (includeLogicalRightEdge) {
+ if (isHorizontal)
+ m_topRight = edges.topRight();
+ else
+ m_bottomLeft = edges.bottomLeft();
+ m_bottomRight = edges.bottomRight();
+ }
+}
+
+void RoundedIntRect::Radii::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
+{
+ if (excludeLogicalLeftEdge) {
+ if (isHorizontal)
+ m_bottomLeft = IntSize();
+ else
+ m_topRight = IntSize();
+ m_topLeft = IntSize();
+ }
+
+ if (excludeLogicalRightEdge) {
+ if (isHorizontal)
+ m_topRight = IntSize();
+ else
+ m_bottomLeft = IntSize();
+ m_bottomRight = IntSize();
+ }
+}
+
+RoundedIntRect::RoundedIntRect(int x, int y, int width, int height)
+ : m_rect(x, y, width, height)
+{
+}
+
+RoundedIntRect::RoundedIntRect(const IntRect& rect, const Radii& radii)
+ : m_rect(rect)
+ , m_radii(radii)
+{
+}
+
+RoundedIntRect::RoundedIntRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
+ : m_rect(rect)
+ , m_radii(topLeft, topRight, bottomLeft, bottomRight)
+{
+}
+
+void RoundedIntRect::includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+{
+ m_radii.includeLogicalEdges(edges, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
+}
+
+void RoundedIntRect::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
+{
+ m_radii.excludeLogicalEdges(isHorizontal, excludeLogicalLeftEdge, excludeLogicalRightEdge);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.h b/Source/WebCore/platform/graphics/RoundedIntRect.h
new file mode 100644
index 0000000..c3c972f
--- /dev/null
+++ b/Source/WebCore/platform/graphics/RoundedIntRect.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
+ * 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 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.
+ */
+
+#ifndef RoundedIntRect_h
+#define RoundedIntRect_h
+
+#include "IntRect.h"
+
+namespace WebCore {
+
+
+class RoundedIntRect {
+public:
+ class Radii {
+ public:
+ Radii() {}
+ Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
+ : m_topLeft(topLeft)
+ , m_topRight(topRight)
+ , m_bottomLeft(bottomLeft)
+ , m_bottomRight(bottomRight)
+ {
+ }
+
+ void setTopLeft(const IntSize& size) { m_topLeft = size; }
+ void setTopRight(const IntSize& size) { m_topRight = size; }
+ void setBottomLeft(const IntSize& size) { m_bottomLeft = size; }
+ void setBottomRight(const IntSize& size) { m_bottomRight = size; }
+ const IntSize& topLeft() const { return m_topLeft; }
+ const IntSize& topRight() const { return m_topRight; }
+ const IntSize& bottomLeft() const { return m_bottomLeft; }
+ const IntSize& bottomRight() const { return m_bottomRight; }
+
+ bool isZero() const;
+
+ void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
+ void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
+
+ void scale(float factor);
+ void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth);
+ void expand(int size) { expand(size, size, size, size); }
+ void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
+ void shrink(int size) { shrink(size, size, size, size); }
+
+ private:
+ IntSize m_topLeft;
+ IntSize m_topRight;
+ IntSize m_bottomLeft;
+ IntSize m_bottomRight;
+ };
+
+ explicit RoundedIntRect(const IntRect&, const Radii& = Radii());
+ RoundedIntRect(int x, int y, int width, int height);
+ RoundedIntRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
+
+ const IntRect& rect() const { return m_rect; }
+ const Radii& radii() const { return m_radii; }
+ bool isRounded() const { return !m_radii.isZero(); }
+ bool isEmpty() const { return m_rect.isEmpty(); }
+
+ void setRect(const IntRect& rect) { m_rect = rect; }
+ void setRadii(const Radii& radii) { m_radii = radii; }
+
+ void move(const IntSize& size) { m_rect.move(size); }
+ void inflate(int size) { m_rect.inflate(size); }
+ void inflateWithRadii(int size) { m_rect.inflate(size); m_radii.expand(size); }
+ void expandRadii(int size) { m_radii.expand(size); }
+ void shrinkRadii(int size) { m_radii.shrink(size); }
+
+ void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
+ void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
+
+private:
+ IntRect m_rect;
+ Radii m_radii;
+};
+
+} // namespace WebCore
+
+#endif // RoundedIntRect_h
diff --git a/Source/WebCore/platform/graphics/StringTruncator.cpp b/Source/WebCore/platform/graphics/StringTruncator.cpp
index b6c86ce..65325f0 100644
--- a/Source/WebCore/platform/graphics/StringTruncator.cpp
+++ b/Source/WebCore/platform/graphics/StringTruncator.cpp
@@ -32,6 +32,7 @@
#include "CharacterNames.h"
#include "Font.h"
#include "TextBreakIterator.h"
+#include "TextRun.h"
#include <wtf/Assertions.h>
#include <wtf/Vector.h>
diff --git a/Source/WebCore/platform/graphics/TiledBackingStore.h b/Source/WebCore/platform/graphics/TiledBackingStore.h
index 58477db..06c7fe1 100644
--- a/Source/WebCore/platform/graphics/TiledBackingStore.h
+++ b/Source/WebCore/platform/graphics/TiledBackingStore.h
@@ -36,7 +36,8 @@ namespace WebCore {
class GraphicsContext;
class TiledBackingStoreClient;
-class TiledBackingStore : public Noncopyable {
+class TiledBackingStore {
+ WTF_MAKE_NONCOPYABLE(TiledBackingStore); WTF_MAKE_FAST_ALLOCATED;
public:
TiledBackingStore(TiledBackingStoreClient*);
~TiledBackingStore();
diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp
index 2a951e8..412c86e 100644
--- a/Source/WebCore/platform/graphics/WidthIterator.cpp
+++ b/Source/WebCore/platform/graphics/WidthIterator.cpp
@@ -25,6 +25,7 @@
#include "Font.h"
#include "GlyphBuffer.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include <wtf/MathExtras.h>
#if USE(ICU_UNICODE)
diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
index b72d761..01e25e9 100644
--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
@@ -1105,6 +1105,10 @@ void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose)
if (m_structuralLayer) {
// Replace the transformLayer in the parent with this layer.
m_layer->removeFromSuperlayer();
+
+ // If m_layer doesn't have a parent, it means it's the root layer and
+ // is likely hosted by something that is not expecting to be changed
+ ASSERT(m_structuralLayer->superlayer());
m_structuralLayer->superlayer()->replaceSublayer(m_structuralLayer.get(), m_layer.get());
moveOrCopyAnimationsForProperty(Move, AnimatedPropertyWebkitTransform, m_structuralLayer.get(), m_layer.get());
@@ -1178,6 +1182,9 @@ void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose)
}
// Move this layer to be a child of the transform layer.
+ // If m_layer doesn't have a parent, it means it's the root layer and
+ // is likely hosted by something that is not expecting to be changed
+ ASSERT(m_layer->superlayer());
m_layer->superlayer()->replaceSublayer(m_layer.get(), m_structuralLayer.get());
m_structuralLayer->appendSublayer(m_layer.get());
@@ -2013,6 +2020,9 @@ void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)
m_layer->adoptSublayers(oldLayer.get());
+ // If m_layer doesn't have a parent, it means it's the root layer and
+ // is likely hosted by something that is not expecting to be changed
+ ASSERT(oldLayer->superlayer());
oldLayer->superlayer()->replaceSublayer(oldLayer.get(), m_layer.get());
updateContentsTransform();
diff --git a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
index 7c83f86..1d27608 100644
--- a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
+++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
@@ -24,17 +24,12 @@
*/
#include "config.h"
+#include "CACFLayerTreeHost.h"
#if USE(ACCELERATED_COMPOSITING)
-#ifndef NDEBUG
-#define D3D_DEBUG_INFO
-#endif
-
-#include "WKCACFLayerRenderer.h"
-
+#include "LayerChangesFlusher.h"
#include "PlatformCALayer.h"
-#include "WKCACFContextFlusher.h"
#include "WebCoreInstanceHandle.h"
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <limits.h>
@@ -44,6 +39,11 @@
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/StdLibExtras.h>
+
+#ifndef NDEBUG
+#define D3D_DEBUG_INFO
+#endif
+
#include <d3d9.h>
#include <d3dx9.h>
@@ -117,7 +117,7 @@ static bool hardwareCapabilitiesIndicateCoreAnimationSupport(const D3DCAPS9& cap
return true;
}
-bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
+bool CACFLayerTreeHost::acceleratedCompositingAvailable()
{
static bool available;
static bool tested;
@@ -165,30 +165,31 @@ bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
return available;
}
- OwnPtr<WKCACFLayerRenderer> testLayerRenderer = WKCACFLayerRenderer::create(0);
- testLayerRenderer->setHostWindow(testWindow);
- available = testLayerRenderer->createRenderer();
+ RefPtr<CACFLayerTreeHost> host = CACFLayerTreeHost::create();
+ host->setWindow(testWindow);
+ available = host->createRenderer();
::DestroyWindow(testWindow);
return available;
}
-PassOwnPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create(WKCACFLayerRendererClient* client)
+PassRefPtr<CACFLayerTreeHost> CACFLayerTreeHost::create()
{
if (!acceleratedCompositingAvailable())
return 0;
- return new WKCACFLayerRenderer(client);
+ return adoptRef(new CACFLayerTreeHost());
}
-WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client)
- : m_client(client)
+CACFLayerTreeHost::CACFLayerTreeHost()
+ : m_client(0)
, m_mightBeAbleToCreateDeviceLater(true)
, m_rootLayer(PlatformCALayer::create(PlatformCALayer::LayerTypeRootLayer, 0))
, m_context(wkCACFContextCreate())
- , m_hostWindow(0)
- , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
+ , m_window(0)
+ , m_renderTimer(this, &CACFLayerTreeHost::renderTimerFired)
, m_mustResetLostDeviceBeforeRendering(false)
- , m_syncLayerChanges(false)
+ , m_shouldFlushPendingGraphicsLayerChanges(false)
+ , m_isFlushingLayerChanges(false)
{
// Point the CACFContext to this
wkCACFContextSetUserData(m_context, this);
@@ -202,7 +203,7 @@ WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client)
// cause any repositioning.
// Scrolling will affect only the position of the scroll layer without affecting the bounds.
- m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
+ m_rootLayer->setName("CACFLayerTreeHost rootLayer");
m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
m_rootLayer->setGeometryFlipped(true);
@@ -221,38 +222,37 @@ WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client)
#endif
}
-WKCACFLayerRenderer::~WKCACFLayerRenderer()
+CACFLayerTreeHost::~CACFLayerTreeHost()
{
- setHostWindow(0);
- WKCACFContextFlusher::shared().removeContext(m_context);
+ setWindow(0);
wkCACFContextDestroy(m_context);
}
-void WKCACFLayerRenderer::setHostWindow(HWND window)
+void CACFLayerTreeHost::setWindow(HWND window)
{
- if (window == m_hostWindow)
+ if (window == m_window)
return;
- if (m_hostWindow)
+ if (m_window)
destroyRenderer();
- m_hostWindow = window;
+ m_window = window;
- if (m_hostWindow)
+ if (m_window)
createRenderer();
}
-PlatformCALayer* WKCACFLayerRenderer::rootLayer() const
+PlatformCALayer* CACFLayerTreeHost::rootLayer() const
{
return m_rootLayer.get();
}
-void WKCACFLayerRenderer::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer)
+void CACFLayerTreeHost::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer)
{
m_pendingAnimatedLayers.add(layer);
}
-void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer)
+void CACFLayerTreeHost::setRootChildLayer(PlatformCALayer* layer)
{
m_rootLayer->removeAllSublayers();
m_rootChildLayer = layer;
@@ -260,13 +260,22 @@ void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer)
m_rootLayer->appendSublayer(m_rootChildLayer.get());
}
-void WKCACFLayerRenderer::layerTreeDidChange()
+void CACFLayerTreeHost::layerTreeDidChange()
{
- WKCACFContextFlusher::shared().addContext(m_context);
- renderSoon();
+ if (m_isFlushingLayerChanges) {
+ // The layer tree is changing as a result of flushing GraphicsLayer changes to their
+ // underlying PlatformCALayers. We'll flush those changes to the context as part of that
+ // process, so there's no need to schedule another flush here.
+ return;
+ }
+
+ // The layer tree is changing as a result of someone modifying a PlatformCALayer that doesn't
+ // have a corresponding GraphicsLayer. Schedule a flush since we won't schedule one through the
+ // normal GraphicsLayer mechanisms.
+ LayerChangesFlusher::shared().flushPendingLayerChangesSoon(this);
}
-bool WKCACFLayerRenderer::createRenderer()
+bool CACFLayerTreeHost::createRenderer()
{
if (m_d3dDevice || !m_mightBeAbleToCreateDeviceLater)
return m_d3dDevice;
@@ -274,14 +283,14 @@ bool WKCACFLayerRenderer::createRenderer()
m_mightBeAbleToCreateDeviceLater = false;
D3DPRESENT_PARAMETERS parameters = initialPresentationParameters();
- if (!d3d() || !::IsWindow(m_hostWindow))
+ if (!d3d() || !::IsWindow(m_window))
return false;
// D3D doesn't like to make back buffers for 0 size windows. We skirt this problem if we make the
// passed backbuffer width and height non-zero. The window will necessarily get set to a non-zero
// size eventually, and then the backbuffer size will get reset.
RECT rect;
- GetClientRect(m_hostWindow, &rect);
+ GetClientRect(m_window, &rect);
if (rect.left-rect.right == 0 || rect.bottom-rect.top == 0) {
parameters.BackBufferWidth = 1;
@@ -299,7 +308,7 @@ bool WKCACFLayerRenderer::createRenderer()
behaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
COMPtr<IDirect3DDevice9> device;
- if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hostWindow, behaviorFlags, &parameters, &device))) {
+ if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_window, behaviorFlags, &parameters, &device))) {
// In certain situations (e.g., shortly after waking from sleep), Direct3DCreate9() will
// return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. In case we
// have one of these bad IDirect3D9s, get rid of it so we'll fetch a new one the next time
@@ -332,15 +341,17 @@ bool WKCACFLayerRenderer::createRenderer()
wkCACFContextSetD3DDevice(m_context, m_d3dDevice.get());
- if (IsWindow(m_hostWindow))
+ if (IsWindow(m_window))
m_rootLayer->setBounds(bounds());
return true;
}
-void WKCACFLayerRenderer::destroyRenderer()
+void CACFLayerTreeHost::destroyRenderer()
{
- wkCACFContextSetLayer(m_context, m_rootLayer->platformLayer());
+ LayerChangesFlusher::shared().cancelPendingFlush(this);
+
+ wkCACFContextSetLayer(m_context, 0);
wkCACFContextSetD3DDevice(m_context, 0);
m_d3dDevice = 0;
@@ -354,7 +365,7 @@ void WKCACFLayerRenderer::destroyRenderer()
m_mightBeAbleToCreateDeviceLater = true;
}
-void WKCACFLayerRenderer::resize()
+void CACFLayerTreeHost::resize()
{
if (!m_d3dDevice)
return;
@@ -365,7 +376,7 @@ void WKCACFLayerRenderer::resize()
if (m_rootLayer) {
m_rootLayer->setBounds(bounds());
- WKCACFContextFlusher::shared().flushAllContexts();
+ wkCACFContextFlush(m_context);
}
}
@@ -399,12 +410,12 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
outRects[i] = winRectToCGRect(*rect, clientRect);
}
-void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
+void CACFLayerTreeHost::renderTimerFired(Timer<CACFLayerTreeHost>*)
{
paint();
}
-void WKCACFLayerRenderer::paint()
+void CACFLayerTreeHost::paint()
{
createRenderer();
if (!m_d3dDevice) {
@@ -414,11 +425,11 @@ void WKCACFLayerRenderer::paint()
}
Vector<CGRect> dirtyRects;
- getDirtyRects(m_hostWindow, dirtyRects);
+ getDirtyRects(m_window, dirtyRects);
render(dirtyRects);
}
-void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects)
+void CACFLayerTreeHost::render(const Vector<CGRect>& windowDirtyRects)
{
ASSERT(m_d3dDevice);
@@ -428,20 +439,6 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects)
return;
}
- if (m_client && !m_client->shouldRender()) {
- renderSoon();
- return;
- }
-
- // Sync the layer if needed
- if (m_syncLayerChanges) {
- m_client->syncCompositingState();
- m_syncLayerChanges = false;
- }
-
- // Flush the root layer to the render tree.
- wkCACFContextFlush(m_context);
-
// All pending animations will have been started with the flush. Fire the animationStarted calls
double currentTime = WTF::currentTime();
double currentMediaTime = CACurrentMediaTime();
@@ -521,27 +518,49 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects)
renderSoon();
}
-void WKCACFLayerRenderer::renderSoon()
+void CACFLayerTreeHost::renderSoon()
{
if (!m_renderTimer.isActive())
m_renderTimer.startOneShot(0);
}
-void WKCACFLayerRenderer::syncCompositingStateSoon()
+void CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon()
+{
+ m_shouldFlushPendingGraphicsLayerChanges = true;
+ LayerChangesFlusher::shared().flushPendingLayerChangesSoon(this);
+}
+
+void CACFLayerTreeHost::flushPendingLayerChangesNow()
{
- m_syncLayerChanges = true;
+ // Calling out to the client could cause our last reference to go away.
+ RefPtr<CACFLayerTreeHost> protector(this);
+
+ m_isFlushingLayerChanges = true;
+
+ // Flush changes stored up in GraphicsLayers to their underlying PlatformCALayers, if
+ // requested.
+ if (m_client && m_shouldFlushPendingGraphicsLayerChanges) {
+ m_shouldFlushPendingGraphicsLayerChanges = false;
+ m_client->flushPendingGraphicsLayerChanges();
+ }
+
+ // Flush changes stored up in PlatformCALayers to the context so they will be rendered.
+ wkCACFContextFlush(m_context);
+
renderSoon();
+
+ m_isFlushingLayerChanges = false;
}
-CGRect WKCACFLayerRenderer::bounds() const
+CGRect CACFLayerTreeHost::bounds() const
{
RECT clientRect;
- GetClientRect(m_hostWindow, &clientRect);
+ GetClientRect(m_window, &clientRect);
return winRectToCGRect(clientRect);
}
-void WKCACFLayerRenderer::initD3DGeometry()
+void CACFLayerTreeHost::initD3DGeometry()
{
ASSERT(m_d3dDevice);
@@ -558,7 +577,7 @@ void WKCACFLayerRenderer::initD3DGeometry()
m_d3dDevice->SetTransform(D3DTS_PROJECTION, &projection);
}
-bool WKCACFLayerRenderer::resetDevice(ResetReason reason)
+bool CACFLayerTreeHost::resetDevice(ResetReason reason)
{
ASSERT(m_d3dDevice);
ASSERT(m_context);
diff --git a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
index 02cdbdb..fc61f39 100644
--- a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
+++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WKCACFLayerRenderer_h
-#define WKCACFLayerRenderer_h
+#ifndef CACFLayerTreeHost_h
+#define CACFLayerTreeHost_h
#if USE(ACCELERATED_COMPOSITING)
@@ -32,9 +32,8 @@
#include "Timer.h"
#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
@@ -50,43 +49,45 @@ namespace WebCore {
class PlatformCALayer;
-class WKCACFLayerRendererClient {
+class CACFLayerTreeHostClient {
public:
- virtual ~WKCACFLayerRendererClient() { }
- virtual bool shouldRender() const = 0;
- virtual void syncCompositingState() { }
+ virtual ~CACFLayerTreeHostClient() { }
+ virtual void flushPendingGraphicsLayerChanges() { }
};
-// FIXME: Currently there is a WKCACFLayerRenderer for each WebView and each
+// FIXME: Currently there is a CACFLayerTreeHost for each WebView and each
// has its own CARenderOGLContext and Direct3DDevice9, which is inefficient.
// (https://bugs.webkit.org/show_bug.cgi?id=31855)
-class WKCACFLayerRenderer : public Noncopyable {
+class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost> {
friend PlatformCALayer;
public:
- static PassOwnPtr<WKCACFLayerRenderer> create(WKCACFLayerRendererClient*);
- ~WKCACFLayerRenderer();
+ static PassRefPtr<CACFLayerTreeHost> create();
+ ~CACFLayerTreeHost();
static bool acceleratedCompositingAvailable();
+ void setClient(CACFLayerTreeHostClient* client) { m_client = client; }
+
void setRootChildLayer(PlatformCALayer*);
void layerTreeDidChange();
- void setHostWindow(HWND);
+ void setWindow(HWND);
void paint();
void resize();
- void syncCompositingStateSoon();
+ void flushPendingGraphicsLayerChangesSoon();
+ void flushPendingLayerChangesNow();
protected:
PlatformCALayer* rootLayer() const;
void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>);
private:
- WKCACFLayerRenderer(WKCACFLayerRendererClient*);
+ CACFLayerTreeHost();
bool createRenderer();
void destroyRenderer();
void renderSoon();
- void renderTimerFired(Timer<WKCACFLayerRenderer>*);
+ void renderTimerFired(Timer<CACFLayerTreeHost>*);
CGRect bounds() const;
@@ -100,16 +101,17 @@ private:
void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
- WKCACFLayerRendererClient* m_client;
+ CACFLayerTreeHostClient* m_client;
bool m_mightBeAbleToCreateDeviceLater;
COMPtr<IDirect3DDevice9> m_d3dDevice;
RefPtr<PlatformCALayer> m_rootLayer;
RefPtr<PlatformCALayer> m_rootChildLayer;
WKCACFContext* m_context;
- HWND m_hostWindow;
- Timer<WKCACFLayerRenderer> m_renderTimer;
+ HWND m_window;
+ Timer<CACFLayerTreeHost> m_renderTimer;
bool m_mustResetLostDeviceBeforeRendering;
- bool m_syncLayerChanges;
+ bool m_shouldFlushPendingGraphicsLayerChanges;
+ bool m_isFlushingLayerChanges;
HashSet<RefPtr<PlatformCALayer> > m_pendingAnimatedLayers;
#ifndef NDEBUG
@@ -121,4 +123,4 @@ private:
#endif // USE(ACCELERATED_COMPOSITING)
-#endif // WKCACFLayerRenderer_h
+#endif // CACFLayerTreeHost_h
diff --git a/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp
new file mode 100644
index 0000000..3fd857b
--- /dev/null
+++ b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2011 Apple 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. ``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.
+ */
+
+#include "config.h"
+#include "LayerChangesFlusher.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CACFLayerTreeHost.h"
+#include "WebCoreInstanceHandle.h"
+#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+LayerChangesFlusher& LayerChangesFlusher::shared()
+{
+ DEFINE_STATIC_LOCAL(LayerChangesFlusher, flusher, ());
+ return flusher;
+}
+
+LayerChangesFlusher::LayerChangesFlusher()
+ : m_hook(0)
+ , m_isCallingHosts(false)
+{
+}
+
+void LayerChangesFlusher::flushPendingLayerChangesSoon(CACFLayerTreeHost* host)
+{
+ if (!m_hostsWithChangesToFlush.add(host).second || m_hook)
+ return;
+
+ setHook();
+}
+
+void LayerChangesFlusher::cancelPendingFlush(CACFLayerTreeHost* host)
+{
+ m_hostsWithChangesToFlush.remove(host);
+
+ if (!m_hostsWithChangesToFlush.isEmpty() || !m_hook)
+ return;
+
+ // We handle removing the hook when we finish calling out to the hosts, so we shouldn't
+ // mess with it while we're in the process of calling them.
+ if (m_isCallingHosts)
+ return;
+
+ removeHook();
+}
+
+LRESULT LayerChangesFlusher::hookCallback(int code, WPARAM wParam, LPARAM lParam)
+{
+ return shared().hookFired(code, wParam, lParam);
+}
+
+LRESULT LayerChangesFlusher::hookFired(int code, WPARAM wParam, LPARAM lParam)
+{
+ ASSERT(m_hook);
+
+ // Calling out to the hosts can cause m_hostsWithChangesToFlush to be modified, so we copy it
+ // into a Vector first. We have to hold a reference to them because otherwise they could be
+ // destroyed while we're calling out to them.
+ Vector<RefPtr<CACFLayerTreeHost> > hosts;
+ copyToVector(m_hostsWithChangesToFlush, hosts);
+ m_hostsWithChangesToFlush.clear();
+
+ m_isCallingHosts = true;
+ for (size_t i = 0; i < hosts.size(); ++i)
+ hosts[i]->flushPendingLayerChangesNow();
+ m_isCallingHosts = false;
+
+ LRESULT result = ::CallNextHookEx(m_hook, code, wParam, lParam);
+
+ if (m_hostsWithChangesToFlush.isEmpty()) {
+ // We won't have any work to do next time around, so just remove our hook.
+ removeHook();
+ }
+
+ return result;
+}
+
+void LayerChangesFlusher::setHook()
+{
+ ASSERT(!m_hook);
+ ASSERT(!m_isCallingHosts);
+
+ DWORD threadID = ::GetCurrentThreadId();
+
+ m_hook = ::SetWindowsHookExW(WH_GETMESSAGE, hookCallback, instanceHandle(), threadID);
+ ASSERT_WITH_MESSAGE(m_hook, "::SetWindowsHookExW failed with error %lu", ::GetLastError());
+
+ // Post a message to the message queue to prevent ::GetMessage from blocking, which will ensure
+ // our hook is called soon.
+ ::PostThreadMessageW(threadID, WM_NULL, 0, 0);
+}
+
+void LayerChangesFlusher::removeHook()
+{
+ ASSERT(m_hook);
+ ASSERT(!m_isCallingHosts);
+
+ if (!::UnhookWindowsHookEx(m_hook))
+ ASSERT_WITH_MESSAGE(false, "::UnhookWindowsHookEx failed with error %lu", ::GetLastError());
+
+ m_hook = 0;
+}
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.h b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h
index 17ec41d..6a98a99 100644
--- a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.h
+++ b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -20,41 +20,46 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WKCACFContextFlusher_h
-#define WKCACFContextFlusher_h
+#ifndef LayerChangesFlusher_h
+#define LayerChangesFlusher_h
#if USE(ACCELERATED_COMPOSITING)
-#include <wtf/Noncopyable.h>
-
+#include <windows.h>
#include <wtf/HashSet.h>
-
-struct WKCACFContext;
+#include <wtf/Noncopyable.h>
namespace WebCore {
-class WKCACFContextFlusher : public Noncopyable {
-public:
- static WKCACFContextFlusher& shared();
+class CACFLayerTreeHost;
- void addContext(WKCACFContext*);
- void removeContext(WKCACFContext*);
+class LayerChangesFlusher {
+ WTF_MAKE_NONCOPYABLE(LayerChangesFlusher);
+public:
+ static LayerChangesFlusher& shared();
- void flushAllContexts();
+ void flushPendingLayerChangesSoon(CACFLayerTreeHost*);
+ void cancelPendingFlush(CACFLayerTreeHost*);
private:
- WKCACFContextFlusher();
- ~WKCACFContextFlusher();
+ LayerChangesFlusher();
+ ~LayerChangesFlusher();
+
+ static LRESULT CALLBACK hookCallback(int code, WPARAM, LPARAM);
+ LRESULT hookFired(int code, WPARAM, LPARAM);
+ void setHook();
+ void removeHook();
- typedef HashSet<WKCACFContext*> ContextSet;
- ContextSet m_contexts;
+ HashSet<CACFLayerTreeHost*> m_hostsWithChangesToFlush;
+ HHOOK m_hook;
+ bool m_isCallingHosts;
};
-}
+} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
-#endif // WKCACFContextFlusher_h
+#endif // LayerChangesFlusher_h
diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp
index 7230cfc..228bb01 100644
--- a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp
+++ b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp
@@ -41,7 +41,7 @@
using namespace WebCore;
-static String toCACFFillModeType(PlatformCAAnimation::FillModeType type)
+static CFStringRef toCACFFillModeType(PlatformCAAnimation::FillModeType type)
{
switch (type) {
case PlatformCAAnimation::NoFillMode:
@@ -49,10 +49,11 @@ static String toCACFFillModeType(PlatformCAAnimation::FillModeType type)
case PlatformCAAnimation::Backwards: return kCACFFillModeBackwards;
case PlatformCAAnimation::Both: return kCACFFillModeBoth;
}
- return "";
+ ASSERT_NOT_REACHED();
+ return 0;
}
-static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& string)
+static PlatformCAAnimation::FillModeType fromCACFFillModeType(CFStringRef string)
{
if (string == kCACFFillModeBackwards)
return PlatformCAAnimation::Backwards;
@@ -63,10 +64,10 @@ static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& stri
return PlatformCAAnimation::Forwards;
}
-static String toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type)
+static CFStringRef toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type)
{
switch (type) {
- case PlatformCAAnimation::NoValueFunction: return "";
+ case PlatformCAAnimation::NoValueFunction: return 0;
case PlatformCAAnimation::RotateX: return kCACFValueFunctionRotateX;
case PlatformCAAnimation::RotateY: return kCACFValueFunctionRotateY;
case PlatformCAAnimation::RotateZ: return kCACFValueFunctionRotateZ;
@@ -79,10 +80,11 @@ static String toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType typ
case PlatformCAAnimation::TranslateZ: return kCACFValueFunctionTranslateZ;
case PlatformCAAnimation::Translate: return kCACFValueFunctionTranslate;
}
- return "";
+ ASSERT_NOT_REACHED();
+ return 0;
}
-static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const String string)
+static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(CFStringRef string)
{
if (string == kCACFValueFunctionRotateX)
return PlatformCAAnimation::RotateX;
@@ -120,14 +122,14 @@ static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const St
return PlatformCAAnimation::NoValueFunction;
}
-static CACFTimingFunctionRef toCACFTimingFunction(const TimingFunction* timingFunction)
+static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunction* timingFunction)
{
if (!timingFunction)
- return CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f);
+ return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f));
if (timingFunction->isCubicBezierTimingFunction()) {
const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction);
- return CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2()));
+ return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2())));
}
return CACFTimingFunctionGetFunctionWithName(kCACFTimingFunctionLinear);
@@ -162,12 +164,12 @@ PlatformCAAnimation::PlatformCAAnimation(AnimationType type, const String& keyPa
PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation)
{
- if (String(CACFAnimationGetClass(animation)) == kCACFBasicAnimation)
+ if (CACFAnimationGetClass(animation) == kCACFBasicAnimation)
m_type = Basic;
- else if (String(CACFAnimationGetClass(animation)) == kCACFKeyframeAnimation)
+ else if (CACFAnimationGetClass(animation) == kCACFKeyframeAnimation)
m_type = Keyframe;
else {
- ASSERT(0);
+ ASSERT_NOT_REACHED();
return;
}
@@ -289,13 +291,12 @@ PlatformCAAnimation::FillModeType PlatformCAAnimation::fillMode() const
void PlatformCAAnimation::setFillMode(FillModeType value)
{
- RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFFillModeType(value).createCFString());
- CACFAnimationSetFillMode(m_animation.get(), keyPath.get());
+ CACFAnimationSetFillMode(m_animation.get(), toCACFFillModeType(value));
}
void PlatformCAAnimation::setTimingFunction(const TimingFunction* value)
{
- CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value));
+ CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value).get());
}
void PlatformCAAnimation::copyTimingFunctionFrom(const PlatformCAAnimation* value)
@@ -330,8 +331,7 @@ PlatformCAAnimation::ValueFunctionType PlatformCAAnimation::valueFunction() cons
void PlatformCAAnimation::setValueFunction(ValueFunctionType value)
{
- RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFValueFunctionType(value).createCFString());
- CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(keyPath.get()));
+ CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(toCACFValueFunctionType(value)));
}
void PlatformCAAnimation::setFromValue(float value)
@@ -524,7 +524,7 @@ void PlatformCAAnimation::setTimingFunctions(const Vector<const TimingFunction*>
RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
for (size_t i = 0; i < value.size(); ++i) {
RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
- CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]));
+ CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]).get());
}
CACFAnimationSetTimingFunctions(m_animation.get(), array.get());
diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
index 66d0732..b5a26f4 100644
--- a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
+++ b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
@@ -29,10 +29,10 @@
#include "PlatformCALayer.h"
+#include "CACFLayerTreeHost.h"
#include "Font.h"
#include "GraphicsContext.h"
#include "PlatformCALayerWinInternal.h"
-#include "WKCACFLayerRenderer.h"
#include <QuartzCore/CoreAnimationCF.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <wtf/CurrentTime.h>
@@ -65,14 +65,14 @@ static CFStringRef toCACFFilterType(PlatformCALayer::FilterType type)
}
}
-static WKCACFLayerRenderer* rendererForLayer(const PlatformCALayer* layer)
+static CACFLayerTreeHost* layerTreeHostForLayer(const PlatformCALayer* layer)
{
- // We need the WKCACFLayerRenderer associated with this layer, which is stored in the UserData of the CACFContext
+ // We need the CACFLayerTreeHost associated with this layer, which is stored in the UserData of the CACFContext
void* userData = wkCACFLayerGetContextUserData(layer->platformLayer());
if (!userData)
return 0;
- return static_cast<WKCACFLayerRenderer*>(userData);
+ return static_cast<CACFLayerTreeHost*>(userData);
}
static PlatformCALayerWinInternal* intern(const PlatformCALayer* layer)
@@ -156,8 +156,8 @@ PlatformLayer* PlatformCALayer::platformLayer() const
PlatformCALayer* PlatformCALayer::rootLayer() const
{
- WKCACFLayerRenderer* renderer = rendererForLayer(this);
- return renderer ? renderer->rootLayer() : 0;
+ CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+ return host ? host->rootLayer() : 0;
}
void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
@@ -167,9 +167,9 @@ void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
void PlatformCALayer::setNeedsCommit()
{
- WKCACFLayerRenderer* renderer = rendererForLayer(this);
- if (renderer)
- renderer->layerTreeDidChange();
+ CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+ if (host)
+ host->layerTreeDidChange();
}
void PlatformCALayer::setContentsChanged()
@@ -269,10 +269,10 @@ void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation*
CACFLayerAddAnimation(m_layer.get(), s.get(), animation->platformAnimation());
setNeedsCommit();
- // Tell the renderer about it so we can fire the start animation event
- WKCACFLayerRenderer* renderer = rendererForLayer(this);
- if (renderer)
- renderer->addPendingAnimatedLayer(this);
+ // Tell the host about it so we can fire the start animation event
+ CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+ if (host)
+ host->addPendingAnimatedLayer(this);
}
void PlatformCALayer::removeAnimationForKey(const String& key)
@@ -283,7 +283,7 @@ void PlatformCALayer::removeAnimationForKey(const String& key)
RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
CACFLayerRemoveAnimation(m_layer.get(), s.get());
- // We don't "remove" a layer from WKCACFLayerRenderer when it loses an animation.
+ // We don't "remove" a layer from CACFLayerTreeHost when it loses an animation.
// There may be other active animations on the layer and if an animation
// callback is fired on a layer without any animations no harm is done.
diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
index cdf90db..1697122 100644
--- a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
+++ b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
@@ -31,6 +31,7 @@
#include "Font.h"
#include "PlatformCALayer.h"
+#include "TextRun.h"
#include <QuartzCore/CACFLayer.h>
using namespace std;
diff --git a/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
index dac31f8..50ea00f 100644
--- a/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
@@ -35,7 +35,8 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
FontCustomPlatformData(FT_Face, SharedBuffer*);
~FontCustomPlatformData();
diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
index ac5da3d..51b5ee6 100644
--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
@@ -91,6 +91,11 @@ ImageBuffer::~ImageBuffer()
cairo_surface_destroy(m_data.m_surface);
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.width() * m_size.height() * 4;
+}
+
GraphicsContext* ImageBuffer::context() const
{
return m_context.get();
diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index eddf735..bcfc37b 100644
--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -625,8 +625,8 @@ void GraphicsContext::fillRect(const FloatRect& rect)
if (m_state.fillGradient) {
CGContextSaveGState(context);
- CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
if (hasShadow()) {
+ CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0);
CGContextRef layerContext = CGLayerGetContext(layer);
m_state.fillGradient->paint(layerContext);
@@ -634,6 +634,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
CGLayerRelease(layer);
} else {
CGContextClipToRect(context, rect);
+ CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
m_state.fillGradient->paint(this);
}
CGContextRestoreGState(context);
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index 023d098..295f632 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -173,6 +173,11 @@ ImageBuffer::~ImageBuffer()
{
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.height() * m_data.m_bytesPerRow;
+}
+
GraphicsContext* ImageBuffer::context() const
{
return m_context.get();
diff --git a/Source/WebCore/platform/graphics/cg/PatternCG.cpp b/Source/WebCore/platform/graphics/cg/PatternCG.cpp
index 94f37b2..cfac15c 100644
--- a/Source/WebCore/platform/graphics/cg/PatternCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/PatternCG.cpp
@@ -54,8 +54,7 @@ CGPatternRef Pattern::createPlatformPattern(const AffineTransform& userSpaceTran
{
IntRect tileRect = tileImage()->rect();
- AffineTransform patternTransform = m_patternSpaceTransformation;
- patternTransform.multiply(userSpaceTransformation);
+ AffineTransform patternTransform = userSpaceTransformation * m_patternSpaceTransformation;
patternTransform.scaleNonUniform(1, -1);
patternTransform.translate(0, -tileRect.height());
diff --git a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
index 99159e6..92861fc 100644
--- a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
+++ b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
@@ -32,6 +32,7 @@
#include "ComplexTextControllerLinux.h"
#include "Font.h"
+#include "TextRun.h"
#include <unicode/normlzr.h>
@@ -47,8 +48,6 @@ static int truncateFixedPointToInteger(HB_Fixed value)
ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, const Font* font)
: m_font(font)
- , m_startingX(startingX)
- , m_offsetX(m_startingX)
, m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer))
, m_wordSpacingAdjustment(0)
, m_padding(0)
@@ -75,7 +74,7 @@ ComplexTextController::ComplexTextController(const TextRun& run, unsigned starti
m_item.string = m_run.characters();
m_item.stringLength = m_run.length();
- reset();
+ reset(startingX);
}
ComplexTextController::~ComplexTextController()
@@ -137,10 +136,10 @@ void ComplexTextController::setPadding(int padding)
m_padPerWordBreak = 0;
}
-void ComplexTextController::reset()
+void ComplexTextController::reset(unsigned offset)
{
m_indexOfNextScriptRun = 0;
- m_offsetX = m_startingX;
+ m_offsetX = offset;
}
// Advance to the next script run, returning false when the end of the
@@ -277,8 +276,7 @@ void ComplexTextController::setGlyphXPositions(bool isRTL)
int logClustersIndex = 0;
// Iterate through the glyphs in logical order, flipping for RTL where necessary.
- // In RTL mode all variables are positive except m_xPositions, which starts from m_offsetX and runs negative.
- // It is fixed up in a second pass below.
+ // Glyphs are positioned starting from m_offsetX; in RTL mode they go leftwards from there.
for (size_t i = 0; i < m_item.num_glyphs; ++i) {
while (static_cast<unsigned>(logClustersIndex) < m_item.item.length && logClusters()[logClustersIndex] < i)
logClustersIndex++;
@@ -303,16 +301,8 @@ void ComplexTextController::setGlyphXPositions(bool isRTL)
position += advance;
}
- const double width = position;
-
- // Now that we've computed the total width, do another pass to fix positioning for RTL.
- if (isRTL) {
- for (size_t i = 0; i < m_item.num_glyphs; ++i)
- m_xPositions[i] += width;
- }
-
- m_pixelWidth = std::max(width, 0.0);
- m_offsetX += m_pixelWidth;
+ m_pixelWidth = std::max(position, 0.0);
+ m_offsetX += m_pixelWidth * rtlFlip;
}
void ComplexTextController::normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UChar* destination, int length)
diff --git a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h
index e264b99..a2aea60 100644
--- a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h
+++ b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h
@@ -68,7 +68,7 @@ public:
// setPadding sets a number of pixels to be distributed across the TextRun.
// WebKit uses this to justify text.
void setPadding(int);
- void reset();
+ void reset(unsigned offset);
// Advance to the next script run, returning false when the end of the
// TextRun has been reached.
bool nextScriptRun();
@@ -86,7 +86,6 @@ public:
// Set the x offset for the next script run. This affects the values in
// |xPositions|
- void setXOffsetToZero() { m_offsetX = 0; }
bool rtl() const { return m_run.rtl(); }
const uint16_t* glyphs() const { return m_glyphs16; }
@@ -114,6 +113,9 @@ public:
// return the number of code points in the current script run
const unsigned numCodePoints() const { return m_numCodePoints; }
+ // Return the current pixel position of the controller.
+ const unsigned offsetX() const { return m_offsetX; }
+
const FontPlatformData* fontPlatformDataForScriptRun() { return reinterpret_cast<FontPlatformData*>(m_item.font->userData); }
private:
@@ -137,7 +139,6 @@ private:
uint16_t* m_glyphs16; // A vector of 16-bit glyph ids.
SkScalar* m_xPositions; // A vector of x positions for each glyph.
ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|.
- const unsigned m_startingX; // Offset in pixels of the first script run.
unsigned m_offsetX; // Offset in pixels to the start of the next script run.
unsigned m_pixelWidth; // Width (in px) of the current script run.
unsigned m_numCodePoints; // Code points in current script run.
diff --git a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
index 72e3369..227fbe4 100644
--- a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
+++ b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
@@ -30,7 +30,7 @@
#import "CrossProcessFontLoading.h"
#import "../graphics/cocoa/FontPlatformData.h"
-#import "ChromiumBridge.h"
+#import "PlatformBridge.h"
#import <AppKit/NSFont.h>
#import <wtf/HashMap.h>
@@ -87,7 +87,7 @@ PassRefPtr<MemoryActivatedFont> loadFontFromBrowserProcess(NSFont* nsFont)
{
ATSFontContainerRef container;
// Send cross-process request to load font.
- if (!ChromiumBridge::loadFont(nsFont, &container))
+ if (!PlatformBridge::loadFont(nsFont, &container))
return 0;
ATSFontContainerRef srcFontContainerRef = fontContainerRefFromNSFont(nsFont);
diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index 569dff4..2d4ca41 100644
--- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -72,15 +72,16 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
bool multisampleExtensionSupported,
bool packedDepthStencilExtensionSupported)
: m_context(context)
- , m_size(size)
+ , m_size(-1, -1)
, m_multisampleExtensionSupported(multisampleExtensionSupported)
, m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported)
, m_fbo(0)
, m_colorBuffer(0)
, m_depthStencilBuffer(0)
+ , m_depthBuffer(0)
+ , m_stencilBuffer(0)
, m_multisampleFBO(0)
, m_multisampleColorBuffer(0)
- , m_multisampleDepthStencilBuffer(0)
, m_internal(new DrawingBufferInternal)
{
if (!m_context->getExtensions()->supports("GL_CHROMIUM_copy_texture_to_parent_texture")) {
@@ -91,6 +92,7 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
m_colorBuffer = generateColorTexture(context, size);
createSecondaryBuffers();
+ reset(size);
}
DrawingBuffer::~DrawingBuffer()
diff --git a/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
index 2c79815..f4c0dee 100644
--- a/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -32,11 +32,11 @@
#include "config.h"
#include "FontCache.h"
-#include "ChromiumBridge.h"
#include "Font.h"
#include "FontUtilsChromiumWin.h"
#include "HashMap.h"
#include "HashSet.h"
+#include "PlatformBridge.h"
#include "SimpleFontData.h"
#include <unicode/uniset.h>
#include <wtf/text/StringHash.h>
@@ -288,9 +288,9 @@ static bool fontContainsCharacter(const FontPlatformData* fontData,
HDC hdc = GetDC(0);
HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(hdc, hfont));
int count = GetFontUnicodeRanges(hdc, 0);
- if (count == 0 && ChromiumBridge::ensureFontLoaded(hfont))
+ if (!count && PlatformBridge::ensureFontLoaded(hfont))
count = GetFontUnicodeRanges(hdc, 0);
- if (count == 0) {
+ if (!count) {
LOG_ERROR("Unable to get the font unicode range after second attempt");
SelectObject(hdc, oldFont);
ReleaseDC(0, hdc);
@@ -362,7 +362,7 @@ static void FillLogFont(const FontDescription& fontDescription, LOGFONT* winfont
winfont->lfStrikeOut = false;
winfont->lfCharSet = DEFAULT_CHARSET;
winfont->lfOutPrecision = OUT_TT_ONLY_PRECIS;
- winfont->lfQuality = ChromiumBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings.
+ winfont->lfQuality = PlatformBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings.
winfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
winfont->lfItalic = fontDescription.italic();
winfont->lfWeight = toGDIFontWeight(fontDescription.weight());
diff --git a/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
index bd33927..a849a6c 100644
--- a/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
@@ -31,12 +31,12 @@
#include "config.h"
#include "FontCache.h"
-#include "ChromiumBridge.h"
#include "Font.h"
#include "FontDescription.h"
#include "FontPlatformData.h"
#include "Logging.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
#include "SimpleFontData.h"
#include "SkPaint.h"
@@ -57,7 +57,7 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
const UChar* characters,
int length)
{
- String family = ChromiumBridge::getFontFamilyForCharacters(characters, length);
+ String family = PlatformBridge::getFontFamilyForCharacters(characters, length);
if (family.isEmpty())
return 0;
diff --git a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
index 1a00833..5da4d5a 100644
--- a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
@@ -32,10 +32,10 @@
#include "config.h"
#include "Font.h"
-#include "ChromiumBridge.h"
#include "FontFallbackList.h"
#include "GlyphBuffer.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
#include "PlatformContextSkia.h"
#include "SimpleFontData.h"
#include "SkiaFontWin.h"
@@ -424,7 +424,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext,
success = painter.drawGlyphs(curLen, &glyphs[0], &advances[0], curAdvance);
if (!success && executions == 0) {
// Ask the browser to load the font for us and retry.
- ChromiumBridge::ensureFontLoaded(font->platformData().hfont());
+ PlatformBridge::ensureFontLoaded(font->platformData().hfont());
continue;
}
break;
diff --git a/Source/WebCore/platform/graphics/chromium/FontLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
index f1eadf2..822bbbb 100644
--- a/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -206,6 +206,16 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
controller.setLetterSpacingAdjustment(letterSpacing());
controller.setPadding(run.padding());
+ if (run.rtl()) {
+ // FIXME: this causes us to shape the text twice -- once to compute the width and then again
+ // below when actually rendering. Change ComplexTextController to match platform/mac and
+ // platform/chromium/win by having it store the shaped runs, so we can reuse the results.
+ controller.reset(point.x() + controller.widthOfFullRun());
+ // We need to set the padding again because ComplexTextController layout consumed the value.
+ // Fixing the above problem would help here too.
+ controller.setPadding(run.padding());
+ }
+
while (controller.nextScriptRun()) {
if (fill) {
controller.fontPlatformDataForScriptRun()->setupPaint(&fillPaint);
@@ -231,6 +241,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
ComplexTextController controller(run, 0, this);
controller.setWordSpacingAdjustment(wordSpacing());
controller.setLetterSpacingAdjustment(letterSpacing());
+ controller.setPadding(run.padding());
return controller.widthOfFullRun();
}
@@ -239,7 +250,7 @@ static int glyphIndexForXPositionInScriptRun(const ComplexTextController& contro
// Iterate through the glyphs in logical order, seeing whether targetX falls between the previous
// position and halfway through the current glyph.
// FIXME: this code probably belongs in ComplexTextController.
- int lastX = controller.rtl() ? controller.width() : 0;
+ int lastX = controller.offsetX() - (controller.rtl() ? -controller.width() : controller.width());
for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < controller.length(); ++glyphIndex) {
int advance = truncateFixedPointToInteger(controller.advances()[glyphIndex]);
int nextX = static_cast<int>(controller.xPositions()[glyphIndex]) + advance / 2;
@@ -257,53 +268,29 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
{
// FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
// to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
- int x = static_cast<int>(xFloat);
+ int targetX = static_cast<int>(xFloat);
// (Mac code ignores includePartialGlyphs, and they don't know what it's
// supposed to do, so we just ignore it as well.)
ComplexTextController controller(run, 0, this);
controller.setWordSpacingAdjustment(wordSpacing());
controller.setLetterSpacingAdjustment(letterSpacing());
-
- // If this is RTL text, the first glyph from the left is actually the last
- // code point. So we need to know how many code points there are total in
- // order to subtract. This is different from the length of the TextRun
- // because UTF-16 surrogate pairs are a single code point, but 32-bits long.
- // In LTR we leave this as 0 so that we get the correct value for
- // |basePosition|, below.
- unsigned totalCodePoints = 0;
- if (controller.rtl()) {
- ssize_t offset = 0;
- while (offset < run.length()) {
- utf16_to_code_point(run.characters(), run.length(), &offset);
- totalCodePoints++;
- }
+ controller.setPadding(run.padding());
+ if (run.rtl()) {
+ // See FIXME in drawComplexText.
+ controller.reset(controller.widthOfFullRun());
+ controller.setPadding(run.padding());
}
- unsigned basePosition = totalCodePoints;
-
- // For RTL:
- // code-point order: abcd efg hijkl
- // on screen: lkjih gfe dcba
- // ^ ^
- // | |
- // basePosition--| |
- // totalCodePoints----|
- // Since basePosition is currently the total number of code-points, the
- // first thing we do is decrement it so that it's pointing to the start of
- // the current script-run.
- //
- // For LTR, basePosition is zero so it already points to the start of the
- // first script run.
+ unsigned basePosition = 0;
+
+ int x = controller.offsetX();
while (controller.nextScriptRun()) {
- if (controller.rtl())
- basePosition -= controller.numCodePoints();
+ int nextX = controller.offsetX();
- if (x >= 0 && static_cast<unsigned>(x) < controller.width()) {
- // The x value in question is within this script run. We consider
- // each glyph in presentation order and stop when we find the one
- // covering this position.
- const int glyphIndex = glyphIndexForXPositionInScriptRun(controller, x);
+ if (std::min(x, nextX) <= targetX && targetX <= std::max(x, nextX)) {
+ // The x value in question is within this script run.
+ const int glyphIndex = glyphIndexForXPositionInScriptRun(controller, targetX);
// Now that we have a glyph index, we have to turn that into a
// code-point index. Because of ligatures, several code-points may
@@ -324,10 +311,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
return basePosition + controller.numCodePoints() - 1;
}
- x -= controller.width();
-
- if (!controller.rtl())
- basePosition += controller.numCodePoints();
+ basePosition += controller.numCodePoints();
}
return basePosition;
@@ -342,27 +326,21 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
ComplexTextController controller(run, 0, this);
controller.setWordSpacingAdjustment(wordSpacing());
controller.setLetterSpacingAdjustment(letterSpacing());
+ controller.setPadding(run.padding());
+ if (run.rtl()) {
+ // See FIXME in drawComplexText.
+ controller.reset(controller.widthOfFullRun());
+ controller.setPadding(run.padding());
+ }
- // Base will point to the x offset for the start of the current script run. Note that, in
- // the LTR case, width will be 0.
- int base = controller.rtl() ? controller.widthOfFullRun() : 0;
-
- controller.reset();
+ // Iterate through the script runs in logical order, searching for the run covering the positions of interest.
while (controller.nextScriptRun() && (fromX == -1 || toX == -1)) {
- // ComplexTextController will helpfully accululate the x offsets for different
- // script runs for us. For this code, however, we always want the x offsets
- // to start from zero so we call this before each script run.
- controller.setXOffsetToZero();
-
- if (controller.rtl())
- base -= controller.width();
-
if (fromX == -1 && from >= 0 && static_cast<unsigned>(from) < controller.numCodePoints()) {
// |from| is within this script run. So we index the clusters log to
// find which glyph this code-point contributed to and find its x
// position.
int glyph = controller.logClusters()[from];
- fromX = base + controller.xPositions()[glyph];
+ fromX = controller.xPositions()[glyph];
if (controller.rtl())
fromX += truncateFixedPointToInteger(controller.advances()[glyph]);
} else
@@ -370,22 +348,18 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < controller.numCodePoints()) {
int glyph = controller.logClusters()[to];
- toX = base + controller.xPositions()[glyph];
+ toX = controller.xPositions()[glyph];
if (controller.rtl())
toX += truncateFixedPointToInteger(controller.advances()[glyph]);
} else
to -= controller.numCodePoints();
-
- if (!controller.rtl())
- base += controller.width();
}
// The position in question might be just after the text.
- const int endEdge = base;
- if (fromX == -1 && !from)
- fromX = endEdge;
- if (toX == -1 && !to)
- toX = endEdge;
+ if (fromX == -1)
+ fromX = controller.offsetX();
+ if (toX == -1)
+ toX = controller.offsetX();
ASSERT(fromX != -1 && toX != -1);
diff --git a/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
index d6c83ec..1022a9f 100644
--- a/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
@@ -36,7 +36,7 @@
#include <objidl.h>
#include <mlang.h>
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "SkiaFontWin.h"
namespace WebCore {
@@ -136,7 +136,7 @@ SCRIPT_FONTPROPERTIES* FontPlatformData::scriptFontProperties() const
HRESULT hr = ScriptGetFontProperties(dc, scriptCache(),
m_scriptFontProperties);
if (S_OK != hr) {
- if (ChromiumBridge::ensureFontLoaded(hfont())) {
+ if (PlatformBridge::ensureFontLoaded(hfont())) {
// FIXME: Handle gracefully the error if this call also fails.
hr = ScriptGetFontProperties(dc, scriptCache(),
m_scriptFontProperties);
diff --git a/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
index 42942cc..a1ea012 100644
--- a/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
@@ -31,9 +31,9 @@
#include "config.h"
#include "FontPlatformData.h"
-#include "ChromiumBridge.h"
#include "HarfbuzzSkia.h"
#include "NotImplemented.h"
+#include "PlatformBridge.h"
#include "PlatformString.h"
#include "SkPaint.h"
@@ -229,7 +229,7 @@ void FontPlatformData::querySystemForRenderStyle()
return;
}
- ChromiumBridge::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style);
+ PlatformBridge::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
index 697cf5e..4393f97 100644
--- a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
+++ b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
@@ -34,12 +34,16 @@
#include "DrawingBuffer.h"
#include "FloatRect.h"
+#include "FloatSize.h"
#include "GraphicsContext3D.h"
+#include "internal_glu.h"
#include "IntRect.h"
+#include "Path.h"
#include "PlatformString.h"
#include "SharedGraphicsContext3D.h"
-#include "SolidFillShader.h"
-#include "TexShader.h"
+#if PLATFORM(SKIA)
+#include "SkPath.h"
+#endif
#include "Texture.h"
#define _USE_MATH_DEFINES
@@ -50,17 +54,99 @@
namespace WebCore {
+// Number of line segments used to approximate bezier curves.
+const int pathTesselation = 30;
+typedef void (GLAPIENTRY *TESSCB)();
+typedef WTF::Vector<float> FloatVector;
+typedef WTF::Vector<double> DoubleVector;
+
struct GLES2Canvas::State {
State()
: m_fillColor(0, 0, 0, 255)
, m_alpha(1.0f)
, m_compositeOp(CompositeSourceOver)
+ , m_clippingEnabled(false)
+ {
+ }
+ State(const State& other)
+ : m_fillColor(other.m_fillColor)
+ , m_alpha(other.m_alpha)
+ , m_compositeOp(other.m_compositeOp)
+ , m_ctm(other.m_ctm)
+ , m_clippingPaths() // Don't copy; clipping paths are tracked per-state.
+ , m_clippingEnabled(other.m_clippingEnabled)
{
}
Color m_fillColor;
float m_alpha;
CompositeOperator m_compositeOp;
AffineTransform m_ctm;
+ WTF::Vector<Path> m_clippingPaths;
+ bool m_clippingEnabled;
+};
+
+static inline FloatPoint operator*(const FloatPoint& f, float scale)
+{
+ return FloatPoint(f.x() * scale, f.y() * scale);
+}
+
+static inline FloatPoint operator*(float scale, const FloatPoint& f)
+{
+ return FloatPoint(f.x() * scale, f.y() * scale);
+}
+
+static inline FloatSize operator*(const FloatSize& f, float scale)
+{
+ return FloatSize(f.width() * scale, f.height() * scale);
+}
+
+static inline FloatSize operator*(float scale, const FloatSize& f)
+{
+ return FloatSize(f.width() * scale, f.height() * scale);
+}
+
+class Quadratic {
+ public:
+ Quadratic(FloatPoint a, FloatPoint b, FloatPoint c) :
+ m_a(a), m_b(b), m_c(c)
+ {
+ }
+ static Quadratic fromBezier(FloatPoint p0, FloatPoint p1, FloatPoint p2)
+ {
+ FloatSize p1s(p1.x(), p1.y());
+ FloatSize p2s(p2.x(), p2.y());
+ FloatPoint b = -2.0f * p0 + 2.0f * p1s;
+ FloatPoint c = p0 - 2.0f * p1s + p2s;
+ return Quadratic(p0, b, c);
+ }
+ inline FloatPoint evaluate(float t)
+ {
+ return m_a + t * (m_b + t * m_c);
+ }
+ FloatPoint m_a, m_b, m_c, m_d;
+};
+
+class Cubic {
+ public:
+ Cubic(FloatPoint a, FloatPoint b, FloatPoint c, FloatPoint d) :
+ m_a(a), m_b(b), m_c(c), m_d(d)
+ {
+ }
+ static Cubic fromBezier(FloatPoint p0, FloatPoint p1, FloatPoint p2, FloatPoint p3)
+ {
+ FloatSize p1s(p1.x(), p1.y());
+ FloatSize p2s(p2.x(), p2.y());
+ FloatSize p3s(p3.x(), p3.y());
+ FloatPoint b = -3.0f * p0 + 3.0f * p1s;
+ FloatPoint c = 3.0f * p0 - 6.0f * p1s + 3.0f * p2s;
+ FloatPoint d = -1.0f * p0 + 3.0f * p1s - 3.0f * p2s + p3s;
+ return Cubic(p0, b, c, d);
+ }
+ FloatPoint evaluate(float t)
+ {
+ return m_a + t * (m_b + t * (m_c + t * m_d));
+ }
+ FloatPoint m_a, m_b, m_c, m_d;
};
GLES2Canvas::GLES2Canvas(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const IntSize& size)
@@ -88,7 +174,7 @@ void GLES2Canvas::bindFramebuffer()
void GLES2Canvas::clearRect(const FloatRect& rect)
{
bindFramebuffer();
- if (m_state->m_ctm.isIdentity()) {
+ if (m_state->m_ctm.isIdentity() && !m_state->m_clippingEnabled) {
m_context->scissor(rect);
m_context->enable(GraphicsContext3D::SCISSOR_TEST);
m_context->clearColor(Color(RGBA32(0)));
@@ -102,13 +188,21 @@ void GLES2Canvas::clearRect(const FloatRect& rect)
}
}
+void GLES2Canvas::fillPath(const Path& path)
+{
+ m_context->applyCompositeOperator(m_state->m_compositeOp);
+ applyClipping(m_state->m_clippingEnabled);
+ fillPath(path, m_state->m_fillColor);
+}
+
void GLES2Canvas::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
{
m_context->applyCompositeOperator(m_state->m_compositeOp);
+ applyClipping(m_state->m_clippingEnabled);
m_context->useQuadVertices();
AffineTransform matrix(m_flipMatrix);
- matrix.multLeft(m_state->m_ctm);
+ matrix *= m_state->m_ctm;
matrix.translate(rect.x(), rect.y());
matrix.scale(rect.width(), rect.height());
@@ -150,7 +244,24 @@ void GLES2Canvas::scale(const FloatSize& size)
void GLES2Canvas::concatCTM(const AffineTransform& affine)
{
- m_state->m_ctm.multLeft(affine);
+ m_state->m_ctm *= affine;
+}
+
+void GLES2Canvas::clipPath(const Path& path)
+{
+ bindFramebuffer();
+ checkGLError("bindFramebuffer");
+ beginStencilDraw();
+ // Red is used so we can see it if it ends up in the color buffer.
+ Color red(255, 0, 0, 255);
+ fillPath(path, red);
+ m_state->m_clippingPaths.append(path);
+ m_state->m_clippingEnabled = true;
+}
+
+void GLES2Canvas::clipOut(const Path& path)
+{
+ ASSERT(!"clipOut is unsupported in GLES2Canvas.\n");
}
void GLES2Canvas::save()
@@ -162,13 +273,30 @@ void GLES2Canvas::save()
void GLES2Canvas::restore()
{
ASSERT(!m_stateStack.isEmpty());
+ bool hadClippingPaths = !m_state->m_clippingPaths.isEmpty();
m_stateStack.removeLast();
m_state = &m_stateStack.last();
+ if (hadClippingPaths) {
+ m_context->clear(GraphicsContext3D::STENCIL_BUFFER_BIT);
+ beginStencilDraw();
+ StateVector::const_iterator iter;
+ for (iter = m_stateStack.begin(); iter < m_stateStack.end(); ++iter) {
+ const State& state = *iter;
+ const Vector<Path>& clippingPaths = state.m_clippingPaths;
+ Vector<Path>::const_iterator pathIter;
+ for (pathIter = clippingPaths.begin(); pathIter < clippingPaths.end(); ++pathIter) {
+ // Red is used so we can see it if it ends up in the color buffer.
+ Color red(255, 0, 0, 255);
+ fillPath(*pathIter, red);
+ }
+ }
+ }
}
void GLES2Canvas::drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
{
m_context->applyCompositeOperator(compositeOp);
+ applyClipping(false);
m_context->useQuadVertices();
m_context->setActiveTexture(GraphicsContext3D::TEXTURE0);
@@ -180,13 +308,14 @@ void GLES2Canvas::drawTexturedRect(unsigned texture, const IntSize& textureSize,
void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
{
- drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp);
+ drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp, m_state->m_clippingEnabled);
}
-void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp)
+void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, bool clip)
{
m_context->applyCompositeOperator(compositeOp);
+ applyClipping(clip);
const TilingData& tiles = texture->tiles();
IntRect tileIdxRect = tiles.overlappedTileIndices(srcRect);
@@ -220,7 +349,7 @@ void GLES2Canvas::drawTexturedRectTile(Texture* texture, int tile, const FloatRe
void GLES2Canvas::drawQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
{
AffineTransform matrix(m_flipMatrix);
- matrix.multLeft(transform);
+ matrix *= transform;
matrix.translate(dstRect.x(), dstRect.y());
matrix.scale(dstRect.width(), dstRect.height());
@@ -251,6 +380,214 @@ Texture* GLES2Canvas::getTexture(NativeImagePtr ptr)
return m_context->getTexture(ptr);
}
+#if PLATFORM(SKIA)
+// This is actually cross-platform code, but since its only caller is inside a
+// PLATFORM(SKIA), it will cause a warning-as-error on Chrome/Mac.
+static void interpolateQuadratic(DoubleVector* vertices, const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2)
+{
+ float tIncrement = 1.0f / pathTesselation, t = tIncrement;
+ Quadratic c = Quadratic::fromBezier(p0, p1, p2);
+ for (int i = 0; i < pathTesselation; ++i, t += tIncrement) {
+ FloatPoint p = c.evaluate(t);
+ vertices->append(p.x());
+ vertices->append(p.y());
+ vertices->append(1.0);
+ }
+}
+
+static void interpolateCubic(DoubleVector* vertices, const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3)
+{
+ float tIncrement = 1.0f / pathTesselation, t = tIncrement;
+ Cubic c = Cubic::fromBezier(p0, p1, p2, p3);
+ for (int i = 0; i < pathTesselation; ++i, t += tIncrement) {
+ FloatPoint p = c.evaluate(t);
+ vertices->append(p.x());
+ vertices->append(p.y());
+ vertices->append(1.0);
+ }
+}
+#endif
+
+struct PolygonData {
+ PolygonData(FloatVector* vertices, WTF::Vector<short>* indices)
+ : m_vertices(vertices)
+ , m_indices(indices)
+ {
+ }
+ FloatVector* m_vertices;
+ WTF::Vector<short>* m_indices;
+};
+
+static void beginData(GLenum type, void* data)
+{
+ ASSERT(type == GL_TRIANGLES);
+}
+
+static void edgeFlagData(GLboolean flag, void* data)
+{
+}
+
+static void vertexData(void* vertexData, void* data)
+{
+ static_cast<PolygonData*>(data)->m_indices->append(reinterpret_cast<long>(vertexData));
+}
+
+static void endData(void* data)
+{
+}
+
+static void combineData(GLdouble coords[3], void* vertexData[4],
+ GLfloat weight[4], void **outData, void* data)
+{
+ PolygonData* polygonData = static_cast<PolygonData*>(data);
+ int index = polygonData->m_vertices->size() / 3;
+ polygonData->m_vertices->append(static_cast<float>(coords[0]));
+ polygonData->m_vertices->append(static_cast<float>(coords[1]));
+ polygonData->m_vertices->append(1.0f);
+ *outData = reinterpret_cast<void*>(index);
+}
+
+typedef void (*TESSCB)();
+
+void GLES2Canvas::createVertexBufferFromPath(const Path& path, int* count, unsigned* vertexBuffer, unsigned* indexBuffer)
+{
+ *vertexBuffer = m_context->graphicsContext3D()->createBuffer();
+ checkGLError("createVertexBufferFromPath, createBuffer");
+ *indexBuffer = m_context->graphicsContext3D()->createBuffer();
+ checkGLError("createVertexBufferFromPath, createBuffer");
+ DoubleVector inVertices;
+ WTF::Vector<size_t> contours;
+#if PLATFORM(SKIA)
+ const SkPath* skPath = path.platformPath();
+ SkPoint pts[4];
+ SkPath::Iter iter(*skPath, true);
+ SkPath::Verb verb;
+ while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
+ switch (verb) {
+ case SkPath::kMove_Verb:
+ inVertices.append(pts[0].fX);
+ inVertices.append(pts[0].fY);
+ inVertices.append(1.0);
+ break;
+ case SkPath::kLine_Verb:
+ inVertices.append(pts[1].fX);
+ inVertices.append(pts[1].fY);
+ inVertices.append(1.0);
+ break;
+ case SkPath::kQuad_Verb:
+ interpolateQuadratic(&inVertices, pts[0], pts[1], pts[2]);
+ break;
+ case SkPath::kCubic_Verb:
+ interpolateCubic(&inVertices, pts[0], pts[1], pts[2], pts[3]);
+ break;
+ case SkPath::kClose_Verb:
+ contours.append(inVertices.size() / 3);
+ break;
+ case SkPath::kDone_Verb:
+ break;
+ }
+ }
+#else
+ ASSERT(!"Path extraction not implemented on this platform.");
+#endif
+
+ GLUtesselator* tess = internal_gluNewTess();
+ internal_gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO);
+ internal_gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (TESSCB) &beginData);
+ internal_gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (TESSCB) &vertexData);
+ internal_gluTessCallback(tess, GLU_TESS_END_DATA, (TESSCB) &endData);
+ internal_gluTessCallback(tess, GLU_TESS_EDGE_FLAG_DATA, (TESSCB) &edgeFlagData);
+ internal_gluTessCallback(tess, GLU_TESS_COMBINE_DATA, (TESSCB) &combineData);
+ WTF::Vector<short> indices;
+ FloatVector vertices;
+ vertices.reserveInitialCapacity(inVertices.size());
+ PolygonData data(&vertices, &indices);
+ internal_gluTessBeginPolygon(tess, &data);
+ WTF::Vector<size_t>::const_iterator contour;
+ size_t i = 0;
+ for (contour = contours.begin(); contour != contours.end(); ++contour) {
+ internal_gluTessBeginContour(tess);
+ for (; i < *contour; ++i) {
+ vertices.append(inVertices[i * 3]);
+ vertices.append(inVertices[i * 3 + 1]);
+ vertices.append(1.0f);
+ internal_gluTessVertex(tess, &inVertices[i * 3], reinterpret_cast<void*>(i));
+ }
+ internal_gluTessEndContour(tess);
+ }
+ internal_gluTessEndPolygon(tess);
+ internal_gluDeleteTess(tess);
+
+ m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, *vertexBuffer);
+ checkGLError("createVertexBufferFromPath, bindBuffer ARRAY_BUFFER");
+ m_context->graphicsContext3D()->bufferData(GraphicsContext3D::ARRAY_BUFFER, vertices.size() * sizeof(float), vertices.data(), GraphicsContext3D::STREAM_DRAW);
+ checkGLError("createVertexBufferFromPath, bufferData ARRAY_BUFFER");
+
+ m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, *indexBuffer);
+ checkGLError("createVertexBufferFromPath, bindBuffer ELEMENT_ARRAY_BUFFER");
+ m_context->graphicsContext3D()->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(short), indices.data(), GraphicsContext3D::STREAM_DRAW);
+ checkGLError("createVertexBufferFromPath, bufferData ELEMENT_ARRAY_BUFFER");
+ *count = indices.size();
+}
+
+void GLES2Canvas::fillPath(const Path& path, const Color& color)
+{
+ int count;
+ unsigned vertexBuffer, indexBuffer;
+ createVertexBufferFromPath(path, &count, &vertexBuffer, &indexBuffer);
+ m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, vertexBuffer);
+ checkGLError("bindBuffer");
+ m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indexBuffer);
+ checkGLError("bindBuffer");
+
+ AffineTransform matrix(m_flipMatrix);
+ matrix *= m_state->m_ctm;
+
+ m_context->useFillSolidProgram(matrix, color);
+ checkGLError("useFillSolidProgram");
+
+ m_context->graphicsContext3D()->drawElements(GraphicsContext3D::TRIANGLES, count, GraphicsContext3D::UNSIGNED_SHORT, 0);
+ checkGLError("drawArrays");
+
+ m_context->graphicsContext3D()->deleteBuffer(vertexBuffer);
+ checkGLError("deleteBuffer");
+
+ m_context->graphicsContext3D()->deleteBuffer(indexBuffer);
+ checkGLError("deleteBuffer");
+}
+
+void GLES2Canvas::beginStencilDraw()
+{
+ // Turn on stencil test.
+ m_context->enableStencil(true);
+ checkGLError("enable STENCIL_TEST");
+
+ // Stencil test never passes, so colorbuffer is not drawn.
+ m_context->graphicsContext3D()->stencilFunc(GraphicsContext3D::NEVER, 1, 1);
+ checkGLError("stencilFunc");
+
+ // All writes incremement the stencil buffer.
+ m_context->graphicsContext3D()->stencilOp(GraphicsContext3D::INCR,
+ GraphicsContext3D::INCR,
+ GraphicsContext3D::INCR);
+ checkGLError("stencilOp");
+}
+
+void GLES2Canvas::applyClipping(bool enable)
+{
+ m_context->enableStencil(enable);
+ if (enable) {
+ // Enable drawing only where stencil is non-zero.
+ m_context->graphicsContext3D()->stencilFunc(GraphicsContext3D::EQUAL, m_state->m_clippingPaths.size() % 256, 1);
+ checkGLError("stencilFunc");
+ // Keep all stencil values the same.
+ m_context->graphicsContext3D()->stencilOp(GraphicsContext3D::KEEP,
+ GraphicsContext3D::KEEP,
+ GraphicsContext3D::KEEP);
+ checkGLError("stencilOp");
+ }
+}
+
void GLES2Canvas::checkGLError(const char* header)
{
#ifndef NDEBUG
@@ -283,4 +620,3 @@ void GLES2Canvas::checkGLError(const char* header)
}
}
-
diff --git a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h
index 6fc1a0e..605f86f 100644
--- a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h
+++ b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h
@@ -48,13 +48,16 @@ class Color;
class DrawingBuffer;
class FloatRect;
class GraphicsContext3D;
+class Path;
class SharedGraphicsContext3D;
-class GLES2Canvas : public Noncopyable {
+class GLES2Canvas {
+ WTF_MAKE_NONCOPYABLE(GLES2Canvas);
public:
GLES2Canvas(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
~GLES2Canvas();
+ void fillPath(const Path&);
void fillRect(const FloatRect&, const Color&, ColorSpace);
void fillRect(const FloatRect&);
void clearRect(const FloatRect&);
@@ -65,6 +68,8 @@ public:
void rotate(float angleInRadians);
void scale(const FloatSize&);
void concatCTM(const AffineTransform&);
+ void clipPath(const Path&);
+ void clipOut(const Path&);
void save();
void restore();
@@ -72,9 +77,13 @@ public:
// non-standard functions
// These are not standard GraphicsContext functions, and should be pushed
// down into a PlatformContextGLES2 at some point.
+
+ // This version is called by the canvas->canvas draws.
void drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator);
- void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator);
+ // This version is called by BitmapImage::draw().
void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator);
+ // This version is called by the above, and by the software->hardware uploads.
+ void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator, bool clip);
Texture* createTexture(NativeImagePtr, Texture::Format, int width, int height);
Texture* getTexture(NativeImagePtr);
@@ -88,6 +97,10 @@ private:
void drawTexturedRectTile(Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha);
void drawQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha);
void applyCompositeOperator(CompositeOperator);
+ void createVertexBufferFromPath(const Path&, int* count, unsigned* vertexBuffer, unsigned* indexBuffer);
+ void fillPath(const Path&, const Color&);
+ void beginStencilDraw();
+ void applyClipping(bool enable);
void checkGLError(const char* header);
IntSize m_size;
@@ -96,7 +109,8 @@ private:
DrawingBuffer* m_drawingBuffer;
struct State;
- WTF::Vector<State> m_stateStack;
+ typedef WTF::Vector<State> StateVector;
+ StateVector m_stateStack;
State* m_state;
AffineTransform m_flipMatrix;
};
diff --git a/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
index e71f66a..ee2b5ab 100644
--- a/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
@@ -32,9 +32,9 @@
#include <windows.h>
#include <vector>
-#include "ChromiumBridge.h"
#include "Font.h"
#include "GlyphPageTreeNode.h"
+#include "PlatformBridge.h"
#include "SimpleFontData.h"
#include "UniscribeHelperTextRun.h"
#include "WindowsVersion.h"
@@ -80,12 +80,11 @@ static bool fillBMPGlyphs(unsigned offset,
ReleaseDC(0, dc);
if (recurse) {
- if (ChromiumBridge::ensureFontLoaded(fontData->platformData().hfont()))
+ if (PlatformBridge::ensureFontLoaded(fontData->platformData().hfont()))
return fillBMPGlyphs(offset, length, buffer, page, fontData, false);
- else {
- fillEmptyGlyphs(page);
- return false;
- }
+
+ fillEmptyGlyphs(page);
+ return false;
} else {
// FIXME: Handle gracefully the error if this call also fails.
// See http://crbug.com/6401
diff --git a/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp
index e90d566..e2b6f7a 100644
--- a/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "Image.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
namespace WebCore {
@@ -39,7 +39,7 @@ namespace WebCore {
PassRefPtr<Image> Image::loadPlatformResource(const char *name)
{
- return ChromiumBridge::loadPlatformImageResource(name);
+ return PlatformBridge::loadPlatformImageResource(name);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm b/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm
index 073a409..f003894 100644
--- a/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm
+++ b/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm
@@ -33,14 +33,14 @@
#include "config.h"
#include "BitmapImage.h"
-#include "ChromiumBridge.h"
#include "Image.h"
+#include "PlatformBridge.h"
namespace WebCore {
PassRefPtr<Image> Image::loadPlatformResource(const char* name)
{
- return ChromiumBridge::loadPlatformImageResource(name);
+ return PlatformBridge::loadPlatformImageResource(name);
}
// FIXME: These are temporary stubs, we need real implementations which
diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 8d77bea..90eac74 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -119,12 +119,6 @@ LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> conte
LayerRendererChromium::~LayerRendererChromium()
{
cleanupSharedObjects();
-
- // Because the tilers need to clean up textures, clean them up explicitly
- // before the GraphicsContext3D is destroyed.
- m_rootLayerTiler.clear();
- m_horizontalScrollbarTiler.clear();
- m_verticalScrollbarTiler.clear();
}
GraphicsContext3D* LayerRendererChromium::context()
@@ -269,6 +263,9 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect
updateAndDrawRootLayer(tilePaint, scrollbarPaint, visibleRect, contentRect);
+ // Re-enable color writes to layers, which may be partially transparent.
+ m_context->colorMask(true, true, true, true);
+
// Set the root visible/content rects --- used by subsequent drawLayers calls.
m_rootVisibleRect = visibleRect;
m_rootContentRect = contentRect;
@@ -795,6 +792,11 @@ void LayerRendererChromium::cleanupSharedObjects()
if (m_offscreenFramebufferId)
GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId));
+ // Clear tilers before the texture manager, as they have references to textures.
+ m_rootLayerTiler.clear();
+ m_horizontalScrollbarTiler.clear();
+ m_verticalScrollbarTiler.clear();
+
m_textureManager.clear();
}
diff --git a/Source/WebCore/platform/graphics/chromium/LayerTexture.h b/Source/WebCore/platform/graphics/chromium/LayerTexture.h
index 711e687..b60dff2 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerTexture.h
+++ b/Source/WebCore/platform/graphics/chromium/LayerTexture.h
@@ -28,6 +28,7 @@
#include "IntSize.h"
#include "TextureManager.h"
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
@@ -37,7 +38,8 @@ namespace WebCore {
class GraphicsContext3D;
class TextureManager;
-class LayerTexture : public Noncopyable {
+class LayerTexture {
+ WTF_MAKE_NONCOPYABLE(LayerTexture); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<LayerTexture> create(GraphicsContext3D* context, TextureManager* manager)
{
diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
index b4b4a72..6b65e66 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
@@ -33,6 +33,7 @@
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
+#include "LayerTexture.h"
#if PLATFORM(SKIA)
#include "NativeImageSkia.h"
@@ -54,7 +55,8 @@ PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium*
}
LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize)
- : m_layerRenderer(layerRenderer)
+ : m_skipsDraw(false)
+ , m_layerRenderer(layerRenderer)
{
setTileSize(tileSize);
}
@@ -83,17 +85,7 @@ void LayerTilerChromium::setTileSize(const IntSize& size)
void LayerTilerChromium::reset()
{
- for (size_t i = 0; i < m_tiles.size(); ++i) {
- if (!m_tiles[i])
- continue;
- layerRenderer()->deleteLayerTexture(m_tiles[i]->releaseTextureId());
- }
m_tiles.clear();
- for (size_t i = 0; i < m_unusedTiles.size(); ++i) {
- if (!m_unusedTiles[i])
- continue;
- layerRenderer()->deleteLayerTexture(m_unusedTiles[i]->releaseTextureId());
- }
m_unusedTiles.clear();
m_layerSize = IntSize();
@@ -110,12 +102,9 @@ LayerTilerChromium::Tile* LayerTilerChromium::createTile(int i, int j)
m_tiles[index] = m_unusedTiles.last().release();
m_unusedTiles.removeLast();
} else {
- const unsigned int textureId = layerRenderer()->createLayerTexture();
- OwnPtr<Tile> tile = adoptPtr(new Tile(textureId));
-
GraphicsContext3D* context = layerRendererContext();
- GLC(context, context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_tileSize.width(), m_tileSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE));
-
+ TextureManager* manager = layerRenderer()->textureManager();
+ OwnPtr<Tile> tile = adoptPtr(new Tile(LayerTexture::create(context, manager)));
m_tiles[index] = tile.release();
}
@@ -238,6 +227,9 @@ void LayerTilerChromium::invalidateEntireLayer()
void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& contentRect)
{
+ if (m_skipsDraw)
+ return;
+
// Invalidate old tiles that were previously used but aren't in use this
// frame so that they can get reused for new tiles.
IntRect layerRect = contentRectToLayerRect(contentRect);
@@ -256,6 +248,8 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont
Tile* tile = m_tiles[tileIndex(i, j)].get();
if (!tile)
tile = createTile(i, j);
+ if (!tile->texture()->isValid(m_tileSize, GraphicsContext3D::RGBA))
+ tile->m_dirtyLayerRect = tileLayerRect(i, j);
dirtyLayerRect.unite(tile->m_dirtyLayerRect);
}
}
@@ -318,6 +312,12 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont
if (sourceRect.isEmpty())
continue;
+ if (!tile->texture()->reserve(m_tileSize, GraphicsContext3D::RGBA)) {
+ m_skipsDraw = true;
+ reset();
+ return;
+ }
+
// Calculate tile-space rectangle to upload into.
IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
ASSERT(destRect.x() >= 0);
@@ -342,7 +342,7 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont
pixelSource = &m_tilePixels[0];
}
- GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, tile->textureId()));
+ tile->texture()->bindTexture();
GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource));
tile->clearDirty();
@@ -357,6 +357,9 @@ void LayerTilerChromium::setLayerPosition(const IntPoint& layerPosition)
void LayerTilerChromium::draw(const IntRect& contentRect)
{
+ if (m_skipsDraw)
+ return;
+
// We reuse the shader program used by ContentLayerChromium.
GraphicsContext3D* context = layerRendererContext();
const ContentLayerChromium::SharedValues* contentLayerValues = layerRenderer()->contentLayerSharedValues();
@@ -370,13 +373,15 @@ void LayerTilerChromium::draw(const IntRect& contentRect)
Tile* tile = m_tiles[tileIndex(i, j)].get();
ASSERT(tile);
- GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, tile->textureId()));
+ tile->texture()->bindTexture();
TransformationMatrix tileMatrix;
IntRect tileRect = tileContentRect(i, j);
tileMatrix.translate3d(tileRect.x() - contentRect.x() + tileRect.width() / 2.0, tileRect.y() - contentRect.y() + tileRect.height() / 2.0, 0);
LayerChromium::drawTexturedQuad(context, layerRenderer()->projectionMatrix(), tileMatrix, m_tileSize.width(), m_tileSize.height(), 1, contentLayerValues->shaderMatrixLocation(), contentLayerValues->shaderAlphaLocation());
+
+ tile->texture()->unreserve();
}
}
}
@@ -410,21 +415,6 @@ void LayerTilerChromium::growLayerToContain(const IntRect& contentRect)
resizeLayer(newSize);
}
-LayerTilerChromium::Tile::~Tile()
-{
- // Each tile doesn't have a reference to the context, so can't clean up
- // its own texture. If this assert is hit, then the LayerTilerChromium
- // destructor didn't clean this up.
- ASSERT(!m_textureId);
-}
-
-unsigned int LayerTilerChromium::Tile::releaseTextureId()
-{
- unsigned int id = m_textureId;
- m_textureId = 0;
- return id;
-}
-
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
index c066fdf..e09693d 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
@@ -30,6 +30,7 @@
#if USE(ACCELERATED_COMPOSITING)
#include "LayerChromium.h"
+#include "LayerTexture.h"
#include <wtf/OwnArrayPtr.h>
namespace WebCore {
@@ -42,7 +43,8 @@ public:
virtual void paint(GraphicsContext& context, const IntRect& contentRect) = 0;
};
-class LayerTilerChromium : public Noncopyable {
+class LayerTilerChromium {
+ WTF_MAKE_NONCOPYABLE(LayerTilerChromium);
public:
static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium* layerRenderer, const IntSize& tileSize);
@@ -62,12 +64,11 @@ private:
LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize);
class Tile {
+ WTF_MAKE_NONCOPYABLE(Tile);
public:
- explicit Tile(unsigned int textureId) : m_textureId(textureId) { }
- ~Tile();
+ explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex) {}
- unsigned int textureId() const { return m_textureId; }
- unsigned int releaseTextureId();
+ LayerTexture* texture() { return m_tex.get(); }
bool dirty() const { return !m_dirtyLayerRect.isEmpty(); }
void clearDirty() { m_dirtyLayerRect = IntRect(); }
@@ -75,7 +76,7 @@ private:
// Layer-space dirty rectangle that needs to be repainted.
IntRect m_dirtyLayerRect;
private:
- unsigned int m_textureId;
+ OwnPtr<LayerTexture> m_tex;
};
void resizeLayer(const IntSize& size);
@@ -105,6 +106,8 @@ private:
IntRect m_lastUpdateLayerRect;
IntPoint m_layerPosition;
+ bool m_skipsDraw;
+
// Logical 2D array of tiles (dimensions of m_layerTileSize)
Vector<OwnPtr<Tile> > m_tiles;
// Linear array of unused tiles.
diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
index a93218f..689a6eb 100644
--- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
@@ -41,7 +41,8 @@ class LayerChromium;
class LayerRendererChromium;
class LayerTexture;
-class RenderSurfaceChromium : public Noncopyable {
+class RenderSurfaceChromium {
+ WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium);
friend class LayerRendererChromium;
public:
explicit RenderSurfaceChromium(LayerChromium*);
diff --git a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
index 204c565..c23c586 100644
--- a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
@@ -32,11 +32,11 @@
#include "config.h"
#include "SimpleFontData.h"
-#include "ChromiumBridge.h"
+#include "FloatRect.h"
#include "Font.h"
#include "FontCache.h"
-#include "FloatRect.h"
#include "FontDescription.h"
+#include "PlatformBridge.h"
#include <wtf/MathExtras.h>
#include <unicode/uchar.h>
@@ -70,7 +70,7 @@ void SimpleFontData::platformInit()
TEXTMETRIC textMetric = {0};
if (!GetTextMetrics(dc, &textMetric)) {
- if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) {
+ if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) {
// Retry GetTextMetrics.
// FIXME: Handle gracefully the error if this call also fails.
// See http://crbug.com/6401.
@@ -159,7 +159,7 @@ void SimpleFontData::determinePitch()
// is *not* fixed pitch. Unbelievable but true.
TEXTMETRIC textMetric = {0};
if (!GetTextMetrics(dc, &textMetric)) {
- if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) {
+ if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) {
// Retry GetTextMetrics.
// FIXME: Handle gracefully the error if this call also fails.
// See http://crbug.com/6401.
@@ -190,7 +190,7 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
int width = 0;
if (!GetCharWidthI(dc, glyph, 1, 0, &width)) {
// Ask the browser to preload the font and retry.
- if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) {
+ if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) {
// FIXME: Handle gracefully the error if this call also fails.
// See http://crbug.com/6401.
if (!GetCharWidthI(dc, glyph, 1, 0, &width))
diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h
index 4891cc7..83104a9 100644
--- a/Source/WebCore/platform/graphics/chromium/TextureManager.h
+++ b/Source/WebCore/platform/graphics/chromium/TextureManager.h
@@ -29,6 +29,7 @@
#include "IntRect.h"
#include "IntSize.h"
+#include <wtf/FastAllocBase.h>
#include <wtf/HashMap.h>
#include <wtf/ListHashSet.h>
@@ -36,7 +37,8 @@ namespace WebCore {
typedef int TextureToken;
-class TextureManager : public Noncopyable {
+class TextureManager {
+ WTF_MAKE_NONCOPYABLE(TextureManager);
public:
static PassOwnPtr<TextureManager> create(GraphicsContext3D* context, size_t memoryLimitBytes, int maxTextureSize)
{
diff --git a/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp b/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp
index 4dc2157..ba66eae 100644
--- a/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp
@@ -252,7 +252,7 @@ void TransparencyWin::setupLayerForOpaqueCompositeLayer()
if (m_transformMode == Untransform){
// Compute the inverse mapping from the canvas space to the
// coordinate space of our bitmap.
- mapping = m_orgTransform.inverse() * mapping;
+ mapping *= m_orgTransform.inverse();
}
compositeToCopy(*m_destContext, *m_drawContext, mapping);
@@ -313,7 +313,7 @@ void TransparencyWin::setupTransformForKeepTransform(const IntRect& region)
// We're making a layer, so apply the old transform to the new one
// so it's maintained. We know the new layer has the identity
// transform now, we we can just multiply it.
- xform = m_orgTransform * xform;
+ xform *= m_orgTransform;
m_drawContext->concatCTM(xform);
}
m_drawRect = m_sourceRect;
diff --git a/Source/WebCore/platform/graphics/chromium/TransparencyWin.h b/Source/WebCore/platform/graphics/chromium/TransparencyWin.h
index b6bef91..535cbaa 100644
--- a/Source/WebCore/platform/graphics/chromium/TransparencyWin.h
+++ b/Source/WebCore/platform/graphics/chromium/TransparencyWin.h
@@ -54,7 +54,8 @@ class TransparencyWin_OpaqueCompositeLayer_Test;
// that is composited later manually. This is to get around Windows' inability
// to handle the alpha channel, semitransparent text, and transformed form
// controls.
-class TransparencyWin : public Noncopyable {
+class TransparencyWin {
+ WTF_MAKE_NONCOPYABLE(TransparencyWin);
public:
enum LayerMode {
// No extra layer is created. Drawing will happen to the source.
diff --git a/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp b/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp
index f801c13..aa18b4a 100644
--- a/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp
+++ b/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp
@@ -31,9 +31,10 @@
#include "config.h"
#include "UniscribeHelperTextRun.h"
-#include "ChromiumBridge.h"
#include "Font.h"
+#include "PlatformBridge.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
namespace WebCore {
@@ -79,7 +80,7 @@ void UniscribeHelperTextRun::tryToPreloadFont(HFONT font)
// Ask the browser to get the font metrics for this font.
// That will preload the font and it should now be accessible
// from the renderer.
- ChromiumBridge::ensureFontLoaded(font);
+ PlatformBridge::ensureFontLoaded(font);
}
bool UniscribeHelperTextRun::nextWinFontData(
diff --git a/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 81264b3..776b83f 100644
--- a/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -264,6 +264,7 @@ unsigned VideoLayerChromium::determineTextureFormat(VideoFrameChromium* frame)
{
switch (frame->format()) {
case VideoFrameChromium::YV12:
+ case VideoFrameChromium::YV16:
return GraphicsContext3D::LUMINANCE;
case VideoFrameChromium::RGBA:
return GraphicsContext3D::RGBA;
@@ -330,6 +331,7 @@ void VideoLayerChromium::draw()
switch (m_frameFormat) {
case VideoFrameChromium::YV12:
+ case VideoFrameChromium::YV16:
drawYUV(sv);
break;
case VideoFrameChromium::RGBA:
diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
index c283068..dae83a2 100644
--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
@@ -67,16 +67,21 @@ void DrawingBuffer::clear()
m_multisampleColorBuffer = 0;
}
- if (m_multisampleDepthStencilBuffer) {
- m_context->deleteRenderbuffer(m_multisampleDepthStencilBuffer);
- m_multisampleDepthStencilBuffer = 0;
- }
-
if (m_depthStencilBuffer) {
m_context->deleteRenderbuffer(m_depthStencilBuffer);
m_depthStencilBuffer = 0;
}
+ if (m_depthBuffer) {
+ m_context->deleteRenderbuffer(m_depthBuffer);
+ m_depthBuffer = 0;
+ }
+
+ if (m_stencilBuffer) {
+ m_context->deleteRenderbuffer(m_stencilBuffer);
+ m_stencilBuffer = 0;
+ }
+
if (m_multisampleFBO) {
m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
m_context->deleteFramebuffer(m_multisampleFBO);
@@ -92,22 +97,52 @@ void DrawingBuffer::clear()
void DrawingBuffer::createSecondaryBuffers()
{
- const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
-
- // Create the stencil and depth buffer if needed
- if (!multisample() && (attributes.stencil || attributes.depth))
- m_depthStencilBuffer = m_context->createRenderbuffer();
-
// create a multisample FBO
if (multisample()) {
m_multisampleFBO = m_context->createFramebuffer();
m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
m_multisampleColorBuffer = m_context->createRenderbuffer();
- if (attributes.stencil || attributes.depth)
- m_multisampleDepthStencilBuffer = m_context->createRenderbuffer();
}
}
+void DrawingBuffer::resizeDepthStencil(int sampleCount)
+{
+ const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
+ if (attributes.depth && attributes.stencil && m_packedDepthStencilExtensionSupported) {
+ if (!m_depthStencilBuffer)
+ m_depthStencilBuffer = m_context->createRenderbuffer();
+ m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
+ if (multisample())
+ m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height());
+ else
+ m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height());
+ m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
+ m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
+ } else {
+ if (attributes.depth) {
+ if (!m_depthBuffer)
+ m_depthBuffer = m_context->createRenderbuffer();
+ m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+ if (multisample())
+ m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height());
+ else
+ m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height());
+ m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer);
+ }
+ if (attributes.stencil) {
+ if (!m_stencilBuffer)
+ m_stencilBuffer = m_context->createRenderbuffer();
+ m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+ if (multisample())
+ m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height());
+ else
+ m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height());
+ m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
+ }
+ }
+ m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
+}
+
void DrawingBuffer::reset(const IntSize& newSize)
{
if (m_size == newSize)
@@ -120,7 +155,7 @@ void DrawingBuffer::reset(const IntSize& newSize)
m_context->makeContextCurrent();
const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
- unsigned long internalColorFormat, colorFormat, internalDepthStencilFormat = 0;
+ unsigned long internalColorFormat, colorFormat;
if (attributes.alpha) {
internalColorFormat = GraphicsContext3D::RGBA;
colorFormat = GraphicsContext3D::RGBA;
@@ -128,17 +163,7 @@ void DrawingBuffer::reset(const IntSize& newSize)
internalColorFormat = GraphicsContext3D::RGB;
colorFormat = GraphicsContext3D::RGB;
}
- if (attributes.stencil || attributes.depth) {
- // We don't allow the logic where stencil is required and depth is not.
- // See GraphicsContext3D constructor.
- // FIXME: If packed depth/stencil is not supported, we should
- // create separate renderbuffers for depth and stencil.
- if (attributes.stencil && attributes.depth && m_packedDepthStencilExtensionSupported)
- internalDepthStencilFormat = Extensions3D::DEPTH24_STENCIL8;
- else
- internalDepthStencilFormat = GraphicsContext3D::DEPTH_COMPONENT16;
- }
// resize multisample FBO
if (multisample()) {
@@ -152,15 +177,7 @@ void DrawingBuffer::reset(const IntSize& newSize)
m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalColorFormat, m_size.width(), m_size.height());
m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
- if (attributes.stencil || attributes.depth) {
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer);
- m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalDepthStencilFormat, m_size.width(), m_size.height());
- if (attributes.stencil)
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer);
- if (attributes.depth)
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer);
- }
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
+ resizeDepthStencil(sampleCount);
if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
// Cleanup
clear();
@@ -175,15 +192,7 @@ void DrawingBuffer::reset(const IntSize& newSize)
m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE);
m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
- if (!multisample() && (attributes.stencil || attributes.depth)) {
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, internalDepthStencilFormat, m_size.width(), m_size.height());
- if (attributes.stencil)
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- if (attributes.depth)
- m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
- m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
- }
+ resizeDepthStencil(0);
if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
// Cleanup
clear();
diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
index e0e0ee1..49ae114 100644
--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
@@ -67,6 +67,8 @@ public:
// Create the depth/stencil and multisample buffers, if needed.
void createSecondaryBuffers();
+ void resizeDepthStencil(int sampleCount);
+
// Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound
void commit(long x = 0, long y = 0, long width = -1, long height = -1);
@@ -80,8 +82,10 @@ public:
#endif
#if PLATFORM(CHROMIUM)
- class WillPublishCallback : public Noncopyable {
+ class WillPublishCallback {
+ WTF_MAKE_NONCOPYABLE(WillPublishCallback);
public:
+ WillPublishCallback() { }
virtual ~WillPublishCallback() { }
virtual void willPublish() = 0;
@@ -106,13 +110,18 @@ private:
bool m_packedDepthStencilExtensionSupported;
Platform3DObject m_fbo;
Platform3DObject m_colorBuffer;
+
+ // This is used when we have OES_packed_depth_stencil.
Platform3DObject m_depthStencilBuffer;
+ // These are used when we don't.
+ Platform3DObject m_depthBuffer;
+ Platform3DObject m_stencilBuffer;
+
// For multisampling
Platform3DObject m_multisampleFBO;
Platform3DObject m_multisampleColorBuffer;
- Platform3DObject m_multisampleDepthStencilBuffer;
-
+
#if PLATFORM(CHROMIUM)
OwnPtr<WillPublishCallback> m_callback;
OwnPtr<DrawingBufferInternal> m_internal;
diff --git a/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h b/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h
index c665844..1bd67b8 100644
--- a/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h
+++ b/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h
@@ -30,14 +30,14 @@
#ifndef LoopBlinnClassifier_h
#define LoopBlinnClassifier_h
-#include <wtf/Noncopyable.h>
namespace WebCore {
class FloatPoint;
// Classifies cubic curves into specific types.
-class LoopBlinnClassifier : public Noncopyable {
+class LoopBlinnClassifier {
+ WTF_MAKE_NONCOPYABLE(LoopBlinnClassifier);
public:
// The types of cubic curves.
enum CurveType {
diff --git a/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h b/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h
index ea3d7e3..d01e6c9 100644
--- a/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h
+++ b/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h
@@ -30,19 +30,20 @@
#include "FloatPoint3D.h"
#include "LoopBlinnConstants.h"
#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
namespace WebCore {
// Performs a localized triangulation of the triangle mesh
// corresponding to the four control point vertices of a cubic curve
// segment.
-class LoopBlinnLocalTriangulator : public Noncopyable {
+class LoopBlinnLocalTriangulator {
+ WTF_MAKE_NONCOPYABLE(LoopBlinnLocalTriangulator);
public:
// The vertices that the triangulator operates upon, containing both
// the position information as well as the cubic texture
// coordinates.
- class Vertex : public Noncopyable {
+ class Vertex {
+ WTF_MAKE_NONCOPYABLE(Vertex);
public:
Vertex()
{
diff --git a/Source/WebCore/platform/graphics/gpu/PODArena.h b/Source/WebCore/platform/graphics/gpu/PODArena.h
index f68baef..6edc1db 100644
--- a/Source/WebCore/platform/graphics/gpu/PODArena.h
+++ b/Source/WebCore/platform/graphics/gpu/PODArena.h
@@ -158,7 +158,8 @@ private:
}
// Manages a chunk of memory and individual allocations out of it.
- class Chunk : public Noncopyable {
+ class Chunk {
+ WTF_MAKE_NONCOPYABLE(Chunk);
public:
// Allocates a block of memory of the given size from the passed
// Allocator.
diff --git a/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h b/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h
index 320ce60..5bf3de0 100644
--- a/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h
+++ b/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h
@@ -44,8 +44,8 @@ struct ValueToString;
// supports efficient (O(lg n)) insertion, removal and querying of
// intervals in the tree.
template<class T, class UserData = void*>
-class PODIntervalTree : public Noncopyable,
- public PODRedBlackTree<PODInterval<T, UserData> > {
+class PODIntervalTree : public PODRedBlackTree<PODInterval<T, UserData> > {
+ WTF_MAKE_NONCOPYABLE(PODIntervalTree);
public:
// Typedef to reduce typing when declaring intervals to be stored in
// this tree.
diff --git a/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h b/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h
index 6d5954c..bd08988 100644
--- a/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h
+++ b/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h
@@ -198,7 +198,8 @@ protected:
// The base Node class which is stored in the tree. Nodes are only
// an internal concept; users of the tree deal only with the data
// they store in it.
- class Node : public Noncopyable {
+ class Node {
+ WTF_MAKE_NONCOPYABLE(Node);
public:
// Constructor. Newly-created nodes are colored red.
explicit Node(const T& data)
@@ -659,7 +660,8 @@ private:
// Helper class for size()
// A Visitor which simply counts the number of visited elements.
- class Counter : public Visitor, public Noncopyable {
+ class Counter : public Visitor {
+ WTF_MAKE_NONCOPYABLE(Counter);
public:
Counter()
: m_count(0) { }
diff --git a/Source/WebCore/platform/graphics/gpu/Shader.h b/Source/WebCore/platform/graphics/gpu/Shader.h
index e5bd8de..4f62ca9 100644
--- a/Source/WebCore/platform/graphics/gpu/Shader.h
+++ b/Source/WebCore/platform/graphics/gpu/Shader.h
@@ -40,7 +40,8 @@ class AffineTransform;
class GraphicsContext3D;
class Color;
-class Shader : public Noncopyable {
+class Shader {
+ WTF_MAKE_NONCOPYABLE(Shader);
protected:
Shader(GraphicsContext3D*, unsigned program);
~Shader();
diff --git a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
index 9d1298f..9c59077 100644
--- a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
+++ b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
@@ -51,6 +51,9 @@ namespace WebCore {
PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow* hostWindow)
{
GraphicsContext3D::Attributes attr;
+ attr.depth = false;
+ attr.stencil = true;
+ attr.antialias = false;
attr.canRecoverFromContextLoss = false; // Canvas contexts can not handle lost contexts.
RefPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow);
if (!context)
@@ -293,6 +296,14 @@ void SharedGraphicsContext3D::applyCompositeOperator(CompositeOperator op)
}
}
+void SharedGraphicsContext3D::enableStencil(bool enable)
+{
+ if (enable)
+ m_context->enable(GraphicsContext3D::STENCIL_TEST);
+ else
+ m_context->disable(GraphicsContext3D::STENCIL_TEST);
+}
+
void SharedGraphicsContext3D::useQuadVertices()
{
if (!m_quadVertices) {
diff --git a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
index ea1810d..1e032d7 100644
--- a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
+++ b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
@@ -90,6 +90,7 @@ public:
// Shared logic for canvas 2d
void applyCompositeOperator(CompositeOperator);
+ void enableStencil(bool enable);
void useQuadVertices();
void useFillSolidProgram(const AffineTransform&, const Color&);
diff --git a/Source/WebCore/platform/graphics/gpu/TilingData.h b/Source/WebCore/platform/graphics/gpu/TilingData.h
index 1bdc51a..d1140bd 100644
--- a/Source/WebCore/platform/graphics/gpu/TilingData.h
+++ b/Source/WebCore/platform/graphics/gpu/TilingData.h
@@ -38,7 +38,8 @@ namespace WebCore {
class FloatRect;
class IntRect;
-class TilingData : public Noncopyable {
+class TilingData {
+ WTF_MAKE_NONCOPYABLE(TilingData);
public:
TilingData(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels);
int maxTextureSize() const { return m_maxTextureSize; }
diff --git a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
index 601454e..e6dfdb8 100644
--- a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
+++ b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
@@ -41,15 +41,16 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
bool multisampleExtensionSupported,
bool packedDepthStencilExtensionSupported)
: m_context(context)
- , m_size(size)
+ , m_size(-1, -1)
, m_multisampleExtensionSupported(multisampleExtensionSupported)
, m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported)
, m_fbo(context->createFramebuffer())
, m_colorBuffer(0)
, m_depthStencilBuffer(0)
+ , m_depthBuffer(0)
+ , m_stencilBuffer(0)
, m_multisampleFBO(0)
, m_multisampleColorBuffer(0)
- , m_multisampleDepthStencilBuffer(0)
{
ASSERT(m_fbo);
if (!m_fbo) {
diff --git a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
index e10e61f..36b49df 100644
--- a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
@@ -36,7 +36,8 @@
using namespace WebCore;
-class StreamingClient : public Noncopyable, public ResourceHandleClient {
+class StreamingClient : public ResourceHandleClient {
+ WTF_MAKE_NONCOPYABLE(StreamingClient);
public:
StreamingClient(WebKitWebSrc*);
virtual ~StreamingClient();
diff --git a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp
index fdf91db..4d6f509 100644
--- a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -38,6 +38,7 @@
#include "GraphicsContext.h"
#include "NotImplemented.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include <cairo.h>
#include <gdk/gdk.h>
#include <pango/pango.h>
diff --git a/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
index cc348e3..86f99b2 100644
--- a/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
@@ -24,14 +24,14 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
namespace WebCore {
class FontPlatformData;
class SharedBuffer;
- struct FontCustomPlatformData : Noncopyable {
+ struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
FontCustomPlatformData() { }
~FontCustomPlatformData();
diff --git a/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp b/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
index bdad6a0..7a7c88b 100644
--- a/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
+++ b/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
@@ -78,6 +78,11 @@ ImageBuffer::~ImageBuffer()
{
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.width() * m_size.height() * 4;
+}
+
GraphicsContext* ImageBuffer::context() const
{
ASSERT(m_data.m_view.Window());
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
index 206fd5f..86f6bec 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -30,6 +30,7 @@
#include "FloatSize.h"
#include "Font.h"
#include "TextBreakIterator.h"
+#include "TextRun.h"
#include <wtf/StdLibExtras.h>
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index c24a914..9c2ab6b 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -28,6 +28,7 @@
#include "CharacterNames.h"
#include "Font.h"
#include "ShapeArabic.h"
+#include "TextRun.h"
#ifdef __LP64__
// ATSUTextInserted() is SPI in 64-bit.
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index 42e7897..07fb153 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "ComplexTextController.h"
+#include "TextRun.h"
#include "WebCoreSystemInterface.h"
#if USE(CORE_TEXT)
diff --git a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp
index ca006d9..02bac9c 100644
--- a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp
+++ b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp
@@ -31,6 +31,7 @@
#include "GraphicsContext.h"
#include "IntRect.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include <wtf/MathExtras.h>
using namespace std;
diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
index c11858c..7043d7e 100644
--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
@@ -36,7 +36,9 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
+public:
FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont)
: m_atsContainer(container)
, m_cgFont(cgFont)
diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
index 321d0ef..21eb59d 100644
--- a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
+++ b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
@@ -188,21 +188,15 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
// ANGLE initialization.
- TBuiltInResource ANGLEResources;
+ ShBuiltInResources ANGLEResources;
+ ShInitBuiltInResources(&ANGLEResources);
- ANGLEResources.MaxVertexAttribs = 0;
getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &ANGLEResources.MaxVertexAttribs);
- ANGLEResources.MaxVertexUniformVectors = 0;
getIntegerv(GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS, &ANGLEResources.MaxVertexUniformVectors);
- ANGLEResources.MaxVaryingVectors = 0;
getIntegerv(GraphicsContext3D::MAX_VARYING_VECTORS, &ANGLEResources.MaxVaryingVectors);
- ANGLEResources.MaxVertexTextureImageUnits = 0;
getIntegerv(GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxVertexTextureImageUnits);
- ANGLEResources.MaxCombinedTextureImageUnits = 0;
getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxCombinedTextureImageUnits);
- ANGLEResources.MaxTextureImageUnits = 0;
getIntegerv(GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxTextureImageUnits);
- ANGLEResources.MaxFragmentUniformVectors = 0;
getIntegerv(GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS, &ANGLEResources.MaxFragmentUniformVectors);
// Always set to 1 for OpenGL ES.
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
index 4215d12..3eb5196 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
@@ -33,13 +33,15 @@
#include <wtf/Vector.h>
#if PLATFORM(MAC)
+#include "ANGLE/ShaderLang.h"
#include <OpenGL/gl.h>
#endif
namespace WebCore {
-Extensions3DOpenGL::Extensions3DOpenGL()
+Extensions3DOpenGL::Extensions3DOpenGL(GraphicsContext3D* context)
: m_initializedAvailableExtensions(false)
+ , m_context(context)
{
}
@@ -82,12 +84,28 @@ bool Extensions3DOpenGL::supports(const String& name)
if (name == "GL_OES_texture_float" || name == "GL_OES_texture_half_float")
return m_availableExtensions.contains("GL_ARB_texture_float");
+ // Desktop GL always supports the standard derivative functions
+ if (name == "GL_OES_standard_derivatives")
+ return true;
+
return m_availableExtensions.contains(name);
}
void Extensions3DOpenGL::ensureEnabled(const String& name)
{
+#if PLATFORM(MAC)
+ if (name == "GL_OES_standard_derivatives") {
+ // Enable support in ANGLE (if not enabled already)
+ ANGLEWebKitBridge& compiler = m_context->m_compiler;
+ ShBuiltInResources ANGLEResources = compiler.getResources();
+ if (!ANGLEResources.OES_standard_derivatives) {
+ ANGLEResources.OES_standard_derivatives = 1;
+ compiler.setResources(ANGLEResources);
+ }
+ }
+#else
ASSERT_UNUSED(name, supports(name));
+#endif
}
int Extensions3DOpenGL::getGraphicsResetStatusARB()
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
index 59f8180..1941a42 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
@@ -48,10 +48,13 @@ public:
private:
// This class only needs to be instantiated by GraphicsContext3D implementations.
friend class GraphicsContext3D;
- Extensions3DOpenGL();
+ Extensions3DOpenGL(GraphicsContext3D*);
bool m_initializedAvailableExtensions;
HashSet<String> m_availableExtensions;
+
+ // Weak pointer back to GraphicsContext3D
+ GraphicsContext3D* m_context;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
index 221ee11..7c103f3 100644
--- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
@@ -1467,7 +1467,7 @@ void GraphicsContext3D::synthesizeGLError(GC3Denum error)
Extensions3D* GraphicsContext3D::getExtensions()
{
if (!m_extensions)
- m_extensions = adoptPtr(new Extensions3DOpenGL);
+ m_extensions = adoptPtr(new Extensions3DOpenGL(this));
return m_extensions.get();
}
diff --git a/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h b/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h
index 32f1fe5..3f1494e 100644
--- a/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h
+++ b/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h
@@ -41,7 +41,8 @@ class TiledImageOpenVG;
struct PlatformPainterState;
-class PainterOpenVG : public Noncopyable {
+class PainterOpenVG {
+ WTF_MAKE_NONCOPYABLE(PainterOpenVG);
public:
friend class SurfaceOpenVG;
friend struct PlatformPainterState;
diff --git a/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h b/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
index 46d1646..19d95d8 100644
--- a/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
+++ b/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
@@ -42,7 +42,8 @@ class IntSize;
* of #ifdefs and should make it easy to add different surface/context
* implementations than EGL.
*/
-class SurfaceOpenVG : public Noncopyable {
+class SurfaceOpenVG {
+ WTF_MAKE_NONCOPYABLE(SurfaceOpenVG);
public:
enum MakeCurrentMode {
ApplyPainterStateOnSurfaceSwitch,
diff --git a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
index 834ca62..37d6b44 100644
--- a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp
@@ -72,7 +72,7 @@ QImage* ShadowBuffer::scratchImage(const QSize& size)
// keep too many allocated pixels for too long.
if (!image.isNull() && (image.width() > width) && (image.height() > height))
if (((2 * width) > image.width()) && ((2 * height) > image.height())) {
- image.fill(Qt::transparent);
+ image.fill(0);
return &image;
}
@@ -82,7 +82,7 @@ QImage* ShadowBuffer::scratchImage(const QSize& size)
height = (1 + (height >> 5)) << 5;
image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
- image.fill(Qt::transparent);
+ image.fill(0);
return &image;
}
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
index 6c41d47..54fa679 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
@@ -24,6 +24,7 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
+#include <wtf/FastAllocBase.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -32,7 +33,10 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); WTF_MAKE_FAST_ALLOCATED;
+public:
+ FontCustomPlatformData() { }
~FontCustomPlatformData();
// for use with QFontDatabase::addApplicationFont/removeApplicationFont
diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
index 1c57e29..f268370 100644
--- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h
+++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h
@@ -32,7 +32,8 @@
namespace WebCore {
-class FontPlatformDataPrivate : public Noncopyable {
+class FontPlatformDataPrivate {
+ WTF_MAKE_NONCOPYABLE(FontPlatformDataPrivate); WTF_MAKE_FAST_ALLOCATED;
public:
FontPlatformDataPrivate()
: refCount(1)
@@ -62,8 +63,10 @@ public:
-class FontPlatformData : public FastAllocBase {
+class FontPlatformData {
+ WTF_MAKE_FAST_ALLOCATED;
public:
+ FontPlatformData() { }
FontPlatformData(float size, bool bold, bool oblique);
FontPlatformData(const FontPlatformData &);
FontPlatformData(const FontDescription&, const AtomicString& familyName, int wordSpacing = 0, int letterSpacing = 0);
diff --git a/Source/WebCore/platform/graphics/qt/FontQt.cpp b/Source/WebCore/platform/graphics/qt/FontQt.cpp
index f1ced2b..778a13f 100644
--- a/Source/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontQt.cpp
@@ -31,6 +31,7 @@
#include "GraphicsContext.h"
#include "NotImplemented.h"
#include "Pattern.h"
+#include "TextRun.h"
#include <QBrush>
#include <QFontInfo>
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 253cd84..4dabe09 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -8,7 +8,7 @@
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de>
- * Copyright (C) 2010 Sencha, Inc.
+ * Copyright (C) 2010, 2011 Sencha, Inc.
*
* All rights reserved.
*
@@ -174,7 +174,8 @@ static inline Qt::FillRule toQtFillRule(WindRule rule)
return Qt::OddEvenFill;
}
-class GraphicsContextPlatformPrivate : public Noncopyable {
+class GraphicsContextPlatformPrivate {
+ WTF_MAKE_NONCOPYABLE(GraphicsContextPlatformPrivate); WTF_MAKE_FAST_ALLOCATED;
public:
GraphicsContextPlatformPrivate(QPainter*, const QColor& initialSolidColor);
~GraphicsContextPlatformPrivate();
@@ -505,14 +506,19 @@ void GraphicsContext::fillPath(const Path& path)
brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
shadowPainter->fillPath(platformPath, brush);
- } else
- shadowPainter->fillPath(platformPath, QColor(shadow->m_color));
+ } else {
+ QColor shadowColor = shadow->m_color;
+ shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
+ shadowPainter->fillPath(platformPath, shadowColor);
+ }
shadow->endShadowLayer(this);
}
} else {
QPointF offset = shadow->offset();
p->translate(offset);
- p->fillPath(platformPath, QColor(shadow->m_color));
+ QColor shadowColor = shadow->m_color;
+ shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
+ p->fillPath(platformPath, shadowColor);
p->translate(-offset);
}
}
@@ -550,10 +556,12 @@ void GraphicsContext::strokePath(const Path& path)
shadow->endShadowLayer(this);
}
} else {
- QPen shadowPen(pen);
- shadowPen.setColor(m_data->shadow.m_color);
QPointF offset = shadow->offset();
p->translate(offset);
+ QColor shadowColor = shadow->m_color;
+ shadowColor.setAlphaF(shadowColor.alphaF() * pen.color().alphaF());
+ QPen shadowPen(pen);
+ shadowPen.setColor(shadowColor);
p->strokePath(platformPath, shadowPen);
p->translate(-offset);
}
@@ -983,11 +991,9 @@ void GraphicsContext::clearRect(const FloatRect& rect)
QPainter* p = m_data->p();
QPainter::CompositionMode currentCompositionMode = p->compositionMode();
- if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- p->setCompositionMode(QPainter::CompositionMode_Source);
+ p->setCompositionMode(QPainter::CompositionMode_Source);
p->fillRect(rect, Qt::transparent);
- if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- p->setCompositionMode(currentCompositionMode);
+ p->setCompositionMode(currentCompositionMode);
}
void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
@@ -1077,12 +1083,7 @@ void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op)
if (paintingDisabled())
return;
- QPainter* painter = m_data->p();
-
- if (!painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- return;
-
- painter->setCompositionMode(toQtCompositionMode(op));
+ m_data->p()->setCompositionMode(toQtCompositionMode(op));
}
void GraphicsContext::clip(const Path& path)
diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index f56603d..d1567ec 100644
--- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -95,6 +95,11 @@ ImageBuffer::~ImageBuffer()
{
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.width() * m_size.height() * 4;
+}
+
GraphicsContext* ImageBuffer::context() const
{
ASSERT(m_data.m_painter->isActive());
diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index be6f732..0a4c0f6 100644
--- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -20,7 +20,6 @@
#include "config.h"
#include "MediaPlayerPrivateQt.h"
-#include "FrameLoaderClientQt.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLMediaElement.h"
@@ -205,10 +204,10 @@ void MediaPlayerPrivateQt::commitLoad(const String& url)
// Grab the frame and network manager
Frame* frame = document ? document->frame() : 0;
- QNetworkAccessManager* manager = frame ? frame->loader()->networkingContext()->networkAccessManager() : 0;
- FrameLoaderClientQt* frameLoader = frame ? static_cast<FrameLoaderClientQt*>(frame->loader()->client()) : 0;
+ FrameLoader* frameLoader = frame ? frame->loader() : 0;
+ QNetworkAccessManager* manager = frameLoader ? frameLoader->networkingContext()->networkAccessManager() : 0;
- if (document && manager) {
+ if (manager) {
// Set the cookies
QtNAMThreadSafeProxy managerProxy(manager);
QList<QNetworkCookie> cookies = managerProxy.cookiesForUrl(rUrl);
diff --git a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
index 5b2f8b2..ff9ef20 100644
--- a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
+++ b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h
@@ -42,7 +42,9 @@
namespace WebCore {
-struct TransparencyLayer : FastAllocBase {
+struct TransparencyLayer {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask)
: pixmap(rect.width(), rect.height())
, opacity(opacity)
@@ -59,8 +61,7 @@ struct TransparencyLayer : FastAllocBase {
painter.setTransform(p->transform(), true);
painter.setOpacity(p->opacity());
painter.setFont(p->font());
- if (painter.paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- painter.setCompositionMode(p->compositionMode());
+ painter.setCompositionMode(p->compositionMode());
}
TransparencyLayer()
diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
index e94c417..0b31dfa 100644
--- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
@@ -35,8 +35,8 @@
#if OS(WINDOWS)
#include "Base64.h"
-#include "ChromiumBridge.h"
#include "OpenTypeUtilities.h"
+#include "PlatformBridge.h"
#elif OS(LINUX) || OS(FREEBSD) || PLATFORM(BREWMP)
#include "SkStream.h"
#endif
@@ -91,7 +91,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
logFont.lfStrikeOut = false;
logFont.lfCharSet = DEFAULT_CHARSET;
logFont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
- logFont.lfQuality = ChromiumBridge::layoutTestMode() ?
+ logFont.lfQuality = PlatformBridge::layoutTestMode() ?
NONANTIALIASED_QUALITY :
DEFAULT_QUALITY; // Honor user's desktop settings.
logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h
index e51b6b6..4228b40 100644
--- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h
@@ -49,7 +49,9 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
+public:
#if OS(WINDOWS)
FontCustomPlatformData(HANDLE fontReference, const String& name)
: m_fontReference(fontReference)
diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h b/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h
index 5e12ad6..44835a4 100644
--- a/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h
+++ b/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h
@@ -31,14 +31,14 @@
#ifndef GraphicsContextPlatformPrivate_h
#define GraphicsContextPlatformPrivate_h
-#include <wtf/Noncopyable.h>
class PlatformContextSkia;
namespace WebCore {
// This class just holds onto a PlatformContextSkia for GraphicsContext.
-class GraphicsContextPlatformPrivate : public Noncopyable {
+class GraphicsContextPlatformPrivate {
+ WTF_MAKE_NONCOPYABLE(GraphicsContextPlatformPrivate);
public:
GraphicsContextPlatformPrivate(PlatformContextSkia* platformContext)
: m_context(platformContext) { }
diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 51e2477..1a7112b 100644
--- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -386,6 +386,9 @@ void GraphicsContext::canvasClip(const Path& path)
if (paintingDisabled())
return;
+ if (platformContext()->useGPU())
+ platformContext()->gpuCanvas()->clipPath(path);
+
const SkPath& p = *path.platformPath();
if (!isPathSkiaSafe(getCTM(), p))
return;
@@ -410,6 +413,9 @@ void GraphicsContext::clipOut(const Path& p)
if (paintingDisabled())
return;
+ if (platformContext()->useGPU())
+ platformContext()->gpuCanvas()->clipOut(p);
+
const SkPath& path = *p.platformPath();
if (!isPathSkiaSafe(getCTM(), path))
return;
@@ -422,6 +428,9 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
if (paintingDisabled())
return;
+ if (platformContext()->useGPU())
+ platformContext()->gpuCanvas()->clipPath(pathToClip);
+
// FIXME: Be smarter about this.
beginPath();
addPath(pathToClip);
@@ -733,6 +742,12 @@ void GraphicsContext::fillPath(const Path& pathToFill)
beginPath();
addPath(pathToFill);
+ if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
+ platformContext()->prepareForHardwareDraw();
+ platformContext()->gpuCanvas()->fillPath(pathToFill);
+ return;
+ }
+
SkPath path = platformContext()->currentPathInLocalCoordinates();
if (!isPathSkiaSafe(getCTM(), path))
return;
diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index b65b5bd..2c489ef 100644
--- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -91,6 +91,11 @@ GraphicsContext* ImageBuffer::context() const
return m_context.get();
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.width() * m_size.height() * 4;
+}
+
bool ImageBuffer::drawsUsingCopy() const
{
return false;
diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index d3c0e00..d852e9b 100644
--- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -702,8 +702,7 @@ void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths)
bool PlatformContextSkia::canAccelerate() const
{
return !m_state->m_fillShader // Can't accelerate with a fill gradient or pattern.
- && !m_state->m_looper // Can't accelerate with a shadow.
- && !m_state->m_canvasClipApplied; // Can't accelerate with a clip to path applied.
+ && !m_state->m_looper; // Can't accelerate with a shadow.
}
bool PlatformContextSkia::canvasClipApplied() const
@@ -848,7 +847,7 @@ void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const
m_uploadTexture->updateSubRect(bitmap.getPixels(), m_softwareDirtyRect);
AffineTransform identity;
- gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op);
+ gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op, false);
// Clear out the region of the software canvas we just uploaded.
m_canvas->save();
m_canvas->resetMatrix();
diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
index 11b311a..0304486 100644
--- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -67,7 +67,8 @@ class Texture;
// responsible for managing the painting state which is store in separate
// SkPaint objects. This class provides the adaptor that allows the painting
// state to be pushed and popped along with the bitmap.
-class PlatformContextSkia : public Noncopyable {
+class PlatformContextSkia {
+ WTF_MAKE_NONCOPYABLE(PlatformContextSkia);
public:
// For printing, there shouldn't be any canvas. canvas can be NULL. If you
// supply a NULL canvas, you can also call setCanvas later.
diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp
index f275526..3f88140 100644
--- a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp
+++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp
@@ -164,12 +164,10 @@ AffineTransform AffineTransform::inverse() const
return result;
}
-AffineTransform& AffineTransform::multiply(const AffineTransform& other)
-{
- return (*this) *= other;
-}
-AffineTransform& AffineTransform::multLeft(const AffineTransform& other)
+// Multiplies this AffineTransform by the provided AffineTransform - i.e.
+// this = this * other;
+AffineTransform& AffineTransform::multiply(const AffineTransform& other)
{
AffineTransform trans;
@@ -192,7 +190,7 @@ AffineTransform& AffineTransform::rotate(double a)
double sinAngle = sin(a);
AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0);
- multLeft(rot);
+ multiply(rot);
return *this;
}
diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.h b/Source/WebCore/platform/graphics/transforms/AffineTransform.h
index baee102..50d0655 100644
--- a/Source/WebCore/platform/graphics/transforms/AffineTransform.h
+++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.h
@@ -55,7 +55,8 @@ class IntPoint;
class IntRect;
class TransformationMatrix;
-class AffineTransform : public FastAllocBase {
+class AffineTransform {
+ WTF_MAKE_FAST_ALLOCATED;
public:
typedef double Transform[6];
@@ -95,8 +96,7 @@ public:
void makeIdentity();
- AffineTransform& multiply(const AffineTransform&);
- AffineTransform& multLeft(const AffineTransform&);
+ AffineTransform& multiply(const AffineTransform& other);
AffineTransform& scale(double);
AffineTransform& scale(double sx, double sy);
AffineTransform& scaleNonUniform(double sx, double sy);
@@ -147,15 +147,14 @@ public:
// *this = *this * t (i.e., a multRight)
AffineTransform& operator*=(const AffineTransform& t)
{
- *this = *this * t;
- return *this;
+ return multiply(t);
}
// result = *this * t (i.e., a multRight)
AffineTransform operator*(const AffineTransform& t) const
{
- AffineTransform result = t;
- result.multLeft(*this);
+ AffineTransform result = *this;
+ result *= t;
return result;
}
diff --git a/Source/WebCore/platform/graphics/transforms/TransformOperations.h b/Source/WebCore/platform/graphics/transforms/TransformOperations.h
index c0da377..981e1f6 100644
--- a/Source/WebCore/platform/graphics/transforms/TransformOperations.h
+++ b/Source/WebCore/platform/graphics/transforms/TransformOperations.h
@@ -31,7 +31,8 @@
namespace WebCore {
-class TransformOperations : public FastAllocBase {
+class TransformOperations {
+ WTF_MAKE_FAST_ALLOCATED;
public:
TransformOperations(bool makeIdentity = false);
diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
index 10c7f70..357a140 100644
--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatPoint3D.h"
#include "FloatRect.h"
#include "FloatQuad.h"
diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
index f13bcc1..c883675 100644
--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
@@ -26,7 +26,6 @@
#ifndef TransformationMatrix_h
#define TransformationMatrix_h
-#include "AffineTransform.h"
#include "FloatPoint.h"
#include "IntPoint.h"
#include <string.h> //for memcpy
@@ -65,7 +64,8 @@ class FloatPoint3D;
class FloatRect;
class FloatQuad;
-class TransformationMatrix : public FastAllocBase {
+class TransformationMatrix {
+ WTF_MAKE_FAST_ALLOCATED;
public:
typedef double Matrix4[4][4];
diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
index 1bdf270..de33c63 100644
--- a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
@@ -34,7 +34,9 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
+public:
FontCustomPlatformData(HANDLE fontReference, const String& name)
: m_fontReference(fontReference)
, m_name(name)
diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
index 3ab52b8..9c67037 100644
--- a/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
+++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
@@ -33,7 +33,9 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-struct FontCustomPlatformData : Noncopyable {
+struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
+public:
FontCustomPlatformData(cairo_font_face_t* fontFace)
: m_fontFace(fontFace)
{
diff --git a/Source/WebCore/platform/graphics/win/FontWin.cpp b/Source/WebCore/platform/graphics/win/FontWin.cpp
index 2170954..2ed9eb3 100644
--- a/Source/WebCore/platform/graphics/win/FontWin.cpp
+++ b/Source/WebCore/platform/graphics/win/FontWin.cpp
@@ -32,6 +32,7 @@
#include "IntRect.h"
#include "Logging.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include "UniscribeController.h"
#include <wtf/MathExtras.h>
diff --git a/Source/WebCore/platform/graphics/win/LocalWindowsContext.h b/Source/WebCore/platform/graphics/win/LocalWindowsContext.h
index c216140..5951e49 100644
--- a/Source/WebCore/platform/graphics/win/LocalWindowsContext.h
+++ b/Source/WebCore/platform/graphics/win/LocalWindowsContext.h
@@ -31,7 +31,8 @@
namespace WebCore {
-class LocalWindowsContext : public Noncopyable {
+class LocalWindowsContext {
+ WTF_MAKE_NONCOPYABLE(LocalWindowsContext);
public:
LocalWindowsContext(GraphicsContext* graphicsContext, const IntRect& rect, bool supportAlphaBlend = true, bool mayCreateBitmap = true)
: m_graphicsContext(graphicsContext)
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
index 7abe2eb..01db7f2 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
@@ -40,7 +40,7 @@ MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow(MediaPlay
: m_client(client)
, m_hwnd(0)
#if USE(ACCELERATED_COMPOSITING)
- , m_layerRenderer(WKCACFLayerRenderer::create(0))
+ , m_layerTreeHost(CACFLayerTreeHost::create())
#endif
{
}
@@ -81,7 +81,7 @@ void MediaPlayerPrivateFullscreenWindow::createWindow(HWND parentHwnd)
ASSERT(IsWindow(m_hwnd));
#if USE(ACCELERATED_COMPOSITING)
- m_layerRenderer->setHostWindow(m_hwnd);
+ m_layerTreeHost->setWindow(m_hwnd);
#endif
::SetFocus(m_hwnd);
@@ -107,7 +107,7 @@ void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCA
if (!m_rootChild)
return;
- m_layerRenderer->setRootChildLayer(m_rootChild.get());
+ m_layerTreeHost->setRootChildLayer(m_rootChild.get());
PlatformCALayer* rootLayer = m_rootChild->rootLayer();
CGRect rootBounds = m_rootChild->rootLayer()->bounds();
m_rootChild->setFrame(rootBounds);
@@ -147,7 +147,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
case WM_DESTROY:
m_hwnd = 0;
#if USE(ACCELERATED_COMPOSITING)
- m_layerRenderer->setHostWindow(0);
+ m_layerTreeHost->setWindow(0);
#endif
break;
case WM_WINDOWPOSCHANGED:
@@ -156,7 +156,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
if (wp->flags & SWP_NOSIZE)
break;
#if USE(ACCELERATED_COMPOSITING)
- m_layerRenderer->resize();
+ m_layerTreeHost->resize();
PlatformCALayer* rootLayer = m_rootChild->rootLayer();
CGRect rootBounds = m_rootChild->rootLayer()->bounds();
m_rootChild->setFrame(rootBounds);
@@ -166,7 +166,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
break;
case WM_PAINT:
#if USE(ACCELERATED_COMPOSITING)
- m_layerRenderer->paint();
+ m_layerTreeHost->paint();
::ValidateRect(m_hwnd, 0);
#endif
break;
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
index a18f0cc..c1ae762 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
@@ -27,10 +27,9 @@
#define MediaPlayerPrivateFullscreenWindow_h
#if USE(ACCELERATED_COMPOSITING)
+#include "CACFLayerTreeHost.h"
#include "PlatformCALayer.h"
-#include "WKCACFLayerRenderer.h"
#endif
-#include <wtf/OwnPtr.h>
typedef unsigned WPARAM;
typedef long LPARAM;
@@ -59,7 +58,7 @@ public:
HWND hwnd() const { return m_hwnd; }
#if USE(ACCELERATED_COMPOSITING)
- WKCACFLayerRenderer* layerRenderer() const { return m_layerRenderer.get(); }
+ CACFLayerTreeHost* layerView() const { return m_layerTreeHost.get(); }
PlatformCALayer* rootChildLayer() const { return m_rootChild.get(); }
void setRootChildLayer(PassRefPtr<PlatformCALayer>);
@@ -71,7 +70,7 @@ private:
MediaPlayerPrivateFullscreenClient* m_client;
#if USE(ACCELERATED_COMPOSITING)
- OwnPtr<WKCACFLayerRenderer> m_layerRenderer;
+ RefPtr<CACFLayerTreeHost> m_layerTreeHost;
RefPtr<PlatformCALayer> m_rootChild;
#endif
HWND m_hwnd;
diff --git a/Source/WebCore/platform/graphics/win/QTMovie.cpp b/Source/WebCore/platform/graphics/win/QTMovie.cpp
index efaf218..dfa1d36 100644
--- a/Source/WebCore/platform/graphics/win/QTMovie.cpp
+++ b/Source/WebCore/platform/graphics/win/QTMovie.cpp
@@ -63,7 +63,8 @@ union UppParam {
static Vector<CFStringRef>* gSupportedTypes = 0;
static SInt32 quickTimeVersion = 0;
-class QTMoviePrivate : public Noncopyable, public QTMovieTaskClient {
+class QTMoviePrivate : public QTMovieTaskClient {
+ WTF_MAKE_NONCOPYABLE(QTMoviePrivate);
public:
QTMoviePrivate();
~QTMoviePrivate();
diff --git a/Source/WebCore/platform/graphics/win/QTTrack.cpp b/Source/WebCore/platform/graphics/win/QTTrack.cpp
index 09142bc..bf80a81 100644
--- a/Source/WebCore/platform/graphics/win/QTTrack.cpp
+++ b/Source/WebCore/platform/graphics/win/QTTrack.cpp
@@ -31,7 +31,8 @@
using namespace std;
-class QTTrackPrivate : public Noncopyable {
+class QTTrackPrivate {
+ WTF_MAKE_NONCOPYABLE(QTTrackPrivate);
public:
QTTrackPrivate();
~QTTrackPrivate();
diff --git a/Source/WebCore/platform/graphics/win/UniscribeController.cpp b/Source/WebCore/platform/graphics/win/UniscribeController.cpp
index ab32150..dac6c3e 100644
--- a/Source/WebCore/platform/graphics/win/UniscribeController.cpp
+++ b/Source/WebCore/platform/graphics/win/UniscribeController.cpp
@@ -27,6 +27,7 @@
#include "UniscribeController.h"
#include "Font.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include <wtf/MathExtras.h>
using namespace std;
diff --git a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp b/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp
deleted file mode 100644
index d75c854..0000000
--- a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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. ``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.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "WKCACFContextFlusher.h"
-
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-WKCACFContextFlusher& WKCACFContextFlusher::shared()
-{
- DEFINE_STATIC_LOCAL(WKCACFContextFlusher, flusher, ());
- return flusher;
-}
-
-WKCACFContextFlusher::WKCACFContextFlusher()
-{
-}
-
-WKCACFContextFlusher::~WKCACFContextFlusher()
-{
-}
-
-void WKCACFContextFlusher::addContext(WKCACFContext* context)
-{
- ASSERT(context);
-
- m_contexts.add(context);
-}
-
-void WKCACFContextFlusher::removeContext(WKCACFContext* context)
-{
- ASSERT(context);
-
- m_contexts.remove(context);
-}
-
-void WKCACFContextFlusher::flushAllContexts()
-{
- // addContext might get called beneath CACFContextFlush, and we don't want m_contexts to change while
- // we're iterating over it, so we move the contexts into a local ContextSet and iterate over that instead.
- ContextSet contextsToFlush;
- contextsToFlush.swap(m_contexts);
-
- ContextSet::const_iterator end = contextsToFlush.end();
- for (ContextSet::const_iterator it = contextsToFlush.begin(); it != end; ++it)
- wkCACFContextFlush(*it);
-}
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
index abdc0f2..0508246 100644
--- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
@@ -37,7 +37,9 @@ namespace WebCore {
virtual void unregisterFont(const String& fontName) = 0;
};
- struct FontCustomPlatformData : Noncopyable {
+ struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
+ public:
FontCustomPlatformData(const String& name)
: m_name(name)
{
diff --git a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
index d636517..5a4c8da 100644
--- a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
@@ -38,6 +38,7 @@
#include "GraphicsContext.h"
#include "IntRect.h"
#include "NotImplemented.h"
+#include "TextRun.h"
#include "WidthIterator.h"
#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
diff --git a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 2def6ab..9b672d2 100644
--- a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -209,7 +209,7 @@ public:
void concatCTM(const AffineTransform& transform)
{
- m_transform = transform * m_transform;
+ m_transform *= transform;
}
IntRect mapRect(const IntRect& rect) const
@@ -438,7 +438,8 @@ static void rotateBitmap(SharedBitmap* destBmp, const SharedBitmap* sourceBmp, c
_rotateBitmap<unsigned, false>(destBmp, sourceBmp, transform);
}
-class TransparentLayerDC : Noncopyable {
+class TransparentLayerDC {
+ WTF_MAKE_NONCOPYABLE(TransparentLayerDC);
public:
TransparentLayerDC(GraphicsContextPlatformPrivate* data, IntRect& origRect, const IntRect* rectBeforeTransform = 0, int alpha = 255, bool paintImage = false);
~TransparentLayerDC();
@@ -558,7 +559,8 @@ void TransparentLayerDC::fillAlphaChannel()
}
}
-class ScopeDCProvider : Noncopyable {
+class ScopeDCProvider {
+ WTF_MAKE_NONCOPYABLE(ScopeDCProvider);
public:
explicit ScopeDCProvider(GraphicsContextPlatformPrivate* data)
: m_data(data)
diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferData.h b/Source/WebCore/platform/graphics/wince/ImageBufferData.h
index 01b7d06..cbd49dc 100644
--- a/Source/WebCore/platform/graphics/wince/ImageBufferData.h
+++ b/Source/WebCore/platform/graphics/wince/ImageBufferData.h
@@ -20,15 +20,18 @@
#ifndef ImageBufferData_h
#define ImageBufferData_h
+#include "SharedBitmap.h"
+
namespace WebCore {
- class IntSize;
- class ImageBufferData {
- public:
- ImageBufferData(const IntSize& size);
- RefPtr<SharedBitmap> m_bitmap;
- };
+class IntSize;
+
+class ImageBufferData {
+public:
+ ImageBufferData(const IntSize&);
+ RefPtr<SharedBitmap> m_bitmap;
+};
-} // namespace WebCore
+} // namespace WebCore
-#endif // ImageBufferData_h
+#endif // ImageBufferData_h
diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
index 537d27d..b5118f6 100644
--- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
@@ -88,6 +88,11 @@ ImageBuffer::~ImageBuffer()
{
}
+size_t ImageBuffer::dataSize() const
+{
+ return m_size.width() * m_size.height() * 4;
+}
+
GraphicsContext* ImageBuffer::context() const
{
return m_context.get();
diff --git a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
index 05d1535..168a5e2 100644
--- a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
+++ b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
@@ -445,8 +445,7 @@ void SharedBitmap::drawPattern(HDC hdc, const AffineTransform& transform, const
bmpHeight = tileRect.height();
}
- AffineTransform tf = transform;
- tf *= patternTransform;
+ AffineTransform tf = patternTransform * transform;
FloatRect trRect = tf.mapRect(destRect);
diff --git a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h
index cc348e3..86f99b2 100644
--- a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h
@@ -24,14 +24,14 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
namespace WebCore {
class FontPlatformData;
class SharedBuffer;
- struct FontCustomPlatformData : Noncopyable {
+ struct FontCustomPlatformData {
+ WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
FontCustomPlatformData() { }
~FontCustomPlatformData();
diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
index ba33287..b603a60 100644
--- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
+++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
@@ -48,6 +48,12 @@ ImageBuffer::~ImageBuffer()
{
}
+size_t ImageBuffer::dataSize() const
+{
+ notImplemented();
+ return 0;
+}
+
GraphicsContext* ImageBuffer::context() const
{
notImplemented();
diff --git a/Source/WebCore/platform/gtk/ClipboardGtk.h b/Source/WebCore/platform/gtk/ClipboardGtk.h
index e14a583..0c07c07 100644
--- a/Source/WebCore/platform/gtk/ClipboardGtk.h
+++ b/Source/WebCore/platform/gtk/ClipboardGtk.h
@@ -39,6 +39,7 @@ namespace WebCore {
// State available during IE's events for drag and drop and copy/paste
// Created from the EventHandlerGtk to be used by the dom
class ClipboardGtk : public Clipboard, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, Frame* frame)
{
diff --git a/Source/WebCore/platform/gtk/DragDataGtk.cpp b/Source/WebCore/platform/gtk/DragDataGtk.cpp
index 3a1daf1..cc9a208 100644
--- a/Source/WebCore/platform/gtk/DragDataGtk.cpp
+++ b/Source/WebCore/platform/gtk/DragDataGtk.cpp
@@ -66,13 +66,21 @@ bool DragData::containsCompatibleContent() const
return containsPlainText() || containsURL(0) || m_platformDragData->hasMarkup() || containsColor() || containsFiles();
}
-bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const
+bool DragData::containsURL(Frame* frame, FilenameConversionPolicy filenamePolicy) const
{
- return m_platformDragData->hasURL();
+ return !asURL(frame, filenamePolicy).isEmpty();
}
String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const
{
+ if (!m_platformDragData->hasURL())
+ return String();
+ if (filenamePolicy != ConvertFilenames) {
+ KURL url(KURL(), m_platformDragData->url());
+ if (url.isLocalFile())
+ return String();
+ }
+
String url(m_platformDragData->url());
if (title)
*title = m_platformDragData->urlLabel();
diff --git a/Source/WebCore/platform/gtk/KeyEventGtk.cpp b/Source/WebCore/platform/gtk/KeyEventGtk.cpp
index 50dfa4c..5a034d6 100644
--- a/Source/WebCore/platform/gtk/KeyEventGtk.cpp
+++ b/Source/WebCore/platform/gtk/KeyEventGtk.cpp
@@ -583,8 +583,7 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom
bool PlatformKeyboardEvent::currentCapsLockState()
{
- notImplemented();
- return false;
+ return gdk_keymap_get_caps_lock_state(gdk_keymap_get_default());
}
void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
diff --git a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp
index c2e24e0..d1571a5 100644
--- a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp
+++ b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp
@@ -25,13 +25,14 @@
#include "GraphicsContext.h"
#include "GtkVersioning.h"
#include "IntRect.h"
+#include "ScrollableArea.h"
#include <gtk/gtk.h>
using namespace WebCore;
-PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adj)
+PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adj)
{
- return adoptRef(new MainFrameScrollbarGtk(client, orientation, adj));
+ return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation, adj));
}
// Main frame scrollbars are slaves to a GtkAdjustment. If a main frame
@@ -41,8 +42,8 @@ PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollbarClient*
// state. These scrollbars are never painted, as the container takes care of
// that. They exist only to shuttle data from the GtkWidget container into
// WebCore and vice-versa.
-MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adjustment)
- : Scrollbar(client, orientation, RegularScrollbar)
+MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adjustment)
+ : Scrollbar(scrollableArea, orientation, RegularScrollbar)
, m_adjustment(0)
{
attachAdjustment(adjustment);
@@ -108,7 +109,7 @@ void MainFrameScrollbarGtk::updateThumbProportion()
void MainFrameScrollbarGtk::gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk* that)
{
- that->setValue(static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get())), NotFromScrollAnimator);
+ that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get())));
}
void MainFrameScrollbarGtk::paint(GraphicsContext* context, const IntRect& rect)
diff --git a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h
index f184425..f104f81 100644
--- a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h
+++ b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h
@@ -30,18 +30,19 @@ namespace WebCore {
class MainFrameScrollbarGtk : public Scrollbar {
public:
+ static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*);
+
~MainFrameScrollbarGtk();
virtual void paint(GraphicsContext*, const IntRect&);
void detachAdjustment();
void attachAdjustment(GtkAdjustment*);
- static PassRefPtr<MainFrameScrollbarGtk> create(ScrollbarClient*, ScrollbarOrientation, GtkAdjustment*);
protected:
virtual void updateThumbPosition();
virtual void updateThumbProportion();
private:
- MainFrameScrollbarGtk(ScrollbarClient*, ScrollbarOrientation, GtkAdjustment*);
+ MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*);
static void gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk*);
GRefPtr<GtkAdjustment> m_adjustment;
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
index 97c966d..bfe3901 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -41,6 +41,10 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
+#if ENABLE(PROGRESS_TAG)
+#include "RenderProgress.h"
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -305,6 +309,24 @@ bool RenderThemeGtk::paintSearchField(RenderObject* o, const PaintInfo& i, const
return paintTextField(o, i, rect);
}
+bool RenderThemeGtk::paintCapsLockIndicator(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ // The other paint methods don't need to check whether painting is disabled because RenderTheme already checks it
+ // before calling them, but paintCapsLockIndicator() is called by RenderTextControlSingleLine which doesn't check it.
+ if (paintInfo.context->paintingDisabled())
+ return true;
+
+ GRefPtr<GdkPixbuf> icon = getStockIcon(GTK_TYPE_ENTRY, GTK_STOCK_CAPS_LOCK_WARNING,
+ gtkTextDirection(renderObject->style()->direction()),
+ gtkIconState(this, renderObject), GTK_ICON_SIZE_MENU);
+
+ // GTK+ locates the icon right aligned in the entry. The given rectangle is already
+ // centered vertically by RenderTextControlSingleLine.
+ IntPoint iconPosition(rect.x() + rect.width() - gdk_pixbuf_get_width(icon.get()), rect.y());
+ paintGdkPixbuf(paintInfo.context, icon.get(), iconPosition);
+ return true;
+}
+
void RenderThemeGtk::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setBoxShadow(0);
@@ -330,7 +352,7 @@ double RenderThemeGtk::caretBlinkInterval() const
return time / 2000.;
}
-static double getScreenDPI()
+double RenderThemeGtk::getScreenDPI()
{
// FIXME: Really this should be the widget's screen.
GdkScreen* screen = gdk_screen_get_default();
@@ -543,6 +565,50 @@ void RenderThemeGtk::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* styl
{
style->setBoxShadow(0);
}
+
+// These values have been copied from RenderThemeChromiumSkia.cpp
+static const int progressActivityBlocks = 5;
+static const int progressAnimationFrames = 10;
+static const double progressAnimationInterval = 0.125;
+double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
+{
+ return progressAnimationInterval;
+}
+
+double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
+{
+ return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth;
+}
+
+IntRect RenderThemeGtk::calculateProgressRect(RenderObject* renderObject, const IntRect& fullBarRect)
+{
+ IntRect progressRect(fullBarRect);
+ RenderProgress* renderProgress = toRenderProgress(renderObject);
+ if (renderProgress->isDeterminate()) {
+ int progressWidth = progressRect.width() * renderProgress->position();
+ if (renderObject->style()->direction() == RTL)
+ progressRect.setX(progressRect.x() + progressRect.width() - progressWidth);
+ progressRect.setWidth(progressWidth);
+ return progressRect;
+ }
+
+ double animationProgress = renderProgress->animationProgress();
+
+ // Never let the progress rect shrink smaller than 2 pixels.
+ int newWidth = max(2, progressRect.width() / progressActivityBlocks);
+ int movableWidth = progressRect.width() - newWidth;
+ progressRect.setWidth(newWidth);
+
+ // We want the first 0.5 units of the animation progress to represent the
+ // forward motion and the second 0.5 units to represent the backward motion,
+ // thus we multiply by two here to get the full sweep of the progress bar with
+ // each direction.
+ if (animationProgress < 0.5)
+ progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth));
+ else
+ progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth));
+ return progressRect;
+}
#endif
}
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h
index 90113e5..5765782 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk.h
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h
@@ -169,13 +169,21 @@ protected:
virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
#endif
+ virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&);
+
private:
void platformInit();
+ static void setTextInputBorders(RenderStyle*);
+ GRefPtr<GdkPixbuf> getStockIcon(GType, const char* iconName, gint direction, gint state, gint iconSize);
+ static double getScreenDPI();
+
#if ENABLE(VIDEO)
bool paintMediaButton(RenderObject*, GraphicsContext*, const IntRect&, const char* iconName);
#endif
- static void setTextInputBorders(RenderStyle*);
- GRefPtr<GdkPixbuf> getStockIcon(GType, const char* iconName, gint direction, gint state, gint iconSize);
+
+#if ENABLE(PROGRESS_TAG)
+ static IntRect calculateProgressRect(RenderObject*, const IntRect&);
+#endif
mutable Color m_panelColor;
mutable Color m_sliderColor;
@@ -188,13 +196,26 @@ private:
#ifdef GTK_API_VERSION_2
void setupWidgetAndAddToContainer(GtkWidget*, GtkWidget*) const;
bool paintRenderObject(GtkThemeWidgetType, RenderObject*, GraphicsContext*, const IntRect&, int flags = 0);
+ void refreshComboBoxChildren() const;
+ void getComboBoxPadding(RenderStyle*, int& left, int& top, int& right, int& bottom) const;
+ int getComboBoxSeparatorWidth() const;
+ int comboBoxArrowSize(RenderStyle*) const;
GtkThemeParts m_themeParts;
+
GtkWidget* gtkButton() const;
GtkWidget* gtkEntry() const;
GtkWidget* gtkTreeView() const;
GtkWidget* gtkVScale() const;
GtkWidget* gtkHScale() const;
GtkWidget* gtkContainer() const;
+ GtkWidget* gtkRadioButton() const;
+ GtkWidget* gtkCheckButton() const;
+ GtkWidget* gtkProgressBar() const;
+ GtkWidget* gtkComboBox() const;
+ GtkWidget* gtkComboBoxButton() const;
+ GtkWidget* gtkComboBoxArrow() const;
+ GtkWidget* gtkComboBoxSeparator() const;
+
mutable GtkWidget* m_gtkWindow;
mutable GtkWidget* m_gtkContainer;
mutable GtkWidget* m_gtkButton;
@@ -202,6 +223,13 @@ private:
mutable GtkWidget* m_gtkTreeView;
mutable GtkWidget* m_gtkVScale;
mutable GtkWidget* m_gtkHScale;
+ mutable GtkWidget* m_gtkRadioButton;
+ mutable GtkWidget* m_gtkCheckButton;
+ mutable GtkWidget* m_gtkProgressBar;
+ mutable GtkWidget* m_gtkComboBox;
+ mutable GtkWidget* m_gtkComboBoxButton;
+ mutable GtkWidget* m_gtkComboBoxArrow;
+ mutable GtkWidget* m_gtkComboBoxSeparator;
bool m_themePartsHaveRGBAColormap;
friend class WidgetRenderingContext;
#endif
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
index e01508e..de4195d 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
@@ -27,6 +27,10 @@
#ifdef GTK_API_VERSION_2
+// We need this to allow building while using GTK_WIDGET_SET_FLAGS. It's deprecated
+// but some theme engines require it to ensure proper rendering of focus indicators.
+#undef GTK_DISABLE_DEPRECATED
+
#include "CSSValueKeywords.h"
#include "GraphicsContext.h"
#include "GtkVersioning.h"
@@ -41,10 +45,6 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if ENABLE(PROGRESS_TAG)
-#include "RenderProgress.h"
-#endif
-
namespace WebCore {
// This is not a static method, because we want to avoid having GTK+ headers in RenderThemeGtk.h.
@@ -61,6 +61,13 @@ void RenderThemeGtk::platformInit()
m_gtkTreeView = 0;
m_gtkVScale = 0;
m_gtkHScale = 0;
+ m_gtkRadioButton = 0;
+ m_gtkCheckButton = 0;
+ m_gtkProgressBar = 0;
+ m_gtkComboBox = 0;
+ m_gtkComboBoxButton = 0;
+ m_gtkComboBoxArrow = 0;
+ m_gtkComboBoxSeparator = 0;
memset(&m_themeParts, 0, sizeof(GtkThemeParts));
GdkColormap* colormap = gdk_screen_get_rgba_colormap(gdk_screen_get_default());
@@ -99,8 +106,34 @@ void RenderThemeGtk::initMediaColors()
}
#endif
-void RenderThemeGtk::adjustRepaintRect(const RenderObject*, IntRect&)
+static void adjustRectForFocus(GtkWidget* widget, IntRect& rect, bool ignoreInteriorFocusProperty = false)
+{
+ gint focusWidth, focusPad;
+ gboolean interiorFocus = 0;
+ gtk_widget_style_get(widget,
+ "interior-focus", &interiorFocus,
+ "focus-line-width", &focusWidth,
+ "focus-padding", &focusPad, NULL);
+ if (!ignoreInteriorFocusProperty && interiorFocus)
+ return;
+ rect.inflate(focusWidth + focusPad);
+}
+
+void RenderThemeGtk::adjustRepaintRect(const RenderObject* renderObject, IntRect& rect)
{
+ ControlPart part = renderObject->style()->appearance();
+ switch (part) {
+ case CheckboxPart:
+ case RadioPart: {
+ // We ignore the interior focus property and always expand the focus rect. In GTK+, the
+ // focus indicator is usually on the text next to a checkbox or radio button, but that doesn't
+ // happen in WebCore. By expanding the focus rectangle unconditionally we increase its prominence.
+ adjustRectForFocus(part == CheckboxPart ? gtkCheckButton() : gtkRadioButton(), rect, true);
+ return;
+ }
+ default:
+ return;
+ }
}
static GtkStateType getGtkStateType(RenderThemeGtk* theme, RenderObject* object)
@@ -142,56 +175,89 @@ bool RenderThemeGtk::paintRenderObject(GtkThemeWidgetType type, RenderObject* re
gtkTextDirection(renderObject->style()->direction()));
}
-void RenderThemeGtk::getIndicatorMetrics(ControlPart part, int& indicatorSize, int& indicatorSpacing)
+static void setToggleSize(const RenderThemeGtk* theme, RenderStyle* style, GtkWidget* widget)
{
- ASSERT(part == CheckboxPart || part == RadioPart);
- if (part == CheckboxPart) {
- moz_gtk_checkbox_get_metrics(&indicatorSize, &indicatorSpacing);
+ // The width and height are both specified, so we shouldn't change them.
+ if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
return;
- }
- // RadioPart
- moz_gtk_radio_get_metrics(&indicatorSize, &indicatorSpacing);
+ gint indicatorSize;
+ gtk_widget_style_get(widget, "indicator-size", &indicatorSize, NULL);
+ if (style->width().isIntrinsicOrAuto())
+ style->setWidth(Length(indicatorSize, Fixed));
+ if (style->height().isAuto())
+ style->setHeight(Length(indicatorSize, Fixed));
}
-static void setToggleSize(const RenderThemeGtk* theme, RenderStyle* style, ControlPart appearance)
+static void paintToggle(RenderThemeGtk* theme, RenderObject* renderObject, const PaintInfo& info, const IntRect& rect, GtkWidget* widget)
{
- // The width and height are both specified, so we shouldn't change them.
- if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
- return;
+ // We do not call gtk_toggle_button_set_active here, because some themes begin a series of
+ // animation frames in a "toggled" signal handler. This puts some checkboxes in a half-way
+ // checked state. Every GTK+ theme I tested merely looks at the shadow type (and not the
+ // 'active' property) to determine whether or not to draw the check.
+ gtk_widget_set_sensitive(widget, theme->isEnabled(renderObject) && !theme->isReadOnlyControl(renderObject));
+ gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction()));
- // FIXME: This is probably not correct use of indicatorSize and indicatorSpacing.
- gint indicatorSize, indicatorSpacing;
- RenderThemeGtk::getIndicatorMetrics(appearance, indicatorSize, indicatorSpacing);
+ bool indeterminate = theme->isIndeterminate(renderObject);
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), indeterminate);
- // Other ports hard-code this to 13, but GTK+ users tend to demand the native look.
- // It could be made a configuration option values other than 13 actually break site compatibility.
- int length = indicatorSize + indicatorSpacing;
- if (style->width().isIntrinsicOrAuto())
- style->setWidth(Length(length, Fixed));
+ GtkShadowType shadowType = GTK_SHADOW_OUT;
+ if (indeterminate) // This originates from the Mozilla code.
+ shadowType = GTK_SHADOW_ETCHED_IN;
+ else if (theme->isChecked(renderObject))
+ shadowType = GTK_SHADOW_IN;
- if (style->height().isAuto())
- style->setHeight(Length(length, Fixed));
+ WidgetRenderingContext widgetContext(info.context, rect);
+ IntRect buttonRect(IntPoint(), rect.size());
+ GtkStateType toggleState = getGtkStateType(theme, renderObject);
+ const char* detail = 0;
+ if (GTK_IS_RADIO_BUTTON(widget)) {
+ detail = "radiobutton";
+ widgetContext.gtkPaintOption(buttonRect, widget, toggleState, shadowType, detail);
+ } else {
+ detail = "checkbutton";
+ widgetContext.gtkPaintCheck(buttonRect, widget, toggleState, shadowType, detail);
+ }
+
+ if (theme->isFocused(renderObject)) {
+ IntRect focusRect(buttonRect);
+ adjustRectForFocus(widget, focusRect, true);
+ widgetContext.gtkPaintFocus(focusRect, widget, toggleState, detail);
+ }
}
void RenderThemeGtk::setCheckboxSize(RenderStyle* style) const
{
- setToggleSize(this, style, RadioPart);
+ setToggleSize(this, style, gtkCheckButton());
}
-bool RenderThemeGtk::paintCheckbox(RenderObject* object, const PaintInfo& info, const IntRect& rect)
+bool RenderThemeGtk::paintCheckbox(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect)
{
- return paintRenderObject(MOZ_GTK_CHECKBUTTON, object, info.context, rect, isChecked(object));
+ paintToggle(this, renderObject, info, rect, gtkCheckButton());
+ return false;
}
void RenderThemeGtk::setRadioSize(RenderStyle* style) const
{
- setToggleSize(this, style, RadioPart);
+ setToggleSize(this, style, gtkRadioButton());
+}
+
+bool RenderThemeGtk::paintRadio(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect)
+{
+ paintToggle(this, renderObject, info, rect, gtkRadioButton());
+ return false;
}
-bool RenderThemeGtk::paintRadio(RenderObject* object, const PaintInfo& info, const IntRect& rect)
+static void setWidgetHasFocus(GtkWidget* widget, gboolean hasFocus)
{
- return paintRenderObject(MOZ_GTK_RADIOBUTTON, object, info.context, rect, isChecked(object));
+ g_object_set(widget, "has-focus", hasFocus, NULL);
+
+ // These functions are deprecated in GTK+ 2.22, yet theme engines still look
+ // at these flags when determining if a widget has focus, so we must use them.
+ if (hasFocus)
+ GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+ else
+ GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
}
bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
@@ -208,12 +274,7 @@ bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, co
gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction()));
if (isFocused(object)) {
- if (isEnabled(object)) {
-#if !GTK_CHECK_VERSION(2, 22, 0)
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
-#endif
- g_object_set(widget, "has-focus", TRUE, NULL);
- }
+ setWidgetHasFocus(widget, TRUE);
gboolean interiorFocus = 0, focusWidth = 0, focusPadding = 0;
gtk_widget_style_get(widget,
@@ -239,21 +300,74 @@ bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, co
if (isFocused(object))
widgetContext.gtkPaintFocus(focusRect, widget, state, "button");
-#if !GTK_CHECK_VERSION(2, 22, 0)
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
-#endif
- g_object_set(widget, "has-focus", FALSE, NULL);
+ setWidgetHasFocus(widget, FALSE);
return false;
}
-static void getComboBoxPadding(RenderStyle* style, int& left, int& top, int& right, int& bottom)
+int RenderThemeGtk::getComboBoxSeparatorWidth() const
+{
+ GtkWidget* separator = gtkComboBoxSeparator();
+ if (!separator)
+ return 0;
+
+ gboolean hasWideSeparators = FALSE;
+ gint separatorWidth = 0;
+ gtk_widget_style_get(separator,
+ "wide-separators", &hasWideSeparators,
+ "separator-width", &separatorWidth,
+ NULL);
+ if (hasWideSeparators)
+ return separatorWidth;
+ return gtk_widget_get_style(separator)->xthickness;
+}
+
+int RenderThemeGtk::comboBoxArrowSize(RenderStyle* style) const
+{
+ // Taking the font size and reversing the DPI conversion seems to match
+ // GTK+ rendering as closely as possible.
+ return style->font().size() * (72.0 / RenderThemeGtk::getScreenDPI());
+}
+
+static void getButtonInnerBorder(GtkWidget* button, int& left, int& top, int& right, int& bottom)
+{
+ GtkStyle* style = gtk_widget_get_style(button);
+ int outerBorder = gtk_container_get_border_width(GTK_CONTAINER(button));
+ static GtkBorder defaultInnerBorder = {1, 1, 1, 1};
+ GtkBorder* innerBorder;
+ gtk_widget_style_get(button, "inner-border", &innerBorder, NULL);
+ if (!innerBorder)
+ innerBorder = &defaultInnerBorder;
+
+ left = outerBorder + innerBorder->left + style->xthickness;
+ right = outerBorder + innerBorder->right + style->xthickness;
+ top = outerBorder + innerBorder->top + style->ythickness;
+ bottom = outerBorder + innerBorder->bottom + style->ythickness;
+
+ if (innerBorder != &defaultInnerBorder)
+ gtk_border_free(innerBorder);
+}
+
+
+void RenderThemeGtk::getComboBoxPadding(RenderStyle* style, int& left, int& top, int& right, int& bottom) const
{
// If this menu list button isn't drawn using the native theme, we
// don't add any extra padding beyond what WebCore already uses.
if (style->appearance() == NoControlPart)
return;
- moz_gtk_get_widget_border(MOZ_GTK_DROPDOWN, &left, &top, &right, &bottom,
- gtkTextDirection(style->direction()), TRUE);
+
+ // A combo box button is a button with widgets packed into it.
+ GtkStyle* buttonWidgetStyle = gtk_widget_get_style(gtkComboBoxButton());
+ getButtonInnerBorder(gtkComboBoxButton(), left, top, right, bottom);
+
+ // Add xthickness amount of padding for each side of the separator. This ensures
+ // that the text does not bump up against the separator.
+ int arrowAndSeperatorLength = comboBoxArrowSize(style) +
+ getComboBoxSeparatorWidth() + (3 * buttonWidgetStyle->xthickness);
+
+ if (style->direction() == RTL)
+ left += arrowAndSeperatorLength;
+ else
+ right += arrowAndSeperatorLength;
}
int RenderThemeGtk::popupInternalPaddingLeft(RenderStyle* style) const
@@ -286,12 +400,102 @@ int RenderThemeGtk::popupInternalPaddingBottom(RenderStyle* style) const
bool RenderThemeGtk::paintMenuList(RenderObject* object, const PaintInfo& info, const IntRect& rect)
{
- return paintRenderObject(MOZ_GTK_DROPDOWN, object, info.context, rect);
+ if (paintButton(object, info, rect))
+ return true;
+
+ // Menu list button painting strategy.
+ // For buttons with appears-as-list set to false (having a separator):
+ // | left border | Button text | xthickness | vseparator | xthickness | arrow | xthickness | right border |
+ // For buttons with appears-as-list set to true (not having a separator):
+ // | left border | Button text | arrow | xthickness | right border |
+
+ int leftBorder = 0, rightBorder = 0, bottomBorder = 0, topBorder = 0;
+ getButtonInnerBorder(gtkComboBoxButton(), leftBorder, topBorder, rightBorder, bottomBorder);
+ RenderStyle* style = object->style();
+ int arrowSize = comboBoxArrowSize(style);
+ GtkStyle* buttonStyle = gtk_widget_get_style(gtkComboBoxButton());
+
+ IntRect arrowRect(0, (rect.height() - arrowSize) / 2, arrowSize, arrowSize);
+ if (style->direction() == RTL)
+ arrowRect.setX(leftBorder + buttonStyle->xthickness);
+ else
+ arrowRect.setX(rect.width() - rightBorder - buttonStyle->xthickness - arrowSize);
+ GtkShadowType shadowType = isPressed(object) ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+
+ WidgetRenderingContext widgetContext(info.context, rect);
+ GtkStateType stateType = getGtkStateType(this, object);
+ widgetContext.gtkPaintArrow(arrowRect, gtkComboBoxArrow(), stateType, shadowType, GTK_ARROW_DOWN, "arrow");
+
+ // Some combo boxes do not have a separator.
+ GtkWidget* separator = gtkComboBoxSeparator();
+ if (!separator)
+ return false;
+
+ // We want to decrease the height of the separator based on the focus padding of the button.
+ gint focusPadding = 0, focusWidth = 0;
+ gtk_widget_style_get(gtkComboBoxButton(),
+ "focus-line-width", &focusWidth,
+ "focus-padding", &focusPadding, NULL);
+ topBorder += focusPadding + focusWidth;
+ bottomBorder += focusPadding + focusWidth;
+ int separatorWidth = getComboBoxSeparatorWidth();
+ IntRect separatorRect(0, topBorder, separatorWidth, rect.height() - topBorder - bottomBorder);
+ if (style->direction() == RTL)
+ separatorRect.setX(arrowRect.x() + arrowRect.width() + buttonStyle->xthickness + separatorWidth);
+ else
+ separatorRect.setX(arrowRect.x() - buttonStyle->xthickness - separatorWidth);
+
+ gboolean hasWideSeparators = FALSE;
+ gtk_widget_style_get(separator, "wide-separators", &hasWideSeparators, NULL);
+ if (hasWideSeparators)
+ widgetContext.gtkPaintBox(separatorRect, separator, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, "vseparator");
+ else
+ widgetContext.gtkPaintVLine(separatorRect, separator, GTK_STATE_NORMAL, "vseparator");
+
+ return false;
}
-bool RenderThemeGtk::paintTextField(RenderObject* object, const PaintInfo& info, const IntRect& rect)
+bool RenderThemeGtk::paintTextField(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect)
{
- return paintRenderObject(MOZ_GTK_ENTRY, object, info.context, rect);
+ GtkWidget* widget = gtkEntry();
+
+ bool enabled = isEnabled(renderObject) && !isReadOnlyControl(renderObject);
+ GtkStateType backgroundState = enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
+ gtk_widget_set_sensitive(widget, enabled);
+ gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction()));
+ setWidgetHasFocus(widget, isFocused(renderObject));
+
+ WidgetRenderingContext widgetContext(info.context, rect);
+ IntRect textFieldRect(IntPoint(), rect.size());
+
+ // The entry background is only painted over the interior part of the GTK+ entry, not
+ // the entire frame. This happens in the Mozilla theme drawing code as well.
+ IntRect interiorRect(textFieldRect);
+ GtkStyle* style = gtk_widget_get_style(widget);
+ interiorRect.inflateX(-style->xthickness);
+ interiorRect.inflateY(-style->ythickness);
+ widgetContext.gtkPaintFlatBox(interiorRect, widget, backgroundState, GTK_SHADOW_NONE, "entry_bg");
+
+ // This is responsible for drawing the actual frame.
+ widgetContext.gtkPaintShadow(textFieldRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry");
+
+ gboolean interiorFocus;
+ gint focusWidth;
+ gtk_widget_style_get(widget,
+ "interior-focus", &interiorFocus,
+ "focus-line-width", &focusWidth, NULL);
+ if (isFocused(renderObject) && !interiorFocus) {
+ // When GTK+ paints a text entry with focus, it shrinks the size of the frame area by the
+ // focus width and paints over the previously unfocused text entry. We need to emulate that
+ // by drawing both the unfocused frame above and the focused frame here.
+ IntRect shadowRect(textFieldRect);
+ shadowRect.inflate(-focusWidth);
+ widgetContext.gtkPaintShadow(shadowRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry");
+
+ widgetContext.gtkPaintFocus(textFieldRect, widget, GTK_STATE_NORMAL, "entry");
+ }
+
+ return false;
}
bool RenderThemeGtk::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
@@ -382,45 +586,25 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const
}
#if ENABLE(PROGRESS_TAG)
-double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
-{
- // FIXME: It doesn't look like there is a good way yet to support animated
- // progress bars with the Mozilla theme drawing code.
- return 0;
-}
-
-double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
-{
- // FIXME: It doesn't look like there is a good way yet to support animated
- // progress bars with the Mozilla theme drawing code.
- return 0;
-}
-
bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
{
- if (!renderObject->isProgress())
- return true;
+ GtkWidget* widget = gtkProgressBar();
+ gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction()));
- GtkWidget* progressBarWidget = moz_gtk_get_progress_widget();
- if (!progressBarWidget)
- return true;
+ WidgetRenderingContext widgetContext(paintInfo.context, rect);
+ IntRect fullProgressBarRect(IntPoint(), rect.size());
+ widgetContext.gtkPaintBox(fullProgressBarRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "trough");
- if (paintRenderObject(MOZ_GTK_PROGRESSBAR, renderObject, paintInfo.context, rect))
- return true;
+ GtkStyle* style = gtk_widget_get_style(widget);
+ IntRect progressRect(fullProgressBarRect);
+ progressRect.inflateX(-style->xthickness);
+ progressRect.inflateY(-style->ythickness);
+ progressRect = RenderThemeGtk::calculateProgressRect(renderObject, progressRect);
- IntRect chunkRect(rect);
- RenderProgress* renderProgress = toRenderProgress(renderObject);
+ if (!progressRect.isEmpty())
+ widgetContext.gtkPaintBox(progressRect, widget, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, "bar");
- GtkStyle* style = gtk_widget_get_style(progressBarWidget);
- chunkRect.setHeight(chunkRect.height() - (2 * style->ythickness));
- chunkRect.setY(chunkRect.y() + style->ythickness);
- chunkRect.setWidth((chunkRect.width() - (2 * style->xthickness)) * renderProgress->position());
- if (renderObject->style()->direction() == RTL)
- chunkRect.setX(rect.x() + rect.width() - chunkRect.width() - style->xthickness);
- else
- chunkRect.setX(chunkRect.x() + style->xthickness);
-
- return paintRenderObject(MOZ_GTK_PROGRESS_CHUNK, renderObject, paintInfo.context, chunkRect);
+ return false;
}
#endif
@@ -503,11 +687,16 @@ static void gtkStyleSetCallback(GtkWidget* widget, GtkStyle* previous, RenderThe
renderTheme->platformColorsDidChange();
}
-void RenderThemeGtk::setupWidgetAndAddToContainer(GtkWidget* widget, GtkWidget* window) const
+static void setupWidget(GtkWidget* widget)
{
- gtk_container_add(GTK_CONTAINER(window), widget);
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
+}
+
+void RenderThemeGtk::setupWidgetAndAddToContainer(GtkWidget* widget, GtkWidget* window) const
+{
+ gtk_container_add(GTK_CONTAINER(window), widget);
+ setupWidget(widget);
// FIXME: Perhaps this should only be called for the containing window or parent container.
g_signal_connect(widget, "style-set", G_CALLBACK(gtkStyleSetCallback), const_cast<RenderThemeGtk*>(this));
@@ -520,7 +709,7 @@ GtkWidget* RenderThemeGtk::gtkContainer() const
m_gtkWindow = gtk_window_new(GTK_WINDOW_POPUP);
gtk_widget_set_colormap(m_gtkWindow, m_themeParts.colormap);
- gtk_widget_realize(m_gtkWindow);
+ setupWidget(m_gtkWindow);
gtk_widget_set_name(m_gtkWindow, "MozillaGtkWidget");
m_gtkContainer = gtk_fixed_new();
@@ -573,6 +762,126 @@ GtkWidget* RenderThemeGtk::gtkHScale() const
return m_gtkHScale;
}
+GtkWidget* RenderThemeGtk::gtkRadioButton() const
+{
+ if (m_gtkRadioButton)
+ return m_gtkRadioButton;
+ m_gtkRadioButton = gtk_radio_button_new(0);
+ setupWidgetAndAddToContainer(m_gtkRadioButton, gtkContainer());
+ return m_gtkRadioButton;
+}
+
+GtkWidget* RenderThemeGtk::gtkCheckButton() const
+{
+ if (m_gtkCheckButton)
+ return m_gtkCheckButton;
+ m_gtkCheckButton = gtk_check_button_new();
+ setupWidgetAndAddToContainer(m_gtkCheckButton, gtkContainer());
+ return m_gtkCheckButton;
+}
+
+GtkWidget* RenderThemeGtk::gtkProgressBar() const
+{
+ if (m_gtkProgressBar)
+ return m_gtkProgressBar;
+ m_gtkProgressBar = gtk_progress_bar_new();
+ setupWidgetAndAddToContainer(m_gtkProgressBar, gtkContainer());
+ return m_gtkProgressBar;
+}
+
+static void getGtkComboBoxButton(GtkWidget* widget, gpointer target)
+{
+ if (!GTK_IS_TOGGLE_BUTTON(widget))
+ return;
+ GtkWidget** widgetTarget = static_cast<GtkWidget**>(target);
+ *widgetTarget = widget;
+}
+
+typedef struct {
+ GtkWidget* arrow;
+ GtkWidget* separator;
+} ComboBoxWidgetPieces;
+
+static void getGtkComboBoxPieces(GtkWidget* widget, gpointer data)
+{
+ if (GTK_IS_ARROW(widget)) {
+ static_cast<ComboBoxWidgetPieces*>(data)->arrow = widget;
+ return;
+ }
+ if (GTK_IS_SEPARATOR(widget))
+ static_cast<ComboBoxWidgetPieces*>(data)->separator = widget;
+}
+
+GtkWidget* RenderThemeGtk::gtkComboBox() const
+{
+ if (m_gtkComboBox)
+ return m_gtkComboBox;
+ m_gtkComboBox = gtk_combo_box_new();
+ setupWidgetAndAddToContainer(m_gtkComboBox, gtkContainer());
+ return m_gtkComboBox;
+}
+
+void RenderThemeGtk::refreshComboBoxChildren() const
+{
+ gtkComboBox(); // Ensure that we've initialized the combo box.
+
+ // Some themes look at widget ancestry to determine how to render widgets, so
+ // get the GtkButton that is the actual child of the combo box.
+ gtk_container_forall(GTK_CONTAINER(m_gtkComboBox), getGtkComboBoxButton, &m_gtkComboBoxButton);
+ ASSERT(m_gtkComboBoxButton);
+ setupWidget(m_gtkComboBoxButton);
+ g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxButton), reinterpret_cast<gpointer*>(&m_gtkComboBoxButton));
+
+ ComboBoxWidgetPieces pieces = { 0, 0 };
+ GtkWidget* buttonChild = gtk_bin_get_child(GTK_BIN(gtkComboBoxButton()));
+ if (GTK_IS_HBOX(buttonChild))
+ gtk_container_forall(GTK_CONTAINER(buttonChild), getGtkComboBoxPieces, &pieces);
+ else if (GTK_IS_ARROW(buttonChild))
+ pieces.arrow = buttonChild;
+
+ ASSERT(pieces.arrow);
+ m_gtkComboBoxArrow = pieces.arrow;
+ setupWidget(m_gtkComboBoxArrow);
+ // When the style changes, the combo box may destroy its children.
+ g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxArrow), reinterpret_cast<gpointer*>(&m_gtkComboBoxArrow));
+
+ m_gtkComboBoxSeparator = pieces.separator;
+ if (m_gtkComboBoxSeparator) {
+ setupWidget(m_gtkComboBoxSeparator);
+ // When the style changes, the combo box may destroy its children.
+ g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxSeparator), reinterpret_cast<gpointer*>(&m_gtkComboBoxSeparator));
+ }
+}
+
+GtkWidget* RenderThemeGtk::gtkComboBoxButton() const
+{
+ if (m_gtkComboBoxButton)
+ return m_gtkComboBoxButton;
+ refreshComboBoxChildren();
+ ASSERT(m_gtkComboBoxButton);
+ return m_gtkComboBoxButton;
+}
+
+GtkWidget* RenderThemeGtk::gtkComboBoxArrow() const
+{
+ if (m_gtkComboBoxArrow)
+ return m_gtkComboBoxArrow;
+ refreshComboBoxChildren();
+ ASSERT(m_gtkComboBoxArrow);
+ return m_gtkComboBoxArrow;
+}
+
+GtkWidget* RenderThemeGtk::gtkComboBoxSeparator() const
+{
+ // m_gtkComboBoxSeparator may be null either because we haven't initialized the combo box
+ // or because the combo boxes in this theme don't have separators. If m_gtkComboBoxArrow
+ // arrow isn't null, we definitely have initialized the combo box.
+ if (m_gtkComboBoxArrow || m_gtkComboBoxButton)
+ return m_gtkComboBoxSeparator;
+ refreshComboBoxChildren();
+ return m_gtkComboBoxSeparator;
+}
+
GtkWidget* RenderThemeGtk::gtkScrollbar()
{
return moz_gtk_get_scrollbar_widget();
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
index 212e29d..1a9f445 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
@@ -41,10 +41,6 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if ENABLE(PROGRESS_TAG)
-#include "RenderProgress.h"
-#endif
-
namespace WebCore {
// This is the default value defined by GTK+, where it was defined as MIN_ARROW_SIZE in gtkarrow.c.
@@ -690,20 +686,6 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* renderObject) const
}
#if ENABLE(PROGRESS_TAG)
-// These values have been copied from RenderThemeChromiumSkia.cpp
-static const int progressActivityBlocks = 5;
-static const int progressAnimationFrames = 10;
-static const double progressAnimationInterval = 0.125;
-double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
-{
- return progressAnimationInterval;
-}
-
-double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
-{
- return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth;
-}
-
bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
{
if (!renderObject->isProgress())
@@ -722,34 +704,18 @@ bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInf
gtk_style_context_save(context);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
- RenderProgress* renderProgress = toRenderProgress(renderObject);
GtkBorder padding;
gtk_style_context_get_padding(context, static_cast<GtkStateFlags>(0), &padding);
IntRect progressRect(rect.x() + padding.left, rect.y() + padding.top,
rect.width() - (padding.left + padding.right),
rect.height() - (padding.top + padding.bottom));
-
- if (renderProgress->isDeterminate()) {
- progressRect.setWidth(progressRect.width() * renderProgress->position());
- if (renderObject->style()->direction() == RTL)
- progressRect.setX(rect.x() + rect.width() - progressRect.width() - padding.right);
- } else {
- double animationProgress = renderProgress->animationProgress();
-
- progressRect.setWidth(max(2, progressRect.width() / progressActivityBlocks));
- int movableWidth = rect.width() - progressRect.width();
- if (animationProgress < 0.5)
- progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth));
- else
- progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth));
- }
+ progressRect = RenderThemeGtk::calculateProgressRect(renderObject, progressRect);
if (!progressRect.isEmpty())
gtk_render_activity(context, paintInfo.context->platformContext(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height());
gtk_style_context_restore(context);
-
return false;
}
#endif
diff --git a/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp b/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp
index 6d1be31..51b32ea 100644
--- a/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp
+++ b/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp
@@ -65,21 +65,6 @@ static void scheduleScratchBufferPurge()
purgeScratchBufferTimer.startOneShot(2);
}
-static IntSize getExtraSpaceForWidget(RenderThemeGtk* theme)
-{
- // Checkboxes and scrollbar thumbs often draw outside their boundaries. Here we figure out
- // the maximum amount of space we need for any type of widget and use that to increase the
- // size of the scratch buffer, while preserving the final widget position.
-
- // The checkbox extra space is calculated by looking at the widget style.
- int indicatorSize, indicatorSpacing;
- theme->getIndicatorMetrics(CheckboxPart, indicatorSize, indicatorSpacing);
- IntSize extraSpace(indicatorSpacing, indicatorSpacing);
-
- // Scrollbar thumbs need at least an extra pixel along their movement axis.
- return extraSpace.expandedTo(IntSize(1, 1));
-}
-
WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext, const IntRect& targetRect)
: m_graphicsContext(graphicsContext)
, m_targetRect(targetRect)
@@ -96,8 +81,9 @@ WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext,
return;
}
- // Some widgets render outside their rectangles. We need to account for this.
- m_extraSpace = getExtraSpaceForWidget(theme);
+ // Widgets sometimes need to draw outside their boundaries for things such as
+ // exterior focus. We want to allocate a some extra pixels in our surface for this.
+ m_extraSpace = IntSize(15, 15);
// Offset the target rectangle so that the extra space is within the boundaries of the scratch buffer.
m_paintRect = IntRect(IntPoint(m_extraSpace.width(), m_extraSpace.height()),
@@ -173,10 +159,17 @@ void WidgetRenderingContext::gtkPaintBox(const IntRect& rect, GtkWidget* widget,
widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
}
+void WidgetRenderingContext::gtkPaintFlatBox(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_flat_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect,
+ widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+}
+
void WidgetRenderingContext::gtkPaintFocus(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail)
{
GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
- gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &m_paintRect, widget,
+ gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget,
detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
}
@@ -187,6 +180,42 @@ void WidgetRenderingContext::gtkPaintSlider(const IntRect& rect, GtkWidget* widg
detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height, orientation);
}
+void WidgetRenderingContext::gtkPaintCheck(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_check(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget,
+ detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+}
+
+void WidgetRenderingContext::gtkPaintOption(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_option(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget,
+ detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+}
+
+void WidgetRenderingContext::gtkPaintShadow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_shadow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget,
+ detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+}
+
+void WidgetRenderingContext::gtkPaintArrow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, int arrowDirection, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_arrow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, detail,
+ static_cast<GtkArrowType>(arrowDirection), TRUE, paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+}
+
+void WidgetRenderingContext::gtkPaintVLine(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail)
+{
+ GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() };
+ gtk_paint_vline(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget, detail,
+ paintRect.y, paintRect.y + paintRect.height, paintRect.x);
+
+}
+
}
#endif // GTK_API_VERSION_2
diff --git a/Source/WebCore/platform/gtk/WidgetRenderingContext.h b/Source/WebCore/platform/gtk/WidgetRenderingContext.h
index 8b2a0e2..e248f04 100644
--- a/Source/WebCore/platform/gtk/WidgetRenderingContext.h
+++ b/Source/WebCore/platform/gtk/WidgetRenderingContext.h
@@ -39,8 +39,14 @@ public:
bool paintMozillaWidget(GtkThemeWidgetType, GtkWidgetState*, int flags, GtkTextDirection = GTK_TEXT_DIR_NONE);
void gtkPaintBox(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*);
+ void gtkPaintFlatBox(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*);
void gtkPaintFocus(const IntRect&, GtkWidget*, GtkStateType, const gchar*);
void gtkPaintSlider(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*, GtkOrientation);
+ void gtkPaintCheck(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*);
+ void gtkPaintOption(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*);
+ void gtkPaintShadow(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*);
+ void gtkPaintArrow(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, int arrowDirection, const gchar*);
+ void gtkPaintVLine(const IntRect&, GtkWidget*, GtkStateType, const gchar*);
private:
GraphicsContext* m_graphicsContext;
diff --git a/Source/WebCore/platform/gtk/gtk2drawing.c b/Source/WebCore/platform/gtk/gtk2drawing.c
index 3ebd332..3979b7f 100644
--- a/Source/WebCore/platform/gtk/gtk2drawing.c
+++ b/Source/WebCore/platform/gtk/gtk2drawing.c
@@ -60,7 +60,6 @@
static GtkThemeParts *gParts = NULL;
static style_prop_t style_prop_func;
-static gboolean have_arrow_scaling;
static gboolean is_initialized;
void
@@ -116,61 +115,6 @@ setup_widget_prototype(GtkWidget* widget)
}
static gint
-ensure_button_widget()
-{
- if (!gParts->buttonWidget) {
- gParts->buttonWidget = gtk_button_new_with_label("M");
- setup_widget_prototype(gParts->buttonWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-ensure_toggle_button_widget()
-{
- if (!gParts->toggleButtonWidget) {
- gParts->toggleButtonWidget = gtk_toggle_button_new();
- setup_widget_prototype(gParts->toggleButtonWidget);
- /* toggle button must be set active to get the right style on hover. */
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gParts->toggleButtonWidget), TRUE);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-ensure_button_arrow_widget()
-{
- if (!gParts->buttonArrowWidget) {
- ensure_toggle_button_widget();
-
- gParts->buttonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_container_add(GTK_CONTAINER(gParts->toggleButtonWidget), gParts->buttonArrowWidget);
- gtk_widget_realize(gParts->buttonArrowWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-ensure_checkbox_widget()
-{
- if (!gParts->checkboxWidget) {
- gParts->checkboxWidget = gtk_check_button_new_with_label("M");
- setup_widget_prototype(gParts->checkboxWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-ensure_radiobutton_widget()
-{
- if (!gParts->radiobuttonWidget) {
- gParts->radiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
- setup_widget_prototype(gParts->radiobuttonWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
ensure_scrollbar_widget()
{
if (!gParts->vertScrollbarWidget) {
@@ -185,129 +129,6 @@ ensure_scrollbar_widget()
}
static gint
-ensure_entry_widget()
-{
- if (!gParts->entryWidget) {
- gParts->entryWidget = gtk_entry_new();
- setup_widget_prototype(gParts->entryWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-/* We need to have pointers to the inner widgets (button, separator, arrow)
- * of the ComboBox to get the correct rendering from theme engines which
- * special cases their look. Since the inner layout can change, we ask GTK
- * to NULL our pointers when they are about to become invalid because the
- * corresponding widgets don't exist anymore. It's the role of
- * g_object_add_weak_pointer().
- * Note that if we don't find the inner widgets (which shouldn't happen), we
- * fallback to use generic "non-inner" widgets, and they don't need that kind
- * of weak pointer since they are explicit children of gParts->protoWindow and as
- * such GTK holds a strong reference to them. */
-static void
-moz_gtk_get_combo_box_inner_button(GtkWidget *widget, gpointer client_data)
-{
- if (GTK_IS_TOGGLE_BUTTON(widget)) {
- gParts->comboBoxButtonWidget = widget;
- g_object_add_weak_pointer(G_OBJECT(widget),
- (gpointer) &gParts->comboBoxButtonWidget);
- gtk_widget_realize(widget);
- g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
- }
-}
-
-static void
-moz_gtk_get_combo_box_button_inner_widgets(GtkWidget *widget,
- gpointer client_data)
-{
- if (GTK_IS_SEPARATOR(widget)) {
- gParts->comboBoxSeparatorWidget = widget;
- g_object_add_weak_pointer(G_OBJECT(widget),
- (gpointer) &gParts->comboBoxSeparatorWidget);
- } else if (GTK_IS_ARROW(widget)) {
- gParts->comboBoxArrowWidget = widget;
- g_object_add_weak_pointer(G_OBJECT(widget),
- (gpointer) &gParts->comboBoxArrowWidget);
- } else
- return;
- gtk_widget_realize(widget);
- g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
-}
-
-static gint
-ensure_combo_box_widgets()
-{
- GtkWidget* buttonChild;
-
- if (gParts->comboBoxButtonWidget && gParts->comboBoxArrowWidget)
- return MOZ_GTK_SUCCESS;
-
- /* Create a ComboBox if needed */
- if (!gParts->comboBoxWidget) {
- gParts->comboBoxWidget = gtk_combo_box_new();
- setup_widget_prototype(gParts->comboBoxWidget);
- }
-
- /* Get its inner Button */
- gtk_container_forall(GTK_CONTAINER(gParts->comboBoxWidget),
- moz_gtk_get_combo_box_inner_button,
- NULL);
-
- if (gParts->comboBoxButtonWidget) {
- /* Get the widgets inside the Button */
- buttonChild = gtk_bin_get_child(GTK_BIN(gParts->comboBoxButtonWidget));
- if (GTK_IS_HBOX(buttonChild)) {
- /* appears-as-list = FALSE, cell-view = TRUE; the button
- * contains an hbox. This hbox is there because the ComboBox
- * needs to place a cell renderer, a separator, and an arrow in
- * the button when appears-as-list is FALSE. */
- gtk_container_forall(GTK_CONTAINER(buttonChild),
- moz_gtk_get_combo_box_button_inner_widgets,
- NULL);
- } else if(GTK_IS_ARROW(buttonChild)) {
- /* appears-as-list = TRUE, or cell-view = FALSE;
- * the button only contains an arrow */
- gParts->comboBoxArrowWidget = buttonChild;
- g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
- &gParts->comboBoxArrowWidget);
- gtk_widget_realize(gParts->comboBoxArrowWidget);
- g_object_set_data(G_OBJECT(gParts->comboBoxArrowWidget),
- "transparent-bg-hint", GINT_TO_POINTER(TRUE));
- }
- } else {
- /* Shouldn't be reached with current internal gtk implementation; we
- * use a generic toggle button as last resort fallback to avoid
- * crashing. */
- ensure_toggle_button_widget();
- gParts->comboBoxButtonWidget = gParts->toggleButtonWidget;
- }
-
- if (!gParts->comboBoxArrowWidget) {
- /* Shouldn't be reached with current internal gtk implementation;
- * we gParts->buttonArrowWidget as last resort fallback to avoid
- * crashing. */
- ensure_button_arrow_widget();
- gParts->comboBoxArrowWidget = gParts->buttonArrowWidget;
- }
-
- /* We don't test the validity of gParts->comboBoxSeparatorWidget since there
- * is none when "appears-as-list" = TRUE or "cell-view" = FALSE; if it
- * is invalid we just won't paint it. */
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-ensure_progress_widget()
-{
- if (!gParts->progresWidget) {
- gParts->progresWidget = gtk_progress_bar_new();
- setup_widget_prototype(gParts->progresWidget);
- }
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
ensure_scrolled_window_widget()
{
if (!gParts->scrolledWindowWidget) {
@@ -355,93 +176,12 @@ TSOffsetStyleGCs(GtkStyle* style, gint xorigin, gint yorigin)
return MOZ_GTK_SUCCESS;
}
-static gint
-moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkWidgetState* state,
- GtkReliefStyle relief, GtkWidget* widget,
- GtkTextDirection direction)
-{
- GtkShadowType shadow_type;
- GtkStyle* style = gtk_widget_get_style(widget);
- GtkStateType button_state = ConvertGtkState(state);
- gint x = rect->x, y=rect->y, width=rect->width, height=rect->height;
-
- gboolean interior_focus;
- gint focus_width, focus_pad;
-
- moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
-
- gtk_widget_set_state(widget, button_state);
- gtk_widget_set_direction(widget, direction);
-
- if (state->isDefault)
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_DEFAULT);
-
- gtk_button_set_relief(GTK_BUTTON(widget), relief);
-
- /* Some theme engines love to cause us pain in that gtk_paint_focus is a
- no-op on buttons and button-like widgets. They only listen to this flag. */
- if (state->focused && !state->disabled)
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
-
- if (!interior_focus && state->focused) {
- x += focus_width + focus_pad;
- y += focus_width + focus_pad;
- width -= 2 * (focus_width + focus_pad);
- height -= 2 * (focus_width + focus_pad);
- }
-
- shadow_type = button_state == GTK_STATE_ACTIVE ||
- state->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
-
- if (state->isDefault && relief == GTK_RELIEF_NORMAL) {
- gtk_paint_box(style, drawable, button_state, shadow_type, cliprect,
- widget, "buttondefault", x, y, width, height);
- }
-
- if (relief != GTK_RELIEF_NONE || state->depressed ||
- (button_state != GTK_STATE_NORMAL &&
- button_state != GTK_STATE_INSENSITIVE)) {
- TSOffsetStyleGCs(style, x, y);
- /* the following line can trigger an assertion (Crux theme)
- file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area):
- assertion `GDK_IS_WINDOW (window)' failed */
- gtk_paint_box(style, drawable, button_state, shadow_type, cliprect,
- widget, "button", x, y, width, height);
- }
-
- if (state->focused) {
- if (interior_focus) {
- GtkStyle* style = gtk_widget_get_style(widget);
- x += style->xthickness + focus_pad;
- y += style->ythickness + focus_pad;
- width -= 2 * (style->xthickness + focus_pad);
- height -= 2 * (style->ythickness + focus_pad);
- } else {
- x -= focus_width + focus_pad;
- y -= focus_width + focus_pad;
- width += 2 * (focus_width + focus_pad);
- height += 2 * (focus_width + focus_pad);
- }
-
- TSOffsetStyleGCs(style, x, y);
- gtk_paint_focus(style, drawable, button_state, cliprect,
- widget, "button", x, y, width, height);
- }
-
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_DEFAULT);
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
- return MOZ_GTK_SUCCESS;
-}
-
gint
moz_gtk_init()
{
GtkWidgetClass *entry_class;
is_initialized = TRUE;
- have_arrow_scaling = (gtk_major_version > 2 ||
- (gtk_major_version == 2 && gtk_minor_version >= 12));
/* Add style property to GtkEntry.
* Adding the style property to the normal GtkEntry class means that it
@@ -457,215 +197,6 @@ moz_gtk_init()
return MOZ_GTK_SUCCESS;
}
-gint
-moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing)
-{
- ensure_checkbox_widget();
-
- gtk_widget_style_get (gParts->checkboxWidget,
- "indicator_size", indicator_size,
- "indicator_spacing", indicator_spacing,
- NULL);
-
- return MOZ_GTK_SUCCESS;
-}
-
-gint
-moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing)
-{
- ensure_radiobutton_widget();
-
- gtk_widget_style_get (gParts->radiobuttonWidget,
- "indicator_size", indicator_size,
- "indicator_spacing", indicator_spacing,
- NULL);
-
- return MOZ_GTK_SUCCESS;
-}
-
-gint
-moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus,
- gint* focus_width, gint* focus_pad)
-{
- gtk_widget_style_get (widget,
- "interior-focus", interior_focus,
- "focus-line-width", focus_width,
- "focus-padding", focus_pad,
- NULL);
-
- return MOZ_GTK_SUCCESS;
-}
-
-gint
-moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border)
-{
- static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
- GtkBorder *tmp_border;
-
- gtk_widget_style_get (widget, "inner-border", &tmp_border, NULL);
-
- if (tmp_border) {
- *inner_border = *tmp_border;
- gtk_border_free(tmp_border);
- }
- else
- *inner_border = default_inner_border;
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkWidgetState* state,
- gboolean selected, gboolean inconsistent,
- gboolean isradio, GtkTextDirection direction)
-{
- GtkStateType state_type = ConvertGtkState(state);
- GtkShadowType shadow_type = (selected)?GTK_SHADOW_IN:GTK_SHADOW_OUT;
- gint indicator_size, indicator_spacing;
- gint x, y, width, height;
- gint focus_x, focus_y, focus_width, focus_height;
- GtkWidget *w;
- GtkStyle *style;
-
- if (isradio) {
- moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
- w = gParts->radiobuttonWidget;
- } else {
- moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
- w = gParts->checkboxWidget;
- }
-
- // "GetMinimumWidgetSize was ignored"
- // FIXME: This assert causes a build failure in WebKitGTK+ debug
- // builds, because it uses 'false' in its definition. We may want
- // to force this file to be built with g++, by renaming it.
- // ASSERT(rect->width == indicator_size);
-
- /*
- * vertically center in the box, since XUL sometimes ignores our
- * GetMinimumWidgetSize in the vertical dimension
- */
- x = rect->x;
- y = rect->y + (rect->height - indicator_size) / 2;
- width = indicator_size;
- height = indicator_size;
-
- focus_x = x - indicator_spacing;
- focus_y = y - indicator_spacing;
- focus_width = width + 2 * indicator_spacing;
- focus_height = height + 2 * indicator_spacing;
-
- style = gtk_widget_get_style(w);
- TSOffsetStyleGCs(style, x, y);
-
- gtk_widget_set_sensitive(w, !state->disabled);
- gtk_widget_set_direction(w, direction);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), selected);
-
- if (isradio) {
- gtk_paint_option(style, drawable, state_type, shadow_type, cliprect,
- gParts->radiobuttonWidget, "radiobutton", x, y,
- width, height);
- if (state->focused) {
- gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
- gParts->radiobuttonWidget, "radiobutton", focus_x, focus_y,
- focus_width, focus_height);
- }
- }
- else {
- /*
- * 'indeterminate' type on checkboxes. In GTK, the shadow type
- * must also be changed for the state to be drawn.
- */
- if (inconsistent) {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), TRUE);
- shadow_type = GTK_SHADOW_ETCHED_IN;
- } else {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), FALSE);
- }
-
- gtk_paint_check(style, drawable, state_type, shadow_type, cliprect,
- gParts->checkboxWidget, "checkbutton", x, y, width, height);
- if (state->focused) {
- gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
- gParts->checkboxWidget, "checkbutton", focus_x, focus_y,
- focus_width, focus_height);
- }
- }
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect,
- GdkRectangle* inner_rect,
- GtkTextDirection direction,
- gboolean ignore_focus)
-{
- GtkBorder inner_border;
- gboolean interior_focus;
- gint focus_width, focus_pad;
- GtkStyle* style;
-
- style = gtk_widget_get_style(button);
-
- /* This mirrors gtkbutton's child positioning */
- moz_gtk_button_get_inner_border(button, &inner_border);
- moz_gtk_widget_get_focus(button, &interior_focus,
- &focus_width, &focus_pad);
-
- if (ignore_focus)
- focus_width = focus_pad = 0;
-
- inner_rect->x = rect->x + XTHICKNESS(style) + focus_width + focus_pad;
- inner_rect->x += direction == GTK_TEXT_DIR_LTR ?
- inner_border.left : inner_border.right;
- inner_rect->y = rect->y + inner_border.top + YTHICKNESS(style) +
- focus_width + focus_pad;
- inner_rect->width = MAX(1, rect->width - inner_border.left -
- inner_border.right - (XTHICKNESS(style) + focus_pad + focus_width) * 2);
- inner_rect->height = MAX(1, rect->height - inner_border.top -
- inner_border.bottom - (YTHICKNESS(style) + focus_pad + focus_width) * 2);
-
- return MOZ_GTK_SUCCESS;
-}
-
-
-static gint
-calculate_arrow_rect(GtkWidget* arrow, GdkRectangle* rect,
- GdkRectangle* arrow_rect, GtkTextDirection direction)
-{
- /* defined in gtkarrow.c */
- gfloat arrow_scaling = 0.7;
- gfloat xalign, xpad;
- gint extent;
- GtkMisc* misc = GTK_MISC(arrow);
- gfloat misc_xalign, misc_yalign;
- gint misc_xpad, misc_ypad;
-
- if (have_arrow_scaling)
- gtk_widget_style_get(arrow, "arrow_scaling", &arrow_scaling, NULL);
-
- gtk_misc_get_padding(misc, &misc_xpad, &misc_ypad);
- gtk_misc_get_alignment(misc, &misc_xalign, &misc_yalign);
-
- extent = MIN((rect->width - misc_xpad * 2),
- (rect->height - misc_ypad * 2)) * arrow_scaling;
-
- xalign = direction == GTK_TEXT_DIR_LTR ? misc_xalign : 1.0 - misc_xalign;
- xpad = misc_xpad + (rect->width - extent) * xalign;
-
- arrow_rect->x = direction == GTK_TEXT_DIR_LTR ?
- floor(rect->x + xpad) : ceil(rect->x + xpad);
- arrow_rect->y = floor(rect->y + misc_ypad +
- ((rect->height - extent) * misc_yalign));
-
- arrow_rect->width = arrow_rect->height = extent;
-
- return MOZ_GTK_SUCCESS;
-}
-
static gint
moz_gtk_scrolled_window_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkWidgetState* state)
@@ -906,226 +437,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget,
return MOZ_GTK_SUCCESS;
}
-static gint
-moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkWidgetState* state,
- GtkWidget* widget, GtkTextDirection direction)
-{
- GtkStateType bg_state = state->disabled ?
- GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
- gint x, y, width = rect->width, height = rect->height;
- GtkStyle* style;
- gboolean interior_focus;
- gboolean theme_honors_transparency = FALSE;
- gint focus_width;
-
- gtk_widget_set_direction(widget, direction);
-
- style = gtk_widget_get_style(widget);
-
- gtk_widget_style_get(widget,
- "interior-focus", &interior_focus,
- "focus-line-width", &focus_width,
- "honors-transparent-bg-hint", &theme_honors_transparency,
- NULL);
-
- /* gtkentry.c uses two windows, one for the entire widget and one for the
- * text area inside it. The background of both windows is set to the "base"
- * color of the new state in gtk_entry_state_changed, but only the inner
- * textarea window uses gtk_paint_flat_box when exposed */
-
- TSOffsetStyleGCs(style, rect->x, rect->y);
-
- /* This gets us a lovely greyish disabledish look */
- gtk_widget_set_sensitive(widget, !state->disabled);
-
- /* GTK fills the outer widget window with the base color before drawing the widget.
- * Some older themes rely on this behavior, but many themes nowadays use rounded
- * corners on their widgets. While most GTK apps are blissfully unaware of this
- * problem due to their use of the default window background, we render widgets on
- * many kinds of backgrounds on the web.
- * If the theme is able to cope with transparency, then we can skip pre-filling
- * and notify the theme it will paint directly on the canvas. */
- if (theme_honors_transparency) {
- g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
- } else {
- gdk_draw_rectangle(drawable, style->base_gc[bg_state], TRUE,
- cliprect->x, cliprect->y, cliprect->width, cliprect->height);
- g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(FALSE));
- }
-
- /* Get the position of the inner window, see _gtk_entry_get_borders */
- x = XTHICKNESS(style);
- y = YTHICKNESS(style);
-
- if (!interior_focus) {
- x += focus_width;
- y += focus_width;
- }
-
- /* Simulate an expose of the inner window */
- gtk_paint_flat_box(style, drawable, bg_state, GTK_SHADOW_NONE,
- cliprect, widget, "entry_bg", rect->x + x,
- rect->y + y, rect->width - 2*x, rect->height - 2*y);
-
- /* Now paint the shadow and focus border.
- * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
- * smaller when focused if the focus is not interior, then the focus. */
- x = rect->x;
- y = rect->y;
-
- if (state->focused && !state->disabled) {
- /* This will get us the lit borders that focused textboxes enjoy on
- * some themes. */
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
-
- if (!interior_focus) {
- /* Indent the border a little bit if we have exterior focus
- (this is what GTK does to draw native entries) */
- x += focus_width;
- y += focus_width;
- width -= 2 * focus_width;
- height -= 2 * focus_width;
- }
- }
-
- gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
- cliprect, widget, "entry", x, y, width, height);
-
- if (state->focused && !state->disabled) {
- if (!interior_focus) {
- gtk_paint_focus(style, drawable, GTK_STATE_NORMAL, cliprect,
- widget, "entry",
- rect->x, rect->y, rect->width, rect->height);
- }
-
- /* Now unset the focus flag. We don't want other entries to look
- * like they're focused too! */
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
- }
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkWidgetState* state,
- gboolean ishtml, GtkTextDirection direction)
-{
- GdkRectangle arrow_rect, real_arrow_rect;
- gint /* arrow_size, */ separator_width;
- gboolean wide_separators;
- GtkStateType state_type = ConvertGtkState(state);
- GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
- GtkStyle* style;
- GtkRequisition arrow_req;
-
- ensure_combo_box_widgets();
-
- /* Also sets the direction on gParts->comboBoxButtonWidget, which is then
- * inherited by the separator and arrow */
- moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
- gParts->comboBoxButtonWidget, direction);
-
- calculate_button_inner_rect(gParts->comboBoxButtonWidget,
- rect, &arrow_rect, direction, ishtml);
- /* Now arrow_rect contains the inner rect ; we want to correct the width
- * to what the arrow needs (see gtk_combo_box_size_allocate) */
- gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req);
- if (direction == GTK_TEXT_DIR_LTR)
- arrow_rect.x += arrow_rect.width - arrow_req.width;
- arrow_rect.width = arrow_req.width;
-
- calculate_arrow_rect(gParts->comboBoxArrowWidget,
- &arrow_rect, &real_arrow_rect, direction);
-
- style = gtk_widget_get_style(gParts->comboBoxArrowWidget);
- TSOffsetStyleGCs(style, rect->x, rect->y);
-
- gtk_widget_size_allocate(gParts->comboBoxWidget, rect);
-
- gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
- gParts->comboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
- real_arrow_rect.x, real_arrow_rect.y,
- real_arrow_rect.width, real_arrow_rect.height);
-
-
- /* If there is no separator in the theme, there's nothing left to do. */
- if (!gParts->comboBoxSeparatorWidget)
- return MOZ_GTK_SUCCESS;
-
- style = gtk_widget_get_style(gParts->comboBoxSeparatorWidget);
- TSOffsetStyleGCs(style, rect->x, rect->y);
-
- gtk_widget_style_get(gParts->comboBoxSeparatorWidget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- NULL);
-
- if (wide_separators) {
- if (direction == GTK_TEXT_DIR_LTR)
- arrow_rect.x -= separator_width;
- else
- arrow_rect.x += arrow_rect.width;
-
- gtk_paint_box(style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
- cliprect, gParts->comboBoxSeparatorWidget, "vseparator",
- arrow_rect.x, arrow_rect.y,
- separator_width, arrow_rect.height);
- } else {
- if (direction == GTK_TEXT_DIR_LTR)
- arrow_rect.x -= XTHICKNESS(style);
- else
- arrow_rect.x += arrow_rect.width;
-
- gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect,
- gParts->comboBoxSeparatorWidget, "vseparator",
- arrow_rect.y, arrow_rect.y + arrow_rect.height,
- arrow_rect.x);
- }
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-moz_gtk_progressbar_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkTextDirection direction)
-{
- GtkStyle* style;
-
- ensure_progress_widget();
- gtk_widget_set_direction(gParts->progresWidget, direction);
-
- style = gtk_widget_get_style(gParts->progresWidget);
-
- TSOffsetStyleGCs(style, rect->x, rect->y);
- gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
- cliprect, gParts->progresWidget, "trough", rect->x, rect->y,
- rect->width, rect->height);
-
- return MOZ_GTK_SUCCESS;
-}
-
-static gint
-moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect,
- GdkRectangle* cliprect, GtkTextDirection direction)
-{
- GtkStyle* style;
-
- ensure_progress_widget();
- gtk_widget_set_direction(gParts->progresWidget, direction);
-
- style = gtk_widget_get_style(gParts->progresWidget);
-
- TSOffsetStyleGCs(style, rect->x, rect->y);
- gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
- cliprect, gParts->progresWidget, "bar", rect->x, rect->y,
- rect->width, rect->height);
-
- return MOZ_GTK_SUCCESS;
-}
-
gint
moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
gint* right, gint* bottom, GtkTextDirection direction,
@@ -1135,99 +446,12 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
GtkStyle *style;
switch (widget) {
- case MOZ_GTK_BUTTON:
- {
- GtkBorder inner_border;
- gboolean interior_focus;
- gint focus_width, focus_pad;
- GtkStyle *style;
-
- ensure_button_widget();
- *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gParts->buttonWidget));
-
- /* Don't add this padding in HTML, otherwise the buttons will
- become too big and stuff the layout. */
- if (!inhtml) {
- moz_gtk_widget_get_focus(gParts->buttonWidget, &interior_focus, &focus_width, &focus_pad);
- moz_gtk_button_get_inner_border(gParts->buttonWidget, &inner_border);
- *left += focus_width + focus_pad + inner_border.left;
- *right += focus_width + focus_pad + inner_border.right;
- *top += focus_width + focus_pad + inner_border.top;
- *bottom += focus_width + focus_pad + inner_border.bottom;
- }
-
- style = gtk_widget_get_style(gParts->buttonWidget);
- *left += style->xthickness;
- *right += style->xthickness;
- *top += style->ythickness;
- *bottom += style->ythickness;
- return MOZ_GTK_SUCCESS;
- }
- case MOZ_GTK_ENTRY:
- ensure_entry_widget();
- w = gParts->entryWidget;
- break;
- case MOZ_GTK_DROPDOWN:
- {
- /* We need to account for the arrow on the dropdown, so text
- * doesn't come too close to the arrow, or in some cases spill
- * into the arrow. */
- gboolean ignored_interior_focus, wide_separators;
- gint focus_width, focus_pad, separator_width;
- GtkRequisition arrow_req;
- GtkStyle* style;
-
- ensure_combo_box_widgets();
-
- *left = gtk_container_get_border_width(GTK_CONTAINER(gParts->comboBoxButtonWidget));
-
- if (!inhtml) {
- moz_gtk_widget_get_focus(gParts->comboBoxButtonWidget,
- &ignored_interior_focus,
- &focus_width, &focus_pad);
- *left += focus_width + focus_pad;
- }
-
- style = gtk_widget_get_style(gParts->comboBoxButtonWidget);
- *top = *left + style->ythickness;
- *left += style->xthickness;
-
- *right = *left; *bottom = *top;
-
- /* If there is no separator, don't try to count its width. */
- separator_width = 0;
- if (gParts->comboBoxSeparatorWidget) {
- gtk_widget_style_get(gParts->comboBoxSeparatorWidget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- NULL);
-
- if (!wide_separators)
- separator_width =
- XTHICKNESS(style);
- }
-
- gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req);
- if (direction == GTK_TEXT_DIR_RTL)
- *left += separator_width + arrow_req.width;
- else
- *right += separator_width + arrow_req.width;
-
- return MOZ_GTK_SUCCESS;
- }
- case MOZ_GTK_PROGRESSBAR:
- ensure_progress_widget();
- w = gParts->progresWidget;
- break;
/* These widgets have no borders, since they are not containers. */
- case MOZ_GTK_CHECKBUTTON:
- case MOZ_GTK_RADIOBUTTON:
case MOZ_GTK_SCROLLBAR_BUTTON:
case MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL:
case MOZ_GTK_SCROLLBAR_TRACK_VERTICAL:
case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL:
case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL:
- case MOZ_GTK_PROGRESS_CHUNK:
*left = *top = *right = *bottom = 0;
return MOZ_GTK_SUCCESS;
default:
@@ -1269,26 +493,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
GtkTextDirection direction)
{
switch (widget) {
- case MOZ_GTK_BUTTON:
- if (state->depressed) {
- ensure_toggle_button_widget();
- return moz_gtk_button_paint(drawable, rect, cliprect, state,
- (GtkReliefStyle) flags,
- gParts->toggleButtonWidget, direction);
- }
- ensure_button_widget();
- return moz_gtk_button_paint(drawable, rect, cliprect, state,
- (GtkReliefStyle) flags, gParts->buttonWidget,
- direction);
- break;
- case MOZ_GTK_CHECKBUTTON:
- case MOZ_GTK_RADIOBUTTON:
- return moz_gtk_toggle_paint(drawable, rect, cliprect, state,
- !!(flags & MOZ_GTK_WIDGET_CHECKED),
- !!(flags & MOZ_GTK_WIDGET_INCONSISTENT),
- (widget == MOZ_GTK_RADIOBUTTON),
- direction);
- break;
case MOZ_GTK_SCROLLBAR_BUTTON:
return moz_gtk_scrollbar_button_paint(drawable, rect, cliprect, state,
(GtkScrollbarButtonFlags) flags,
@@ -1307,22 +511,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
case MOZ_GTK_SCROLLED_WINDOW:
return moz_gtk_scrolled_window_paint(drawable, rect, cliprect, state);
break;
- case MOZ_GTK_ENTRY:
- ensure_entry_widget();
- return moz_gtk_entry_paint(drawable, rect, cliprect, state,
- gParts->entryWidget, direction);
- break;
- case MOZ_GTK_DROPDOWN:
- return moz_gtk_combo_box_paint(drawable, rect, cliprect, state,
- (gboolean) flags, direction);
- break;
- case MOZ_GTK_PROGRESSBAR:
- return moz_gtk_progressbar_paint(drawable, rect, cliprect, direction);
- break;
- case MOZ_GTK_PROGRESS_CHUNK:
- return moz_gtk_progress_chunk_paint(drawable, rect, cliprect,
- direction);
- break;
default:
g_warning("Unknown widget type: %d", widget);
}
@@ -1361,12 +549,4 @@ void moz_gtk_destroy_theme_parts_widgets(GtkThemeParts* parts)
}
}
-GtkWidget* moz_gtk_get_progress_widget()
-{
- if (!is_initialized)
- return NULL;
- ensure_progress_widget();
- return gParts->progresWidget;
-}
-
#endif // GTK_API_VERSION_2
diff --git a/Source/WebCore/platform/gtk/gtkdrawing.h b/Source/WebCore/platform/gtk/gtkdrawing.h
index 412a1f7..cdb343c 100644
--- a/Source/WebCore/platform/gtk/gtkdrawing.h
+++ b/Source/WebCore/platform/gtk/gtkdrawing.h
@@ -48,6 +48,8 @@
#ifndef _GTK_DRAWING_H_
#define _GTK_DRAWING_H_
+#undef GTK_DISABLE_DEPRECATED
+
#include <gtk/gtk.h>
#ifdef __cplusplus
@@ -84,23 +86,8 @@ typedef struct _GtkThemeParts {
GdkColormap* colormap;
GtkWidget* protoWindow;
GtkWidget* protoLayout;
- GtkWidget* buttonWidget;
- GtkWidget* toggleButtonWidget;
- GtkWidget* buttonArrowWidget;
- GtkWidget* checkboxWidget;
- GtkWidget* radiobuttonWidget;
GtkWidget* horizScrollbarWidget;
GtkWidget* vertScrollbarWidget;
- GtkWidget* entryWidget;
- GtkWidget* comboBoxWidget;
- GtkWidget* comboBoxButtonWidget;
- GtkWidget* comboBoxArrowWidget;
- GtkWidget* comboBoxSeparatorWidget;
- GtkWidget* comboBoxEntryWidget;
- GtkWidget* comboBoxEntryTextareaWidget;
- GtkWidget* comboBoxEntryButtonWidget;
- GtkWidget* comboBoxEntryArrowWidget;
- GtkWidget* progresWidget;
GtkWidget* scrolledWindowWidget;
} GtkThemeParts;
@@ -118,18 +105,10 @@ typedef gint (*style_prop_t)(GtkStyle*, const gchar*, gint);
#define MOZ_GTK_UNKNOWN_WIDGET -1
#define MOZ_GTK_UNSAFE_THEME -2
-/*** checkbox/radio flags ***/
-#define MOZ_GTK_WIDGET_CHECKED 1
-#define MOZ_GTK_WIDGET_INCONSISTENT (1 << 1)
-
/*** widget type constants ***/
typedef enum {
/* Paints a GtkButton. flags is a GtkReliefStyle. */
MOZ_GTK_BUTTON,
- /* Paints a GtkCheckButton. flags is a boolean, 1=checked, 0=not checked. */
- MOZ_GTK_CHECKBUTTON,
- /* Paints a GtkRadioButton. flags is a boolean, 1=checked, 0=not checked. */
- MOZ_GTK_RADIOBUTTON,
/**
* Paints the button of a GtkScrollbar. flags is a GtkArrowType giving
* the arrow direction.
@@ -143,13 +122,6 @@ typedef enum {
MOZ_GTK_SCROLLBAR_THUMB_VERTICAL,
/* Paints the background of a scrolled window */
MOZ_GTK_SCROLLED_WINDOW,
- MOZ_GTK_ENTRY,
- /* Paints a GtkOptionMenu. */
- MOZ_GTK_DROPDOWN,
- /* Paints a GtkProgressBar. */
- MOZ_GTK_PROGRESSBAR,
- /* Paints a progress chunk of a GtkProgressBar. */
- MOZ_GTK_PROGRESS_CHUNK
} GtkThemeWidgetType;
/*** General library functions ***/
@@ -223,42 +195,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
gint* right, gint* bottom, GtkTextDirection direction,
gboolean inhtml);
-
-/**
- * Get the desired size of a GtkCheckButton
- * indicator_size: [OUT] the indicator size
- * indicator_spacing: [OUT] the spacing between the indicator and its
- * container
- *
- * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
- */
-gint
-moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing);
-
-/**
- * Get the desired size of a GtkRadioButton
- * indicator_size: [OUT] the indicator size
- * indicator_spacing: [OUT] the spacing between the indicator and its
- * container
- *
- * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
- */
-gint
-moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing);
-
-/** Get the focus metrics for a treeheadercell, button, checkbox, or radio button.
- * widget: [IN] the widget to get the focus metrics for
- * interior_focus: [OUT] whether the focus is drawn around the
- * label (TRUE) or around the whole container (FALSE)
- * focus_width: [OUT] the width of the focus line
- * focus_pad: [OUT] the padding between the focus line and children
- *
- * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
- */
-gint
-moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus,
- gint* focus_width, gint* focus_pad);
-
/**
* Get the desired metrics for a GtkScrollbar
* metrics: [IN] struct which will contain the metrics
@@ -274,12 +210,6 @@ moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics);
*/
GtkWidget* moz_gtk_get_scrollbar_widget(void);
-/**
- * Retrieve an actual GTK progress bar widget for style analysis. It will not
- * be modified.
- */
-GtkWidget* moz_gtk_get_progress_widget(void);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h
index 13069de..c581ba1 100644
--- a/Source/WebCore/platform/image-decoders/ImageDecoder.h
+++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h
@@ -231,7 +231,8 @@ namespace WebCore {
// setMaxNumPixels() to specify the biggest size that decoded images can
// have. Image decoders will deflate those images that are bigger than
// m_maxNumPixels. (Not supported by all image decoders yet)
- class ImageDecoder : public Noncopyable {
+ class ImageDecoder {
+ WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED;
public:
ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
: m_scaled(false)
diff --git a/Source/WebCore/platform/mac/ClipboardMac.h b/Source/WebCore/platform/mac/ClipboardMac.h
index 7187ecf..39eadda 100644
--- a/Source/WebCore/platform/mac/ClipboardMac.h
+++ b/Source/WebCore/platform/mac/ClipboardMac.h
@@ -44,6 +44,7 @@ class Frame;
class FileList;
class ClipboardMac : public Clipboard, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<ClipboardMac> create(ClipboardType clipboardType, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame* frame)
{
diff --git a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h
index 90beb40..8fde2cf 100644
--- a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h
+++ b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h
@@ -31,7 +31,8 @@ class GraphicsContext;
// This class automatically saves and restores the current NSGraphicsContext for
// functions which call out into AppKit and rely on the currentContext being set
-class LocalCurrentGraphicsContext : public Noncopyable {
+class LocalCurrentGraphicsContext {
+ WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
public:
LocalCurrentGraphicsContext(GraphicsContext* graphicsContext);
~LocalCurrentGraphicsContext();
diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.h b/Source/WebCore/platform/mac/ScrollAnimatorMac.h
index 234e43c..f05db40 100644
--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.h
+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.h
@@ -28,7 +28,6 @@
#if ENABLE(SMOOTH_SCROLLING)
-#include "FloatPoint.h"
#include "ScrollAnimator.h"
#include <wtf/RetainPtr.h>
@@ -42,14 +41,13 @@ namespace WebCore {
class ScrollAnimatorMac : public ScrollAnimator {
public:
- ScrollAnimatorMac(ScrollbarClient*);
+ ScrollAnimatorMac(ScrollableArea*);
virtual ~ScrollAnimatorMac();
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
- virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float position);
+ virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
// Called by the ScrollAnimationHelperDelegate.
- FloatPoint currentPosition() const;
void immediateScrollToPoint(const FloatPoint& newPosition);
private:
diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
index ca71bd3..59b333b 100644
--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
@@ -28,7 +28,10 @@
#if ENABLE(SMOOTH_SCROLLING)
#include "ScrollAnimatorMac.h"
-#include "ScrollbarClient.h"
+
+#include "FloatPoint.h"
+#include "ScrollableArea.h"
+#include <wtf/PassOwnPtr.h>
@interface NSObject (NSScrollAnimationHelperDetails)
- (id)initWithDelegate:(id)delegate;
@@ -121,13 +124,13 @@ static NSSize abs(NSSize size)
namespace WebCore {
-ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
{
- return new ScrollAnimatorMac(client);
+ return adoptPtr(new ScrollAnimatorMac(scrollableArea));
}
-ScrollAnimatorMac::ScrollAnimatorMac(ScrollbarClient* client)
- : ScrollAnimator(client)
+ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
+ : ScrollAnimator(scrollableArea)
{
m_scrollAnimationHelperDelegate.adoptNS([[ScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
@@ -146,7 +149,7 @@ bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranulari
return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_currentPosY;
- float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0);
+ float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0);
if (currentPos == newPos)
return false;
@@ -161,23 +164,17 @@ bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranulari
return true;
}
-void ScrollAnimatorMac::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos)
+void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
{
[m_scrollAnimationHelper.get() _stopRun];
- ScrollAnimator::setScrollPositionAndStopAnimation(orientation, pos);
-}
-
-FloatPoint ScrollAnimatorMac::currentPosition() const
-{
- return FloatPoint(m_currentPosX, m_currentPosY);
+ ScrollAnimator::scrollToOffsetWithoutAnimation(offset);
}
void ScrollAnimatorMac::immediateScrollToPoint(const FloatPoint& newPosition)
{
m_currentPosX = newPosition.x();
m_currentPosY = newPosition.y();
-
- m_client->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY));
+ notityPositionChanged();
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.h b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
index c833ee7..8b5412d 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.h
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
@@ -40,6 +40,7 @@ public:
virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
virtual bool supportsControlTints() const { return true; }
+ virtual bool usesOverlayScrollbars() const;
virtual double initialAutoscrollTimerDelay();
virtual double autoscrollTimerDelay();
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
index ce3be1a..032d9f3 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
@@ -27,18 +27,39 @@
#include "ScrollbarThemeMac.h"
#include "ImageBuffer.h"
+#include "LocalCurrentGraphicsContext.h"
#include "PlatformMouseEvent.h"
#include "ScrollView.h"
+#include "WebCoreSystemInterface.h"
#include <Carbon/Carbon.h>
+#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
#include <wtf/UnusedParam.h>
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#define USE_WK_SCROLLBAR_PAINTER
+#endif
+
// FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow.
using namespace std;
using namespace WebCore;
-static HashSet<Scrollbar*>* gScrollbars;
+namespace WebCore {
+
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+typedef HashMap<Scrollbar*, RetainPtr<WKScrollbarPainterRef> > ScrollbarPainterMap;
+#else
+typedef HashSet<Scrollbar*> ScrollbarPainterMap;
+#endif
+
+static ScrollbarPainterMap* scrollbarMap()
+{
+ static ScrollbarPainterMap* map = new ScrollbarPainterMap;
+ return map;
+}
+
+}
@interface ScrollbarPrefsObserver : NSObject
{
@@ -58,12 +79,17 @@ static HashSet<Scrollbar*>* gScrollbars;
UNUSED_PARAM(unusedNotification);
static_cast<ScrollbarThemeMac*>(ScrollbarTheme::nativeTheme())->preferencesChanged();
- if (!gScrollbars)
+ if (scrollbarMap()->isEmpty())
return;
- HashSet<Scrollbar*>::iterator end = gScrollbars->end();
- for (HashSet<Scrollbar*>::iterator it = gScrollbars->begin(); it != end; ++it) {
+ ScrollbarPainterMap::iterator end = scrollbarMap()->end();
+ for (ScrollbarPainterMap::iterator it = scrollbarMap()->begin(); it != end; ++it) {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+ it->first->styleChanged();
+ it->first->invalidate();
+#else
(*it)->styleChanged();
(*it)->invalidate();
+#endif
}
}
@@ -109,6 +135,9 @@ static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
static void updateArrowPlacement()
{
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+ gButtonPlacement = ScrollbarButtonsNone;
+#else
NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"];
if ([buttonPlacement isEqualToString:@"Single"])
gButtonPlacement = ScrollbarButtonsSingle;
@@ -118,22 +147,23 @@ static void updateArrowPlacement()
gButtonPlacement = ScrollbarButtonsDoubleBoth;
else
gButtonPlacement = ScrollbarButtonsDoubleEnd; // The default is ScrollbarButtonsDoubleEnd.
+#endif
}
void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar)
{
- if (!gScrollbars)
- gScrollbars = new HashSet<Scrollbar*>;
- gScrollbars->add(scrollbar);
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+ WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(),
+ scrollbar->orientation() == HorizontalScrollbar);
+ scrollbarMap()->add(scrollbar, scrollbarPainter);
+#else
+ scrollbarMap()->add(scrollbar);
+#endif
}
void ScrollbarThemeMac::unregisterScrollbar(Scrollbar* scrollbar)
{
- gScrollbars->remove(scrollbar);
- if (gScrollbars->isEmpty()) {
- delete gScrollbars;
- gScrollbars = 0;
- }
+ scrollbarMap()->remove(scrollbar);
}
ScrollbarThemeMac::ScrollbarThemeMac()
@@ -165,6 +195,12 @@ int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
return cScrollbarThickness[controlSize];
}
+bool ScrollbarThemeMac::usesOverlayScrollbars() const
+{
+ // FIXME: This should be enabled when <rdar://problem/8492788> is resolved.
+ return false;
+}
+
double ScrollbarThemeMac::initialAutoscrollTimerDelay()
{
return gInitialButtonDelay;
@@ -355,6 +391,20 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part)
bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect)
{
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+ context->save();
+ context->clip(damageRect);
+ context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y());
+ LocalCurrentGraphicsContext localContext(context);
+ wkScrollbarPainterPaint(scrollbarMap()->get(scrollbar).get(),
+ scrollbar->enabled(),
+ scrollbar->currentPos() / scrollbar->maximum(),
+ static_cast<CGFloat>(scrollbar->visibleSize()) / scrollbar->totalSize(),
+ scrollbar->frameRect());
+ context->restore();
+ return true;
+#endif
+
HIThemeTrackDrawInfo trackInfo;
trackInfo.version = 0;
trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar;
@@ -370,7 +420,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co
if (!scrollbar->enabled())
trackInfo.enableState = kThemeTrackDisabled;
else
- trackInfo.enableState = scrollbar->client()->isActive() ? kThemeTrackActive : kThemeTrackInactive;
+ trackInfo.enableState = scrollbar->scrollableArea()->isActive() ? kThemeTrackActive : kThemeTrackInactive;
if (hasThumb(scrollbar))
trackInfo.attributes |= kThemeTrackShowThumb;
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index 0c78c23..045864a 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -186,6 +186,10 @@ extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(cons
extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
+
+typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
+extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
#endif
}
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index df3c77c..047827f 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -125,4 +125,7 @@ CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniCh
CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
+
+WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
#endif
diff --git a/Source/WebCore/platform/mock/SpeechInputClientMock.cpp b/Source/WebCore/platform/mock/SpeechInputClientMock.cpp
index 16a7c76..9aa3113 100644
--- a/Source/WebCore/platform/mock/SpeechInputClientMock.cpp
+++ b/Source/WebCore/platform/mock/SpeechInputClientMock.cpp
@@ -33,6 +33,7 @@
#if ENABLE(INPUT_SPEECH)
+#include "SecurityOrigin.h"
#include "SpeechInputListener.h"
namespace WebCore {
@@ -50,7 +51,7 @@ void SpeechInputClientMock::setListener(SpeechInputListener* listener)
m_listener = listener;
}
-bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar)
+bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin* origin)
{
if (m_timer.isActive())
return false;
diff --git a/Source/WebCore/platform/mock/SpeechInputClientMock.h b/Source/WebCore/platform/mock/SpeechInputClientMock.h
index 6f72191..4e13242 100644
--- a/Source/WebCore/platform/mock/SpeechInputClientMock.h
+++ b/Source/WebCore/platform/mock/SpeechInputClientMock.h
@@ -54,7 +54,7 @@ public:
// SpeechInputClient methods.
void setListener(SpeechInputListener*);
- bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar);
+ bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*);
void stopRecording(int);
void cancelRecognition(int);
diff --git a/Source/WebCore/platform/network/BlobData.h b/Source/WebCore/platform/network/BlobData.h
index 1ff6344..c1f5522 100644
--- a/Source/WebCore/platform/network/BlobData.h
+++ b/Source/WebCore/platform/network/BlobData.h
@@ -145,6 +145,7 @@ private:
typedef Vector<BlobDataItem> BlobDataItemList;
class BlobData {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<BlobData> create();
diff --git a/Source/WebCore/platform/network/FormDataBuilder.h b/Source/WebCore/platform/network/FormDataBuilder.h
index 87d0ef3..112e315 100644
--- a/Source/WebCore/platform/network/FormDataBuilder.h
+++ b/Source/WebCore/platform/network/FormDataBuilder.h
@@ -23,14 +23,14 @@
#include "PlatformString.h"
#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
namespace WebCore {
class Document;
class TextEncoding;
-class FormDataBuilder : public Noncopyable {
+class FormDataBuilder {
+ WTF_MAKE_NONCOPYABLE(FormDataBuilder);
public:
static TextEncoding encodingFromAcceptCharset(const String& acceptCharset, Document* document);
diff --git a/Source/WebCore/platform/network/NetworkStateNotifier.h b/Source/WebCore/platform/network/NetworkStateNotifier.h
index 21d0067..08ab0bd 100644
--- a/Source/WebCore/platform/network/NetworkStateNotifier.h
+++ b/Source/WebCore/platform/network/NetworkStateNotifier.h
@@ -26,6 +26,7 @@
#ifndef NetworkStateNotifier_h
#define NetworkStateNotifier_h
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
#if PLATFORM(ANDROID)
// TODO: Upstream to webkit.org
@@ -65,7 +66,8 @@ namespace WebCore {
class NetworkStateNotifierPrivate;
#endif
-class NetworkStateNotifier : public Noncopyable {
+class NetworkStateNotifier {
+ WTF_MAKE_NONCOPYABLE(NetworkStateNotifier); WTF_MAKE_FAST_ALLOCATED;
public:
NetworkStateNotifier();
void setNetworkStateChangedFunction(void (*)());
diff --git a/Source/WebCore/platform/network/ResourceHandleInternal.h b/Source/WebCore/platform/network/ResourceHandleInternal.h
index d833e32..ed66944 100644
--- a/Source/WebCore/platform/network/ResourceHandleInternal.h
+++ b/Source/WebCore/platform/network/ResourceHandleInternal.h
@@ -80,7 +80,8 @@ class NSURLConnection;
namespace WebCore {
class ResourceHandleClient;
- class ResourceHandleInternal : public Noncopyable {
+ class ResourceHandleInternal {
+ WTF_MAKE_NONCOPYABLE(ResourceHandleInternal); WTF_MAKE_FAST_ALLOCATED;
public:
ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff)
: m_client(c)
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h
index 5cb7ee3..dce33db 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.h
+++ b/Source/WebCore/platform/network/ResourceRequestBase.h
@@ -49,7 +49,8 @@ namespace WebCore {
struct CrossThreadResourceRequestData;
// Do not use this type directly. Use ResourceRequest instead.
- class ResourceRequestBase : public FastAllocBase {
+ class ResourceRequestBase {
+ WTF_MAKE_FAST_ALLOCATED;
public:
// The type of this ResourceRequest, based on how the resource will be used.
enum TargetType {
@@ -207,7 +208,10 @@ namespace WebCore {
inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { return ResourceRequestBase::compare(a, b); }
inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !(a == b); }
- struct CrossThreadResourceRequestDataBase : Noncopyable {
+ struct CrossThreadResourceRequestDataBase {
+ WTF_MAKE_NONCOPYABLE(CrossThreadResourceRequestDataBase); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ CrossThreadResourceRequestDataBase() { }
KURL m_url;
ResourceRequestCachePolicy m_cachePolicy;
diff --git a/Source/WebCore/platform/network/ResourceResponseBase.h b/Source/WebCore/platform/network/ResourceResponseBase.h
index 9c54bab..e0774c2 100644
--- a/Source/WebCore/platform/network/ResourceResponseBase.h
+++ b/Source/WebCore/platform/network/ResourceResponseBase.h
@@ -41,7 +41,8 @@ class ResourceResponse;
struct CrossThreadResourceResponseData;
// Do not use this class directly, use the class ResponseResponse instead
-class ResourceResponseBase : public FastAllocBase {
+class ResourceResponseBase {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<ResourceResponse> adopt(PassOwnPtr<CrossThreadResourceResponseData>);
@@ -175,7 +176,10 @@ private:
inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); }
inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
-struct CrossThreadResourceResponseDataBase : Noncopyable {
+struct CrossThreadResourceResponseDataBase {
+ WTF_MAKE_NONCOPYABLE(CrossThreadResourceResponseDataBase);
+public:
+ CrossThreadResourceResponseDataBase() { }
KURL m_url;
String m_mimeType;
long long m_expectedContentLength;
diff --git a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
index 659b719..c6d513a 100644
--- a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
@@ -34,6 +34,7 @@
#include "KURL.h"
#include "PlatformString.h"
#include "ResourceHandle.h"
+#include "SoftLinking.h"
#include <CFNetwork/CFHTTPCookiesPriv.h>
#include <CoreFoundation/CoreFoundation.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -44,6 +45,53 @@ namespace WebCore {
static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
static const CFStringRef s_cookieCF = CFSTR("Cookie");
+#ifdef DEBUG_ALL
+SOFT_LINK_DEBUG_LIBRARY(CFNetwork)
+#else
+SOFT_LINK_LIBRARY(CFNetwork)
+#endif
+
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyDomain, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieGetExpirationTime, CFAbsoluteTime, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyName, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyPath, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyValue, CFStringRef, __cdecl, (CFHTTPCookieRef))
+
+static inline RetainPtr<CFStringRef> cookieDomain(CFHTTPCookieRef cookie)
+{
+ if (CFHTTPCookieCopyDomainPtr())
+ return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyDomainPtr()(cookie));
+ return CFHTTPCookieGetDomain(cookie);
+}
+
+static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie)
+{
+ if (CFHTTPCookieGetExpirationTimePtr())
+ return CFHTTPCookieGetExpirationTimePtr()(cookie);
+ return CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie));
+}
+
+static inline RetainPtr<CFStringRef> cookieName(CFHTTPCookieRef cookie)
+{
+ if (CFHTTPCookieCopyNamePtr())
+ return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyNamePtr()(cookie));
+ return CFHTTPCookieGetName(cookie);
+}
+
+static inline RetainPtr<CFStringRef> cookiePath(CFHTTPCookieRef cookie)
+{
+ if (CFHTTPCookieCopyPathPtr())
+ return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyPathPtr()(cookie));
+ return CFHTTPCookieGetPath(cookie);
+}
+
+static inline RetainPtr<CFStringRef> cookieValue(CFHTTPCookieRef cookie)
+{
+ if (CFHTTPCookieCopyValuePtr())
+ return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyValuePtr()(cookie));
+ return CFHTTPCookieGetValue(cookie);
+}
+
static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
{
CFIndex count = CFArrayGetCount(unfilteredCookies);
@@ -55,7 +103,7 @@ static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
// which would be sent as "Cookie: =". We have a workaround in setCookies() to prevent
// that, but we also need to avoid sending cookies that were previously stored, and
// there's no harm to doing this check because such a cookie is never valid.
- if (!CFStringGetLength(CFHTTPCookieGetName(cookie)))
+ if (!CFStringGetLength(cookieName(cookie).get()))
continue;
if (CFHTTPCookieIsHTTPOnly(cookie))
@@ -147,12 +195,12 @@ bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies)
for (CFIndex i = 0; i < count; i++) {
CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
- String name = CFHTTPCookieGetName(cookie);
- String value = CFHTTPCookieGetValue(cookie);
- String domain = CFHTTPCookieGetDomain(cookie);
- String path = CFHTTPCookieGetPath(cookie);
+ String name = cookieName(cookie).get();
+ String value = cookieValue(cookie).get();
+ String domain = cookieDomain(cookie).get();
+ String path = cookiePath(cookie).get();
- double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;
+ double expires = (cookieExpirationTime(cookie) + kCFAbsoluteTimeIntervalSince1970) * 1000;
bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie);
bool secure = CFHTTPCookieIsSecure(cookie);
@@ -178,8 +226,7 @@ void deleteCookie(const Document*, const KURL& url, const String& name)
CFIndex count = CFArrayGetCount(cookiesCF.get());
for (CFIndex i = 0; i < count; i++) {
CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
- String cookieName = CFHTTPCookieGetName(cookie);
- if (cookieName == name) {
+ if (String(cookieName(cookie).get()) == name) {
CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie);
break;
}
diff --git a/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp b/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp
index e17816a..2f2489b 100644
--- a/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp
+++ b/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp
@@ -32,39 +32,39 @@
#include "CookieJar.h"
#include "Cookie.h"
-#include "ChromiumBridge.h"
#include "Document.h"
+#include "PlatformBridge.h"
namespace WebCore {
void setCookies(Document* document, const KURL& url, const String& value)
{
- ChromiumBridge::setCookies(document, url, value);
+ PlatformBridge::setCookies(document, url, value);
}
String cookies(const Document* document, const KURL& url)
{
- return ChromiumBridge::cookies(document, url);
+ return PlatformBridge::cookies(document, url);
}
String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
{
- return ChromiumBridge::cookieRequestHeaderFieldValue(document, url);
+ return PlatformBridge::cookieRequestHeaderFieldValue(document, url);
}
bool cookiesEnabled(const Document* document)
{
- return ChromiumBridge::cookiesEnabled(document);
+ return PlatformBridge::cookiesEnabled(document);
}
bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
{
- return ChromiumBridge::rawCookies(document, url, rawCookies);
+ return PlatformBridge::rawCookies(document, url, rawCookies);
}
void deleteCookie(const Document* document, const KURL& url, const String& cookieName)
{
- return ChromiumBridge::deleteCookie(document, url, cookieName);
+ return PlatformBridge::deleteCookie(document, url, cookieName);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/network/chromium/DNSChromium.cpp b/Source/WebCore/platform/network/chromium/DNSChromium.cpp
index 21fcd46..7b9eac5 100644
--- a/Source/WebCore/platform/network/chromium/DNSChromium.cpp
+++ b/Source/WebCore/platform/network/chromium/DNSChromium.cpp
@@ -26,14 +26,14 @@
#include "config.h"
#include "DNS.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "ResourceHandle.h"
namespace WebCore {
void prefetchDNS(const String& hostname)
{
- ChromiumBridge::prefetchDNS(hostname);
+ PlatformBridge::prefetchDNS(hostname);
}
void ResourceHandle::prepareForURL(const KURL& url)
diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index ebb6c5f..a7170fe 100644
--- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -60,7 +60,8 @@ namespace WebCore {
#define READ_BUFFER_SIZE 8192
-class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable {
+class WebCoreSynchronousLoader : public ResourceHandleClient {
+ WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader);
public:
WebCoreSynchronousLoader(ResourceError&, ResourceResponse &, Vector<char>&);
~WebCoreSynchronousLoader();
diff --git a/Source/WebCore/platform/network/win/ResourceHandleWin.cpp b/Source/WebCore/platform/network/win/ResourceHandleWin.cpp
index 38d9cd1..f50540c 100644
--- a/Source/WebCore/platform/network/win/ResourceHandleWin.cpp
+++ b/Source/WebCore/platform/network/win/ResourceHandleWin.cpp
@@ -76,7 +76,8 @@ static String queryHTTPHeader(HINTERNET requestHandle, DWORD infoLevel)
}
-class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable {
+class WebCoreSynchronousLoader : public ResourceHandleClient {
+ WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader);
public:
WebCoreSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&, const String& userAgent);
~WebCoreSynchronousLoader();
diff --git a/Source/WebCore/platform/qt/ClipboardQt.h b/Source/WebCore/platform/qt/ClipboardQt.h
index 5aca1a6..fb5abef 100644
--- a/Source/WebCore/platform/qt/ClipboardQt.h
+++ b/Source/WebCore/platform/qt/ClipboardQt.h
@@ -39,6 +39,7 @@ namespace WebCore {
// State available during IE's events for drag and drop and copy/paste
class ClipboardQt : public Clipboard, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, const QMimeData* readableClipboard)
{
diff --git a/Source/WebCore/platform/qt/PlatformBridge.h b/Source/WebCore/platform/qt/PlatformBridge.h
index e478d8f..9647507 100644
--- a/Source/WebCore/platform/qt/PlatformBridge.h
+++ b/Source/WebCore/platform/qt/PlatformBridge.h
@@ -86,7 +86,7 @@ class Widget;
// An interface to the embedding layer, which has the ability to answer
// questions about the system and so on...
-// This is very similar to ChromiumBridge and the two are likely to converge
+// This is very similar to chromium/PlatformBridge and the two are likely to converge
// in the future.
class PlatformBridge {
public:
diff --git a/Source/WebCore/platform/qt/ScrollbarQt.cpp b/Source/WebCore/platform/qt/ScrollbarQt.cpp
index a517064..dda82e9 100644
--- a/Source/WebCore/platform/qt/ScrollbarQt.cpp
+++ b/Source/WebCore/platform/qt/ScrollbarQt.cpp
@@ -34,6 +34,7 @@
#include "GraphicsContext.h"
#include "IntRect.h"
#include "PlatformMouseEvent.h"
+#include "ScrollableArea.h"
#include "ScrollbarTheme.h"
#include <QApplication>
@@ -76,17 +77,17 @@ bool Scrollbar::contextMenu(const PlatformMouseEvent& event)
const QPoint pos = convertFromContainingWindow(event.pos());
moveThumb(horizontal ? pos.x() : pos.y());
} else if (actionSelected == actScrollTop)
- scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument);
+ scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument);
else if (actionSelected == actScrollBottom)
- scroll(horizontal ? ScrollRight : ScrollDown, ScrollByDocument);
+ scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByDocument);
else if (actionSelected == actPageUp)
- scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByPage);
+ scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByPage);
else if (actionSelected == actPageDown)
- scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage);
+ scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage);
else if (actionSelected == actScrollUp)
- scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine);
+ scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine);
else if (actionSelected == actScrollDown)
- scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine);
+ scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine);
#endif // QT_NO_CONTEXTMENU
return true;
}
diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.h b/Source/WebCore/platform/sql/SQLiteDatabase.h
index c329273..da53acc 100644
--- a/Source/WebCore/platform/sql/SQLiteDatabase.h
+++ b/Source/WebCore/platform/sql/SQLiteDatabase.h
@@ -50,7 +50,8 @@ extern const int SQLResultSchema;
extern const int SQLResultFull;
extern const int SQLResultInterrupt;
-class SQLiteDatabase : public Noncopyable {
+class SQLiteDatabase {
+ WTF_MAKE_NONCOPYABLE(SQLiteDatabase);
friend class SQLiteTransaction;
public:
SQLiteDatabase();
diff --git a/Source/WebCore/platform/sql/SQLiteStatement.h b/Source/WebCore/platform/sql/SQLiteStatement.h
index 1444f0e..fd1abfb 100644
--- a/Source/WebCore/platform/sql/SQLiteStatement.h
+++ b/Source/WebCore/platform/sql/SQLiteStatement.h
@@ -34,7 +34,8 @@ namespace WebCore {
class SQLValue;
-class SQLiteStatement : public Noncopyable {
+class SQLiteStatement {
+ WTF_MAKE_NONCOPYABLE(SQLiteStatement); WTF_MAKE_FAST_ALLOCATED;
public:
SQLiteStatement(SQLiteDatabase&, const String&);
~SQLiteStatement();
diff --git a/Source/WebCore/platform/sql/SQLiteTransaction.h b/Source/WebCore/platform/sql/SQLiteTransaction.h
index 924241f..ba686ba 100644
--- a/Source/WebCore/platform/sql/SQLiteTransaction.h
+++ b/Source/WebCore/platform/sql/SQLiteTransaction.h
@@ -26,14 +26,15 @@
#ifndef SQLiteTransaction_h
#define SQLiteTransaction_h
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class SQLiteDatabase;
-class SQLiteTransaction : public Noncopyable
-{
+class SQLiteTransaction {
+ WTF_MAKE_NONCOPYABLE(SQLiteTransaction); WTF_MAKE_FAST_ALLOCATED;
public:
SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false);
~SQLiteTransaction();
diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp
index 0a09888..b79eb1a 100644
--- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp
+++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "SQLiteFileSystem.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include "SQLiteDatabase.h"
#include <sqlite3.h>
#include <wtf/text/CString.h>
@@ -92,12 +92,12 @@ bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&)
bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName)
{
- return (ChromiumBridge::databaseDeleteFile(fileName) == SQLITE_OK);
+ return (PlatformBridge::databaseDeleteFile(fileName) == SQLITE_OK);
}
long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName)
{
- return ChromiumBridge::databaseGetFileSize(fileName);
+ return PlatformBridge::databaseGetFileSize(fileName);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
index 1102df5..37f96be 100644
--- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
+++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "SQLiteFileSystem.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include <sqlite3.h>
#include <errno.h>
@@ -996,10 +996,10 @@ static int chromiumOpen(sqlite3_vfs* vfs, const char* fileName,
}
if (fd < 0) {
- fd = ChromiumBridge::databaseOpenFile(fileName, desiredFlags);
+ fd = PlatformBridge::databaseOpenFile(fileName, desiredFlags);
if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) {
int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY;
- fd = ChromiumBridge::databaseOpenFile(fileName, newFlags);
+ fd = PlatformBridge::databaseOpenFile(fileName, newFlags);
}
}
if (fd < 0) {
@@ -1031,7 +1031,7 @@ static int chromiumOpen(sqlite3_vfs* vfs, const char* fileName,
// should be synched after the file is deleted.
static int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir)
{
- return ChromiumBridge::databaseDeleteFile(fileName, syncDir);
+ return PlatformBridge::databaseDeleteFile(fileName, syncDir);
}
// Check the existance and status of the given file.
@@ -1042,7 +1042,7 @@ static int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir)
// res - the result.
static int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
{
- int attr = static_cast<int>(ChromiumBridge::databaseGetFileAttributes(fileName));
+ int attr = static_cast<int>(PlatformBridge::databaseGetFileAttributes(fileName));
if (attr < 0) {
*res = 0;
return SQLITE_OK;
diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp
index d846af7..47e01d0 100644
--- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp
+++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "SQLiteFileSystem.h"
-#include "ChromiumBridge.h"
+#include "PlatformBridge.h"
#include <sqlite3.h>
#include <windows.h>
@@ -55,7 +55,7 @@ namespace {
int chromiumOpen(sqlite3_vfs*, const char* fileName,
sqlite3_file* id, int desiredFlags, int* usedFlags)
{
- HANDLE h = ChromiumBridge::databaseOpenFile(fileName, desiredFlags);
+ HANDLE h = PlatformBridge::databaseOpenFile(fileName, desiredFlags);
if (h == INVALID_HANDLE_VALUE) {
if (desiredFlags & SQLITE_OPEN_READWRITE) {
int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE;
@@ -82,7 +82,7 @@ int chromiumOpen(sqlite3_vfs*, const char* fileName,
// should be synched after the file is deleted.
int chromiumDelete(sqlite3_vfs*, const char* fileName, int)
{
- return ChromiumBridge::databaseDeleteFile(fileName);
+ return PlatformBridge::databaseDeleteFile(fileName);
}
// Check the existance and status of the given file.
@@ -93,7 +93,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int)
// res - the result.
int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
{
- DWORD attr = ChromiumBridge::databaseGetFileAttributes(fileName);
+ DWORD attr = PlatformBridge::databaseGetFileAttributes(fileName);
switch (flag) {
case SQLITE_ACCESS_READ:
case SQLITE_ACCESS_EXISTS:
diff --git a/Source/WebCore/platform/text/BidiResolver.h b/Source/WebCore/platform/text/BidiResolver.h
index 1f87115..8abd698 100644
--- a/Source/WebCore/platform/text/BidiResolver.h
+++ b/Source/WebCore/platform/text/BidiResolver.h
@@ -126,7 +126,8 @@ struct BidiCharacterRun {
BidiCharacterRun* m_next;
};
-template <class Iterator, class Run> class BidiResolver : public Noncopyable {
+template <class Iterator, class Run> class BidiResolver {
+ WTF_MAKE_NONCOPYABLE(BidiResolver);
public :
BidiResolver()
: m_direction(WTF::Unicode::OtherNeutral)
@@ -314,23 +315,13 @@ void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel()
using namespace WTF::Unicode;
ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
- // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
- // Bidi control characters are included into BidiRun, so last direction
- // could be one of the bidi embeddings when there are nested embeddings.
- // For example: "&#x202a;&#x202b;....."
- ASSERT(m_status.last == EuropeanNumberSeparator
- || m_status.last == EuropeanNumberTerminator
- || m_status.last == CommonNumberSeparator
- || m_status.last == BoundaryNeutral
- || m_status.last == BlockSeparator
- || m_status.last == SegmentSeparator
- || m_status.last == WhiteSpaceNeutral
- || m_status.last == OtherNeutral
- || m_status.last == RightToLeftEmbedding
- || m_status.last == LeftToRightEmbedding
- || m_status.last == RightToLeftOverride
- || m_status.last == LeftToRightOverride
- || m_status.last == PopDirectionalFormat);
+ ASSERT(m_status.last != NonSpacingMark
+ && m_status.last != BoundaryNeutral
+ && m_status.last != RightToLeftEmbedding
+ && m_status.last != LeftToRightEmbedding
+ && m_status.last != RightToLeftOverride
+ && m_status.last != LeftToRightOverride
+ && m_status.last != PopDirectionalFormat);
if (m_direction == OtherNeutral)
m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
}
@@ -342,6 +333,7 @@ void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Dire
if (!emptyRun && eor != last) {
checkDirectionInLowerRaiseEmbeddingLevel();
+ // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
if (from == LeftToRight) {
// bidi.sor ... bidi.eor ... bidi.last L
if (m_status.eor == EuropeanNumber) {
@@ -377,6 +369,7 @@ void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Dire
if (!emptyRun && eor != last) {
checkDirectionInLowerRaiseEmbeddingLevel();
+ // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
if (to == LeftToRight) {
// bidi.sor ... bidi.eor ... bidi.last L
if (m_status.eor == EuropeanNumber) {
@@ -866,6 +859,11 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo
break;
case NonSpacingMark:
case BoundaryNeutral:
+ case RightToLeftEmbedding:
+ case LeftToRightEmbedding:
+ case RightToLeftOverride:
+ case LeftToRightOverride:
+ case PopDirectionalFormat:
// ignore these
break;
case EuropeanNumber:
diff --git a/Source/WebCore/platform/text/RegularExpression.h b/Source/WebCore/platform/text/RegularExpression.h
index f1611e5..536ed48 100644
--- a/Source/WebCore/platform/text/RegularExpression.h
+++ b/Source/WebCore/platform/text/RegularExpression.h
@@ -30,7 +30,8 @@
namespace WebCore {
-class RegularExpression : public FastAllocBase {
+class RegularExpression {
+ WTF_MAKE_FAST_ALLOCATED;
public:
RegularExpression(const String&, TextCaseSensitivity);
~RegularExpression();
diff --git a/Source/WebCore/platform/text/SegmentedString.cpp b/Source/WebCore/platform/text/SegmentedString.cpp
index a371582..5e9755b 100644
--- a/Source/WebCore/platform/text/SegmentedString.cpp
+++ b/Source/WebCore/platform/text/SegmentedString.cpp
@@ -246,7 +246,8 @@ void SegmentedString::advanceSlowCase(int& lineNumber)
if (*m_currentString.m_current++ == '\n' && m_currentString.doNotExcludeLineNumbers()) {
++lineNumber;
++m_currentLine;
- m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed();
+ // Plus 1 because numberOfCharactersConsumed value hasn't incremented yet; it does with m_length decrement below.
+ m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
}
if (--m_currentString.m_length == 0)
advanceSubstring();
diff --git a/Source/WebCore/platform/text/SegmentedString.h b/Source/WebCore/platform/text/SegmentedString.h
index 5f548c7..30c899d 100644
--- a/Source/WebCore/platform/text/SegmentedString.h
+++ b/Source/WebCore/platform/text/SegmentedString.h
@@ -164,7 +164,7 @@ public:
lineNumber += newLineFlag;
m_currentLine += newLineFlag;
if (newLineFlag)
- m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed();
+ m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
--m_currentString.m_length;
m_currentChar = ++m_currentString.m_current;
return;
diff --git a/Source/WebCore/platform/text/TextCodec.h b/Source/WebCore/platform/text/TextCodec.h
index c6af38a..35229a3 100644
--- a/Source/WebCore/platform/text/TextCodec.h
+++ b/Source/WebCore/platform/text/TextCodec.h
@@ -57,8 +57,10 @@ namespace WebCore {
typedef char UnencodableReplacementArray[32];
- class TextCodec : public Noncopyable {
+ class TextCodec {
+ WTF_MAKE_NONCOPYABLE(TextCodec); WTF_MAKE_FAST_ALLOCATED;
public:
+ TextCodec() { }
virtual ~TextCodec();
String decode(const char* str, size_t length, bool flush = false)
diff --git a/Source/WebCore/platform/text/transcoder/FontTranscoder.h b/Source/WebCore/platform/text/transcoder/FontTranscoder.h
index 67db977..6990a10 100644
--- a/Source/WebCore/platform/text/transcoder/FontTranscoder.h
+++ b/Source/WebCore/platform/text/transcoder/FontTranscoder.h
@@ -40,7 +40,8 @@ namespace WebCore {
class FontDescription;
class TextEncoding;
-class FontTranscoder : public Noncopyable {
+class FontTranscoder {
+ WTF_MAKE_NONCOPYABLE(FontTranscoder); WTF_MAKE_FAST_ALLOCATED;
public:
void convert(String& text, const FontDescription&, const TextEncoding* = 0) const;
bool needsTranscoding(const FontDescription&, const TextEncoding* = 0) const;
diff --git a/Source/WebCore/platform/win/ClipboardWin.h b/Source/WebCore/platform/win/ClipboardWin.h
index ce64b85..779da26 100644
--- a/Source/WebCore/platform/win/ClipboardWin.h
+++ b/Source/WebCore/platform/win/ClipboardWin.h
@@ -41,6 +41,7 @@ class WCDataObject;
// State available during IE's events for drag and drop and copy/paste
class ClipboardWin : public Clipboard, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<ClipboardWin> create(ClipboardType clipboardType, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame)
{
diff --git a/Source/WebCore/platform/win/PopupMenuWin.cpp b/Source/WebCore/platform/win/PopupMenuWin.cpp
index e86aef9..15871e6 100644
--- a/Source/WebCore/platform/win/PopupMenuWin.cpp
+++ b/Source/WebCore/platform/win/PopupMenuWin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2007-2009 Torch Mobile Inc.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
@@ -40,6 +40,7 @@
#include "Scrollbar.h"
#include "ScrollbarTheme.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include "WebCoreInstanceHandle.h"
#include <tchar.h>
#include <windows.h>
@@ -531,12 +532,12 @@ bool PopupMenuWin::scrollToRevealSelection()
int index = focusedIndex();
if (index < m_scrollOffset) {
- m_scrollbar->setValue(index, Scrollbar::NotFromScrollAnimator);
+ ScrollableArea::scrollToYOffsetWithoutAnimation(index);
return true;
}
if (index >= m_scrollOffset + visibleItems()) {
- m_scrollbar->setValue(index - visibleItems() + 1, Scrollbar::NotFromScrollAnimator);
+ ScrollableArea::scrollToYOffsetWithoutAnimation(index - visibleItems() + 1);
return true;
}
@@ -669,21 +670,23 @@ int PopupMenuWin::scrollSize(ScrollbarOrientation orientation) const
return ((orientation == VerticalScrollbar) && m_scrollbar) ? (m_scrollbar->totalSize() - m_scrollbar->visibleSize()) : 0;
}
-void PopupMenuWin::setScrollOffsetFromAnimation(const IntPoint& offset)
+int PopupMenuWin::scrollPosition(Scrollbar*) const
{
- if (m_scrollbar)
- m_scrollbar->setValue(offset.y(), Scrollbar::FromScrollAnimator);
+ return m_scrollOffset;
+}
+
+void PopupMenuWin::setScrollOffset(const IntPoint& offset)
+{
+ scrollTo(offset.y());
}
-void PopupMenuWin::valueChanged(Scrollbar* scrollBar)
+void PopupMenuWin::scrollTo(int offset)
{
ASSERT(m_scrollbar);
if (!m_popup)
return;
- int offset = scrollBar->value();
-
if (m_scrollOffset == offset)
return;
@@ -990,7 +993,8 @@ LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
else
--i;
}
- scrollbar()->scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i));
+
+ ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i));
break;
}
diff --git a/Source/WebCore/platform/win/PopupMenuWin.h b/Source/WebCore/platform/win/PopupMenuWin.h
index bfec7aa..0d7630c 100644
--- a/Source/WebCore/platform/win/PopupMenuWin.h
+++ b/Source/WebCore/platform/win/PopupMenuWin.h
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* This library is free software; you can redistribute it and/or
@@ -23,8 +24,8 @@
#include "IntRect.h"
#include "PopupMenu.h"
#include "PopupMenuClient.h"
+#include "ScrollableArea.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -38,7 +39,7 @@ namespace WebCore {
class FrameView;
class Scrollbar;
-class PopupMenuWin : public PopupMenu, private ScrollbarClient {
+class PopupMenuWin : public PopupMenu, private ScrollableArea {
public:
PopupMenuWin(PopupMenuClient*);
~PopupMenuWin();
@@ -78,7 +79,6 @@ private:
void setWasClicked(bool b = true) { m_wasClicked = b; }
bool wasClicked() const { return m_wasClicked; }
- void setScrollOffset(int offset) { m_scrollOffset = offset; }
int scrollOffset() const { return m_scrollOffset; }
bool scrollToRevealSelection();
@@ -90,13 +90,17 @@ private:
bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; }
void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; }
- // ScrollBarClient
+ // ScrollableArea
virtual int scrollSize(ScrollbarOrientation orientation) const;
- virtual void setScrollOffsetFromAnimation(const IntPoint&);
- virtual void valueChanged(Scrollbar*);
+ virtual int scrollPosition(Scrollbar*) const;
+ virtual void setScrollOffset(const IntPoint&);
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const { return true; }
virtual bool scrollbarCornerPresent() const { return false; }
+ virtual Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); }
+
+ // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
+ void scrollTo(int offset);
void calculatePositionAndSize(const IntRect&, FrameView*);
void invalidateItem(int index);
@@ -120,6 +124,6 @@ private:
bool m_showPopup;
};
-}
+} // namespace WebCore
#endif // PopupMenuWin_h
diff --git a/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp b/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp
index 4e979f2..343bbb2 100644
--- a/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp
+++ b/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp
@@ -32,8 +32,8 @@
#include "IntRect.h"
#include "Page.h"
#include "PlatformMouseEvent.h"
+#include "ScrollableArea.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
#include "ScrollbarThemeWin.h"
#include "Settings.h"
#include "SoftLinking.h"
@@ -209,7 +209,7 @@ void ScrollbarThemeSafari::paintTrackBackground(GraphicsContext* graphicsContext
return;
NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize;
ThemeControlState state = 0;
- if (scrollbar->client()->isActive())
+ if (scrollbar->scrollableArea()->isActive())
state |= ActiveState;
if (hasButtons(scrollbar))
state |= EnabledState;
@@ -222,7 +222,7 @@ void ScrollbarThemeSafari::paintButton(GraphicsContext* graphicsContext, Scrollb
return;
NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize;
ThemeControlState state = 0;
- if (scrollbar->client()->isActive())
+ if (scrollbar->scrollableArea()->isActive())
state |= ActiveState;
if (hasButtons(scrollbar))
state |= EnabledState;
@@ -242,7 +242,7 @@ void ScrollbarThemeSafari::paintThumb(GraphicsContext* graphicsContext, Scrollba
return;
NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize;
ThemeControlState state = 0;
- if (scrollbar->client()->isActive())
+ if (scrollbar->scrollableArea()->isActive())
state |= ActiveState;
if (hasThumb(scrollbar))
state |= EnabledState;
diff --git a/Source/WebCore/platform/win/WebCoreTextRenderer.cpp b/Source/WebCore/platform/win/WebCoreTextRenderer.cpp
index a32fa4f..e96ba31 100644
--- a/Source/WebCore/platform/win/WebCoreTextRenderer.cpp
+++ b/Source/WebCore/platform/win/WebCoreTextRenderer.cpp
@@ -29,6 +29,7 @@
#include "FontDescription.h"
#include "GraphicsContext.h"
#include "StringTruncator.h"
+#include "TextRun.h"
#include <wtf/unicode/Unicode.h>
namespace WebCore {
diff --git a/Source/WebCore/platform/win/WindowMessageBroadcaster.h b/Source/WebCore/platform/win/WindowMessageBroadcaster.h
index e7856e7..d36c233 100644
--- a/Source/WebCore/platform/win/WindowMessageBroadcaster.h
+++ b/Source/WebCore/platform/win/WindowMessageBroadcaster.h
@@ -31,13 +31,13 @@
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
namespace WebCore {
class WindowMessageListener;
- class WindowMessageBroadcaster : public Noncopyable {
+ class WindowMessageBroadcaster {
+ WTF_MAKE_NONCOPYABLE(WindowMessageBroadcaster);
public:
static void addListener(HWND, WindowMessageListener*);
static void removeListener(HWND, WindowMessageListener*);
diff --git a/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp b/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp
index 82e4a15..957f958 100644
--- a/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp
+++ b/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp
@@ -29,8 +29,8 @@
#include "HostWindow.h"
#include "NotImplemented.h"
#include "PlatformMouseEvent.h"
+#include "ScrollableArea.h"
#include "Scrollbar.h"
-#include "ScrollbarClient.h"
#include "scrollbar_render.h"
#include "ScrollbarThemeComposite.h"
#include "ScrollView.h"
@@ -185,7 +185,7 @@ bool ScrollbarThemeWx::paint(Scrollbar* scrollbar, GraphicsContext* context, con
{
wxOrientation orientation = (scrollbar->orientation() == HorizontalScrollbar) ? wxHORIZONTAL : wxVERTICAL;
int flags = 0;
- if (scrollbar->client()->isActive())
+ if (scrollbar->scrollableArea()->isActive())
flags |= wxCONTROL_FOCUSED;
if (!scrollbar->enabled())