summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-13 05:20:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-13 05:20:16 -0700
commitf4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch)
tree14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/platform
parentd074a7997da8ce379434eb6e208b97cde8a0841c (diff)
parentf964bc1fd59a545a80a0cc2529ad8830be514871 (diff)
downloadexternal_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip
external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz
external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes: Merge WebKit at r65072 : Update WebKit revision number. Merge WebKit at r65072 : Update test_expectations. Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient Merge WebKit at r65072 : Implement DeviceMotionClientAndroid Merge WebKit at r65072: JSC build fix in InspectorController.h Merge WebKit at r65072: Fix V8 code generator. Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock. Merge WebKit at r65072: String class has moved to the WTF namespace. Merge Webkit at r65072 : Fix conflicts. Merge Webkit at r65072 : Fix Makefiles. Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/BlobItem.cpp16
-rw-r--r--WebCore/platform/BlobItem.h16
-rw-r--r--WebCore/platform/CookieJar.h2
-rw-r--r--WebCore/platform/CrossThreadCopier.h2
-rw-r--r--WebCore/platform/Cursor.h6
-rw-r--r--WebCore/platform/DragImage.h4
-rw-r--r--WebCore/platform/FileSystem.h10
-rw-r--r--WebCore/platform/KURLHash.h2
-rw-r--r--WebCore/platform/Language.h4
-rw-r--r--WebCore/platform/Length.h3
-rw-r--r--WebCore/platform/LinkHash.h2
-rw-r--r--WebCore/platform/LocalizationStrategy.h9
-rw-r--r--WebCore/platform/LocalizedStrings.cpp (renamed from WebCore/platform/mac/LocalizedStringsMac.mm)42
-rw-r--r--WebCore/platform/LocalizedStrings.h10
-rw-r--r--WebCore/platform/Logging.h3
-rw-r--r--WebCore/platform/Pasteboard.h6
-rw-r--r--WebCore/platform/PopupMenuClient.h2
-rw-r--r--WebCore/platform/SearchPopupMenu.h3
-rw-r--r--WebCore/platform/Widget.h4
-rw-r--r--WebCore/platform/WindowsKeyboardCodes.h30
-rw-r--r--WebCore/platform/android/TemporaryLinkStubs.cpp2
-rw-r--r--WebCore/platform/cf/BinaryPropertyList.h3
-rw-r--r--WebCore/platform/chromium/ChromiumBridge.h3
-rw-r--r--WebCore/platform/chromium/ClipboardUtilitiesChromium.h3
-rw-r--r--WebCore/platform/chromium/WidgetChromium.cpp2
-rw-r--r--WebCore/platform/cocoa/KeyEventCocoa.h4
-rw-r--r--WebCore/platform/cocoa/KeyEventCocoa.mm2
-rw-r--r--WebCore/platform/efl/ClipboardEfl.cpp2
-rw-r--r--WebCore/platform/efl/ClipboardEfl.h2
-rw-r--r--WebCore/platform/efl/RenderThemeEfl.cpp64
-rw-r--r--WebCore/platform/efl/RenderThemeEfl.h7
-rw-r--r--WebCore/platform/graphics/Color.h2
-rw-r--r--WebCore/platform/graphics/FontCache.h2
-rw-r--r--WebCore/platform/graphics/FontData.h2
-rw-r--r--WebCore/platform/graphics/FontSelector.h2
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h11
-rw-r--r--WebCore/platform/graphics/GraphicsContext3D.h1464
-rw-r--r--WebCore/platform/graphics/GraphicsLayer.cpp2
-rw-r--r--WebCore/platform/graphics/GraphicsLayer.h4
-rw-r--r--WebCore/platform/graphics/GraphicsTypes.h4
-rw-r--r--WebCore/platform/graphics/Icon.h1
-rw-r--r--WebCore/platform/graphics/Image.h4
-rw-r--r--WebCore/platform/graphics/ImageBuffer.h2
-rw-r--r--WebCore/platform/graphics/ImageSource.h15
-rw-r--r--WebCore/platform/graphics/MediaPlayer.cpp5
-rw-r--r--WebCore/platform/graphics/MediaPlayer.h3
-rw-r--r--WebCore/platform/graphics/MediaPlayerPrivate.h4
-rw-r--r--WebCore/platform/graphics/Path.h2
-rw-r--r--WebCore/platform/graphics/SimpleFontData.cpp88
-rw-r--r--WebCore/platform/graphics/SimpleFontData.h12
-rw-r--r--WebCore/platform/graphics/StringTruncator.h3
-rw-r--r--WebCore/platform/graphics/WOFFFileFormat.cpp7
-rw-r--r--WebCore/platform/graphics/android/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/cairo/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/cairo/FontPlatformData.h3
-rw-r--r--WebCore/platform/graphics/cg/ColorCG.cpp1
-rw-r--r--WebCore/platform/graphics/cg/FontPlatformData.h2
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp30
-rw-r--r--WebCore/platform/graphics/cg/ImageSourceCG.h3
-rw-r--r--WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp (renamed from WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp)18
-rw-r--r--WebCore/platform/graphics/chromium/CanvasLayerChromium.h (renamed from WebCore/platform/graphics/chromium/WebGLLayerChromium.h)19
-rw-r--r--WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp2
-rw-r--r--WebCore/platform/graphics/chromium/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/chromium/FontPlatformDataChromiumMac.mm11
-rw-r--r--WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h2
-rw-r--r--WebCore/platform/graphics/chromium/FontPlatformDataLinux.h2
-rw-r--r--WebCore/platform/graphics/chromium/GLES2Canvas.cpp281
-rw-r--r--WebCore/platform/graphics/chromium/GLES2Canvas.h10
-rw-r--r--WebCore/platform/graphics/chromium/GLES2Texture.cpp58
-rw-r--r--WebCore/platform/graphics/chromium/GLES2Texture.h8
-rw-r--r--WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp26
-rw-r--r--WebCore/platform/graphics/chromium/GraphicsLayerChromium.h5
-rw-r--r--WebCore/platform/graphics/chromium/ImageLayerChromium.cpp44
-rw-r--r--WebCore/platform/graphics/chromium/LayerChromium.cpp64
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.cpp117
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.h12
-rw-r--r--WebCore/platform/graphics/chromium/VideoLayerChromium.cpp143
-rw-r--r--WebCore/platform/graphics/chromium/VideoLayerChromium.h12
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h2
-rw-r--r--WebCore/platform/graphics/haiku/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextController.h2
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp30
-rw-r--r--WebCore/platform/graphics/mac/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/mac/FontMac.mm2
-rw-r--r--WebCore/platform/graphics/mac/FontPlatformData.h14
-rw-r--r--WebCore/platform/graphics/mac/FontPlatformDataMac.mm20
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.mm168
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.h19
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.mm26
-rw-r--r--WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h6
-rw-r--r--WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm30
-rw-r--r--WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp13
-rw-r--r--WebCore/platform/graphics/qt/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/qt/FontPlatformData.h2
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp159
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp10
-rw-r--r--WebCore/platform/graphics/qt/ImageBufferQt.cpp2
-rw-r--r--WebCore/platform/graphics/qt/PathQt.cpp6
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp21
-rw-r--r--WebCore/platform/graphics/skia/ImageBufferSkia.cpp2
-rw-r--r--WebCore/platform/graphics/skia/ImageSkia.cpp1
-rw-r--r--WebCore/platform/graphics/skia/NativeImageSkia.cpp8
-rw-r--r--WebCore/platform/graphics/skia/NativeImageSkia.h5
-rw-r--r--WebCore/platform/graphics/skia/PlatformContextSkia.cpp125
-rw-r--r--WebCore/platform/graphics/skia/PlatformContextSkia.h40
-rw-r--r--WebCore/platform/graphics/skia/SkiaFontWin.cpp4
-rw-r--r--WebCore/platform/graphics/skia/SkiaFontWin.h5
-rw-r--r--WebCore/platform/graphics/win/FontCustomPlatformData.h2
-rw-r--r--WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h2
-rw-r--r--WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h2
-rw-r--r--WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h2
-rw-r--r--WebCore/platform/graphics/wince/FontPlatformData.h2
-rw-r--r--WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h2
-rw-r--r--WebCore/platform/graphics/wince/MediaPlayerProxy.h2
-rw-r--r--WebCore/platform/graphics/wx/FontCustomPlatformData.cpp (renamed from WebCore/platform/qt/SearchPopupMenuQt.cpp)28
-rw-r--r--WebCore/platform/graphics/wx/FontCustomPlatformData.h (renamed from WebCore/platform/qt/SearchPopupMenuQt.h)35
-rw-r--r--WebCore/platform/graphics/wx/FontPlatformData.h4
-rw-r--r--WebCore/platform/gtk/ClipboardGtk.cpp60
-rw-r--r--WebCore/platform/gtk/ClipboardGtk.h9
-rw-r--r--WebCore/platform/gtk/CursorGtk.cpp431
-rw-r--r--WebCore/platform/gtk/KeyEventGtk.cpp1
-rw-r--r--WebCore/platform/gtk/WidgetGtk.cpp2
-rw-r--r--WebCore/platform/image-decoders/ImageDecoder.cpp21
-rw-r--r--WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp3
-rw-r--r--WebCore/platform/iphone/KeyEventIPhone.mm4
-rw-r--r--WebCore/platform/mac/PasteboardHelper.h1
-rw-r--r--WebCore/platform/network/Credential.h2
-rw-r--r--WebCore/platform/network/DNS.h4
-rw-r--r--WebCore/platform/network/FormData.cpp12
-rw-r--r--WebCore/platform/network/FormData.h13
-rw-r--r--WebCore/platform/network/FormDataBuilder.h16
-rw-r--r--WebCore/platform/network/HTTPParsers.h3
-rw-r--r--WebCore/platform/network/mac/FormDataStreamMac.mm16
-rw-r--r--WebCore/platform/network/qt/NetworkStateNotifierPrivate.h4
-rw-r--r--WebCore/platform/network/qt/NetworkStateNotifierQt.cpp2
-rw-r--r--WebCore/platform/network/qt/QNetworkReplyHandler.cpp14
-rw-r--r--WebCore/platform/qt/FileSystemQt.cpp2
-rw-r--r--WebCore/platform/qt/PopupMenuQt.cpp88
-rw-r--r--WebCore/platform/qt/PopupMenuQt.h49
-rw-r--r--WebCore/platform/qt/QWebPageClient.h2
-rw-r--r--WebCore/platform/qt/QtAbstractWebPopup.cpp82
-rw-r--r--WebCore/platform/qt/QtAbstractWebPopup.h75
-rw-r--r--WebCore/platform/qt/RenderThemeQt.cpp2
-rw-r--r--WebCore/platform/text/AtomicStringHash.h6
-rw-r--r--WebCore/platform/text/AtomicStringKeyedMRUCache.h71
-rw-r--r--WebCore/platform/text/Hyphenation.cpp9
-rw-r--r--WebCore/platform/text/Hyphenation.h4
-rw-r--r--WebCore/platform/text/LineEnding.h2
-rw-r--r--WebCore/platform/text/SegmentedString.h4
-rw-r--r--WebCore/platform/text/StringBuffer.h52
-rw-r--r--WebCore/platform/text/StringBuilder.cpp39
-rw-r--r--WebCore/platform/text/StringBuilder.h41
-rw-r--r--WebCore/platform/text/TextCodec.h3
-rw-r--r--WebCore/platform/text/TextCodecICU.cpp59
-rw-r--r--WebCore/platform/text/TextCodecLatin1.cpp1
-rw-r--r--WebCore/platform/text/TextEncoding.cpp2
-rw-r--r--WebCore/platform/text/TextEncoding.h10
-rw-r--r--WebCore/platform/text/TextEncodingRegistry.cpp57
-rw-r--r--WebCore/platform/text/TextStream.h3
-rw-r--r--WebCore/platform/text/android/HyphenationAndroid.cpp8
-rw-r--r--WebCore/platform/text/cf/HyphenationCF.cpp31
-rw-r--r--WebCore/platform/text/cf/StringCF.cpp2
-rw-r--r--WebCore/platform/text/cf/StringImplCF.cpp4
-rw-r--r--WebCore/platform/text/haiku/StringHaiku.cpp2
-rw-r--r--WebCore/platform/text/mac/HyphenationMac.mm30
-rw-r--r--WebCore/platform/text/mac/StringImplMac.mm2
-rw-r--r--WebCore/platform/text/mac/StringMac.mm2
-rw-r--r--WebCore/platform/text/wx/StringWx.cpp2
-rw-r--r--WebCore/platform/win/BString.h4
-rw-r--r--WebCore/platform/win/ClipboardUtilitiesWin.h2
-rw-r--r--WebCore/platform/win/SearchPopupMenuWin.cpp13
-rw-r--r--WebCore/platform/win/WCDataObject.h3
-rw-r--r--WebCore/platform/win/WebCoreTextRenderer.h3
-rw-r--r--WebCore/platform/wx/ClipboardWx.cpp2
-rw-r--r--WebCore/platform/wx/ClipboardWx.h2
175 files changed, 2613 insertions, 2377 deletions
diff --git a/WebCore/platform/BlobItem.cpp b/WebCore/platform/BlobItem.cpp
index cc5e6c7..591516d 100644
--- a/WebCore/platform/BlobItem.cpp
+++ b/WebCore/platform/BlobItem.cpp
@@ -37,7 +37,7 @@
namespace WebCore {
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
static const double invalidModificationTime = 0;
static double getFileSnapshotModificationTime(const String& path)
@@ -48,11 +48,11 @@ static double getFileSnapshotModificationTime(const String& path)
return static_cast<double>(modificationTime);
return invalidModificationTime;
}
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
// DataBlobItem ----------------------------------------------------------------
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
PassRefPtr<BlobItem> DataBlobItem::slice(long long start, long long length)
{
ASSERT(start >= 0 && length >= 0);
@@ -63,7 +63,7 @@ PassRefPtr<BlobItem> DataBlobItem::slice(long long start, long long length)
length = size() - start;
return DataRangeBlobItem::create(this, start, length);
}
-#endif // ENABLE(BLOB_SLICE)
+#endif
// FileBlobItem ----------------------------------------------------------------
@@ -101,7 +101,7 @@ unsigned long long FileBlobItem::size() const
return static_cast<unsigned long long>(size);
}
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
PassRefPtr<BlobItem> FileBlobItem::slice(long long start, long long length)
{
ASSERT(start >= 0 && length >= 0);
@@ -115,7 +115,7 @@ PassRefPtr<BlobItem> FileBlobItem::slice(long long start, long long length)
double modificationTime = fileRangeItem ? fileRangeItem->snapshotModificationTime() : getFileSnapshotModificationTime(path());
return FileRangeBlobItem::create(path(), start, length, modificationTime);
}
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
// StringBlobItem --------------------------------------------------------------
@@ -141,7 +141,7 @@ ByteArrayBlobItem::ByteArrayBlobItem(const char* data, size_t size)
m_bytesArray.append(data, size);
}
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
// DataRangeBlobItem -----------------------------------------------------------
@@ -187,6 +187,6 @@ FileRangeBlobItem::FileRangeBlobItem(const String& path, long long start, long l
m_uniqueName.replace("-", ""); // For safty, remove '-' from the filename snce some servers may not like it.
}
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
} // namespace WebCore
diff --git a/WebCore/platform/BlobItem.h b/WebCore/platform/BlobItem.h
index 3741f3f..42ece92 100644
--- a/WebCore/platform/BlobItem.h
+++ b/WebCore/platform/BlobItem.h
@@ -70,13 +70,13 @@ public:
virtual const StringBlobItem* toStringBlobItem() const { return 0; }
virtual const ByteArrayBlobItem* toByteArrayBlobItem() const { return 0; }
virtual const FileBlobItem* toFileBlobItem() const { return 0; }
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
virtual const DataRangeBlobItem* toDataRangeBlobItem() const { return 0; }
virtual const FileRangeBlobItem* toFileRangeBlobItem() const { return 0; }
// Note: no external methods except for Blob::slice should call this.
virtual PassRefPtr<BlobItem> slice(long long start, long long length) = 0;
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
protected:
BlobItem() { }
@@ -90,9 +90,9 @@ public:
// BlobItem methods.
virtual const DataBlobItem* toDataBlobItem() const { return this; }
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
virtual PassRefPtr<BlobItem> slice(long long start, long long length);
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
};
class FileBlobItem : public BlobItem {
@@ -110,9 +110,9 @@ public:
// BlobItem methods.
virtual unsigned long long size() const;
virtual const FileBlobItem* toFileBlobItem() const { return this; }
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
virtual PassRefPtr<BlobItem> slice(long long start, long long length);
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
protected:
FileBlobItem(const String& path);
@@ -159,7 +159,7 @@ private:
Vector<char> m_bytesArray;
};
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
// BlobItem class for sliced data (string or bytes-array).
class DataRangeBlobItem : public DataBlobItem {
@@ -202,7 +202,7 @@ private:
double m_snapshotModificationTime;
};
-#endif // ENABLE(BLOB_SLICE)
+#endif // ENABLE(BLOB)
} // namespace WebCore
diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h
index fb1abee..4793708 100644
--- a/WebCore/platform/CookieJar.h
+++ b/WebCore/platform/CookieJar.h
@@ -26,13 +26,13 @@
#ifndef CookieJar_h
#define CookieJar_h
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
namespace WebCore {
class Document;
class KURL;
- class String;
struct Cookie;
diff --git a/WebCore/platform/CrossThreadCopier.h b/WebCore/platform/CrossThreadCopier.h
index 80805c4..6f7bb25 100644
--- a/WebCore/platform/CrossThreadCopier.h
+++ b/WebCore/platform/CrossThreadCopier.h
@@ -31,6 +31,7 @@
#ifndef CrossThreadCopier_h
#define CrossThreadCopier_h
+#include <wtf/Forward.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -43,7 +44,6 @@ namespace WebCore {
class ResourceError;
class ResourceRequest;
class ResourceResponse;
- class String;
struct CrossThreadResourceResponseData;
struct CrossThreadResourceRequestData;
struct ThreadableLoaderOptions;
diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h
index 98d69b9..5e547ef 100644
--- a/WebCore/platform/Cursor.h
+++ b/WebCore/platform/Cursor.h
@@ -36,7 +36,7 @@ typedef HICON HCURSOR;
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#elif PLATFORM(GTK)
-typedef struct _GdkCursor GdkCursor;
+#include "GRefPtrGtk.h"
#elif PLATFORM(QT)
#include <QCursor>
#elif PLATFORM(CHROMIUM)
@@ -62,7 +62,7 @@ typedef struct HICON__ *HICON;
typedef HICON HCURSOR;
#endif
-#if PLATFORM(WIN) || PLATFORM(MAC)
+#if PLATFORM(WIN) || PLATFORM(MAC) || PLATFORM(GTK)
#define WTF_USE_LAZY_NATIVE_CURSOR 1
#endif
@@ -84,7 +84,7 @@ namespace WebCore {
#elif PLATFORM(MAC)
typedef NSCursor* PlatformCursor;
#elif PLATFORM(GTK)
- typedef GdkCursor* PlatformCursor;
+ typedef GRefPtr<GdkCursor> PlatformCursor;
#elif PLATFORM(EFL)
typedef const char* PlatformCursor;
#elif PLATFORM(QT) && !defined(QT_NO_CURSOR)
diff --git a/WebCore/platform/DragImage.h b/WebCore/platform/DragImage.h
index d7d53b2..e825798 100644
--- a/WebCore/platform/DragImage.h
+++ b/WebCore/platform/DragImage.h
@@ -28,6 +28,7 @@
#include "IntSize.h"
#include "FloatSize.h"
+#include <wtf/Forward.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
@@ -64,8 +65,7 @@ namespace WebCore {
class Image;
class KURL;
class Range;
- class String;
-
+
#if PLATFORM(MAC)
typedef RetainPtr<NSImage> DragImageRef;
#elif PLATFORM(QT)
diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h
index 42aaaef..617470b 100644
--- a/WebCore/platform/FileSystem.h
+++ b/WebCore/platform/FileSystem.h
@@ -47,6 +47,7 @@
#include "PlatformString.h"
#include <time.h>
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
typedef const struct __CFData* CFDataRef;
@@ -63,11 +64,6 @@ typedef HINSTANCE HMODULE;
typedef struct _IFile IFile;
#endif
-namespace WTF {
-class CString;
-}
-using WTF::CString;
-
namespace WebCore {
// PlatformModule
@@ -155,12 +151,12 @@ String directoryName(const String&);
Vector<String> listDirectory(const String& path, const String& filter = String());
-WTF::CString fileSystemRepresentation(const String&);
+CString fileSystemRepresentation(const String&);
inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; }
// Prefix is what the filename should be prefixed with, not the full path.
-WTF::CString openTemporaryFile(const char* prefix, PlatformFileHandle&);
+CString openTemporaryFile(const char* prefix, PlatformFileHandle&);
PlatformFileHandle openFile(const String& path, FileOpenMode);
void closeFile(PlatformFileHandle&);
// Returns the resulting offset from the beginning of the file if successful, -1 otherwise.
diff --git a/WebCore/platform/KURLHash.h b/WebCore/platform/KURLHash.h
index 7448a49..283170b 100644
--- a/WebCore/platform/KURLHash.h
+++ b/WebCore/platform/KURLHash.h
@@ -52,7 +52,7 @@ namespace WTF {
template<> struct HashTraits<WebCore::KURL> : GenericHashTraits<WebCore::KURL> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(WebCore::KURL& slot) { new (&slot) WebCore::KURL(WebCore::ParsedURLString, WebCore::String(HashTableDeletedValue)); }
+ static void constructDeletedValue(WebCore::KURL& slot) { new (&slot) WebCore::KURL(WebCore::ParsedURLString, WTF::String(HashTableDeletedValue)); }
static bool isDeletedValue(const WebCore::KURL& slot) { return slot.string().isHashTableDeletedValue(); }
};
diff --git a/WebCore/platform/Language.h b/WebCore/platform/Language.h
index 1d59c21..4c92755 100644
--- a/WebCore/platform/Language.h
+++ b/WebCore/platform/Language.h
@@ -26,9 +26,9 @@
#ifndef Language_h
#define Language_h
-namespace WebCore {
+#include <wtf/Forward.h>
- class String;
+namespace WebCore {
String defaultLanguage();
diff --git a/WebCore/platform/Length.h b/WebCore/platform/Length.h
index 4f36577..a3b1eda 100644
--- a/WebCore/platform/Length.h
+++ b/WebCore/platform/Length.h
@@ -23,12 +23,11 @@
#include <wtf/Assertions.h>
#include <wtf/FastAllocBase.h>
+#include <wtf/Forward.h>
#include <wtf/MathExtras.h>
namespace WebCore {
-class String;
-
const int undefinedLength = -1;
const int percentScaleFactor = 128;
diff --git a/WebCore/platform/LinkHash.h b/WebCore/platform/LinkHash.h
index 2756654..a499a8e 100644
--- a/WebCore/platform/LinkHash.h
+++ b/WebCore/platform/LinkHash.h
@@ -27,10 +27,10 @@
#define LinkHash_h
#include "StringHash.h"
+#include <wtf/Forward.h>
namespace WebCore {
-class AtomicString;
class KURL;
typedef uint64_t LinkHash;
diff --git a/WebCore/platform/LocalizationStrategy.h b/WebCore/platform/LocalizationStrategy.h
index 9bde316..178cfa2 100644
--- a/WebCore/platform/LocalizationStrategy.h
+++ b/WebCore/platform/LocalizationStrategy.h
@@ -28,9 +28,10 @@
#if USE(PLATFORM_STRATEGIES)
+#include <wtf/Forward.h>
+
namespace WebCore {
-class String;
class IntSize;
class LocalizationStrategy {
@@ -41,7 +42,10 @@ public:
virtual String submitButtonDefaultLabel() = 0;
virtual String fileButtonChooseFileLabel() = 0;
virtual String fileButtonNoFileSelectedLabel() = 0;
+
+#if PLATFORM(MAC)
virtual String copyImageUnknownFileLabel() = 0;
+#endif
#if ENABLE(CONTEXT_MENUS)
virtual String contextMenuItemTagOpenLinkInNewWindow() = 0;
@@ -122,7 +126,10 @@ public:
virtual String AXHeadingText() = 0;
virtual String AXDefinitionListTermText() = 0;
virtual String AXDefinitionListDefinitionText() = 0;
+
+#if PLATFORM(MAC)
virtual String AXARIAContentGroupText(const String& ariaType) = 0;
+#endif
virtual String AXButtonActionVerb() = 0;
virtual String AXRadioButtonActionVerb() = 0;
diff --git a/WebCore/platform/mac/LocalizedStringsMac.mm b/WebCore/platform/LocalizedStrings.cpp
index 8b7df04..a69e0fb 100644
--- a/WebCore/platform/mac/LocalizedStringsMac.mm
+++ b/WebCore/platform/LocalizedStrings.cpp
@@ -23,16 +23,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "config.h"
-#import "LocalizedStrings.h"
+#include "config.h"
+#include "LocalizedStrings.h"
-#import "IntSize.h"
-#import "LocalizationStrategy.h"
-#import "PlatformStrategies.h"
-#import "PlatformString.h"
+#include "IntSize.h"
+#include "LocalizationStrategy.h"
+#include "PlatformStrategies.h"
+#include "PlatformString.h"
namespace WebCore {
+#if USE(PLATFORM_STRATEGIES)
+
String inputElementAltText()
{
return platformStrategies()->localizationStrategy()->inputElementAltText();
@@ -63,10 +65,12 @@ String fileButtonNoFileSelectedLabel()
return platformStrategies()->localizationStrategy()->fileButtonNoFileSelectedLabel();
}
+#if PLATFORM(MAC)
String copyImageUnknownFileLabel()
{
return platformStrategies()->localizationStrategy()->copyImageUnknownFileLabel();
}
+#endif
#if ENABLE(CONTEXT_MENUS)
String contextMenuItemTagOpenLinkInNewWindow()
@@ -154,10 +158,12 @@ String contextMenuItemTagLearnSpelling()
return platformStrategies()->localizationStrategy()->contextMenuItemTagLearnSpelling();
}
+#if PLATFORM(MAC)
String contextMenuItemTagSearchInSpotlight()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagSearchInSpotlight();
}
+#endif
String contextMenuItemTagSearchWeb()
{
@@ -209,10 +215,12 @@ String contextMenuItemTagFontMenu()
return platformStrategies()->localizationStrategy()->contextMenuItemTagFontMenu();
}
+#if PLATFORM(MAC)
String contextMenuItemTagShowFonts()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagShowFonts();
}
+#endif
String contextMenuItemTagBold()
{
@@ -234,6 +242,7 @@ String contextMenuItemTagOutline()
return platformStrategies()->localizationStrategy()->contextMenuItemTagOutline();
}
+#if PLATFORM(MAC)
String contextMenuItemTagStyles()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagStyles();
@@ -258,6 +267,7 @@ String contextMenuItemTagStopSpeaking()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagStopSpeaking();
}
+#endif
String contextMenuItemTagWritingDirectionMenu()
{
@@ -284,6 +294,8 @@ String contextMenuItemTagRightToLeft()
return platformStrategies()->localizationStrategy()->contextMenuItemTagRightToLeft();
}
+#if PLATFORM(MAC)
+
String contextMenuItemTagCorrectSpellingAutomatically()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagCorrectSpellingAutomatically();
@@ -348,6 +360,8 @@ String contextMenuItemTagChangeBack(const String& replacedString)
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagChangeBack(replacedString);
}
+
+#endif // PLATFORM(MAC)
String contextMenuItemTagInspectElement()
{
@@ -406,10 +420,12 @@ String AXDefinitionListDefinitionText()
return platformStrategies()->localizationStrategy()->AXDefinitionListDefinitionText();
}
+#if PLATFORM(MAC)
String AXARIAContentGroupText(const String& ariaType)
{
return platformStrategies()->localizationStrategy()->AXARIAContentGroupText(ariaType);
}
+#endif
String AXButtonActionVerb()
{
@@ -471,6 +487,18 @@ String unknownFileSizeText()
return platformStrategies()->localizationStrategy()->unknownFileSizeText();
}
+#if PLATFORM(WIN)
+String uploadFileText()
+{
+ return platformStrategies()->localizationStrategy()->uploadFileText();
+}
+
+String allFilesText()
+{
+ return platformStrategies()->localizationStrategy()->allFilesText();
+}
+#endif
+
String imageTitle(const String& filename, const IntSize& size)
{
return platformStrategies()->localizationStrategy()->imageTitle(filename, size);
@@ -536,4 +564,6 @@ String validationMessageStepMismatchText()
return platformStrategies()->localizationStrategy()->validationMessageStepMismatchText();
}
+#endif // USE(PLATFORM_STRATEGIES)
+
} // namespace WebCore
diff --git a/WebCore/platform/LocalizedStrings.h b/WebCore/platform/LocalizedStrings.h
index 56d44b3..04042b6 100644
--- a/WebCore/platform/LocalizedStrings.h
+++ b/WebCore/platform/LocalizedStrings.h
@@ -26,9 +26,10 @@
#ifndef LocalizedStrings_h
#define LocalizedStrings_h
+#include <wtf/Forward.h>
+
namespace WebCore {
- class String;
class IntSize;
String inputElementAltText();
@@ -37,7 +38,11 @@ namespace WebCore {
String submitButtonDefaultLabel();
String fileButtonChooseFileLabel();
String fileButtonNoFileSelectedLabel();
+
+#if PLATFORM(MAC)
String copyImageUnknownFileLabel();
+#endif
+
#if ENABLE(CONTEXT_MENUS)
String contextMenuItemTagOpenLinkInNewWindow();
String contextMenuItemTagDownloadLinkToDisk();
@@ -117,7 +122,10 @@ namespace WebCore {
String AXHeadingText();
String AXDefinitionListTermText();
String AXDefinitionListDefinitionText();
+
+#if PLATFORM(MAC)
String AXARIAContentGroupText(const String& ariaType);
+#endif
String AXButtonActionVerb();
String AXRadioButtonActionVerb();
diff --git a/WebCore/platform/Logging.h b/WebCore/platform/Logging.h
index 45b6d23..df3c6fd 100644
--- a/WebCore/platform/Logging.h
+++ b/WebCore/platform/Logging.h
@@ -27,6 +27,7 @@
#define Logging_h
#include <wtf/Assertions.h>
+#include <wtf/Forward.h>
#ifndef LOG_CHANNEL_PREFIX
#define LOG_CHANNEL_PREFIX Log
@@ -34,8 +35,6 @@
namespace WebCore {
- class String;
-
extern WTFLogChannel LogNotYetImplemented;
extern WTFLogChannel LogFrames;
extern WTFLogChannel LogLoading;
diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h
index 7ee8e81..7773624 100644
--- a/WebCore/platform/Pasteboard.h
+++ b/WebCore/platform/Pasteboard.h
@@ -63,11 +63,6 @@ typedef struct HWND__* HWND;
#include "PasteboardPrivate.h"
#endif
-namespace WTF {
-class CString;
-}
-using WTF::CString;
-
namespace WebCore {
#if PLATFORM(MAC)
@@ -84,7 +79,6 @@ class HitTestResult;
class KURL;
class Node;
class Range;
-class String;
class Pasteboard : public Noncopyable {
public:
diff --git a/WebCore/platform/PopupMenuClient.h b/WebCore/platform/PopupMenuClient.h
index 976f28c..2b41380 100644
--- a/WebCore/platform/PopupMenuClient.h
+++ b/WebCore/platform/PopupMenuClient.h
@@ -24,6 +24,7 @@
#include "PopupMenuStyle.h"
#include "ScrollTypes.h"
+#include <wtf/Forward.h>
namespace WebCore {
@@ -32,7 +33,6 @@ class FontSelector;
class HostWindow;
class Scrollbar;
class ScrollbarClient;
-class String;
class PopupMenuClient {
public:
diff --git a/WebCore/platform/SearchPopupMenu.h b/WebCore/platform/SearchPopupMenu.h
index d1ecd0f..f199fab 100644
--- a/WebCore/platform/SearchPopupMenu.h
+++ b/WebCore/platform/SearchPopupMenu.h
@@ -22,13 +22,12 @@
#define SearchPopupMenu_h
#include "PopupMenu.h"
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
-class AtomicString;
-
class SearchPopupMenu : public RefCounted<SearchPopupMenu> {
public:
virtual ~SearchPopupMenu() {}
diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h
index 6303c6a..58d4e57 100644
--- a/WebCore/platform/Widget.h
+++ b/WebCore/platform/Widget.h
@@ -99,6 +99,7 @@ typedef PlatformWidget PlatformPageClient;
#include "IntRect.h"
#include "IntSize.h"
+#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -110,9 +111,6 @@ class GraphicsContext;
class PlatformMouseEvent;
class ScrollView;
class WidgetPrivate;
-#if PLATFORM(EFL)
-class String;
-#endif
// The Widget class serves as a base class for three kinds of objects:
// (1) Scrollable areas (ScrollView)
diff --git a/WebCore/platform/WindowsKeyboardCodes.h b/WebCore/platform/WindowsKeyboardCodes.h
index 86c77ea..2d287c2 100644
--- a/WebCore/platform/WindowsKeyboardCodes.h
+++ b/WebCore/platform/WindowsKeyboardCodes.h
@@ -27,6 +27,36 @@
#define VK_UNKNOWN 0
+// Undef macros which are also defined in MinGW/include/winuser.h to aviod gcc redefinition warning
+// https://bugs.webkit.org/show_bug.cgi?id=43360
+#if COMPILER(MINGW)
+#undef VK_BACK
+#undef VK_TAB
+#undef VK_CLEAR
+#undef VK_RETURN
+#undef VK_SHIFT
+#undef VK_CONTROL
+#undef VK_MENU
+#undef VK_PAUSE
+#undef VK_CAPITAL
+#undef VK_SPACE
+#undef VK_PRIOR
+#undef VK_NEXT
+#undef VK_END
+#undef VK_HOME
+#undef VK_LEFT
+#undef VK_UP
+#undef VK_RIGHT
+#undef VK_DOWN
+#undef VK_SELECT
+#undef VK_PRINT
+#undef VK_EXECUTE
+#undef VK_SNAPSHOT
+#undef VK_INSERT
+#undef VK_DELETE
+#undef VK_HELP
+#endif // COMPILER(MINGW)
+
// Left mouse button
// Right mouse button
// Control-break processing
diff --git a/WebCore/platform/android/TemporaryLinkStubs.cpp b/WebCore/platform/android/TemporaryLinkStubs.cpp
index 911d849..bedb91b 100644
--- a/WebCore/platform/android/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/android/TemporaryLinkStubs.cpp
@@ -311,7 +311,7 @@ void* WebCore::Frame::dragImageForSelection()
return 0;
}
-void WebCore::Pasteboard::writeImage(WebCore::Node*, WebCore::KURL const&, WebCore::String const&) {}
+void WebCore::Pasteboard::writeImage(WebCore::Node*, WebCore::KURL const&, WTF::String const&) {}
namespace WebCore {
diff --git a/WebCore/platform/cf/BinaryPropertyList.h b/WebCore/platform/cf/BinaryPropertyList.h
index a930b43..8cbb2e1 100644
--- a/WebCore/platform/cf/BinaryPropertyList.h
+++ b/WebCore/platform/cf/BinaryPropertyList.h
@@ -28,12 +28,11 @@
#include <CoreFoundation/CoreFoundation.h>
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
namespace WebCore {
-class String;
-
// Writes a limited subset of binary property lists.
// Covers only what's needed for writing browser history as of this writing.
class BinaryPropertyListObjectStream {
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index acfefe1..fc1345e 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -38,6 +38,7 @@
#include "PasteboardPrivate.h"
#include "PluginData.h"
+#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
@@ -73,7 +74,6 @@ namespace WebCore {
class IDBFactoryBackendInterface;
class IntRect;
class KURL;
- class String;
class Widget;
struct Cookie;
@@ -260,7 +260,6 @@ namespace WebCore {
// Widget -------------------------------------------------------------
static void widgetSetCursor(Widget*, const Cursor&);
- static void widgetSetFocus(Widget*);
};
} // namespace WebCore
diff --git a/WebCore/platform/chromium/ClipboardUtilitiesChromium.h b/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
index 7514280..9fdad42 100644
--- a/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
+++ b/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
@@ -28,10 +28,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <wtf/Forward.h>
+
namespace WebCore {
class KURL;
-class String;
#if OS(WINDOWS)
void replaceNewlinesWithWindowsStyleNewlines(String&);
diff --git a/WebCore/platform/chromium/WidgetChromium.cpp b/WebCore/platform/chromium/WidgetChromium.cpp
index 94afa0d..1b7fef4 100644
--- a/WebCore/platform/chromium/WidgetChromium.cpp
+++ b/WebCore/platform/chromium/WidgetChromium.cpp
@@ -65,8 +65,6 @@ void Widget::paint(GraphicsContext*, const IntRect&)
void Widget::setFocus(bool focused)
{
- if (focused)
- ChromiumBridge::widgetSetFocus(this);
}
void Widget::setIsSelected(bool)
diff --git a/WebCore/platform/cocoa/KeyEventCocoa.h b/WebCore/platform/cocoa/KeyEventCocoa.h
index 8d486ad..d6e206e 100644
--- a/WebCore/platform/cocoa/KeyEventCocoa.h
+++ b/WebCore/platform/cocoa/KeyEventCocoa.h
@@ -26,9 +26,9 @@
#ifndef KeyEventCocoa_h
#define KeyEventCocoa_h
-namespace WebCore {
+#include <wtf/Forward.h>
-class String;
+namespace WebCore {
String keyIdentifierForCharCode(unichar charCode);
diff --git a/WebCore/platform/cocoa/KeyEventCocoa.mm b/WebCore/platform/cocoa/KeyEventCocoa.mm
index 522c420..cf83d93 100644
--- a/WebCore/platform/cocoa/KeyEventCocoa.mm
+++ b/WebCore/platform/cocoa/KeyEventCocoa.mm
@@ -31,7 +31,7 @@
#import "WindowsKeyboardCodes.h"
#import <wtf/ASCIICType.h>
-#if PLATFORM(IPHONE)
+#if PLATFORM(IOS)
#import "KeyEventCodesIPhone.h"
#endif
diff --git a/WebCore/platform/efl/ClipboardEfl.cpp b/WebCore/platform/efl/ClipboardEfl.cpp
index 1633ccb..60146b5 100644
--- a/WebCore/platform/efl/ClipboardEfl.cpp
+++ b/WebCore/platform/efl/ClipboardEfl.cpp
@@ -53,7 +53,7 @@ void ClipboardEfl::clearData(const String&)
notImplemented();
}
-void ClipboardEfl::writePlainText(const WebCore::String&)
+void ClipboardEfl::writePlainText(const WTF::String&)
{
notImplemented();
}
diff --git a/WebCore/platform/efl/ClipboardEfl.h b/WebCore/platform/efl/ClipboardEfl.h
index c8de431..d5b17c0 100644
--- a/WebCore/platform/efl/ClipboardEfl.h
+++ b/WebCore/platform/efl/ClipboardEfl.h
@@ -52,7 +52,7 @@ public:
virtual bool hasData();
- virtual void writePlainText(const WebCore::String&);
+ virtual void writePlainText(const WTF::String&);
};
}
diff --git a/WebCore/platform/efl/RenderThemeEfl.cpp b/WebCore/platform/efl/RenderThemeEfl.cpp
index d5a5365..36600a9 100644
--- a/WebCore/platform/efl/RenderThemeEfl.cpp
+++ b/WebCore/platform/efl/RenderThemeEfl.cpp
@@ -34,6 +34,7 @@
#include "Page.h"
#include "RenderBox.h"
#include "RenderObject.h"
+#include "RenderSlider.h"
#include <wtf/text/CString.h>
#include <Ecore_Evas.h>
@@ -256,7 +257,7 @@ void RenderThemeEfl::applyEdjeStateFromForm(Evas_Object* o, ControlStates states
bool RenderThemeEfl::paintThemePart(RenderObject* o, FormType type, const PaintInfo& i, const IntRect& rect)
{
- struct ThemePartCacheEntry* ce;
+ ThemePartCacheEntry* ce;
Eina_List* updates;
cairo_t* cairo;
@@ -273,6 +274,29 @@ bool RenderThemeEfl::paintThemePart(RenderObject* o, FormType type, const PaintI
cairo = i.context->platformContext();
ASSERT(cairo);
+ // Currently, only sliders needs this message; if other widget ever needs special
+ // treatment, move them to special functions.
+ if (type == SliderVertical || type == SliderHorizontal) {
+ RenderSlider* renderSlider = toRenderSlider(o);
+ Edje_Message_Float_Set* msg;
+ int max, value;
+
+ if (type == SliderVertical) {
+ max = rect.height() - renderSlider->thumbRect().height();
+ value = renderSlider->thumbRect().y();
+ } else {
+ max = rect.width() - renderSlider->thumbRect().width();
+ value = renderSlider->thumbRect().x();
+ }
+
+ msg = static_cast<Edje_Message_Float_Set*>(alloca(sizeof(Edje_Message_Float_Set) + sizeof(float)));
+
+ msg->count = 2;
+ msg->val[0] = static_cast<float>(value) / static_cast<float>(max);
+ msg->val[1] = 0.1;
+ edje_object_message_send(ce->o, EDJE_MESSAGE_FLOAT_SET, 0, msg);
+ }
+
edje_object_calc_force(ce->o);
edje_object_message_signal_process(ce->o);
updates = evas_render_updates(ecore_evas_get(ce->ee));
@@ -542,6 +566,8 @@ const char* RenderThemeEfl::edjeGroupFromFormType(FormType type) const
W("search/results_button"),
W("search/results_decoration"),
W("search/cancel_button"),
+ W("slider/vertical"),
+ W("slider/horizontal"),
#undef W
0
};
@@ -702,6 +728,8 @@ static bool supportsFocus(ControlPart appearance)
case MenulistPart:
case RadioPart:
case CheckboxPart:
+ case SliderVerticalPart:
+ case SliderHorizontalPart:
return true;
default:
return false;
@@ -730,6 +758,40 @@ int RenderThemeEfl::baselinePosition(const RenderObject* o) const
return RenderTheme::baselinePosition(o);
}
+bool RenderThemeEfl::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
+{
+ if (o->style()->appearance() == SliderHorizontalPart)
+ return paintThemePart(o, SliderHorizontal, i, rect);
+ return paintThemePart(o, SliderVertical, i, rect);
+}
+
+void RenderThemeEfl::adjustSliderTrackStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
+{
+ if (!m_page && e && e->document()->page()) {
+ static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSliderTrackStyle(selector, style, e);
+ return;
+ }
+
+ adjustSizeConstraints(style, SliderHorizontal);
+ style->resetBorder();
+
+ const struct ThemePartDesc *desc = m_partDescs + (size_t)SliderHorizontal;
+ if (style->width().value() < desc->min.width().value())
+ style->setWidth(desc->min.width());
+ if (style->height().value() < desc->min.height().value())
+ style->setHeight(desc->min.height());
+}
+
+void RenderThemeEfl::adjustSliderThumbStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
+{
+ adjustSliderTrackStyle(selector, style, e);
+}
+
+bool RenderThemeEfl::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
+{
+ return paintSliderTrack(o, i, rect);
+}
+
void RenderThemeEfl::adjustCheckboxStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
{
if (!m_page && e && e->document()->page()) {
diff --git a/WebCore/platform/efl/RenderThemeEfl.h b/WebCore/platform/efl/RenderThemeEfl.h
index 9753a76..8e5650d 100644
--- a/WebCore/platform/efl/RenderThemeEfl.h
+++ b/WebCore/platform/efl/RenderThemeEfl.h
@@ -50,6 +50,8 @@ enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType()
SearchFieldResultsButton,
SearchFieldResultsDecoration,
SearchFieldCancelButton,
+ SliderVertical,
+ SliderHorizontal,
FormTypeLast
};
@@ -135,6 +137,11 @@ public:
virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
+
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
private:
void createCanvas();
void createEdje();
diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h
index 9335bc4..81480b6 100644
--- a/WebCore/platform/graphics/Color.h
+++ b/WebCore/platform/graphics/Color.h
@@ -27,6 +27,7 @@
#define Color_h
#include <wtf/FastAllocBase.h>
+#include <wtf/Forward.h>
#include <wtf/unicode/Unicode.h>
#if PLATFORM(CG)
@@ -55,7 +56,6 @@ struct rgb_color;
namespace WebCore {
class Color;
-class String;
typedef unsigned RGBA32; // RGBA quadruplet
diff --git a/WebCore/platform/graphics/FontCache.h b/WebCore/platform/graphics/FontCache.h
index 1a3ba69..e6845d9 100644
--- a/WebCore/platform/graphics/FontCache.h
+++ b/WebCore/platform/graphics/FontCache.h
@@ -31,6 +31,7 @@
#define FontCache_h
#include <limits.h>
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
#include <wtf/unicode/Unicode.h>
@@ -42,7 +43,6 @@
namespace WebCore
{
-class AtomicString;
class Font;
class FontPlatformData;
class FontData;
diff --git a/WebCore/platform/graphics/FontData.h b/WebCore/platform/graphics/FontData.h
index 76927f5..ee94a98 100644
--- a/WebCore/platform/graphics/FontData.h
+++ b/WebCore/platform/graphics/FontData.h
@@ -26,13 +26,13 @@
#ifndef FontData_h
#define FontData_h
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/unicode/Unicode.h>
namespace WebCore {
class SimpleFontData;
-class String;
class FontData : public Noncopyable {
public:
diff --git a/WebCore/platform/graphics/FontSelector.h b/WebCore/platform/graphics/FontSelector.h
index 9b520b9..156bf10 100644
--- a/WebCore/platform/graphics/FontSelector.h
+++ b/WebCore/platform/graphics/FontSelector.h
@@ -26,11 +26,11 @@
#ifndef FontSelector_h
#define FontSelector_h
+#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
-class AtomicString;
class FontData;
class FontDescription;
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index d5df153..9cae2f1 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -76,7 +76,10 @@ class PlatformGraphicsContext;
class SkPaint;
struct SkPoint;
#else
-typedef class PlatformContextSkia PlatformGraphicsContext;
+namespace WebCore {
+class PlatformContextSkia;
+}
+typedef WebCore::PlatformContextSkia PlatformGraphicsContext;
#endif
#elif PLATFORM(HAIKU)
class BView;
@@ -121,6 +124,7 @@ namespace WebCore {
class Font;
class Generator;
class Gradient;
+ class GraphicsContext3D;
class GraphicsContextPlatformPrivate;
class GraphicsContextPrivate;
class ImageBuffer;
@@ -425,6 +429,11 @@ namespace WebCore {
pattern getHaikuStrokeStyle();
#endif
+#if PLATFORM(SKIA)
+ void setGraphicsContext3D(GraphicsContext3D*, const IntSize&);
+ void syncSoftwareCanvas();
+#endif
+
private:
void savePlatformState();
void restorePlatformState();
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 28388f4..d702096 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -43,7 +43,7 @@
#include <wtf/RetainPtr.h>
typedef CGLContextObj PlatformGraphicsContext3D;
-const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
typedef GLuint Platform3DObject;
const Platform3DObject NullPlatform3DObject = 0;
@@ -58,12 +58,12 @@ typedef void* WebGLLayer;
class QPainter;
class QRect;
typedef void* PlatformGraphicsContext3D;
-const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
typedef int Platform3DObject;
const Platform3DObject NullPlatform3DObject = 0;
#else
typedef void* PlatformGraphicsContext3D;
-const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
typedef int Platform3DObject;
const Platform3DObject NullPlatform3DObject = 0;
#endif
@@ -73,774 +73,768 @@ const Platform3DObject NullPlatform3DObject = 0;
#endif
namespace WebCore {
- class WebGLActiveInfo;
- class ArrayBuffer;
- class ArrayBufferView;
- class WebGLBuffer;
- class Uint8Array;
- class Float32Array;
- class WebGLFramebuffer;
- class Int32Array;
- class WebGLProgram;
- class WebGLRenderbuffer;
- class WebGLRenderingContext;
- class WebGLShader;
- class WebGLTexture;
- class Image;
- class ImageData;
- class HostWindow;
-
- struct ActiveInfo {
- String name;
- unsigned type;
- int size;
- };
-
- // FIXME: ideally this would be used on all platforms.
+class ArrayBuffer;
+class ArrayBufferView;
+class CanvasRenderingContext;
+class Float32Array;
+class HostWindow;
+class Image;
+class ImageData;
+class Int32Array;
+class Uint8Array;
+class WebGLActiveInfo;
+
+struct ActiveInfo {
+ String name;
+ unsigned type;
+ int size;
+};
+
+// FIXME: ideally this would be used on all platforms.
#if PLATFORM(CHROMIUM) || PLATFORM(QT)
- class GraphicsContext3DInternal;
+class GraphicsContext3DInternal;
#endif
- class GraphicsContext3D : public Noncopyable {
- public:
- enum WebGLEnumType {
- DEPTH_BUFFER_BIT = 0x00000100,
- STENCIL_BUFFER_BIT = 0x00000400,
- COLOR_BUFFER_BIT = 0x00004000,
- POINTS = 0x0000,
- LINES = 0x0001,
- LINE_LOOP = 0x0002,
- LINE_STRIP = 0x0003,
- TRIANGLES = 0x0004,
- TRIANGLE_STRIP = 0x0005,
- TRIANGLE_FAN = 0x0006,
- ZERO = 0,
- ONE = 1,
- SRC_COLOR = 0x0300,
- ONE_MINUS_SRC_COLOR = 0x0301,
- SRC_ALPHA = 0x0302,
- ONE_MINUS_SRC_ALPHA = 0x0303,
- DST_ALPHA = 0x0304,
- ONE_MINUS_DST_ALPHA = 0x0305,
- DST_COLOR = 0x0306,
- ONE_MINUS_DST_COLOR = 0x0307,
- SRC_ALPHA_SATURATE = 0x0308,
- FUNC_ADD = 0x8006,
- BLEND_EQUATION = 0x8009,
- BLEND_EQUATION_RGB = 0x8009,
- BLEND_EQUATION_ALPHA = 0x883D,
- FUNC_SUBTRACT = 0x800A,
- FUNC_REVERSE_SUBTRACT = 0x800B,
- BLEND_DST_RGB = 0x80C8,
- BLEND_SRC_RGB = 0x80C9,
- BLEND_DST_ALPHA = 0x80CA,
- BLEND_SRC_ALPHA = 0x80CB,
- CONSTANT_COLOR = 0x8001,
- ONE_MINUS_CONSTANT_COLOR = 0x8002,
- CONSTANT_ALPHA = 0x8003,
- ONE_MINUS_CONSTANT_ALPHA = 0x8004,
- BLEND_COLOR = 0x8005,
- ARRAY_BUFFER = 0x8892,
- ELEMENT_ARRAY_BUFFER = 0x8893,
- ARRAY_BUFFER_BINDING = 0x8894,
- ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
- STREAM_DRAW = 0x88E0,
- STATIC_DRAW = 0x88E4,
- DYNAMIC_DRAW = 0x88E8,
- BUFFER_SIZE = 0x8764,
- BUFFER_USAGE = 0x8765,
- CURRENT_VERTEX_ATTRIB = 0x8626,
- FRONT = 0x0404,
- BACK = 0x0405,
- FRONT_AND_BACK = 0x0408,
- TEXTURE_2D = 0x0DE1,
- CULL_FACE = 0x0B44,
- BLEND = 0x0BE2,
- DITHER = 0x0BD0,
- STENCIL_TEST = 0x0B90,
- DEPTH_TEST = 0x0B71,
- SCISSOR_TEST = 0x0C11,
- POLYGON_OFFSET_FILL = 0x8037,
- SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
- SAMPLE_COVERAGE = 0x80A0,
- NO_ERROR = 0,
- INVALID_ENUM = 0x0500,
- INVALID_VALUE = 0x0501,
- INVALID_OPERATION = 0x0502,
- OUT_OF_MEMORY = 0x0505,
- CW = 0x0900,
- CCW = 0x0901,
- LINE_WIDTH = 0x0B21,
- ALIASED_POINT_SIZE_RANGE = 0x846D,
- ALIASED_LINE_WIDTH_RANGE = 0x846E,
- CULL_FACE_MODE = 0x0B45,
- FRONT_FACE = 0x0B46,
- DEPTH_RANGE = 0x0B70,
- DEPTH_WRITEMASK = 0x0B72,
- DEPTH_CLEAR_VALUE = 0x0B73,
- DEPTH_FUNC = 0x0B74,
- STENCIL_CLEAR_VALUE = 0x0B91,
- STENCIL_FUNC = 0x0B92,
- STENCIL_FAIL = 0x0B94,
- STENCIL_PASS_DEPTH_FAIL = 0x0B95,
- STENCIL_PASS_DEPTH_PASS = 0x0B96,
- STENCIL_REF = 0x0B97,
- STENCIL_VALUE_MASK = 0x0B93,
- STENCIL_WRITEMASK = 0x0B98,
- STENCIL_BACK_FUNC = 0x8800,
- STENCIL_BACK_FAIL = 0x8801,
- STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
- STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
- STENCIL_BACK_REF = 0x8CA3,
- STENCIL_BACK_VALUE_MASK = 0x8CA4,
- STENCIL_BACK_WRITEMASK = 0x8CA5,
- VIEWPORT = 0x0BA2,
- SCISSOR_BOX = 0x0C10,
- COLOR_CLEAR_VALUE = 0x0C22,
- COLOR_WRITEMASK = 0x0C23,
- UNPACK_ALIGNMENT = 0x0CF5,
- PACK_ALIGNMENT = 0x0D05,
- MAX_TEXTURE_SIZE = 0x0D33,
- MAX_VIEWPORT_DIMS = 0x0D3A,
- SUBPIXEL_BITS = 0x0D50,
- RED_BITS = 0x0D52,
- GREEN_BITS = 0x0D53,
- BLUE_BITS = 0x0D54,
- ALPHA_BITS = 0x0D55,
- DEPTH_BITS = 0x0D56,
- STENCIL_BITS = 0x0D57,
- POLYGON_OFFSET_UNITS = 0x2A00,
- POLYGON_OFFSET_FACTOR = 0x8038,
- TEXTURE_BINDING_2D = 0x8069,
- SAMPLE_BUFFERS = 0x80A8,
- SAMPLES = 0x80A9,
- SAMPLE_COVERAGE_VALUE = 0x80AA,
- SAMPLE_COVERAGE_INVERT = 0x80AB,
- NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
- COMPRESSED_TEXTURE_FORMATS = 0x86A3,
- DONT_CARE = 0x1100,
- FASTEST = 0x1101,
- NICEST = 0x1102,
- GENERATE_MIPMAP_HINT = 0x8192,
- BYTE = 0x1400,
- UNSIGNED_BYTE = 0x1401,
- SHORT = 0x1402,
- UNSIGNED_SHORT = 0x1403,
- INT = 0x1404,
- UNSIGNED_INT = 0x1405,
- FLOAT = 0x1406,
- FIXED = 0x140C,
- DEPTH_COMPONENT = 0x1902,
- ALPHA = 0x1906,
- RGB = 0x1907,
- RGBA = 0x1908,
- LUMINANCE = 0x1909,
- LUMINANCE_ALPHA = 0x190A,
- UNSIGNED_SHORT_4_4_4_4 = 0x8033,
- UNSIGNED_SHORT_5_5_5_1 = 0x8034,
- UNSIGNED_SHORT_5_6_5 = 0x8363,
- FRAGMENT_SHADER = 0x8B30,
- VERTEX_SHADER = 0x8B31,
- MAX_VERTEX_ATTRIBS = 0x8869,
- MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
- MAX_VARYING_VECTORS = 0x8DFC,
- MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
- MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
- MAX_TEXTURE_IMAGE_UNITS = 0x8872,
- MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
- SHADER_TYPE = 0x8B4F,
- DELETE_STATUS = 0x8B80,
- LINK_STATUS = 0x8B82,
- VALIDATE_STATUS = 0x8B83,
- ATTACHED_SHADERS = 0x8B85,
- ACTIVE_UNIFORMS = 0x8B86,
- ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
- ACTIVE_ATTRIBUTES = 0x8B89,
- ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
- SHADING_LANGUAGE_VERSION = 0x8B8C,
- CURRENT_PROGRAM = 0x8B8D,
- NEVER = 0x0200,
- LESS = 0x0201,
- EQUAL = 0x0202,
- LEQUAL = 0x0203,
- GREATER = 0x0204,
- NOTEQUAL = 0x0205,
- GEQUAL = 0x0206,
- ALWAYS = 0x0207,
- KEEP = 0x1E00,
- REPLACE = 0x1E01,
- INCR = 0x1E02,
- DECR = 0x1E03,
- INVERT = 0x150A,
- INCR_WRAP = 0x8507,
- DECR_WRAP = 0x8508,
- VENDOR = 0x1F00,
- RENDERER = 0x1F01,
- VERSION = 0x1F02,
- EXTENSIONS = 0x1F03,
- NEAREST = 0x2600,
- LINEAR = 0x2601,
- NEAREST_MIPMAP_NEAREST = 0x2700,
- LINEAR_MIPMAP_NEAREST = 0x2701,
- NEAREST_MIPMAP_LINEAR = 0x2702,
- LINEAR_MIPMAP_LINEAR = 0x2703,
- TEXTURE_MAG_FILTER = 0x2800,
- TEXTURE_MIN_FILTER = 0x2801,
- TEXTURE_WRAP_S = 0x2802,
- TEXTURE_WRAP_T = 0x2803,
- TEXTURE = 0x1702,
- TEXTURE_CUBE_MAP = 0x8513,
- TEXTURE_BINDING_CUBE_MAP = 0x8514,
- TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
- TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
- TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
- TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
- TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
- TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
- MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C,
- TEXTURE0 = 0x84C0,
- TEXTURE1 = 0x84C1,
- TEXTURE2 = 0x84C2,
- TEXTURE3 = 0x84C3,
- TEXTURE4 = 0x84C4,
- TEXTURE5 = 0x84C5,
- TEXTURE6 = 0x84C6,
- TEXTURE7 = 0x84C7,
- TEXTURE8 = 0x84C8,
- TEXTURE9 = 0x84C9,
- TEXTURE10 = 0x84CA,
- TEXTURE11 = 0x84CB,
- TEXTURE12 = 0x84CC,
- TEXTURE13 = 0x84CD,
- TEXTURE14 = 0x84CE,
- TEXTURE15 = 0x84CF,
- TEXTURE16 = 0x84D0,
- TEXTURE17 = 0x84D1,
- TEXTURE18 = 0x84D2,
- TEXTURE19 = 0x84D3,
- TEXTURE20 = 0x84D4,
- TEXTURE21 = 0x84D5,
- TEXTURE22 = 0x84D6,
- TEXTURE23 = 0x84D7,
- TEXTURE24 = 0x84D8,
- TEXTURE25 = 0x84D9,
- TEXTURE26 = 0x84DA,
- TEXTURE27 = 0x84DB,
- TEXTURE28 = 0x84DC,
- TEXTURE29 = 0x84DD,
- TEXTURE30 = 0x84DE,
- TEXTURE31 = 0x84DF,
- ACTIVE_TEXTURE = 0x84E0,
- REPEAT = 0x2901,
- CLAMP_TO_EDGE = 0x812F,
- MIRRORED_REPEAT = 0x8370,
- FLOAT_VEC2 = 0x8B50,
- FLOAT_VEC3 = 0x8B51,
- FLOAT_VEC4 = 0x8B52,
- INT_VEC2 = 0x8B53,
- INT_VEC3 = 0x8B54,
- INT_VEC4 = 0x8B55,
- BOOL = 0x8B56,
- BOOL_VEC2 = 0x8B57,
- BOOL_VEC3 = 0x8B58,
- BOOL_VEC4 = 0x8B59,
- FLOAT_MAT2 = 0x8B5A,
- FLOAT_MAT3 = 0x8B5B,
- FLOAT_MAT4 = 0x8B5C,
- SAMPLER_2D = 0x8B5E,
- SAMPLER_CUBE = 0x8B60,
- VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
- VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
- VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
- VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
- VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
- VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
- VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
- IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
- IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
- COMPILE_STATUS = 0x8B81,
- INFO_LOG_LENGTH = 0x8B84,
- SHADER_SOURCE_LENGTH = 0x8B88,
- SHADER_COMPILER = 0x8DFA,
- SHADER_BINARY_FORMATS = 0x8DF8,
- NUM_SHADER_BINARY_FORMATS = 0x8DF9,
- LOW_FLOAT = 0x8DF0,
- MEDIUM_FLOAT = 0x8DF1,
- HIGH_FLOAT = 0x8DF2,
- LOW_INT = 0x8DF3,
- MEDIUM_INT = 0x8DF4,
- HIGH_INT = 0x8DF5,
- FRAMEBUFFER = 0x8D40,
- RENDERBUFFER = 0x8D41,
- RGBA4 = 0x8056,
- RGB5_A1 = 0x8057,
- RGB565 = 0x8D62,
- DEPTH_COMPONENT16 = 0x81A5,
- STENCIL_INDEX = 0x1901,
- STENCIL_INDEX8 = 0x8D48,
- DEPTH_STENCIL = 0x84F9,
- RENDERBUFFER_WIDTH = 0x8D42,
- RENDERBUFFER_HEIGHT = 0x8D43,
- RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
- RENDERBUFFER_RED_SIZE = 0x8D50,
- RENDERBUFFER_GREEN_SIZE = 0x8D51,
- RENDERBUFFER_BLUE_SIZE = 0x8D52,
- RENDERBUFFER_ALPHA_SIZE = 0x8D53,
- RENDERBUFFER_DEPTH_SIZE = 0x8D54,
- RENDERBUFFER_STENCIL_SIZE = 0x8D55,
- FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
- FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
- FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
- FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
- COLOR_ATTACHMENT0 = 0x8CE0,
- DEPTH_ATTACHMENT = 0x8D00,
- STENCIL_ATTACHMENT = 0x8D20,
- DEPTH_STENCIL_ATTACHMENT = 0x821A,
- NONE = 0,
- FRAMEBUFFER_COMPLETE = 0x8CD5,
- FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
- FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
- FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
- FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
- FRAMEBUFFER_BINDING = 0x8CA6,
- RENDERBUFFER_BINDING = 0x8CA7,
- MAX_RENDERBUFFER_SIZE = 0x84E8,
- INVALID_FRAMEBUFFER_OPERATION = 0x0506,
-
- // WebGL-specific enums
- UNPACK_FLIP_Y_WEBGL = 0x9240,
- UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241
- };
-
- // Context creation attributes.
- struct Attributes {
- Attributes()
- : alpha(true)
- , depth(true)
- , stencil(false)
- , antialias(true)
- , premultipliedAlpha(true)
- {
- }
-
- bool alpha;
- bool depth;
- bool stencil;
- bool antialias;
- bool premultipliedAlpha;
- };
-
- static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow);
- virtual ~GraphicsContext3D();
+class GraphicsContext3D : public Noncopyable {
+public:
+ enum WebGLEnumType {
+ DEPTH_BUFFER_BIT = 0x00000100,
+ STENCIL_BUFFER_BIT = 0x00000400,
+ COLOR_BUFFER_BIT = 0x00004000,
+ POINTS = 0x0000,
+ LINES = 0x0001,
+ LINE_LOOP = 0x0002,
+ LINE_STRIP = 0x0003,
+ TRIANGLES = 0x0004,
+ TRIANGLE_STRIP = 0x0005,
+ TRIANGLE_FAN = 0x0006,
+ ZERO = 0,
+ ONE = 1,
+ SRC_COLOR = 0x0300,
+ ONE_MINUS_SRC_COLOR = 0x0301,
+ SRC_ALPHA = 0x0302,
+ ONE_MINUS_SRC_ALPHA = 0x0303,
+ DST_ALPHA = 0x0304,
+ ONE_MINUS_DST_ALPHA = 0x0305,
+ DST_COLOR = 0x0306,
+ ONE_MINUS_DST_COLOR = 0x0307,
+ SRC_ALPHA_SATURATE = 0x0308,
+ FUNC_ADD = 0x8006,
+ BLEND_EQUATION = 0x8009,
+ BLEND_EQUATION_RGB = 0x8009,
+ BLEND_EQUATION_ALPHA = 0x883D,
+ FUNC_SUBTRACT = 0x800A,
+ FUNC_REVERSE_SUBTRACT = 0x800B,
+ BLEND_DST_RGB = 0x80C8,
+ BLEND_SRC_RGB = 0x80C9,
+ BLEND_DST_ALPHA = 0x80CA,
+ BLEND_SRC_ALPHA = 0x80CB,
+ CONSTANT_COLOR = 0x8001,
+ ONE_MINUS_CONSTANT_COLOR = 0x8002,
+ CONSTANT_ALPHA = 0x8003,
+ ONE_MINUS_CONSTANT_ALPHA = 0x8004,
+ BLEND_COLOR = 0x8005,
+ ARRAY_BUFFER = 0x8892,
+ ELEMENT_ARRAY_BUFFER = 0x8893,
+ ARRAY_BUFFER_BINDING = 0x8894,
+ ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
+ STREAM_DRAW = 0x88E0,
+ STATIC_DRAW = 0x88E4,
+ DYNAMIC_DRAW = 0x88E8,
+ BUFFER_SIZE = 0x8764,
+ BUFFER_USAGE = 0x8765,
+ CURRENT_VERTEX_ATTRIB = 0x8626,
+ FRONT = 0x0404,
+ BACK = 0x0405,
+ FRONT_AND_BACK = 0x0408,
+ TEXTURE_2D = 0x0DE1,
+ CULL_FACE = 0x0B44,
+ BLEND = 0x0BE2,
+ DITHER = 0x0BD0,
+ STENCIL_TEST = 0x0B90,
+ DEPTH_TEST = 0x0B71,
+ SCISSOR_TEST = 0x0C11,
+ POLYGON_OFFSET_FILL = 0x8037,
+ SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
+ SAMPLE_COVERAGE = 0x80A0,
+ NO_ERROR = 0,
+ INVALID_ENUM = 0x0500,
+ INVALID_VALUE = 0x0501,
+ INVALID_OPERATION = 0x0502,
+ OUT_OF_MEMORY = 0x0505,
+ CW = 0x0900,
+ CCW = 0x0901,
+ LINE_WIDTH = 0x0B21,
+ ALIASED_POINT_SIZE_RANGE = 0x846D,
+ ALIASED_LINE_WIDTH_RANGE = 0x846E,
+ CULL_FACE_MODE = 0x0B45,
+ FRONT_FACE = 0x0B46,
+ DEPTH_RANGE = 0x0B70,
+ DEPTH_WRITEMASK = 0x0B72,
+ DEPTH_CLEAR_VALUE = 0x0B73,
+ DEPTH_FUNC = 0x0B74,
+ STENCIL_CLEAR_VALUE = 0x0B91,
+ STENCIL_FUNC = 0x0B92,
+ STENCIL_FAIL = 0x0B94,
+ STENCIL_PASS_DEPTH_FAIL = 0x0B95,
+ STENCIL_PASS_DEPTH_PASS = 0x0B96,
+ STENCIL_REF = 0x0B97,
+ STENCIL_VALUE_MASK = 0x0B93,
+ STENCIL_WRITEMASK = 0x0B98,
+ STENCIL_BACK_FUNC = 0x8800,
+ STENCIL_BACK_FAIL = 0x8801,
+ STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
+ STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
+ STENCIL_BACK_REF = 0x8CA3,
+ STENCIL_BACK_VALUE_MASK = 0x8CA4,
+ STENCIL_BACK_WRITEMASK = 0x8CA5,
+ VIEWPORT = 0x0BA2,
+ SCISSOR_BOX = 0x0C10,
+ COLOR_CLEAR_VALUE = 0x0C22,
+ COLOR_WRITEMASK = 0x0C23,
+ UNPACK_ALIGNMENT = 0x0CF5,
+ PACK_ALIGNMENT = 0x0D05,
+ MAX_TEXTURE_SIZE = 0x0D33,
+ MAX_VIEWPORT_DIMS = 0x0D3A,
+ SUBPIXEL_BITS = 0x0D50,
+ RED_BITS = 0x0D52,
+ GREEN_BITS = 0x0D53,
+ BLUE_BITS = 0x0D54,
+ ALPHA_BITS = 0x0D55,
+ DEPTH_BITS = 0x0D56,
+ STENCIL_BITS = 0x0D57,
+ POLYGON_OFFSET_UNITS = 0x2A00,
+ POLYGON_OFFSET_FACTOR = 0x8038,
+ TEXTURE_BINDING_2D = 0x8069,
+ SAMPLE_BUFFERS = 0x80A8,
+ SAMPLES = 0x80A9,
+ SAMPLE_COVERAGE_VALUE = 0x80AA,
+ SAMPLE_COVERAGE_INVERT = 0x80AB,
+ NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
+ COMPRESSED_TEXTURE_FORMATS = 0x86A3,
+ DONT_CARE = 0x1100,
+ FASTEST = 0x1101,
+ NICEST = 0x1102,
+ GENERATE_MIPMAP_HINT = 0x8192,
+ BYTE = 0x1400,
+ UNSIGNED_BYTE = 0x1401,
+ SHORT = 0x1402,
+ UNSIGNED_SHORT = 0x1403,
+ INT = 0x1404,
+ UNSIGNED_INT = 0x1405,
+ FLOAT = 0x1406,
+ FIXED = 0x140C,
+ DEPTH_COMPONENT = 0x1902,
+ ALPHA = 0x1906,
+ RGB = 0x1907,
+ RGBA = 0x1908,
+ LUMINANCE = 0x1909,
+ LUMINANCE_ALPHA = 0x190A,
+ UNSIGNED_SHORT_4_4_4_4 = 0x8033,
+ UNSIGNED_SHORT_5_5_5_1 = 0x8034,
+ UNSIGNED_SHORT_5_6_5 = 0x8363,
+ FRAGMENT_SHADER = 0x8B30,
+ VERTEX_SHADER = 0x8B31,
+ MAX_VERTEX_ATTRIBS = 0x8869,
+ MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
+ MAX_VARYING_VECTORS = 0x8DFC,
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
+ MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
+ MAX_TEXTURE_IMAGE_UNITS = 0x8872,
+ MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
+ SHADER_TYPE = 0x8B4F,
+ DELETE_STATUS = 0x8B80,
+ LINK_STATUS = 0x8B82,
+ VALIDATE_STATUS = 0x8B83,
+ ATTACHED_SHADERS = 0x8B85,
+ ACTIVE_UNIFORMS = 0x8B86,
+ ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+ ACTIVE_ATTRIBUTES = 0x8B89,
+ ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
+ SHADING_LANGUAGE_VERSION = 0x8B8C,
+ CURRENT_PROGRAM = 0x8B8D,
+ NEVER = 0x0200,
+ LESS = 0x0201,
+ EQUAL = 0x0202,
+ LEQUAL = 0x0203,
+ GREATER = 0x0204,
+ NOTEQUAL = 0x0205,
+ GEQUAL = 0x0206,
+ ALWAYS = 0x0207,
+ KEEP = 0x1E00,
+ REPLACE = 0x1E01,
+ INCR = 0x1E02,
+ DECR = 0x1E03,
+ INVERT = 0x150A,
+ INCR_WRAP = 0x8507,
+ DECR_WRAP = 0x8508,
+ VENDOR = 0x1F00,
+ RENDERER = 0x1F01,
+ VERSION = 0x1F02,
+ EXTENSIONS = 0x1F03,
+ NEAREST = 0x2600,
+ LINEAR = 0x2601,
+ NEAREST_MIPMAP_NEAREST = 0x2700,
+ LINEAR_MIPMAP_NEAREST = 0x2701,
+ NEAREST_MIPMAP_LINEAR = 0x2702,
+ LINEAR_MIPMAP_LINEAR = 0x2703,
+ TEXTURE_MAG_FILTER = 0x2800,
+ TEXTURE_MIN_FILTER = 0x2801,
+ TEXTURE_WRAP_S = 0x2802,
+ TEXTURE_WRAP_T = 0x2803,
+ TEXTURE = 0x1702,
+ TEXTURE_CUBE_MAP = 0x8513,
+ TEXTURE_BINDING_CUBE_MAP = 0x8514,
+ TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
+ TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
+ TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
+ TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
+ TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
+ TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
+ MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C,
+ TEXTURE0 = 0x84C0,
+ TEXTURE1 = 0x84C1,
+ TEXTURE2 = 0x84C2,
+ TEXTURE3 = 0x84C3,
+ TEXTURE4 = 0x84C4,
+ TEXTURE5 = 0x84C5,
+ TEXTURE6 = 0x84C6,
+ TEXTURE7 = 0x84C7,
+ TEXTURE8 = 0x84C8,
+ TEXTURE9 = 0x84C9,
+ TEXTURE10 = 0x84CA,
+ TEXTURE11 = 0x84CB,
+ TEXTURE12 = 0x84CC,
+ TEXTURE13 = 0x84CD,
+ TEXTURE14 = 0x84CE,
+ TEXTURE15 = 0x84CF,
+ TEXTURE16 = 0x84D0,
+ TEXTURE17 = 0x84D1,
+ TEXTURE18 = 0x84D2,
+ TEXTURE19 = 0x84D3,
+ TEXTURE20 = 0x84D4,
+ TEXTURE21 = 0x84D5,
+ TEXTURE22 = 0x84D6,
+ TEXTURE23 = 0x84D7,
+ TEXTURE24 = 0x84D8,
+ TEXTURE25 = 0x84D9,
+ TEXTURE26 = 0x84DA,
+ TEXTURE27 = 0x84DB,
+ TEXTURE28 = 0x84DC,
+ TEXTURE29 = 0x84DD,
+ TEXTURE30 = 0x84DE,
+ TEXTURE31 = 0x84DF,
+ ACTIVE_TEXTURE = 0x84E0,
+ REPEAT = 0x2901,
+ CLAMP_TO_EDGE = 0x812F,
+ MIRRORED_REPEAT = 0x8370,
+ FLOAT_VEC2 = 0x8B50,
+ FLOAT_VEC3 = 0x8B51,
+ FLOAT_VEC4 = 0x8B52,
+ INT_VEC2 = 0x8B53,
+ INT_VEC3 = 0x8B54,
+ INT_VEC4 = 0x8B55,
+ BOOL = 0x8B56,
+ BOOL_VEC2 = 0x8B57,
+ BOOL_VEC3 = 0x8B58,
+ BOOL_VEC4 = 0x8B59,
+ FLOAT_MAT2 = 0x8B5A,
+ FLOAT_MAT3 = 0x8B5B,
+ FLOAT_MAT4 = 0x8B5C,
+ SAMPLER_2D = 0x8B5E,
+ SAMPLER_CUBE = 0x8B60,
+ VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
+ VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
+ VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
+ VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
+ VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
+ VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
+ VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
+ IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
+ IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
+ COMPILE_STATUS = 0x8B81,
+ INFO_LOG_LENGTH = 0x8B84,
+ SHADER_SOURCE_LENGTH = 0x8B88,
+ SHADER_COMPILER = 0x8DFA,
+ SHADER_BINARY_FORMATS = 0x8DF8,
+ NUM_SHADER_BINARY_FORMATS = 0x8DF9,
+ LOW_FLOAT = 0x8DF0,
+ MEDIUM_FLOAT = 0x8DF1,
+ HIGH_FLOAT = 0x8DF2,
+ LOW_INT = 0x8DF3,
+ MEDIUM_INT = 0x8DF4,
+ HIGH_INT = 0x8DF5,
+ FRAMEBUFFER = 0x8D40,
+ RENDERBUFFER = 0x8D41,
+ RGBA4 = 0x8056,
+ RGB5_A1 = 0x8057,
+ RGB565 = 0x8D62,
+ DEPTH_COMPONENT16 = 0x81A5,
+ STENCIL_INDEX = 0x1901,
+ STENCIL_INDEX8 = 0x8D48,
+ DEPTH_STENCIL = 0x84F9,
+ RENDERBUFFER_WIDTH = 0x8D42,
+ RENDERBUFFER_HEIGHT = 0x8D43,
+ RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
+ RENDERBUFFER_RED_SIZE = 0x8D50,
+ RENDERBUFFER_GREEN_SIZE = 0x8D51,
+ RENDERBUFFER_BLUE_SIZE = 0x8D52,
+ RENDERBUFFER_ALPHA_SIZE = 0x8D53,
+ RENDERBUFFER_DEPTH_SIZE = 0x8D54,
+ RENDERBUFFER_STENCIL_SIZE = 0x8D55,
+ FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
+ FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
+ FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
+ FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
+ COLOR_ATTACHMENT0 = 0x8CE0,
+ DEPTH_ATTACHMENT = 0x8D00,
+ STENCIL_ATTACHMENT = 0x8D20,
+ DEPTH_STENCIL_ATTACHMENT = 0x821A,
+ NONE = 0,
+ FRAMEBUFFER_COMPLETE = 0x8CD5,
+ FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
+ FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
+ FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
+ FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
+ FRAMEBUFFER_BINDING = 0x8CA6,
+ RENDERBUFFER_BINDING = 0x8CA7,
+ MAX_RENDERBUFFER_SIZE = 0x84E8,
+ INVALID_FRAMEBUFFER_OPERATION = 0x0506,
+
+ // WebGL-specific enums
+ UNPACK_FLIP_Y_WEBGL = 0x9240,
+ UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241
+ };
+
+ // Context creation attributes.
+ struct Attributes {
+ Attributes()
+ : alpha(true)
+ , depth(true)
+ , stencil(false)
+ , antialias(true)
+ , premultipliedAlpha(true)
+ {
+ }
+
+ bool alpha;
+ bool depth;
+ bool stencil;
+ bool antialias;
+ bool premultipliedAlpha;
+ };
+
+ static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow);
+ virtual ~GraphicsContext3D();
#if PLATFORM(MAC)
- PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
- Platform3DObject platformTexture() const { return m_texture; }
- CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); }
+ PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
+ Platform3DObject platformTexture() const { return m_texture; }
+ CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); }
#elif PLATFORM(CHROMIUM)
- PlatformGraphicsContext3D platformGraphicsContext3D() const;
- Platform3DObject platformTexture() const;
+ PlatformGraphicsContext3D platformGraphicsContext3D() const;
+ Platform3DObject platformTexture() const;
#if USE(ACCELERATED_COMPOSITING)
- PlatformLayer* platformLayer() const;
+ PlatformLayer* platformLayer() const;
#endif
#elif PLATFORM(QT)
- PlatformGraphicsContext3D platformGraphicsContext3D();
- Platform3DObject platformTexture() const;
+ PlatformGraphicsContext3D platformGraphicsContext3D();
+ Platform3DObject platformTexture() const;
#if USE(ACCELERATED_COMPOSITING)
- PlatformLayer* platformLayer() const { return 0; }
+ PlatformLayer* platformLayer() const { return 0; }
#endif
#else
- PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; }
- Platform3DObject platformTexture() const { return NullPlatform3DObject; }
+ PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; }
+ Platform3DObject platformTexture() const { return NullPlatform3DObject; }
#if USE(ACCELERATED_COMPOSITING)
- PlatformLayer* platformLayer() const { return 0; }
+ PlatformLayer* platformLayer() const { return 0; }
#endif
#endif
- void makeContextCurrent();
+ void makeContextCurrent();
#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
- // With multisampling on, blit from multisampleFBO to regular FBO.
- void prepareTexture();
+ // With multisampling on, blit from multisampleFBO to regular FBO.
+ void prepareTexture();
#endif
- // Helper to return the size in bytes of OpenGL data types
- // like GL_FLOAT, GL_INT, etc.
- int sizeInBytes(int type);
-
- bool isGLES2Compliant() const;
-
- //----------------------------------------------------------------------
- // Helpers for texture uploading and pixel readback.
- //
-
- // Computes the components per pixel and bytes per component
- // for the given format and type combination. Returns false if
- // either was an invalid enum.
- bool computeFormatAndTypeParameters(unsigned int format,
- unsigned int type,
- unsigned long* componentsPerPixel,
- unsigned long* bytesPerComponent);
-
- // Extracts the contents of the given Image into the passed Vector,
- // packing the pixel data according to the given format and type,
- // and obeying the flipY and premultiplyAlpha flags. Returns true
- // upon success.
- bool extractImageData(Image* image,
- unsigned int format,
- unsigned int type,
- bool flipY,
- bool premultiplyAlpha,
- Vector<uint8_t>& data);
-
- // Extracts the contents of the given ImageData into the passed Vector,
- // packing the pixel data according to the given format and type,
- // and obeying the flipY and premultiplyAlpha flags. Returns true
- // upon success.
- bool extractImageData(ImageData*,
- unsigned int format,
- unsigned int type,
- bool flipY,
- bool premultiplyAlpha,
- Vector<uint8_t>& data);
-
- // Helper function which extracts the user-supplied texture
- // data, applying the flipY and premultiplyAlpha parameters.
- // If the data is not tightly packed according to the passed
- // unpackAlignment, the output data will be tightly packed.
- // Returns true if successful, false if any error occurred.
- bool extractTextureData(unsigned int width, unsigned int height,
- unsigned int format, unsigned int type,
- unsigned int unpackAlignment,
- bool flipY, bool premultiplyAlpha,
- ArrayBufferView* pixels,
- Vector<uint8_t>& data);
-
- // Flips the given image data vertically, in-place.
- void flipVertically(void* imageData,
- unsigned int width,
- unsigned int height,
- unsigned int bytesPerPixel,
- unsigned int unpackAlignment);
-
- // Attempt to enumerate all possible native image formats to
- // reduce the amount of temporary allocations during texture
- // uploading. This enum must be public because it is accessed
- // by non-member functions.
- enum SourceDataFormat {
- kSourceFormatRGBA8,
- kSourceFormatRGB8,
- kSourceFormatBGRA8,
- kSourceFormatRGBA5551,
- kSourceFormatRGBA4444,
- kSourceFormatRGB565,
- kSourceFormatR8,
- kSourceFormatRA8,
- kSourceFormatA8
- };
-
- //----------------------------------------------------------------------
- // Entry points for WebGL.
- //
-
- void activeTexture(unsigned long texture);
- void attachShader(WebGLProgram* program, WebGLShader* shader);
- void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name);
- void bindBuffer(unsigned long target, WebGLBuffer*);
- void bindFramebuffer(unsigned long target, WebGLFramebuffer*);
- void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*);
- void bindTexture(unsigned long target, WebGLTexture* texture);
- void blendColor(double red, double green, double blue, double alpha);
- void blendEquation(unsigned long mode);
- void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
- void blendFunc(unsigned long sfactor, unsigned long dfactor);
- void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
-
- void bufferData(unsigned long target, int size, unsigned long usage);
- void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage);
- void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage);
- void bufferSubData(unsigned long target, long offset, ArrayBuffer* data);
- void bufferSubData(unsigned long target, long offset, ArrayBufferView* data);
-
- unsigned long checkFramebufferStatus(unsigned long target);
- void clear(unsigned long mask);
- void clearColor(double red, double green, double blue, double alpha);
- void clearDepth(double depth);
- void clearStencil(long s);
- void colorMask(bool red, bool green, bool blue, bool alpha);
- void compileShader(WebGLShader*);
-
- //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
- //void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
-
- void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
- void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
- void cullFace(unsigned long mode);
- void depthFunc(unsigned long func);
- void depthMask(bool flag);
- void depthRange(double zNear, double zFar);
- void detachShader(WebGLProgram*, WebGLShader*);
- void disable(unsigned long cap);
- void disableVertexAttribArray(unsigned long index);
- void drawArrays(unsigned long mode, long first, long count);
- void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
-
- void enable(unsigned long cap);
- void enableVertexAttribArray(unsigned long index);
- void finish();
- void flush();
- void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*);
- void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level);
- void frontFace(unsigned long mode);
- void generateMipmap(unsigned long target);
-
- bool getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo&);
- bool getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo&);
-
- void getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders);
-
- int getAttribLocation(WebGLProgram*, const String& name);
-
- void getBooleanv(unsigned long pname, unsigned char* value);
-
- void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
- Attributes getContextAttributes();
-
- unsigned long getError();
-
- void getFloatv(unsigned long pname, float* value);
-
- void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
-
- void getIntegerv(unsigned long pname, int* value);
-
- void getProgramiv(WebGLProgram* program, unsigned long pname, int* value);
-
- String getProgramInfoLog(WebGLProgram*);
-
- void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
- void getShaderiv(WebGLShader*, unsigned long pname, int* value);
-
- String getShaderInfoLog(WebGLShader*);
-
- // TBD
- // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-
- String getShaderSource(WebGLShader*);
- String getString(unsigned long name);
-
- void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
- void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
-
- void getUniformfv(WebGLProgram* program, long location, float* value);
- void getUniformiv(WebGLProgram* program, long location, int* value);
-
- long getUniformLocation(WebGLProgram*, const String& name);
-
- void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
- void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
-
- long getVertexAttribOffset(unsigned long index, unsigned long pname);
-
- void hint(unsigned long target, unsigned long mode);
- bool isBuffer(WebGLBuffer*);
- bool isEnabled(unsigned long cap);
- bool isFramebuffer(WebGLFramebuffer*);
- bool isProgram(WebGLProgram*);
- bool isRenderbuffer(WebGLRenderbuffer*);
- bool isShader(WebGLShader*);
- bool isTexture(WebGLTexture*);
- void lineWidth(double);
- void linkProgram(WebGLProgram*);
- void pixelStorei(unsigned long pname, long param);
- void polygonOffset(double factor, double units);
-
- void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
-
- void releaseShaderCompiler();
- void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
- void sampleCoverage(double value, bool invert);
- void scissor(long x, long y, unsigned long width, unsigned long height);
- void shaderSource(WebGLShader*, const String& string);
- void stencilFunc(unsigned long func, long ref, unsigned long mask);
- void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
- void stencilMask(unsigned long mask);
- void stencilMaskSeparate(unsigned long face, unsigned long mask);
- void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
- void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
-
- int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
-
- void texParameterf(unsigned target, unsigned pname, float param);
- void texParameteri(unsigned target, unsigned pname, int param);
-
- int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
-
- void uniform1f(long location, float x);
- void uniform1fv(long location, float* v, int size);
- void uniform1i(long location, int x);
- void uniform1iv(long location, int* v, int size);
- void uniform2f(long location, float x, float y);
- void uniform2fv(long location, float* v, int size);
- void uniform2i(long location, int x, int y);
- void uniform2iv(long location, int* v, int size);
- void uniform3f(long location, float x, float y, float z);
- void uniform3fv(long location, float* v, int size);
- void uniform3i(long location, int x, int y, int z);
- void uniform3iv(long location, int* v, int size);
- void uniform4f(long location, float x, float y, float z, float w);
- void uniform4fv(long location, float* v, int size);
- void uniform4i(long location, int x, int y, int z, int w);
- void uniform4iv(long location, int* v, int size);
- void uniformMatrix2fv(long location, bool transpose, float* value, int size);
- void uniformMatrix3fv(long location, bool transpose, float* value, int size);
- void uniformMatrix4fv(long location, bool transpose, float* value, int size);
+ // Helper to return the size in bytes of OpenGL data types
+ // like GL_FLOAT, GL_INT, etc.
+ int sizeInBytes(int type);
+
+ bool isGLES2Compliant() const;
+
+ //----------------------------------------------------------------------
+ // Helpers for texture uploading and pixel readback.
+ //
+
+ // Computes the components per pixel and bytes per component
+ // for the given format and type combination. Returns false if
+ // either was an invalid enum.
+ bool computeFormatAndTypeParameters(unsigned int format,
+ unsigned int type,
+ unsigned long* componentsPerPixel,
+ unsigned long* bytesPerComponent);
+
+ // Extracts the contents of the given Image into the passed Vector,
+ // packing the pixel data according to the given format and type,
+ // and obeying the flipY and premultiplyAlpha flags. Returns true
+ // upon success.
+ bool extractImageData(Image* image,
+ unsigned int format,
+ unsigned int type,
+ bool flipY,
+ bool premultiplyAlpha,
+ Vector<uint8_t>& data);
+
+ // Extracts the contents of the given ImageData into the passed Vector,
+ // packing the pixel data according to the given format and type,
+ // and obeying the flipY and premultiplyAlpha flags. Returns true
+ // upon success.
+ bool extractImageData(ImageData*,
+ unsigned int format,
+ unsigned int type,
+ bool flipY,
+ bool premultiplyAlpha,
+ Vector<uint8_t>& data);
+
+ // Helper function which extracts the user-supplied texture
+ // data, applying the flipY and premultiplyAlpha parameters.
+ // If the data is not tightly packed according to the passed
+ // unpackAlignment, the output data will be tightly packed.
+ // Returns true if successful, false if any error occurred.
+ bool extractTextureData(unsigned int width, unsigned int height,
+ unsigned int format, unsigned int type,
+ unsigned int unpackAlignment,
+ bool flipY, bool premultiplyAlpha,
+ ArrayBufferView* pixels,
+ Vector<uint8_t>& data);
+
+ // Flips the given image data vertically, in-place.
+ void flipVertically(void* imageData,
+ unsigned int width,
+ unsigned int height,
+ unsigned int bytesPerPixel,
+ unsigned int unpackAlignment);
+
+ // Attempt to enumerate all possible native image formats to
+ // reduce the amount of temporary allocations during texture
+ // uploading. This enum must be public because it is accessed
+ // by non-member functions.
+ enum SourceDataFormat {
+ kSourceFormatRGBA8,
+ kSourceFormatRGB8,
+ kSourceFormatBGRA8,
+ kSourceFormatRGBA5551,
+ kSourceFormatRGBA4444,
+ kSourceFormatRGB565,
+ kSourceFormatR8,
+ kSourceFormatRA8,
+ kSourceFormatA8
+ };
+
+ //----------------------------------------------------------------------
+ // Entry points for WebGL.
+ //
+
+ void activeTexture(unsigned long texture);
+ void attachShader(Platform3DObject program, Platform3DObject shader);
+ void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
+ void bindBuffer(unsigned long target, Platform3DObject);
+ void bindFramebuffer(unsigned long target, Platform3DObject);
+ void bindRenderbuffer(unsigned long target, Platform3DObject);
+ void bindTexture(unsigned long target, Platform3DObject texture);
+ void blendColor(double red, double green, double blue, double alpha);
+ void blendEquation(unsigned long mode);
+ void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
+ void blendFunc(unsigned long sfactor, unsigned long dfactor);
+ void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+
+ void bufferData(unsigned long target, int size, unsigned long usage);
+ void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage);
+ void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage);
+ void bufferSubData(unsigned long target, long offset, ArrayBuffer* data);
+ void bufferSubData(unsigned long target, long offset, ArrayBufferView* data);
+
+ unsigned long checkFramebufferStatus(unsigned long target);
+ void clear(unsigned long mask);
+ void clearColor(double red, double green, double blue, double alpha);
+ void clearDepth(double depth);
+ void clearStencil(long s);
+ void colorMask(bool red, bool green, bool blue, bool alpha);
+ void compileShader(Platform3DObject);
+
+ // void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
+ // void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
+
+ void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
+ void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
+ void cullFace(unsigned long mode);
+ void depthFunc(unsigned long func);
+ void depthMask(bool flag);
+ void depthRange(double zNear, double zFar);
+ void detachShader(Platform3DObject, Platform3DObject);
+ void disable(unsigned long cap);
+ void disableVertexAttribArray(unsigned long index);
+ void drawArrays(unsigned long mode, long first, long count);
+ void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
- void useProgram(WebGLProgram*);
- void validateProgram(WebGLProgram*);
+ void enable(unsigned long cap);
+ void enableVertexAttribArray(unsigned long index);
+ void finish();
+ void flush();
+ void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
+ void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
+ void frontFace(unsigned long mode);
+ void generateMipmap(unsigned long target);
+
+ bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
+ bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
+
+ void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
+
+ int getAttribLocation(Platform3DObject, const String& name);
+
+ void getBooleanv(unsigned long pname, unsigned char* value);
+
+ void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ Attributes getContextAttributes();
+
+ unsigned long getError();
+
+ void getFloatv(unsigned long pname, float* value);
+
+ void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
+
+ void getIntegerv(unsigned long pname, int* value);
+
+ void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
+
+ String getProgramInfoLog(Platform3DObject);
+
+ void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ void getShaderiv(Platform3DObject, unsigned long pname, int* value);
+
+ String getShaderInfoLog(Platform3DObject);
+
+ // TBD
+ // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+
+ String getShaderSource(Platform3DObject);
+ String getString(unsigned long name);
+
+ void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
+ void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ void getUniformfv(Platform3DObject program, long location, float* value);
+ void getUniformiv(Platform3DObject program, long location, int* value);
+
+ long getUniformLocation(Platform3DObject, const String& name);
+
+ void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
+ void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
+
+ long getVertexAttribOffset(unsigned long index, unsigned long pname);
+
+ void hint(unsigned long target, unsigned long mode);
+ bool isBuffer(Platform3DObject);
+ bool isEnabled(unsigned long cap);
+ bool isFramebuffer(Platform3DObject);
+ bool isProgram(Platform3DObject);
+ bool isRenderbuffer(Platform3DObject);
+ bool isShader(Platform3DObject);
+ bool isTexture(Platform3DObject);
+ void lineWidth(double);
+ void linkProgram(Platform3DObject);
+ void pixelStorei(unsigned long pname, long param);
+ void polygonOffset(double factor, double units);
+
+ void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
+
+ void releaseShaderCompiler();
+ void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
+ void sampleCoverage(double value, bool invert);
+ void scissor(long x, long y, unsigned long width, unsigned long height);
+ void shaderSource(Platform3DObject, const String& string);
+ void stencilFunc(unsigned long func, long ref, unsigned long mask);
+ void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
+ void stencilMask(unsigned long mask);
+ void stencilMaskSeparate(unsigned long face, unsigned long mask);
+ void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
+ void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
- void vertexAttrib1f(unsigned long indx, float x);
- void vertexAttrib1fv(unsigned long indx, float* values);
- void vertexAttrib2f(unsigned long indx, float x, float y);
- void vertexAttrib2fv(unsigned long indx, float* values);
- void vertexAttrib3f(unsigned long indx, float x, float y, float z);
- void vertexAttrib3fv(unsigned long indx, float* values);
- void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
- void vertexAttrib4fv(unsigned long indx, float* values);
- void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
- unsigned long stride, unsigned long offset);
-
- void viewport(long x, long y, unsigned long width, unsigned long height);
-
- void reshape(int width, int height);
+ int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
+
+ void texParameterf(unsigned target, unsigned pname, float param);
+ void texParameteri(unsigned target, unsigned pname, int param);
+
+ int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
+
+ void uniform1f(long location, float x);
+ void uniform1fv(long location, float* v, int size);
+ void uniform1i(long location, int x);
+ void uniform1iv(long location, int* v, int size);
+ void uniform2f(long location, float x, float y);
+ void uniform2fv(long location, float* v, int size);
+ void uniform2i(long location, int x, int y);
+ void uniform2iv(long location, int* v, int size);
+ void uniform3f(long location, float x, float y, float z);
+ void uniform3fv(long location, float* v, int size);
+ void uniform3i(long location, int x, int y, int z);
+ void uniform3iv(long location, int* v, int size);
+ void uniform4f(long location, float x, float y, float z, float w);
+ void uniform4fv(long location, float* v, int size);
+ void uniform4i(long location, int x, int y, int z, int w);
+ void uniform4iv(long location, int* v, int size);
+ void uniformMatrix2fv(long location, bool transpose, float* value, int size);
+ void uniformMatrix3fv(long location, bool transpose, float* value, int size);
+ void uniformMatrix4fv(long location, bool transpose, float* value, int size);
+
+ void useProgram(Platform3DObject);
+ void validateProgram(Platform3DObject);
+
+ void vertexAttrib1f(unsigned long indx, float x);
+ void vertexAttrib1fv(unsigned long indx, float* values);
+ void vertexAttrib2f(unsigned long indx, float x, float y);
+ void vertexAttrib2fv(unsigned long indx, float* values);
+ void vertexAttrib3f(unsigned long indx, float x, float y, float z);
+ void vertexAttrib3fv(unsigned long indx, float* values);
+ void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
+ void vertexAttrib4fv(unsigned long indx, float* values);
+ void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
+ unsigned long stride, unsigned long offset);
+
+ void viewport(long x, long y, unsigned long width, unsigned long height);
+
+ void reshape(int width, int height);
#if PLATFORM(CG)
- void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
- int canvasWidth, int canvasHeight, CGContextRef context);
+ void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
+ int canvasWidth, int canvasHeight, CGContextRef context);
#endif
- void paintRenderingResultsToCanvas(WebGLRenderingContext* context);
+ void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
- // Helpers for notification about paint events
- void beginPaint(WebGLRenderingContext* context);
- void endPaint();
+ // Helpers for notification about paint events
+ void beginPaint(CanvasRenderingContext* context);
+ void endPaint();
#if PLATFORM(QT)
- void paint(QPainter* painter, const QRect& rect) const;
+ void paint(QPainter* painter, const QRect& rect) const;
#endif
- // Support for buffer creation and deletion
- unsigned createBuffer();
- unsigned createFramebuffer();
- unsigned createProgram();
- unsigned createRenderbuffer();
- unsigned createShader(unsigned long);
- unsigned createTexture();
-
- void deleteBuffer(unsigned);
- void deleteFramebuffer(unsigned);
- void deleteProgram(unsigned);
- void deleteRenderbuffer(unsigned);
- void deleteShader(unsigned);
- void deleteTexture(unsigned);
-
- // Synthesizes an OpenGL error which will be returned from a
- // later call to getError. This is used to emulate OpenGL ES
- // 2.0 behavior on the desktop and to enforce additional error
- // checking mandated by WebGL.
- //
- // Per the behavior of glGetError, this stores at most one
- // instance of any given error, and returns them from calls to
- // getError in the order they were added.
- void synthesizeGLError(unsigned long error);
-
- private:
- GraphicsContext3D(Attributes attrs, HostWindow* hostWindow);
-
- // Each platform must provide an implementation of this method.
- //
- // Gets the data for the given Image into outputVector in the
- // format specified by the (OpenGL-style) format and type
- // arguments. Despite the fact that the outputVector contains
- // uint8_t, if the format and type specify packed pixels, then
- // it will essentially contain uint16_t after the extraction
- // process.
- //
- // If premultiplyAlpha is true, the alpha channel, if any,
- // will be multiplied into the color channels during the
- // extraction process. This premultiplication occurs before
- // any packing of pixel data.
- //
- // No vertical flip of the image data is performed by this
- // method.
- bool getImageData(Image* image,
- unsigned int format,
- unsigned int type,
- bool premultiplyAlpha,
- Vector<uint8_t>& outputVector);
-
- // Possible alpha operations that may need to occur during
- // pixel packing. FIXME: kAlphaDoUnmultiply is lossy and must
- // be removed.
- enum AlphaOp {
- kAlphaDoNothing = 0,
- kAlphaDoPremultiply = 1,
- kAlphaDoUnmultiply = 2
- };
-
- // Helper for getImageData which implements packing of pixel
- // data into the specified OpenGL destination format and type.
- // A sourceUnpackAlignment of zero indicates that the source
- // data is tightly packed. Non-zero values may take a slow path.
- // Destination data will have no gaps between rows.
- bool packPixels(const uint8_t* sourceData,
- SourceDataFormat sourceDataFormat,
- unsigned int width,
- unsigned int height,
- unsigned int sourceUnpackAlignment,
- unsigned int destinationFormat,
- unsigned int destinationType,
- AlphaOp alphaOp,
- void* destinationData);
+ // Support for buffer creation and deletion
+ unsigned createBuffer();
+ unsigned createFramebuffer();
+ unsigned createProgram();
+ unsigned createRenderbuffer();
+ unsigned createShader(unsigned long);
+ unsigned createTexture();
+
+ void deleteBuffer(unsigned);
+ void deleteFramebuffer(unsigned);
+ void deleteProgram(unsigned);
+ void deleteRenderbuffer(unsigned);
+ void deleteShader(unsigned);
+ void deleteTexture(unsigned);
+
+ // Synthesizes an OpenGL error which will be returned from a
+ // later call to getError. This is used to emulate OpenGL ES
+ // 2.0 behavior on the desktop and to enforce additional error
+ // checking mandated by WebGL.
+ //
+ // Per the behavior of glGetError, this stores at most one
+ // instance of any given error, and returns them from calls to
+ // getError in the order they were added.
+ void synthesizeGLError(unsigned long error);
+
+ private:
+ GraphicsContext3D(Attributes attrs, HostWindow* hostWindow);
+
+ // Each platform must provide an implementation of this method.
+ //
+ // Gets the data for the given Image into outputVector in the
+ // format specified by the (OpenGL-style) format and type
+ // arguments. Despite the fact that the outputVector contains
+ // uint8_t, if the format and type specify packed pixels, then
+ // it will essentially contain uint16_t after the extraction
+ // process.
+ //
+ // If premultiplyAlpha is true, the alpha channel, if any,
+ // will be multiplied into the color channels during the
+ // extraction process. This premultiplication occurs before
+ // any packing of pixel data.
+ //
+ // No vertical flip of the image data is performed by this
+ // method.
+ bool getImageData(Image* image,
+ unsigned int format,
+ unsigned int type,
+ bool premultiplyAlpha,
+ Vector<uint8_t>& outputVector);
+
+ // Possible alpha operations that may need to occur during
+ // pixel packing. FIXME: kAlphaDoUnmultiply is lossy and must
+ // be removed.
+ enum AlphaOp {
+ kAlphaDoNothing = 0,
+ kAlphaDoPremultiply = 1,
+ kAlphaDoUnmultiply = 2
+ };
+
+ // Helper for getImageData which implements packing of pixel
+ // data into the specified OpenGL destination format and type.
+ // A sourceUnpackAlignment of zero indicates that the source
+ // data is tightly packed. Non-zero values may take a slow path.
+ // Destination data will have no gaps between rows.
+ bool packPixels(const uint8_t* sourceData,
+ SourceDataFormat sourceDataFormat,
+ unsigned int width,
+ unsigned int height,
+ unsigned int sourceUnpackAlignment,
+ unsigned int destinationFormat,
+ unsigned int destinationType,
+ AlphaOp alphaOp,
+ void* destinationData);
#if PLATFORM(MAC)
- // Take into account the user's requested context creation attributes,
- // in particular stencil and antialias, and determine which could or
- // could not be honored based on the capabilities of the OpenGL
- // implementation.
- void validateAttributes();
+ // Take into account the user's requested context creation attributes,
+ // in particular stencil and antialias, and determine which could or
+ // could not be honored based on the capabilities of the OpenGL
+ // implementation.
+ void validateAttributes();
#endif
- int m_currentWidth, m_currentHeight;
-
+ int m_currentWidth, m_currentHeight;
+
#if PLATFORM(MAC)
- Attributes m_attrs;
- Vector<Vector<float> > m_vertexArray;
-
- CGLContextObj m_contextObj;
- RetainPtr<WebGLLayer> m_webGLLayer;
- GLuint m_texture;
- GLuint m_fbo;
- GLuint m_depthStencilBuffer;
-
- // For tracking which FBO is bound
- GLuint m_boundFBO;
-
- // For multisampling
- GLuint m_multisampleFBO;
- GLuint m_multisampleDepthStencilBuffer;
- GLuint m_multisampleColorBuffer;
-
- // Errors raised by synthesizeGLError().
- ListHashSet<unsigned long> m_syntheticErrors;
-#endif
-
- // FIXME: ideally this would be used on all platforms.
+ Attributes m_attrs;
+ Vector<Vector<float> > m_vertexArray;
+
+ CGLContextObj m_contextObj;
+ RetainPtr<WebGLLayer> m_webGLLayer;
+ GLuint m_texture;
+ GLuint m_fbo;
+ GLuint m_depthStencilBuffer;
+
+ // For tracking which FBO is bound
+ GLuint m_boundFBO;
+
+ // For multisampling
+ GLuint m_multisampleFBO;
+ GLuint m_multisampleDepthStencilBuffer;
+ GLuint m_multisampleColorBuffer;
+
+ // Errors raised by synthesizeGLError().
+ ListHashSet<unsigned long> m_syntheticErrors;
+#endif
+
+ // FIXME: ideally this would be used on all platforms.
#if PLATFORM(CHROMIUM) || PLATFORM(QT)
- friend class GraphicsContext3DInternal;
- OwnPtr<GraphicsContext3DInternal> m_internal;
+ friend class GraphicsContext3DInternal;
+ OwnPtr<GraphicsContext3DInternal> m_internal;
#endif
- };
+};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/GraphicsLayer.cpp b/WebCore/platform/graphics/GraphicsLayer.cpp
index c1e2ed6..5003907 100644
--- a/WebCore/platform/graphics/GraphicsLayer.cpp
+++ b/WebCore/platform/graphics/GraphicsLayer.cpp
@@ -526,7 +526,7 @@ void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
if (!layer)
return;
- WebCore::String output = layer->layerTreeAsText(LayerTreeAsTextDebug);
+ WTF::String output = layer->layerTreeAsText(LayerTreeAsTextDebug);
fprintf(stderr, "%s\n", output.utf8().data());
}
#endif
diff --git a/WebCore/platform/graphics/GraphicsLayer.h b/WebCore/platform/graphics/GraphicsLayer.h
index a5819f4..0f74cd5 100644
--- a/WebCore/platform/graphics/GraphicsLayer.h
+++ b/WebCore/platform/graphics/GraphicsLayer.h
@@ -298,9 +298,7 @@ public:
virtual void setContentsToImage(Image*) { }
virtual void setContentsToMedia(PlatformLayer*) { } // video or plug-in
virtual void setContentsBackgroundColor(const Color&) { }
-#if ENABLE(3D_CANVAS)
- virtual void setContentsToWebGL(PlatformLayer*) { }
-#endif
+ virtual void setContentsToCanvas(PlatformLayer*) { }
virtual bool hasContentsLayer() const { return false; }
// Callback from the underlying graphics system to draw layer contents.
diff --git a/WebCore/platform/graphics/GraphicsTypes.h b/WebCore/platform/graphics/GraphicsTypes.h
index 769207a..1e73f25 100644
--- a/WebCore/platform/graphics/GraphicsTypes.h
+++ b/WebCore/platform/graphics/GraphicsTypes.h
@@ -26,9 +26,9 @@
#ifndef GraphicsTypes_h
#define GraphicsTypes_h
-namespace WebCore {
+#include <wtf/Forward.h>
- class String;
+namespace WebCore {
// Note: These constants exactly match the NSCompositeOperator constants of
// AppKit on Mac OS X Tiger. If these ever change, we'll need to change the
diff --git a/WebCore/platform/graphics/Icon.h b/WebCore/platform/graphics/Icon.h
index 3390679..c83685f 100644
--- a/WebCore/platform/graphics/Icon.h
+++ b/WebCore/platform/graphics/Icon.h
@@ -49,7 +49,6 @@ namespace WebCore {
class GraphicsContext;
class IntRect;
-class String;
class Icon : public RefCounted<Icon> {
public:
diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h
index 3230df5..7c00b71 100644
--- a/WebCore/platform/graphics/Image.h
+++ b/WebCore/platform/graphics/Image.h
@@ -55,10 +55,6 @@ typedef SIZE* LPSIZE;
typedef struct HBITMAP__ *HBITMAP;
#endif
-#if PLATFORM(SKIA)
-class NativeImageSkia;
-#endif
-
#if PLATFORM(QT)
#include <QPixmap>
#endif
diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h
index cb5d63f..a54c721 100644
--- a/WebCore/platform/graphics/ImageBuffer.h
+++ b/WebCore/platform/graphics/ImageBuffer.h
@@ -32,6 +32,7 @@
#include "Image.h"
#include "IntSize.h"
#include "ImageBufferData.h"
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
@@ -42,7 +43,6 @@ namespace WebCore {
class ImageData;
class IntPoint;
class IntRect;
- class String;
enum ImageColorSpace {
Unknown,
diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h
index 6913e4d..014c136 100644
--- a/WebCore/platform/graphics/ImageSource.h
+++ b/WebCore/platform/graphics/ImageSource.h
@@ -27,6 +27,7 @@
#ifndef ImageSource_h
#define ImageSource_h
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
@@ -51,7 +52,9 @@ typedef struct _cairo_surface cairo_surface_t;
class SkBitmapRef;
class PrivateAndroidImageSourceRec;
#else
+namespace WebCore {
class NativeImageSkia;
+}
#endif
#elif PLATFORM(HAIKU)
class BBitmap;
@@ -64,7 +67,6 @@ namespace WebCore {
class IntPoint;
class IntSize;
class SharedBuffer;
-class String;
#if PLATFORM(CG)
typedef CGImageSourceRef NativeImageSourcePtr;
@@ -78,9 +80,7 @@ typedef TiledImageOpenVG* NativeImagePtr;
class ImageDecoderQt;
typedef ImageDecoderQt* NativeImageSourcePtr;
typedef QPixmap* NativeImagePtr;
-#elif PLATFORM(SKIA)
-#if PLATFORM(ANDROID)
-class String;
+#elif PLATFORM(SKIA) && PLATFORM(ANDROID)
#ifdef ANDROID_ANIMATED_GIF
class ImageDecoder;
#endif
@@ -96,11 +96,6 @@ typedef SkBitmapRef* NativeImagePtr;
#else
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
-typedef NativeImageSkia* NativeImagePtr;
-#endif
-#else
-class ImageDecoder;
-typedef ImageDecoder* NativeImageSourcePtr;
#if PLATFORM(WX)
#if USE(WXGC)
typedef wxGraphicsBitmap* NativeImagePtr;
@@ -109,6 +104,8 @@ typedef wxBitmap* NativeImagePtr;
#endif
#elif PLATFORM(CAIRO)
typedef cairo_surface_t* NativeImagePtr;
+#elif PLATFORM(SKIA)
+typedef WebCore::NativeImageSkia* NativeImagePtr;
#elif PLATFORM(HAIKU)
typedef BBitmap* NativeImagePtr;
#elif OS(WINCE)
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 9290dfe..b8b742d 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -297,6 +297,11 @@ bool MediaPlayer::hasAvailableVideoFrame() const
return m_private->hasAvailableVideoFrame();
}
+void MediaPlayer::prepareForRendering()
+{
+ return m_private->prepareForRendering();
+}
+
bool MediaPlayer::canLoadPoster() const
{
return m_private->canLoadPoster();
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index dea5100..4da697a 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -35,6 +35,7 @@
#include "Document.h"
#include "IntRect.h"
#include "StringHash.h"
+#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
#include <wtf/Noncopyable.h>
@@ -88,7 +89,6 @@ class GraphicsContext;
class IntRect;
class IntSize;
class MediaPlayer;
-class String;
class TimeRanges;
class MediaPlayerClient {
@@ -251,6 +251,7 @@ public:
MediaPlayerClient* mediaPlayerClient() const { return m_mediaPlayerClient; }
bool hasAvailableVideoFrame() const;
+ void prepareForRendering();
bool canLoadPoster() const;
void setPoster(const String&);
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index 40aeacb..a8d9b86 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -29,12 +29,12 @@
#if ENABLE(VIDEO)
#include "MediaPlayer.h"
+#include <wtf/Forward.h>
namespace WebCore {
class IntRect;
class IntSize;
-class String;
class MediaPlayerPrivateInterface : public Noncopyable {
public:
@@ -123,6 +123,8 @@ public:
virtual MediaPlayer::MovieLoadType movieLoadType() const { return MediaPlayer::Unknown; }
+ virtual void prepareForRendering() { }
+
};
}
diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h
index 86b77f8..43ba889 100644
--- a/WebCore/platform/graphics/Path.h
+++ b/WebCore/platform/graphics/Path.h
@@ -30,6 +30,7 @@
#include <algorithm>
#include <wtf/FastAllocBase.h>
+#include <wtf/Forward.h>
#if PLATFORM(CG)
typedef struct CGPath PlatformPath;
@@ -78,7 +79,6 @@ namespace WebCore {
class FloatRect;
class FloatSize;
class GraphicsContext;
- class String;
class StrokeStyleApplier;
enum WindRule {
diff --git a/WebCore/platform/graphics/SimpleFontData.cpp b/WebCore/platform/graphics/SimpleFontData.cpp
index 1cc3b4c..7980643 100644
--- a/WebCore/platform/graphics/SimpleFontData.cpp
+++ b/WebCore/platform/graphics/SimpleFontData.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov
*
* Redistribution and use in source and binary forms, with or without
@@ -47,64 +47,66 @@ using namespace std;
namespace WebCore {
-SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
+SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading)
: m_maxCharWidth(-1)
, m_avgCharWidth(-1)
, m_unitsPerEm(defaultUnitsPerEm)
- , m_platformData(f)
+ , m_platformData(platformData)
, m_treatAsFixedPitch(false)
+ , m_isCustomFont(isCustomFont)
+ , m_isLoading(isLoading)
+ , m_smallCapsFontData(0)
+{
+ platformInit();
+ platformGlyphInit();
+ platformCharWidthInit();
+}
+
#if ENABLE(SVG_FONTS)
+SimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bool syntheticBold, bool syntheticItalic)
+ : m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic))
+ , m_treatAsFixedPitch(false)
, m_svgFontData(svgFontData)
-#endif
- , m_isCustomFont(customFont)
- , m_isLoading(loading)
+ , m_isCustomFont(true)
+ , m_isLoading(false)
, m_smallCapsFontData(0)
{
-#if !ENABLE(SVG_FONTS)
- UNUSED_PARAM(svgFontData);
-#else
- if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
- m_unitsPerEm = svgFontFaceElement->unitsPerEm();
+ SVGFontFaceElement* svgFontFaceElement = m_svgFontData->svgFontFaceElement();
+ m_unitsPerEm = svgFontFaceElement->unitsPerEm();
- double scale = f.size();
- if (m_unitsPerEm)
- scale /= m_unitsPerEm;
+ double scale = size;
+ if (m_unitsPerEm)
+ scale /= m_unitsPerEm;
- m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
- m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
- m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
- m_lineGap = 0.1f * f.size();
- m_lineSpacing = m_ascent + m_descent + m_lineGap;
+ m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
+ m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
+ m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
+ m_lineGap = 0.1f * size;
+ m_lineSpacing = m_ascent + m_descent + m_lineGap;
- SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
+ SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
- Vector<SVGGlyphIdentifier> spaceGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
- m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> spaceGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
+ m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
- Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
- m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
+ m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
- Vector<SVGGlyphIdentifier> letterWGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
- m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> letterWGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
+ m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
- // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
- m_spaceGlyph = 0;
- m_zeroWidthSpaceGlyph = 0;
- determinePitch();
- m_adjustedSpaceWidth = roundf(m_spaceWidth);
- m_missingGlyphData.fontData = this;
- m_missingGlyphData.glyph = 0;
- return;
- }
-#endif
-
- platformInit();
- platformGlyphInit();
- platformCharWidthInit();
+ // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
+ m_spaceGlyph = 0;
+ m_zeroWidthSpaceGlyph = 0;
+ determinePitch();
+ m_adjustedSpaceWidth = roundf(m_spaceWidth);
+ m_missingGlyphData.fontData = this;
+ m_missingGlyphData.glyph = 0;
}
+#endif
#if !PLATFORM(QT)
// Estimates of avgCharWidth and maxCharWidth for platforms that don't support accessing these values from the font.
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index ba959e4..535554f 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -1,7 +1,7 @@
/*
* This file is part of the internal font implementation.
*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007-2008 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -38,7 +38,6 @@ typedef struct OpaqueATSUStyle* ATSUStyle;
#endif
#if USE(CORE_TEXT)
-#include <ApplicationServices/ApplicationServices.h>
#include <wtf/RetainPtr.h>
#endif
@@ -62,7 +61,6 @@ typedef struct OpaqueATSUStyle* ATSUStyle;
namespace WebCore {
class FontDescription;
-class FontPlatformData;
class SharedBuffer;
class SVGFontData;
@@ -70,10 +68,12 @@ enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
class SimpleFontData : public FontData {
public:
- SimpleFontData(const FontPlatformData&, bool customFont = false, bool loading = false, SVGFontData* data = 0);
+ SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false);
+#if ENABLE(SVG_FONTS)
+ SimpleFontData(PassOwnPtr<SVGFontData>, int size, bool syntheticBold, bool syntheticItalic);
+#endif
virtual ~SimpleFontData();
-public:
const FontPlatformData& platformData() const { return m_platformData; }
SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) const;
@@ -131,7 +131,6 @@ public:
#endif
#if USE(CORE_TEXT)
- CTFontRef getCTFont() const;
CFDictionaryRef getCFStringAttributes(TypesettingFeatures) const;
#endif
@@ -236,7 +235,6 @@ private:
#endif
#if USE(CORE_TEXT)
- mutable RetainPtr<CTFontRef> m_CTFont;
mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
#endif
diff --git a/WebCore/platform/graphics/StringTruncator.h b/WebCore/platform/graphics/StringTruncator.h
index 0a8532b..6791d38 100644
--- a/WebCore/platform/graphics/StringTruncator.h
+++ b/WebCore/platform/graphics/StringTruncator.h
@@ -29,10 +29,11 @@
#ifndef StringTruncator_h
#define StringTruncator_h
+#include <wtf/Forward.h>
+
namespace WebCore {
class Font;
- class String;
class StringTruncator {
public:
diff --git a/WebCore/platform/graphics/WOFFFileFormat.cpp b/WebCore/platform/graphics/WOFFFileFormat.cpp
index dc73603..908e288 100644
--- a/WebCore/platform/graphics/WOFFFileFormat.cpp
+++ b/WebCore/platform/graphics/WOFFFileFormat.cpp
@@ -32,6 +32,13 @@
#if !PLATFORM(WIN)
#include <zlib.h>
+#if PLATFORM(BREWMP)
+#include <AEEStdLib.h>
+#define htonl(x) HTONL(x)
+#define htons(x) HTONS(x)
+#define ntohl(x) NTOHL(x)
+#define ntohs(x) NTOHS(x)
+#endif
#else
#include "SoftLinking.h"
diff --git a/WebCore/platform/graphics/android/FontCustomPlatformData.h b/WebCore/platform/graphics/android/FontCustomPlatformData.h
index 452a0b3..b41417c 100644
--- a/WebCore/platform/graphics/android/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/android/FontCustomPlatformData.h
@@ -27,6 +27,7 @@
#define FontCustomPlatformData_h
#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
class SkTypeface;
@@ -35,7 +36,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
class FontCustomPlatformData : public Noncopyable {
public:
diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
index 2816427..a72a6a4 100644
--- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
@@ -22,6 +22,7 @@
#define FontCustomPlatformData_h
#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
typedef struct _cairo_font_face cairo_font_face_t;
@@ -30,7 +31,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformData : Noncopyable {
FontCustomPlatformData(cairo_font_face_t* fontFace)
diff --git a/WebCore/platform/graphics/cairo/FontPlatformData.h b/WebCore/platform/graphics/cairo/FontPlatformData.h
index d271f5b..fc6b9f1 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformData.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformData.h
@@ -28,6 +28,7 @@
#ifndef FontPlatformData_h
#define FontPlatformData_h
+#include <wtf/Forward.h>
#include <cairo.h>
#include "FontDescription.h"
#include "GlyphBuffer.h"
@@ -50,8 +51,6 @@ typedef struct HFONT__* HFONT;
#endif
namespace WebCore {
-class String;
-
class FontPlatformData {
public:
FontPlatformData(WTF::HashTableDeletedValueType)
diff --git a/WebCore/platform/graphics/cg/ColorCG.cpp b/WebCore/platform/graphics/cg/ColorCG.cpp
index 9257642..6f05c38 100644
--- a/WebCore/platform/graphics/cg/ColorCG.cpp
+++ b/WebCore/platform/graphics/cg/ColorCG.cpp
@@ -66,6 +66,7 @@ Color::Color(CGColorRef color)
}
m_color = makeRGBA(r * 255, g * 255, b * 255, a * 255);
+ m_valid = true;
}
#if OS(WINDOWS)
diff --git a/WebCore/platform/graphics/cg/FontPlatformData.h b/WebCore/platform/graphics/cg/FontPlatformData.h
index 1da8916..b261f87 100644
--- a/WebCore/platform/graphics/cg/FontPlatformData.h
+++ b/WebCore/platform/graphics/cg/FontPlatformData.h
@@ -26,6 +26,7 @@
#include "RefCountedGDIHandle.h"
#include "StringImpl.h"
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
@@ -36,7 +37,6 @@ typedef struct CGFont* CGFontRef;
namespace WebCore {
class FontDescription;
-class String;
class FontPlatformData {
public:
diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
index 8af3d0e..df14f9d 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -111,34 +111,20 @@ void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imag
if (!imagePixels || imageWidth <= 0 || imageHeight <= 0 || canvasWidth <= 0 || canvasHeight <= 0 || !context)
return;
int rowBytes = imageWidth * 4;
- RetainPtr<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(0, imagePixels, rowBytes * imageHeight, 0);
- RetainPtr<CGColorSpaceRef> colorSpace = CGColorSpaceCreateDeviceRGB();
- RetainPtr<CGImageRef> cgImage = CGImageCreate(imageWidth,
- imageHeight,
- 8,
- 32,
- rowBytes,
- colorSpace.get(),
- kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
- dataProvider.get(),
- 0,
- false,
- kCGRenderingIntentDefault);
+ RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithData(0, imagePixels, rowBytes * imageHeight, 0));
+ RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGImageRef> cgImage(AdoptCF, CGImageCreate(imageWidth, imageHeight, 8, 32, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+ dataProvider.get(), 0, false, kCGRenderingIntentDefault));
// CSS styling may cause the canvas's content to be resized on
// the page. Go back to the Canvas to figure out the correct
// width and height to draw.
- CGRect rect = CGRectMake(0, 0,
- canvasWidth,
- canvasHeight);
+ CGRect rect = CGRectMake(0, 0, canvasWidth, canvasHeight);
// We want to completely overwrite the previous frame's
// rendering results.
CGContextSaveGState(context);
- CGContextSetBlendMode(context,
- kCGBlendModeCopy);
- CGContextSetInterpolationQuality(context,
- kCGInterpolationNone);
- CGContextDrawImage(context,
- rect, cgImage.get());
+ CGContextSetBlendMode(context, kCGBlendModeCopy);
+ CGContextSetInterpolationQuality(context, kCGInterpolationNone);
+ CGContextDrawImage(context, rect, cgImage.get());
CGContextRestoreGState(context);
}
diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.h b/WebCore/platform/graphics/cg/ImageSourceCG.h
index 76b4160..bff8162 100644
--- a/WebCore/platform/graphics/cg/ImageSourceCG.h
+++ b/WebCore/platform/graphics/cg/ImageSourceCG.h
@@ -27,11 +27,10 @@
#define ImageSourceCG_h
#include "ImageSource.h"
+#include <wtf/Forward.h>
namespace WebCore {
-class String;
-
String preferredExtensionForImageSourceType(const String& type);
String MIMETypeForImageSourceType(const String& type);
diff --git a/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp b/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
index ebd9ebe..7e732d1 100644
--- a/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
@@ -32,21 +32,21 @@
#if USE(ACCELERATED_COMPOSITING)
-#include "WebGLLayerChromium.h"
+#include "CanvasLayerChromium.h"
#include "GraphicsContext3D.h"
#include <GLES2/gl2.h>
namespace WebCore {
-unsigned WebGLLayerChromium::m_shaderProgramId = 0;
+unsigned CanvasLayerChromium::m_shaderProgramId = 0;
-PassRefPtr<WebGLLayerChromium> WebGLLayerChromium::create(GraphicsLayerChromium* owner)
+PassRefPtr<CanvasLayerChromium> CanvasLayerChromium::create(GraphicsLayerChromium* owner)
{
- return adoptRef(new WebGLLayerChromium(owner));
+ return adoptRef(new CanvasLayerChromium(owner));
}
-WebGLLayerChromium::WebGLLayerChromium(GraphicsLayerChromium* owner)
+CanvasLayerChromium::CanvasLayerChromium(GraphicsLayerChromium* owner)
: LayerChromium(owner)
, m_context(0)
, m_textureId(0)
@@ -54,12 +54,12 @@ WebGLLayerChromium::WebGLLayerChromium(GraphicsLayerChromium* owner)
{
}
-unsigned WebGLLayerChromium::textureId()
+unsigned CanvasLayerChromium::textureId()
{
return m_textureId;
}
-void WebGLLayerChromium::updateTextureContents(unsigned textureId)
+void CanvasLayerChromium::updateTextureContents(unsigned textureId)
{
ASSERT(textureId == m_textureId);
ASSERT(m_context);
@@ -75,12 +75,14 @@ void WebGLLayerChromium::updateTextureContents(unsigned textureId)
}
// Update the contents of the texture used by the compositor.
if (m_contentsDirty) {
+ if (m_prepareTextureCallback)
+ m_prepareTextureCallback->willPrepareTexture();
m_context->prepareTexture();
m_contentsDirty = false;
}
}
-void WebGLLayerChromium::setContext(const GraphicsContext3D* context)
+void CanvasLayerChromium::setContext(const GraphicsContext3D* context)
{
m_context = const_cast<GraphicsContext3D*>(context);
diff --git a/WebCore/platform/graphics/chromium/WebGLLayerChromium.h b/WebCore/platform/graphics/chromium/CanvasLayerChromium.h
index abd0c93..98be270 100644
--- a/WebCore/platform/graphics/chromium/WebGLLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/CanvasLayerChromium.h
@@ -29,8 +29,8 @@
*/
-#ifndef WebGLLayerChromium_h
-#define WebGLLayerChromium_h
+#ifndef CanvasLayerChromium_h
+#define CanvasLayerChromium_h
#if USE(ACCELERATED_COMPOSITING)
@@ -40,10 +40,10 @@ namespace WebCore {
class GraphicsContext3D;
-// A Layer that contains a WebGL element.
-class WebGLLayerChromium : public LayerChromium {
+// A Layer containing a WebGL or accelerated 2d canvas
+class CanvasLayerChromium : public LayerChromium {
public:
- static PassRefPtr<WebGLLayerChromium> create(GraphicsLayerChromium* owner = 0);
+ static PassRefPtr<CanvasLayerChromium> create(GraphicsLayerChromium* owner = 0);
virtual bool drawsContent() { return m_context; }
virtual bool ownsTexture() { return true; }
virtual void updateTextureContents(unsigned);
@@ -54,11 +54,18 @@ public:
static void setShaderProgramId(unsigned shaderProgramId) { m_shaderProgramId = shaderProgramId; }
+ class PrepareTextureCallback : public Noncopyable {
+ public:
+ virtual void willPrepareTexture() = 0;
+ };
+ void setPrepareTextureCallback(PassOwnPtr<PrepareTextureCallback> callback) { m_prepareTextureCallback = callback; }
+
private:
- WebGLLayerChromium(GraphicsLayerChromium* owner);
+ explicit CanvasLayerChromium(GraphicsLayerChromium* owner);
GraphicsContext3D* m_context;
unsigned m_textureId;
bool m_textureChanged;
+ OwnPtr<PrepareTextureCallback> m_prepareTextureCallback;
static unsigned m_shaderProgramId;
};
diff --git a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
index 6f46f7e..8ba37c6 100644
--- a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -58,7 +58,7 @@ void FontCache::platformInit()
// FIXME: consider adding to WebKit String class
static bool charactersAreAllASCII(const String& s)
{
- return charactersAreAllASCII(s.characters(), s.length());
+ return WTF::charactersAreAllASCII(s.characters(), s.length());
}
// When asked for a CJK font with a native name under a non-CJK locale or
diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
index 03e1b8c..d451c9c 100644
--- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
@@ -33,6 +33,7 @@
#define FontCustomPlatformData_h
#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#if OS(WINDOWS)
@@ -46,7 +47,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformData : Noncopyable {
#if OS(WINDOWS)
diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumMac.mm b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumMac.mm
index 41f684e..ad7ebba 100644
--- a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumMac.mm
+++ b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumMac.mm
@@ -436,6 +436,17 @@ bool FontPlatformData::allowsLigatures() const
return ![[m_font coveredCharacterSet] characterIsMember:'a'];
}
+#if USE(CORE_TEXT)
+CTFontRef FontPlatformData::ctFont() const
+{
+ if (m_font)
+ return toCTFontRef(m_font);
+ if (!m_CTFont)
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0));
+ return m_CTFont.get();
+}
+#endif // USE(CORE_TEXT)
+
#ifndef NDEBUG
String FontPlatformData::description() const
{
diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
index 40e7bcf..1d6cc8e 100644
--- a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
+++ b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
@@ -35,6 +35,7 @@
#include "config.h"
#include "StringImpl.h"
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -45,7 +46,6 @@ typedef struct HFONT__ *HFONT;
namespace WebCore {
class FontDescription;
-class String;
class FontPlatformData {
public:
diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h
index e2abe2e..de12832 100644
--- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h
+++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h
@@ -33,6 +33,7 @@
#include "FontRenderStyle.h"
#include "StringImpl.h"
+#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
#include <wtf/text/CString.h>
#include <SkPaint.h>
@@ -45,7 +46,6 @@ struct HB_FaceRec_;
namespace WebCore {
class FontDescription;
-class String;
// -----------------------------------------------------------------------------
// FontPlatformData is the handle which WebKit has on a specific face. A face
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
index 9fc8917..8a9bde1 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
@@ -34,20 +34,22 @@
#include "GLES2Canvas.h"
+#include "Float32Array.h"
#include "FloatRect.h"
-#include "GLES2Context.h"
#include "GLES2Texture.h"
-
-#include <GLES2/gl2.h>
+#include "GraphicsContext3D.h"
+#include "PlatformString.h"
+#include "Uint16Array.h"
#define _USE_MATH_DEFINES
#include <math.h>
+#include <wtf/text/CString.h>
#include <wtf/OwnArrayPtr.h>
namespace WebCore {
-static inline void affineTo3x3(const AffineTransform& transform, GLfloat mat[9])
+static inline void affineTo3x3(const AffineTransform& transform, float mat[9])
{
mat[0] = transform.a();
mat[1] = transform.b();
@@ -73,8 +75,8 @@ struct GLES2Canvas::State {
AffineTransform m_ctm;
};
-GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size)
- : m_gles2Context(context)
+GLES2Canvas::GLES2Canvas(GraphicsContext3D* context, const IntSize& size)
+ : m_context(context)
, m_quadVertices(0)
, m_quadIndices(0)
, m_simpleProgram(0)
@@ -92,10 +94,8 @@ GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size)
m_flipMatrix.translate(-1.0f, 1.0f);
m_flipMatrix.scale(2.0f / size.width(), -2.0f / size.height());
- m_gles2Context->makeCurrent();
- m_gles2Context->resizeOffscreenContent(size);
- m_gles2Context->swapBuffers();
- glViewport(0, 0, size.width(), size.height());
+ m_context->reshape(size.width(), size.height());
+ m_context->viewport(0, 0, size.width(), size.height());
m_stateStack.append(State());
m_state = &m_stateStack.last();
@@ -107,69 +107,58 @@ GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size)
GLES2Canvas::~GLES2Canvas()
{
- m_gles2Context->makeCurrent();
- if (m_simpleProgram)
- glDeleteProgram(m_simpleProgram);
- if (m_texProgram)
- glDeleteProgram(m_texProgram);
- if (m_quadVertices)
- glDeleteBuffers(1, &m_quadVertices);
- if (m_quadIndices)
- glDeleteBuffers(1, &m_quadVertices);
+ m_context->deleteProgram(m_simpleProgram);
+ m_context->deleteProgram(m_texProgram);
+ m_context->deleteBuffer(m_quadVertices);
+ m_context->deleteBuffer(m_quadIndices);
}
void GLES2Canvas::clearRect(const FloatRect& rect)
{
- m_gles2Context->makeCurrent();
-
- glScissor(rect.x(), rect.y(), rect.width(), rect.height());
- glEnable(GL_SCISSOR_TEST);
- glClear(GL_COLOR_BUFFER_BIT);
- glDisable(GL_SCISSOR_TEST);
+ m_context->scissor(rect.x(), rect.y(), rect.width(), rect.height());
+ m_context->enable(GraphicsContext3D::SCISSOR_TEST);
+ m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+ m_context->disable(GraphicsContext3D::SCISSOR_TEST);
}
void GLES2Canvas::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
{
- m_gles2Context->makeCurrent();
-
- glBindBuffer(GL_ARRAY_BUFFER, getQuadVertices());
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, getQuadIndices());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
+ m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
float rgba[4];
color.getRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
- glUniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
+ m_context->uniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
+ m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
}
void GLES2Canvas::fillRect(const FloatRect& rect)
{
- m_gles2Context->makeCurrent();
-
applyCompositeOperator(m_state->m_compositeOp);
- glBindBuffer(GL_ARRAY_BUFFER, getQuadVertices());
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, getQuadIndices());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
+ m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
- glUseProgram(getSimpleProgram());
+ m_context->useProgram(getSimpleProgram());
float rgba[4];
m_state->m_fillColor.getRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
- glUniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
+ m_context->uniform4f(m_simpleColorLocation, rgba[0] * rgba[3], rgba[1] * rgba[3], rgba[2] * rgba[3], rgba[3]);
AffineTransform matrix(m_flipMatrix);
matrix.multLeft(m_state->m_ctm);
matrix.translate(rect.x(), rect.y());
matrix.scale(rect.width(), rect.height());
- GLfloat mat[9];
+ float mat[9];
affineTo3x3(matrix, mat);
- glUniformMatrix3fv(m_simpleMatrixLocation, 1, GL_FALSE, mat);
+ m_context->uniformMatrix3fv(m_simpleMatrixLocation, false /*transpose*/, mat, 1 /*count*/);
- glVertexAttribPointer(m_simplePositionLocation, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(0));
+ m_context->vertexAttribPointer(m_simplePositionLocation, 3, GraphicsContext3D::FLOAT, false, 0, 0);
- glEnableVertexAttribArray(m_simplePositionLocation);
+ m_context->enableVertexAttribArray(m_simplePositionLocation);
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
+ m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
}
void GLES2Canvas::setFillColor(const Color& color, ColorSpace colorSpace)
@@ -222,49 +211,47 @@ void GLES2Canvas::drawTexturedRect(GLES2Texture* texture, const FloatRect& srcRe
void GLES2Canvas::drawTexturedRect(GLES2Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp)
{
- m_gles2Context->makeCurrent();
-
applyCompositeOperator(compositeOp);
- glBindBuffer(GL_ARRAY_BUFFER, getQuadVertices());
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, getQuadIndices());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, getQuadVertices());
+ m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, getQuadIndices());
checkGLError("glBindBuffer");
- glUseProgram(getTexProgram());
+ m_context->useProgram(getTexProgram());
checkGLError("glUseProgram");
- glActiveTexture(GL_TEXTURE0);
+ m_context->activeTexture(GraphicsContext3D::TEXTURE0);
texture->bind();
- glUniform1i(m_texSamplerLocation, 0);
+ m_context->uniform1i(m_texSamplerLocation, 0);
checkGLError("glUniform1i");
- glUniform1f(m_texAlphaLocation, alpha);
+ m_context->uniform1f(m_texAlphaLocation, alpha);
checkGLError("glUniform1f for alpha");
AffineTransform matrix(m_flipMatrix);
matrix.multLeft(transform);
matrix.translate(dstRect.x(), dstRect.y());
matrix.scale(dstRect.width(), dstRect.height());
- GLfloat mat[9];
+ float mat[9];
affineTo3x3(matrix, mat);
- glUniformMatrix3fv(m_texMatrixLocation, 1, GL_FALSE, mat);
+ m_context->uniformMatrix3fv(m_texMatrixLocation, false /*transpose*/, mat, 1 /*count*/);
checkGLError("glUniformMatrix3fv");
AffineTransform texMatrix;
texMatrix.scale(1.0f / texture->width(), 1.0f / texture->height());
texMatrix.translate(srcRect.x(), srcRect.y());
texMatrix.scale(srcRect.width(), srcRect.height());
- GLfloat texMat[9];
+ float texMat[9];
affineTo3x3(texMatrix, texMat);
- glUniformMatrix3fv(m_texTexMatrixLocation, 1, GL_FALSE, texMat);
+ m_context->uniformMatrix3fv(m_texTexMatrixLocation, false /*transpose*/, texMat, 1 /*count*/);
checkGLError("glUniformMatrix3fv");
- glVertexAttribPointer(m_texPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(0));
+ m_context->vertexAttribPointer(m_texPositionLocation, 3, GraphicsContext3D::FLOAT, false, 0, 0);
- glEnableVertexAttribArray(m_texPositionLocation);
+ m_context->enableVertexAttribArray(m_texPositionLocation);
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
+ m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0);
checkGLError("glDrawElements");
}
@@ -280,56 +267,56 @@ void GLES2Canvas::applyCompositeOperator(CompositeOperator op)
switch (op) {
case CompositeClear:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_ZERO);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ZERO, GraphicsContext3D::ZERO);
break;
case CompositeCopy:
- glDisable(GL_BLEND);
+ m_context->disable(GraphicsContext3D::BLEND);
break;
case CompositeSourceOver:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA);
break;
case CompositeSourceIn:
- glEnable(GL_BLEND);
- glBlendFunc(GL_DST_ALPHA, GL_ZERO);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::DST_ALPHA, GraphicsContext3D::ZERO);
break;
case CompositeSourceOut:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE_MINUS_DST_ALPHA, GraphicsContext3D::ZERO);
break;
case CompositeSourceAtop:
- glEnable(GL_BLEND);
- glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::DST_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA);
break;
case CompositeDestinationOver:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE_MINUS_DST_ALPHA, GraphicsContext3D::ONE);
break;
case CompositeDestinationIn:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ZERO, GraphicsContext3D::SRC_ALPHA);
break;
case CompositeDestinationOut:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ZERO, GraphicsContext3D::ONE_MINUS_SRC_ALPHA);
break;
case CompositeDestinationAtop:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE_MINUS_DST_ALPHA, GraphicsContext3D::SRC_ALPHA);
break;
case CompositeXOR:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE_MINUS_DST_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA);
break;
case CompositePlusDarker:
case CompositeHighlight:
// unsupported
- glDisable(GL_BLEND);
+ m_context->disable(GraphicsContext3D::BLEND);
break;
case CompositePlusLighter:
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
+ m_context->enable(GraphicsContext3D::BLEND);
+ m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE);
break;
}
m_lastCompositeOp = op;
@@ -338,13 +325,14 @@ void GLES2Canvas::applyCompositeOperator(CompositeOperator op)
unsigned GLES2Canvas::getQuadVertices()
{
if (!m_quadVertices) {
- GLfloat vertices[] = { 0.0f, 0.0f, 1.0f,
- 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 1.0f };
- glGenBuffers(1, &m_quadVertices);
- glBindBuffer(GL_ARRAY_BUFFER, m_quadVertices);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
+ float vertices[] = { 0.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f,
+ 0.0f, 1.0f, 1.0f };
+ m_quadVertices = m_context->createBuffer();
+ RefPtr<Float32Array> vertexArray = Float32Array::create(vertices, sizeof(vertices) / sizeof(float));
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_quadVertices);
+ m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, vertexArray.get(), GraphicsContext3D::STATIC_DRAW);
}
return m_quadVertices;
}
@@ -353,32 +341,31 @@ unsigned GLES2Canvas::getQuadVertices()
unsigned GLES2Canvas::getQuadIndices()
{
if (!m_quadIndices) {
- GLushort indices[] = { 0, 1, 2, 0, 2, 3};
+ unsigned short indices[] = { 0, 1, 2, 0, 2, 3};
- glGenBuffers(1, &m_quadIndices);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadIndices);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
+ m_quadIndices = m_context->createBuffer();
+ RefPtr<Uint16Array> indexArray = Uint16Array::create(indices, sizeof(indices) / sizeof(unsigned short));
+ m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, m_quadIndices);
+ m_context->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indexArray.get(), GraphicsContext3D::STATIC_DRAW);
}
return m_quadIndices;
}
-static GLuint loadShader(GLenum type, const char* shaderSource)
+static unsigned loadShader(GraphicsContext3D* context, unsigned type, const char* shaderSource)
{
- GLuint shader = glCreateShader(type);
+ unsigned shader = context->createShader(type);
if (!shader)
return 0;
- glShaderSource(shader, 1, &shaderSource, 0);
- glCompileShader(shader);
- GLint compileStatus;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus);
+ String shaderSourceStr(shaderSource);
+ context->shaderSource(shader, shaderSourceStr);
+ context->compileShader(shader);
+ int compileStatus;
+ context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compileStatus);
if (!compileStatus) {
- int length;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
- OwnArrayPtr<char> log(new char[length]);
- glGetShaderInfoLog(shader, length, 0, log.get());
- LOG_ERROR(log.get());
- glDeleteShader(shader);
+ String infoLog = context->getShaderInfoLog(shader);
+ LOG_ERROR(infoLog.utf8().data());
+ context->deleteShader(shader);
return 0;
}
return shader;
@@ -387,7 +374,7 @@ static GLuint loadShader(GLenum type, const char* shaderSource)
unsigned GLES2Canvas::getSimpleProgram()
{
if (!m_simpleProgram) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER,
+ unsigned vertexShader = loadShader(m_context, GraphicsContext3D::VERTEX_SHADER,
"uniform mat3 matrix;\n"
"uniform vec4 color;\n"
"attribute vec3 position;\n"
@@ -396,7 +383,7 @@ unsigned GLES2Canvas::getSimpleProgram()
"}\n");
if (!vertexShader)
return 0;
- GLuint fragmentShader = loadShader(GL_FRAGMENT_SHADER,
+ unsigned fragmentShader = loadShader(m_context, GraphicsContext3D::FRAGMENT_SHADER,
"precision mediump float;\n"
"uniform mat3 matrix;\n"
"uniform vec4 color;\n"
@@ -405,23 +392,23 @@ unsigned GLES2Canvas::getSimpleProgram()
"}\n");
if (!fragmentShader)
return 0;
- m_simpleProgram = glCreateProgram();
+ m_simpleProgram = m_context->createProgram();
if (!m_simpleProgram)
return 0;
- glAttachShader(m_simpleProgram, vertexShader);
- glAttachShader(m_simpleProgram, fragmentShader);
- glLinkProgram(m_simpleProgram);
- GLint linkStatus;
- glGetProgramiv(m_simpleProgram, GL_LINK_STATUS, &linkStatus);
+ m_context->attachShader(m_simpleProgram, vertexShader);
+ m_context->attachShader(m_simpleProgram, fragmentShader);
+ m_context->linkProgram(m_simpleProgram);
+ int linkStatus;
+ m_context->getProgramiv(m_simpleProgram, GraphicsContext3D::LINK_STATUS, &linkStatus);
if (!linkStatus) {
- glDeleteProgram(m_simpleProgram);
+ m_context->deleteProgram(m_simpleProgram);
m_simpleProgram = 0;
}
- glDeleteShader(vertexShader);
- glDeleteShader(fragmentShader);
- m_simplePositionLocation = glGetAttribLocation(m_simpleProgram, "position");
- m_simpleMatrixLocation = glGetUniformLocation(m_simpleProgram, "matrix");
- m_simpleColorLocation = glGetUniformLocation(m_simpleProgram, "color");
+ m_context->deleteShader(vertexShader);
+ m_context->deleteShader(fragmentShader);
+ m_simplePositionLocation = m_context->getAttribLocation(m_simpleProgram, "position");
+ m_simpleMatrixLocation = m_context->getUniformLocation(m_simpleProgram, "matrix");
+ m_simpleColorLocation = m_context->getUniformLocation(m_simpleProgram, "color");
}
return m_simpleProgram;
}
@@ -429,7 +416,7 @@ unsigned GLES2Canvas::getSimpleProgram()
unsigned GLES2Canvas::getTexProgram()
{
if (!m_texProgram) {
- GLuint vertexShader = loadShader(GL_VERTEX_SHADER,
+ unsigned vertexShader = loadShader(m_context, GraphicsContext3D::VERTEX_SHADER,
"uniform mat3 matrix;\n"
"uniform mat3 texMatrix;\n"
"attribute vec3 position;\n"
@@ -440,7 +427,7 @@ unsigned GLES2Canvas::getTexProgram()
"}\n");
if (!vertexShader)
return 0;
- GLuint fragmentShader = loadShader(GL_FRAGMENT_SHADER,
+ unsigned fragmentShader = loadShader(m_context, GraphicsContext3D::FRAGMENT_SHADER,
"precision mediump float;\n"
"uniform sampler2D sampler;\n"
"uniform float alpha;\n"
@@ -450,25 +437,25 @@ unsigned GLES2Canvas::getTexProgram()
"}\n");
if (!fragmentShader)
return 0;
- m_texProgram = glCreateProgram();
+ m_texProgram = m_context->createProgram();
if (!m_texProgram)
return 0;
- glAttachShader(m_texProgram, vertexShader);
- glAttachShader(m_texProgram, fragmentShader);
- glLinkProgram(m_texProgram);
- GLint linkStatus;
- glGetProgramiv(m_texProgram, GL_LINK_STATUS, &linkStatus);
+ m_context->attachShader(m_texProgram, vertexShader);
+ m_context->attachShader(m_texProgram, fragmentShader);
+ m_context->linkProgram(m_texProgram);
+ int linkStatus;
+ m_context->getProgramiv(m_texProgram, GraphicsContext3D::LINK_STATUS, &linkStatus);
if (!linkStatus) {
- glDeleteProgram(m_texProgram);
+ m_context->deleteProgram(m_texProgram);
m_texProgram = 0;
}
- glDeleteShader(vertexShader);
- glDeleteShader(fragmentShader);
- m_texMatrixLocation = glGetUniformLocation(m_texProgram, "matrix");
- m_texSamplerLocation = glGetUniformLocation(m_texProgram, "sampler");
- m_texTexMatrixLocation = glGetUniformLocation(m_texProgram, "texMatrix");
- m_texPositionLocation = glGetAttribLocation(m_texProgram, "position");
- m_texAlphaLocation = glGetUniformLocation(m_texProgram, "alpha");
+ m_context->deleteShader(vertexShader);
+ m_context->deleteShader(fragmentShader);
+ m_texMatrixLocation = m_context->getUniformLocation(m_texProgram, "matrix");
+ m_texSamplerLocation = m_context->getUniformLocation(m_texProgram, "sampler");
+ m_texTexMatrixLocation = m_context->getUniformLocation(m_texProgram, "texMatrix");
+ m_texPositionLocation = m_context->getAttribLocation(m_texProgram, "position");
+ m_texAlphaLocation = m_context->getUniformLocation(m_texProgram, "alpha");
}
return m_texProgram;
}
@@ -479,7 +466,7 @@ GLES2Texture* GLES2Canvas::createTexture(NativeImagePtr ptr, GLES2Texture::Forma
if (texture)
return texture.get();
- texture = GLES2Texture::create(format, width, height);
+ texture = GLES2Texture::create(m_context, format, width, height);
GLES2Texture* t = texture.get();
m_textures.set(ptr, texture);
return t;
@@ -494,24 +481,24 @@ GLES2Texture* GLES2Canvas::getTexture(NativeImagePtr ptr)
void GLES2Canvas::checkGLError(const char* header)
{
#ifndef NDEBUG
- GLenum err;
- while ((err = glGetError()) != GL_NO_ERROR) {
+ unsigned err;
+ while ((err = m_context->getError()) != GraphicsContext3D::NO_ERROR) {
const char* errorStr = "*** UNKNOWN ERROR ***";
switch (err) {
- case GL_INVALID_ENUM:
- errorStr = "GL_INVALID_ENUM";
+ case GraphicsContext3D::INVALID_ENUM:
+ errorStr = "GraphicsContext3D::INVALID_ENUM";
break;
- case GL_INVALID_VALUE:
- errorStr = "GL_INVALID_VALUE";
+ case GraphicsContext3D::INVALID_VALUE:
+ errorStr = "GraphicsContext3D::INVALID_VALUE";
break;
- case GL_INVALID_OPERATION:
- errorStr = "GL_INVALID_OPERATION";
+ case GraphicsContext3D::INVALID_OPERATION:
+ errorStr = "GraphicsContext3D::INVALID_OPERATION";
break;
- case GL_INVALID_FRAMEBUFFER_OPERATION:
- errorStr = "GL_INVALID_FRAMEBUFFER_OPERATION";
+ case GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION:
+ errorStr = "GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION";
break;
- case GL_OUT_OF_MEMORY:
- errorStr = "GL_OUT_OF_MEMORY";
+ case GraphicsContext3D::OUT_OF_MEMORY:
+ errorStr = "GraphicsContext3D::OUT_OF_MEMORY";
break;
}
if (header)
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h
index 4e500be..cea90ae 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.h
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h
@@ -46,15 +46,15 @@
namespace WebCore {
-class FloatRect;
class Color;
-class GLES2Context;
+class FloatRect;
+class GraphicsContext3D;
typedef HashMap<NativeImagePtr, RefPtr<GLES2Texture> > TextureHashMap;
class GLES2Canvas : public Noncopyable {
public:
- GLES2Canvas(GLES2Context*, const IntSize&);
+ GLES2Canvas(GraphicsContext3D*, const IntSize&);
~GLES2Canvas();
void fillRect(const FloatRect&, const Color&, ColorSpace);
@@ -76,7 +76,7 @@ public:
// down into a PlatformContextGLES2 at some point.
void drawTexturedRect(GLES2Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator);
void drawTexturedRect(GLES2Texture*, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator);
- GLES2Context* gles2Context() { return m_gles2Context; }
+ GraphicsContext3D* context() { return m_context; }
GLES2Texture* createTexture(NativeImagePtr, GLES2Texture::Format, int width, int height);
GLES2Texture* getTexture(NativeImagePtr);
@@ -88,7 +88,7 @@ private:
unsigned getSimpleProgram();
unsigned getTexProgram();
- GLES2Context* m_gles2Context;
+ GraphicsContext3D* m_context;
struct State;
WTF::Vector<State> m_stateStack;
State* m_state;
diff --git a/WebCore/platform/graphics/chromium/GLES2Texture.cpp b/WebCore/platform/graphics/chromium/GLES2Texture.cpp
index 26c8bf7..5e8a141 100644
--- a/WebCore/platform/graphics/chromium/GLES2Texture.cpp
+++ b/WebCore/platform/graphics/chromium/GLES2Texture.cpp
@@ -34,14 +34,15 @@
#include "GLES2Texture.h"
-#include <GLES2/gl2.h>
+#include "GraphicsContext3D.h"
#include <wtf/OwnArrayPtr.h>
namespace WebCore {
-GLES2Texture::GLES2Texture(unsigned int textureId, Format format, int width, int height)
- : m_textureId(textureId)
+GLES2Texture::GLES2Texture(GraphicsContext3D* context, unsigned textureId, Format format, int width, int height)
+ : m_context(context)
+ , m_textureId(textureId)
, m_format(format)
, m_width(width)
, m_height(height)
@@ -50,25 +51,26 @@ GLES2Texture::GLES2Texture(unsigned int textureId, Format format, int width, int
GLES2Texture::~GLES2Texture()
{
- glDeleteTextures(1, &m_textureId);
+ m_context->deleteTexture(m_textureId);
}
-PassRefPtr<GLES2Texture> GLES2Texture::create(Format format, int width, int height)
+PassRefPtr<GLES2Texture> GLES2Texture::create(GraphicsContext3D* context, Format format, int width, int height)
{
- GLuint textureId;
- glGenTextures(1, &textureId);
- if (!textureId)
+ int max;
+ context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &max);
+ if (width > max || height > max) {
+ ASSERT(!"texture too big");
return 0;
+ }
- glBindTexture(GL_TEXTURE_2D, textureId);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ unsigned textureId = context->createTexture();
+ if (!textureId)
+ return 0;
- int max;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
- if (width > max || height > max)
- ASSERT(!"texture too big");
+ context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId);
+ context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, width, height, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0);
- return adoptRef(new GLES2Texture(textureId, format, width, height));
+ return adoptRef(new GLES2Texture(context, textureId, format, width, height));
}
static void convertFormat(GLES2Texture::Format format, unsigned int* glFormat, unsigned int* glType, bool* swizzle)
@@ -76,14 +78,14 @@ static void convertFormat(GLES2Texture::Format format, unsigned int* glFormat, u
*swizzle = false;
switch (format) {
case GLES2Texture::RGBA8:
- *glFormat = GL_RGBA;
- *glType = GL_UNSIGNED_BYTE;
+ *glFormat = GraphicsContext3D::RGBA;
+ *glType = GraphicsContext3D::UNSIGNED_BYTE;
break;
case GLES2Texture::BGRA8:
// FIXME: Once we have support for extensions, we should check for EXT_texture_format_BGRA8888,
// and use that if present.
- *glFormat = GL_RGBA;
- *glType = GL_UNSIGNED_BYTE;
+ *glFormat = GraphicsContext3D::RGBA;
+ *glType = GraphicsContext3D::UNSIGNED_BYTE;
*swizzle = true;
break;
default:
@@ -97,9 +99,9 @@ void GLES2Texture::load(void* pixels)
unsigned int glFormat, glType;
bool swizzle;
convertFormat(m_format, &glFormat, &glType, &swizzle);
- glBindTexture(GL_TEXTURE_2D, m_textureId);
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
if (swizzle) {
- ASSERT(glFormat == GL_RGBA && glType == GL_UNSIGNED_BYTE);
+ ASSERT(glFormat == GraphicsContext3D::RGBA && glType == GraphicsContext3D::UNSIGNED_BYTE);
// FIXME: This could use PBO's to save doing an extra copy here.
int size = m_width * m_height;
unsigned* pixels32 = static_cast<unsigned*>(pixels);
@@ -109,18 +111,18 @@ void GLES2Texture::load(void* pixels)
unsigned pixel = pixels32[i];
bufptr[i] = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16);
}
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, buf.get());
+ m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, buf.get());
} else
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, pixels);
+ m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, pixels);
}
void GLES2Texture::bind()
{
- glBindTexture(GL_TEXTURE_2D, m_textureId);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
+ m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
+ m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
+ m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
+ m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
}
}
diff --git a/WebCore/platform/graphics/chromium/GLES2Texture.h b/WebCore/platform/graphics/chromium/GLES2Texture.h
index 346365a..4d351cd 100644
--- a/WebCore/platform/graphics/chromium/GLES2Texture.h
+++ b/WebCore/platform/graphics/chromium/GLES2Texture.h
@@ -37,20 +37,22 @@
#include "RefPtr.h"
namespace WebCore {
+class GraphicsContext3D;
class GLES2Texture : public RefCounted<GLES2Texture> {
public:
~GLES2Texture();
enum Format { RGBA8, BGRA8 };
- static PassRefPtr<GLES2Texture> create(Format, int width, int height);
+ static PassRefPtr<GLES2Texture> create(GraphicsContext3D*, Format, int width, int height);
void bind();
void load(void* pixels);
Format format() const { return m_format; }
int width() const { return m_width; }
int height() const { return m_height; }
private:
- GLES2Texture(unsigned int textureId, Format format, int width, int height);
- unsigned int m_textureId;
+ GLES2Texture(GraphicsContext3D*, unsigned textureId, Format, int width, int height);
+ GraphicsContext3D* m_context;
+ unsigned m_textureId;
Format m_format;
int m_width;
int m_height;
diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
index a01a17f..1d67857 100644
--- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -53,7 +53,7 @@
#include "PlatformString.h"
#include "SystemTime.h"
#include "TransformLayerChromium.h"
-#include "WebGLLayerChromium.h"
+
#include <wtf/CurrentTime.h>
#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
@@ -69,7 +69,7 @@ static void setLayerBorderColor(LayerChromium& layer, const Color& color)
static void clearBorderColor(LayerChromium& layer)
{
- layer.setBorderColor(0);
+ layer.setBorderColor(static_cast<RGBA32>(0));
}
static void setLayerBackgroundColor(LayerChromium& layer, const Color& color)
@@ -79,7 +79,7 @@ static void setLayerBackgroundColor(LayerChromium& layer, const Color& color)
static void clearLayerBackgroundColor(LayerChromium& layer)
{
- layer.setBackgroundColor(0);
+ layer.setBackgroundColor(static_cast<RGBA32>(0));
}
GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayer::compositingCoordinatesOrientation()
@@ -285,6 +285,11 @@ void GraphicsLayerChromium::setOpacity(float opacity)
primaryLayer()->setOpacity(opacity);
}
+void GraphicsLayerChromium::setContentsNeedsDisplay()
+{
+ if (m_contentsLayer)
+ m_contentsLayer->setNeedsDisplay();
+}
void GraphicsLayerChromium::setNeedsDisplay()
{
if (drawsContent())
@@ -334,19 +339,17 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
updateSublayerList();
}
-#if ENABLE(3D_CANVAS)
-void GraphicsLayerChromium::setContentsToWebGL(PlatformLayer* platformLayer)
+void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
{
bool childrenChanged = false;
if (platformLayer) {
- if (!m_contentsLayer.get() || m_contentsLayerPurpose != ContentsLayerForWebGL) {
- WebGLLayerChromium* webGLLayer = static_cast<WebGLLayerChromium*>(platformLayer);
- setupContentsLayer(webGLLayer);
- m_contentsLayer = webGLLayer;
- m_contentsLayerPurpose = ContentsLayerForWebGL;
+ platformLayer->setOwner(this);
+ if (!m_contentsLayer.get() || m_contentsLayerPurpose != ContentsLayerForCanvas) {
+ setupContentsLayer(platformLayer);
+ m_contentsLayer = platformLayer;
+ m_contentsLayerPurpose = ContentsLayerForCanvas;
childrenChanged = true;
}
- platformLayer->setOwner(this);
platformLayer->setNeedsDisplay();
updateContentsRect();
} else {
@@ -361,7 +364,6 @@ void GraphicsLayerChromium::setContentsToWebGL(PlatformLayer* platformLayer)
if (childrenChanged)
updateSublayerList();
}
-#endif
void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
{
diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
index cd5e479..9dff66a 100644
--- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
@@ -81,12 +81,13 @@ public:
virtual void setNeedsDisplay();
virtual void setNeedsDisplayInRect(const FloatRect&);
+ virtual void setContentsNeedsDisplay();
virtual void setContentsRect(const IntRect&);
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
- virtual void setContentsToWebGL(PlatformLayer*);
+ virtual void setContentsToCanvas(PlatformLayer*);
virtual PlatformLayer* platformLayer() const;
@@ -137,7 +138,7 @@ private:
NoContentsLayer = 0,
ContentsLayerForImage,
ContentsLayerForVideo,
- ContentsLayerForWebGL
+ ContentsLayerForCanvas
};
ContentsLayerPurpose m_contentsLayerPurpose;
diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
index 7905601..9f6ee17 100644
--- a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
@@ -39,6 +39,13 @@
#include "PlatformContextSkia.h"
#endif
+#if PLATFORM(CG)
+#include <CoreGraphics/CGBitmapContext.h>
+#include <CoreGraphics/CGContext.h>
+#include <CoreGraphics/CGImage.h>
+#include <wtf/RetainPtr.h>
+#endif
+
namespace WebCore {
PassRefPtr<ImageLayerChromium> ImageLayerChromium::create(GraphicsLayerChromium* owner)
@@ -82,6 +89,43 @@ void ImageLayerChromium::updateTextureContents(unsigned textureId)
pixels = skiaBitmap->getPixels();
bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
}
+#elif PLATFORM(CG)
+ // NativeImagePtr is a CGImageRef on Mac OS X.
+ CGImageRef cgImage = m_contents;
+ int width = CGImageGetWidth(cgImage);
+ int height = CGImageGetHeight(cgImage);
+ requiredTextureSize = IntSize(width, height);
+ bitmapSize = requiredTextureSize;
+ // FIXME: we should get rid of this temporary copy where possible.
+ int tempRowBytes = width * 4;
+ Vector<uint8_t> tempVector;
+ tempVector.resize(height * tempRowBytes);
+ // Note we do not zero this vector since we are going to
+ // completely overwrite its contents with the image below.
+ // Try to reuse the color space from the image to preserve its colors.
+ // Some images use a color space (such as indexed) unsupported by the bitmap context.
+ RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGImageGetColorSpace(cgImage));
+ CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace.get());
+ switch (colorSpaceModel) {
+ case kCGColorSpaceModelMonochrome:
+ case kCGColorSpaceModelRGB:
+ case kCGColorSpaceModelCMYK:
+ case kCGColorSpaceModelLab:
+ case kCGColorSpaceModelDeviceN:
+ break;
+ default:
+ colorSpace.adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
+ break;
+ }
+ RetainPtr<CGContextRef> tempContext(AdoptCF, CGBitmapContextCreate(tempVector.data(),
+ width, height, 8, tempRowBytes,
+ colorSpace.get(),
+ kCGImageAlphaPremultipliedLast));
+ CGContextSetBlendMode(tempContext.get(), kCGBlendModeCopy);
+ CGContextDrawImage(tempContext.get(),
+ CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
+ cgImage);
+ pixels = tempVector.data();
#else
#error "Need to implement for your platform."
#endif
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index 3119dd6..bba65f4 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -56,26 +56,26 @@ PassRefPtr<LayerChromium> LayerChromium::create(GraphicsLayerChromium* owner)
}
LayerChromium::LayerChromium(GraphicsLayerChromium* owner)
- : m_needsDisplayOnBoundsChange(false)
- , m_owner(owner)
+ : m_owner(owner)
+ , m_contentsDirty(false)
, m_superlayer(0)
+ , m_anchorPoint(0.5, 0.5)
+ , m_backgroundColor(0, 0, 0, 0)
+ , m_borderColor(0, 0, 0, 0)
, m_layerRenderer(0)
+ , m_edgeAntialiasingMask(0)
+ , m_opacity(1.0)
+ , m_zPosition(0.0)
+ , m_anchorPointZ(0)
, m_borderWidth(0)
, m_allocatedTextureId(0)
- , m_borderColor(0, 0, 0, 0)
- , m_backgroundColor(0, 0, 0, 0)
- , m_anchorPoint(0.5, 0.5)
- , m_anchorPointZ(0)
, m_clearsContext(false)
, m_doubleSided(true)
- , m_edgeAntialiasingMask(0)
, m_hidden(false)
, m_masksToBounds(false)
- , m_opacity(1.0)
, m_opaque(true)
- , m_zPosition(0.0)
, m_geometryFlipped(false)
- , m_contentsDirty(false)
+ , m_needsDisplayOnBoundsChange(false)
{
}
@@ -162,6 +162,40 @@ void LayerChromium::updateTextureContents(unsigned textureId)
pixels = skiaBitmap->getPixels();
bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
}
+#elif PLATFORM(CG)
+ requiredTextureSize = m_bounds;
+ IntRect boundsRect(IntPoint(0, 0), m_bounds);
+
+ // If the texture needs to be reallocated then we must redraw the entire
+ // contents of the layer.
+ if (requiredTextureSize != m_allocatedTextureSize)
+ dirtyRect = boundsRect;
+ else {
+ // Clip the dirtyRect to the size of the layer to avoid drawing outside
+ // the bounds of the backing texture.
+ dirtyRect.intersect(boundsRect);
+ }
+
+ Vector<uint8_t> tempVector;
+ int rowBytes = 4 * dirtyRect.width();
+ tempVector.resize(rowBytes * dirtyRect.height());
+ memset(tempVector.data(), 0, tempVector.size());
+ // FIXME: unsure whether this is the best color space choice.
+ RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
+ RetainPtr<CGContextRef> contextCG(AdoptCF, CGBitmapContextCreate(tempVector.data(),
+ dirtyRect.width(), dirtyRect.height(), 8, rowBytes,
+ colorSpace.get(),
+ kCGImageAlphaPremultipliedLast));
+
+ GraphicsContext graphicsContext(contextCG.get());
+
+ // Translate the graphics contxt into the coordinate system of the dirty rect.
+ graphicsContext.translate(-dirtyRect.x(), -dirtyRect.y());
+
+ m_owner->paintGraphicsLayerContents(graphicsContext, dirtyRect);
+
+ pixels = tempVector.data();
+ bitmapSize = dirtyRect.size();
#else
#error "Need to implement for your platform."
#endif
@@ -187,7 +221,17 @@ void LayerChromium::updateTextureRect(void* pixels, const IntSize& bitmapSize, c
} else {
ASSERT(updateRect.width() <= m_allocatedTextureSize.width() && updateRect.height() <= m_allocatedTextureSize.height());
ASSERT(updateRect.width() == bitmapSize.width() && updateRect.height() == bitmapSize.height());
+#if PLATFORM(CG)
+ // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ updateRect.x(), m_allocatedTextureSize.height() - updateRect.height() - updateRect.y(),
+ updateRect.width(), updateRect.height(),
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+#elif PLATFORM(SKIA)
glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+#else
+#error "Need to implement for your platform."
+#endif
}
m_dirtyRect.setSize(FloatSize());
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index b071385..15acfa5 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -34,21 +34,25 @@
#if USE(ACCELERATED_COMPOSITING)
#include "LayerRendererChromium.h"
+#include "CanvasLayerChromium.h"
#include "GLES2Context.h"
#include "LayerChromium.h"
#include "NotImplemented.h"
#include "TransformLayerChromium.h"
-#include "WebGLLayerChromium.h"
#if PLATFORM(SKIA)
#include "NativeImageSkia.h"
#include "PlatformContextSkia.h"
+#elif PLATFORM(CG)
+#include <CoreGraphics/CGBitmapContext.h>
#endif
#include <GLES2/gl2.h>
namespace WebCore {
+#ifndef NDEBUG
static WTFLogChannel LogLayerRenderer = { 0x00000000, "LayerRenderer", WTFLogChannelOn };
+#endif
static void checkGLError()
{
@@ -195,12 +199,12 @@ PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GLES2
}
LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context)
- : m_rootLayer(0)
- , m_needsDisplay(false)
+ : m_rootLayerTextureWidth(0)
+ , m_rootLayerTextureHeight(0)
, m_positionLocation(0)
, m_texCoordLocation(1)
- , m_rootLayerTextureWidth(0)
- , m_rootLayerTextureHeight(0)
+ , m_rootLayer(0)
+ , m_needsDisplay(false)
, m_scrollPosition(IntPoint(-1, -1))
, m_currentShaderProgramType(NumShaderProgramTypes)
, m_gles2Context(gles2Context)
@@ -245,6 +249,19 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size)
m_rootLayerSkiaContext->setDrawingToImageBuffer(true);
#endif
m_rootLayerGraphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_rootLayerSkiaContext.get()));
+#elif PLATFORM(CG)
+ // Release the previous CGBitmapContext before reallocating the backing store as a precaution.
+ m_rootLayerCGContext.adoptCF(0);
+ int rowBytes = 4 * size.width();
+ m_rootLayerBackingStore.resize(rowBytes * size.height());
+ memset(m_rootLayerBackingStore.data(), 0, m_rootLayerBackingStore.size());
+ // FIXME: unsure whether this is the best color space choice.
+ RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
+ m_rootLayerCGContext.adoptCF(CGBitmapContextCreate(m_rootLayerBackingStore.data(),
+ size.width(), size.height(), 8, rowBytes,
+ colorSpace.get(),
+ kCGImageAlphaPremultipliedLast));
+ m_rootLayerGraphicsContext = new GraphicsContext(m_rootLayerCGContext.get());
#else
#error "Need to implement for your platform."
#endif
@@ -304,34 +321,51 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect&
// and viewport.
makeContextCurrent();
+ checkGLError();
+
glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId);
- unsigned visibleRectWidth = visibleRect.width();
- unsigned visibleRectHeight = visibleRect.height();
+ checkGLError();
+
+ int visibleRectWidth = visibleRect.width();
+ int visibleRectHeight = visibleRect.height();
if (visibleRectWidth != m_rootLayerTextureWidth || visibleRectHeight != m_rootLayerTextureHeight) {
m_rootLayerTextureWidth = visibleRect.width();
m_rootLayerTextureHeight = visibleRect.height();
- m_projectionMatrix = orthoMatrix(0, visibleRectWidth + 0.5, visibleRectHeight + 0.5, 0, -1000, 1000);
+ m_projectionMatrix = orthoMatrix(0, visibleRectWidth, visibleRectHeight, 0, -1000, 1000);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+
+ checkGLError();
}
// The GL viewport covers the entire visible area, including the scrollbars.
glViewport(0, 0, visibleRectWidth, visibleRectHeight);
+ checkGLError();
+
// The layer, scroll and debug border shaders all use the same vertex attributes
// so we can bind them only once.
glBindBuffer(GL_ARRAY_BUFFER, m_quadVboIds[Vertices]);
+ checkGLError();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadVboIds[LayerElements]);
+ checkGLError();
GLuint offset = 0;
glVertexAttribPointer(m_positionLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
+ checkGLError();
offset += 3 * sizeof(GLfloat);
glVertexAttribPointer(m_texCoordLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
+ checkGLError();
glEnableVertexAttribArray(m_positionLocation);
+ checkGLError();
glEnableVertexAttribArray(m_texCoordLocation);
+ checkGLError();
glActiveTexture(GL_TEXTURE0);
+ checkGLError();
glDisable(GL_DEPTH_TEST);
+ checkGLError();
glDisable(GL_CULL_FACE);
+ checkGLError();
if (m_scrollPosition == IntPoint(-1, -1))
m_scrollPosition = scrollPosition;
@@ -346,15 +380,28 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect&
// root layer texture. The newly exposed area is subesquently filled as usual with
// the contents of the updateRect.
TransformationMatrix scrolledLayerMatrix;
- scrolledLayerMatrix.translate3d((int)floorf(0.5 * visibleRect.width() + 0.5) - scrollDelta.x(),
- (int)floorf(0.5 * visibleRect.height() + 0.5) + scrollDelta.y(), 0);
+#if PLATFORM(SKIA)
+ float scaleFactor = 1.0f;
+#elif PLATFORM(CG)
+ // Because the contents of the OpenGL texture are inverted
+ // vertically compared to the Skia backend, we need to move
+ // the backing store in the opposite direction.
+ float scaleFactor = -1.0f;
+#else
+#error "Need to implement for your platform."
+#endif
+
+ scrolledLayerMatrix.translate3d((int)floorf(0.5 * visibleRect.width()) - scrollDelta.x(),
+ (int)floorf(0.5 * visibleRect.height()) + scaleFactor * scrollDelta.y(), 0);
scrolledLayerMatrix.scale3d(1, -1, 1);
// Switch shaders to avoid RGB swizzling.
useShaderProgram(ScrollLayerProgram);
glUniform1i(m_shaderPrograms[ScrollLayerProgram].m_samplerLocation, 0);
+ checkGLError();
drawTexturedQuad(scrolledLayerMatrix, visibleRect.width(), visibleRect.height(), 1);
+ checkGLError();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height());
@@ -381,31 +428,52 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect&
// Copy the contents of the updated rect to the root layer texture.
glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
checkGLError();
+#elif PLATFORM(CG)
+ // Get the contents of the updated rect.
+ ASSERT(static_cast<int>(CGBitmapContextGetWidth(m_rootLayerCGContext.get())) == updateRect.width() && static_cast<int>(CGBitmapContextGetHeight(m_rootLayerCGContext.get())) == updateRect.height());
+ void* pixels = m_rootLayerBackingStore.data();
+
+ checkGLError();
+ // Copy the contents of the updated rect to the root layer texture.
+ // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ updateRect.x(), m_rootLayerTextureHeight - updateRect.y() - updateRect.height(),
+ updateRect.width(), updateRect.height(),
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ checkGLError();
#else
-#error Must port to your platform
+#error "Need to implement for your platform."
#endif
}
glClearColor(0, 0, 1, 1);
+ checkGLError();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ checkGLError();
// Render the root layer using a quad that takes up the entire visible area of the window.
useShaderProgram(ContentLayerProgram);
+ checkGLError();
glUniform1i(m_samplerLocation, 0);
+ checkGLError();
TransformationMatrix layerMatrix;
- layerMatrix.translate3d(visibleRect.width() / 2, visibleRect.height() / 2, 0);
+ layerMatrix.translate3d(visibleRect.width() * 0.5f, visibleRect.height() * 0.5f, 0);
drawTexturedQuad(layerMatrix, visibleRect.width(), visibleRect.height(), 1);
+ checkGLError();
// If culling is enabled then we will cull the backface.
glCullFace(GL_BACK);
+ checkGLError();
// The orthographic projection is setup such that Y starts at zero and
// increases going down the page so we need to adjust the winding order of
// front facing triangles.
glFrontFace(GL_CW);
+ checkGLError();
// The shader used to render layers returns pre-multiplied alpha colors
// so we need to send the blending mode appropriately.
glEnable(GL_BLEND);
+ checkGLError();
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
checkGLError();
@@ -623,6 +691,7 @@ void LayerRendererChromium::drawLayer(LayerChromium* layer)
if (layer->contentsDirty()) {
// Update the backing texture contents for any dirty portion of the layer.
layer->updateTextureContents(textureId);
+ m_gles2Context->makeCurrent();
}
if (layer->doubleSided())
@@ -668,6 +737,9 @@ bool LayerRendererChromium::initializeSharedGLObjects()
" gl_Position = matrix * a_position; \n"
" v_texCoord = a_texCoord; \n"
"} \n";
+ // Note differences between Skia and Core Graphics versions:
+ // - Skia uses BGRA and origin is upper left
+ // - Core Graphics uses RGBA and origin is lower left
char fragmentShaderString[] =
"precision mediump float; \n"
"varying vec2 v_texCoord; \n"
@@ -675,8 +747,15 @@ bool LayerRendererChromium::initializeSharedGLObjects()
"uniform float alpha; \n"
"void main() \n"
"{ \n"
+#if PLATFORM(SKIA)
" vec4 texColor = texture2D(s_texture, v_texCoord); \n"
" gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; \n"
+#elif PLATFORM(CG)
+ " vec4 texColor = texture2D(s_texture, vec2(v_texCoord.x, 1.0 - v_texCoord.y)); \n"
+ " gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n"
+#else
+#error "Need to implement for your platform."
+#endif
"} \n";
// Fragment shader used for rendering the scrolled root layer quad. It differs
@@ -692,9 +771,9 @@ bool LayerRendererChromium::initializeSharedGLObjects()
" gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w); \n"
"} \n";
- // WebGL layers need to be flipped vertically and their colors shouldn't be
+ // Canvas layers need to be flipped vertically and their colors shouldn't be
// swizzled.
- char webGLFragmentShaderString[] =
+ char canvasFragmentShaderString[] =
"precision mediump float; \n"
"varying vec2 v_texCoord; \n"
"uniform sampler2D s_texture; \n"
@@ -741,11 +820,11 @@ bool LayerRendererChromium::initializeSharedGLObjects()
}
LayerChromium::setShaderProgramId(ContentLayerProgram);
- if (!createLayerShader(WebGLLayerProgram, vertexShaderString, webGLFragmentShaderString)) {
- LOG_ERROR("Failed to create shader program for WebGL layers");
+ if (!createLayerShader(CanvasLayerProgram, vertexShaderString, canvasFragmentShaderString)) {
+ LOG_ERROR("Failed to create shader program for Canvas layers");
return false;
}
- WebGLLayerChromium::setShaderProgramId(WebGLLayerProgram);
+ CanvasLayerChromium::setShaderProgramId(CanvasLayerProgram);
if (!createLayerShader(ScrollLayerProgram, vertexShaderString, scrollFragmentShaderString)) {
LOG_ERROR("Failed to create shader program for scrolling layer");
@@ -760,7 +839,7 @@ bool LayerRendererChromium::initializeSharedGLObjects()
// Specify the attrib location for the position and texCoord and make it the same for all programs to
// avoid binding re-binding the vertex attributes.
bindCommonAttribLocations(ContentLayerProgram);
- bindCommonAttribLocations(WebGLLayerProgram);
+ bindCommonAttribLocations(CanvasLayerProgram);
bindCommonAttribLocations(DebugBorderProgram);
bindCommonAttribLocations(ScrollLayerProgram);
@@ -775,7 +854,7 @@ bool LayerRendererChromium::initializeSharedGLObjects()
// Create a texture object to hold the contents of the root layer.
m_rootLayerTextureId = createLayerTexture();
- if (m_rootLayerTextureId == -1) {
+ if (!m_rootLayerTextureId) {
LOG_ERROR("Failed to create texture for root layer");
return false;
}
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index 3b89dc6..e4474b5 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -42,6 +42,11 @@
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
+#if PLATFORM(CG)
+#include <CoreGraphics/CGContext.h>
+#include <wtf/RetainPtr.h>
+#endif
+
namespace WebCore {
class GLES2Context;
@@ -83,7 +88,7 @@ public:
GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); }
private:
- enum ShaderProgramType { DebugBorderProgram, ScrollLayerProgram, ContentLayerProgram, WebGLLayerProgram, NumShaderProgramTypes };
+ enum ShaderProgramType { DebugBorderProgram, ScrollLayerProgram, ContentLayerProgram, CanvasLayerProgram, NumShaderProgramTypes };
void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect);
@@ -145,7 +150,12 @@ private:
OwnPtr<skia::PlatformCanvas> m_rootLayerCanvas;
OwnPtr<PlatformContextSkia> m_rootLayerSkiaContext;
OwnPtr<GraphicsContext> m_rootLayerGraphicsContext;
+#elif PLATFORM(CG)
+ Vector<uint8_t> m_rootLayerBackingStore;
+ RetainPtr<CGContextRef> m_rootLayerCGContext;
+ OwnPtr<GraphicsContext> m_rootLayerGraphicsContext;
#endif
+
IntSize m_rootLayerCanvasSize;
OwnPtr<GLES2Context> m_gles2Context;
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 5ac0e57..89b6ec1 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -31,9 +31,21 @@
#include "config.h"
#if USE(ACCELERATED_COMPOSITING)
-
#include "VideoLayerChromium.h"
+#include "LayerRendererChromium.h"
+#include "RenderLayerBacking.h"
+#include "skia/ext/platform_canvas.h"
+
+#include <GLES2/gl2.h>
+#define GL_GLEXT_PROTOTYPES
+#include <GLES2/gl2ext.h>
+
+#if PLATFORM(SKIA)
+#include "NativeImageSkia.h"
+#include "PlatformContextSkia.h"
+#endif
+
namespace WebCore {
PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner)
@@ -43,7 +55,136 @@ PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium*
VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner)
: LayerChromium(owner)
+ , m_allocatedTextureId(0)
+#if PLATFORM(SKIA)
+ , m_canvas(0)
+ , m_skiaContext(0)
+#endif
+ , m_graphicsContext(0)
+{
+}
+
+void VideoLayerChromium::updateTextureContents(unsigned textureId)
+{
+ RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
+ if (!backing || backing->paintingGoesToWindow())
+ return;
+
+ ASSERT(drawsContent());
+
+ IntRect dirtyRect(m_dirtyRect);
+ IntSize requiredTextureSize;
+
+#if PLATFORM(SKIA)
+ requiredTextureSize = m_bounds;
+ IntRect boundsRect(IntPoint(0, 0), m_bounds);
+
+ // If the texture needs to be reallocated, then we must redraw the entire
+ // contents of the layer.
+ if (requiredTextureSize != m_allocatedTextureSize)
+ dirtyRect = boundsRect;
+ else {
+ // Clip the dirtyRect to the size of the layer to avoid drawing outside
+ // the bounds of the backing texture.
+ dirtyRect.intersect(boundsRect);
+ }
+
+ if (!m_canvas.get()
+ || dirtyRect.width() != m_canvas->getDevice()->width()
+ || dirtyRect.height() != m_canvas->getDevice()->height()) {
+ m_canvas = new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), true);
+ m_skiaContext = new PlatformContextSkia(m_canvas.get());
+
+#if OS(WINDOWS)
+ // This is needed to get text to show up correctly. Without it,
+ // GDI renders with zero alpha and the text becomes invisible.
+ // Unfortunately, setting this to true disables cleartype.
+ // FIXME: Does this take us down a very slow text rendering path?
+ // FIXME: Why is this is a windows-only call?
+ m_skiaContext->setDrawingToImageBuffer(true);
+#endif
+ m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get()));
+ }
+
+ // Bring the canvas into the coordinate system of the paint rect.
+ m_canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y()));
+
+ // If the texture id or size changed since last time, then we need to tell GL
+ // to re-allocate a texture.
+ if (m_allocatedTextureId != textureId || requiredTextureSize != m_allocatedTextureSize)
+ createTextureRect(requiredTextureSize, dirtyRect, textureId);
+ else
+ updateTextureRect(dirtyRect, textureId);
+#else
+ // FIXME: Implement non-skia path
+ notImplemented();
+#endif
+}
+
+void VideoLayerChromium::createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId)
+{
+ // Paint into graphics context and get bitmap.
+ m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect);
+ void* pixels = 0;
+ IntSize bitmapSize = IntSize();
+#if PLATFORM(SKIA)
+ const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
+ const SkBitmap* skiaBitmap = &bitmap;
+ ASSERT(skiaBitmap);
+
+ SkAutoLockPixels lock(*skiaBitmap);
+ SkBitmap::Config skiaConfig = skiaBitmap->config();
+ // FIXME: Do we need to support more image configurations?
+ if (skiaConfig == SkBitmap::kARGB_8888_Config) {
+ pixels = skiaBitmap->getPixels();
+ bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
+ }
+#else
+ // FIXME: Implement non-skia path
+ notImplemented();
+#endif
+ if (!pixels)
+ return;
+
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ ASSERT(bitmapSize == requiredTextureSize);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+ m_allocatedTextureId = textureId;
+ m_allocatedTextureSize = requiredTextureSize;
+
+ updateCompleted();
+}
+
+void VideoLayerChromium::updateTextureRect(const IntRect& updateRect, unsigned textureId)
+{
+#if PLATFORM(SKIA)
+ const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true);
+ SkBitmap* skiaBitmap = const_cast<SkBitmap*>(&bitmap);
+ ASSERT(skiaBitmap);
+
+ SkAutoLockPixels lock(*skiaBitmap);
+ SkBitmap::Config skiaConfig = skiaBitmap->config();
+
+ if (skiaConfig == SkBitmap::kARGB_8888_Config) {
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ void* mem = glMapTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, GL_WRITE_ONLY);
+ skiaBitmap->setPixels(mem);
+ m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect);
+ glUnmapTexSubImage2D(mem);
+ }
+
+ updateCompleted();
+#else
+ // FIXME: Implement non-skia path
+ notImplemented();
+#endif
+}
+
+void VideoLayerChromium::updateCompleted()
{
+ m_dirtyRect.setSize(FloatSize());
+ m_contentsDirty = false;
}
}
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.h b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
index 1fa8009..746299f 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
@@ -43,9 +43,21 @@ class VideoLayerChromium : public LayerChromium {
public:
static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner = 0);
virtual bool drawsContent() { return true; }
+ virtual void updateTextureContents(unsigned textureId);
private:
VideoLayerChromium(GraphicsLayerChromium* owner);
+ void createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId);
+ void updateTextureRect(const IntRect& updateRect, unsigned textureId);
+ void updateCompleted();
+
+ unsigned m_allocatedTextureId;
+ IntSize m_allocatedTextureSize;
+#if PLATFORM(SKIA)
+ OwnPtr<skia::PlatformCanvas> m_canvas;
+ OwnPtr<PlatformContextSkia> m_skiaContext;
+#endif
+ OwnPtr<GraphicsContext> m_graphicsContext;
};
}
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index d65bdbc..f2f684b 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -25,6 +25,7 @@
#if ENABLE(VIDEO)
+#include <wtf/Forward.h>
#include "MediaPlayerPrivate.h"
#include "Timer.h"
@@ -42,7 +43,6 @@ namespace WebCore {
class GraphicsContext;
class IntSize;
class IntRect;
-class String;
class GStreamerGWorld;
gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
index 9db6cc6..a7dfe37 100644
--- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
@@ -22,13 +22,13 @@
#define FontCustomPlatformData_h
#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class FontPlatformData;
class SharedBuffer;
- class String;
struct FontCustomPlatformData : Noncopyable {
public:
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h
index b520d33..85407c7 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.h
+++ b/WebCore/platform/graphics/mac/ComplexTextController.h
@@ -127,7 +127,7 @@ private:
unsigned m_stringLocation;
size_t m_stringLength;
#if USE(CORE_TEXT)
- RetainPtr<CFMutableDataRef> m_coreTextIndicesData;
+ Vector<CFIndex, 64> m_coreTextIndicesVector;
const CFIndex* m_coreTextIndices;
#endif
#if USE(ATSUI)
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index fba3d4b..744e6d4 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -51,10 +51,9 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
if (!m_coreTextIndices) {
- m_coreTextIndicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
- CFDataIncreaseLength(m_coreTextIndicesData.get(), m_glyphCount * sizeof(CFIndex));
- m_coreTextIndices = reinterpret_cast<const CFIndex*>(CFDataGetMutableBytePtr(m_coreTextIndicesData.get()));
- CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), const_cast<CFIndex*>(m_coreTextIndices));
+ m_coreTextIndicesVector.grow(m_glyphCount);
+ CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), m_coreTextIndicesVector.data());
+ m_coreTextIndices = m_coreTextIndicesVector.data();
}
m_glyphs = CTRunGetGlyphsPtr(m_coreTextRun.get());
@@ -70,17 +69,16 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
CTRunGetAdvances(m_coreTextRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
m_advances = m_advancesVector.data();
}
-
}
// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bool ltr)
{
- Vector<CFIndex, 16> indices;
+ m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength);
unsigned r = 0;
while (r < m_stringLength) {
- indices.append(r);
+ m_coreTextIndicesVector.uncheckedAppend(r);
if (U_IS_SURROGATE(m_characters[r])) {
ASSERT(r + 1 < m_stringLength);
ASSERT(U_IS_SURROGATE_LEAD(m_characters[r]));
@@ -89,14 +87,12 @@ void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bo
} else
r++;
}
- m_glyphCount = indices.size();
+ m_glyphCount = m_coreTextIndicesVector.size();
if (!ltr) {
for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
- std::swap(indices[r], indices[end]);
+ std::swap(m_coreTextIndicesVector[r], m_coreTextIndicesVector[end]);
}
- m_coreTextIndicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
- CFDataAppendBytes(m_coreTextIndicesData.get(), reinterpret_cast<const UInt8*>(indices.data()), m_glyphCount * sizeof(CFIndex));
- m_coreTextIndices = reinterpret_cast<const CFIndex*>(CFDataGetBytePtr(m_coreTextIndicesData.get()));
+ m_coreTextIndices = m_coreTextIndicesVector.data();
// Synthesize a run of missing glyphs.
m_glyphsVector.fill(0, m_glyphCount);
@@ -120,7 +116,7 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
- RetainPtr<CTTypesetterRef> typesetter;
+ RetainPtr<CTLineRef> line;
if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) {
static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLevel };
@@ -130,11 +126,11 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) };
static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- typesetter.adoptCF(CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
- } else
- typesetter.adoptCF(CTTypesetterCreateWithAttributedString(attributedString.get()));
+ RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
- RetainPtr<CTLineRef> line(AdoptCF, CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
+ line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
+ } else
+ line.adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
index f2cd2cc..90440d5 100644
--- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
@@ -23,6 +23,7 @@
#include "FontRenderingMode.h"
#include <CoreFoundation/CFBase.h>
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
typedef struct CGFont* CGFontRef;
@@ -33,7 +34,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformData : Noncopyable {
FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont)
diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm
index aeb0ab2..db77402 100644
--- a/WebCore/platform/graphics/mac/FontMac.mm
+++ b/WebCore/platform/graphics/mac/FontMac.mm
@@ -64,7 +64,7 @@ static void showGlyphsWithAdvances(const FontPlatformData& font, CGContextRef co
positions[i].x = positions[i - 1].x + advance.width;
positions[i].y = positions[i - 1].y + advance.height;
}
- CTFontDrawGlyphs(toCTFontRef(font.font()), glyphs, positions.data(), count, context);
+ CTFontDrawGlyphs(font.ctFont(), glyphs, positions.data(), count, context);
}
#endif
}
diff --git a/WebCore/platform/graphics/mac/FontPlatformData.h b/WebCore/platform/graphics/mac/FontPlatformData.h
index f4c92be..07ae4f8 100644
--- a/WebCore/platform/graphics/mac/FontPlatformData.h
+++ b/WebCore/platform/graphics/mac/FontPlatformData.h
@@ -2,7 +2,7 @@
* This file is part of the internal font implementation.
* It should not be included by source files outside of it.
*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -39,14 +39,13 @@ typedef const struct __CTFont* CTFontRef;
#include <CoreFoundation/CFBase.h>
#include <objc/objc-auto.h>
+#include <wtf/Forward.h>
#include <wtf/RetainPtr.h>
typedef UInt32 ATSUFontID;
namespace WebCore {
-class String;
-
#ifndef BUILDING_ON_TIGER
inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef>(nsFont); }
#endif
@@ -114,6 +113,10 @@ class FontPlatformData {
NSFont *font() const { return m_font; }
void setFont(NSFont *font);
+#if USE(CORE_TEXT)
+ CTFontRef ctFont() const;
+#endif
+
bool roundsGlyphAdvances() const;
bool allowsLigatures() const;
bool isColorBitmapFont() const { return m_isColorBitmapFont; }
@@ -132,12 +135,17 @@ private:
static NSFont *hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); }
NSFont *m_font;
+
#ifndef BUILDING_ON_TIGER
RetainPtr<CGFontRef> m_cgFont;
#else
CGFontRef m_cgFont; // It is not necessary to refcount this, since either an NSFont owns it or some CachedFont has it referenced.
#endif
+#if USE(CORE_TEXT)
+ mutable RetainPtr<CTFontRef> m_CTFont;
+#endif
+
bool m_isColorBitmapFont;
};
diff --git a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
index aebd9f7..33de3c3 100644
--- a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
+++ b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
@@ -61,6 +61,9 @@ FontPlatformData::FontPlatformData(const FontPlatformData& f)
m_cgFont = f.m_cgFont;
m_atsuFontID = f.m_atsuFontID;
m_isColorBitmapFont = f.m_isColorBitmapFont;
+#if USE(CORE_TEXT)
+ m_CTFont = f.m_CTFont;
+#endif
}
FontPlatformData:: ~FontPlatformData()
@@ -84,6 +87,9 @@ const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& f)
CFRelease(m_font);
m_font = f.m_font;
m_isColorBitmapFont = f.m_isColorBitmapFont;
+#if USE(CORE_TEXT)
+ m_CTFont = f.m_CTFont;
+#endif
return *this;
}
@@ -107,6 +113,9 @@ void FontPlatformData::setFont(NSFont *font)
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
m_isColorBitmapFont = CTFontGetSymbolicTraits(toCTFontRef(font)) & kCTFontColorGlyphsTrait;
#endif
+#if USE(CORE_TEXT)
+ m_CTFont = 0;
+#endif
}
bool FontPlatformData::roundsGlyphAdvances() const
@@ -119,6 +128,17 @@ bool FontPlatformData::allowsLigatures() const
return ![[m_font coveredCharacterSet] characterIsMember:'a'];
}
+#if USE(CORE_TEXT)
+CTFontRef FontPlatformData::ctFont() const
+{
+ if (m_font)
+ return toCTFontRef(m_font);
+ if (!m_CTFont)
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0));
+ return m_CTFont.get();
+}
+#endif // USE(CORE_TEXT)
+
#ifndef NDEBUG
String FontPlatformData::description() const
{
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
index 30c3b8e..fd503fc 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
@@ -30,25 +30,19 @@
#include "GraphicsContext3D.h"
#import "BlockExceptions.h"
-#include "CanvasObject.h"
-#include "ImageBuffer.h"
-#include "NotImplemented.h"
-#include "WebGLActiveInfo.h"
+
#include "ArrayBuffer.h"
#include "ArrayBufferView.h"
-#include "WebGLBuffer.h"
+#include "WebGLObject.h"
+#include "CanvasRenderingContext.h"
#include "Float32Array.h"
-#include "WebGLFramebuffer.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
+#include "ImageBuffer.h"
#include "Int32Array.h"
-#include "WebGLLayer.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLRenderingContext.h"
-#include "WebGLShader.h"
-#include "WebGLTexture.h"
+#include "NotImplemented.h"
#include "Uint8Array.h"
+#include "WebGLLayer.h"
#include <CoreGraphics/CGBitmapContext.h>
#include <OpenGL/CGLRenderers.h>
#include <OpenGL/gl.h>
@@ -240,7 +234,7 @@ void GraphicsContext3D::makeContextCurrent()
CGLSetCurrentContext(m_contextObj);
}
-void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* context)
+void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
HTMLCanvasElement* canvas = context->canvas();
ImageBuffer* imageBuffer = canvas->buffer();
@@ -288,7 +282,7 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* con
canvas->width(), canvas->height(), imageBuffer->context()->platformContext());
}
-void GraphicsContext3D::beginPaint(WebGLRenderingContext* context)
+void GraphicsContext3D::beginPaint(CanvasRenderingContext* context)
{
UNUSED_PARAM(context);
}
@@ -461,34 +455,34 @@ void GraphicsContext3D::activeTexture(unsigned long texture)
::glActiveTexture(texture);
}
-void GraphicsContext3D::attachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::attachShader(Platform3DObject program, Platform3DObject shader)
{
ASSERT(program);
ASSERT(shader);
ensureContext(m_contextObj);
- ::glAttachShader((GLuint) program->object(), (GLuint) shader->object());
+ ::glAttachShader((GLuint) program, (GLuint) shader);
}
-void GraphicsContext3D::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name)
+void GraphicsContext3D::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glBindAttribLocation((GLuint) program->object(), index, name.utf8().data());
+ ::glBindAttribLocation((GLuint) program, index, name.utf8().data());
}
-void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer* buffer)
+void GraphicsContext3D::bindBuffer(unsigned long target, Platform3DObject buffer)
{
ensureContext(m_contextObj);
- ::glBindBuffer(target, buffer ? (GLuint) buffer->object() : 0);
+ ::glBindBuffer(target, (GLuint) buffer);
}
-void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer)
+void GraphicsContext3D::bindFramebuffer(unsigned long target, Platform3DObject buffer)
{
ensureContext(m_contextObj);
GLuint fbo;
- if (buffer && buffer->object())
- fbo = (GLuint)buffer->object();
+ if (buffer)
+ fbo = (GLuint)buffer;
else
fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo);
if (fbo != m_boundFBO) {
@@ -497,17 +491,17 @@ void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer*
}
}
-void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
+void GraphicsContext3D::bindRenderbuffer(unsigned long target, Platform3DObject renderbuffer)
{
ensureContext(m_contextObj);
- ::glBindRenderbufferEXT(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
+ ::glBindRenderbufferEXT(target, (GLuint) renderbuffer);
}
-void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture* texture)
+void GraphicsContext3D::bindTexture(unsigned long target, Platform3DObject texture)
{
ensureContext(m_contextObj);
- ::glBindTexture(target, texture ? (GLuint) texture->object() : 0);
+ ::glBindTexture(target, (GLuint) texture);
}
void GraphicsContext3D::blendColor(double red, double green, double blue, double alpha)
@@ -619,11 +613,11 @@ void GraphicsContext3D::colorMask(bool red, bool green, bool blue, bool alpha)
::glColorMask(red, green, blue, alpha);
}
-void GraphicsContext3D::compileShader(WebGLShader* shader)
+void GraphicsContext3D::compileShader(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
- ::glCompileShader((GLuint) shader->object());
+ ::glCompileShader((GLuint) shader);
}
void GraphicsContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border)
@@ -678,12 +672,12 @@ void GraphicsContext3D::depthRange(double zNear, double zFar)
::glDepthRange(zNear, zFar);
}
-void GraphicsContext3D::detachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::detachShader(Platform3DObject program, Platform3DObject shader)
{
ASSERT(program);
ASSERT(shader);
ensureContext(m_contextObj);
- ::glDetachShader((GLuint) program->object(), (GLuint) shader->object());
+ ::glDetachShader((GLuint) program, (GLuint) shader);
}
void GraphicsContext3D::disable(unsigned long cap)
@@ -734,10 +728,10 @@ void GraphicsContext3D::flush()
::glFlush();
}
-void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer)
+void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject buffer)
{
ensureContext(m_contextObj);
- GLuint renderbuffer = (buffer ? (GLuint) buffer->object() : 0);
+ GLuint renderbuffer = (GLuint) buffer;
if (attachment == DEPTH_STENCIL_ATTACHMENT) {
::glFramebufferRenderbufferEXT(target, DEPTH_ATTACHMENT, renderbuffertarget, renderbuffer);
::glFramebufferRenderbufferEXT(target, STENCIL_ATTACHMENT, renderbuffertarget, renderbuffer);
@@ -745,10 +739,10 @@ void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned l
::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
}
-void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level)
+void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject texture, long level)
{
ensureContext(m_contextObj);
- ::glFramebufferTexture2DEXT(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);
+ ::glFramebufferTexture2DEXT(target, attachment, textarget, (GLuint) texture, level);
}
void GraphicsContext3D::frontFace(unsigned long mode)
@@ -763,20 +757,20 @@ void GraphicsContext3D::generateMipmap(unsigned long target)
::glGenerateMipmapEXT(target);
}
-bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
ensureContext(m_contextObj);
GLint maxAttributeSize = 0;
- ::glGetProgramiv(static_cast<GLuint>(program->object()), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
+ ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
GLchar name[maxAttributeSize]; // GL_ACTIVE_ATTRIBUTE_MAX_LENGTH includes null termination
GLsizei nameLength = 0;
GLint size = 0;
GLenum type = 0;
- ::glGetActiveAttrib(static_cast<GLuint>(program->object()), index, maxAttributeSize, &nameLength, &size, &type, name);
+ ::glGetActiveAttrib(static_cast<GLuint>(program), index, maxAttributeSize, &nameLength, &size, &type, name);
if (!nameLength)
return false;
info.name = String(name, nameLength);
@@ -785,20 +779,20 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
return true;
}
-bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
ensureContext(m_contextObj);
GLint maxUniformSize = 0;
- ::glGetProgramiv(static_cast<GLuint>(program->object()), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
+ ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
GLchar name[maxUniformSize]; // GL_ACTIVE_UNIFORM_MAX_LENGTH includes null termination
GLsizei nameLength = 0;
GLint size = 0;
GLenum type = 0;
- ::glGetActiveUniform(static_cast<GLuint>(program->object()), index, maxUniformSize, &nameLength, &size, &type, name);
+ ::glGetActiveUniform(static_cast<GLuint>(program), index, maxUniformSize, &nameLength, &size, &type, name);
if (!nameLength)
return false;
info.name = String(name, nameLength);
@@ -807,23 +801,23 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
return true;
}
-void GraphicsContext3D::getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders)
+void GraphicsContext3D::getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders)
{
- if (!program || !program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return;
}
ensureContext(m_contextObj);
- ::glGetAttachedShaders(static_cast<GLuint>(program->object()), maxCount, count, shaders);
+ ::glGetAttachedShaders(static_cast<GLuint>(program), maxCount, count, shaders);
}
-int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& name)
+int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name)
{
if (!program)
return -1;
ensureContext(m_contextObj);
- return ::glGetAttribLocation((GLuint) program->object(), name.utf8().data());
+ return ::glGetAttribLocation((GLuint) program, name.utf8().data());
}
GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
@@ -856,13 +850,13 @@ void GraphicsContext3D::hint(unsigned long target, unsigned long mode)
::glHint(target, mode);
}
-bool GraphicsContext3D::isBuffer(WebGLBuffer* buffer)
+bool GraphicsContext3D::isBuffer(Platform3DObject buffer)
{
if (!buffer)
return false;
ensureContext(m_contextObj);
- return ::glIsBuffer((GLuint) buffer->object());
+ return ::glIsBuffer((GLuint) buffer);
}
bool GraphicsContext3D::isEnabled(unsigned long cap)
@@ -871,49 +865,49 @@ bool GraphicsContext3D::isEnabled(unsigned long cap)
return ::glIsEnabled(cap);
}
-bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer)
+bool GraphicsContext3D::isFramebuffer(Platform3DObject framebuffer)
{
if (!framebuffer)
return false;
ensureContext(m_contextObj);
- return ::glIsFramebufferEXT((GLuint) framebuffer->object());
+ return ::glIsFramebufferEXT((GLuint) framebuffer);
}
-bool GraphicsContext3D::isProgram(WebGLProgram* program)
+bool GraphicsContext3D::isProgram(Platform3DObject program)
{
if (!program)
return false;
ensureContext(m_contextObj);
- return ::glIsProgram((GLuint) program->object());
+ return ::glIsProgram((GLuint) program);
}
-bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
+bool GraphicsContext3D::isRenderbuffer(Platform3DObject renderbuffer)
{
if (!renderbuffer)
return false;
ensureContext(m_contextObj);
- return ::glIsRenderbufferEXT((GLuint) renderbuffer->object());
+ return ::glIsRenderbufferEXT((GLuint) renderbuffer);
}
-bool GraphicsContext3D::isShader(WebGLShader* shader)
+bool GraphicsContext3D::isShader(Platform3DObject shader)
{
if (!shader)
return false;
ensureContext(m_contextObj);
- return ::glIsShader((GLuint) shader->object());
+ return ::glIsShader((GLuint) shader);
}
-bool GraphicsContext3D::isTexture(WebGLTexture* texture)
+bool GraphicsContext3D::isTexture(Platform3DObject texture)
{
if (!texture)
return false;
ensureContext(m_contextObj);
- return ::glIsTexture((GLuint) texture->object());
+ return ::glIsTexture((GLuint) texture);
}
void GraphicsContext3D::lineWidth(double width)
@@ -922,11 +916,11 @@ void GraphicsContext3D::lineWidth(double width)
::glLineWidth(static_cast<float>(width));
}
-void GraphicsContext3D::linkProgram(WebGLProgram* program)
+void GraphicsContext3D::linkProgram(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glLinkProgram((GLuint) program->object());
+ ::glLinkProgram((GLuint) program);
}
void GraphicsContext3D::pixelStorei(unsigned long pname, long param)
@@ -999,7 +993,7 @@ void GraphicsContext3D::scissor(long x, long y, unsigned long width, unsigned lo
::glScissor(x, y, width, height);
}
-void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& string)
+void GraphicsContext3D::shaderSource(Platform3DObject shader, const String& string)
{
ASSERT(shader);
@@ -1008,7 +1002,7 @@ void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& string)
const char* s = cs.data();
int length = string.length();
- ::glShaderSource((GLuint) shader->object(), 1, &s, &length);
+ ::glShaderSource((GLuint) shader, 1, &s, &length);
}
void GraphicsContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask)
@@ -1182,18 +1176,18 @@ void GraphicsContext3D::uniformMatrix4fv(long location, bool transpose, float* a
::glUniformMatrix4fv(location, size, transpose, array);
}
-void GraphicsContext3D::useProgram(WebGLProgram* program)
+void GraphicsContext3D::useProgram(Platform3DObject program)
{
ensureContext(m_contextObj);
- ::glUseProgram(program ? ((GLuint) program->object()) : 0);
+ ::glUseProgram((GLuint) program);
}
-void GraphicsContext3D::validateProgram(WebGLProgram* program)
+void GraphicsContext3D::validateProgram(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glValidateProgram((GLuint) program->object());
+ ::glValidateProgram((GLuint) program);
}
void GraphicsContext3D::vertexAttrib1f(unsigned long indx, float v0)
@@ -1316,26 +1310,26 @@ void GraphicsContext3D::getIntegerv(unsigned long pname, int* value)
}
}
-void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long pname, int* value)
+void GraphicsContext3D::getProgramiv(Platform3DObject program, unsigned long pname, int* value)
{
ensureContext(m_contextObj);
- ::glGetProgramiv((GLuint) program->object(), pname, value);
+ ::glGetProgramiv((GLuint) program, pname, value);
}
-String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
+String GraphicsContext3D::getProgramInfoLog(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
GLint length;
- ::glGetProgramiv((GLuint) program->object(), GL_INFO_LOG_LENGTH, &length);
+ ::glGetProgramiv((GLuint) program, GL_INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetProgramInfoLog((GLuint) program->object(), length, &size, info);
+ ::glGetProgramInfoLog((GLuint) program, length, &size, info);
String s(info);
fastFree(info);
return s;
@@ -1347,47 +1341,47 @@ void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigne
::glGetRenderbufferParameterivEXT(target, pname, value);
}
-void GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long pname, int* value)
+void GraphicsContext3D::getShaderiv(Platform3DObject shader, unsigned long pname, int* value)
{
ASSERT(shader);
ensureContext(m_contextObj);
- ::glGetShaderiv((GLuint) shader->object(), pname, value);
+ ::glGetShaderiv((GLuint) shader, pname, value);
}
-String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
+String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
GLint length;
- ::glGetShaderiv((GLuint) shader->object(), GL_INFO_LOG_LENGTH, &length);
+ ::glGetShaderiv((GLuint) shader, GL_INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetShaderInfoLog((GLuint) shader->object(), length, &size, info);
+ ::glGetShaderInfoLog((GLuint) shader, length, &size, info);
String s(info);
fastFree(info);
return s;
}
-String GraphicsContext3D::getShaderSource(WebGLShader* shader)
+String GraphicsContext3D::getShaderSource(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
GLint length;
- ::glGetShaderiv((GLuint) shader->object(), GL_SHADER_SOURCE_LENGTH, &length);
+ ::glGetShaderiv((GLuint) shader, GL_SHADER_SOURCE_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetShaderSource((GLuint) shader->object(), length, &size, info);
+ ::glGetShaderSource((GLuint) shader, length, &size, info);
String s(info);
fastFree(info);
return s;
@@ -1406,24 +1400,24 @@ void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pn
::glGetTexParameteriv(target, pname, value);
}
-void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
+void GraphicsContext3D::getUniformfv(Platform3DObject program, long location, float* value)
{
ensureContext(m_contextObj);
- ::glGetUniformfv((GLuint) program->object(), location, value);
+ ::glGetUniformfv((GLuint) program, location, value);
}
-void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
+void GraphicsContext3D::getUniformiv(Platform3DObject program, long location, int* value)
{
ensureContext(m_contextObj);
- ::glGetUniformiv((GLuint) program->object(), location, value);
+ ::glGetUniformiv((GLuint) program, location, value);
}
-long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
+long GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name)
{
ASSERT(program);
ensureContext(m_contextObj);
- return ::glGetUniformLocation((GLuint) program->object(), name.utf8().data());
+ return ::glGetUniformLocation((GLuint) program, name.utf8().data());
}
void GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long pname, float* value)
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
index 80c822c..ee70338 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
@@ -103,9 +103,8 @@ public:
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
-#if ENABLE(3D_CANVAS)
- virtual void setContentsToWebGL(PlatformLayer*);
-#endif
+ virtual void setContentsToCanvas(PlatformLayer*);
+
virtual bool hasContentsLayer() const { return m_contentsLayer; }
virtual PlatformLayer* platformLayer() const;
@@ -258,9 +257,7 @@ private:
void updateContentsImage();
void updateContentsMediaLayer();
-#if ENABLE(3D_CANVAS)
- void updateContentsWebGLLayer();
-#endif
+ void updateContentsCanvasLayer();
void updateContentsRect();
void updateGeometryOrientation();
void updateMaskLayer();
@@ -305,9 +302,7 @@ private:
DirtyRectsChanged = 1 << 16,
ContentsImageChanged = 1 << 17,
ContentsMediaLayerChanged = 1 << 18,
-#if ENABLE(3D_CANVAS)
- ContentsWebGLLayerChanged = 1 << 19,
-#endif
+ ContentsCanvasLayerChanged = 1 << 19,
ContentsRectChanged = 1 << 20,
GeometryOrientationChanged = 1 << 21,
MaskLayerChanged = 1 << 22,
@@ -332,10 +327,8 @@ private:
enum ContentsLayerPurpose {
NoContentsLayer = 0,
ContentsLayerForImage,
- ContentsLayerForMedia
-#if ENABLE(3D_CANVAS)
- , ContentsLayerForWebGL
-#endif
+ ContentsLayerForMedia,
+ ContentsLayerForCanvas
};
ContentsLayerPurpose m_contentsLayerPurpose;
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index 9f1ac83..cb4ca58 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -917,10 +917,8 @@ void GraphicsLayerCA::commitLayerChangesBeforeSublayers()
if (m_uncommittedChanges & ContentsMediaLayerChanged) // Needs to happen before ChildrenChanged
updateContentsMediaLayer();
-#if ENABLE(3D_CANVAS)
- if (m_uncommittedChanges & ContentsWebGLLayerChanged) // Needs to happen before ChildrenChanged
- updateContentsWebGLLayer();
-#endif
+ if (m_uncommittedChanges & ContentsCanvasLayerChanged) // Needs to happen before ChildrenChanged
+ updateContentsCanvasLayer();
if (m_uncommittedChanges & BackgroundColorChanged) // Needs to happen before ChildrenChanged, and after updating image or video
updateLayerBackgroundColor();
@@ -1396,18 +1394,16 @@ void GraphicsLayerCA::updateContentsMediaLayer()
}
}
-#if ENABLE(3D_CANVAS)
-void GraphicsLayerCA::updateContentsWebGLLayer()
+void GraphicsLayerCA::updateContentsCanvasLayer()
{
- // WebGLLayer was set as m_contentsLayer, and will get parented in updateSublayerList().
+ // CanvasLayer was set as m_contentsLayer, and will get parented in updateSublayerList().
if (m_contentsLayer) {
setupContentsLayer(m_contentsLayer.get());
[m_contentsLayer.get() setNeedsDisplay];
updateContentsRect();
}
}
-#endif
-
+
void GraphicsLayerCA::updateContentsRect()
{
if (!m_contentsLayer)
@@ -1722,22 +1718,20 @@ void GraphicsLayerCA::pauseAnimationOnLayer(AnimatedPropertyID property, const S
}
}
-#if ENABLE(3D_CANVAS)
-void GraphicsLayerCA::setContentsToWebGL(PlatformLayer* webglLayer)
+void GraphicsLayerCA::setContentsToCanvas(PlatformLayer* canvasLayer)
{
- if (webglLayer == m_contentsLayer)
+ if (canvasLayer == m_contentsLayer)
return;
- m_contentsLayer = webglLayer;
+ m_contentsLayer = canvasLayer;
if (m_contentsLayer && [m_contentsLayer.get() respondsToSelector:@selector(setLayerOwner:)])
[(id)m_contentsLayer.get() setLayerOwner:this];
- m_contentsLayerPurpose = webglLayer ? ContentsLayerForWebGL : NoContentsLayer;
+ m_contentsLayerPurpose = canvasLayer ? ContentsLayerForCanvas : NoContentsLayer;
noteSublayersChanged();
- noteLayerPropertyChanged(ContentsWebGLLayerChanged);
+ noteLayerPropertyChanged(ContentsCanvasLayerChanged);
}
-#endif
void GraphicsLayerCA::repaintLayerDirtyRects()
{
diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
index 2636aeb..3895a00 100644
--- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
+++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
@@ -59,7 +59,6 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
public:
static void registerMediaEngine(MediaEngineRegistrar);
-
void repaint();
void loadStateChanged();
void rateChanged();
@@ -127,6 +126,8 @@ private:
void paint(GraphicsContext*, const IntRect&);
void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
+ virtual void prepareForRendering();
+
#if USE(ACCELERATED_COMPOSITING)
bool supportsAcceleratedRendering() const;
@@ -170,7 +171,7 @@ private:
void cacheMovieScale();
bool metaDataAvailable() const { return m_qtMovie && m_readyState >= MediaPlayer::HaveMetadata; }
- bool isReadyForRendering() const;
+ bool isReadyForVideoSetup() const;
MediaPlayer* m_player;
RetainPtr<QTMovie> m_qtMovie;
@@ -197,6 +198,7 @@ private:
bool m_hasUnsupportedTracks;
bool m_videoFrameHasDrawn;
bool m_delayingLoad;
+ bool m_isAllowedToRender;
#if DRAW_FRAME_RATE
int m_frameCountWhilePlaying;
double m_timeStartedPlaying;
diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
index 5c327f9..435e56e 100644
--- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
+++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
@@ -217,6 +217,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
, m_visible(false)
, m_hasUnsupportedTracks(false)
, m_videoFrameHasDrawn(false)
+ , m_isAllowedToRender(false)
#if DRAW_FRAME_RATE
, m_frameCountWhilePlaying(0)
, m_timeStartedPlaying(0)
@@ -495,7 +496,7 @@ MediaPlayerPrivate::MediaRenderingMode MediaPlayerPrivate::preferredRenderingMod
void MediaPlayerPrivate::setUpVideoRendering()
{
- if (!isReadyForRendering())
+ if (!isReadyForVideoSetup())
return;
MediaRenderingMode currentMode = currentRenderingMode();
@@ -519,10 +520,9 @@ void MediaPlayerPrivate::setUpVideoRendering()
break;
}
-#if USE(ACCELERATED_COMPOSITING)
+ // If using a movie layer, inform the client so the compositing tree is updated.
if (currentMode == MediaRenderingMovieLayer || preferredMode == MediaRenderingMovieLayer)
m_player->mediaPlayerClient()->mediaPlayerRenderingModeChanged(m_player);
-#endif
}
void MediaPlayerPrivate::tearDownVideoRendering()
@@ -915,11 +915,26 @@ void MediaPlayerPrivate::cacheMovieScale()
m_scaleFactor.setHeight(initialSize.height / naturalSize.height);
}
-bool MediaPlayerPrivate::isReadyForRendering() const
+bool MediaPlayerPrivate::isReadyForVideoSetup() const
{
return m_readyState >= MediaPlayer::HaveMetadata && m_player->visible();
}
+void MediaPlayerPrivate::prepareForRendering()
+{
+ if (m_isAllowedToRender)
+ return;
+ m_isAllowedToRender = true;
+
+ if (!hasSetUpVideoRendering())
+ setUpVideoRendering();
+
+ // If using a movie layer, inform the client so the compositing tree is updated. This is crucial if the movie
+ // has a poster, as it will most likely not have a layer and we will now be rendering frames to the movie layer.
+ if (currentRenderingMode() == MediaRenderingMovieLayer || preferredRenderingMode() == MediaRenderingMovieLayer)
+ m_player->mediaPlayerClient()->mediaPlayerRenderingModeChanged(m_player);
+}
+
void MediaPlayerPrivate::updateStates()
{
MediaPlayer::NetworkState oldNetworkState = m_networkState;
@@ -1009,7 +1024,7 @@ void MediaPlayerPrivate::updateStates()
}
}
- if (!hasSetUpVideoRendering())
+ if (isReadyForVideoSetup() && !hasSetUpVideoRendering())
setUpVideoRendering();
if (seeking())
@@ -1443,8 +1458,9 @@ void MediaPlayerPrivate::sawUnsupportedTracks()
#if USE(ACCELERATED_COMPOSITING)
bool MediaPlayerPrivate::supportsAcceleratedRendering() const
{
- // When in the media document we render via QTMovieView, which is already accelerated.
- return isReadyForRendering() && getQTMovieLayerClass() != Nil && !m_player->inMediaDocument();
+ // Also don't claim to support accelerated rendering when in the media document, as we will then render
+ // via QTMovieView which is already accelerated.
+ return isReadyForVideoSetup() && getQTMovieLayerClass() != Nil && !m_player->inMediaDocument();
}
void MediaPlayerPrivate::acceleratedRenderingStateChanged()
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
index fc67a19..4fb525f 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
+++ b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
@@ -41,15 +41,6 @@ using namespace std;
namespace WebCore {
-CTFontRef SimpleFontData::getCTFont() const
-{
- if (getNSFont())
- return toCTFontRef(getNSFont());
- if (!m_CTFont)
- m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_platformData.cgFont(), m_platformData.size(), 0, 0));
- return m_CTFont.get();
-}
-
CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const
{
unsigned key = typesettingFeatures + 1;
@@ -70,7 +61,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
static const float kerningAdjustmentValue = 0;
static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue);
static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
- const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures
+ const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures
? ligaturesAllowed : ligaturesNotAllowed };
attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled,
sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled),
@@ -78,7 +69,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
} else {
// By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning.
static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName };
- const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
+ const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled,
sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled),
&kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/WebCore/platform/graphics/qt/FontCustomPlatformData.h
index 6837059..019a6bc 100644
--- a/WebCore/platform/graphics/qt/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/qt/FontCustomPlatformData.h
@@ -23,13 +23,13 @@
#define FontCustomPlatformData_h
#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformData : Noncopyable {
~FontCustomPlatformData();
diff --git a/WebCore/platform/graphics/qt/FontPlatformData.h b/WebCore/platform/graphics/qt/FontPlatformData.h
index 9355142..79daa6b 100644
--- a/WebCore/platform/graphics/qt/FontPlatformData.h
+++ b/WebCore/platform/graphics/qt/FontPlatformData.h
@@ -24,13 +24,13 @@
#ifndef FontPlatformData_h
#define FontPlatformData_h
+#include <wtf/Forward.h>
#include "FontDescription.h"
#include <QFont>
#include <QHash>
namespace WebCore {
-class String;
class FontPlatformDataPrivate : public Noncopyable {
public:
FontPlatformDataPrivate()
diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 311d3a3..273e2dd 100644
--- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -20,24 +20,17 @@
#include "GraphicsContext3D.h"
-#include "CanvasObject.h"
+#include "ArrayBufferView.h"
+#include "WebGLObject.h"
+#include "CanvasRenderingContext.h"
+#include "Float32Array.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
#include "HostWindow.h"
#include "ImageBuffer.h"
+#include "Int32Array.h"
#include "NotImplemented.h"
#include "QWebPageClient.h"
-#include "WebGLActiveInfo.h"
-#include "ArrayBufferView.h"
-#include "WebGLBuffer.h"
-#include "Float32Array.h"
-#include "WebGLFramebuffer.h"
-#include "Int32Array.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLRenderingContext.h"
-#include "WebGLShader.h"
-#include "WebGLTexture.h"
#include "Uint8Array.h"
#include <QAbstractScrollArea>
#include <QGLContext>
@@ -519,7 +512,7 @@ void GraphicsContext3D::makeContextCurrent()
m_internal->m_glWidget->makeCurrent();
}
-void GraphicsContext3D::beginPaint(WebGLRenderingContext* context)
+void GraphicsContext3D::beginPaint(CanvasRenderingContext* context)
{
paintRenderingResultsToCanvas();
}
@@ -528,7 +521,7 @@ void GraphicsContext3D::endPaint()
{
}
-void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* context)
+void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
m_internal->m_glWidget->makeCurrent();
HTMLCanvasElement* canvas = context->canvas();
@@ -598,44 +591,44 @@ void GraphicsContext3D::activeTexture(unsigned long texture)
m_internal->activeTexture(texture);
}
-void GraphicsContext3D::attachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::attachShader(PlatformGLObject program, PlatformGLObject shader)
{
ASSERT(program);
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->attachShader((GLuint) program->object(), (GLuint) shader->object());
+ m_internal->attachShader((GLuint) program, (GLuint) shader);
}
-void GraphicsContext3D::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name)
+void GraphicsContext3D::bindAttribLocation(PlatformGLObject program, unsigned long index, const String& name)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->bindAttribLocation((GLuint) program->object(), index, name.utf8().data());
+ m_internal->bindAttribLocation((GLuint) program, index, name.utf8().data());
}
-void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer* buffer)
+void GraphicsContext3D::bindBuffer(unsigned long target, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->bindBuffer(target, buffer ? (GLuint) buffer->object() : 0);
+ m_internal->bindBuffer(target, (GLuint) buffer->object());
}
-void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer)
+void GraphicsContext3D::bindFramebuffer(unsigned long target, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->m_currentFbo = (buffer && buffer->object()) ? (GLuint) buffer->object() : m_internal->m_mainFbo;
+ m_internal->m_currentFbo = buffer ? (GLuint) buffer : m_internal->m_mainFbo;
m_internal->bindFramebuffer(target, m_internal->m_currentFbo);
}
-void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
+void GraphicsContext3D::bindRenderbuffer(unsigned long target, PlatformGLObject renderbuffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->bindRenderbuffer(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
+ m_internal->bindRenderbuffer(target, (GLuint) renderbuffer);
}
-void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture* texture)
+void GraphicsContext3D::bindTexture(unsigned long target, PlatformGLObject texture)
{
m_internal->m_glWidget->makeCurrent();
- glBindTexture(target, texture ? (GLuint) texture->object() : 0);
+ glBindTexture(target, (GLuint) texture);
}
void GraphicsContext3D::blendColor(double red, double green, double blue, double alpha)
@@ -732,11 +725,11 @@ void GraphicsContext3D::colorMask(bool red, bool green, bool blue, bool alpha)
glColorMask(red, green, blue, alpha);
}
-void GraphicsContext3D::compileShader(WebGLShader* shader)
+void GraphicsContext3D::compileShader(PlatformGLObject shader)
{
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->compileShader((GLuint) shader->object());
+ m_internal->compileShader((GLuint) shader);
}
void GraphicsContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border)
@@ -779,12 +772,12 @@ void GraphicsContext3D::depthRange(double zNear, double zFar)
#endif
}
-void GraphicsContext3D::detachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::detachShader(PlatformGLObject program, PlatformGLObject shader)
{
ASSERT(program);
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->detachShader((GLuint) program->object(), (GLuint) shader->object());
+ m_internal->detachShader((GLuint) program, (GLuint) shader);
}
void GraphicsContext3D::disable(unsigned long cap)
@@ -835,16 +828,16 @@ void GraphicsContext3D::flush()
glFlush();
}
-void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer)
+void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer ? (GLuint) buffer->object() : 0);
+ m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, (GLuint) buffer);
}
-void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level)
+void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, PlatformGLObject texture, long level)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->framebufferTexture2D(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);
+ m_internal->framebufferTexture2D(target, attachment, textarget, (GLuint) texture, level);
}
void GraphicsContext3D::frontFace(unsigned long mode)
@@ -859,9 +852,9 @@ void GraphicsContext3D::generateMipmap(unsigned long target)
m_internal->generateMipmap(target);
}
-bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveAttrib(PlatformGLObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
@@ -869,14 +862,14 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
m_internal->m_glWidget->makeCurrent();
GLint maxLength;
- m_internal->getProgramiv(static_cast<GLuint>(program->object()), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);
+ m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);
GLchar* name = (GLchar*) fastMalloc(maxLength);
GLsizei nameLength;
GLint size;
GLenum type;
- m_internal->getActiveAttrib(static_cast<GLuint>(program->object()), index, maxLength, &nameLength, &size, &type, name);
+ m_internal->getActiveAttrib(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name);
if (!nameLength) {
fastFree(name);
@@ -891,9 +884,9 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
return true;
}
-bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveUniform(PlatformGLObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
@@ -901,14 +894,14 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
m_internal->m_glWidget->makeCurrent();
GLint maxLength;
- m_internal->getProgramiv(static_cast<GLuint>(program->object()), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
+ m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
GLchar* name = (GLchar*) fastMalloc(maxLength);
GLsizei nameLength;
GLint size;
GLenum type;
- m_internal->getActiveUniform(static_cast<GLuint>(program->object()), index, maxLength, &nameLength, &size, &type, name);
+ m_internal->getActiveUniform(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name);
if (!nameLength) {
fastFree(name);
@@ -923,13 +916,13 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
return true;
}
-int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& name)
+int GraphicsContext3D::getAttribLocation(PlatformGLObject program, const String& name)
{
if (!program)
return -1;
m_internal->m_glWidget->makeCurrent();
- return m_internal->getAttribLocation((GLuint) program->object(), name.utf8().data());
+ return m_internal->getAttribLocation((GLuint) program, name.utf8().data());
}
GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
@@ -962,13 +955,13 @@ void GraphicsContext3D::hint(unsigned long target, unsigned long mode)
glHint(target, mode);
}
-bool GraphicsContext3D::isBuffer(WebGLBuffer* buffer)
+bool GraphicsContext3D::isBuffer(PlatformGLObject buffer)
{
if (!buffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isBuffer((GLuint) buffer->object());
+ return m_internal->isBuffer((GLuint) buffer);
}
bool GraphicsContext3D::isEnabled(unsigned long cap)
@@ -977,49 +970,49 @@ bool GraphicsContext3D::isEnabled(unsigned long cap)
return glIsEnabled(cap);
}
-bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer)
+bool GraphicsContext3D::isFramebuffer(PlatformGLObject framebuffer)
{
if (!framebuffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isFramebuffer((GLuint) framebuffer->object());
+ return m_internal->isFramebuffer((GLuint) framebuffer);
}
-bool GraphicsContext3D::isProgram(WebGLProgram* program)
+bool GraphicsContext3D::isProgram(PlatformGLObject program)
{
if (!program)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isProgram((GLuint) program->object());
+ return m_internal->isProgram((GLuint) program);
}
-bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
+bool GraphicsContext3D::isRenderbuffer(PlatformGLObject renderbuffer)
{
if (!renderbuffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isRenderbuffer((GLuint) renderbuffer->object());
+ return m_internal->isRenderbuffer((GLuint) renderbuffer);
}
-bool GraphicsContext3D::isShader(WebGLShader* shader)
+bool GraphicsContext3D::isShader(PlatformGLObject shader)
{
if (!shader)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isShader((GLuint) shader->object());
+ return m_internal->isShader((GLuint) shader);
}
-bool GraphicsContext3D::isTexture(WebGLTexture* texture)
+bool GraphicsContext3D::isTexture(PlatformGLObject texture)
{
if (!texture)
return false;
m_internal->m_glWidget->makeCurrent();
- return glIsTexture((GLuint) texture->object());
+ return glIsTexture((GLuint) texture);
}
void GraphicsContext3D::lineWidth(double width)
@@ -1028,11 +1021,11 @@ void GraphicsContext3D::lineWidth(double width)
glLineWidth(static_cast<float>(width));
}
-void GraphicsContext3D::linkProgram(WebGLProgram* program)
+void GraphicsContext3D::linkProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->linkProgram((GLuint) program->object());
+ m_internal->linkProgram((GLuint) program);
}
void GraphicsContext3D::pixelStorei(unsigned long paramName, long param)
@@ -1081,7 +1074,7 @@ void GraphicsContext3D::scissor(long x, long y, unsigned long width, unsigned lo
glScissor(x, y, width, height);
}
-void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source)
+void GraphicsContext3D::shaderSource(PlatformGLObject shader, const String& source)
{
ASSERT(shader);
@@ -1098,7 +1091,7 @@ void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source)
CString sourceCS = prefixedSource.utf8();
const char* data = sourceCS.data();
int length = prefixedSource.length();
- m_internal->shaderSource((GLuint) shader->object(), /* count */ 1, &data, &length);
+ m_internal->shaderSource((GLuint) shader, /* count */ 1, &data, &length);
}
void GraphicsContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask)
@@ -1263,20 +1256,20 @@ void GraphicsContext3D::uniformMatrix4fv(long location, bool transpose, float* a
m_internal->uniformMatrix4fv(location, size, transpose, array);
}
-void GraphicsContext3D::useProgram(WebGLProgram* program)
+void GraphicsContext3D::useProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->useProgram((GLuint) program->object());
+ m_internal->useProgram((GLuint) program);
}
-void GraphicsContext3D::validateProgram(WebGLProgram* program)
+void GraphicsContext3D::validateProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->validateProgram((GLuint) program->object());
+ m_internal->validateProgram((GLuint) program);
}
void GraphicsContext3D::vertexAttrib1f(unsigned long indx, float v0)
@@ -1369,18 +1362,18 @@ void GraphicsContext3D::getIntegerv(unsigned long paramName, int* value)
glGetIntegerv(paramName, value);
}
-void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long paramName, int* value)
+void GraphicsContext3D::getProgramiv(PlatformGLObject program, unsigned long paramName, int* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getProgramiv((GLuint) program->object(), paramName, value);
+ m_internal->getProgramiv((GLuint) program, paramName, value);
}
-String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
+String GraphicsContext3D::getProgramInfoLog(PlatformGLObject program)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getProgramiv((GLuint) program->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);
+ m_internal->getProgramiv((GLuint) program, GraphicsContext3D::INFO_LOG_LENGTH, &length);
GLsizei size;
@@ -1388,7 +1381,7 @@ String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
if (!info)
return "";
- m_internal->getProgramInfoLog((GLuint) program->object(), length, &size, info);
+ m_internal->getProgramInfoLog((GLuint) program, length, &size, info);
String result(info);
fastFree(info);
@@ -1402,26 +1395,26 @@ void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigne
m_internal->getRenderbufferParameteriv(target, paramName, value);
}
-void GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long paramName, int* value)
+void GraphicsContext3D::getShaderiv(PlatformGLObject shader, unsigned long paramName, int* value)
{
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->getShaderiv((GLuint) shader->object(), paramName, value);
+ m_internal->getShaderiv((GLuint) shader, paramName, value);
}
-String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
+String GraphicsContext3D::getShaderInfoLog(PlatformGLObject shader)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getShaderiv((GLuint) shader->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);
+ m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- m_internal->getShaderInfoLog((GLuint) shader->object(), length, &size, info);
+ m_internal->getShaderInfoLog((GLuint) shader, length, &size, info);
String result(info);
fastFree(info);
@@ -1429,19 +1422,19 @@ String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
return result;
}
-String GraphicsContext3D::getShaderSource(WebGLShader* shader)
+String GraphicsContext3D::getShaderSource(PlatformGLObject shader)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getShaderiv((GLuint) shader->object(), GraphicsContext3D::SHADER_SOURCE_LENGTH, &length);
+ m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::SHADER_SOURCE_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- m_internal->getShaderSource((GLuint) shader->object(), length, &size, info);
+ m_internal->getShaderSource((GLuint) shader, length, &size, info);
String result(info);
fastFree(info);
@@ -1461,24 +1454,24 @@ void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pa
glGetTexParameteriv(target, paramName, value);
}
-void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
+void GraphicsContext3D::getUniformfv(PlatformGLObject program, long location, float* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getUniformfv((GLuint) program->object(), location, value);
+ m_internal->getUniformfv((GLuint) program, location, value);
}
-void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
+void GraphicsContext3D::getUniformiv(PlatformGLObject program, long location, int* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getUniformiv((GLuint) program->object(), location, value);
+ m_internal->getUniformiv((GLuint) program, location, value);
}
-long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
+long GraphicsContext3D::getUniformLocation(PlatformGLObject program, const String& name)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- return m_internal->getUniformLocation((GLuint) program->object(), name.utf8().data());
+ return m_internal->getUniformLocation((GLuint) program, name.utf8().data());
}
void GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long paramName, float* value)
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index e560e15..d4a145f 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -536,8 +536,12 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
if (numPoints <= 1)
return;
-
- // FIXME: IMPLEMENT!!
+
+ QPainterPath path(points[0]);
+ for (size_t i = 1; i < numPoints; ++i)
+ path.lineTo(points[i]);
+ path.setFillRule(Qt::WindingFill);
+ m_data->p()->setClipPath(path, Qt::IntersectClip);
}
QPen GraphicsContext::pen()
@@ -1192,7 +1196,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
p->setClipPath(newClip, Qt::IntersectClip);
} else {
QRect clipOutRect(rect);
- QRect window(p->window());
+ QRect window = p->transform().inverted().mapRect(p->window());
clipOutRect &= window;
newClip.addRect(window);
newClip.addRect(clipOutRect);
diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index bc25003..761a4fe 100644
--- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -181,7 +181,7 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& i
ASSERT(!image.isNull());
const int bytesPerLine = image.bytesPerLine();
-#if QT_VERSION >= 0x040700
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
const uchar* bits = image.constBits();
#else
const uchar* bits = image.bits();
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index a8adb31..de9de07 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -123,8 +123,10 @@ bool Path::contains(const FloatPoint& point, WindRule rule) const
static GraphicsContext* scratchContext()
{
- static ImageBuffer* scratch = ImageBuffer::create(IntSize(1, 1)).leakPtr();
- return scratch->context();
+ static QImage image(1, 1, QImage::Format_ARGB32_Premultiplied);
+ static QPainter painter(&image);
+ static GraphicsContext* context = new GraphicsContext(&painter);
+ return context;
}
bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 7994244..7bcd84b 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -786,8 +786,6 @@ void GraphicsContext::fillRect(const FloatRect& rect)
if (paintingDisabled())
return;
- platformContext()->save();
-
SkRect r = rect;
if (!isRectSkiaSafe(getCTM(), r)) {
// See the other version of fillRect below.
@@ -802,6 +800,8 @@ void GraphicsContext::fillRect(const FloatRect& rect)
}
#endif
+ platformContext()->save();
+
platformContext()->prepareForSoftwareDraw();
SkPaint paint;
@@ -1276,4 +1276,21 @@ void GraphicsContext::translate(float w, float h)
WebCoreFloatToSkScalar(h));
}
+void GraphicsContext::setGraphicsContext3D(GraphicsContext3D* context3D, const IntSize& size)
+{
+#if USE(GLES2_RENDERING)
+ platformContext()->setGraphicsContext3D(context3D, size);
+#else
+ UNUSED_PARAM(context3D);
+ UNUSED_PARAM(size);
+#endif
+}
+
+void GraphicsContext::syncSoftwareCanvas()
+{
+#if USE(GLES2_RENDERING)
+ platformContext()->syncSoftwareCanvas();
+#endif
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index 3eb033d..eaa91ec 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -131,7 +131,7 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap,
if (bitmap.config() == SkBitmap::kNo_Config) {
// This is an empty SkBitmap that could not be configured.
- ASSERT(size.width() == 0 || size.height() == 0);
+ ASSERT(!size.width() || !size.height());
return result;
}
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index a2485e6..024bf50 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -414,7 +414,6 @@ static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, cons
{
ctxt->platformContext()->prepareForHardwareDraw();
GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas();
- gpuCanvas->gles2Context()->makeCurrent();
GLES2Texture* texture = gpuCanvas->getTexture(bitmap);
if (!texture) {
ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config);
diff --git a/WebCore/platform/graphics/skia/NativeImageSkia.cpp b/WebCore/platform/graphics/skia/NativeImageSkia.cpp
index 2411897..007a32c 100644
--- a/WebCore/platform/graphics/skia/NativeImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/NativeImageSkia.cpp
@@ -37,6 +37,8 @@
#include "NativeImageSkia.h"
#include "SkiaUtils.h"
+namespace WebCore {
+
NativeImageSkia::NativeImageSkia()
: m_isDataComplete(false),
m_lastRequestSize(0, 0),
@@ -54,7 +56,7 @@ bool NativeImageSkia::hasResizedBitmap(int w, int h) const
if (m_lastRequestSize.width() == w && m_lastRequestSize.height() == h)
m_resizeRequests++;
else {
- m_lastRequestSize = WebCore::IntSize(w, h);
+ m_lastRequestSize = IntSize(w, h);
m_resizeRequests = 0;
}
@@ -101,7 +103,7 @@ bool NativeImageSkia::shouldCacheResampling(int destWidth,
} else {
// When a different size is being requested, count this as a query
// (hasResizedBitmap) and reset the counter.
- m_lastRequestSize = WebCore::IntSize(destWidth, destHeight);
+ m_lastRequestSize = IntSize(destWidth, destHeight);
m_resizeRequests = 0;
}
@@ -111,3 +113,5 @@ bool NativeImageSkia::shouldCacheResampling(int destWidth,
int destSubsetSize = destSubsetWidth * destSubsetHeight;
return destSize / 4 < destSubsetSize;
}
+
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/NativeImageSkia.h b/WebCore/platform/graphics/skia/NativeImageSkia.h
index 5947238..0718836 100644
--- a/WebCore/platform/graphics/skia/NativeImageSkia.h
+++ b/WebCore/platform/graphics/skia/NativeImageSkia.h
@@ -34,6 +34,8 @@
#include "SkBitmap.h"
#include "IntSize.h"
+namespace WebCore {
+
// This object is used as the "native image" in our port. When WebKit uses
// "NativeImagePtr", it is a pointer to this type. It is an SkBitmap, but also
// stores a cached resized image.
@@ -96,9 +98,10 @@ private:
// This allows us to see if many requests have been made for the same
// resized image, we know that we should probably cache it, even if all of
// those requests individually are small and would not otherwise be cached.
- mutable WebCore::IntSize m_lastRequestSize;
+ mutable IntSize m_lastRequestSize;
mutable int m_resizeRequests;
};
+}
#endif // NativeImageSkia_h
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index 65c6e95..abf04f9 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -30,6 +30,10 @@
#include "config.h"
+#include "PlatformContextSkia.h"
+
+#include "AffineTransform.h"
+#include "CanvasLayerChromium.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "NativeImageSkia.h"
@@ -45,20 +49,18 @@
#include "SkDashPathEffect.h"
#if USE(GLES2_RENDERING)
+#include "GraphicsContext3D.h"
#include "GLES2Canvas.h"
-#include "GLES2Context.h"
#include "GLES2Texture.h"
-#include <GLES2/gl2.h>
#endif
#include <wtf/MathExtras.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/Vector.h>
-namespace WebCore
-{
+namespace WebCore {
+
extern bool isPathSkiaSafe(const SkMatrix& transform, const SkPath& path);
-}
// State -----------------------------------------------------------------------
@@ -80,7 +82,7 @@ struct PlatformContextSkia::State {
SkShader* m_fillShader;
// Stroke.
- WebCore::StrokeStyle m_strokeStyle;
+ StrokeStyle m_strokeStyle;
SkColor m_strokeColor;
SkShader* m_strokeShader;
float m_strokeThickness;
@@ -101,13 +103,13 @@ struct PlatformContextSkia::State {
// If non-empty, the current State is clipped to this image.
SkBitmap m_imageBufferClip;
// If m_imageBufferClip is non-empty, this is the region the image is clipped to.
- WebCore::FloatRect m_clip;
+ FloatRect m_clip;
#endif
// This is a list of clipping paths which are currently active, in the
// order in which they were pushed.
WTF::Vector<SkPath> m_antiAliasClipPaths;
- WebCore::InterpolationQuality m_interpolationQuality;
+ InterpolationQuality m_interpolationQuality;
PlatformContextSkia::State cloneInheritedProperties();
private:
@@ -123,8 +125,8 @@ PlatformContextSkia::State::State()
, m_looper(0)
, m_fillColor(0xFF000000)
, m_fillShader(0)
- , m_strokeStyle(WebCore::SolidStroke)
- , m_strokeColor(WebCore::Color::black)
+ , m_strokeStyle(SolidStroke)
+ , m_strokeColor(Color::black)
, m_strokeShader(0)
, m_strokeThickness(0)
, m_dashRatio(3)
@@ -132,8 +134,8 @@ PlatformContextSkia::State::State()
, m_lineCap(SkPaint::kDefault_Cap)
, m_lineJoin(SkPaint::kDefault_Join)
, m_dash(0)
- , m_textDrawingMode(WebCore::cTextFill)
- , m_interpolationQuality(WebCore::InterpolationHigh)
+ , m_textDrawingMode(cTextFill)
+ , m_interpolationQuality(InterpolationHigh)
{
}
@@ -219,6 +221,12 @@ PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas)
PlatformContextSkia::~PlatformContextSkia()
{
+#if USE(GLES2_RENDERING) && USE(ACCELERATED_COMPOSITING)
+ if (m_gpuCanvas) {
+ CanvasLayerChromium* layer = static_cast<CanvasLayerChromium*>(m_gpuCanvas->context()->platformLayer());
+ layer->setPrepareTextureCallback(0);
+ }
+#endif
}
void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas)
@@ -256,8 +264,8 @@ void PlatformContextSkia::save()
}
#if OS(LINUX) || OS(WINDOWS)
-void PlatformContextSkia::beginLayerClippedToImage(const WebCore::FloatRect& rect,
- const WebCore::ImageBuffer* imageBuffer)
+void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
+ const ImageBuffer* imageBuffer)
{
// Skia doesn't support clipping to an image, so we create a layer. The next
// time restore is invoked the layer and |imageBuffer| are combined to
@@ -329,8 +337,8 @@ void PlatformContextSkia::drawRect(SkRect rect)
canvas()->drawRect(rect, paint);
}
- if (m_state->m_strokeStyle != WebCore::NoStroke &&
- (m_state->m_strokeColor & 0xFF000000)) {
+ if (m_state->m_strokeStyle != NoStroke
+ && (m_state->m_strokeColor & 0xFF000000)) {
// We do a fill of four rects to simulate the stroke of a border.
SkColor oldFillColor = m_state->m_fillColor;
@@ -392,13 +400,13 @@ float PlatformContextSkia::setupPaintForStroking(SkPaint* paint, SkRect* rect, i
paint->setPathEffect(m_state->m_dash);
else {
switch (m_state->m_strokeStyle) {
- case WebCore::NoStroke:
- case WebCore::SolidStroke:
+ case NoStroke:
+ case SolidStroke:
break;
- case WebCore::DashedStroke:
+ case DashedStroke:
width = m_state->m_dashRatio * width;
// Fall through.
- case WebCore::DottedStroke:
+ case DottedStroke:
// Truncate the width, since we don't want fuzzy dots or dashes.
int dashLength = static_cast<int>(width);
// Subtract off the endcaps, since they're rendered separately.
@@ -467,12 +475,12 @@ SkDrawLooper* PlatformContextSkia::getDrawLooper() const
return m_state->m_looper;
}
-WebCore::StrokeStyle PlatformContextSkia::getStrokeStyle() const
+StrokeStyle PlatformContextSkia::getStrokeStyle() const
{
return m_state->m_strokeStyle;
}
-void PlatformContextSkia::setStrokeStyle(WebCore::StrokeStyle strokeStyle)
+void PlatformContextSkia::setStrokeStyle(StrokeStyle strokeStyle)
{
m_state->m_strokeStyle = strokeStyle;
}
@@ -514,10 +522,10 @@ float PlatformContextSkia::getAlpha() const
void PlatformContextSkia::setTextDrawingMode(int mode)
{
- // cTextClip is never used, so we assert that it isn't set:
- // https://bugs.webkit.org/show_bug.cgi?id=21898
- ASSERT((mode & WebCore::cTextClip) == 0);
- m_state->m_textDrawingMode = mode;
+ // cTextClip is never used, so we assert that it isn't set:
+ // https://bugs.webkit.org/show_bug.cgi?id=21898
+ ASSERT(!(mode & cTextClip));
+ m_state->m_textDrawingMode = mode;
}
void PlatformContextSkia::setUseAntialiasing(bool enable)
@@ -570,12 +578,12 @@ void PlatformContextSkia::setFillShader(SkShader* fillShader)
}
}
-WebCore::InterpolationQuality PlatformContextSkia::interpolationQuality() const
+InterpolationQuality PlatformContextSkia::interpolationQuality() const
{
return m_state->m_interpolationQuality;
}
-void PlatformContextSkia::setInterpolationQuality(WebCore::InterpolationQuality interpolationQuality)
+void PlatformContextSkia::setInterpolationQuality(InterpolationQuality interpolationQuality)
{
m_state->m_interpolationQuality = interpolationQuality;
}
@@ -604,13 +612,13 @@ bool PlatformContextSkia::isPrinting()
return m_canvas->getTopPlatformDevice().IsVectorial();
}
-void PlatformContextSkia::getImageResamplingHint(WebCore::IntSize* srcSize, WebCore::FloatSize* dstSize) const
+void PlatformContextSkia::getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const
{
*srcSize = m_imageResamplingHintSrcSize;
*dstSize = m_imageResamplingHintDstSize;
}
-void PlatformContextSkia::setImageResamplingHint(const WebCore::IntSize& srcSize, const WebCore::FloatSize& dstSize)
+void PlatformContextSkia::setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize)
{
m_imageResamplingHintSrcSize = srcSize;
m_imageResamplingHintDstSize = dstSize;
@@ -618,8 +626,8 @@ void PlatformContextSkia::setImageResamplingHint(const WebCore::IntSize& srcSize
void PlatformContextSkia::clearImageResamplingHint()
{
- m_imageResamplingHintSrcSize = WebCore::IntSize();
- m_imageResamplingHintDstSize = WebCore::FloatSize();
+ m_imageResamplingHintSrcSize = IntSize();
+ m_imageResamplingHintDstSize = FloatSize();
}
bool PlatformContextSkia::hasImageResamplingHint() const
@@ -628,7 +636,7 @@ bool PlatformContextSkia::hasImageResamplingHint() const
}
#if OS(LINUX) || OS(WINDOWS)
-void PlatformContextSkia::applyClipFromImage(const WebCore::FloatRect& rect, const SkBitmap& imageBuffer)
+void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitmap& imageBuffer)
{
// NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we
// only look at the alpha when compositing. I'm not 100% sure this is what WebKit expects for image clipping.
@@ -676,10 +684,32 @@ void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths)
}
#if USE(GLES2_RENDERING)
-void PlatformContextSkia::setGLES2Context(WebCore::GLES2Context* context, const WebCore::IntSize& size)
+#if USE(ACCELERATED_COMPOSITING)
+class PrepareTextureCallbackImpl : public CanvasLayerChromium::PrepareTextureCallback {
+public:
+ static PassOwnPtr<PrepareTextureCallbackImpl> create(PlatformContextSkia* pcs)
+ {
+ return new PrepareTextureCallbackImpl(pcs);
+ }
+
+ virtual void willPrepareTexture()
+ {
+ m_pcs->prepareForHardwareDraw();
+ }
+private:
+ explicit PrepareTextureCallbackImpl(PlatformContextSkia* pcs) : m_pcs(pcs) {}
+ PlatformContextSkia* m_pcs;
+};
+#endif
+
+void PlatformContextSkia::setGraphicsContext3D(GraphicsContext3D* context, const WebCore::IntSize& size)
{
m_useGPU = true;
- m_gpuCanvas = new WebCore::GLES2Canvas(context, size);
+ m_gpuCanvas = new GLES2Canvas(context, size);
+#if USE(ACCELERATED_COMPOSITING)
+ CanvasLayerChromium* layer = static_cast<CanvasLayerChromium*>(context->platformLayer());
+ layer->setPrepareTextureCallback(PrepareTextureCallbackImpl::create(this));
+#endif
}
void PlatformContextSkia::prepareForSoftwareDraw() const
@@ -716,7 +746,7 @@ void PlatformContextSkia::prepareForSoftwareDraw() const
} else if (m_backingStoreState == Mixed) {
if (m_state->m_xferMode != SkXfermode::kSrcOver_Mode) {
// Have to composite our currently software drawn data...
- uploadSoftwareToHardware(WebCore::CompositeSourceOver);
+ uploadSoftwareToHardware(CompositeSourceOver);
// then do a readback so we can hardware draw stuff.
readbackHardwareToSoftware();
m_backingStoreState = Software;
@@ -731,11 +761,11 @@ void PlatformContextSkia::prepareForHardwareDraw() const
if (m_backingStoreState == Software) {
// Last drawn in software; upload everything we've drawn.
- uploadSoftwareToHardware(WebCore::CompositeCopy);
+ uploadSoftwareToHardware(CompositeCopy);
} else if (m_backingStoreState == Mixed) {
// Stuff in software/hardware, composite the software stuff on top of
// the hardware stuff.
- uploadSoftwareToHardware(WebCore::CompositeSourceOver);
+ uploadSoftwareToHardware(CompositeSourceOver);
}
m_backingStoreState = Hardware;
}
@@ -749,7 +779,7 @@ void PlatformContextSkia::syncSoftwareCanvas() const
readbackHardwareToSoftware();
else if (m_backingStoreState == Mixed) {
// Have to composite our currently software drawn data..
- uploadSoftwareToHardware(WebCore::CompositeSourceOver);
+ uploadSoftwareToHardware(CompositeSourceOver);
// then do a readback.
readbackHardwareToSoftware();
m_backingStoreState = Software;
@@ -757,29 +787,30 @@ void PlatformContextSkia::syncSoftwareCanvas() const
m_backingStoreState = Software;
}
-void PlatformContextSkia::uploadSoftwareToHardware(WebCore::CompositeOperator op) const
+void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const
{
const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
SkAutoLockPixels lock(bitmap);
- m_gpuCanvas->gles2Context()->makeCurrent();
// FIXME: Keep a texture around for this rather than constantly creating/destroying one.
- RefPtr<WebCore::GLES2Texture> texture = WebCore::GLES2Texture::create(WebCore::GLES2Texture::BGRA8, bitmap.width(), bitmap.height());
+ GraphicsContext3D* context = m_gpuCanvas->context();
+ RefPtr<GLES2Texture> texture = GLES2Texture::create(context, GLES2Texture::BGRA8, bitmap.width(), bitmap.height());
texture->load(bitmap.getPixels());
- WebCore::IntRect rect(0, 0, bitmap.width(), bitmap.height());
- gpuCanvas()->drawTexturedRect(texture.get(), rect, rect, WebCore::DeviceColorSpace, op);
+ IntRect rect(0, 0, bitmap.width(), bitmap.height());
+ AffineTransform identity;
+ gpuCanvas()->drawTexturedRect(texture.get(), rect, rect, identity, 1.0, DeviceColorSpace, op);
}
void PlatformContextSkia::readbackHardwareToSoftware() const
{
const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true);
SkAutoLockPixels lock(bitmap);
- m_gpuCanvas->gles2Context()->makeCurrent();
int width = bitmap.width(), height = bitmap.height();
OwnArrayPtr<uint32_t> buf(new uint32_t[width]);
+ GraphicsContext3D* context = m_gpuCanvas->context();
// Flips the image vertically.
for (int y = 0; y < height; ++y) {
uint32_t* pixels = bitmap.getAddr32(0, y);
- glReadPixels(0, height - 1 - y, width, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels);
for (int i = 0; i < width; ++i) {
uint32_t pixel = pixels[i];
// Swizzles from RGBA -> BGRA.
@@ -787,4 +818,6 @@ void PlatformContextSkia::readbackHardwareToSoftware() const
}
}
}
+
#endif
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h
index 2099dd0..ff80d1b 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -41,16 +41,16 @@
#include "SkPaint.h"
#include "SkPath.h"
-#if USE(GLES2_RENDERING)
+#include <wtf/Vector.h>
+
namespace WebCore {
+
+#if USE(GLES2_RENDERING)
enum CompositeOperator;
class GLES2Canvas;
-class GLES2Context;
-}
+class GraphicsContext3D;
#endif
-#include <wtf/Vector.h>
-
// This class holds the platform-specific state for GraphicsContext. We put
// most of our Skia wrappers on this class. In theory, a lot of this stuff could
// be moved to GraphicsContext directly, except that some code external to this
@@ -97,8 +97,7 @@ public:
// invoked.
// NOTE: |imageBuffer| may be deleted before the |restore| is invoked.
#if OS(LINUX) || OS(WINDOWS)
- void beginLayerClippedToImage(const WebCore::FloatRect&,
- const WebCore::ImageBuffer*);
+ void beginLayerClippedToImage(const FloatRect&, const ImageBuffer*);
#endif
void clipPathAntiAliased(const SkPath&);
@@ -127,7 +126,7 @@ public:
void setXfermodeMode(SkXfermode::Mode);
void setFillColor(SkColor);
void setFillShader(SkShader*);
- void setStrokeStyle(WebCore::StrokeStyle);
+ void setStrokeStyle(StrokeStyle);
void setStrokeColor(SkColor);
void setStrokeThickness(float thickness);
void setStrokeShader(SkShader*);
@@ -136,7 +135,7 @@ public:
void setDashPathEffect(SkDashPathEffect*);
SkDrawLooper* getDrawLooper() const;
- WebCore::StrokeStyle getStrokeStyle() const;
+ StrokeStyle getStrokeStyle() const;
float getStrokeThickness() const;
int getTextDrawingMode() const;
float getAlpha() const;
@@ -155,8 +154,8 @@ public:
skia::PlatformCanvas* canvas() { return m_canvas; }
- WebCore::InterpolationQuality interpolationQuality() const;
- void setInterpolationQuality(WebCore::InterpolationQuality interpolationQuality);
+ InterpolationQuality interpolationQuality() const;
+ void setInterpolationQuality(InterpolationQuality interpolationQuality);
// FIXME: This should be pushed down to GraphicsContext.
void drawRect(SkRect rect);
@@ -178,14 +177,14 @@ public:
// possible quality.
bool isPrinting();
- void getImageResamplingHint(WebCore::IntSize* srcSize, WebCore::FloatSize* dstSize) const;
- void setImageResamplingHint(const WebCore::IntSize& srcSize, const WebCore::FloatSize& dstSize);
+ void getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const;
+ void setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize);
void clearImageResamplingHint();
bool hasImageResamplingHint() const;
#if USE(GLES2_RENDERING)
bool useGPU() { return m_useGPU; }
- void setGLES2Context(WebCore::GLES2Context*, const WebCore::IntSize&);
- WebCore::GLES2Canvas* gpuCanvas() const { return m_gpuCanvas.get(); }
+ void setGraphicsContext3D(GraphicsContext3D*, const IntSize&);
+ GLES2Canvas* gpuCanvas() const { return m_gpuCanvas.get(); }
#endif
#if USE(GLES2_RENDERING)
@@ -205,12 +204,12 @@ private:
#if OS(LINUX) || OS(WINDOWS)
// Used when restoring and the state has an image clip. Only shows the pixels in
// m_canvas that are also in imageBuffer.
- void applyClipFromImage(const WebCore::FloatRect&, const SkBitmap&);
+ void applyClipFromImage(const FloatRect&, const SkBitmap&);
#endif
void applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths);
#if USE(GLES2_RENDERING)
- void uploadSoftwareToHardware(WebCore::CompositeOperator) const;
+ void uploadSoftwareToHardware(CompositeOperator) const;
void readbackHardwareToSoftware() const;
#endif
@@ -232,16 +231,17 @@ private:
// Stores image sizes for a hint to compute image resampling modes.
// Values are used in ImageSkia.cpp
- WebCore::IntSize m_imageResamplingHintSrcSize;
- WebCore::FloatSize m_imageResamplingHintDstSize;
+ IntSize m_imageResamplingHintSrcSize;
+ FloatSize m_imageResamplingHintDstSize;
#if OS(WINDOWS)
bool m_drawingToImageBuffer;
#endif
#if USE(GLES2_RENDERING)
bool m_useGPU;
- OwnPtr<WebCore::GLES2Canvas> m_gpuCanvas;
+ OwnPtr<GLES2Canvas> m_gpuCanvas;
mutable enum { None, Software, Mixed, Hardware } m_backingStoreState;
#endif
};
+}
#endif // PlatformContextSkia_h
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
index 6595f6b..44003bb 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
@@ -220,7 +220,7 @@ void SkiaWinOutlineCache::removePathsForFont(HFONT hfont)
deleteOutline(outlineCache.find(*i));
}
-bool windowsCanHandleDrawTextShadow(WebCore::GraphicsContext *context)
+bool windowsCanHandleDrawTextShadow(GraphicsContext *context)
{
FloatSize shadowSize;
float shadowBlur;
@@ -323,7 +323,7 @@ bool paintSkiaText(GraphicsContext* context,
}
// Stroking on top (if necessary).
- if ((textMode & WebCore::cTextStroke)
+ if ((textMode & cTextStroke)
&& platformContext->getStrokeStyle() != NoStroke
&& platformContext->getStrokeThickness() > 0) {
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.h b/WebCore/platform/graphics/skia/SkiaFontWin.h
index 4c2bb32..40bee62 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.h
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.h
@@ -34,13 +34,14 @@
#include <windows.h>
#include <usp10.h>
-class GraphicsContext;
class SkPath;
class SkPoint;
-class PlatformContextSkia;
namespace WebCore {
+class GraphicsContext;
+class PlatformContextSkia;
+
// FIXME: Rename file to SkiaWinOutlineCache
class SkiaWinOutlineCache {
public:
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.h b/WebCore/platform/graphics/win/FontCustomPlatformData.h
index 46ddbb5..d19a8a5 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/win/FontCustomPlatformData.h
@@ -23,6 +23,7 @@
#include "FontRenderingMode.h"
#include "PlatformString.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
typedef struct CGFont* CGFontRef;
@@ -31,7 +32,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformData : Noncopyable {
FontCustomPlatformData(HANDLE fontReference, const String& name)
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
index 75fe3d1..2dbea51 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
+++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
@@ -21,6 +21,7 @@
#ifndef FontCustomPlatformDataCairo_h
#define FontCustomPlatformDataCairo_h
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <cairo.h>
@@ -29,7 +30,6 @@ namespace WebCore {
class FontPlatformData;
class SharedBuffer;
-class String;
struct FontCustomPlatformDataCairo : Noncopyable {
FontCustomPlatformDataCairo(cairo_font_face_t* fontFace)
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
index 7bf796c..9c449dd 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
@@ -31,6 +31,7 @@
#include "GraphicsLayer.h"
#include "MediaPlayerPrivate.h"
#include "Timer.h"
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/RetainPtr.h>
@@ -47,7 +48,6 @@ namespace WebCore {
class GraphicsContext;
class IntSize;
class IntRect;
-class String;
#if USE(ACCELERATED_COMPOSITING)
class WKCAImageQueue;
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h
index ecdb9da..ab9b1f0 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h
@@ -32,6 +32,7 @@
#include "Timer.h"
#include <QTMovie.h>
#include <QTMovieGWorld.h>
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/RetainPtr.h>
@@ -50,7 +51,6 @@ namespace WebCore {
class GraphicsContext;
class IntSize;
class IntRect;
-class String;
class MediaPlayerPrivate : public MediaPlayerPrivateInterface, public QTMovieClient, public QTMovieGWorldClient
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/wince/FontPlatformData.h b/WebCore/platform/graphics/wince/FontPlatformData.h
index bb49f75..0b973b8 100644
--- a/WebCore/platform/graphics/wince/FontPlatformData.h
+++ b/WebCore/platform/graphics/wince/FontPlatformData.h
@@ -27,6 +27,7 @@
#include "FontDescription.h"
#include "StringImpl.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
typedef struct tagTEXTMETRICW TEXTMETRIC;
@@ -35,7 +36,6 @@ typedef struct tagLOGFONTW LOGFONT;
namespace WebCore {
class FontPlatformPrivateData;
- class String;
class FontPlatformData {
diff --git a/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h
index a657e3e..e86b8a9 100644
--- a/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h
+++ b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h
@@ -29,6 +29,7 @@
#if ENABLE(VIDEO)
+#include <wtf/Forward.h>
#include "MediaPlayerPrivate.h"
#include "Timer.h"
#include <wtf/OwnPtr.h>
@@ -38,7 +39,6 @@ namespace WebCore {
class GraphicsContext;
class IntSize;
class IntRect;
- class String;
class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
public:
diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.h b/WebCore/platform/graphics/wince/MediaPlayerProxy.h
index 05f9b21..b02e0f4 100644
--- a/WebCore/platform/graphics/wince/MediaPlayerProxy.h
+++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.h
@@ -23,13 +23,13 @@
#if ENABLE(VIDEO)
+#include <wtf/Forward.h>
#include "ScriptInstance.h"
namespace WebCore {
class IntRect;
class IntSize;
- class String;
class MediaPlayer;
class PluginView;
class HTMLMediaElement;
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp
index a05d08a..4cebe43 100644
--- a/WebCore/platform/qt/SearchPopupMenuQt.cpp
+++ b/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp
@@ -1,6 +1,5 @@
/*
- * Copyright C 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -16,34 +15,35 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
+ *
*/
#include "config.h"
-#include "SearchPopupMenuQt.h"
+#include "FontCustomPlatformData.h"
-namespace WebCore {
+#include "SharedBuffer.h"
+#include "FontPlatformData.h"
-SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client)
- : m_popup(adoptRef(new PopupMenuQt(client)))
-{
-}
-PopupMenu* SearchPopupMenuQt::popupMenu()
+namespace WebCore {
+
+FontCustomPlatformData::~FontCustomPlatformData()
{
- return m_popup.get();
}
-void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontRenderingMode)
{
+ return FontPlatformData(size, bold, italic);
}
-void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&)
+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
{
+ return 0;
}
-bool SearchPopupMenuQt::enabled()
+bool FontCustomPlatformData::supportsFormat(const String& /* format */)
{
- return true;
+ return false;
}
}
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.h b/WebCore/platform/graphics/wx/FontCustomPlatformData.h
index 0fbeafd..a7dfe37 100644
--- a/WebCore/platform/qt/SearchPopupMenuQt.h
+++ b/WebCore/platform/graphics/wx/FontCustomPlatformData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -18,27 +18,30 @@
*
*/
-#ifndef SearchPopupMenuQt_h
-#define SearchPopupMenuQt_h
+#ifndef FontCustomPlatformData_h
+#define FontCustomPlatformData_h
-#include "PopupMenuQt.h"
-#include "SearchPopupMenu.h"
+#include "FontRenderingMode.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
namespace WebCore {
-class SearchPopupMenuQt : public SearchPopupMenu {
-public:
- SearchPopupMenuQt(PopupMenuClient*);
+ class FontPlatformData;
+ class SharedBuffer;
- virtual PopupMenu* popupMenu();
- virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
- virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems);
- virtual bool enabled();
+ struct FontCustomPlatformData : Noncopyable {
+ public:
+ FontCustomPlatformData() { }
+ ~FontCustomPlatformData();
-private:
- RefPtr<PopupMenuQt> m_popup;
-};
+ static bool supportsFormat(const String&);
+
+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
+ };
+
+ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*);
}
-#endif // SearchPopupMenuQt_h
+#endif
diff --git a/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h
index 952368e..4f8d740 100644
--- a/WebCore/platform/graphics/wx/FontPlatformData.h
+++ b/WebCore/platform/graphics/wx/FontPlatformData.h
@@ -32,6 +32,7 @@
#include "FontDescription.h"
#include "AtomicString.h"
#include "StringImpl.h"
+#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
#include <wtf/text/CString.h>
@@ -56,8 +57,6 @@ inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef
namespace WebCore {
-class String;
-
class FontHolder: public WTF::RefCounted<FontHolder>
{
public:
@@ -157,6 +156,7 @@ public:
ATSUFontID m_atsuFontID;
CGFontRef cgFont() const;
NSFont* nsFont() const { return m_nsFont; }
+ CTFontRef ctFont() const { return reinterpret_cast<CTFontRef>(m_nsFont); }
void cacheNSFont();
#endif
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp
index c08b03f..7003cf0 100644
--- a/WebCore/platform/gtk/ClipboardGtk.cpp
+++ b/WebCore/platform/gtk/ClipboardGtk.cpp
@@ -23,6 +23,7 @@
#include "Element.h"
#include "FileList.h"
#include "Frame.h"
+#include "HTMLNames.h"
#include "Image.h"
#include "NotImplemented.h"
#include "Pasteboard.h"
@@ -271,38 +272,38 @@ PassRefPtr<FileList> ClipboardGtk::files() const
return fileList.release();
}
-IntPoint ClipboardGtk::dragLocation() const
+void ClipboardGtk::setDragImage(CachedImage* image, const IntPoint& location)
{
- notImplemented();
- return IntPoint(0, 0);
+ setDragImage(image, 0, location);
}
-CachedImage* ClipboardGtk::dragImage() const
+void ClipboardGtk::setDragImageElement(Node* element, const IntPoint& location)
{
- notImplemented();
- return 0;
+ setDragImage(0, element, location);
}
-void ClipboardGtk::setDragImage(CachedImage*, const IntPoint&)
+void ClipboardGtk::setDragImage(CachedImage* image, Node* element, const IntPoint& location)
{
- notImplemented();
-}
+ if (policy() != ClipboardImageWritable && policy() != ClipboardWritable)
+ return;
-Node* ClipboardGtk::dragImageElement()
-{
- notImplemented();
- return 0;
-}
+ if (m_dragImage)
+ m_dragImage->removeClient(this);
+ m_dragImage = image;
+ if (m_dragImage)
+ m_dragImage->addClient(this);
-void ClipboardGtk::setDragImageElement(Node*, const IntPoint&)
-{
- notImplemented();
+ m_dragLoc = location;
+ m_dragImageElement = element;
}
-DragImageRef ClipboardGtk::createDragImage(IntPoint&) const
+DragImageRef ClipboardGtk::createDragImage(IntPoint& location) const
{
- notImplemented();
- return 0;
+ location = m_dragLoc;
+ if (!m_dragImage)
+ return 0;
+
+ return createDragImageFromImage(m_dragImage->image());
}
static CachedImage* getCachedImage(Element* element)
@@ -320,23 +321,20 @@ static CachedImage* getCachedImage(Element* element)
return 0;
}
-void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*)
+void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame* frame)
{
- CachedImage* cachedImage = getCachedImage(element);
- if (!cachedImage || !cachedImage->isLoaded())
+ m_dataObject->setURL(url, label);
+ m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, AbsoluteURLs));
+
+ CachedImage* image = getCachedImage(element);
+ if (!image || !image->isLoaded())
return;
- GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf();
+ GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->image()->getGdkPixbuf());
if (!pixbuf)
return;
- GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage"));
- gtk_clipboard_clear(imageClipboard);
-
- gtk_clipboard_set_image(imageClipboard, pixbuf);
- g_object_unref(pixbuf);
-
- writeURL(url, label, 0);
+ m_dataObject->setImage(pixbuf.get());
}
void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*)
diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h
index 5b42ac6..8b8ee38 100644
--- a/WebCore/platform/gtk/ClipboardGtk.h
+++ b/WebCore/platform/gtk/ClipboardGtk.h
@@ -27,6 +27,7 @@
#ifndef ClipboardGtk_h
#define ClipboardGtk_h
+#include "CachedResourceClient.h"
#include "Clipboard.h"
#include "DataObjectGtk.h"
@@ -39,7 +40,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 {
+ class ClipboardGtk : public Clipboard, public CachedResourceClient {
public:
static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, bool isForDragging, Frame* frame)
{
@@ -60,14 +61,14 @@ namespace WebCore {
virtual HashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
- IntPoint dragLocation() const;
- CachedImage* dragImage() const;
void setDragImage(CachedImage*, const IntPoint&);
- Node* dragImageElement();
void setDragImageElement(Node*, const IntPoint&);
+ void setDragImage(CachedImage*, Node*, const IntPoint&);
virtual DragImageRef createDragImage(IntPoint&) const;
+#if ENABLE(DRAG_SUPPORT)
virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*);
+#endif
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
virtual void writePlainText(const String&);
diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp
index a535f0c..41b0800 100644
--- a/WebCore/platform/gtk/CursorGtk.cpp
+++ b/WebCore/platform/gtk/CursorGtk.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
+ * Copyright (C) 2010 Igalia S.L.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,318 +31,172 @@
#include "Image.h"
#include "IntPoint.h"
-
-#include <wtf/Assertions.h>
-
#include <gdk/gdk.h>
#include <gtk/gtk.h>
+#include <wtf/Assertions.h>
namespace WebCore {
-static GdkCursor* customCursorNew(CustomCursorType cursorType)
+static GRefPtr<GdkCursor> createNamedCursor(CustomCursorType cursorType)
{
CustomCursor cursor = CustomCursors[cursorType];
- GdkCursor* c = gdk_cursor_new_from_name(gdk_display_get_default(), cursor.name);
- if (!c) {
- const GdkColor fg = { 0, 0, 0, 0 };
- const GdkColor bg = { 65535, 65535, 65535, 65535 };
+ GRefPtr<GdkCursor> c = adoptGRef(gdk_cursor_new_from_name(gdk_display_get_default(), cursor.name));
+ if (c)
+ return c;
- GdkPixmap* source = gdk_bitmap_create_from_data(NULL, cursor.bits, 32, 32);
- GdkPixmap* mask = gdk_bitmap_create_from_data(NULL, cursor.mask_bits, 32, 32);
- c = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, cursor.hot_x, cursor.hot_y);
- g_object_unref(source);
- g_object_unref(mask);
- }
- return c;
+ const GdkColor fg = { 0, 0, 0, 0 };
+ const GdkColor bg = { 65535, 65535, 65535, 65535 };
+ GRefPtr<GdkPixmap> source = adoptGRef(gdk_bitmap_create_from_data(0, cursor.bits, 32, 32));
+ GRefPtr<GdkPixmap> mask = adoptGRef(gdk_bitmap_create_from_data(0, cursor.mask_bits, 32, 32));
+ return adoptGRef(gdk_cursor_new_from_pixmap(source.get(), mask.get(), &fg, &bg, cursor.hot_x, cursor.hot_y));
}
-
-Cursor::Cursor(const Cursor& other)
- : m_platformCursor(other.m_platformCursor)
-{
- if (m_platformCursor)
- gdk_cursor_ref(m_platformCursor);
-}
-
-Cursor::Cursor(Image* image, const IntPoint& hotSpot)
+static GRefPtr<GdkCursor> createCustomCursor(Image* image, const IntPoint& hotSpot)
{
IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
- GdkPixbuf* pixbuf = image->getGdkPixbuf();
- m_platformCursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, effectiveHotSpot.x(), effectiveHotSpot.y());
- g_object_unref(pixbuf);
+ GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf());
+ return adoptGRef(gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf.get(), effectiveHotSpot.x(), effectiveHotSpot.y()));
+}
+
+void Cursor::ensurePlatformCursor() const
+{
+ if (m_platformCursor || m_type == Cursor::Pointer)
+ return;
+
+ switch (m_type) {
+ case Cursor::Pointer:
+ // A null GdkCursor is the default cursor for the window.
+ m_platformCursor = 0;
+ break;
+ case Cursor::Cross:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_CROSS));
+ break;
+ case Cursor::Hand:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_HAND2));
+ break;
+ case Cursor::IBeam:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_XTERM));
+ break;
+ case Cursor::Wait:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_WATCH));
+ break;
+ case Cursor::Help:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_QUESTION_ARROW));
+ break;
+ case Cursor::Move:
+ case Cursor::MiddlePanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_FLEUR));
+ break;
+ case Cursor::EastResize:
+ case Cursor::EastPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_RIGHT_SIDE));
+ break;
+ case Cursor::NorthResize:
+ case Cursor::NorthPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_TOP_SIDE));
+ break;
+ case Cursor::NorthEastResize:
+ case Cursor::NorthEastPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_LEFT_SIDE));
+ break;
+ case Cursor::NorthWestResize:
+ case Cursor::NorthWestPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_TOP_LEFT_CORNER));
+ break;
+ case Cursor::SouthResize:
+ case Cursor::SouthPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_BOTTOM_SIDE));
+ break;
+ case Cursor::SouthEastResize:
+ case Cursor::SouthEastPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER));
+ break;
+ case Cursor::SouthWestResize:
+ case Cursor::SouthWestPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_BOTTOM_LEFT_CORNER));
+ break;
+ case Cursor::WestResize:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_LEFT_SIDE));
+ break;
+ case Cursor::NorthSouthResize:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_TOP_TEE));
+ break;
+ case Cursor::EastWestResize:
+ case Cursor::WestPanning:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_LEFT_SIDE));
+ break;
+ case Cursor::NorthEastSouthWestResize:
+ case Cursor::NorthWestSouthEastResize:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_SIZING));
+ break;
+ case Cursor::ColumnResize:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW));
+ break;
+ case Cursor::RowResize:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW));
+ break;
+ case Cursor::VerticalText:
+ m_platformCursor = createNamedCursor(CustomCursorVerticalText);
+ break;
+ case Cursor::Cell:
+ m_platformCursor = adoptGRef(gdk_cursor_new(GDK_PLUS));
+ break;
+ case Cursor::ContextMenu:
+ m_platformCursor = createNamedCursor(CustomCursorContextMenu);
+ break;
+ case Cursor::Alias:
+ m_platformCursor = createNamedCursor(CustomCursorAlias);
+ break;
+ case Cursor::Progress:
+ m_platformCursor = createNamedCursor(CustomCursorProgress);
+ break;
+ case Cursor::NoDrop:
+ case Cursor::NotAllowed:
+ m_platformCursor = createNamedCursor(CustomCursorNoDrop);
+ break;
+ case Cursor::Copy:
+ m_platformCursor = createNamedCursor(CustomCursorCopy);
+ break;
+ case Cursor::None:
+ m_platformCursor = createNamedCursor(CustomCursorNone);
+ break;
+ case Cursor::ZoomIn:
+ m_platformCursor = createNamedCursor(CustomCursorZoomIn);
+ break;
+ case Cursor::ZoomOut:
+ m_platformCursor = createNamedCursor(CustomCursorZoomOut);
+ break;
+ case Cursor::Grab:
+ m_platformCursor = createNamedCursor(CustomCursorGrab);
+ break;
+ case Cursor::Grabbing:
+ m_platformCursor = createNamedCursor(CustomCursorGrabbing);
+ break;
+ case Cursor::Custom:
+ m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot);
+ break;
+ }
}
-Cursor::~Cursor()
+Cursor::Cursor(const Cursor& other)
+ : m_type(other.m_type)
+ , m_image(other.m_image)
+ , m_hotSpot(other.m_hotSpot)
+ , m_platformCursor(other.m_platformCursor)
{
- if (m_platformCursor)
- gdk_cursor_unref(m_platformCursor);
}
Cursor& Cursor::operator=(const Cursor& other)
{
- gdk_cursor_ref(other.m_platformCursor);
- gdk_cursor_unref(m_platformCursor);
+ m_type = other.m_type;
+ m_image = other.m_image;
+ m_hotSpot = other.m_hotSpot;
m_platformCursor = other.m_platformCursor;
return *this;
}
-Cursor::Cursor(GdkCursor* c)
- : m_platformCursor(c)
-{
- m_platformCursor = c;
-
- // The GdkCursor may be NULL - the default cursor for the window.
- if (c)
- gdk_cursor_ref(c);
-}
-
-const Cursor& pointerCursor()
-{
- static Cursor c = 0;
- return c;
-}
-
-const Cursor& crossCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_CROSS);
- return c;
-}
-
-const Cursor& handCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_HAND2);
- return c;
-}
-
-const Cursor& moveCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_FLEUR);
- return c;
-}
-
-const Cursor& iBeamCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_XTERM);
- return c;
-}
-
-const Cursor& waitCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_WATCH);
- return c;
-}
-
-const Cursor& helpCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_QUESTION_ARROW);
- return c;
-}
-
-const Cursor& eastResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_RIGHT_SIDE);
- return c;
-}
-
-const Cursor& northResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_TOP_SIDE);
- return c;
-}
-
-const Cursor& northEastResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_TOP_RIGHT_CORNER);
- return c;
-}
-
-const Cursor& northWestResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_TOP_LEFT_CORNER);
- return c;
-}
-
-const Cursor& southResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_BOTTOM_SIDE);
- return c;
-}
-
-const Cursor& southEastResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER);
- return c;
-}
-
-const Cursor& southWestResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_BOTTOM_LEFT_CORNER);
- return c;
-}
-
-const Cursor& westResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_LEFT_SIDE);
- return c;
-}
-
-const Cursor& northSouthResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_TOP_TEE);
- return c;
-}
-
-const Cursor& eastWestResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_LEFT_SIDE);
- return c;
-}
-
-const Cursor& northEastSouthWestResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_SIZING);
- return c;
-}
-
-const Cursor& northWestSouthEastResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_SIZING);
- return c;
-}
-
-const Cursor& columnResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW);
- return c;
-}
-
-const Cursor& rowResizeCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW);
- return c;
-}
-
-const Cursor& middlePanningCursor()
-{
- return moveCursor();
-}
-
-const Cursor& eastPanningCursor()
-{
- return eastResizeCursor();
-}
-
-const Cursor& northPanningCursor()
-{
- return northResizeCursor();
-}
-
-const Cursor& northEastPanningCursor()
-{
- return northEastResizeCursor();
-}
-
-const Cursor& northWestPanningCursor()
-{
- return northWestResizeCursor();
-}
-
-const Cursor& southPanningCursor()
-{
- return southResizeCursor();
-}
-
-const Cursor& southEastPanningCursor()
-{
- return southEastResizeCursor();
-}
-
-const Cursor& southWestPanningCursor()
-{
- return southWestResizeCursor();
-}
-
-const Cursor& westPanningCursor()
-{
- return westResizeCursor();
-}
-
-
-const Cursor& verticalTextCursor()
-{
- static Cursor c = customCursorNew(CustomCursorVerticalText);
- return c;
-}
-
-const Cursor& cellCursor()
-{
- static Cursor c = gdk_cursor_new(GDK_PLUS);
- return c;
-}
-
-const Cursor& contextMenuCursor()
-{
- static Cursor c = customCursorNew(CustomCursorContextMenu);
- return c;
-}
-
-const Cursor& noDropCursor()
-{
- static Cursor c = customCursorNew(CustomCursorNoDrop);
- return c;
-}
-
-const Cursor& copyCursor()
-{
- static Cursor c = customCursorNew(CustomCursorCopy);
- return c;
-}
-
-const Cursor& progressCursor()
-{
- static Cursor c = customCursorNew(CustomCursorProgress);
- return c;
-}
-
-const Cursor& aliasCursor()
-{
- static Cursor c = customCursorNew(CustomCursorAlias);
- return c;
-}
-
-const Cursor& noneCursor()
-{
- static Cursor c = customCursorNew(CustomCursorNone);
- return c;
-}
-
-const Cursor& notAllowedCursor()
-{
- return noDropCursor();
-}
-
-const Cursor& zoomInCursor()
-{
- static Cursor c = customCursorNew(CustomCursorZoomIn);
- return c;
-}
-
-const Cursor& zoomOutCursor()
-{
- static Cursor c = customCursorNew(CustomCursorZoomOut);
- return c;
-}
-
-const Cursor& grabCursor()
-{
- static Cursor c = customCursorNew(CustomCursorGrab);
- return c;
-}
-
-const Cursor& grabbingCursor()
+Cursor::~Cursor()
{
- static Cursor c = customCursorNew(CustomCursorGrabbing);
- return c;
}
}
diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp
index e9756d8..f90647d 100644
--- a/WebCore/platform/gtk/KeyEventGtk.cpp
+++ b/WebCore/platform/gtk/KeyEventGtk.cpp
@@ -126,6 +126,7 @@ static String keyIdentifierForGdkKeyCode(guint keyCode)
case GDK_Pause:
return "Pause";
case GDK_3270_PrintScreen:
+ case GDK_Print:
return "PrintScreen";
case GDK_Right:
return "Right";
diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp
index c2c11bd..db316d5 100644
--- a/WebCore/platform/gtk/WidgetGtk.cpp
+++ b/WebCore/platform/gtk/WidgetGtk.cpp
@@ -67,7 +67,7 @@ static GdkDrawable* gdkDrawable(PlatformWidget widget)
void Widget::setCursor(const Cursor& cursor)
{
- GdkCursor* platformCursor = cursor.impl();
+ GdkCursor* platformCursor = cursor.platformCursor().get();
// http://bugs.webkit.org/show_bug.cgi?id=16388
// [GTK] Widget::setCursor() gets called frequently
diff --git a/WebCore/platform/image-decoders/ImageDecoder.cpp b/WebCore/platform/image-decoders/ImageDecoder.cpp
index 86bcb45..1946596 100644
--- a/WebCore/platform/image-decoders/ImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/ImageDecoder.cpp
@@ -224,19 +224,20 @@ template <MatchType type> int getScaledValue(const Vector<int>& scaledValues, in
void ImageDecoder::prepareScaleDataIfNecessary()
{
+ m_scaled = false;
+ m_scaledColumns.clear();
+ m_scaledRows.clear();
+
int width = size().width();
int height = size().height();
int numPixels = height * width;
- if (m_maxNumPixels > 0 && numPixels > m_maxNumPixels) {
- m_scaled = true;
- double scale = sqrt(m_maxNumPixels / (double)numPixels);
- fillScaledValues(m_scaledColumns, scale, width);
- fillScaledValues(m_scaledRows, scale, height);
- } else if (m_scaled) {
- m_scaled = false;
- m_scaledColumns.clear();
- m_scaledRows.clear();
- }
+ if (m_maxNumPixels <= 0 || numPixels <= m_maxNumPixels)
+ return;
+
+ m_scaled = true;
+ double scale = sqrt(m_maxNumPixels / (double)numPixels);
+ fillScaledValues(m_scaledColumns, scale, width);
+ fillScaledValues(m_scaledRows, scale, height);
}
int ImageDecoder::upperBoundScaledX(int origX, int searchStart)
diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
index a590a6c..ec16da7 100644
--- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -61,6 +61,9 @@ bool GIFImageDecoder::isSizeAvailable()
bool GIFImageDecoder::setSize(unsigned width, unsigned height)
{
+ if (ImageDecoder::isSizeAvailable() && size().width() == width && size().height() == height)
+ return true;
+
if (!ImageDecoder::setSize(width, height))
return false;
diff --git a/WebCore/platform/iphone/KeyEventIPhone.mm b/WebCore/platform/iphone/KeyEventIPhone.mm
index f2999d9..7e021b5 100644
--- a/WebCore/platform/iphone/KeyEventIPhone.mm
+++ b/WebCore/platform/iphone/KeyEventIPhone.mm
@@ -26,7 +26,7 @@
#import "config.h"
#import "PlatformKeyboardEvent.h"
-#if PLATFORM(IPHONE)
+#if PLATFORM(IOS)
#import "KeyEventCocoa.h"
#import "Logging.h"
@@ -116,4 +116,4 @@ bool PlatformKeyboardEvent::currentCapsLockState()
}
-#endif // PLATFORM(IPHONE)
+#endif // PLATFORM(IOS)
diff --git a/WebCore/platform/mac/PasteboardHelper.h b/WebCore/platform/mac/PasteboardHelper.h
index 0e241bb..7bd62e5 100644
--- a/WebCore/platform/mac/PasteboardHelper.h
+++ b/WebCore/platform/mac/PasteboardHelper.h
@@ -42,7 +42,6 @@ class DOMDocumentFragment;
namespace WebCore {
- class String;
class Document;
class PasteboardHelper {
diff --git a/WebCore/platform/network/Credential.h b/WebCore/platform/network/Credential.h
index 4fb8bfd..ee47887 100644
--- a/WebCore/platform/network/Credential.h
+++ b/WebCore/platform/network/Credential.h
@@ -27,7 +27,7 @@
#include "PlatformString.h"
-#define CERTIFICATE_CREDENTIALS_SUPPORTED ((PLATFORM(MAC) || PLATFORM(IPHONE)) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
+#define CERTIFICATE_CREDENTIALS_SUPPORTED ((PLATFORM(MAC) || PLATFORM(IOS)) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
#if CERTIFICATE_CREDENTIALS_SUPPORTED
#include <Security/SecBase.h>
diff --git a/WebCore/platform/network/DNS.h b/WebCore/platform/network/DNS.h
index 1eeec3c..21d9c80 100644
--- a/WebCore/platform/network/DNS.h
+++ b/WebCore/platform/network/DNS.h
@@ -26,9 +26,9 @@
#ifndef DNS_h
#define DNS_h
-namespace WebCore {
+#include <wtf/Forward.h>
- class String;
+namespace WebCore {
#if !USE(SOUP)
void prefetchDNS(const String& hostname);
diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp
index 80f17da..31506ea 100644
--- a/WebCore/platform/network/FormData.cpp
+++ b/WebCore/platform/network/FormData.cpp
@@ -34,7 +34,7 @@
namespace WebCore {
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
const long long FormDataElement::toEndOfFile = -1;
const double FormDataElement::doNotCheckFileChange = 0;
#endif
@@ -133,7 +133,7 @@ PassRefPtr<FormData> FormData::deepCopy() const
formData->m_elements.append(FormDataElement(e.m_data));
break;
case FormDataElement::encodedFile:
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
formData->m_elements.append(FormDataElement(e.m_filename, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenerateFile));
#else
formData->m_elements.append(FormDataElement(e.m_filename, e.m_shouldGenerateFile));
@@ -156,7 +156,7 @@ void FormData::appendData(const void* data, size_t size)
void FormData::appendFile(const String& filename, bool shouldGenerateFile)
{
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
m_elements.append(FormDataElement(filename, 0, FormDataElement::toEndOfFile, FormDataElement::doNotCheckFileChange, shouldGenerateFile));
#else
m_elements.append(FormDataElement(filename, shouldGenerateFile));
@@ -184,7 +184,7 @@ void FormData::appendItem(const BlobItem* item, bool shouldGenerateFile)
return;
}
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
const FileRangeBlobItem* fileRangeItem = item->toFileRangeBlobItem();
if (fileRangeItem) {
appendFileRange(fileItem->path(), fileRangeItem->start(), fileRangeItem->size(), fileRangeItem->snapshotModificationTime(), shouldGenerateFile);
@@ -195,7 +195,7 @@ void FormData::appendItem(const BlobItem* item, bool shouldGenerateFile)
appendFile(fileItem->path(), shouldGenerateFile);
}
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
void FormData::appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile)
{
m_elements.append(FormDataElement(filename, start, length, expectedModificationTime, shouldGenerateFile));
@@ -245,7 +245,7 @@ void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEnco
FormDataBuilder::addFilenameToMultiPartHeader(header, encoding, fileName);
// If the item is sliced from a file, do not add the content type.
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
if (!fileName.isEmpty() && !value->toFileRangeBlobItem()) {
#else
if (!fileName.isEmpty()) {
diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h
index 95eb258..a1964e3 100644
--- a/WebCore/platform/network/FormData.h
+++ b/WebCore/platform/network/FormData.h
@@ -21,6 +21,7 @@
#define FormData_h
#include "PlatformString.h"
+#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -36,7 +37,7 @@ public:
FormDataElement() : m_type(data) { }
FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { }
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) { }
#else
FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { }
@@ -45,7 +46,7 @@ public:
enum { data, encodedFile } m_type;
Vector<char> m_data;
String m_filename;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
long long m_fileStart;
long long m_fileLength;
double m_expectedFileModificationTime;
@@ -53,7 +54,7 @@ public:
String m_generatedFilename;
bool m_shouldGenerateFile;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
static const long long toEndOfFile;
static const double doNotCheckFileChange;
#endif
@@ -68,7 +69,7 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b)
return false;
if (a.m_data != b.m_data)
return false;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
if (a.m_filename != b.m_filename || a.m_fileStart != b.m_fileStart || a.m_fileLength != b.m_fileLength || a.m_expectedFileModificationTime != b.m_expectedFileModificationTime)
#else
if (a.m_filename != b.m_filename)
@@ -87,7 +88,7 @@ class FormData : public RefCounted<FormData> {
public:
static PassRefPtr<FormData> create();
static PassRefPtr<FormData> create(const void*, size_t);
- static PassRefPtr<FormData> create(const WTF::CString&);
+ static PassRefPtr<FormData> create(const CString&);
static PassRefPtr<FormData> create(const Vector<char>&);
static PassRefPtr<FormData> create(const BlobItemList&, const TextEncoding&);
static PassRefPtr<FormData> createMultiPart(const BlobItemList&, const TextEncoding&, Document*);
@@ -98,7 +99,7 @@ public:
void appendData(const void* data, size_t);
void appendItems(const BlobItemList&);
void appendFile(const String& filename, bool shouldGenerateFile = false);
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false);
#endif
diff --git a/WebCore/platform/network/FormDataBuilder.h b/WebCore/platform/network/FormDataBuilder.h
index 26b90af..87d0ef3 100644
--- a/WebCore/platform/network/FormDataBuilder.h
+++ b/WebCore/platform/network/FormDataBuilder.h
@@ -22,13 +22,9 @@
#define FormDataBuilder_h
#include "PlatformString.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
-namespace WTF {
-class CString;
-}
-using WTF::CString;
-
namespace WebCore {
class Document;
@@ -40,15 +36,15 @@ public:
// Helper functions used by HTMLFormElement/WMLGoElement for multi-part form data
static Vector<char> generateUniqueBoundaryString();
- static void beginMultiPartHeader(Vector<char>&, const WTF::CString& boundary, const WTF::CString& name);
- static void addBoundaryToMultiPartHeader(Vector<char>&, const WTF::CString& boundary, bool isLastBoundary = false);
+ static void beginMultiPartHeader(Vector<char>&, const CString& boundary, const CString& name);
+ static void addBoundaryToMultiPartHeader(Vector<char>&, const CString& boundary, bool isLastBoundary = false);
static void addFilenameToMultiPartHeader(Vector<char>&, const TextEncoding&, const String& filename);
- static void addContentTypeToMultiPartHeader(Vector<char>&, const WTF::CString& mimeType);
+ static void addContentTypeToMultiPartHeader(Vector<char>&, const CString& mimeType);
static void finishMultiPartHeader(Vector<char>&);
// Helper functions used by HTMLFormElement/WMLGoElement for non multi-part form data
- static void addKeyValuePairAsFormData(Vector<char>&, const WTF::CString& key, const WTF::CString& value);
- static void encodeStringAsFormData(Vector<char>&, const WTF::CString&);
+ static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value);
+ static void encodeStringAsFormData(Vector<char>&, const CString&);
private:
FormDataBuilder() {}
diff --git a/WebCore/platform/network/HTTPParsers.h b/WebCore/platform/network/HTTPParsers.h
index bb2a9e5..9d6971b 100644
--- a/WebCore/platform/network/HTTPParsers.h
+++ b/WebCore/platform/network/HTTPParsers.h
@@ -30,9 +30,10 @@
#ifndef HTTPParsers_h
#define HTTPParsers_h
+#include <wtf/Forward.h>
+
namespace WebCore {
-class String;
class ResourceResponseBase;
enum XSSProtectionDisposition {
diff --git a/WebCore/platform/network/mac/FormDataStreamMac.mm b/WebCore/platform/network/mac/FormDataStreamMac.mm
index db2e13b..c7bd2e7 100644
--- a/WebCore/platform/network/mac/FormDataStreamMac.mm
+++ b/WebCore/platform/network/mac/FormDataStreamMac.mm
@@ -124,7 +124,7 @@ struct FormStreamFields {
SchedulePairHashSet scheduledRunLoopPairs;
Vector<FormDataElement> remainingElements; // in reverse order
CFReadStreamRef currentStream;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
long long currentStreamRangeLength;
#endif
char* currentData;
@@ -140,7 +140,7 @@ static void closeCurrentStream(FormStreamFields *form)
CFReadStreamSetClient(form->currentStream, kCFStreamEventNone, NULL, NULL);
CFRelease(form->currentStream);
form->currentStream = NULL;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
form->currentStreamRangeLength = FormDataElement::toEndOfFile;
#endif
}
@@ -167,7 +167,7 @@ static bool advanceCurrentStream(FormStreamFields* form)
form->currentStream = CFReadStreamCreateWithBytesNoCopy(0, reinterpret_cast<const UInt8*>(data), size, kCFAllocatorNull);
form->currentData = data;
} else {
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
// Check if the file has been changed or not if required.
if (nextInput.m_expectedFileModificationTime != FormDataElement::doNotCheckFileChange) {
time_t fileModificationTime;
@@ -183,7 +183,7 @@ static bool advanceCurrentStream(FormStreamFields* form)
// The file must have been removed or become unreadable.
return false;
}
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
if (nextInput.m_fileStart > 0) {
CFNumberRef position = CFNumberCreate(0, kCFNumberLongLongType, &nextInput.m_fileStart);
CFReadStreamSetProperty(form->currentStream, kCFStreamPropertyFileCurrentOffset, position);
@@ -224,7 +224,7 @@ static void* formCreate(CFReadStreamRef stream, void* context)
FormStreamFields* newInfo = new FormStreamFields;
newInfo->currentStream = NULL;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
newInfo->currentStreamRangeLength = FormDataElement::toEndOfFile;
#endif
newInfo->currentData = 0;
@@ -272,7 +272,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen
while (form->currentStream) {
CFIndex bytesToRead = bufferLength;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
if (form->currentStreamRangeLength != FormDataElement::toEndOfFile && form->currentStreamRangeLength < bytesToRead)
bytesToRead = static_cast<CFIndex>(form->currentStreamRangeLength);
#endif
@@ -285,7 +285,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen
error->error = 0;
*atEOF = FALSE;
form->bytesSent += bytesRead;
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
if (form->currentStreamRangeLength != FormDataElement::toEndOfFile)
form->currentStreamRangeLength -= bytesRead;
#endif
@@ -401,7 +401,7 @@ void setHTTPBody(NSMutableURLRequest *request, PassRefPtr<FormData> formData)
if (element.m_type == FormDataElement::data)
length += element.m_data.size();
else {
-#if ENABLE(BLOB_SLICE)
+#if ENABLE(BLOB)
// If we're sending the file range, use the existing range length for now. We will detect if the file has been changed right before we read the file and abort the operation if necessary.
if (element.m_fileLength != FormDataElement::toEndOfFile) {
length += element.m_fileLength;
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
index 15a48cd..766dc90 100644
--- a/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
+++ b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
@@ -22,7 +22,7 @@
#include <QObject>
-#if QT_VERSION < 0x040700
+#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
namespace QtMobility {
class QNetworkConfigurationManager;
}
@@ -46,7 +46,7 @@ public slots:
void networkAccessPermissionChanged(bool);
public:
-#if QT_VERSION < 0x040700
+#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
QtMobility::QNetworkConfigurationManager* m_configurationManager;
#else
QNetworkConfigurationManager* m_configurationManager;
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
index 3aae92a..959e74a 100644
--- a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
+++ b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -25,7 +25,7 @@
#include "NetworkStateNotifierPrivate.h"
#include "qnetworkconfigmanager.h"
-#if QT_VERSION < 0x040700
+#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
using namespace QtMobility;
#endif
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 131f924..915dc9a 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -160,11 +160,11 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load
m_method = QNetworkAccessManager::PostOperation;
else if (r.httpMethod() == "PUT")
m_method = QNetworkAccessManager::PutOperation;
-#if QT_VERSION >= 0x040600
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
else if (r.httpMethod() == "DELETE")
m_method = QNetworkAccessManager::DeleteOperation;
#endif
-#if QT_VERSION >= 0x040700
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
else if (r.httpMethod() == "OPTIONS")
m_method = QNetworkAccessManager::CustomOperation;
#endif
@@ -294,9 +294,9 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
if (!client)
return;
- WebCore::String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString();
- WebCore::String encoding = extractCharsetFromMediaType(contentType);
- WebCore::String mimeType = extractMIMETypeFromMediaType(contentType);
+ WTF::String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString();
+ WTF::String encoding = extractCharsetFromMediaType(contentType);
+ WTF::String mimeType = extractMIMETypeFromMediaType(contentType);
if (mimeType.isEmpty()) {
// let's try to guess from the extension
@@ -456,13 +456,13 @@ void QNetworkReplyHandler::start()
putDevice->setParent(m_reply);
break;
}
-#if QT_VERSION >= 0x040600
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
case QNetworkAccessManager::DeleteOperation: {
m_reply = manager->deleteResource(m_request);
break;
}
#endif
-#if QT_VERSION >= 0x040700
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
case QNetworkAccessManager::CustomOperation:
m_reply = manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data());
break;
diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp
index 03dfc8f..96c2093 100644
--- a/WebCore/platform/qt/FileSystemQt.cpp
+++ b/WebCore/platform/qt/FileSystemQt.cpp
@@ -116,7 +116,7 @@ Vector<String> listDirectory(const String& path, const String& filter)
CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
{
#ifndef QT_NO_TEMPORARYFILE
- QTemporaryFile* tempFile = new QTemporaryFile(QLatin1String(prefix));
+ QTemporaryFile* tempFile = new QTemporaryFile(QDir::tempPath() + QLatin1Char('/') + QLatin1String(prefix));
tempFile->setAutoRemove(false);
QFile* temp = tempFile;
if (temp->open(QIODevice::ReadWrite)) {
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
deleted file mode 100644
index 5590556..0000000
--- a/WebCore/platform/qt/PopupMenuQt.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * This file is part of the popup menu implementation for <select> elements in WebCore.
- *
- * Copyright (C) 2008, 2009, 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Coypright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "PopupMenuQt.h"
-
-#include "Chrome.h"
-#include "ChromeClientQt.h"
-#include "FrameView.h"
-#include "PopupMenuClient.h"
-#include "QWebPageClient.h"
-#include "QtAbstractWebPopup.h"
-
-namespace WebCore {
-
-PopupMenuQt::PopupMenuQt(PopupMenuClient* client)
- : m_popupClient(client)
- , m_popup(0)
-{
-}
-
-PopupMenuQt::~PopupMenuQt()
-{
- delete m_popup;
-}
-
-
-void PopupMenuQt::disconnectClient()
-{
- m_popupClient = 0;
-}
-
-void PopupMenuQt::show(const IntRect& rect, FrameView* view, int index)
-{
- ChromeClientQt* chromeClient = static_cast<ChromeClientQt*>(
- view->frame()->page()->chrome()->client());
- ASSERT(chromeClient);
-
- if (!m_popup)
- m_popup = chromeClient->createSelectPopup();
-
- m_popup->m_popupClient = m_popupClient;
- m_popup->m_currentIndex = index;
- m_popup->m_pageClient = chromeClient->platformPageClient();
-
- QRect geometry(rect);
- geometry.moveTopLeft(view->contentsToWindow(rect.topLeft()));
- m_popup->m_geometry = geometry;
-
- m_popup->show();
-
-}
-
-void PopupMenuQt::hide()
-{
- m_popup->hide();
-}
-
-void PopupMenuQt::updateFromElement()
-{
- m_popupClient->setTextFromItem(m_popupClient->selectedIndex());
-}
-
-}
-
-// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/PopupMenuQt.h b/WebCore/platform/qt/PopupMenuQt.h
deleted file mode 100644
index 25a9f76..0000000
--- a/WebCore/platform/qt/PopupMenuQt.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef PopupMenuQt_h
-#define PopupMenuQt_h
-
-#include "PopupMenu.h"
-
-namespace WebCore {
-
-class FrameView;
-class QtAbstractWebPopup;
-class Scrollbar;
-class PopupMenuClient;
-
-class PopupMenuQt : public PopupMenu {
-public:
- PopupMenuQt(PopupMenuClient*);
- ~PopupMenuQt();
-
- virtual void show(const IntRect&, FrameView*, int index);
- virtual void hide();
- virtual void updateFromElement();
- virtual void disconnectClient();
-
-private:
- PopupMenuClient* m_popupClient;
- QtAbstractWebPopup* m_popup;
-};
-
-}
-
-#endif // PopupMenuQt_h
diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h
index 1f508bb..a0a0218 100644
--- a/WebCore/platform/qt/QWebPageClient.h
+++ b/WebCore/platform/qt/QWebPageClient.h
@@ -59,7 +59,7 @@ public:
#endif
#if QT_VERSION >= 0x040600
- virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0;
+ virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0;
#endif
#ifndef QT_NO_CURSOR
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.cpp b/WebCore/platform/qt/QtAbstractWebPopup.cpp
deleted file mode 100644
index 31ab28d..0000000
--- a/WebCore/platform/qt/QtAbstractWebPopup.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-#include "config.h"
-#include "QtAbstractWebPopup.h"
-
-#include "PopupMenuClient.h"
-
-
-namespace WebCore {
-
-QtAbstractWebPopup::QtAbstractWebPopup()
- : m_popupClient(0)
- , m_pageClient(0)
- , m_currentIndex(-1)
-{
-}
-
-QtAbstractWebPopup::~QtAbstractWebPopup()
-{
-}
-
-void QtAbstractWebPopup::popupDidHide()
-{
- Q_ASSERT(m_popupClient);
- m_popupClient->popupDidHide();
-}
-
-void QtAbstractWebPopup::valueChanged(int index)
-{
- Q_ASSERT(m_popupClient);
- m_popupClient->valueChanged(index);
-}
-
-void QtAbstractWebPopup::selectItem(int index, bool allowMultiplySelections, bool shift)
-{
-#if ENABLE(NO_LISTBOX_RENDERING)
- ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
- if (client) {
- client->listBoxSelectItem(index, allowMultiplySelections, shift);
- return;
- }
-#endif
- valueChanged(index);
-}
-
-bool QtAbstractWebPopup::multiple()
-{
-#if ENABLE(NO_LISTBOX_RENDERING)
- ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
- return client && client->multiple();
-#else
- return false;
-#endif
-}
-
-QtAbstractWebPopup::ItemType QtAbstractWebPopup::itemType(int idx) const
-{
- if (m_popupClient->itemIsSeparator(idx))
- return Separator;
- if (m_popupClient->itemIsLabel(idx))
- return Group;
- return Option;
-}
-
-} // namespace WebCore
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h
deleted file mode 100644
index 5f6f619..0000000
--- a/WebCore/platform/qt/QtAbstractWebPopup.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-#ifndef QtAbstractWebPopup_h
-#define QtAbstractWebPopup_h
-
-#include "PopupMenuClient.h"
-
-#include <QFont>
-#include <QList>
-#include <QRect>
-#include <QWidget>
-
-class QWebPageClient;
-
-namespace WebCore {
-
-class QtAbstractWebPopup {
-public:
- enum ItemType { Option, Group, Separator };
-
- ItemType itemType(int) const;
- QString itemText(int idx) const { return m_popupClient->itemText(idx); }
- QString itemToolTip(int idx) const { return m_popupClient->itemToolTip(idx); }
- bool itemIsEnabled(int idx) const { return m_popupClient->itemIsEnabled(idx); }
- int itemCount() const { return m_popupClient->listSize(); }
- bool itemIsSelected(int idx) const { return m_popupClient->itemIsSelected(idx); }
-
-
- QWebPageClient* pageClient() const { return m_pageClient; }
- QRect geometry() const { return m_geometry; }
- int currentIndex() const { return m_currentIndex; }
-
- QtAbstractWebPopup();
- virtual ~QtAbstractWebPopup();
-
- virtual void show() = 0;
- virtual void hide() = 0;
-
- void popupDidHide();
- void valueChanged(int index);
-
- void selectItem(int index, bool allowMultiplySelections, bool shift);
- bool multiple();
-
-
- QFont font() { return m_popupClient->menuStyle().font().font(); }
-
-private:
- friend class PopupMenuQt;
- PopupMenuClient* m_popupClient;
- QWebPageClient* m_pageClient;
- int m_currentIndex;
- QRect m_geometry;
-};
-
-}
-
-#endif // QtAbstractWebPopup_h
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 22d99a1..870f0eb 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -1202,7 +1202,7 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const PaintInfo& pain
paintMediaBackground(p.painter, r);
-#if QT_VERSION >= 0x040700
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
if (MediaPlayer* player = mediaElement->player()) {
// Get the buffered parts of the media
PassRefPtr<TimeRanges> buffered = player->buffered();
diff --git a/WebCore/platform/text/AtomicStringHash.h b/WebCore/platform/text/AtomicStringHash.h
index 67a45de..d13332b 100644
--- a/WebCore/platform/text/AtomicStringHash.h
+++ b/WebCore/platform/text/AtomicStringHash.h
@@ -53,10 +53,10 @@ namespace WebCore {
namespace WTF {
// WebCore::AtomicStringHash is the default hash for AtomicString
- template<> struct HashTraits<WebCore::AtomicString> : GenericHashTraits<WebCore::AtomicString> {
+ template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(WebCore::AtomicString& slot) { new (&slot) WebCore::AtomicString(HashTableDeletedValue); }
- static bool isDeletedValue(const WebCore::AtomicString& slot) { return slot.isHashTableDeletedValue(); }
+ static void constructDeletedValue(WTF::AtomicString& slot) { new (&slot) WTF::AtomicString(HashTableDeletedValue); }
+ static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); }
};
}
diff --git a/WebCore/platform/text/AtomicStringKeyedMRUCache.h b/WebCore/platform/text/AtomicStringKeyedMRUCache.h
new file mode 100644
index 0000000..a47585a
--- /dev/null
+++ b/WebCore/platform/text/AtomicStringKeyedMRUCache.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AtomicStringKeyedMRUCache_h
+#define AtomicStringKeyedMRUCache_h
+
+namespace WebCore {
+
+template<typename T, size_t capacity = 4>
+class AtomicStringKeyedMRUCache {
+public:
+ T get(const AtomicString& key)
+ {
+ if (key.isNull()) {
+ DEFINE_STATIC_LOCAL(T, valueForNull, (createValueForNullKey()));
+ return valueForNull;
+ }
+
+ for (size_t i = 0; i < m_cache.size(); ++i) {
+ if (m_cache[i].first == key) {
+ size_t foundIndex = i;
+ if (foundIndex + 1 < m_cache.size()) {
+ Entry entry = m_cache[foundIndex];
+ m_cache.remove(foundIndex);
+ foundIndex = m_cache.size();
+ m_cache.append(entry);
+ }
+ return m_cache[foundIndex].second;
+ }
+ }
+ if (m_cache.size() == capacity)
+ m_cache.remove(0);
+
+ m_cache.append(std::make_pair(key, createValueForKey(key)));
+ return m_cache.last().second;
+ }
+
+private:
+ T createValueForNullKey();
+ T createValueForKey(const AtomicString&);
+
+ typedef pair<AtomicString, T> Entry;
+ typedef Vector<Entry, capacity> Cache;
+ Cache m_cache;
+};
+
+}
+
+#endif // AtomicStringKeyedMRUCache_h
diff --git a/WebCore/platform/text/Hyphenation.cpp b/WebCore/platform/text/Hyphenation.cpp
index 8ef5a25..89f6438 100644
--- a/WebCore/platform/text/Hyphenation.cpp
+++ b/WebCore/platform/text/Hyphenation.cpp
@@ -30,9 +30,14 @@
namespace WebCore {
-size_t lastHyphenLocation(const UChar* /* characters */, size_t /* length */, size_t /* beforeIndex */)
+bool canHyphenate(const AtomicString& /* localeIdentifier */)
{
- notImplemented();
+ return false;
+}
+
+size_t lastHyphenLocation(const UChar* /* characters */, size_t /* length */, size_t /* beforeIndex */, const AtomicString& /* localeIdentifier */)
+{
+ ASSERT_NOT_REACHED();
return 0;
}
diff --git a/WebCore/platform/text/Hyphenation.h b/WebCore/platform/text/Hyphenation.h
index dbcbe69..a99bff0 100644
--- a/WebCore/platform/text/Hyphenation.h
+++ b/WebCore/platform/text/Hyphenation.h
@@ -26,11 +26,13 @@
#ifndef Hyphenation_h
#define Hyphenation_h
+#include <wtf/Forward.h>
#include <wtf/unicode/Unicode.h>
namespace WebCore {
-size_t lastHyphenLocation(const UChar*, size_t length, size_t beforeIndex);
+bool canHyphenate(const AtomicString& localeIdentifier);
+size_t lastHyphenLocation(const UChar*, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier);
} // namespace WebCore
diff --git a/WebCore/platform/text/LineEnding.h b/WebCore/platform/text/LineEnding.h
index 9c3e2aa..ab8d6ee 100644
--- a/WebCore/platform/text/LineEnding.h
+++ b/WebCore/platform/text/LineEnding.h
@@ -32,6 +32,8 @@
#ifndef LineEnding_h
#define LineEnding_h
+#include <wtf/Forward.h>
+
namespace WTF {
class CString;
}
diff --git a/WebCore/platform/text/SegmentedString.h b/WebCore/platform/text/SegmentedString.h
index 747d426..1d3098d 100644
--- a/WebCore/platform/text/SegmentedString.h
+++ b/WebCore/platform/text/SegmentedString.h
@@ -38,8 +38,6 @@ public:
{
}
- SegmentedSubstring(const UChar* str, int length) : m_length(length), m_current(length == 0 ? 0 : str), m_doNotExcludeLineNumbers(true) {}
-
void clear() { m_length = 0; m_current = 0; }
bool excludeLineNumbers() const { return !m_doNotExcludeLineNumbers; }
@@ -72,8 +70,6 @@ class SegmentedString {
public:
SegmentedString()
: m_pushedChar1(0), m_pushedChar2(0), m_currentChar(0), m_composite(false), m_closed(false) {}
- SegmentedString(const UChar* str, int length) : m_pushedChar1(0), m_pushedChar2(0)
- , m_currentString(str, length), m_currentChar(m_currentString.m_current), m_composite(false), m_closed(false) {}
SegmentedString(const String& str)
: m_pushedChar1(0), m_pushedChar2(0), m_currentString(str)
, m_currentChar(m_currentString.m_current), m_composite(false), m_closed(false) {}
diff --git a/WebCore/platform/text/StringBuffer.h b/WebCore/platform/text/StringBuffer.h
index 353a44a..3a753b4 100644
--- a/WebCore/platform/text/StringBuffer.h
+++ b/WebCore/platform/text/StringBuffer.h
@@ -26,52 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef StringBuffer_h
-#define StringBuffer_h
+#ifndef WebCoreStringBuffer_h
+#define WebCoreStringBuffer_h
-#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/unicode/Unicode.h>
+// FIXME: remove this header, use the forward from wtf directly.
+#include <wtf/text/StringBuffer.h>
-namespace WebCore {
-
-class StringBuffer : public Noncopyable {
-public:
- explicit StringBuffer(unsigned length)
- : m_length(length)
- , m_data(static_cast<UChar*>(fastMalloc(length * sizeof(UChar))))
- {
- }
- ~StringBuffer()
- {
- fastFree(m_data);
- }
-
- void shrink(unsigned newLength)
- {
- ASSERT(newLength <= m_length);
- m_length = newLength;
- }
-
- void resize(unsigned newLength)
- {
- if (newLength > m_length)
- m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
- m_length = newLength;
- }
-
- unsigned length() const { return m_length; }
- UChar* characters() { return m_data; }
-
- UChar& operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
-
- UChar* release() { UChar* data = m_data; m_data = 0; return data; }
-
-private:
- unsigned m_length;
- UChar* m_data;
-};
-
-}
-
-#endif
+#endif // StringBuffer_h
diff --git a/WebCore/platform/text/StringBuilder.cpp b/WebCore/platform/text/StringBuilder.cpp
index 3e34981..213daab 100644
--- a/WebCore/platform/text/StringBuilder.cpp
+++ b/WebCore/platform/text/StringBuilder.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -67,7 +68,7 @@ void StringBuilder::append(char c)
m_strings.append(String(&c, 1));
}
-String StringBuilder::toString() const
+String StringBuilder::toString(ConcatMode mode) const
{
if (isNull())
return String();
@@ -80,17 +81,37 @@ String StringBuilder::toString() const
return m_strings[0];
UChar* buffer;
- String result = String::createUninitialized(m_totalLength, buffer);
+ unsigned totalLength = m_totalLength;
+ if (mode == ConcatAddingSpacesBetweenIndividualStrings)
+ totalLength += count - 1;
+ String result = String::createUninitialized(totalLength, buffer);
UChar* p = buffer;
- for (unsigned i = 0; i < count; ++i) {
- StringImpl* string = m_strings[i].impl();
- unsigned length = string->length();
- memcpy(p, string->characters(), length * 2);
- p += length;
- }
- ASSERT(p == m_totalLength + buffer);
+ // We could handle both Concat modes in a single for loop, not doing that for performance reasons.
+ if (mode == ConcatUnaltered) {
+ for (unsigned i = 0; i < count; ++i) {
+ StringImpl* string = m_strings[i].impl();
+ unsigned length = string->length();
+ memcpy(p, string->characters(), length * 2);
+ p += length;
+ }
+ } else {
+ ASSERT(mode == ConcatAddingSpacesBetweenIndividualStrings);
+ for (unsigned i = 0; i < count; ++i) {
+ StringImpl* string = m_strings[i].impl();
+ unsigned length = string->length();
+ memcpy(p, string->characters(), length * 2);
+ p += length;
+
+ // Add space after string before the start of the next string, if we're not processing the last string.
+ if (i < count - 1) {
+ *p = ' ';
+ ++p;
+ }
+ }
+ }
+ ASSERT(p == totalLength + buffer);
return result;
}
diff --git a/WebCore/platform/text/StringBuilder.h b/WebCore/platform/text/StringBuilder.h
index 7f72fbf..72adfa7 100644
--- a/WebCore/platform/text/StringBuilder.h
+++ b/WebCore/platform/text/StringBuilder.h
@@ -33,27 +33,36 @@
namespace WebCore {
- class StringBuilder {
- public:
- StringBuilder() : m_totalLength(UINT_MAX) {}
+enum ConcatMode {
+ ConcatUnaltered,
+ ConcatAddingSpacesBetweenIndividualStrings
+};
- void setNonNull() { if (m_totalLength == UINT_MAX) m_totalLength = 0; }
+class StringBuilder {
+public:
+ StringBuilder() : m_totalLength(UINT_MAX) {}
- void append(const String&);
- void append(UChar);
- void append(char);
-
- void clear();
- unsigned length() const;
+ void setNonNull()
+ {
+ if (m_totalLength == UINT_MAX)
+ m_totalLength = 0;
+ }
- String toString() const;
+ void append(const String&);
+ void append(UChar);
+ void append(char);
+
+ void clear();
+ unsigned length() const;
- private:
- bool isNull() const { return m_totalLength == UINT_MAX; }
+ String toString(ConcatMode mode = ConcatUnaltered) const;
- unsigned m_totalLength;
- Vector<String, 16> m_strings;
- };
+private:
+ bool isNull() const { return m_totalLength == UINT_MAX; }
+
+ unsigned m_totalLength;
+ Vector<String, 16> m_strings;
+};
}
diff --git a/WebCore/platform/text/TextCodec.h b/WebCore/platform/text/TextCodec.h
index 591e3a6..c6af38a 100644
--- a/WebCore/platform/text/TextCodec.h
+++ b/WebCore/platform/text/TextCodec.h
@@ -28,6 +28,7 @@
#define TextCodec_h
#include <memory>
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
@@ -67,7 +68,7 @@ namespace WebCore {
}
virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError) = 0;
- virtual WTF::CString encode(const UChar*, size_t length, UnencodableHandling) = 0;
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling) = 0;
// Fills a null-terminated string representation of the given
// unencodable character into the given replacement buffer.
diff --git a/WebCore/platform/text/TextCodecICU.cpp b/WebCore/platform/text/TextCodecICU.cpp
index 56a4393..6a579f9 100644
--- a/WebCore/platform/text/TextCodecICU.cpp
+++ b/WebCore/platform/text/TextCodecICU.cpp
@@ -70,10 +70,6 @@ void TextCodecICU::registerBaseCodecs(TextCodecRegistrar registrar)
registrar("UTF-8", newTextCodecICU, 0);
}
-// FIXME: Registering all the encodings we get from ucnv_getAvailableName
-// includes encodings we don't want or need. For example, all
-// the encodings with commas and version numbers.
-
void TextCodecICU::registerExtendedEncodingNames(EncodingNameRegistrar registrar)
{
// We register Hebrew with logical ordering using a separate name.
@@ -136,41 +132,62 @@ void TextCodecICU::registerExtendedEncodingNames(EncodingNameRegistrar registrar
// table in WebKit on Macintosh that don't seem to be present in ICU.
// Perhaps we can prove these are not used on the web and remove them.
// Or perhaps we can get them added to ICU.
- registrar("xmacroman", "macintosh");
- registrar("xmacukrainian", "x-mac-cyrillic");
- registrar("cnbig5", "Big5");
- registrar("xxbig5", "Big5");
- registrar("cngb", "GBK");
+ registrar("x-mac-roman", "macintosh");
+ registrar("x-mac-ukrainian", "x-mac-cyrillic");
+ registrar("cn-big5", "Big5");
+ registrar("x-x-big5", "Big5");
+ registrar("cn-gb", "GBK");
registrar("csgb231280", "GBK");
- registrar("xeuccn", "GBK");
- registrar("xgbk", "GBK");
- registrar("csISO88598I", "ISO_8859-8-I");
+ registrar("x-euc-cn", "GBK");
+ registrar("x-gbk", "GBK");
+ registrar("csISO88598I", "ISO-8859-8-I");
registrar("koi", "KOI8-R");
registrar("logical", "ISO-8859-8-I");
registrar("unicode11utf8", "UTF-8");
registrar("unicode20utf8", "UTF-8");
- registrar("xunicode20utf8", "UTF-8");
+ registrar("x-unicode20utf8", "UTF-8");
registrar("visual", "ISO-8859-8");
registrar("winarabic", "windows-1256");
registrar("winbaltic", "windows-1257");
registrar("wincyrillic", "windows-1251");
- registrar("iso885911", "windows-874");
- registrar("dos874", "windows-874");
+ registrar("iso-8859-11", "windows-874");
+ registrar("iso8859-11", "windows-874");
+ registrar("dos-874", "windows-874");
registrar("wingreek", "windows-1253");
registrar("winhebrew", "windows-1255");
registrar("winlatin2", "windows-1250");
registrar("winturkish", "windows-1254");
registrar("winvietnamese", "windows-1258");
- registrar("xcp1250", "windows-1250");
- registrar("xcp1251", "windows-1251");
- registrar("xeuc", "EUC-JP");
- registrar("xwindows949", "windows-949");
- registrar("xuhc", "windows-949");
+ registrar("x-cp1250", "windows-1250");
+ registrar("x-cp1251", "windows-1251");
+ registrar("x-euc", "EUC-JP");
+ registrar("x-windows-949", "windows-949");
+ registrar("x-uhc", "windows-949");
+ registrar("utf8", "UTF-8");
+ registrar("shift-jis", "Shift_JIS");
// These aliases are present in modern versions of ICU, but use different codecs, and have no standard names.
// They are not present in ICU 3.2.
- registrar("dos720", "cp864");
+ registrar("dos-720", "cp864");
registrar("jis7", "ISO-2022-JP");
+
+ // Alternative spelling of ISO encoding names.
+ registrar("ISO8859-1", "ISO-8859-1");
+ registrar("ISO8859-2", "ISO-8859-2");
+ registrar("ISO8859-3", "ISO-8859-3");
+ registrar("ISO8859-4", "ISO-8859-4");
+ registrar("ISO8859-5", "ISO-8859-5");
+ registrar("ISO8859-6", "ISO-8859-6");
+ registrar("ISO8859-7", "ISO-8859-7");
+ registrar("ISO8859-8", "ISO-8859-8");
+ registrar("ISO8859-8-I", "ISO-8859-8-I");
+ registrar("ISO8859-9", "ISO-8859-9");
+ registrar("ISO8859-10", "ISO-8859-10");
+ registrar("ISO8859-13", "ISO-8859-13");
+ registrar("ISO8859-14", "ISO-8859-14");
+ registrar("ISO8859-15", "ISO-8859-15");
+ // Not registering ISO8859-16, because Firefox (as of version 3.6.6) doesn't know this particular alias,
+ // and because older versions of ICU don't support ISO-8859-16 encoding at all.
}
void TextCodecICU::registerExtendedCodecs(TextCodecRegistrar registrar)
diff --git a/WebCore/platform/text/TextCodecLatin1.cpp b/WebCore/platform/text/TextCodecLatin1.cpp
index 55b20e8..1e9385d 100644
--- a/WebCore/platform/text/TextCodecLatin1.cpp
+++ b/WebCore/platform/text/TextCodecLatin1.cpp
@@ -79,7 +79,6 @@ void TextCodecLatin1::registerEncodingNames(EncodingNameRegistrar registrar)
registrar("ibm-1252", "windows-1252");
registrar("ibm-1252_P100-2000", "windows-1252");
- registrar("8859-1", "ISO-8859-1");
registrar("CP819", "ISO-8859-1");
registrar("IBM819", "ISO-8859-1");
registrar("csISOLatin1", "ISO-8859-1");
diff --git a/WebCore/platform/text/TextEncoding.cpp b/WebCore/platform/text/TextEncoding.cpp
index 0a997a2..29ae170 100644
--- a/WebCore/platform/text/TextEncoding.cpp
+++ b/WebCore/platform/text/TextEncoding.cpp
@@ -248,7 +248,7 @@ const TextEncoding& ASCIIEncoding()
const TextEncoding& Latin1Encoding()
{
- static TextEncoding globalLatin1Encoding("Latin-1");
+ static TextEncoding globalLatin1Encoding("latin1");
return globalLatin1Encoding;
}
diff --git a/WebCore/platform/text/TextEncoding.h b/WebCore/platform/text/TextEncoding.h
index 3429bb5..675625b 100644
--- a/WebCore/platform/text/TextEncoding.h
+++ b/WebCore/platform/text/TextEncoding.h
@@ -27,17 +27,11 @@
#define TextEncoding_h
#include "TextCodec.h"
+#include <wtf/Forward.h>
#include <wtf/unicode/Unicode.h>
-namespace WTF {
-class CString;
-}
-using WTF::CString;
-
namespace WebCore {
- class String;
-
class TextEncoding {
public:
TextEncoding() : m_name(0) { }
@@ -75,7 +69,7 @@ namespace WebCore {
return decode(str, length, false, ignored);
}
String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
- WTF::CString encode(const UChar*, size_t length, UnencodableHandling) const;
+ CString encode(const UChar*, size_t length, UnencodableHandling) const;
UChar backslashAsCurrencySymbol() const;
diff --git a/WebCore/platform/text/TextEncodingRegistry.cpp b/WebCore/platform/text/TextEncodingRegistry.cpp
index 6ecc36f..40fcdc5 100644
--- a/WebCore/platform/text/TextEncodingRegistry.cpp
+++ b/WebCore/platform/text/TextEncodingRegistry.cpp
@@ -61,10 +61,7 @@ namespace WebCore {
const size_t maxEncodingNameLength = 63;
-// Hash for all-ASCII strings that does case folding and skips any characters
-// that are not alphanumeric. If passed any non-ASCII characters, depends on
-// the behavior of isalnum -- if that returns false as it does on OS X, then
-// it will properly skip those characters too.
+// Hash for all-ASCII strings that does case folding.
struct TextEncodingNameHash {
static bool equal(const char* s1, const char* s2)
@@ -72,12 +69,8 @@ struct TextEncodingNameHash {
char c1;
char c2;
do {
- do
- c1 = *s1++;
- while (c1 && !isASCIIAlphanumeric(c1));
- do
- c2 = *s2++;
- while (c2 && !isASCIIAlphanumeric(c2));
+ c1 = *s1++;
+ c2 = *s2++;
if (toASCIILower(c1) != toASCIILower(c2))
return false;
} while (c1 && c2);
@@ -91,16 +84,13 @@ struct TextEncodingNameHash {
{
unsigned h = WTF::stringHashingStartValue;
for (;;) {
- char c;
- do {
- c = *s++;
- if (!c) {
- h += (h << 3);
- h ^= (h >> 11);
- h += (h << 15);
- return h;
- }
- } while (!isASCIIAlphanumeric(c));
+ char c = *s++;
+ if (!c) {
+ h += (h << 3);
+ h ^= (h >> 11);
+ h += (h << 15);
+ return h;
+ }
h += toASCIILower(c);
h += (h << 10);
h ^= (h >> 6);
@@ -154,15 +144,30 @@ static void checkExistingName(const char* alias, const char* atomicName)
&& strcmp(oldAtomicName, "ISO-8859-8-I") == 0
&& strcasecmp(atomicName, "iso-8859-8") == 0)
return;
- LOG_ERROR("alias %s maps to %s already, but someone is trying to make it map to %s",
- alias, oldAtomicName, atomicName);
+ LOG_ERROR("alias %s maps to %s already, but someone is trying to make it map to %s", alias, oldAtomicName, atomicName);
}
#endif
+static bool isUndesiredAlias(const char* alias)
+{
+ // Reject aliases with version numbers that are supported by some back-ends (such as "ISO_2022,locale=ja,version=0" in ICU).
+ for (const char* p = alias; *p; ++p) {
+ if (*p == ',')
+ return true;
+ }
+ // 8859_1 is known to (at least) ICU, but other browsers don't support this name - and having it caused a compatibility
+ // problem, see bug 43554.
+ if (0 == strcmp(alias, "8859_1"))
+ return true;
+ return false;
+}
+
static void addToTextEncodingNameMap(const char* alias, const char* name)
{
ASSERT(strlen(alias) <= maxEncodingNameLength);
+ if (isUndesiredAlias(alias))
+ return;
const char* atomicName = textEncodingNameMap->get(name);
ASSERT(strcmp(alias, name) == 0 || atomicName);
if (!atomicName)
@@ -300,11 +305,9 @@ const char* atomicCanonicalTextEncodingName(const UChar* characters, size_t leng
size_t j = 0;
for (size_t i = 0; i < length; ++i) {
UChar c = characters[i];
- if (isASCIIAlphanumeric(c)) {
- if (j == maxEncodingNameLength)
- return 0;
- buffer[j++] = c;
- }
+ if (j == maxEncodingNameLength)
+ return 0;
+ buffer[j++] = c;
}
buffer[j] = 0;
return atomicCanonicalTextEncodingName(buffer);
diff --git a/WebCore/platform/text/TextStream.h b/WebCore/platform/text/TextStream.h
index f5e512c..e7e4cc0 100644
--- a/WebCore/platform/text/TextStream.h
+++ b/WebCore/platform/text/TextStream.h
@@ -26,13 +26,12 @@
#ifndef TextStream_h
#define TextStream_h
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
#include <wtf/unicode/Unicode.h>
namespace WebCore {
-class String;
-
class TextStream {
public:
TextStream& operator<<(bool);
diff --git a/WebCore/platform/text/android/HyphenationAndroid.cpp b/WebCore/platform/text/android/HyphenationAndroid.cpp
index 00ebd46..e8ba5ef 100644
--- a/WebCore/platform/text/android/HyphenationAndroid.cpp
+++ b/WebCore/platform/text/android/HyphenationAndroid.cpp
@@ -57,7 +57,13 @@ static HyphenDict* loadHyphenationDictionary()
return dict;
}
-size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+bool canHyphenate(const AtomicString& /* localeIdentifier */)
+{
+ // FIXME: Check that the locale identifier matches the available dictionary.
+ return true;
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& /* localeIdentifier */)
{
static const size_t minWordLen = 5;
static const size_t maxWordLen = 100;
diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp
index 50ba4c8..b983979 100644
--- a/WebCore/platform/text/cf/HyphenationCF.cpp
+++ b/WebCore/platform/text/cf/HyphenationCF.cpp
@@ -28,24 +28,43 @@
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#include "AtomicString.h"
+#include "AtomicStringKeyedMRUCache.h"
#include "TextBreakIteratorInternalICU.h"
+#include <wtf/ListHashSet.h>
#include <wtf/RetainPtr.h>
namespace WebCore {
-static CFLocaleRef createCurrentSearchLocale()
+template<>
+RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForNullKey()
{
- RetainPtr<CFStringRef> localeIdentifier(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, (const UInt8*)currentSearchLocaleID(), strlen(currentSearchLocaleID()), kCFStringEncodingASCII, false, kCFAllocatorNull));
- return CFLocaleCreate(kCFAllocatorDefault, localeIdentifier.get());
+ RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(currentSearchLocaleID()), strlen(currentSearchLocaleID()), kCFStringEncodingASCII, false, kCFAllocatorNull));
+ RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get()));
+ return locale;
}
-size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+template<>
+RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForKey(const AtomicString& localeIdentifier)
+{
+ RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString());
+ RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get()));
+ return locale;
+}
+
+bool canHyphenate(const AtomicString& /* localeIdentifer */)
+{
+ return true;
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier)
{
RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
- static CFLocaleRef locale = createCurrentSearchLocale();
+ DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cfLocaleCache, ());
+ RetainPtr<CFLocaleRef> locale = cfLocaleCache.get(localeIdentifier);
- CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale, 0);
+ CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0);
return result == kCFNotFound ? 0 : result;
}
diff --git a/WebCore/platform/text/cf/StringCF.cpp b/WebCore/platform/text/cf/StringCF.cpp
index 97691e5..dcaf8fb 100644
--- a/WebCore/platform/text/cf/StringCF.cpp
+++ b/WebCore/platform/text/cf/StringCF.cpp
@@ -25,7 +25,7 @@
#include <CoreFoundation/CoreFoundation.h>
-namespace WebCore {
+namespace WTF {
String::String(CFStringRef str)
{
diff --git a/WebCore/platform/text/cf/StringImplCF.cpp b/WebCore/platform/text/cf/StringImplCF.cpp
index aff45b3..18e137f 100644
--- a/WebCore/platform/text/cf/StringImplCF.cpp
+++ b/WebCore/platform/text/cf/StringImplCF.cpp
@@ -32,7 +32,7 @@
#include <objc/objc-auto.h>
#endif
-namespace WebCore {
+namespace WTF {
namespace StringWrapperCFAllocator {
@@ -50,7 +50,7 @@ namespace StringWrapperCFAllocator {
static CFStringRef copyDescription(const void*)
{
- return CFSTR("WebCore::String-based allocator");
+ return CFSTR("WTF::String-based allocator");
}
static void* allocate(CFIndex size, CFOptionFlags, void*)
diff --git a/WebCore/platform/text/haiku/StringHaiku.cpp b/WebCore/platform/text/haiku/StringHaiku.cpp
index 7436ce2..96d6676 100644
--- a/WebCore/platform/text/haiku/StringHaiku.cpp
+++ b/WebCore/platform/text/haiku/StringHaiku.cpp
@@ -29,7 +29,7 @@
#include <String.h>
-namespace WebCore {
+namespace WTF {
// String conversions
String::String(const BString& string)
diff --git a/WebCore/platform/text/mac/HyphenationMac.mm b/WebCore/platform/text/mac/HyphenationMac.mm
index e64477f..56122df 100644
--- a/WebCore/platform/text/mac/HyphenationMac.mm
+++ b/WebCore/platform/text/mac/HyphenationMac.mm
@@ -28,17 +28,39 @@
#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+#import "AtomicString.h"
+#import "AtomicStringKeyedMRUCache.h"
#import "TextBreakIteratorInternalICU.h"
#import "WebCoreSystemInterface.h"
#import <wtf/RetainPtr.h>
namespace WebCore {
-size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+template<>
+bool AtomicStringKeyedMRUCache<bool>::createValueForNullKey()
{
- static bool localeIsEnglish = !strcmp("en", currentSearchLocaleID());
- if (!localeIsEnglish)
- return 0;
+ return !strcmp(currentSearchLocaleID(), "en");
+}
+
+template<>
+bool AtomicStringKeyedMRUCache<bool>::createValueForKey(const AtomicString& localeIdentifier)
+{
+ RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString());
+ RetainPtr<CFDictionaryRef> components(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, cfLocaleIdentifier.get()));
+ CFStringRef language = reinterpret_cast<CFStringRef>(CFDictionaryGetValue(components.get(), kCFLocaleLanguageCode));
+ static CFStringRef englishLanguage = CFSTR("en");
+ return language && CFEqual(language, englishLanguage);
+}
+
+bool canHyphenate(const AtomicString& localeIdentifier)
+{
+ DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<bool>, isEnglishCache, ());
+ return isEnglishCache.get(localeIdentifier);
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier)
+{
+ ASSERT_UNUSED(localeIdentifier, canHyphenate(localeIdentifier));
RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
return wkGetHyphenationLocationBeforeIndex(string.get(), beforeIndex);
diff --git a/WebCore/platform/text/mac/StringImplMac.mm b/WebCore/platform/text/mac/StringImplMac.mm
index d14c6d8..843f396 100644
--- a/WebCore/platform/text/mac/StringImplMac.mm
+++ b/WebCore/platform/text/mac/StringImplMac.mm
@@ -23,7 +23,7 @@
#include "FoundationExtras.h"
-namespace WebCore {
+namespace WTF {
StringImpl::operator NSString *()
{
diff --git a/WebCore/platform/text/mac/StringMac.mm b/WebCore/platform/text/mac/StringMac.mm
index 758ae1d..7e98b2b 100644
--- a/WebCore/platform/text/mac/StringMac.mm
+++ b/WebCore/platform/text/mac/StringMac.mm
@@ -22,7 +22,7 @@
#include "PlatformString.h"
#include <CoreFoundation/CFString.h>
-namespace WebCore {
+namespace WTF {
String::String(NSString* str)
{
diff --git a/WebCore/platform/text/wx/StringWx.cpp b/WebCore/platform/text/wx/StringWx.cpp
index 5302a85..7302edc 100644
--- a/WebCore/platform/text/wx/StringWx.cpp
+++ b/WebCore/platform/text/wx/StringWx.cpp
@@ -32,7 +32,7 @@
#include <wx/defs.h>
#include <wx/string.h>
-namespace WebCore {
+namespace WTF {
// String conversions
String::String(const wxString& wxstr)
diff --git a/WebCore/platform/win/BString.h b/WebCore/platform/win/BString.h
index c32a49d..bdbf189 100644
--- a/WebCore/platform/win/BString.h
+++ b/WebCore/platform/win/BString.h
@@ -26,6 +26,8 @@
#ifndef BString_h
#define BString_h
+#include <wtf/Forward.h>
+
#if PLATFORM(CF)
typedef const struct __CFString * CFStringRef;
#endif
@@ -38,9 +40,7 @@ namespace JSC {
namespace WebCore {
- class AtomicString;
class KURL;
- class String;
class BString {
public:
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.h b/WebCore/platform/win/ClipboardUtilitiesWin.h
index fe01499..1a29e7e 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.h
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.h
@@ -28,12 +28,12 @@
#include "DragData.h"
#include <windows.h>
+#include <wtf/Forward.h>
namespace WebCore {
class Document;
class KURL;
-class String;
HGLOBAL createGlobalData(const String&);
HGLOBAL createGlobalData(const Vector<char>&);
diff --git a/WebCore/platform/win/SearchPopupMenuWin.cpp b/WebCore/platform/win/SearchPopupMenuWin.cpp
index e1bbe68..6655b1b 100644
--- a/WebCore/platform/win/SearchPopupMenuWin.cpp
+++ b/WebCore/platform/win/SearchPopupMenuWin.cpp
@@ -22,7 +22,10 @@
#include "SearchPopupMenuWin.h"
#include "AtomicString.h"
+
+#if PLATFORM(CF)
#include <wtf/RetainPtr.h>
+#endif
namespace WebCore {
@@ -38,20 +41,27 @@ PopupMenu* SearchPopupMenuWin::popupMenu()
bool SearchPopupMenuWin::enabled()
{
+#if PLATFORM(CF)
return true;
+#else
+ return false;
+#endif
}
+#if PLATFORM(CF)
static RetainPtr<CFStringRef> autosaveKey(const String& name)
{
String key = "com.apple.WebKit.searchField:" + name;
return RetainPtr<CFStringRef>(AdoptCF, key.createCFString());
}
+#endif
void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
{
if (name.isEmpty())
return;
+#if PLATFORM(CF)
RetainPtr<CFMutableArrayRef> items;
size_t size = searchItems.size();
@@ -65,6 +75,7 @@ void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vect
CFPreferencesSetAppValue(autosaveKey(name).get(), items.get(), kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+#endif
}
void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
@@ -72,6 +83,7 @@ void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<Str
if (name.isEmpty())
return;
+#if PLATFORM(CF)
searchItems.clear();
RetainPtr<CFArrayRef> items(AdoptCF, reinterpret_cast<CFArrayRef>(CFPreferencesCopyAppValue(autosaveKey(name).get(), kCFPreferencesCurrentApplication)));
@@ -84,6 +96,7 @@ void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<Str
if (CFGetTypeID(item) == CFStringGetTypeID())
searchItems.append(item);
}
+#endif
}
}
diff --git a/WebCore/platform/win/WCDataObject.h b/WebCore/platform/win/WCDataObject.h
index bdfb013..133115d 100644
--- a/WebCore/platform/win/WCDataObject.h
+++ b/WebCore/platform/win/WCDataObject.h
@@ -26,14 +26,13 @@
#ifndef WCDataObject_h
#define WCDataObject_h
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
#include <ShlObj.h>
#include <objidl.h>
namespace WebCore {
-class String;
-
class WCDataObject : public IDataObject {
public:
void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
diff --git a/WebCore/platform/win/WebCoreTextRenderer.h b/WebCore/platform/win/WebCoreTextRenderer.h
index 7b72946..7efc1f3 100644
--- a/WebCore/platform/win/WebCoreTextRenderer.h
+++ b/WebCore/platform/win/WebCoreTextRenderer.h
@@ -23,13 +23,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <wtf/Forward.h>
+
namespace WebCore {
class Color;
class Font;
class GraphicsContext;
class IntPoint;
- class String;
void WebCoreDrawTextAtPoint(GraphicsContext&, const String&, const IntPoint&, const Font&, const Color&, int underlinedIndex = -1);
void WebCoreDrawDoubledTextAtPoint(GraphicsContext&, const String&, const IntPoint&, const Font&, const Color& topColor, const Color& bottomColor, int underlinedIndex = -1);
diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp
index 25bef55..336881d 100644
--- a/WebCore/platform/wx/ClipboardWx.cpp
+++ b/WebCore/platform/wx/ClipboardWx.cpp
@@ -138,7 +138,7 @@ bool ClipboardWx::hasData()
return false;
}
-void ClipboardWx::writePlainText(const WebCore::String& text)
+void ClipboardWx::writePlainText(const WTF::String& text)
{
Pasteboard::generalPasteboard()->writePlainText(text);
}
diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h
index b0c520b..45d1cf3 100644
--- a/WebCore/platform/wx/ClipboardWx.h
+++ b/WebCore/platform/wx/ClipboardWx.h
@@ -59,7 +59,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
- virtual void writePlainText(const WebCore::String&);
+ virtual void writePlainText(const WTF::String&);
virtual bool hasData();