summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/platform
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/BlobItem.cpp243
-rw-r--r--WebCore/platform/BlobItem.h209
-rw-r--r--WebCore/platform/ColorData.gperf14
-rw-r--r--WebCore/platform/ContextMenu.cpp1
-rw-r--r--WebCore/platform/Cursor.cpp49
-rw-r--r--WebCore/platform/Cursor.h4
-rw-r--r--WebCore/platform/DragData.h6
-rw-r--r--WebCore/platform/FileSystem.h2
-rw-r--r--WebCore/platform/PlatformMouseEvent.h1
-rw-r--r--WebCore/platform/PopupMenuClient.h2
-rw-r--r--WebCore/platform/ScrollView.cpp2
-rw-r--r--WebCore/platform/ScrollView.h2
-rw-r--r--WebCore/platform/ThemeTypes.h4
-rw-r--r--WebCore/platform/android/DragDataAndroid.cpp4
-rw-r--r--WebCore/platform/animation/Animation.h3
-rw-r--r--WebCore/platform/animation/AnimationList.cpp6
-rw-r--r--WebCore/platform/animation/AnimationList.h5
-rw-r--r--WebCore/platform/brew/ClipboardBrew.cpp117
-rw-r--r--WebCore/platform/brew/ClipboardBrew.h65
-rw-r--r--WebCore/platform/brew/ContextMenuBrew.cpp107
-rw-r--r--WebCore/platform/brew/ContextMenuItemBrew.cpp139
-rw-r--r--WebCore/platform/brew/EventLoopBrew.cpp (renamed from WebCore/platform/FileSystem.cpp)16
-rw-r--r--WebCore/platform/brew/SearchPopupMenuBrew.cpp52
-rw-r--r--WebCore/platform/chromium/DragDataChromium.cpp8
-rw-r--r--WebCore/platform/chromium/KeyCodeConversionGtk.cpp2
-rw-r--r--WebCore/platform/chromium/PasteboardChromium.cpp5
-rw-r--r--WebCore/platform/chromium/PopupMenuChromium.cpp2
-rw-r--r--WebCore/platform/efl/DragDataEfl.cpp4
-rw-r--r--WebCore/platform/efl/FileSystemEfl.cpp12
-rw-r--r--WebCore/platform/graphics/BitmapImage.cpp5
-rw-r--r--WebCore/platform/graphics/BitmapImage.h1
-rw-r--r--WebCore/platform/graphics/Color.cpp2
-rw-r--r--WebCore/platform/graphics/Font.cpp87
-rw-r--r--WebCore/platform/graphics/Font.h8
-rw-r--r--WebCore/platform/graphics/FontFastPath.cpp70
-rw-r--r--WebCore/platform/graphics/Gradient.cpp4
-rw-r--r--WebCore/platform/graphics/Gradient.h4
-rw-r--r--WebCore/platform/graphics/GraphicsContext.cpp4
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h8
-rw-r--r--WebCore/platform/graphics/GraphicsContext3D.cpp3
-rw-r--r--WebCore/platform/graphics/GraphicsContext3D.h14
-rw-r--r--WebCore/platform/graphics/GraphicsContextPrivate.h2
-rw-r--r--WebCore/platform/graphics/Image.h1
-rw-r--r--WebCore/platform/graphics/ImageBuffer.h6
-rw-r--r--WebCore/platform/graphics/ImageSource.cpp16
-rw-r--r--WebCore/platform/graphics/ImageSource.h13
-rw-r--r--WebCore/platform/graphics/cairo/FontCacheCairo.cpp51
-rw-r--r--WebCore/platform/graphics/cairo/FontCairo.cpp2
-rw-r--r--WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp50
-rw-r--r--WebCore/platform/graphics/cairo/GOwnPtrCairo.h41
-rw-r--r--WebCore/platform/graphics/cairo/GradientCairo.cpp9
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp8
-rw-r--r--WebCore/platform/graphics/cairo/ImageBufferCairo.cpp2
-rw-r--r--WebCore/platform/graphics/cairo/ImageCairo.cpp2
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextCG.cpp2
-rw-r--r--WebCore/platform/graphics/cg/ImageBufferCG.cpp29
-rw-r--r--WebCore/platform/graphics/cg/ImageSourceCG.cpp23
-rw-r--r--WebCore/platform/graphics/chromium/FontChromiumWin.cpp4
-rw-r--r--WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp1
-rw-r--r--WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp104
-rw-r--r--WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp48
-rw-r--r--WebCore/platform/graphics/chromium/LayerChromium.cpp7
-rw-r--r--WebCore/platform/graphics/chromium/LayerChromium.h12
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.cpp155
-rw-r--r--WebCore/platform/graphics/chromium/LayerRendererChromium.h6
-rw-r--r--WebCore/platform/graphics/gtk/FontGtk.cpp2
-rw-r--r--WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp2
-rw-r--r--WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp2
-rw-r--r--WebCore/platform/graphics/mac/FontMac.mm2
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp2
-rw-r--r--WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp2
-rw-r--r--WebCore/platform/graphics/qt/FontQt.cpp187
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp11
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp19
-rw-r--r--WebCore/platform/graphics/qt/GraphicsLayerQt.cpp15
-rw-r--r--WebCore/platform/graphics/qt/ImageBufferQt.cpp16
-rw-r--r--WebCore/platform/graphics/qt/ImageQt.cpp17
-rw-r--r--WebCore/platform/graphics/qt/PathQt.cpp56
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp6
-rw-r--r--WebCore/platform/graphics/skia/ImageBufferSkia.cpp2
-rw-r--r--WebCore/platform/graphics/skia/ImageSkia.cpp12
-rw-r--r--WebCore/platform/graphics/skia/PlatformContextSkia.cpp40
-rw-r--r--WebCore/platform/graphics/skia/PlatformContextSkia.h9
-rw-r--r--WebCore/platform/graphics/skia/SkiaFontWin.cpp2
-rw-r--r--WebCore/platform/graphics/win/FontCGWin.cpp4
-rw-r--r--WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp2
-rw-r--r--WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h2
-rw-r--r--WebCore/platform/graphics/win/QTCFDictionary.cpp5
-rw-r--r--WebCore/platform/graphics/win/WKCAImageQueue.cpp2
-rw-r--r--WebCore/platform/graphics/win/WKCAImageQueue.h2
-rw-r--r--WebCore/platform/graphics/wince/GraphicsContextWince.cpp6
-rw-r--r--WebCore/platform/graphics/wince/ImageBufferWince.cpp2
-rw-r--r--WebCore/platform/graphics/wx/GraphicsContextWx.cpp2
-rw-r--r--WebCore/platform/graphics/wx/ImageBufferWx.cpp2
-rw-r--r--WebCore/platform/gtk/CursorGtk.cpp3
-rw-r--r--WebCore/platform/gtk/DragDataGtk.cpp4
-rw-r--r--WebCore/platform/gtk/FileChooserGtk.cpp5
-rw-r--r--WebCore/platform/gtk/FileSystemGtk.cpp77
-rw-r--r--WebCore/platform/gtk/GOwnPtrGtk.cpp33
-rw-r--r--WebCore/platform/gtk/GOwnPtrGtk.h33
-rw-r--r--WebCore/platform/gtk/GtkPluginWidget.cpp2
-rw-r--r--WebCore/platform/gtk/GtkVersioning.h4
-rw-r--r--WebCore/platform/gtk/PlatformScreenGtk.cpp4
-rw-r--r--WebCore/platform/gtk/PopupMenuGtk.cpp3
-rw-r--r--WebCore/platform/gtk/RenderThemeGtk.cpp65
-rw-r--r--WebCore/platform/gtk/RenderThemeGtk.h8
-rw-r--r--WebCore/platform/gtk/SharedBufferGtk.cpp6
-rw-r--r--WebCore/platform/gtk/WidgetGtk.cpp5
-rw-r--r--WebCore/platform/haiku/DragDataHaiku.cpp4
-rw-r--r--WebCore/platform/haiku/SharedBufferHaiku.cpp11
-rw-r--r--WebCore/platform/mac/CursorMac.mm8
-rw-r--r--WebCore/platform/mac/DragDataMac.mm8
-rw-r--r--WebCore/platform/mac/WebCoreSystemInterface.h2
-rw-r--r--WebCore/platform/mac/WebCoreSystemInterface.mm2
-rw-r--r--WebCore/platform/mac/WheelEventMac.mm11
-rw-r--r--WebCore/platform/network/FormData.cpp124
-rw-r--r--WebCore/platform/network/FormData.h29
-rw-r--r--WebCore/platform/network/chromium/ResourceResponse.h8
-rw-r--r--WebCore/platform/network/mac/FormDataStreamMac.mm21
-rw-r--r--WebCore/platform/network/soup/ResourceHandleSoup.cpp6
-rw-r--r--WebCore/platform/posix/SharedBufferPOSIX.cpp5
-rw-r--r--WebCore/platform/qt/ClipboardQt.cpp14
-rw-r--r--WebCore/platform/qt/ContextMenuItemQt.cpp3
-rw-r--r--WebCore/platform/qt/ContextMenuQt.cpp8
-rw-r--r--WebCore/platform/qt/CursorQt.cpp7
-rw-r--r--WebCore/platform/qt/DragDataQt.cpp12
-rw-r--r--WebCore/platform/qt/FileChooserQt.cpp2
-rw-r--r--WebCore/platform/qt/FileSystemQt.cpp14
-rw-r--r--WebCore/platform/qt/GeolocationServiceQt.cpp109
-rw-r--r--WebCore/platform/qt/GeolocationServiceQt.h70
-rw-r--r--WebCore/platform/qt/KURLQt.cpp4
-rw-r--r--WebCore/platform/qt/Localizations.cpp19
-rw-r--r--WebCore/platform/qt/LoggingQt.cpp2
-rw-r--r--WebCore/platform/qt/PasteboardQt.cpp4
-rw-r--r--WebCore/platform/qt/PlatformKeyboardEventQt.cpp820
-rw-r--r--WebCore/platform/qt/PlatformMouseEventQt.cpp23
-rw-r--r--WebCore/platform/qt/RenderThemeQt.cpp7
-rw-r--r--WebCore/platform/qt/ScreenQt.cpp8
-rw-r--r--WebCore/platform/qt/ScrollbarQt.cpp4
-rw-r--r--WebCore/platform/qt/ScrollbarThemeQt.cpp64
-rw-r--r--WebCore/platform/qt/SharedTimerQt.cpp5
-rw-r--r--WebCore/platform/qt/SoundQt.cpp3
-rw-r--r--WebCore/platform/qt/TemporaryLinkStubsQt.cpp16
-rw-r--r--WebCore/platform/qt/WheelEventQt.cpp31
-rw-r--r--WebCore/platform/qt/WidgetQt.cpp9
-rw-r--r--WebCore/platform/text/SegmentedString.cpp4
-rw-r--r--WebCore/platform/text/qt/TextBreakIteratorQt.cpp64
-rw-r--r--WebCore/platform/win/ClipboardUtilitiesWin.cpp61
-rw-r--r--WebCore/platform/win/ClipboardUtilitiesWin.h5
-rw-r--r--WebCore/platform/win/ClipboardWin.cpp2
-rw-r--r--WebCore/platform/win/CursorWin.cpp13
-rw-r--r--WebCore/platform/win/DragDataWin.cpp11
-rw-r--r--WebCore/platform/wince/DragDataWince.cpp4
-rw-r--r--WebCore/platform/wx/DragDataWx.cpp4
154 files changed, 3111 insertions, 1129 deletions
diff --git a/WebCore/platform/BlobItem.cpp b/WebCore/platform/BlobItem.cpp
new file mode 100644
index 0000000..949e7f8
--- /dev/null
+++ b/WebCore/platform/BlobItem.cpp
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BlobItem.h"
+
+#include "FileSystem.h"
+#include "UUID.h"
+
+namespace WebCore {
+
+#if ENABLE(BLOB_SLICE)
+static const double invalidModificationTime = 0;
+
+static double getFileSnapshotModificationTime(const String& path)
+{
+ // FIXME: synchronized file call
+ time_t modificationTime;
+ if (getFileModificationTime(path, modificationTime))
+ return static_cast<double>(modificationTime);
+ return invalidModificationTime;
+}
+#endif // ENABLE(BLOB_SLICE)
+
+// DataBlobItem ----------------------------------------------------------------
+
+#if ENABLE(BLOB_SLICE)
+PassRefPtr<BlobItem> DataBlobItem::slice(long long start, long long length)
+{
+ ASSERT(start >= 0 && length >= 0);
+ ASSERT(static_cast<unsigned long long>(start) < size());
+ if (!start && size() <= static_cast<unsigned long long>(length))
+ return this;
+ if (static_cast<unsigned long long>(start + length) > size())
+ length = size() - start;
+ return DataRangeBlobItem::create(this, start, length);
+}
+#endif // ENABLE(BLOB_SLICE)
+
+// FileBlobItem ----------------------------------------------------------------
+
+PassRefPtr<BlobItem> FileBlobItem::create(const String& path)
+{
+ return adoptRef(static_cast<BlobItem*>(new FileBlobItem(path)));
+}
+
+FileBlobItem::FileBlobItem(const String& path)
+ : m_path(path)
+ , m_fileName(pathGetFileName(m_path))
+{
+}
+
+unsigned long long FileBlobItem::size() const
+{
+ // FIXME: synchronized file call
+ long long size;
+ if (!getFileSize(m_path, size))
+ return 0;
+ return static_cast<unsigned long long>(size);
+}
+
+#if ENABLE(BLOB_SLICE)
+PassRefPtr<BlobItem> FileBlobItem::slice(long long start, long long length)
+{
+ ASSERT(start >= 0 && length >= 0);
+ ASSERT(static_cast<unsigned long long>(start) < size());
+ if (!start && size() <= static_cast<unsigned long long>(length))
+ return this;
+ const FileRangeBlobItem* fileRangeItem = toFileRangeBlobItem();
+ double modificationTime = fileRangeItem ? fileRangeItem->snapshotModificationTime() : getFileSnapshotModificationTime(path());
+ return FileRangeBlobItem::create(path(), start, length, modificationTime);
+}
+#endif // ENABLE(BLOB_SLICE)
+
+// StringBlobItem --------------------------------------------------------------
+
+PassRefPtr<BlobItem> StringBlobItem::create(const String& text, LineEnding ending, TextEncoding encoding)
+{
+ return adoptRef(static_cast<BlobItem*>(new StringBlobItem(text, ending, encoding)));
+}
+
+PassRefPtr<BlobItem> StringBlobItem::create(const CString& text)
+{
+ return adoptRef(static_cast<BlobItem*>(new StringBlobItem(text)));
+}
+
+StringBlobItem::StringBlobItem(const String& text, LineEnding ending, TextEncoding encoding)
+ : m_data(StringBlobItem::convertToCString(text, ending, encoding))
+{
+}
+
+StringBlobItem::StringBlobItem(const CString& text)
+ : m_data(text)
+{
+}
+
+CString StringBlobItem::convertToCString(const String& text, LineEnding ending, TextEncoding encoding)
+{
+ CString from = encoding.encode(text.characters(), text.length(), EntitiesForUnencodables);
+ CString result = from;
+
+ if (ending == EndingTransparent)
+ return result;
+
+ const char* endingChars = (ending == EndingCRLF) ? "\r\n" : ((ending == EndingCR) ? "\r" : "\n");
+
+ int endingLength = (ending == EndingCRLF) ? 2 : 1;
+ int needFix = 0;
+
+ // Calculate the final length.
+ int calculatedLength = from.length();
+ const char* p = from.data();
+ while (char c = *p++) {
+ if (c == '\r') {
+ // Safe to look ahead because of trailing '\0'.
+ if (*p == '\n' && ending != EndingCRLF) {
+ calculatedLength += (endingLength - 2);
+ ++needFix;
+ } else if (ending != EndingCR) {
+ calculatedLength += (endingLength - 1);
+ ++needFix;
+ }
+ } else if (c == '\n' && ending != EndingLF) {
+ calculatedLength += (endingLength - 1);
+ ++needFix;
+ }
+ }
+
+ if (!needFix)
+ return result;
+
+ // Convert the endings and create a data buffer.
+ p = from.data();
+ char* q;
+ result = CString::newUninitialized(calculatedLength, q);
+ while (char c = *p++) {
+ if (c == '\r') {
+ if (*p == '\n' && ending != EndingCRLF) {
+ memcpy(q, endingChars, endingLength);
+ q += endingLength;
+ } else if (*p != '\n' && ending != EndingCR) {
+ memcpy(q, endingChars, endingLength);
+ q += endingLength;
+ }
+ } else if (c == '\n' && ending != EndingLF) {
+ memcpy(q, endingChars, endingLength);
+ q += endingLength;
+ } else {
+ // Leave other characters alone.
+ *q++ = c;
+ }
+ }
+ return result;
+}
+
+// ByteArrayBlobItem ----------------------------------------------------------
+
+PassRefPtr<BlobItem> ByteArrayBlobItem::create(const char* data, size_t size)
+{
+ return adoptRef(static_cast<BlobItem*>(new ByteArrayBlobItem(data, size)));
+}
+
+ByteArrayBlobItem::ByteArrayBlobItem(const char* data, size_t size)
+{
+ m_bytesArray.append(data, size);
+}
+
+#if ENABLE(BLOB_SLICE)
+
+// DataRangeBlobItem -----------------------------------------------------------
+
+PassRefPtr<BlobItem> DataRangeBlobItem::create(PassRefPtr<DataBlobItem> item, long long start, long long length)
+{
+ return adoptRef(static_cast<BlobItem*>(new DataRangeBlobItem(item, start, length)));
+}
+
+DataRangeBlobItem::DataRangeBlobItem(PassRefPtr<DataBlobItem> item, long long start, long long length)
+ : m_length(length)
+{
+ const DataRangeBlobItem* rangeItem = m_item->toDataRangeBlobItem();
+ if (rangeItem) {
+ m_item = rangeItem->m_item;
+ m_start = start + rangeItem->m_start;
+ ASSERT(!m_item->toDataRangeBlobItem());
+ ASSERT(static_cast<unsigned long long>(m_start + m_length) <= m_item->size());
+ } else {
+ m_item = item;
+ m_start = start;
+ }
+}
+
+const char* DataRangeBlobItem::data() const
+{
+ return m_item->data() + m_start;
+}
+
+// FileRangeBlobItem -----------------------------------------------------------
+
+PassRefPtr<BlobItem> FileRangeBlobItem::create(const String& path, long long start, long long length, double snapshotModificationTime)
+{
+ return adoptRef(static_cast<BlobItem*>(new FileRangeBlobItem(path, start, length, snapshotModificationTime)));
+}
+
+FileRangeBlobItem::FileRangeBlobItem(const String& path, long long start, long long length, double modificationTime)
+ : FileBlobItem(path)
+ , m_start(start)
+ , m_length(length)
+ , m_snapshotModificationTime(modificationTime)
+{
+ m_uniqueName = "Blob" + createCanonicalUUIDString();
+ m_uniqueName.replace("-", ""); // For safty, remove '-' from the filename snce some servers may not like it.
+}
+
+#endif // ENABLE(BLOB_SLICE)
+
+} // namespace WebCore
diff --git a/WebCore/platform/BlobItem.h b/WebCore/platform/BlobItem.h
new file mode 100644
index 0000000..f2ee56b
--- /dev/null
+++ b/WebCore/platform/BlobItem.h
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobItem_h
+#define BlobItem_h
+
+#include "PlatformString.h"
+#include "TextEncoding.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+// String ending types.
+enum LineEnding {
+ EndingTransparent = 0,
+ EndingLF,
+ EndingCR,
+ EndingCRLF,
+};
+
+class ByteArrayBlobItem;
+class DataBlobItem;
+class DataRangeBlobItem;
+class FileBlobItem;
+class FileRangeBlobItem;
+class StringBlobItem;
+
+// A base interface for all arbitrary-data-object component items.
+// The BlobItem and its subclasses are structured like the following:
+// BlobItem
+// |
+// +-------> DataBlobItem
+// | |
+// | +---------> StringBlobItem
+// | +---------> ByteArrayBlobItem
+// | +---------> DataRangeBlobItem
+// |
+// +-------> FileBlobItem
+// |
+// +---------> FileRangeBlobItem
+//
+class BlobItem : public RefCounted<BlobItem> {
+public:
+ virtual ~BlobItem() { }
+ virtual unsigned long long size() const = 0;
+
+ virtual const DataBlobItem* toDataBlobItem() const { return 0; }
+ 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)
+ 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)
+
+protected:
+ BlobItem() { }
+};
+
+typedef Vector<RefPtr<BlobItem> > BlobItemList;
+
+class DataBlobItem : public BlobItem {
+public:
+ virtual const char* data() const = 0;
+
+ // BlobItem methods.
+ virtual const DataBlobItem* toDataBlobItem() const { return this; }
+#if ENABLE(BLOB_SLICE)
+ virtual PassRefPtr<BlobItem> slice(long long start, long long length);
+#endif // ENABLE(BLOB_SLICE)
+};
+
+class FileBlobItem : public BlobItem {
+public:
+ static PassRefPtr<BlobItem> create(const String& path);
+ virtual const String& name() const { return m_fileName; }
+ virtual const String& path() const { return m_path; }
+
+ // BlobItem methods.
+ virtual unsigned long long size() const;
+ virtual const FileBlobItem* toFileBlobItem() const { return this; }
+#if ENABLE(BLOB_SLICE)
+ virtual PassRefPtr<BlobItem> slice(long long start, long long length);
+#endif // ENABLE(BLOB_SLICE)
+
+protected:
+ FileBlobItem(const String& path);
+ String m_path;
+ String m_fileName;
+};
+
+class StringBlobItem : public DataBlobItem {
+public:
+ static PassRefPtr<BlobItem> create(const String&, LineEnding, TextEncoding);
+ static PassRefPtr<BlobItem> create(const CString&);
+ const CString& cstr() const { return m_data; }
+
+ // BlobItem methods.
+ virtual unsigned long long size() const { return m_data.length(); }
+ virtual const StringBlobItem* toStringBlobItem() const { return this; }
+
+ // DataBlobItem methods.
+ virtual const char* data() const { return m_data.data(); }
+
+private:
+ StringBlobItem(const String&, LineEnding, TextEncoding);
+ StringBlobItem(const CString&);
+ static CString convertToCString(const String&, LineEnding, TextEncoding);
+ CString m_data;
+};
+
+class ByteArrayBlobItem : public DataBlobItem {
+public:
+ static PassRefPtr<BlobItem> create(const char* data, size_t size);
+
+ // BlobItem methods.
+ virtual unsigned long long size() const { return m_bytesArray.size(); }
+ virtual const ByteArrayBlobItem* toByteArrayBlobItem() const { return this; }
+
+ // DataBlobItem methods.
+ virtual const char* data() const { return m_bytesArray.data(); }
+
+private:
+ ByteArrayBlobItem(const char* data, size_t size);
+ Vector<char> m_bytesArray;
+};
+
+#if ENABLE(BLOB_SLICE)
+
+// BlobItem class for sliced data (string or bytes-array).
+class DataRangeBlobItem : public DataBlobItem {
+public:
+ static PassRefPtr<BlobItem> create(PassRefPtr<DataBlobItem>, long long start, long long length);
+
+ // BlobItem methods.
+ virtual unsigned long long size() const { return m_length; }
+ virtual const DataRangeBlobItem* toDataRangeBlobItem() const { return this; }
+
+ // DataBlobItem methods.
+ virtual const char* data() const;
+
+private:
+ DataRangeBlobItem(PassRefPtr<DataBlobItem>, long long start, long long length);
+ RefPtr<DataBlobItem> m_item;
+ long long m_start;
+ long long m_length;
+};
+
+class FileRangeBlobItem : public FileBlobItem {
+public:
+ static PassRefPtr<BlobItem> create(const String& path, long long start, long long length, double snapshotModificationTime);
+ long long start() const { return m_start; }
+ double snapshotModificationTime() const { return m_snapshotModificationTime; }
+
+ // BlobItem methods.
+ virtual unsigned long long size() const { return m_length; }
+ virtual const FileRangeBlobItem* toFileRangeBlobItem() const { return this; }
+
+ // FileBlobItem methods.
+ virtual const String& name() const { return m_uniqueName; }
+
+private:
+ FileRangeBlobItem(const String& path, long long start, long long length, double snapshotModificationTime);
+ long long m_start;
+ long long m_length;
+ String m_uniqueName;
+
+ double m_snapshotModificationTime;
+};
+
+#endif // ENABLE(BLOB_SLICE)
+
+} // namespace WebCore
+
+#endif // BlobItem_h
diff --git a/WebCore/platform/ColorData.gperf b/WebCore/platform/ColorData.gperf
index 8a54916..11ef798 100644
--- a/WebCore/platform/ColorData.gperf
+++ b/WebCore/platform/ColorData.gperf
@@ -1,4 +1,16 @@
-struct NamedColor { const char *name; int RGBValue; };
+%struct-type
+struct NamedColor {
+ const char *name;
+ int RGBValue;
+};
+%language=ANSI-C
+%readonly-tables
+%global-table
+%compare-strncmp
+%define lookup-function-name findColor
+%define hash-function-name colordata_hash_function
+%includes
+%enum
%%
aliceblue, 0xf0f8ff
antiquewhite, 0xfaebd7
diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp
index 66d3496..00bb253 100644
--- a/WebCore/platform/ContextMenu.cpp
+++ b/WebCore/platform/ContextMenu.cpp
@@ -570,6 +570,7 @@ void ContextMenu::addInspectElementItem()
return;
ContextMenuItem InspectElementItem(ActionType, ContextMenuItemTagInspectElement, contextMenuItemTagInspectElement());
+ appendItem(*separatorItem());
appendItem(InspectElementItem);
}
#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/platform/Cursor.cpp b/WebCore/platform/Cursor.cpp
new file mode 100644
index 0000000..794a9dc
--- /dev/null
+++ b/WebCore/platform/Cursor.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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. ``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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Cursor.h"
+
+#include "Image.h"
+
+namespace WebCore {
+
+IntPoint determineHotSpot(Image* image, const IntPoint& specifiedHotSpot)
+{
+ // Hot spot must be inside cursor rectangle.
+ IntRect imageRect = image->rect();
+ if (imageRect.contains(specifiedHotSpot))
+ return specifiedHotSpot;
+
+ // If hot spot is not specified externally, it can be extracted from some image formats (e.g. .cur).
+ IntPoint intrinsicHotSpot;
+ bool imageHasIntrinsicHotSpot = image->getHotSpot(intrinsicHotSpot);
+ if (imageHasIntrinsicHotSpot && imageRect.contains(intrinsicHotSpot))
+ return intrinsicHotSpot;
+
+ return IntPoint();
+}
+
+}
diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h
index 76f19e9..12b1614 100644
--- a/WebCore/platform/Cursor.h
+++ b/WebCore/platform/Cursor.h
@@ -110,7 +110,7 @@ namespace WebCore {
#endif
{ }
- Cursor(Image*, const IntPoint& hotspot);
+ Cursor(Image*, const IntPoint& hotSpot);
Cursor(const Cursor&);
~Cursor();
Cursor& operator=(const Cursor&);
@@ -122,6 +122,8 @@ namespace WebCore {
PlatformCursor m_impl;
};
+ IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot);
+
const Cursor& pointerCursor();
const Cursor& crossCursor();
const Cursor& handCursor();
diff --git a/WebCore/platform/DragData.h b/WebCore/platform/DragData.h
index 5020739..eda7e7e 100644
--- a/WebCore/platform/DragData.h
+++ b/WebCore/platform/DragData.h
@@ -80,6 +80,8 @@ namespace WebCore {
class DragData {
public:
+ enum FilenameConversionPolicy { DoNotConvertFilenames, ConvertFilenames };
+
#if PLATFORM(MAC)
//FIXME: In the future the WebKit functions provided by the helper class should be moved into WebCore,
//after which this constructor should be removed
@@ -94,10 +96,10 @@ namespace WebCore {
DragDataRef platformData() const { return m_platformDragData; }
DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; }
PassRefPtr<Clipboard> createClipboard(ClipboardAccessPolicy) const;
- bool containsURL() const;
+ bool containsURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames) const;
bool containsPlainText() const;
bool containsCompatibleContent() const;
- String asURL(String* title = 0) const;
+ String asURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames, String* title = 0) const;
String asPlainText() const;
void asFilenames(Vector<String>&) const;
Color asColor() const;
diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h
index c79237b..f270c31 100644
--- a/WebCore/platform/FileSystem.h
+++ b/WebCore/platform/FileSystem.h
@@ -172,8 +172,6 @@ String roamingUserSpecificStorageDirectory();
bool safeCreateFile(const String&, CFDataRef);
#endif
-char* filenameFromString(const String&);
-
#if PLATFORM(GTK)
String filenameToString(const char*);
String filenameForDisplay(const String&);
diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h
index 5121995..be25973 100644
--- a/WebCore/platform/PlatformMouseEvent.h
+++ b/WebCore/platform/PlatformMouseEvent.h
@@ -122,6 +122,7 @@ namespace WebCore {
#if PLATFORM(GTK)
PlatformMouseEvent(GdkEventButton*);
PlatformMouseEvent(GdkEventMotion*);
+ void setClickCount(int count) { m_clickCount = count; }
#endif
#if PLATFORM(EFL)
diff --git a/WebCore/platform/PopupMenuClient.h b/WebCore/platform/PopupMenuClient.h
index 2f3f892..bffde92 100644
--- a/WebCore/platform/PopupMenuClient.h
+++ b/WebCore/platform/PopupMenuClient.h
@@ -38,6 +38,8 @@ class PopupMenuClient {
public:
virtual ~PopupMenuClient() {}
virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0;
+ virtual void selectionChanged(unsigned listIndex, bool fireEvents = true) = 0;
+ virtual void selectionCleared() = 0;
virtual String itemText(unsigned listIndex) const = 0;
virtual String itemToolTip(unsigned listIndex) const = 0;
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index 3ed65c3..87d58c7 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -322,7 +322,7 @@ void ScrollView::valueChanged(Scrollbar* scrollbar)
if (scrollbarsSuppressed())
return;
- scrollPositionChanged();
+ repaintFixedElementsAfterScrolling();
scrollContents(scrollDelta);
}
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index 27bdedd..8bda7af 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -305,7 +305,7 @@ private:
void updateScrollbars(const IntSize& desiredOffset);
// Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations.
- virtual void scrollPositionChanged() {}
+ virtual void repaintFixedElementsAfterScrolling() {}
void platformInit();
void platformDestroy();
diff --git a/WebCore/platform/ThemeTypes.h b/WebCore/platform/ThemeTypes.h
index 657797f..7314fba 100644
--- a/WebCore/platform/ThemeTypes.h
+++ b/WebCore/platform/ThemeTypes.h
@@ -56,7 +56,9 @@ enum ControlPart {
SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
- SearchFieldCancelButtonPart, TextFieldPart, TextAreaPart, CapsLockIndicatorPart
+ SearchFieldCancelButtonPart, TextFieldPart, CapsLockIndicatorPart,
+ RelevancyLevelIndicatorPart, ContinuousCapacityLevelIndicatorPart, DiscreteCapacityLevelIndicatorPart, RatingLevelIndicatorPart,
+ TextAreaPart
};
enum SelectionPart {
diff --git a/WebCore/platform/android/DragDataAndroid.cpp b/WebCore/platform/android/DragDataAndroid.cpp
index 39b2963..756d007 100644
--- a/WebCore/platform/android/DragDataAndroid.cpp
+++ b/WebCore/platform/android/DragDataAndroid.cpp
@@ -68,12 +68,12 @@ bool DragData::containsCompatibleContent() const
return false;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy) const
{
return false;
}
-String DragData::asURL(String*) const
+String DragData::asURL(FilenameConversionPolicy, String*) const
{
return String();
}
diff --git a/WebCore/platform/animation/Animation.h b/WebCore/platform/animation/Animation.h
index a629f43..cabb0eb 100644
--- a/WebCore/platform/animation/Animation.h
+++ b/WebCore/platform/animation/Animation.h
@@ -39,7 +39,8 @@ class Animation : public RefCounted<Animation> {
public:
~Animation();
- static PassRefPtr<Animation> create() { return adoptRef(new Animation); };
+ static PassRefPtr<Animation> create() { return adoptRef(new Animation); }
+ static PassRefPtr<Animation> create(const Animation* o) { return adoptRef(new Animation(*o)); }
bool isDelaySet() const { return m_delaySet; }
bool isDirectionSet() const { return m_directionSet; }
diff --git a/WebCore/platform/animation/AnimationList.cpp b/WebCore/platform/animation/AnimationList.cpp
index bd5fdee..58a40aa 100644
--- a/WebCore/platform/animation/AnimationList.cpp
+++ b/WebCore/platform/animation/AnimationList.cpp
@@ -31,6 +31,12 @@ if (i < size() && i != 0) { \
animation(i)->propSet(animation(j)->propGet()); \
}
+AnimationList::AnimationList(const AnimationList& o)
+{
+ for (size_t i = 0; i < o.size(); ++i)
+ m_animations.append(Animation::create(o.animation(i)));
+}
+
void AnimationList::fillUnsetProperties()
{
size_t i;
diff --git a/WebCore/platform/animation/AnimationList.h b/WebCore/platform/animation/AnimationList.h
index afad422..9a334ca 100644
--- a/WebCore/platform/animation/AnimationList.h
+++ b/WebCore/platform/animation/AnimationList.h
@@ -33,6 +33,9 @@ namespace WebCore {
class AnimationList : public FastAllocBase {
public:
+ AnimationList() { }
+ AnimationList(const AnimationList&);
+
void fillUnsetProperties();
bool operator==(const AnimationList& o) const;
bool operator!=(const AnimationList& o) const
@@ -51,6 +54,8 @@ public:
const Animation* animation(size_t i) const { return m_animations[i].get(); }
private:
+ AnimationList& operator=(const AnimationList&);
+
Vector<RefPtr<Animation> > m_animations;
};
diff --git a/WebCore/platform/brew/ClipboardBrew.cpp b/WebCore/platform/brew/ClipboardBrew.cpp
new file mode 100644
index 0000000..3fd085a
--- /dev/null
+++ b/WebCore/platform/brew/ClipboardBrew.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ClipboardBrew.h"
+
+#include "CachedImage.h"
+#include "Element.h"
+#include "FileList.h"
+#include "Frame.h"
+#include "NotImplemented.h"
+#include "Range.h"
+
+namespace WebCore {
+
+ClipboardBrew::ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging)
+ : Clipboard(policy, isForDragging)
+{
+}
+
+ClipboardBrew::~ClipboardBrew()
+{
+}
+
+void ClipboardBrew::clearData(const String&)
+{
+ ASSERT(isForDragging());
+}
+
+void ClipboardBrew::clearAllData()
+{
+ ASSERT(isForDragging());
+}
+
+String ClipboardBrew::getData(const String&, bool& success) const
+{
+ success = false;
+ return "";
+}
+
+bool ClipboardBrew::setData(const String&, const String&)
+{
+ ASSERT(isForDragging());
+ return false;
+}
+
+// extensions beyond IE's API
+HashSet<String> ClipboardBrew::types() const
+{
+ return HashSet<String>();
+}
+
+PassRefPtr<FileList> ClipboardBrew::files() const
+{
+ notImplemented();
+ return 0;
+}
+
+void ClipboardBrew::setDragImage(CachedImage*, const IntPoint&)
+{
+}
+
+void ClipboardBrew::setDragImageElement(Node*, const IntPoint&)
+{
+}
+
+DragImageRef ClipboardBrew::createDragImage(IntPoint&) const
+{
+ return 0;
+}
+
+void ClipboardBrew::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*)
+{
+}
+
+void ClipboardBrew::writeURL(const KURL&, const String&, Frame*)
+{
+}
+
+void ClipboardBrew::writeRange(Range* selectedRange, Frame*)
+{
+ ASSERT(selectedRange);
+}
+
+void ClipboardBrew::writePlainText(const String&)
+{
+}
+
+bool ClipboardBrew::hasData()
+{
+ return false;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/brew/ClipboardBrew.h b/WebCore/platform/brew/ClipboardBrew.h
new file mode 100644
index 0000000..a966db1
--- /dev/null
+++ b/WebCore/platform/brew/ClipboardBrew.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ClipboardBrew_h
+#define ClipboardBrew_h
+
+#include "CachedResourceClient.h"
+#include "Clipboard.h"
+
+namespace WebCore {
+
+class CachedImage;
+
+class ClipboardBrew : public Clipboard, public CachedResourceClient {
+public:
+ ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging);
+ ~ClipboardBrew();
+
+ void clearData(const String&);
+ void clearAllData();
+ String getData(const String&, bool& success) const;
+ bool setData(const String&, const String&);
+
+ // extensions beyond IE's API
+ HashSet<String> types() const;
+ virtual PassRefPtr<FileList> files() const;
+
+ void setDragImage(CachedImage*, const IntPoint&);
+ void setDragImageElement(Node*, const IntPoint&);
+
+ virtual DragImageRef createDragImage(IntPoint&) const;
+ virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*);
+ virtual void writeURL(const KURL&, const String&, Frame*);
+ virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
+
+ virtual bool hasData();
+};
+
+} // namespace WebCore
+
+#endif // ClipboardBrew_h
diff --git a/WebCore/platform/brew/ContextMenuBrew.cpp b/WebCore/platform/brew/ContextMenuBrew.cpp
new file mode 100644
index 0000000..924e9dd
--- /dev/null
+++ b/WebCore/platform/brew/ContextMenuBrew.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ContextMenu.h"
+
+#include "NotImplemented.h"
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+ContextMenu::ContextMenu(const HitTestResult& result)
+ : m_hitTestResult(result)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenu::ContextMenu(const HitTestResult& result, const PlatformMenuDescription menu)
+ : m_hitTestResult(result)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenu::~ContextMenu()
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+unsigned ContextMenu::itemCount() const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenu::appendItem(ContextMenuItem& item)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenuItem* ContextMenu::itemWithAction(unsigned action)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+ContextMenuItem* ContextMenu::itemAtIndex(unsigned index, const PlatformMenuDescription platformDescription)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+PlatformMenuDescription ContextMenu::platformDescription() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+PlatformMenuDescription ContextMenu::releasePlatformDescription()
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+}
diff --git a/WebCore/platform/brew/ContextMenuItemBrew.cpp b/WebCore/platform/brew/ContextMenuItemBrew.cpp
new file mode 100644
index 0000000..717084d
--- /dev/null
+++ b/WebCore/platform/brew/ContextMenuItemBrew.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ContextMenuItem.h"
+
+#include "ContextMenu.h"
+#include "NotImplemented.h"
+
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+ContextMenuItem::ContextMenuItem(PlatformMenuDescription item)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenu* subMenu)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+ContextMenuItem::~ContextMenuItem()
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+PlatformMenuDescription ContextMenuItem::releasePlatformDescription()
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+ContextMenuItemType ContextMenuItem::type() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return ActionType;
+}
+
+ContextMenuAction ContextMenuItem::action() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return ContextMenuItemTagNoAction;
+}
+
+String ContextMenuItem::title() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return String();
+}
+
+PlatformMenuDescription ContextMenuItem::platformSubMenu() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return 0;
+}
+
+void ContextMenuItem::setType(ContextMenuItemType type)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenuItem::setAction(ContextMenuAction action)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenuItem::setTitle(const String& title)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenuItem::setSubMenu(ContextMenu* subMenu)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenuItem::setChecked(bool checked)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+void ContextMenuItem::setEnabled(bool enabled)
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+}
+
+bool ContextMenuItem::enabled() const
+{
+ ASSERT_NOT_REACHED();
+ notImplemented();
+ return false;
+}
+
+}
diff --git a/WebCore/platform/FileSystem.cpp b/WebCore/platform/brew/EventLoopBrew.cpp
index 01318e3..286b983 100644
--- a/WebCore/platform/FileSystem.cpp
+++ b/WebCore/platform/brew/EventLoopBrew.cpp
@@ -4,13 +4,13 @@
* 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
+ * * 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
+ * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
@@ -24,17 +24,13 @@
*/
#include "config.h"
-#include "FileSystem.h"
-
-#include <wtf/text/CString.h>
+#include "EventLoop.h"
namespace WebCore {
-#if !PLATFORM(GTK) && !PLATFORM(EFL)
-char* filenameFromString(const String& string)
+void EventLoop::cycle()
{
- return fastStrDup(string.utf8().data());
+ // BREW MP does not have an explicit event loop.
}
-#endif
} // namespace WebCore
diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.cpp b/WebCore/platform/brew/SearchPopupMenuBrew.cpp
new file mode 100644
index 0000000..780c7e5
--- /dev/null
+++ b/WebCore/platform/brew/SearchPopupMenuBrew.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+// Save the past searches stored in 'searchItems' to a database associated with 'name'
+void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+{
+}
+
+// Load past searches associated with 'name' from the database to 'searchItems'
+void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+{
+}
+
+// Create a search popup menu - not sure what else we have to do here
+SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
+ : PopupMenu(client)
+{
+}
+
+bool SearchPopupMenu::enabled()
+{
+ return false;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/chromium/DragDataChromium.cpp b/WebCore/platform/chromium/DragDataChromium.cpp
index 1ce20dc..2c2151a 100644
--- a/WebCore/platform/chromium/DragDataChromium.cpp
+++ b/WebCore/platform/chromium/DragDataChromium.cpp
@@ -56,17 +56,17 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co
return clipboard.release();
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
- return !asURL().isEmpty();
+ return !asURL(filenamePolicy).isEmpty();
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
String url;
if (m_platformDragData->hasValidURL())
url = m_platformDragData->getURL().string();
- else if (!m_platformDragData->filenames.isEmpty()) {
+ else if (filenamePolicy == ConvertFilenames && !m_platformDragData->filenames.isEmpty()) {
String fileName = m_platformDragData->filenames[0];
fileName = ChromiumBridge::getAbsolutePath(fileName);
url = ChromiumBridge::filePathToURL(fileName).string();
diff --git a/WebCore/platform/chromium/KeyCodeConversionGtk.cpp b/WebCore/platform/chromium/KeyCodeConversionGtk.cpp
index a709f3e..a7f4245 100644
--- a/WebCore/platform/chromium/KeyCodeConversionGtk.cpp
+++ b/WebCore/platform/chromium/KeyCodeConversionGtk.cpp
@@ -276,8 +276,10 @@ int windowsKeyCodeForKeyEvent(unsigned keycode)
case GDK_Z:
return VKEY_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
case GDK_Meta_L:
+ case GDK_Super_L:
return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
case GDK_Meta_R:
+ case GDK_Super_R:
return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard)
// VKEY_SLEEP (5F) Computer Sleep key
// VKEY_SEPARATOR (6C) Separator key
diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp
index 6904050..0455482 100644
--- a/WebCore/platform/chromium/PasteboardChromium.cpp
+++ b/WebCore/platform/chromium/PasteboardChromium.cpp
@@ -129,6 +129,10 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
return;
Image* image = cachedImage->image();
ASSERT(image);
+
+ NativeImagePtr bitmap = image->nativeImageForCurrentFrame();
+ if (!bitmap)
+ return;
// If the image is wrapped in a link, |url| points to the target of the
// link. This isn't useful to us, so get the actual image URL.
@@ -145,7 +149,6 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
}
KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(deprecatedParseURL(urlString));
- NativeImagePtr bitmap = image->nativeImageForCurrentFrame();
ChromiumBridge::clipboardWriteImage(bitmap, url, title);
}
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index c612bb0..e8ab333 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -1018,6 +1018,7 @@ void PopupListBox::selectIndex(int index)
invalidateRow(m_selectedIndex);
scrollToRevealSelection();
+ m_popupClient->selectionChanged(m_selectedIndex);
}
}
@@ -1079,6 +1080,7 @@ void PopupListBox::clearSelection()
if (m_selectedIndex != -1) {
invalidateRow(m_selectedIndex);
m_selectedIndex = -1;
+ m_popupClient->selectionCleared();
}
}
diff --git a/WebCore/platform/efl/DragDataEfl.cpp b/WebCore/platform/efl/DragDataEfl.cpp
index 3f9eccb..f6b446c 100644
--- a/WebCore/platform/efl/DragDataEfl.cpp
+++ b/WebCore/platform/efl/DragDataEfl.cpp
@@ -71,12 +71,12 @@ bool DragData::containsCompatibleContent() const
return false;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
return false;
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
return String();
}
diff --git a/WebCore/platform/efl/FileSystemEfl.cpp b/WebCore/platform/efl/FileSystemEfl.cpp
index f612793..31b2e22 100644
--- a/WebCore/platform/efl/FileSystemEfl.cpp
+++ b/WebCore/platform/efl/FileSystemEfl.cpp
@@ -53,17 +53,15 @@ namespace WebCore {
CString fileSystemRepresentation(const String& path)
{
- return path.utf8();
-}
-
-char* filenameFromString(const String& string)
-{
// WARNING: this is just used by platform/network/soup, thus must be GLIB!!!
// TODO: move this to CString and use it instead in both, being more standard
#if PLATFORM(WIN_OS)
- return g_strdup(string.utf8().data());
+ return path.utf8();
#else
- return g_uri_unescape_string(string.utf8().data(), 0);
+ char* filename = g_uri_unescape_string(path.utf8().data(), 0);
+ CString cfilename(filename);
+ g_free(filename);
+ return cfilename;
#endif
}
diff --git a/WebCore/platform/graphics/BitmapImage.cpp b/WebCore/platform/graphics/BitmapImage.cpp
index 62f29cf..2805b21 100644
--- a/WebCore/platform/graphics/BitmapImage.cpp
+++ b/WebCore/platform/graphics/BitmapImage.cpp
@@ -155,6 +155,11 @@ IntSize BitmapImage::currentFrameSize() const
return m_source.frameSizeAtIndex(m_currentFrame);
}
+bool BitmapImage::getHotSpot(IntPoint& hotSpot) const
+{
+ return m_source.getHotSpot(hotSpot);
+}
+
bool BitmapImage::dataChanged(bool allDataReceived)
{
// Because we're modifying the current frame, clear its (now possibly
diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h
index e4261e2..e5591ec 100644
--- a/WebCore/platform/graphics/BitmapImage.h
+++ b/WebCore/platform/graphics/BitmapImage.h
@@ -118,6 +118,7 @@ public:
virtual IntSize size() const;
IntSize currentFrameSize() const;
+ virtual bool getHotSpot(IntPoint&) const;
virtual bool dataChanged(bool allDataReceived);
virtual String filenameExtension() const;
diff --git a/WebCore/platform/graphics/Color.cpp b/WebCore/platform/graphics/Color.cpp
index 17a5d38..2f2a357 100644
--- a/WebCore/platform/graphics/Color.cpp
+++ b/WebCore/platform/graphics/Color.cpp
@@ -31,7 +31,7 @@
#include <wtf/Assertions.h>
#include <wtf/MathExtras.h>
-#include "ColorData.c"
+#include "ColorData.cpp"
using namespace std;
using namespace WTF;
diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp
index 7682011..6414147 100644
--- a/WebCore/platform/graphics/Font.cpp
+++ b/WebCore/platform/graphics/Font.cpp
@@ -38,7 +38,6 @@ using namespace Unicode;
namespace WebCore {
-#if USE(FONT_FAST_PATH)
const uint8_t Font::gRoundingHackCharacterTable[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1 /*space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*-*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*?*/,
@@ -51,7 +50,6 @@ const uint8_t Font::gRoundingHackCharacterTable[256] = {
};
Font::CodePath Font::s_codePath = Auto;
-#endif
// ============================================================================================
// Font Implementation (Cross-Platform Portion)
@@ -151,10 +149,8 @@ void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi
}
#endif
-#if USE(FONT_FAST_PATH)
if (codePath(run) != Complex)
return drawSimpleText(context, run, point, from, to);
-#endif
return drawComplexText(context, run, point, from, to);
}
@@ -166,7 +162,6 @@ float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallb
return floatWidthUsingSVGFont(run);
#endif
-#if USE(FONT_FAST_PATH)
CodePath codePathToUse = codePath(run);
if (codePathToUse != Complex) {
// If the complex text implementation cannot return fallback fonts, avoid
@@ -174,7 +169,6 @@ float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallb
static bool returnFallbackFonts = canReturnFallbackFontsForComplexText();
return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow ? glyphOverflow : 0);
}
-#endif
return floatWidthForComplexText(run, fallbackFonts, glyphOverflow);
}
@@ -191,10 +185,8 @@ float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsCo
charsConsumed = run.length();
glyphName = "";
-#if USE(FONT_FAST_PATH)
if (codePath(run) != Complex)
return floatWidthForSimpleText(run, 0);
-#endif
return floatWidthForComplexText(run);
}
@@ -208,10 +200,8 @@ FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point,
to = (to == -1 ? run.length() : to);
-#if USE(FONT_FAST_PATH)
if (codePath(run) != Complex)
return selectionRectForSimpleText(run, point, h, from, to);
-#endif
return selectionRectForComplexText(run, point, h, from, to);
}
@@ -223,10 +213,8 @@ int Font::offsetForPosition(const TextRun& run, int x, bool includePartialGlyphs
return offsetForPositionForTextUsingSVGFont(run, x, includePartialGlyphs);
#endif
-#if USE(FONT_FAST_PATH)
if (codePath(run) != Complex)
return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
-#endif
return offsetForPositionForComplexText(run, x, includePartialGlyphs);
}
@@ -268,4 +256,79 @@ bool Font::shouldUseSmoothing()
return shouldUseFontSmoothing;
}
+void Font::setCodePath(CodePath p)
+{
+ s_codePath = p;
+}
+
+Font::CodePath Font::codePath()
+{
+ return s_codePath;
+}
+
+Font::CodePath Font::codePath(const TextRun& run) const
+{
+ if (s_codePath != Auto)
+ return s_codePath;
+
+#if PLATFORM(QT)
+ if (run.padding() || run.rtl() || isSmallCaps() || wordSpacing() || letterSpacing())
+ return Complex;
+#endif
+
+ // Start from 0 since drawing and highlighting also measure the characters before run->from
+ for (int i = 0; i < run.length(); i++) {
+ const UChar c = run[i];
+ if (c < 0x300) // U+0300 through U+036F Combining diacritical marks
+ continue;
+ if (c <= 0x36F)
+ return Complex;
+
+ if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha
+ continue;
+ if (c <= 0x05CF)
+ return Complex;
+
+ if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar
+ continue;
+ if (c <= 0x1059)
+ return Complex;
+
+ if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A)
+ continue;
+ if (c <= 0x11FF)
+ return Complex;
+
+ if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian
+ continue;
+ if (c <= 0x18AF)
+ return Complex;
+
+ if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0)
+ continue;
+ if (c <= 0x194F)
+ return Complex;
+
+ if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics
+ continue;
+ if (c <= 0x2000)
+ return SimpleWithGlyphOverflow;
+
+ if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols
+ continue;
+ if (c <= 0x20FF)
+ return Complex;
+
+ if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks
+ continue;
+ if (c <= 0xFE2F)
+ return Complex;
+ }
+
+ if (typesettingFeatures())
+ return Complex;
+
+ return Simple;
+}
+
}
diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h
index 6633a50..2b36cca 100644
--- a/WebCore/platform/graphics/Font.h
+++ b/WebCore/platform/graphics/Font.h
@@ -151,9 +151,7 @@ public:
static void setShouldUseSmoothing(bool);
static bool shouldUseSmoothing();
-#if USE(FONT_FAST_PATH)
enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow };
-#endif
private:
#if ENABLE(SVG_FONTS)
@@ -164,8 +162,6 @@ private:
int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const;
#endif
-#if USE(FONT_FAST_PATH)
- CodePath codePath(const TextRun&) const;
void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const;
void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const;
@@ -174,8 +170,8 @@ private:
FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;
static bool canReturnFallbackFontsForComplexText();
-#endif
+ CodePath codePath(const TextRun&) const;
void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const;
@@ -185,7 +181,6 @@ private:
public:
// Useful for debugging the different font rendering code paths.
-#if USE(FONT_FAST_PATH)
static void setCodePath(CodePath);
static CodePath codePath();
static CodePath s_codePath;
@@ -195,7 +190,6 @@ public:
{
return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c]));
}
-#endif
FontSelector* fontSelector() const;
static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp
index f57ae5b..b863e83 100644
--- a/WebCore/platform/graphics/FontFastPath.cpp
+++ b/WebCore/platform/graphics/FontFastPath.cpp
@@ -180,76 +180,6 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap
return data;
}
-void Font::setCodePath(CodePath p)
-{
- s_codePath = p;
-}
-
-Font::CodePath Font::codePath()
-{
- return s_codePath;
-}
-
-Font::CodePath Font::codePath(const TextRun& run) const
-{
- if (s_codePath != Auto)
- return s_codePath;
-
- // Start from 0 since drawing and highlighting also measure the characters before run->from
- for (int i = 0; i < run.length(); i++) {
- const UChar c = run[i];
- if (c < 0x300) // U+0300 through U+036F Combining diacritical marks
- continue;
- if (c <= 0x36F)
- return Complex;
-
- if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha
- continue;
- if (c <= 0x05CF)
- return Complex;
-
- if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar
- continue;
- if (c <= 0x1059)
- return Complex;
-
- if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A)
- continue;
- if (c <= 0x11FF)
- return Complex;
-
- if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian
- continue;
- if (c <= 0x18AF)
- return Complex;
-
- if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0)
- continue;
- if (c <= 0x194F)
- return Complex;
-
- if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics
- continue;
- if (c <= 0x2000)
- return SimpleWithGlyphOverflow;
-
- if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols
- continue;
- if (c <= 0x20FF)
- return Complex;
-
- if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks
- continue;
- if (c <= 0xFE2F)
- return Complex;
- }
-
- if (typesettingFeatures())
- return Complex;
-
- return Simple;
-}
-
void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
// This glyph buffer holds our glyphs+advances+font data for each glyph.
diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp
index 0e961ad..198b41a 100644
--- a/WebCore/platform/graphics/Gradient.cpp
+++ b/WebCore/platform/graphics/Gradient.cpp
@@ -202,7 +202,11 @@ void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTra
setPlatformGradientSpaceTransform(gradientSpaceTransformation);
}
+<<<<<<< HEAD:WebCore/platform/graphics/Gradient.cpp
#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID))
+=======
+#if !PLATFORM(SKIA) && !PLATFORM(CAIRO)
+>>>>>>> Webkit.org at r61121:WebCore/platform/graphics/Gradient.cpp
void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&)
{
}
diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h
index 2c877af..b526e51 100644
--- a/WebCore/platform/graphics/Gradient.h
+++ b/WebCore/platform/graphics/Gradient.h
@@ -93,12 +93,14 @@ namespace WebCore {
void getColor(float value, float* r, float* g, float* b, float* a) const;
+ bool isRadial() const { return m_radial; }
+ bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y(); }
+
#if OS(WINCE) && !PLATFORM(QT)
const FloatPoint& p0() const { return m_p0; }
const FloatPoint& p1() const { return m_p1; }
float r0() const { return m_r0; }
float r1() const { return m_r1; }
- bool isRadial() const { return m_radial; }
const Vector<ColorStop>& getStops() const;
#else
#if PLATFORM(ANDROID)
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index 0105c53..629d100 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -129,7 +129,7 @@ void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
setPlatformStrokeColor(color, colorSpace);
}
-void GraphicsContext::setShadow(const IntSize& size, int blur, const Color& color, ColorSpace colorSpace)
+void GraphicsContext::setShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace)
{
m_common->state.shadowSize = size;
m_common->state.shadowBlur = blur;
@@ -145,7 +145,7 @@ void GraphicsContext::clearShadow()
clearPlatformShadow();
}
-bool GraphicsContext::getShadow(IntSize& size, int& blur, Color& color) const
+bool GraphicsContext::getShadow(IntSize& size, float& blur, Color& color) const
{
size = m_common->state.shadowSize;
blur = m_common->state.shadowBlur;
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index caa0a7c..b857546 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -298,8 +298,8 @@ namespace WebCore {
void beginTransparencyLayer(float opacity);
void endTransparencyLayer();
- void setShadow(const IntSize&, int blur, const Color&, ColorSpace);
- bool getShadow(IntSize&, int&, Color&) const;
+ void setShadow(const IntSize&, float blur, const Color&, ColorSpace);
+ bool getShadow(IntSize&, float&, Color&) const;
void clearShadow();
void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
@@ -314,7 +314,7 @@ namespace WebCore {
#if PLATFORM(CAIRO)
float getAlpha();
void createPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, const FloatRect& shadowRect, float kernelSize);
- static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, int shadowBlur);
+ static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur);
#endif
void setCompositeOperation(CompositeOperator);
@@ -444,7 +444,7 @@ namespace WebCore {
void setPlatformShouldAntialias(bool b);
- void setPlatformShadow(const IntSize&, int blur, const Color&, ColorSpace);
+ void setPlatformShadow(const IntSize&, float blur, const Color&, ColorSpace);
void clearPlatformShadow();
static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index 97465e2..a5ca8c7 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -54,7 +54,8 @@ bool GraphicsContext3D::extractImageData(Image* image,
image->height(),
flipY,
alphaOp);
- *internalFormat = (hasAlphaChannel ? RGBA : RGB);
+ // For GLES2 tex functions, internalformat has to match format.
+ *internalFormat = *format;
return true;
}
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index b62f52c..8d5c286 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -45,8 +45,8 @@ const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
typedef GLuint Platform3DObject;
const Platform3DObject NullPlatform3DObject = 0;
#elif PLATFORM(QT)
-#include <QtOpenGL/QtOpenGL>
-
+class QPainter;
+class QRect;
typedef void* PlatformGraphicsContext3D;
const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
typedef int Platform3DObject;
@@ -63,7 +63,7 @@ namespace WebCore {
class ArrayBufferView;
class WebGLBuffer;
class Uint8Array;
- class FloatArray;
+ class Float32Array;
class WebGLFramebuffer;
class Int32Array;
class WebGLProgram;
@@ -390,7 +390,11 @@ namespace WebCore {
FRAMEBUFFER_BINDING = 0x8CA6,
RENDERBUFFER_BINDING = 0x8CA7,
MAX_RENDERBUFFER_SIZE = 0x84E8,
- INVALID_FRAMEBUFFER_OPERATION = 0x0506
+ INVALID_FRAMEBUFFER_OPERATION = 0x0506,
+
+ // WebGL-specific enums
+ UNPACK_FLIP_Y_WEBGL = 0x9240,
+ UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241
};
// Context creation attributes.
@@ -398,7 +402,7 @@ namespace WebCore {
Attributes()
: alpha(true)
, depth(true)
- , stencil(true)
+ , stencil(false)
, antialias(true)
, premultipliedAlpha(true)
{
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 1980337..baa3392 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -73,7 +73,7 @@ namespace WebCore {
bool paintingDisabled;
IntSize shadowSize;
- unsigned shadowBlur;
+ float shadowBlur;
Color shadowColor;
bool shadowsIgnoreTransforms;
diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h
index 212175c..3230df5 100644
--- a/WebCore/platform/graphics/Image.h
+++ b/WebCore/platform/graphics/Image.h
@@ -109,6 +109,7 @@ public:
IntRect rect() const { return IntRect(IntPoint(), size()); }
int width() const { return size().width(); }
int height() const { return size().height(); }
+ virtual bool getHotSpot(IntPoint&) const { return false; }
bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived);
virtual bool dataChanged(bool /*allDataReceived*/) { return false; }
diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h
index 9163523..9f9ba7e 100644
--- a/WebCore/platform/graphics/ImageBuffer.h
+++ b/WebCore/platform/graphics/ImageBuffer.h
@@ -43,7 +43,7 @@ namespace WebCore {
class IntPoint;
class IntRect;
class String;
-
+
enum ImageColorSpace {
Unknown,
DeviceRGB, // like sRGB
@@ -82,8 +82,8 @@ namespace WebCore {
void putUnmultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint);
void putPremultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint);
-
- String toDataURL(const String& mimeType, double quality = 1.0) const;
+
+ String toDataURL(const String& mimeType, const double* quality = 0) const;
#if !PLATFORM(CG)
AffineTransform baseTransform() const { return AffineTransform(); }
void transformColorSpace(ImageColorSpace srcColorSpace, ImageColorSpace dstColorSpace);
diff --git a/WebCore/platform/graphics/ImageSource.cpp b/WebCore/platform/graphics/ImageSource.cpp
index c2366c1..7f6d323 100644
--- a/WebCore/platform/graphics/ImageSource.cpp
+++ b/WebCore/platform/graphics/ImageSource.cpp
@@ -37,6 +37,10 @@
namespace WebCore {
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+unsigned ImageSource::s_maxPixelsPerDecodedImage = 1024 * 1024;
+#endif
+
ImageSource::ImageSource()
: m_decoder(0)
{
@@ -75,11 +79,8 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
if (!m_decoder) {
m_decoder = static_cast<NativeImageSourcePtr>(ImageDecoder::create(*data));
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
-#ifndef IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS
-#define IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS (1024 * 1024)
-#endif
- if (m_decoder)
- m_decoder->setMaxNumPixels(IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS);
+ if (m_decoder && s_maxPixelsPerDecodedImage)
+ m_decoder->setMaxNumPixels(s_maxPixelsPerDecodedImage);
#endif
}
@@ -107,6 +108,11 @@ IntSize ImageSource::frameSizeAtIndex(size_t index) const
return m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize();
}
+bool ImageSource::getHotSpot(IntPoint&) const
+{
+ return false;
+}
+
int ImageSource::repetitionCount()
{
return m_decoder ? m_decoder->repetitionCount() : cAnimationNone;
diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h
index d9bfa25..716566b 100644
--- a/WebCore/platform/graphics/ImageSource.h
+++ b/WebCore/platform/graphics/ImageSource.h
@@ -61,6 +61,7 @@ class BBitmap;
namespace WebCore {
+class IntPoint;
class IntSize;
class SharedBuffer;
class String;
@@ -172,6 +173,7 @@ public:
bool isSizeAvailable();
IntSize size() const;
IntSize frameSizeAtIndex(size_t) const;
+ bool getHotSpot(IntPoint&) const;
int repetitionCount();
@@ -185,10 +187,18 @@ public:
bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
+<<<<<<< HEAD:WebCore/platform/graphics/ImageSource.h
#if PLATFORM(ANDROID)
void clearURL();
void setURL(const String& url);
#endif
+=======
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+ static unsigned maxPixelsPerDecodedImage() { return s_maxPixelsPerDecodedImage; }
+ static void setMaxPixelsPerDecodedImage(unsigned maxPixels) { s_maxPixelsPerDecodedImage = maxPixels; }
+#endif
+
+>>>>>>> Webkit.org at r61121:WebCore/platform/graphics/ImageSource.h
private:
#if PLATFORM(ANDROID)
// FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder
@@ -196,6 +206,9 @@ private:
protected:
#endif
NativeImageSourcePtr m_decoder;
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+ static unsigned s_maxPixelsPerDecodedImage;
+#endif
};
}
diff --git a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp
index 79b32b4..fceeea1 100644
--- a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp
@@ -21,7 +21,9 @@
#include "config.h"
#include "FontCache.h"
+#include "CString.h"
#include "Font.h"
+#include "GOwnPtrCairo.h"
#include "SimpleFontData.h"
#include <wtf/Assertions.h>
@@ -81,8 +83,57 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne
{
}
+static bool isWellKnownFontName(const AtomicString family)
+{
+ // Fonts that are used by layout tests included. The fact that
+ // they are used in Layout Tests indicate web compatibility issues
+ // if we do not handle them correctly.
+ if (equalIgnoringCase(family, "sans-serif") || equalIgnoringCase(family, "serif")
+ || equalIgnoringCase(family, "monospace") || equalIgnoringCase(family, "cursive")
+ || equalIgnoringCase(family, "fantasy") || equalIgnoringCase(family, "Times")
+ || equalIgnoringCase(family, "Courier") || equalIgnoringCase(family, "Helvetica")
+ || equalIgnoringCase(family, "Arial") || equalIgnoringCase(family, "Lucida Grande")
+ || equalIgnoringCase(family, "Ahem") || equalIgnoringCase(family, "Georgia")
+ || equalIgnoringCase(family, "Times New Roman"))
+ return true;
+
+ return false;
+}
+
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
{
+#if defined(USE_FREETYPE)
+ // Handle generic family types specially, because fontconfig does not know them, but we have
+ // code to fallback correctly in our platform data implementation.
+ if (!family.length() || family.startsWith("-webkit-")
+ || (fontDescription.genericFamily() != FontDescription::NoFamily)
+ || isWellKnownFontName(family))
+ return new FontPlatformData(fontDescription, family);
+
+ // First check the font exists.
+ CString familyNameString = family.string().utf8();
+ const char* fcfamily = familyNameString.data();
+
+ GOwnPtr<FcPattern> pattern(FcPatternCreate());
+ if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
+ return 0;
+
+ FcConfigSubstitute(0, pattern.get(), FcMatchPattern);
+ FcDefaultSubstitute(pattern.get());
+
+ GOwnPtr<FcObjectSet> objectSet(FcObjectSetCreate());
+ if (!FcObjectSetAdd(objectSet.get(), FC_FAMILY))
+ return 0;
+
+ GOwnPtr<FcFontSet> fontSet(FcFontList(0, pattern.get(), objectSet.get()));
+
+ if (!fontSet)
+ return 0;
+
+ if (!fontSet->fonts)
+ return 0;
+#endif
+
return new FontPlatformData(fontDescription, family);
}
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp
index 71a2430..2a2d4a7 100644
--- a/WebCore/platform/graphics/cairo/FontCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCairo.cpp
@@ -71,7 +71,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
// Text shadow, inspired by FontMac
IntSize shadowSize;
- int shadowBlur = 0;
+ float shadowBlur = 0;
Color shadowColor;
bool hasShadow = context->textDrawingMode() == cTextFill &&
context->getShadow(shadowSize, shadowBlur, shadowColor);
diff --git a/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp b/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp
new file mode 100644
index 0000000..12df3cf
--- /dev/null
+++ b/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GOwnPtrCairo.h"
+
+#if defined(USE_FREETYPE)
+#include <cairo-ft.h>
+#include <fontconfig/fcfreetype.h>
+#endif
+
+namespace WTF {
+
+#if defined(USE_FREETYPE)
+template <> void freeOwnedGPtr<FcPattern>(FcPattern* ptr)
+{
+ if (ptr)
+ FcPatternDestroy(ptr);
+}
+
+template <> void freeOwnedGPtr<FcObjectSet>(FcObjectSet* ptr)
+{
+ if (ptr)
+ FcObjectSetDestroy(ptr);
+}
+
+template <> void freeOwnedGPtr<FcFontSet>(FcFontSet* ptr)
+{
+ if (ptr)
+ FcFontSetDestroy(ptr);
+}
+#endif
+
+} // namespace WTF
diff --git a/WebCore/platform/graphics/cairo/GOwnPtrCairo.h b/WebCore/platform/graphics/cairo/GOwnPtrCairo.h
new file mode 100644
index 0000000..b099707
--- /dev/null
+++ b/WebCore/platform/graphics/cairo/GOwnPtrCairo.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GOwnPtrCairo_h
+#define GOwnPtrCairo_h
+
+#include "GOwnPtr.h"
+
+#if defined(USE_FREETYPE)
+typedef struct _FcPattern FcPattern;
+typedef struct _FcObjectSet FcObjectSet;
+typedef struct _FcFontSet FcFontSet;
+#endif
+
+namespace WTF {
+
+#if defined(USE_FREETYPE)
+template <> void freeOwnedGPtr<FcPattern>(FcPattern*);
+template <> void freeOwnedGPtr<FcObjectSet>(FcObjectSet*);
+template <> void freeOwnedGPtr<FcFontSet>(FcFontSet*);
+#endif
+
+} // namespace WTF
+
+#endif
diff --git a/WebCore/platform/graphics/cairo/GradientCairo.cpp b/WebCore/platform/graphics/cairo/GradientCairo.cpp
index 0aada55..4e6ed07 100644
--- a/WebCore/platform/graphics/cairo/GradientCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GradientCairo.cpp
@@ -76,6 +76,15 @@ cairo_pattern_t* Gradient::platformGradient()
return m_gradient;
}
+void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)
+{
+ if (m_gradient) {
+ cairo_matrix_t matrix = gradientSpaceTransformation;
+ cairo_matrix_invert(&matrix);
+ cairo_pattern_set_matrix(m_gradient, &matrix);
+ }
+}
+
void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
{
cairo_t* cr = context->platformContext();
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index a2dcbaf..083497f 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -143,7 +143,7 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr)
cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr));
}
-void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, int shadowBlur)
+void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur)
{
#if ENABLE(FILTERS)
// calculate the kernel size according to the HTML5 canvas shadow specification
@@ -162,7 +162,7 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva
{
#if ENABLE(FILTERS)
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (!context->getShadow(shadowSize, shadowBlur, shadowColor))
return;
@@ -560,7 +560,7 @@ static void drawBorderlessRectShadow(GraphicsContext* context, const FloatRect&
{
#if ENABLE(FILTERS)
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (!context->getShadow(shadowSize, shadowBlur, shadowColor))
@@ -841,7 +841,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer
notImplemented();
}
-void GraphicsContext::setPlatformShadow(IntSize const& size, int, Color const&, ColorSpace)
+void GraphicsContext::setPlatformShadow(IntSize const& size, float, Color const&, ColorSpace)
{
// Cairo doesn't support shadows natively, they are drawn manually in the draw*
// functions
diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
index 85a4179..c298e18 100644
--- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
@@ -284,7 +284,7 @@ static cairo_status_t writeFunction(void* closure, const unsigned char* data, un
return CAIRO_STATUS_SUCCESS;
}
-String ImageBuffer::toDataURL(const String& mimeType, double) const
+String ImageBuffer::toDataURL(const String& mimeType, const double*) const
{
cairo_surface_t* image = cairo_get_target(context()->platformContext());
if (!image)
diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp
index e74c495..92394b3 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -135,7 +135,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
// Draw the shadow
#if ENABLE(FILTERS)
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (context->getShadow(shadowSize, shadowBlur, shadowColor)) {
IntSize shadowBufferSize;
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 2e3f829..c69f222 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -764,7 +764,7 @@ void GraphicsContext::endTransparencyLayer()
m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
-void GraphicsContext::setPlatformShadow(const IntSize& offset, int blur, const Color& color, ColorSpace colorSpace)
+void GraphicsContext::setPlatformShadow(const IntSize& offset, float blur, const Color& color, ColorSpace colorSpace)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index ce11499..fe7f83a 100644
--- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -250,6 +250,14 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size);
}
+static inline CFStringRef jpegUTI()
+{
+#if PLATFORM(WIN)
+ static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg");
+#endif
+ return kUTTypeJPEG;
+}
+
static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType)
{
#if PLATFORM(MAC)
@@ -261,13 +269,12 @@ static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType)
// FIXME: Add Windows support for all the supported UTIs when a way to convert from MIMEType to UTI reliably is found.
// For now, only support PNG, JPEG, and GIF. See <rdar://problem/6095286>.
static const CFStringRef kUTTypePNG = CFSTR("public.png");
- static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg");
static const CFStringRef kUTTypeGIF = CFSTR("com.compuserve.gif");
if (equalIgnoringCase(mimeType, "image/png"))
return kUTTypePNG;
if (equalIgnoringCase(mimeType, "image/jpeg"))
- return kUTTypeJPEG;
+ return jpegUTI();
if (equalIgnoringCase(mimeType, "image/gif"))
return kUTTypeGIF;
@@ -276,7 +283,7 @@ static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType)
#endif
}
-String ImageBuffer::toDataURL(const String& mimeType, double) const
+String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const
{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
@@ -288,11 +295,23 @@ String ImageBuffer::toDataURL(const String& mimeType, double) const
if (!data)
return "data:,";
- RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), utiFromMIMEType(mimeType).get(), 1, 0));
+ RetainPtr<CFStringRef> uti = utiFromMIMEType(mimeType);
+ ASSERT(uti);
+
+ RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), uti.get(), 1, 0));
if (!destination)
return "data:,";
- CGImageDestinationAddImage(destination.get(), image.get(), 0);
+ RetainPtr<CFDictionaryRef> imageProperties = 0;
+ if (CFEqual(uti.get(), jpegUTI()) && quality && *quality >= 0.0 && *quality <= 1.0) {
+ // Apply the compression quality to the image destination.
+ RetainPtr<CFNumberRef> compressionQuality(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, quality));
+ const void* key = kCGImageDestinationLossyCompressionQuality;
+ const void* value = compressionQuality.get();
+ imageProperties.adoptCF(CFDictionaryCreate(0, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ }
+
+ CGImageDestinationAddImage(destination.get(), image.get(), imageProperties.get());
CGImageDestinationFinalize(destination.get());
Vector<char> out;
diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
index 9ad3166..4a7aecc 100644
--- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -29,6 +29,7 @@
#if PLATFORM(CG)
#include "ImageSourceCG.h"
+#include "IntPoint.h"
#include "IntSize.h"
#include "MIMETypeRegistry.h"
#include "SharedBuffer.h"
@@ -196,6 +197,28 @@ IntSize ImageSource::size() const
return frameSizeAtIndex(0);
}
+bool ImageSource::getHotSpot(IntPoint& hotSpot) const
+{
+ RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions()));
+ if (!properties)
+ return false;
+
+ int x = -1, y = -1;
+ CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotX"));
+ if (!num || !CFNumberGetValue(num, kCFNumberIntType, &x))
+ return false;
+
+ num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotY"));
+ if (!num || !CFNumberGetValue(num, kCFNumberIntType, &y))
+ return false;
+
+ if (x < 0 || y < 0)
+ return false;
+
+ hotSpot = IntPoint(x, y);
+ return true;
+}
+
int ImageSource::repetitionCount()
{
int result = cAnimationLoopOnce; // No property means loop once.
diff --git a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
index 9538a8d..48cf9d2 100644
--- a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
+++ b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
@@ -274,7 +274,7 @@ bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs,
// If there is a non-blur shadow and both the fill color and shadow color
// are opaque, handle without skia.
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (m_graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor)) {
// If there is a shadow and this code is reached, windowsCanHandleDrawTextShadow()
@@ -484,7 +484,7 @@ void Font::drawComplexText(GraphicsContext* graphicsContext,
// If there is a non-blur shadow and both the fill color and shadow color
// are opaque, handle without skia.
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor) && windowsCanHandleDrawTextShadow(graphicsContext)) {
COLORREF textColor = skia::SkColorToCOLORREF(SkColorSetARGB(255, shadowColor.red(), shadowColor.green(), shadowColor.blue()));
diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
index 7b22bad..0a5aec5 100644
--- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
@@ -143,6 +143,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const
break;
}
+ paint->setEmbeddedBitmapText(m_style.useBitmaps);
paint->setTextSize(SkFloatToScalar(ts));
paint->setTypeface(m_typeface);
paint->setFakeBoldText(m_fakeBold);
diff --git a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp
index 8dba49e..78170a9 100644
--- a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp
+++ b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -44,6 +44,25 @@ namespace WebCore {
namespace {
+bool isFontPresent(const UChar* fontName)
+{
+ HFONT hfont = CreateFont(12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ fontName);
+ if (!hfont)
+ return false;
+ HDC dc = GetDC(0);
+ HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont));
+ WCHAR actualFontName[LF_FACESIZE];
+ GetTextFace(dc, LF_FACESIZE, actualFontName);
+ actualFontName[LF_FACESIZE - 1] = 0;
+ SelectObject(dc, oldFont);
+ DeleteObject(hfont);
+ ReleaseDC(0, dc);
+ // We don't have to worry about East Asian fonts with locale-dependent
+ // names here for now.
+ return !wcscmp(fontName, actualFontName);
+}
+
// A simple mapping from UScriptCode to family name. This is a sparse array,
// which works well since the range of UScriptCode values is small.
typedef const UChar* ScriptToFontMap[USCRIPT_CODE_LIMIT];
@@ -55,10 +74,14 @@ void initializeScriptFontMap(ScriptToFontMap& scriptFontMap)
const UChar* family;
};
- const static FontMap fontMap[] = {
+ static const FontMap fontMap[] = {
{USCRIPT_LATIN, L"times new roman"},
{USCRIPT_GREEK, L"times new roman"},
{USCRIPT_CYRILLIC, L"times new roman"},
+ // FIXME: Consider trying new Vista fonts before XP fonts for CJK.
+ // Some Vista users do want to use Vista cleartype CJK fonts. If we
+ // did, the results of tests with CJK characters would have to be
+ // regenerated for Vista.
{USCRIPT_SIMPLIFIED_HAN, L"simsun"},
{USCRIPT_TRADITIONAL_HAN, L"pmingliu"},
{USCRIPT_HIRAGANA, L"ms pgothic"},
@@ -72,32 +95,81 @@ void initializeScriptFontMap(ScriptToFontMap& scriptFontMap)
{USCRIPT_BENGALI, L"vrinda"},
{USCRIPT_GURMUKHI, L"raavi"},
{USCRIPT_GUJARATI, L"shruti"},
- {USCRIPT_ORIYA, L"kalinga"},
{USCRIPT_TAMIL, L"latha"},
{USCRIPT_TELUGU, L"gautami"},
{USCRIPT_KANNADA, L"tunga"},
- {USCRIPT_MALAYALAM, L"kartika"},
- {USCRIPT_LAO, L"dokchampa"},
- {USCRIPT_TIBETAN, L"microsoft himalaya"},
{USCRIPT_GEORGIAN, L"sylfaen"},
{USCRIPT_ARMENIAN, L"sylfaen"},
- {USCRIPT_ETHIOPIC, L"nyala"},
+ {USCRIPT_THAANA, L"mv boli"},
{USCRIPT_CANADIAN_ABORIGINAL, L"euphemia"},
{USCRIPT_CHEROKEE, L"plantagenet cherokee"},
- {USCRIPT_YI, L"microsoft yi balti"},
- {USCRIPT_SINHALA, L"iskoola pota"},
- {USCRIPT_SYRIAC, L"estrangelo edessa"},
- {USCRIPT_KHMER, L"daunpenh"},
- {USCRIPT_THAANA, L"mv boli"},
{USCRIPT_MONGOLIAN, L"mongolian balti"},
- {USCRIPT_MYANMAR, L"padauk"},
// For USCRIPT_COMMON, we map blocks to scripts when
// that makes sense.
};
-
+
+ struct ScriptToFontFamilies {
+ UScriptCode script;
+ const UChar** families;
+ };
+
+ // Kartika on Vista or earlier lacks the support for Chillu
+ // letters added to Unicode 5.1.
+ // Try AnjaliOldLipi (a very widely used Malaylalam font with the full
+ // Unicode 5.x support) before falling back to Kartika.
+ static const UChar* malayalamFonts[] = {L"AnjaliOldLipi", L"Lohit Malayalam", L"Kartika", L"Rachana", 0};
+ // Try Khmer OS before Vista fonts because 'Khmer OS' goes along better
+ // with Latin and looks better/larger for the same size.
+ static const UChar* khmerFonts[] = {L"Khmer OS", L"MoolBoran", L"DaunPenh", L"Code2000", 0};
+ // For the following 6 scripts, two or fonts are listed. The fonts in
+ // the 1st slot are not available on Windows XP. To support these
+ // scripts on XP, listed in the rest of slots are widely used
+ // fonts.
+ static const UChar* ethiopicFonts[] = {L"Nyala", L"Abyssinica SIL", L"Ethiopia Jiret", L"Visual Geez Unicode", L"GF Zemen Unicode", 0};
+ static const UChar* oriyaFonts[] = {L"Kalinga", L"ori1Uni", L"Lohit Oriya", 0};
+ static const UChar* laoFonts[] = {L"DokChampa", L"Saysettha OT", L"Phetsarath OT", L"Code2000", 0};
+ static const UChar* tibetanFonts[] = {L"Microsoft Himalaya", L"Jomolhari", L"Tibetan Machine Uni", 0};
+ static const UChar* sinhalaFonts[] = {L"Iskoola Pota", L"AksharUnicode", 0};
+ static const UChar* yiFonts[] = {L"Microsoft Yi Balti", L"Nuosu SIL", L"Code2000", 0};
+ // http://www.bethmardutho.org/support/meltho/download/index.php
+ static const UChar* syriacFonts[] = {L"Estrangelo Edessa", L"Estrangelo Nisibin", L"Code2000", 0};
+ // No Myanmar/Burmese font is shipped with Windows, yet. Try a few
+ // widely available/used ones that supports Unicode 5.1 or later.
+ static const UChar* myanmarFonts[] = {L"Padauk", L"Parabaik", L"Myanmar3", L"Code2000", 0};
+
+ static const ScriptToFontFamilies scriptToFontFamilies[] = {
+ {USCRIPT_MALAYALAM, malayalamFonts},
+ {USCRIPT_KHMER, khmerFonts},
+ {USCRIPT_ETHIOPIC, ethiopicFonts},
+ {USCRIPT_ORIYA, oriyaFonts},
+ {USCRIPT_LAO, laoFonts},
+ {USCRIPT_TIBETAN, tibetanFonts},
+ {USCRIPT_SINHALA, sinhalaFonts},
+ {USCRIPT_YI, yiFonts},
+ {USCRIPT_SYRIAC, syriacFonts},
+ {USCRIPT_MYANMAR, myanmarFonts},
+ };
+
for (int i = 0; i < sizeof(fontMap) / sizeof(fontMap[0]); ++i)
scriptFontMap[fontMap[i].script] = fontMap[i].family;
+ // FIXME: Instead of scanning the hard-coded list, we have to
+ // use EnumFont* to 'inspect' fonts to pick up fonts covering scripts
+ // when it's possible (e.g. using OS/2 table). If we do that, this
+ // had better be pulled out of here.
+ for (int i = 0; i < sizeof(scriptToFontFamilies) / sizeof(scriptToFontFamilies[0]); ++i) {
+ UScriptCode script = scriptToFontFamilies[i].script;
+ scriptFontMap[script] = 0;
+ const UChar** familyPtr = scriptToFontFamilies[i].families;
+ while (*familyPtr) {
+ if (isFontPresent(*familyPtr)) {
+ scriptFontMap[script] = *familyPtr;
+ break;
+ }
+ ++familyPtr;
+ }
+ }
+
// Initialize the locale-dependent mapping.
// Since Chrome synchronizes the ICU default locale with its UI locale,
// this ICU locale tells the current UI locale of Chrome.
@@ -198,7 +270,7 @@ struct FontData {
// in the 1st pass. Need to experiment further.
typedef HashMap<String, FontData> FontDataCache;
-} // namespace
+} // namespace
// FIXME: this is font fallback code version 0.1
// - Cover all the scripts
@@ -363,4 +435,4 @@ int getStyleFromLogfont(const LOGFONT* logfont)
(logfont->lfWeight >= 700 ? FontStyleBold : FontStyleNormal);
}
-} // namespace WebCore
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
index 37ea485..23aeefa 100644
--- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -474,7 +474,50 @@ void GraphicsLayerChromium::updateBackfaceVisibility()
void GraphicsLayerChromium::updateLayerPreserves3D()
{
- // FIXME: implement
+ if (m_preserves3D && !m_transformLayer) {
+ // Create the transform layer.
+ m_transformLayer = LayerChromium::create(LayerChromium::TransformLayer, this);
+
+ // Copy the position from this layer.
+ updateLayerPosition();
+ updateLayerSize();
+ updateAnchorPoint();
+ updateTransform();
+ updateChildrenTransform();
+
+ m_layer->setPosition(FloatPoint(m_size.width() / 2.0f, m_size.height() / 2.0f));
+
+ m_layer->setAnchorPoint(FloatPoint(0.5f, 0.5f));
+ TransformationMatrix identity;
+ m_layer->setTransform(identity);
+
+ // Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
+ m_layer->setOpacity(1);
+
+ // Move this layer to be a child of the transform layer.
+ if (m_layer->superlayer())
+ m_layer->superlayer()->replaceSublayer(m_layer.get(), m_transformLayer.get());
+ m_transformLayer->addSublayer(m_layer.get());
+
+ updateSublayerList();
+ } else if (!m_preserves3D && m_transformLayer) {
+ // Relace the transformLayer in the parent with this layer.
+ m_layer->removeFromSuperlayer();
+ m_transformLayer->superlayer()->replaceSublayer(m_transformLayer.get(), m_layer.get());
+
+ // Release the transform layer.
+ m_transformLayer = 0;
+
+ updateLayerPosition();
+ updateLayerSize();
+ updateAnchorPoint();
+ updateTransform();
+ updateChildrenTransform();
+
+ updateSublayerList();
+ }
+
+ updateOpacityOnLayer();
}
void GraphicsLayerChromium::updateLayerDrawsContent()
@@ -527,8 +570,7 @@ void GraphicsLayerChromium::updateContentsRect()
if (!m_contentsLayer)
return;
- // The position of the layer is the center of quad.
- m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x() + m_contentsRect.width() / 2, m_contentsRect.y() + m_contentsRect.height() / 2));
+ m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
}
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index b08df82..5e71e49 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -118,6 +118,10 @@ void LayerChromium::updateTextureContents(unsigned int textureId)
OwnPtr<PlatformContextSkia> skiaContext;
OwnPtr<GraphicsContext> graphicsContext;
if (drawsContent()) { // Layer contents must be drawn into a canvas.
+ // Clip the dirtyRect to the size of the layer to avoid drawing outside
+ // the bounds of the backing texture.
+ dirtyRect.intersect(IntRect(IntPoint(0, 0), m_bounds));
+
canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false));
skiaContext.set(new PlatformContextSkia(canvas.get()));
@@ -135,8 +139,7 @@ void LayerChromium::updateTextureContents(unsigned int textureId)
m_owner->paintGraphicsLayerContents(*graphicsContext, dirtyRect);
const SkBitmap& bitmap = canvas->getDevice()->accessBitmap(false);
skiaBitmap = &bitmap;
- requiredTextureSize = IntSize(max(m_bounds.width(), dirtyRect.width()),
- max(m_bounds.height(), dirtyRect.height()));
+ requiredTextureSize = m_bounds;
} else { // Layer is a container.
// The layer contains an Image.
NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(contents());
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h
index 59952eb..7af7e9b 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -158,8 +158,16 @@ public:
void setContents(NativeImagePtr contents);
NativeImagePtr contents() const { return m_contents; }
+ void setDrawTransform(const TransformationMatrix& transform) { m_drawTransform = transform; }
+ const TransformationMatrix& drawTransform() const { return m_drawTransform; }
+
+ void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
+ float drawOpacity() const { return m_drawOpacity; }
+
bool drawsContent() { return m_owner && m_owner->drawsContent(); }
+ bool preserves3D() { return m_owner && m_owner->preserves3D(); }
+
void setLayerRenderer(LayerRendererChromium*);
private:
@@ -203,12 +211,16 @@ private:
TransformationMatrix m_transform;
TransformationMatrix m_sublayerTransform;
+ TransformationMatrix m_drawTransform;
+
uint32_t m_edgeAntialiasingMask;
float m_opacity;
float m_zPosition;
float m_anchorPointZ;
float m_borderWidth;
+ float m_drawOpacity;
+
unsigned int m_allocatedTextureId;
IntSize m_allocatedTextureSize;
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index dfb6078..73311be 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -156,6 +156,13 @@ static GLuint createLayerTexture()
return textureId;
}
+static inline bool compareLayerZ(const LayerChromium* a, const LayerChromium* b)
+{
+ const TransformationMatrix& transformA = a->drawTransform();
+ const TransformationMatrix& transformB = b->drawTransform();
+
+ return transformA.m43() < transformB.m43();
+}
PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page)
{
@@ -173,6 +180,7 @@ LayerRendererChromium::LayerRendererChromium(Page* page)
, m_page(page)
, m_rootLayerTextureWidth(0)
, m_rootLayerTextureHeight(0)
+ , m_scrollPosition(IntPoint(-1, -1))
{
m_quadVboIds[Vertices] = m_quadVboIds[LayerElements] = 0;
m_hardwareCompositing = (initGL() && initializeSharedGLObjects());
@@ -284,6 +292,9 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect&
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
+ if (m_scrollPosition == IntPoint(-1, -1))
+ m_scrollPosition = scrollPosition;
+
IntPoint scrollDelta = toPoint(scrollPosition - m_scrollPosition);
// Scroll only when the updateRect contains pixels for the newly uncovered region to avoid flashing.
if ((scrollDelta.x() && updateRect.width() >= abs(scrollDelta.x()) && updateRect.height() >= contentRect.height())
@@ -358,19 +369,26 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect&
checkGLError();
- // FIXME: Sublayers need to be sorted in Z to get the correct transparency effect.
-
- // Enable scissoring to avoid rendering composited layers over the scrollbars.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, visibleRect.height() - contentRect.height(), contentRect.width(), contentRect.height());
-
// Translate all the composited layers by the scroll position.
TransformationMatrix matrix;
matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0);
+
float opacity = 1;
+ m_layerList.shrink(0);
const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers();
for (size_t i = 0; i < sublayers.size(); i++)
- compositeLayersRecursive(sublayers[i].get(), matrix, opacity, visibleRect);
+ updateLayersRecursive(sublayers[i].get(), matrix, opacity, visibleRect);
+
+ // Sort layers by the z coordinate of their center so that layers further
+ // away get drawn first.
+ std::stable_sort(m_layerList.begin(), m_layerList.end(), compareLayerZ);
+
+ // Enable scissoring to avoid rendering composited layers over the scrollbars.
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, visibleRect.height() - contentRect.height(), contentRect.width(), contentRect.height());
+
+ for (size_t j = 0; j < m_layerList.size(); j++)
+ drawLayer(m_layerList[j]);
glDisable(GL_SCISSOR_TEST);
@@ -464,65 +482,108 @@ bool LayerRendererChromium::isLayerVisible(LayerChromium* layer, const Transform
return mappedRect.intersects(FloatRect(-1, -1, 2, 2));
}
-void LayerRendererChromium::compositeLayersRecursive(LayerChromium* layer, const TransformationMatrix& matrix, float opacity, const IntRect& visibleRect)
+// Updates and caches the layer transforms and opacity values that will be used
+// when rendering them.
+void LayerRendererChromium::updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect)
{
- static GLfloat glMatrix[16];
-
// Compute the new matrix transformation that will be applied to this layer and
- // all its sublayers.
- // The basic transformation chain for the layer is (using the Matrix x Vector order):
- // M = M[p] * T[l] * T[a] * M[l] * T[-a]
+ // all its sublayers. It's important to remember that the layer's position
+ // is the position of the layer's anchor point. Also, the coordinate system used
+ // assumes that the origin is at the lower left even though the coordinates the browser
+ // gives us for the layers are for the upper left corner. The Y flip happens via
+ // the orthographic projection applied at render time.
+ // The transformation chain for the layer is (using the Matrix x Vector order):
+ // M = M[p] * Tr[l] * M[l] * Tr[c]
// Where M[p] is the parent matrix passed down to the function
- // T[l] is the translation of the layer's center
- // T[a] and T[-a] is a translation/inverse translation by the anchor point
- // M[l] is the layer's matrix
+ // Tr[l] is the translation matrix locating the layer's anchor point
+ // Tr[c] is the translation offset between the anchor point and the center of the layer
+ // M[l] is the layer's matrix (applied at the anchor point)
+ // This transform creates a coordinate system whose origin is the center of the layer.
// Note that the final matrix used by the shader for the layer is P * M * S . This final product
- // is effectively computed in drawTexturedQuad().
+ // is computed in drawTexturedQuad().
// Where: P is the projection matrix
// M is the layer's matrix computed above
// S is the scale adjustment (to scale up to the layer size)
IntSize bounds = layer->bounds();
FloatPoint anchorPoint = layer->anchorPoint();
FloatPoint position = layer->position();
- float anchorX = (anchorPoint.x() - 0.5) * bounds.width();
- float anchorY = (0.5 - anchorPoint.y()) * bounds.height();
+
+ // Offset between anchor point and the center of the quad.
+ float centerOffsetX = (0.5 - anchorPoint.x()) * bounds.width();
+ float centerOffsetY = (0.5 - anchorPoint.y()) * bounds.height();
// M = M[p]
- TransformationMatrix localMatrix = matrix;
- // M = M[p] * T[l]
- localMatrix.translate3d(position.x(), position.y(), 0);
- // M = M[p] * T[l] * T[a]
- localMatrix.translate3d(anchorX, anchorY, 0);
- // M = M[p] * T[l] * T[a] * M[l]
+ TransformationMatrix localMatrix = parentMatrix;
+ // M = M[p] * Tr[l]
+ localMatrix.translate3d(position.x(), position.y(), layer->anchorPointZ());
+ // M = M[p] * Tr[l] * M[l]
localMatrix.multLeft(layer->transform());
- // M = M[p] * T[l] * T[a] * M[l] * T[-a]
- localMatrix.translate3d(-anchorX, -anchorY, 0);
+ // M = M[p] * Tr[l] * M[l] * Tr[c]
+ localMatrix.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ());
+
+ // Check if the layer falls within the visible bounds of the page.
+ bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect);
+
+ bool layerHasContent = layer->drawsContent() || layer->contents();
bool skipLayer = false;
if (bounds.width() > 2048 || bounds.height() > 2048) {
- LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height());
+ if (layerHasContent)
+ LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height());
skipLayer = true;
}
// Calculate the layer's opacity.
opacity *= layer->opacity();
- bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect);
+ layer->setDrawTransform(localMatrix);
+ layer->setDrawOpacity(opacity);
+ if (layerVisible && !skipLayer)
+ m_layerList.append(layer);
+
+ // Flatten to 2D if the layer doesn't preserve 3D.
+ if (!layer->preserves3D()) {
+ localMatrix.setM13(0);
+ localMatrix.setM23(0);
+ localMatrix.setM31(0);
+ localMatrix.setM32(0);
+ localMatrix.setM33(1);
+ localMatrix.setM34(0);
+ localMatrix.setM43(0);
+ }
+
+ // Apply the sublayer transform at the center of the layer.
+ localMatrix.multLeft(layer->sublayerTransform());
+
+ // The origin of the sublayers is actually the bottom left corner of the layer
+ // (or top left when looking it it from the browser's pespective) instead of the center.
+ // The matrix passed down to the sublayers is therefore:
+ // M[s] = M * Tr[-center]
+ localMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0);
+
+ const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
+ for (size_t i = 0; i < sublayers.size(); i++)
+ updateLayersRecursive(sublayers[i].get(), localMatrix, opacity, visibleRect);
+}
+
+void LayerRendererChromium::drawLayer(LayerChromium* layer)
+{
+ const TransformationMatrix& localMatrix = layer->drawTransform();
+ IntSize bounds = layer->bounds();
// Note that there are two types of layers:
- // 1. Layers that have their own GraphicsContext and can draw their contents on demand (layer->drawsContent() == true).
- // 2. Layers that are just containers of images/video/etc that don't own a GraphicsContext (layer->contents() == true).
- if ((layer->drawsContent() || layer->contents()) && !skipLayer && layerVisible) {
+ // 1. Layers that draw their own content via the GraphicsContext (layer->drawsContent() == true).
+ // 2. Layers that are pure containers of images/video/etc whose content is simply
+ // copied into the backing texture (layer->contents() == true).
+ if (layer->drawsContent() || layer->contents()) {
int textureId = getTextureId(layer);
// If no texture has been created for the layer yet then create one now.
if (textureId == -1)
textureId = assignTextureForLayer(layer);
// Redraw the contents of the layer if necessary.
- if ((layer->drawsContent() || layer->contents()) && layer->contentsDirty()) {
- // Update the contents of the layer before taking a snapshot. For layers that
- // are simply containers, the following call just clears the dirty flag but doesn't
- // actually do any draws/copies.
+ if (layer->contentsDirty()) {
+ // Update the backing texture contents for any dirty portion of the layer.
layer->updateTextureContents(textureId);
}
@@ -533,22 +594,11 @@ void LayerRendererChromium::compositeLayersRecursive(LayerChromium* layer, const
glBindTexture(GL_TEXTURE_2D, textureId);
- drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), opacity, false);
+ drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), layer->drawOpacity(), false);
}
// Draw the debug border if there is one.
drawDebugBorder(layer, localMatrix);
-
- // Apply the sublayer transform.
- localMatrix.multLeft(layer->sublayerTransform());
-
- // The origin of the sublayers is actually the left top corner of the layer
- // instead of the center. The matrix passed down to the sublayers is therefore:
- // M[s] = M * T[-center]
- localMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0);
- const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
- for (size_t i = 0; i < sublayers.size(); i++)
- compositeLayersRecursive(sublayers[i].get(), localMatrix, opacity, visibleRect);
}
bool LayerRendererChromium::makeContextCurrent()
@@ -590,8 +640,7 @@ bool LayerRendererChromium::initializeSharedGLObjects()
" v_texCoord = a_texCoord; \n"
"} \n";
char fragmentShaderString[] =
- // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
- "//precision mediump float; \n"
+ "precision mediump float; \n"
"varying vec2 v_texCoord; \n"
"uniform sampler2D s_texture; \n"
"uniform float alpha; \n"
@@ -605,8 +654,7 @@ bool LayerRendererChromium::initializeSharedGLObjects()
// from fragmentShaderString in that it doesn't swizzle the colors and doesn't
// take an alpha value.
char scrollFragmentShaderString[] =
- // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
- "//precision mediump float; \n"
+ "precision mediump float; \n"
"varying vec2 v_texCoord; \n"
"uniform sampler2D s_texture; \n"
"void main() \n"
@@ -624,8 +672,7 @@ bool LayerRendererChromium::initializeSharedGLObjects()
" gl_Position = matrix * a_position; \n"
"} \n";
char borderFragmentShaderString[] =
- // FIXME: Re-introduce precision qualifier when we need GL ES shaders.
- "//precision mediump float; \n"
+ "precision mediump float; \n"
"uniform vec4 color; \n"
"void main() \n"
"{ \n"
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index eb66dac..a2e3427 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -74,7 +74,9 @@ public:
GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); }
private:
- void compositeLayersRecursive(LayerChromium*, const TransformationMatrix&, float opacity, const IntRect& visibleRect);
+ void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect);
+
+ void drawLayer(LayerChromium*);
void drawDebugBorder(LayerChromium*, const TransformationMatrix&);
@@ -120,6 +122,8 @@ private:
RefPtr<LayerChromium> m_rootLayer;
+ Vector<LayerChromium*> m_layerList;
+
bool m_needsDisplay;
IntPoint m_scrollPosition;
bool m_hardwareCompositing;
diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp
index 29b83dc..2164db5 100644
--- a/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -211,7 +211,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F
// Text shadow, inspired by FontMac
IntSize shadowSize;
- int shadowBlur = 0;
+ float shadowBlur = 0;
Color shadowColor;
bool hasShadow = context->textDrawingMode() == cTextFill &&
context->getShadow(shadowSize, shadowBlur, shadowColor);
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 8db512c..7350eeb 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -536,7 +536,7 @@ void GraphicsContext::clearPlatformShadow()
notImplemented();
}
-void GraphicsContext::setPlatformShadow(IntSize const&, int, Color const&, ColorSpace)
+void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace)
{
notImplemented();
}
diff --git a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
index fdab656..c5de485 100644
--- a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
@@ -310,7 +310,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
putImageData(source, sourceRect, destPoint, m_data, m_size, true);
}
-String ImageBuffer::toDataURL(const String& mimeType, double) const
+String ImageBuffer::toDataURL(const String& mimeType, const double*) const
{
if (!MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType))
return "data:,";
diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm
index 87057fa..100200a 100644
--- a/WebCore/platform/graphics/mac/FontMac.mm
+++ b/WebCore/platform/graphics/mac/FontMac.mm
@@ -136,7 +136,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
ColorSpace fillColorSpace = context->fillColorSpace();
context->getShadow(shadowSize, shadowBlur, shadowColor);
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 79a10dd..90678b2 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -35,7 +35,7 @@
#include "WebGLActiveInfo.h"
#include "ArrayBufferView.h"
#include "WebGLBuffer.h"
-#include "FloatArray.h"
+#include "Float32Array.h"
#include "WebGLFramebuffer.h"
#include "Int32Array.h"
#include "WebGLProgram.h"
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 54cc7ee..7fe160a 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -292,7 +292,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect)
return FloatRect(enclosingIntRect(m_data->transformation().mapRect(rect)));
}
-void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Color& color, ColorSpace colorSpace)
+void GraphicsContext::setPlatformShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace)
{
if (paintingDisabled())
return;
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index 2009424..d357a22 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -44,11 +44,15 @@
namespace WebCore {
-static const QString fromRawDataWithoutRef(const String& string)
+static const QString fromRawDataWithoutRef(const String& string, int start = 0, int len = -1)
{
+ if (len < 0)
+ len = string.length() - start;
+ Q_ASSERT(start + len <= string.length());
+
// We don't detach. This assumes the WebCore string data will stay valid for the
// lifetime of the QString we pass back, since we don't ref the WebCore string.
- return QString::fromRawData(reinterpret_cast<const QChar*>(string.characters()), string.length());
+ return QString::fromRawData(reinterpret_cast<const QChar*>(string.characters() + start), len);
}
static QTextLine setupLayout(QTextLayout* layout, const TextRun& style)
@@ -66,7 +70,7 @@ static QTextLine setupLayout(QTextLayout* layout, const TextRun& style)
return line;
}
-void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
+static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to, const QFont& font, bool isComplexText)
{
if (to < 0)
to = run.length();
@@ -102,59 +106,72 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
QString string = fromRawDataWithoutRef(sanitized);
+ QPointF pt(point.x(), point.y());
// text shadow
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
bool hasShadow = ctx->textDrawingMode() == cTextFill && ctx->getShadow(shadowSize, shadowBlur, shadowColor);
if (from > 0 || to < run.length()) {
- QTextLayout layout(string, font());
- QTextLine line = setupLayout(&layout, run);
- float x1 = line.cursorToX(from);
- float x2 = line.cursorToX(to);
- if (x2 < x1)
- qSwap(x1, x2);
-
- QFontMetrics fm(font());
- int ascent = fm.ascent();
- QRectF clip(point.x() + x1, point.y() - ascent, x2 - x1, fm.height());
-
- if (hasShadow) {
- // TODO: when blur support is added, the clip will need to account
- // for the blur radius
- qreal dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
- if (shadowSize.width() > 0)
- dx2 = shadowSize.width();
- else
- dx1 = -shadowSize.width();
- if (shadowSize.height() > 0)
- dy2 = shadowSize.height();
- else
- dy1 = -shadowSize.height();
- // expand the clip rect to include the text shadow as well
- clip.adjust(dx1, dx2, dy1, dy2);
- }
- p->save();
- p->setClipRect(clip.toRect(), Qt::IntersectClip);
- QPointF pt(point.x(), point.y() - ascent);
- if (hasShadow) {
+ if (isComplexText) {
+ QTextLayout layout(string, font);
+ QTextLine line = setupLayout(&layout, run);
+ float x1 = line.cursorToX(from);
+ float x2 = line.cursorToX(to);
+ if (x2 < x1)
+ qSwap(x1, x2);
+
+ QFontMetrics fm(font);
+ int ascent = fm.ascent();
+ QRectF clip(point.x() + x1, point.y() - ascent, x2 - x1, fm.height());
+
+ if (hasShadow) {
+ // TODO: when blur support is added, the clip will need to account
+ // for the blur radius
+ qreal dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
+ if (shadowSize.width() > 0)
+ dx2 = shadowSize.width();
+ else
+ dx1 = -shadowSize.width();
+ if (shadowSize.height() > 0)
+ dy2 = shadowSize.height();
+ else
+ dy1 = -shadowSize.height();
+ // expand the clip rect to include the text shadow as well
+ clip.adjust(dx1, dx2, dy1, dy2);
+ }
p->save();
- p->setPen(QColor(shadowColor));
- p->translate(shadowSize.width(), shadowSize.height());
+ p->setClipRect(clip.toRect(), Qt::IntersectClip);
+ pt.setY(pt.y() - ascent);
+ if (hasShadow) {
+ p->save();
+ p->setPen(QColor(shadowColor));
+ p->translate(shadowSize.width(), shadowSize.height());
+ line.draw(p, pt);
+ p->restore();
+ }
+ p->setPen(textFillPen);
line.draw(p, pt);
p->restore();
+ return;
}
- line.draw(p, pt);
- p->restore();
- return;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ int skipWidth = QFontMetrics(font).width(string, from, Qt::TextBypassShaping);
+ pt.setX(pt.x() + skipWidth);
+ string = fromRawDataWithoutRef(sanitized, from, to - from);
+#endif
}
- p->setFont(font());
+ p->setFont(font);
- QPointF pt(point.x(), point.y());
int flags = run.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ // See QWebPagePrivate::QWebPagePrivate() where the default path is set to Complex for Qt 4.6 and earlier.
+ if (!isComplexText)
+ flags |= Qt::TextBypassShaping;
+#endif
if (hasShadow) {
// TODO: text shadow blur support
p->save();
@@ -165,7 +182,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
}
if (ctx->textDrawingMode() & cTextStroke) {
QPainterPath path;
- path.addText(pt, font(), string);
+ path.addText(pt, font, string);
p->setPen(textStrokePen);
p->strokePath(path, p->pen());
}
@@ -175,6 +192,42 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
}
}
+void Font::drawSimpleText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */false);
+#else
+ Q_ASSERT(false);
+#endif
+}
+
+void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
+{
+ drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */true);
+}
+
+float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ if (!run.length())
+ return 0;
+
+ String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ QString string = fromRawDataWithoutRef(sanitized);
+
+ int w = QFontMetrics(font()).width(string, -1, Qt::TextBypassShaping);
+
+ // WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does)
+ if (treatAsSpace(run[0]))
+ w -= m_wordSpacing;
+
+ return w + run.padding();
+#else
+ Q_ASSERT(false);
+ return 0.0f;
+#endif
+}
+
float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
{
if (!run.length())
@@ -194,6 +247,34 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
return w + run.padding();
}
+int Font::offsetForPositionForSimpleText(const TextRun& run, int position, bool includePartialGlyphs) const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ QString string = fromRawDataWithoutRef(sanitized);
+
+ QFontMetrics fm(font());
+ float delta = (float)position;
+ int curPos = 0;
+ do {
+ float charWidth = fm.width(string[curPos]);
+ delta -= charWidth;
+ if (includePartialGlyphs) {
+ if (delta + charWidth / 2 <= 0)
+ break;
+ } else {
+ if (delta + charWidth <= 0)
+ break;
+ }
+ } while (++curPos < string.size());
+
+ return curPos;
+#else
+ Q_ASSERT(false);
+ return 0;
+#endif
+}
+
int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool) const
{
String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
@@ -204,6 +285,23 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool
return line.xToCursor(position);
}
+FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
+ QString wholeText = fromRawDataWithoutRef(sanitized);
+ QString selectedText = fromRawDataWithoutRef(sanitized, from, to - from);
+
+ int startX = QFontMetrics(font()).width(wholeText, from, Qt::TextBypassShaping);
+ int width = QFontMetrics(font()).width(selectedText, -1, Qt::TextBypassShaping);
+
+ return FloatRect(pt.x() + startX, pt.y(), width, h);
+#else
+ Q_ASSERT(false);
+ return FloatRect();
+#endif
+}
+
FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
{
String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
@@ -220,6 +318,11 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint&
return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h);
}
+bool Font::canReturnFallbackFontsForComplexText()
+{
+ return false;
+}
+
QFont Font::font() const
{
QFont f = primaryFont()->getQtFont();
diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index ad43908..e0a785e 100644
--- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -30,7 +30,7 @@
#include "WebGLActiveInfo.h"
#include "ArrayBufferView.h"
#include "WebGLBuffer.h"
-#include "FloatArray.h"
+#include "Float32Array.h"
#include "WebGLFramebuffer.h"
#include "Int32Array.h"
#include "WebGLProgram.h"
@@ -40,6 +40,7 @@
#include "WebGLTexture.h"
#include "Uint8Array.h"
#include <QAbstractScrollArea>
+#include <QGLContext>
#include <wtf/UnusedParam.h>
#include <wtf/text/CString.h>
@@ -1620,6 +1621,11 @@ bool GraphicsContext3D::getImageData(Image* image,
AlphaOp* neededAlphaOp,
unsigned int* format)
{
+ if (!image)
+ return false;
+ QPixmap* nativePixmap = image->nativeImageForCurrentFrame();
+ if (!nativePixmap)
+ return false;
*hasAlphaChannel = true;
*format = GraphicsContext3D::RGBA;
@@ -1627,8 +1633,7 @@ bool GraphicsContext3D::getImageData(Image* image,
*neededAlphaOp = kAlphaDoNothing;
if (!premultiplyAlpha && *hasAlphaChannel)
*neededAlphaOp = kAlphaDoUnmultiply;
-
- QPixmap* nativePixmap = image->nativeImageForCurrentFrame();
+
QImage nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32);
outputVector.append(nativeImage.rgbSwapped().bits(), nativeImage.byteCount());
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index bdb810a..2a7db4e 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -334,7 +334,7 @@ void GraphicsContext::drawRect(const IntRect& rect)
if (m_common->state.shadowColor.isValid()) {
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (getShadow(shadowSize, shadowBlur, shadowColor)) {
IntRect shadowRect = rect;
@@ -372,7 +372,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
adjustLineToPixelBoundaries(p1, p2, width, style);
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) {
p->save();
@@ -474,7 +474,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
p->setRenderHint(QPainter::Antialiasing, true);
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
startAngle *= 16;
angleSpan *= 16;
@@ -509,7 +509,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
p->save();
p->setRenderHint(QPainter::Antialiasing, shouldAntialias);
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (getShadow(shadowSize, shadowBlur, shadowColor)) {
p->save();
@@ -540,7 +540,7 @@ QPen GraphicsContext::pen()
static void inline drawFilledShadowPath(GraphicsContext* context, QPainter* p, const QPainterPath& path)
{
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (context->getShadow(shadowSize, shadowBlur, shadowColor)) {
p->translate(shadowSize.width(), shadowSize.height());
@@ -587,7 +587,7 @@ void GraphicsContext::strokePath()
if (m_common->state.strokePattern || m_common->state.strokeGradient || strokeColor().alpha()) {
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (getShadow(shadowSize, shadowBlur, shadowColor)) {
QTransform t(p->worldTransform());
@@ -619,7 +619,7 @@ void GraphicsContext::strokePath()
static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* p, const FloatRect& rect)
{
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
if (context->getShadow(shadowSize, shadowBlur, shadowColor)) {
FloatRect shadowRect(rect);
@@ -820,7 +820,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin);
}
-void GraphicsContext::setPlatformShadow(const IntSize& size, int, const Color&, ColorSpace)
+void GraphicsContext::setPlatformShadow(const IntSize& size, float, const Color&, ColorSpace)
{
// Qt doesn't support shadows natively, they are drawn manually in the draw*
// functions
@@ -1011,7 +1011,8 @@ void GraphicsContext::clipOut(const Path& path)
newClip.addPath(clippedOut);
p->setClipPath(newClip, Qt::IntersectClip);
} else {
- newClip.addRect(p->window());
+ QRect windowRect = p->transform().inverted().mapRect(p->window());
+ newClip.addRect(windowRect);
newClip.addPath(clippedOut.intersected(newClip));
p->setClipPath(newClip);
}
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index be54735..8ed0d89 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -59,7 +59,12 @@ public:
// (a) We don't need the QBrush abstraction - we always end up using QGraphicsItem::paint
// from the mask layer.
// (b) QGraphicsOpacityEffect detaches the pixmap, which is inefficient on OpenGL.
- QPixmap maskPixmap(sourceBoundingRect().toAlignedRect().size());
+ const QSize maskSize = sourceBoundingRect().toAlignedRect().size();
+ if (!maskSize.isValid() || maskSize.isEmpty()) {
+ drawSource(painter);
+ return;
+ }
+ QPixmap maskPixmap(maskSize);
// We need to do this so the pixmap would have hasAlpha().
maskPixmap.fill(Qt::transparent);
@@ -334,7 +339,7 @@ const GraphicsLayerQtImpl* GraphicsLayerQtImpl::rootLayer() const
QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
{
- if (!m_layer->drawsContent())
+ if (!m_layer->drawsContent() || m_size.isEmpty() ||!m_size.isValid())
return QPixmap();
QRegion region = regionToUpdate;
@@ -361,6 +366,7 @@ QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
// Render the actual contents into the cache
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
m_layer->paintGraphicsLayerContents(gc, region.boundingRect());
+ painter.end();
m_backingStoreKey = QPixmapCache::insert(pixmap);
return pixmap;
@@ -665,7 +671,9 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
#ifndef QT_NO_GRAPHICSEFFECT
if (m_maskEffect)
m_maskEffect.data()->update();
- else if (m_changeMask & DisplayChange) {
+ else
+#endif
+ if (m_changeMask & DisplayChange) {
// Recache now: all the content is ready and we don't want to wait until the paint event.
// We only need to do this for HTML content, there's no point in caching directly composited
// content like images or solid rectangles.
@@ -674,7 +682,6 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
update(m_pendingContent.regionToUpdate.boundingRect());
m_pendingContent.regionToUpdate = QRegion();
}
-#endif
if ((m_changeMask & BackgroundColorChange)
&& (m_pendingContent.backgroundColor != m_currentContent.backgroundColor))
diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index bee15f2..e46913c 100644
--- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -276,10 +276,9 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
// We get a mimeType here but QImageWriter does not support mimetypes but
// only formats (png, gif, jpeg..., xpm). So assume we get image/ as image
// mimetypes and then remove the image/ to get the Qt format.
-String ImageBuffer::toDataURL(const String& mimeType, double quality) const
+String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const
{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
- ASSERT(0.0 <= quality && quality <= 1.0);
if (!mimeType.startsWith("image/"))
return "data:,";
@@ -289,9 +288,16 @@ String ImageBuffer::toDataURL(const String& mimeType, double quality) const
QBuffer buffer(&data);
buffer.open(QBuffer::WriteOnly);
- if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), quality * 100 + 0.5)) {
- buffer.close();
- return "data:,";
+ if (quality && *quality >= 0.0 && *quality <= 1.0) {
+ if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), *quality * 100 + 0.5)) {
+ buffer.close();
+ return "data:,";
+ }
+ } else {
+ if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), 100)) {
+ buffer.close();
+ return "data:,";
+ }
}
buffer.close();
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index db12738..0d23738 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -187,6 +187,23 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
painter->setCompositionMode(QPainter::CompositionMode_Source);
+ IntSize shadowSize;
+ float shadowBlur;
+ Color shadowColor;
+ if (ctxt->getShadow(shadowSize, shadowBlur, shadowColor)) {
+ FloatRect shadowImageRect(dst);
+ shadowImageRect.move(shadowSize.width(), shadowSize.height());
+
+ QImage shadowImage(QSize(static_cast<int>(src.width()), static_cast<int>(src.height())), QImage::Format_ARGB32_Premultiplied);
+ QPainter p(&shadowImage);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.fillRect(shadowImage.rect(), shadowColor);
+ p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ p.drawPixmap(dst, *image, src);
+ p.end();
+ painter->drawImage(shadowImageRect, shadowImage, src);
+ }
+
// Test using example site at
// http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
painter->drawPixmap(dst, *image, src);
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index a7351a0..8f1f912 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -72,6 +72,10 @@ Path& Path::operator=(const Path& other)
// Check whether a point is on the border
bool isPointOnPathBorder(const QPolygonF& border, const QPointF& p)
{
+ // null border doesn't contain points
+ if (border.isEmpty())
+ return false;
+
QPointF p1 = border.at(0);
QPointF p2;
@@ -186,6 +190,15 @@ void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const
void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
{
+ // Make sure there is a subpath for p1, the behavior depend on the last element of the subpath.
+ // When the user agent is to ensure there is a subpath for a coordinate (x, y), the user agent must
+ // check to see if the context has any subpaths, and if it does not, then the user agent must create
+ // a new subpath with the point (x, y) as its first (and only) point, as if the moveTo() method had been called.
+ if (!m_path.elementCount()) {
+ m_path.moveTo(p1);
+ return;
+ }
+
FloatPoint p0(m_path.currentPosition());
if ((p1.x() == p0.x() && p1.y() == p0.y()) || (p1.x() == p2.x() && p1.y() == p2.y()) || radius == 0.f) {
@@ -286,22 +299,34 @@ void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool antic
double width = radius*2;
double height = radius*2;
- if (!anticlockwise && (ea < sa))
- span += 360;
- else if (anticlockwise && (sa < ea))
- span -= 360;
-
- // this is also due to switched coordinate system
- // we would end up with a 0 span instead of 360
- if (!(qFuzzyCompare(span + (ea - sa) + 1, 1.0) &&
- qFuzzyCompare(qAbs(span), 360.0))) {
- span += ea - sa;
+ if ((!anticlockwise && (ea - sa >= 360)) || (anticlockwise && (sa - ea >= 360)))
+ // If the anticlockwise argument is false and endAngle-startAngle is equal to or greater than 2*PI, or, if the
+ // anticlockwise argument is true and startAngle-endAngle is equal to or greater than 2*PI, then the arc is the whole
+ // circumference of this circle.
+ span = 360;
+ else {
+ if (!anticlockwise && (ea < sa))
+ span += 360;
+ else if (anticlockwise && (sa < ea))
+ span -= 360;
+
+ // this is also due to switched coordinate system
+ // we would end up with a 0 span instead of 360
+ if (!(qFuzzyCompare(span + (ea - sa) + 1, 1.0)
+ && qFuzzyCompare(qAbs(span), 360.0))) {
+ // mod 360
+ span += (ea - sa) - (static_cast<int>((ea - sa) / 360)) * 360;
+ }
}
// If the path is empty, move to where the arc will start to avoid painting a line from (0,0)
// NOTE: QPainterPath::isEmpty() won't work here since it ignores a lone MoveToElement
if (!m_path.elementCount())
m_path.arcMoveTo(xs, ys, width, height, sa);
+ else if (!radius) {
+ m_path.lineTo(xc, yc);
+ return;
+ }
m_path.arcTo(xs, ys, width, height, sa, span);
@@ -413,7 +438,16 @@ void Path::apply(void* info, PathApplierFunction function) const
void Path::transform(const AffineTransform& transform)
{
- m_path = QTransform(transform).map(m_path);
+ QTransform qTransform(transform);
+#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
+ // Workaround for http://bugreports.qt.nokia.com/browse/QTBUG-11264
+ // QTransform.map doesn't handle the MoveTo element because of the isEmpty issue
+ if (m_path.isEmpty() && m_path.elementCount()) {
+ QPointF point = qTransform.map(m_path.currentPosition());
+ m_path.moveTo(point);
+ } else
+#endif
+ m_path = qTransform.map(m_path);
}
}
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 9de21e0..6ef38f0 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -978,7 +978,7 @@ void GraphicsContext::setPlatformFillPattern(Pattern* pattern)
}
void GraphicsContext::setPlatformShadow(const IntSize& size,
- int blurInt,
+ float blurFloat,
const Color& color,
ColorSpace colorSpace)
{
@@ -986,14 +986,14 @@ void GraphicsContext::setPlatformShadow(const IntSize& size,
return;
// Detect when there's no effective shadow and clear the looper.
- if (!size.width() && !size.height() && !blurInt) {
+ if (!size.width() && !size.height() && !blurFloat) {
platformContext()->setDrawLooper(0);
return;
}
double width = size.width();
double height = size.height();
- double blur = blurInt;
+ double blur = blurFloat;
// TODO(tc): This still does not address the issue that shadows
// within canvas elements should ignore transforms.
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index 1b03694..912fd12 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -261,7 +261,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
putImageData<Premultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size);
}
-String ImageBuffer::toDataURL(const String&, double) const
+String ImageBuffer::toDataURL(const String&, const double*) const
{
// Encode the image into a vector.
Vector<unsigned char> pngEncodedData;
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index d1fb647..d1d1692 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -66,6 +66,16 @@ enum ResamplingMode {
static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight)
{
+ if (platformContext->hasImageResamplingHint()) {
+ IntSize srcSize;
+ FloatSize dstSize;
+ platformContext->getImageResamplingHint(&srcSize, &dstSize);
+ srcWidth = srcSize.width();
+ srcHeight = srcSize.height();
+ destWidth = dstSize.width();
+ destHeight = dstSize.height();
+ }
+
int destIWidth = static_cast<int>(destWidth);
int destIHeight = static_cast<int>(destHeight);
@@ -188,7 +198,7 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
if (!destBitmapSubsetSkI.intersect(resizedImageRect))
return; // Resized image does not intersect.
- if (srcIsFull || bitmap.shouldCacheResampling(
+ if (srcIsFull && bitmap.shouldCacheResampling(
resizedImageRect.width(),
resizedImageRect.height(),
destBitmapSubsetSkI.width(),
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index 7ec403c..15bd9b4 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -101,6 +101,7 @@ struct PlatformContextSkia::State {
WTF::Vector<SkPath> m_antiAliasClipPaths;
WebCore::InterpolationQuality m_interpolationQuality;
+ PlatformContextSkia::State cloneInheritedProperties();
private:
// Not supported.
void operator=(const State&);
@@ -149,6 +150,7 @@ PlatformContextSkia::State::State(const State& other)
, m_imageBufferClip(other.m_imageBufferClip)
, m_clip(other.m_clip)
#endif
+ , m_antiAliasClipPaths(other.m_antiAliasClipPaths)
, m_interpolationQuality(other.m_interpolationQuality)
{
// Up the ref count of these. saveRef does nothing if 'this' is NULL.
@@ -166,6 +168,17 @@ PlatformContextSkia::State::~State()
m_strokeShader->safeUnref();
}
+// Returns a new State with all of this object's inherited properties copied.
+PlatformContextSkia::State PlatformContextSkia::State::cloneInheritedProperties()
+{
+ PlatformContextSkia::State state(*this);
+
+ // Everything is inherited except for the clip paths.
+ state.m_antiAliasClipPaths.clear();
+
+ return state;
+}
+
SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const
{
int s = roundf(m_alpha * 256);
@@ -214,7 +227,9 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const
void PlatformContextSkia::save()
{
- m_stateStack.append(*m_state);
+ ASSERT(!hasImageResamplingHint());
+
+ m_stateStack.append(m_state->cloneInheritedProperties());
m_state = &m_stateStack.last();
#if OS(LINUX) || OS(WINDOWS)
@@ -576,6 +591,29 @@ bool PlatformContextSkia::isPrinting()
return m_canvas->getTopPlatformDevice().IsVectorial();
}
+void PlatformContextSkia::getImageResamplingHint(WebCore::IntSize* srcSize, WebCore::FloatSize* dstSize) const
+{
+ *srcSize = m_imageResamplingHintSrcSize;
+ *dstSize = m_imageResamplingHintDstSize;
+}
+
+void PlatformContextSkia::setImageResamplingHint(const WebCore::IntSize& srcSize, const WebCore::FloatSize& dstSize)
+{
+ m_imageResamplingHintSrcSize = srcSize;
+ m_imageResamplingHintDstSize = dstSize;
+}
+
+void PlatformContextSkia::clearImageResamplingHint()
+{
+ m_imageResamplingHintSrcSize = WebCore::IntSize();
+ m_imageResamplingHintDstSize = WebCore::FloatSize();
+}
+
+bool PlatformContextSkia::hasImageResamplingHint() const
+{
+ return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty();
+}
+
#if OS(LINUX) || OS(WINDOWS)
void PlatformContextSkia::applyClipFromImage(const WebCore::FloatRect& rect, const SkBitmap& imageBuffer)
{
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h
index 2f24646..88a8ec7 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -170,6 +170,11 @@ 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 clearImageResamplingHint();
+ bool hasImageResamplingHint() const;
+
private:
#if OS(LINUX) || OS(WINDOWS)
// Used when restoring and the state has an image clip. Only shows the pixels in
@@ -194,6 +199,10 @@ private:
// Current path in global coordinates.
SkPath m_path;
+ // 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;
#if OS(WINDOWS)
bool m_drawingToImageBuffer;
#endif
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
index 4abf914..e0d2840 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
@@ -223,7 +223,7 @@ void SkiaWinOutlineCache::removePathsForFont(HFONT hfont)
bool windowsCanHandleDrawTextShadow(WebCore::GraphicsContext *context)
{
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
bool hasShadow = context->getShadow(shadowSize, shadowBlur, shadowColor);
diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp
index e4eb159..83178f3 100644
--- a/WebCore/platform/graphics/win/FontCGWin.cpp
+++ b/WebCore/platform/graphics/win/FontCGWin.cpp
@@ -141,7 +141,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->inTransparencyLayer();
if (!drawIntoBitmap) {
IntSize size;
- int blur;
+ float blur;
Color color;
graphicsContext->getShadow(size, blur, color);
drawIntoBitmap = !size.isEmpty() || blur;
@@ -350,7 +350,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo
wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false, font->platformData().useGDI());
IntSize shadowSize;
- int shadowBlur;
+ float shadowBlur;
Color shadowColor;
graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor);
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
index c6be087..2ca1a96 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
@@ -10,7 +10,7 @@
* 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”
+ * 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
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
index d42f7f3..0a43a69 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
@@ -10,7 +10,7 @@
* 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”
+ * 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
diff --git a/WebCore/platform/graphics/win/QTCFDictionary.cpp b/WebCore/platform/graphics/win/QTCFDictionary.cpp
index ada1500..3c72792 100644
--- a/WebCore/platform/graphics/win/QTCFDictionary.cpp
+++ b/WebCore/platform/graphics/win/QTCFDictionary.cpp
@@ -52,9 +52,10 @@ CFDictionaryRef QTCFDictionaryCreateCopyWithDataCallback(CFAllocatorRef allocato
ASSERT(callback);
CFDataRef data = QTCFPropertyListCreateXMLData(kCFAllocatorDefault, dictionary);
+ if (!data)
+ return 0;
CFDictionaryRef outputDictionary = callback(allocator, CFDataGetBytePtr(data), CFDataGetLength(data));
- if (data)
- CFRelease(data);
+ CFRelease(data);
return outputDictionary;
}
diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.cpp b/WebCore/platform/graphics/win/WKCAImageQueue.cpp
index b52b9a4..c2a178b 100644
--- a/WebCore/platform/graphics/win/WKCAImageQueue.cpp
+++ b/WebCore/platform/graphics/win/WKCAImageQueue.cpp
@@ -10,7 +10,7 @@
* 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”
+ * 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
diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.h b/WebCore/platform/graphics/win/WKCAImageQueue.h
index 5c17575..3d25b48 100644
--- a/WebCore/platform/graphics/win/WKCAImageQueue.h
+++ b/WebCore/platform/graphics/win/WKCAImageQueue.h
@@ -10,7 +10,7 @@
* 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”
+ * 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
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index a7bb695..5896f90 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -1250,7 +1250,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& fillRect, const IntSize& to
return;
IntSize shadowSize;
- int shadowBlur = 0;
+ float shadowBlur = 0;
Color shadowColor;
getShadow(shadowSize, shadowBlur, shadowColor);
@@ -1550,7 +1550,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
fillRect(rect, fillColor(), DeviceColorSpace);
}
-void GraphicsContext::setPlatformShadow(const IntSize&, int, const Color&, ColorSpace)
+void GraphicsContext::setPlatformShadow(const IntSize&, float, const Color&, ColorSpace)
{
notImplemented();
}
@@ -1673,7 +1673,7 @@ void GraphicsContext::drawText(const SimpleFontData* fontData, const GlyphBuffer
}
IntSize shadowSize;
- int shadowBlur = 0;
+ float shadowBlur = 0;
Color shadowColor;
bool hasShadow = textDrawingMode() == cTextFill
&& getShadow(shadowSize, shadowBlur, shadowColor)
diff --git a/WebCore/platform/graphics/wince/ImageBufferWince.cpp b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
index 0d5c8dd..4b739c8 100644
--- a/WebCore/platform/graphics/wince/ImageBufferWince.cpp
+++ b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
@@ -216,7 +216,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
putImageData<true>(source, sourceRect, destPoint, m_data.m_bitmap.get());
}
-String ImageBuffer::toDataURL(const String& mimeType, double) const
+String ImageBuffer::toDataURL(const String& mimeType, const double*) const
{
if (!m_data.m_bitmap->bytes())
return "data:,";
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 2298d6a..127bf07 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -554,7 +554,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
return;
}
-void GraphicsContext::setPlatformShadow(IntSize const&,int,Color const&, ColorSpace)
+void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace)
{
notImplemented();
}
diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp
index 1d37dfa..775e018 100644
--- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp
+++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp
@@ -76,7 +76,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so
notImplemented();
}
-String ImageBuffer::toDataURL(const String&, double) const
+String ImageBuffer::toDataURL(const String&, const double*) const
{
notImplemented();
return String();
diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp
index 705c2ae..017e486 100644
--- a/WebCore/platform/gtk/CursorGtk.cpp
+++ b/WebCore/platform/gtk/CursorGtk.cpp
@@ -65,8 +65,9 @@ Cursor::Cursor(const Cursor& other)
Cursor::Cursor(Image* image, const IntPoint& hotSpot)
{
+ IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
GdkPixbuf* pixbuf = image->getGdkPixbuf();
- m_impl = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, hotSpot.x(), hotSpot.y());
+ m_impl = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, effectiveHotSpot.x(), effectiveHotSpot.y());
g_object_unref(pixbuf);
}
diff --git a/WebCore/platform/gtk/DragDataGtk.cpp b/WebCore/platform/gtk/DragDataGtk.cpp
index 69b3161..4ed3bc1 100644
--- a/WebCore/platform/gtk/DragDataGtk.cpp
+++ b/WebCore/platform/gtk/DragDataGtk.cpp
@@ -67,12 +67,12 @@ bool DragData::containsCompatibleContent() const
return false;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
return false;
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
return String();
}
diff --git a/WebCore/platform/gtk/FileChooserGtk.cpp b/WebCore/platform/gtk/FileChooserGtk.cpp
index 3ff06f0..4600215 100644
--- a/WebCore/platform/gtk/FileChooserGtk.cpp
+++ b/WebCore/platform/gtk/FileChooserGtk.cpp
@@ -57,9 +57,8 @@ String FileChooser::basenameForWidth(const Font& font, int width) const
String string = fileButtonNoFileSelectedLabel();
if (m_filenames.size() == 1) {
- gchar* systemFilename = filenameFromString(m_filenames[0]);
- gchar* systemBasename = g_path_get_basename(systemFilename);
- g_free(systemFilename);
+ CString systemFilename = fileSystemRepresentation(m_filenames[0]);
+ gchar* systemBasename = g_path_get_basename(systemFilename.data());
stringByAdoptingFileSystemRepresentation(systemBasename, string);
} else if (m_filenames.size() > 1)
return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false);
diff --git a/WebCore/platform/gtk/FileSystemGtk.cpp b/WebCore/platform/gtk/FileSystemGtk.cpp
index ddcf0aa..401bd4a 100644
--- a/WebCore/platform/gtk/FileSystemGtk.cpp
+++ b/WebCore/platform/gtk/FileSystemGtk.cpp
@@ -52,12 +52,15 @@ String filenameToString(const char* filename)
#endif
}
-char* filenameFromString(const String& string)
+CString fileSystemRepresentation(const String& path)
{
#if OS(WINDOWS)
- return g_strdup(string.utf8().data());
+ return path.utf8();
#else
- return g_uri_unescape_string(string.utf8().data(), 0);
+ char* filename = g_uri_unescape_string(path.utf8().data(), 0);
+ CString cfilename(filename);
+ g_free(filename);
+ return cfilename;
#endif
}
@@ -67,9 +70,8 @@ String filenameForDisplay(const String& string)
#if OS(WINDOWS)
return string;
#else
- gchar* filename = filenameFromString(string);
- gchar* display = g_filename_to_utf8(filename, 0, 0, 0, 0);
- g_free(filename);
+ CString filename = fileSystemRepresentation(string);
+ gchar* display = g_filename_to_utf8(filename.data(), 0, 0, 0, 0);
if (!display)
return string;
@@ -83,12 +85,10 @@ String filenameForDisplay(const String& string)
bool fileExists(const String& path)
{
bool result = false;
- gchar* filename = filenameFromString(path);
+ CString filename = fileSystemRepresentation(path);
- if (filename) {
- result = g_file_test(filename, G_FILE_TEST_EXISTS);
- g_free(filename);
- }
+ if (!filename.isNull())
+ result = g_file_test(filename.data(), G_FILE_TEST_EXISTS);
return result;
}
@@ -96,12 +96,10 @@ bool fileExists(const String& path)
bool deleteFile(const String& path)
{
bool result = false;
- gchar* filename = filenameFromString(path);
+ CString filename = fileSystemRepresentation(path);
- if (filename) {
- result = g_remove(filename) == 0;
- g_free(filename);
- }
+ if (!filename.isNull())
+ result = g_remove(filename.data()) == 0;
return result;
}
@@ -109,25 +107,22 @@ bool deleteFile(const String& path)
bool deleteEmptyDirectory(const String& path)
{
bool result = false;
- gchar* filename = filenameFromString(path);
+ CString filename = fileSystemRepresentation(path);
- if (filename) {
- result = g_rmdir(filename) == 0;
- g_free(filename);
- }
+ if (!filename.isNull())
+ result = g_rmdir(filename.data()) == 0;
return result;
}
bool getFileSize(const String& path, long long& resultSize)
{
- gchar* filename = filenameFromString(path);
- if (!filename)
+ CString filename = fileSystemRepresentation(path);
+ if (filename.isNull())
return false;
struct stat statResult;
- gint result = g_stat(filename, &statResult);
- g_free(filename);
+ gint result = g_stat(filename.data(), &statResult);
if (result != 0)
return false;
@@ -137,13 +132,12 @@ bool getFileSize(const String& path, long long& resultSize)
bool getFileModificationTime(const String& path, time_t& modifiedTime)
{
- gchar* filename = filenameFromString(path);
- if (!filename)
+ CString filename = fileSystemRepresentation(path);
+ if (filename.isNull())
return false;
struct stat statResult;
- gint result = g_stat(filename, &statResult);
- g_free(filename);
+ gint result = g_stat(filename.data(), &statResult);
if (result != 0)
return false;
@@ -162,12 +156,11 @@ String pathByAppendingComponent(const String& path, const String& component)
bool makeAllDirectories(const String& path)
{
- gchar* filename = filenameFromString(path);
- if (!filename)
+ CString filename = fileSystemRepresentation(path);
+ if (filename.isNull())
return false;
- gint result = g_mkdir_with_parents(filename, S_IRWXU);
- g_free(filename);
+ gint result = g_mkdir_with_parents(filename.data(), S_IRWXU);
return result == 0;
}
@@ -182,11 +175,10 @@ String pathGetFileName(const String& pathName)
if (pathName.isEmpty())
return pathName;
- char* tmpFilename = filenameFromString(pathName);
- char* baseName = g_path_get_basename(tmpFilename);
+ CString tmpFilename = fileSystemRepresentation(pathName);
+ char* baseName = g_path_get_basename(tmpFilename.data());
String fileName = String::fromUTF8(baseName);
g_free(baseName);
- g_free(tmpFilename);
return fileName;
}
@@ -194,7 +186,7 @@ String pathGetFileName(const String& pathName)
String directoryName(const String& path)
{
/* No null checking needed */
- GOwnPtr<char> tmpFilename(filenameFromString(path));
+ GOwnPtr<char> tmpFilename(const_cast<char*>(fileSystemRepresentation(path).data()));
GOwnPtr<char> dirname(g_path_get_dirname(tmpFilename.get()));
return String::fromUTF8(dirname.get());
}
@@ -203,8 +195,8 @@ Vector<String> listDirectory(const String& path, const String& filter)
{
Vector<String> entries;
- gchar* filename = filenameFromString(path);
- GDir* dir = g_dir_open(filename, 0, 0);
+ CString filename = fileSystemRepresentation(path);
+ GDir* dir = g_dir_open(filename.data(), 0, 0);
if (!dir)
return entries;
@@ -213,12 +205,11 @@ Vector<String> listDirectory(const String& path, const String& filter)
if (!g_pattern_match_string(pspec, name))
continue;
- gchar* entry = g_build_filename(filename, name, NULL);
- entries.append(filenameToString(entry));
- g_free(entry);
+ GOwnPtr<gchar> entry(g_build_filename(filename.data(), name, NULL));
+ entries.append(filenameToString(entry.get()));
}
+ g_pattern_spec_free(pspec);
g_dir_close(dir);
- g_free(filename);
return entries;
}
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
new file mode 100644
index 0000000..0558f33
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GOwnPtrGtk.h"
+
+#include <gdk/gdk.h>
+#include <glib.h>
+
+namespace WTF {
+
+template <> void freeOwnedGPtr<GdkEvent>(GdkEvent* ptr)
+{
+ if (ptr)
+ gdk_event_free(ptr);
+}
+
+}
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h
new file mode 100644
index 0000000..674ea58
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * 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 GOwnPtrGtk_h
+#define GOwnPtrGtk_h
+
+#include "GOwnPtr.h"
+
+typedef union _GdkEvent GdkEvent;
+
+namespace WTF {
+
+template<> void freeOwnedGPtr<GdkEvent>(GdkEvent*);
+
+}
+
+#endif
diff --git a/WebCore/platform/gtk/GtkPluginWidget.cpp b/WebCore/platform/gtk/GtkPluginWidget.cpp
index 67bf4b1..94382f1 100644
--- a/WebCore/platform/gtk/GtkPluginWidget.cpp
+++ b/WebCore/platform/gtk/GtkPluginWidget.cpp
@@ -47,7 +47,7 @@ void GtkPluginWidget::invalidateRect(const IntRect& _rect)
if (!gtk_widget_get_has_window(platformWidget()))
return;
- GdkWindow* window = platformWidget()->window;
+ GdkWindow* window = gtk_widget_get_window(platformWidget());
if (!window)
return;
diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h
index fc92d8b..cdd679c 100644
--- a/WebCore/platform/gtk/GtkVersioning.h
+++ b/WebCore/platform/gtk/GtkVersioning.h
@@ -31,4 +31,8 @@
#define gtk_widget_is_sensitive(widget) GTK_WIDGET_IS_SENSITIVE(widget)
#endif // GTK_CHECK_VERSION(2, 19, 0)
+#if !GTK_CHECK_VERSION(2, 14, 0)
+#define gtk_widget_get_window(widget) (widget)->window
+#endif
+
#endif // GtkVersioning_h
diff --git a/WebCore/platform/gtk/PlatformScreenGtk.cpp b/WebCore/platform/gtk/PlatformScreenGtk.cpp
index 9341714..0ab00a1 100644
--- a/WebCore/platform/gtk/PlatformScreenGtk.cpp
+++ b/WebCore/platform/gtk/PlatformScreenGtk.cpp
@@ -64,7 +64,7 @@ static GdkVisual* getVisual(Widget* widget)
}
- return gdk_drawable_get_visual(GDK_DRAWABLE(container->window));
+ return gdk_drawable_get_visual(GDK_DRAWABLE(gtk_widget_get_window(container)));
}
int screenDepth(Widget* widget)
@@ -102,7 +102,7 @@ FloatRect screenRect(Widget* widget)
if (!screen)
return FloatRect();
- gint monitor = gdk_screen_get_monitor_at_window(screen, GTK_WIDGET(container)->window);
+ gint monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(container)));
GdkRectangle geometry;
gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp
index 1620b3b..f29d51b 100644
--- a/WebCore/platform/gtk/PopupMenuGtk.cpp
+++ b/WebCore/platform/gtk/PopupMenuGtk.cpp
@@ -26,6 +26,7 @@
#include "PopupMenu.h"
#include "FrameView.h"
+#include "GtkVersioning.h"
#include "HostWindow.h"
#include "PlatformString.h"
#include <wtf/text/CString.h>
@@ -57,7 +58,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
gtk_container_foreach(GTK_CONTAINER(m_popup.get()), reinterpret_cast<GtkCallback>(menuRemoveItem), this);
int x, y;
- gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformPageClient())->window, &x, &y);
+ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y);
m_menuPosition = view->contentsToWindow(rect.location());
m_menuPosition = IntPoint(m_menuPosition.x() + x, m_menuPosition.y() + y + rect.height());
m_indexMap.clear();
diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp
index c572e77..6205dbd 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -99,7 +99,7 @@ void RenderThemeGtk::initMediaStyling(GtkStyle* style, bool force)
m_muteButton = Image::loadPlatformThemeIcon("audio-volume-high", m_mediaIconSize);
m_unmuteButton = Image::loadPlatformThemeIcon("audio-volume-muted", m_mediaIconSize);
m_playButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(playButtonIconName), m_mediaIconSize);
- m_pauseButton = Image::loadPlatformThemeIcon("gtk-media-pause", m_mediaIconSize).releaseRef();
+ m_pauseButton = Image::loadPlatformThemeIcon("gtk-media-pause", m_mediaIconSize);
m_seekBackButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(seekBackButtonIconName), m_mediaIconSize);
m_seekForwardButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(seekForwardButtonIconName), m_mediaIconSize);
@@ -179,6 +179,8 @@ RenderThemeGtk::~RenderThemeGtk()
for (guint i = 0; i < g_list_length(values); i++)
moz_gtk_destroy_theme_parts_widgets(
static_cast<GtkThemeParts*>(g_list_nth_data(values, i)));
+
+ gtk_widget_destroy(m_gtkWindow);
}
GtkThemeParts* RenderThemeGtk::partsForDrawable(GdkDrawable* drawable) const
@@ -211,6 +213,8 @@ static bool supportsFocus(ControlPart appearance)
case MenulistPart:
case RadioPart:
case CheckboxPart:
+ case SliderHorizontalPart:
+ case SliderVerticalPart:
return true;
default:
return false;
@@ -273,7 +277,7 @@ static void adjustMozillaStyle(const RenderThemeGtk* theme, RenderStyle* style,
style->setPaddingBottom(Length(ypadding + bottom, Fixed));
}
-static void setMozillaState(const RenderTheme* theme, GtkWidgetState* state, RenderObject* o)
+static void setMozillaState(const RenderTheme* theme, GtkThemeWidgetType type, RenderObject* o, GtkWidgetState* state)
{
state->active = theme->isPressed(o);
state->focused = theme->isFocused(o);
@@ -282,7 +286,15 @@ static void setMozillaState(const RenderTheme* theme, GtkWidgetState* state, Ren
state->disabled = !theme->isEnabled(o) || theme->isReadOnlyControl(o);
state->isDefault = false;
state->canDefault = false;
- state->depressed = false;
+
+
+ // FIXME: The depressed value should probably apply for other theme parts too.
+ // It must be used for range thumbs, because otherwise when the thumb is pressed,
+ // the rendering is incorrect.
+ if (type == MOZ_GTK_SCALE_THUMB_HORIZONTAL || type == MOZ_GTK_SCALE_THUMB_VERTICAL)
+ state->depressed = theme->isPressed(o);
+ else
+ state->depressed = false;
}
static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetType type, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect)
@@ -299,7 +311,7 @@ static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetTyp
pixmap = adoptGRef(gdk_pixmap_new(0, rect.width(), rect.height(), gdk_visual_get_system()->depth));
GtkWidgetState mozState;
- setMozillaState(theme, &mozState, o);
+ setMozillaState(theme, type, o, &mozState);
int flags;
@@ -528,14 +540,55 @@ bool RenderThemeGtk::paintSearchField(RenderObject* o, const RenderObject::Paint
return paintTextField(o, i, rect);
}
+bool RenderThemeGtk::paintSliderTrack(RenderObject* object, const RenderObject::PaintInfo& info, const IntRect& rect)
+{
+ ControlPart part = object->style()->appearance();
+ ASSERT(part == SliderHorizontalPart || part == SliderVerticalPart);
+
+ GtkThemeWidgetType gtkPart = MOZ_GTK_SCALE_HORIZONTAL;
+ if (part == SliderVerticalPart)
+ gtkPart = MOZ_GTK_SCALE_VERTICAL;
+
+ return paintMozillaGtkWidget(this, gtkPart, object, info, rect);
+}
+
+void RenderThemeGtk::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ style->setBoxShadow(0);
+}
+
+bool RenderThemeGtk::paintSliderThumb(RenderObject* object, const RenderObject::PaintInfo& info, const IntRect& rect)
+{
+ ControlPart part = object->style()->appearance();
+ ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart);
+
+ GtkThemeWidgetType gtkPart = MOZ_GTK_SCALE_THUMB_HORIZONTAL;
+ if (part == SliderThumbVerticalPart)
+ gtkPart = MOZ_GTK_SCALE_THUMB_VERTICAL;
+
+ return paintMozillaGtkWidget(this, gtkPart, object, info, rect);
+}
+
+void RenderThemeGtk::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ style->setBoxShadow(0);
+}
+
void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const
{
+ ControlPart part = o->style()->appearance();
#if ENABLE(VIDEO)
- if (o->style()->appearance() == MediaSliderThumbPart) {
+ if (part == MediaSliderThumbPart) {
o->style()->setWidth(Length(m_mediaSliderThumbWidth, Fixed));
o->style()->setHeight(Length(m_mediaSliderThumbHeight, Fixed));
- }
+ } else
#endif
+ if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) {
+ gint width, height;
+ moz_gtk_get_scalethumb_metrics(part == SliderThumbHorizontalPart ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, &width, &height);
+ o->style()->setWidth(Length(width, Fixed));
+ o->style()->setHeight(Length(height, Fixed));
+ }
}
Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const
diff --git a/WebCore/platform/gtk/RenderThemeGtk.h b/WebCore/platform/gtk/RenderThemeGtk.h
index b62b41c..41b518e 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.h
+++ b/WebCore/platform/gtk/RenderThemeGtk.h
@@ -122,7 +122,13 @@ protected:
virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
- virtual void adjustSliderThumbSize(RenderObject*) const;
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual void adjustSliderThumbSize(RenderObject* object) const;
#if ENABLE(VIDEO)
virtual void initMediaStyling(GtkStyle* style, bool force);
diff --git a/WebCore/platform/gtk/SharedBufferGtk.cpp b/WebCore/platform/gtk/SharedBufferGtk.cpp
index db04d80..c7040f2 100644
--- a/WebCore/platform/gtk/SharedBufferGtk.cpp
+++ b/WebCore/platform/gtk/SharedBufferGtk.cpp
@@ -32,19 +32,17 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi
if (filePath.isEmpty())
return 0;
- gchar* filename = filenameFromString(filePath);
+ CString filename = fileSystemRepresentation(filePath);
gchar* contents;
gsize size;
GError* error = 0;
- if (!g_file_get_contents(filename, &contents, &size, &error)) {
+ if (!g_file_get_contents(filename.data(), &contents, &size, &error)) {
LOG_ERROR("Failed to fully read contents of file %s - %s", filenameForDisplay(filePath).utf8().data(), error->message);
g_error_free(error);
- g_free(filename);
return 0;
}
RefPtr<SharedBuffer> result = SharedBuffer::create(contents, size);
- g_free(filename);
g_free(contents);
return result.release();
diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp
index 71addfd..c2c11bd 100644
--- a/WebCore/platform/gtk/WidgetGtk.cpp
+++ b/WebCore/platform/gtk/WidgetGtk.cpp
@@ -31,6 +31,7 @@
#include "Cursor.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "GtkVersioning.h"
#include "HostWindow.h"
#include "IntRect.h"
#include "RenderObject.h"
@@ -61,7 +62,7 @@ void Widget::setFocus(bool focused)
static GdkDrawable* gdkDrawable(PlatformWidget widget)
{
- return widget ? widget->window : 0;
+ return widget ? gtk_widget_get_window(widget) : 0;
}
void Widget::setCursor(const Cursor& cursor)
@@ -77,7 +78,7 @@ void Widget::setCursor(const Cursor& cursor)
if (platformCursor == lastSetCursor)
return;
- gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformPageClient())->window, platformCursor);
+ gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : gtk_widget_get_window(GTK_WIDGET(root()->hostWindow()->platformPageClient())), platformCursor);
lastSetCursor = platformCursor;
}
diff --git a/WebCore/platform/haiku/DragDataHaiku.cpp b/WebCore/platform/haiku/DragDataHaiku.cpp
index 4a20147..7f40b8a 100644
--- a/WebCore/platform/haiku/DragDataHaiku.cpp
+++ b/WebCore/platform/haiku/DragDataHaiku.cpp
@@ -86,13 +86,13 @@ bool DragData::containsCompatibleContent() const
return containsColor() || containsURL() || containsPlainText();
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
notImplemented();
return false;
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
notImplemented();
return String();
diff --git a/WebCore/platform/haiku/SharedBufferHaiku.cpp b/WebCore/platform/haiku/SharedBufferHaiku.cpp
index abe9e2d..5bab562 100644
--- a/WebCore/platform/haiku/SharedBufferHaiku.cpp
+++ b/WebCore/platform/haiku/SharedBufferHaiku.cpp
@@ -40,17 +40,12 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi
if (file.InitCheck() != B_OK)
return 0;
- RefPtr<SharedBuffer> result = SharedBuffer::create();
-
off_t size;
file.GetSize(&size);
- result->m_buffer.resize(size);
- if (result->m_buffer.size() != size)
- return 0;
- result->m_size = size;
- file.Read(result->m_buffer.data(), result->m_buffer.size());
- return result.release();
+ Vector<char> buffer(size);
+ file.Read(buffer.data(), buffer.size());
+ return SharedBuffer::adoptVector(buffer);
}
} // namespace WebCore
diff --git a/WebCore/platform/mac/CursorMac.mm b/WebCore/platform/mac/CursorMac.mm
index c28f149..8cd54a1 100644
--- a/WebCore/platform/mac/CursorMac.mm
+++ b/WebCore/platform/mac/CursorMac.mm
@@ -43,14 +43,14 @@ namespace WebCore {
// Simple NSCursor calls shouldn't need protection,
// but creating a cursor with a bad image might throw.
-static NSCursor* createCustomCursor(Image* image, const IntPoint& hotspot)
+static NSCursor* createCustomCursor(Image* image, const IntPoint& hotSpot)
{
// FIXME: The cursor won't animate. Not sure if that's a big deal.
NSImage* img = image->getNSImage();
if (!img)
return 0;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return [[NSCursor alloc] initWithImage:img hotSpot:hotspot];
+ return [[NSCursor alloc] initWithImage:img hotSpot:determineHotSpot(image, hotSpot)];
END_BLOCK_OBJC_EXCEPTIONS;
return 0;
}
@@ -76,8 +76,8 @@ static NSCursor* leakNamedCursor(const char* name, int x, int y)
return nil;
}
-Cursor::Cursor(Image* image, const IntPoint& hotspot)
- : m_impl(HardRetainWithNSRelease(createCustomCursor(image, hotspot)))
+Cursor::Cursor(Image* image, const IntPoint& hotSpot)
+ : m_impl(HardRetainWithNSRelease(createCustomCursor(image, hotSpot)))
{
}
diff --git a/WebCore/platform/mac/DragDataMac.mm b/WebCore/platform/mac/DragDataMac.mm
index 02a6af7..fa416ed 100644
--- a/WebCore/platform/mac/DragDataMac.mm
+++ b/WebCore/platform/mac/DragDataMac.mm
@@ -113,13 +113,15 @@ bool DragData::containsCompatibleContent() const
return [types count] != 0;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
- return !asURL().isEmpty();
+ return !asURL(filenamePolicy).isEmpty();
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
+ // FIXME: Use filenamePolicy.
+ (void)filenamePolicy;
return m_pasteboardHelper->urlFromPasteboard([m_platformDragData draggingPasteboard], title);
}
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h
index ea30023..88472da 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -117,7 +117,7 @@ extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
-extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous);
+extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm
index b63c5c2..bb54ad0 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -52,7 +52,7 @@ NSString* (*wkGetMIMETypeForExtension)(NSString*);
NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
-void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous);
+void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
int (*wkQTMovieDataRate)(QTMovie*);
diff --git a/WebCore/platform/mac/WheelEventMac.mm b/WebCore/platform/mac/WheelEventMac.mm
index d7e2934..d9663b9 100644
--- a/WebCore/platform/mac/WheelEventMac.mm
+++ b/WebCore/platform/mac/WheelEventMac.mm
@@ -43,9 +43,14 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
, m_metaKey([event modifierFlags] & NSCommandKeyMask)
{
BOOL continuous;
- wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &m_wheelTicksX, &m_wheelTicksY, &continuous);
-
- if (!continuous) {
+
+ wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
+ if (continuous) {
+ m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
+ m_wheelTicksY = m_deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep());
+ } else {
+ m_wheelTicksX = m_deltaX;
+ m_wheelTicksY = m_deltaY;
m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
}
diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp
index 918002a..431dbe4 100644
--- a/WebCore/platform/network/FormData.cpp
+++ b/WebCore/platform/network/FormData.cpp
@@ -19,23 +19,26 @@
*/
#include "config.h"
+
#include "FormData.h"
-#include "Blob.h"
+#include "BlobItem.h"
#include "Chrome.h"
#include "ChromeClient.h"
-#include "DOMFormData.h"
#include "Document.h"
-#include "File.h"
#include "FileSystem.h"
#include "FormDataBuilder.h"
#include "MIMETypeRegistry.h"
#include "Page.h"
#include "TextEncoding.h"
-#include "UUID.h"
namespace WebCore {
+#if ENABLE(BLOB_SLICE)
+const long long FormDataElement::toEndOfFile = -1;
+const double FormDataElement::doNotCheckFileChange = 0;
+#endif
+
inline FormData::FormData()
: m_identifier(0)
, m_hasGeneratedFiles(false)
@@ -96,17 +99,17 @@ PassRefPtr<FormData> FormData::create(const Vector<char>& vector)
return result.release();
}
-PassRefPtr<FormData> FormData::create(const DOMFormData& domFormData)
+PassRefPtr<FormData> FormData::create(const BlobItemList& items, const TextEncoding& encoding)
{
RefPtr<FormData> result = create();
- result->appendDOMFormData(domFormData, false, 0);
+ result->appendKeyValuePairItems(items, encoding, false, 0);
return result.release();
}
-PassRefPtr<FormData> FormData::createMultiPart(const DOMFormData& domFormData, Document* document)
+PassRefPtr<FormData> FormData::createMultiPart(const BlobItemList& items, const TextEncoding& encoding, Document* document)
{
RefPtr<FormData> result = create();
- result->appendDOMFormData(domFormData, true, document);
+ result->appendKeyValuePairItems(items, encoding, true, document);
return result.release();
}
@@ -154,12 +157,44 @@ void FormData::appendData(const void* data, size_t size)
void FormData::appendFile(const String& filename, bool shouldGenerateFile)
{
#if ENABLE(BLOB_SLICE)
- m_elements.append(FormDataElement(filename, 0, Blob::toEndOfFile, Blob::doNotCheckFileChange, shouldGenerateFile));
+ m_elements.append(FormDataElement(filename, 0, FormDataElement::toEndOfFile, FormDataElement::doNotCheckFileChange, shouldGenerateFile));
#else
m_elements.append(FormDataElement(filename, shouldGenerateFile));
#endif
}
+void FormData::appendItems(const BlobItemList& items)
+{
+ for (BlobItemList::const_iterator iter(items.begin()); iter != items.end(); ++iter)
+ appendItem(iter->get(), false);
+}
+
+void FormData::appendItem(const BlobItem* item, bool shouldGenerateFile)
+{
+ const DataBlobItem* dataItem = item->toDataBlobItem();
+ if (dataItem) {
+ appendData(dataItem->data(), static_cast<size_t>(dataItem->size()));
+ return;
+ }
+
+ const FileBlobItem* fileItem = item->toFileBlobItem();
+ ASSERT(fileItem);
+ if (fileItem->path().isEmpty()) {
+ // If the path is empty do not add the item.
+ return;
+ }
+
+#if ENABLE(BLOB_SLICE)
+ const FileRangeBlobItem* fileRangeItem = item->toFileRangeBlobItem();
+ if (fileRangeItem) {
+ appendFileRange(fileItem->path(), fileRangeItem->start(), fileRangeItem->size(), fileRangeItem->snapshotModificationTime(), shouldGenerateFile);
+ return;
+ }
+#endif
+
+ appendFile(fileItem->path(), shouldGenerateFile);
+}
+
#if ENABLE(BLOB_SLICE)
void FormData::appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile)
{
@@ -167,42 +202,30 @@ void FormData::appendFileRange(const String& filename, long long start, long lon
}
#endif
-void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document)
+void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEncoding& encoding, bool isMultiPartForm, Document* document)
{
FormDataBuilder formDataBuilder;
if (isMultiPartForm)
m_boundary = formDataBuilder.generateUniqueBoundaryString();
Vector<char> encodedData;
- TextEncoding encoding = domFormData.encoding();
- const Vector<FormDataList::Item>& list = domFormData.list();
- size_t formDataListSize = list.size();
+ size_t formDataListSize = items.size();
ASSERT(!(formDataListSize % 2));
for (size_t i = 0; i < formDataListSize; i += 2) {
- const FormDataList::Item& key = list[i];
- const FormDataList::Item& value = list[i + 1];
+ const StringBlobItem* key = items[i]->toStringBlobItem();
+ const BlobItem* value = items[i + 1].get();
+ ASSERT(key);
if (isMultiPartForm) {
Vector<char> header;
- formDataBuilder.beginMultiPartHeader(header, m_boundary.data(), key.data());
+ formDataBuilder.beginMultiPartHeader(header, m_boundary.data(), key->cstr());
bool shouldGenerateFile = false;
// If the current type is FILE, then we also need to include the filename
- if (value.blob()) {
- const String& path = value.blob()->path();
-#if ENABLE(BLOB_SLICE)
- String fileName;
- if (value.blob()->isFile())
- fileName = static_cast<File*>(value.blob())->fileName();
- else {
- // If a blob is sliced from a file, it does not have the filename. In this case, let's produce a unique filename.
- fileName = "Blob" + createCanonicalUUIDString();
- fileName.replace("-", ""); // For safty, remove '-' from the filename snce some servers may not like it.
- }
-#else
- ASSERT(value.blob()->isFile());
- String fileName = static_cast<File*>(value.blob())->fileName();
-#endif
+ const FileBlobItem* fileItem = value->toFileBlobItem();
+ if (fileItem) {
+ const String& path = fileItem->path();
+ String fileName = fileItem->name();
// Let the application specify a filename if it's going to generate a replacement file for the upload.
if (!path.isEmpty()) {
@@ -217,9 +240,9 @@ void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPar
// We have to include the filename=".." part in the header, even if the filename is empty
formDataBuilder.addFilenameToMultiPartHeader(header, encoding, fileName);
- // If a blob is sliced from a file, do not add the content type.
+ // If the item is sliced from a file, do not add the content type.
#if ENABLE(BLOB_SLICE)
- if (!fileName.isEmpty() && value.blob()->isFile()) {
+ if (!fileName.isEmpty() && !value->toFileRangeBlobItem()) {
#else
if (!fileName.isEmpty()) {
#endif
@@ -237,25 +260,20 @@ void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPar
// Append body
appendData(header.data(), header.size());
- if (size_t dataSize = value.data().length())
- appendData(value.data().data(), dataSize);
- else if (value.blob() && !value.blob()->path().isEmpty())
-#if ENABLE(BLOB_SLICE)
- appendFileRange(value.blob()->path(), value.blob()->start(), value.blob()->length(), value.blob()->modificationTime(), shouldGenerateFile);
-#else
- appendFile(value.blob()->path(), shouldGenerateFile);
-#endif
-
+ appendItem(value, shouldGenerateFile);
appendData("\r\n", 2);
} else {
// Omit the name "isindex" if it's the first form data element.
// FIXME: Why is this a good rule? Is this obsolete now?
- if (encodedData.isEmpty() && key.data() == "isindex")
- FormDataBuilder::encodeStringAsFormData(encodedData, value.data());
+ const StringBlobItem* stringValue = value->toStringBlobItem();
+ if (!stringValue)
+ continue;
+ if (encodedData.isEmpty() && key->cstr() == "isindex")
+ FormDataBuilder::encodeStringAsFormData(encodedData, stringValue->cstr());
else
- formDataBuilder.addKeyValuePairAsFormData(encodedData, key.data(), value.data());
+ formDataBuilder.addKeyValuePairAsFormData(encodedData, key->cstr(), stringValue->cstr());
}
- }
+ }
if (isMultiPartForm)
formDataBuilder.addBoundaryToMultiPartHeader(encodedData, m_boundary.data(), true);
@@ -270,12 +288,8 @@ void FormData::flatten(Vector<char>& data) const
size_t n = m_elements.size();
for (size_t i = 0; i < n; ++i) {
const FormDataElement& e = m_elements[i];
- if (e.m_type == FormDataElement::data) {
- size_t oldSize = data.size();
- size_t delta = e.m_data.size();
- data.grow(oldSize + delta);
- memcpy(data.data() + oldSize, e.m_data.data(), delta);
- }
+ if (e.m_type == FormDataElement::data)
+ data.append(e.m_data.data(), static_cast<size_t>(e.m_data.size()));
}
}
@@ -289,10 +303,10 @@ String FormData::flattenToString() const
void FormData::generateFiles(Document* document)
{
ASSERT(!m_hasGeneratedFiles);
-
+
if (m_hasGeneratedFiles)
return;
-
+
Page* page = document->page();
if (!page)
return;
@@ -312,7 +326,7 @@ void FormData::removeGeneratedFilesIfNeeded()
{
if (!m_hasGeneratedFiles)
return;
-
+
size_t n = m_elements.size();
for (size_t i = 0; i < n; ++i) {
FormDataElement& e = m_elements[i];
diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h
index a439023..95eb258 100644
--- a/WebCore/platform/network/FormData.h
+++ b/WebCore/platform/network/FormData.h
@@ -26,13 +26,16 @@
namespace WebCore {
-class DOMFormData;
+class BlobItem;
class Document;
+class TextEncoding;
+typedef Vector<RefPtr<BlobItem> > BlobItemList;
class FormDataElement {
public:
FormDataElement() : m_type(data) { }
FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { }
+
#if ENABLE(BLOB_SLICE)
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
@@ -49,13 +52,18 @@ public:
#endif
String m_generatedFilename;
bool m_shouldGenerateFile;
+
+#if ENABLE(BLOB_SLICE)
+ static const long long toEndOfFile;
+ static const double doNotCheckFileChange;
+#endif
};
inline bool operator==(const FormDataElement& a, const FormDataElement& b)
{
if (&a == &b)
return true;
-
+
if (a.m_type != b.m_type)
return false;
if (a.m_data != b.m_data)
@@ -69,25 +77,26 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b)
return true;
}
-
+
inline bool operator!=(const FormDataElement& a, const FormDataElement& b)
{
return !(a == b);
}
-
+
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 Vector<char>&);
- static PassRefPtr<FormData> create(const DOMFormData&);
- static PassRefPtr<FormData> createMultiPart(const DOMFormData&, Document*);
+ static PassRefPtr<FormData> create(const BlobItemList&, const TextEncoding&);
+ static PassRefPtr<FormData> createMultiPart(const BlobItemList&, const TextEncoding&, Document*);
PassRefPtr<FormData> copy() const;
PassRefPtr<FormData> deepCopy() const;
~FormData();
-
+
void appendData(const void* data, size_t);
+ void appendItems(const BlobItemList&);
void appendFile(const String& filename, bool shouldGenerateFile = false);
#if ENABLE(BLOB_SLICE)
void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false);
@@ -115,9 +124,11 @@ private:
FormData();
FormData(const FormData&);
- void appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document);
+ void appendItem(const BlobItem*, bool shouldGenerateFile);
+ void appendKeyValuePairItems(const BlobItemList&, const TextEncoding&, bool isMultiPartForm, Document*);
Vector<FormDataElement> m_elements;
+
int64_t m_identifier;
bool m_hasGeneratedFiles;
bool m_alwaysStream;
@@ -131,7 +142,7 @@ inline bool operator==(const FormData& a, const FormData& b)
inline bool operator!=(const FormData& a, const FormData& b)
{
- return a.elements() != b.elements();
+ return !(a == b);
}
} // namespace WebCore
diff --git a/WebCore/platform/network/chromium/ResourceResponse.h b/WebCore/platform/network/chromium/ResourceResponse.h
index 8400ce5..f80bf42 100644
--- a/WebCore/platform/network/chromium/ResourceResponse.h
+++ b/WebCore/platform/network/chromium/ResourceResponse.h
@@ -41,6 +41,7 @@ namespace WebCore {
, m_isMultipartPayload(false)
, m_wasFetchedViaSPDY(false)
, m_wasNpnNegotiated(false)
+ , m_wasFetchedViaProxy(false)
, m_responseTime(0)
{
}
@@ -52,6 +53,7 @@ namespace WebCore {
, m_isMultipartPayload(false)
, m_wasFetchedViaSPDY(false)
, m_wasNpnNegotiated(false)
+ , m_wasFetchedViaProxy(false)
, m_responseTime(0)
{
}
@@ -74,6 +76,9 @@ namespace WebCore {
bool wasNpnNegotiated() const { return m_wasNpnNegotiated; }
void setWasNpnNegotiated(bool value) { m_wasNpnNegotiated = value; }
+ bool wasFetchedViaProxy() const { return m_wasFetchedViaProxy; }
+ void setWasFetchedViaProxy(bool value) { m_wasFetchedViaProxy = value; }
+
bool isMultipartPayload() const { return m_isMultipartPayload; }
void setIsMultipartPayload(bool value) { m_isMultipartPayload = value; }
@@ -114,6 +119,9 @@ namespace WebCore {
// Was the resource fetched over a channel which used TLS/Next-Protocol-Negotiation (also SPDY related).
bool m_wasNpnNegotiated;
+ // Was the resource fetched over an explicit proxy (HTTP, SOCKS, etc).
+ bool m_wasFetchedViaProxy;
+
// The time at which the response headers were received. For cached
// responses, this time could be "far" in the past.
double m_responseTime;
diff --git a/WebCore/platform/network/mac/FormDataStreamMac.mm b/WebCore/platform/network/mac/FormDataStreamMac.mm
index 27ecfd0..db2e13b 100644
--- a/WebCore/platform/network/mac/FormDataStreamMac.mm
+++ b/WebCore/platform/network/mac/FormDataStreamMac.mm
@@ -31,7 +31,6 @@
#import "config.h"
#import "FormDataStreamMac.h"
-#import "Blob.h"
#import "FileSystem.h"
#import "FormData.h"
#import "ResourceHandle.h"
@@ -142,7 +141,7 @@ static void closeCurrentStream(FormStreamFields *form)
CFRelease(form->currentStream);
form->currentStream = NULL;
#if ENABLE(BLOB_SLICE)
- form->currentStreamRangeLength = Blob::toEndOfFile;
+ form->currentStreamRangeLength = FormDataElement::toEndOfFile;
#endif
}
if (form->currentData) {
@@ -151,7 +150,7 @@ static void closeCurrentStream(FormStreamFields *form)
}
}
-// Return false if we cannot advance the stream. Currently the only possible failure is that the underlying file has been changed since File.slice.
+// Return false if we cannot advance the stream. Currently the only possible failure is that the underlying file has been removed or changed since File.slice.
static bool advanceCurrentStream(FormStreamFields* form)
{
closeCurrentStream(form);
@@ -161,6 +160,7 @@ static bool advanceCurrentStream(FormStreamFields* form)
// Create the new stream.
FormDataElement& nextInput = form->remainingElements.last();
+
if (nextInput.m_type == FormDataElement::data) {
size_t size = nextInput.m_data.size();
char* data = nextInput.m_data.releaseBuffer();
@@ -169,17 +169,20 @@ static bool advanceCurrentStream(FormStreamFields* form)
} else {
#if ENABLE(BLOB_SLICE)
// Check if the file has been changed or not if required.
- if (nextInput.m_expectedFileModificationTime != Blob::doNotCheckFileChange) {
+ if (nextInput.m_expectedFileModificationTime != FormDataElement::doNotCheckFileChange) {
time_t fileModificationTime;
if (!getFileModificationTime(nextInput.m_filename, fileModificationTime) || fileModificationTime != static_cast<time_t>(nextInput.m_expectedFileModificationTime))
return false;
}
#endif
-
const String& path = nextInput.m_shouldGenerateFile ? nextInput.m_generatedFilename : nextInput.m_filename;
RetainPtr<CFStringRef> filename(AdoptCF, path.createCFString());
RetainPtr<CFURLRef> fileURL(AdoptCF, CFURLCreateWithFileSystemPath(0, filename.get(), kCFURLPOSIXPathStyle, FALSE));
form->currentStream = CFReadStreamCreateWithFile(0, fileURL.get());
+ if (!form->currentStream) {
+ // The file must have been removed or become unreadable.
+ return false;
+ }
#if ENABLE(BLOB_SLICE)
if (nextInput.m_fileStart > 0) {
CFNumberRef position = CFNumberCreate(0, kCFNumberLongLongType, &nextInput.m_fileStart);
@@ -222,7 +225,7 @@ static void* formCreate(CFReadStreamRef stream, void* context)
FormStreamFields* newInfo = new FormStreamFields;
newInfo->currentStream = NULL;
#if ENABLE(BLOB_SLICE)
- newInfo->currentStreamRangeLength = Blob::toEndOfFile;
+ newInfo->currentStreamRangeLength = FormDataElement::toEndOfFile;
#endif
newInfo->currentData = 0;
newInfo->formStream = stream; // Don't retain. That would create a reference cycle.
@@ -270,7 +273,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen
while (form->currentStream) {
CFIndex bytesToRead = bufferLength;
#if ENABLE(BLOB_SLICE)
- if (form->currentStreamRangeLength != Blob::toEndOfFile && form->currentStreamRangeLength < bytesToRead)
+ if (form->currentStreamRangeLength != FormDataElement::toEndOfFile && form->currentStreamRangeLength < bytesToRead)
bytesToRead = static_cast<CFIndex>(form->currentStreamRangeLength);
#endif
CFIndex bytesRead = CFReadStreamRead(form->currentStream, buffer, bytesToRead);
@@ -283,7 +286,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen
*atEOF = FALSE;
form->bytesSent += bytesRead;
#if ENABLE(BLOB_SLICE)
- if (form->currentStreamRangeLength != Blob::toEndOfFile)
+ if (form->currentStreamRangeLength != FormDataElement::toEndOfFile)
form->currentStreamRangeLength -= bytesRead;
#endif
@@ -400,7 +403,7 @@ void setHTTPBody(NSMutableURLRequest *request, PassRefPtr<FormData> formData)
else {
#if ENABLE(BLOB_SLICE)
// 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 != Blob::toEndOfFile) {
+ if (element.m_fileLength != FormDataElement::toEndOfFile) {
length += element.m_fileLength;
continue;
}
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 90a842e..e2c67bc 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -533,10 +533,8 @@ static bool startHttp(ResourceHandle* handle)
* libsoup's simple-httpd test
*/
GError* error = 0;
- gchar* fileName = filenameFromString(element.m_filename);
- GMappedFile* fileMapping = g_mapped_file_new(fileName, false, &error);
-
- g_free(fileName);
+ CString fileName = fileSystemRepresentation(element.m_filename);
+ GMappedFile* fileMapping = g_mapped_file_new(fileName.data(), false, &error);
if (error) {
g_error_free(error);
diff --git a/WebCore/platform/posix/SharedBufferPOSIX.cpp b/WebCore/platform/posix/SharedBufferPOSIX.cpp
index ea0589d..6f66d4d 100644
--- a/WebCore/platform/posix/SharedBufferPOSIX.cpp
+++ b/WebCore/platform/posix/SharedBufferPOSIX.cpp
@@ -40,9 +40,8 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi
if (filePath.isEmpty())
return 0;
- char* filename = filenameFromString(filePath);
- int fd = open(filename, O_RDONLY);
- fastFree(filename);
+ CString filename = fileSystemRepresentation(filePath);
+ int fd = open(filename.data(), O_RDONLY);
if (fd == -1)
return 0;
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp
index c23e42e..c98c79a 100644
--- a/WebCore/platform/qt/ClipboardQt.cpp
+++ b/WebCore/platform/qt/ClipboardQt.cpp
@@ -22,14 +22,14 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ClipboardQt.h"
-#include "CachedImage.h"
#include "CSSHelper.h"
+#include "CachedImage.h"
#include "Document.h"
#include "Element.h"
#include "FileList.h"
@@ -38,19 +38,19 @@
#include "Image.h"
#include "IntPoint.h"
#include "KURL.h"
-#include "markup.h"
#include "NotImplemented.h"
#include "PlatformString.h"
#include "Range.h"
#include "RenderImage.h"
#include "StringHash.h"
+#include "markup.h"
+#include <QApplication>
+#include <QClipboard>
#include <QList>
#include <QMimeData>
#include <QStringList>
#include <QUrl>
-#include <QApplication>
-#include <QClipboard>
#include <qdebug.h>
#define methodDebug() qDebug("ClipboardQt: %s", __FUNCTION__)
@@ -226,14 +226,14 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co
{
ASSERT(frame);
- //WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
+ // WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
if (!m_writableData)
m_writableData = new QMimeData;
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
- QPixmap *pixmap = cachedImage->image()->nativeImageForCurrentFrame();
+ QPixmap* pixmap = cachedImage->image()->nativeImageForCurrentFrame();
if (pixmap)
m_writableData->setImageData(*pixmap);
diff --git a/WebCore/platform/qt/ContextMenuItemQt.cpp b/WebCore/platform/qt/ContextMenuItemQt.cpp
index cf23587..b91a2a7 100644
--- a/WebCore/platform/qt/ContextMenuItemQt.cpp
+++ b/WebCore/platform/qt/ContextMenuItemQt.cpp
@@ -21,11 +21,12 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ContextMenuItem.h"
+
#include "ContextMenu.h"
namespace WebCore {
diff --git a/WebCore/platform/qt/ContextMenuQt.cpp b/WebCore/platform/qt/ContextMenuQt.cpp
index 9b1a054..30c4c2d 100644
--- a/WebCore/platform/qt/ContextMenuQt.cpp
+++ b/WebCore/platform/qt/ContextMenuQt.cpp
@@ -21,19 +21,17 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ContextMenu.h"
-#include <wtf/Assertions.h>
-
-#include <QAction>
-
#include <Document.h>
#include <Frame.h>
#include <FrameView.h>
+#include <QAction>
+#include <wtf/Assertions.h>
namespace WebCore {
diff --git a/WebCore/platform/qt/CursorQt.cpp b/WebCore/platform/qt/CursorQt.cpp
index 87f4fce..2e495e7 100644
--- a/WebCore/platform/qt/CursorQt.cpp
+++ b/WebCore/platform/qt/CursorQt.cpp
@@ -57,11 +57,12 @@ Cursor::~Cursor()
{
}
-Cursor::Cursor(Image* image, const IntPoint& hotspot)
+Cursor::Cursor(Image* image, const IntPoint& hotSpot)
+{
#ifndef QT_NO_CURSOR
- : m_impl(*(image->nativeImageForCurrentFrame()), hotspot.x(), hotspot.y())
+ IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
+ m_impl = QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
#endif
-{
}
Cursor& Cursor::operator=(const Cursor& other)
diff --git a/WebCore/platform/qt/DragDataQt.cpp b/WebCore/platform/qt/DragDataQt.cpp
index 09a797f..808606d 100644
--- a/WebCore/platform/qt/DragDataQt.cpp
+++ b/WebCore/platform/qt/DragDataQt.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -31,10 +31,10 @@
#include "DocumentFragment.h"
#include "markup.h"
+#include <QColor>
#include <QList>
#include <QMimeData>
#include <QUrl>
-#include <QColor>
namespace WebCore {
@@ -90,7 +90,7 @@ String DragData::asPlainText() const
return text;
// FIXME: Should handle rich text here
- return asURL(0);
+ return asURL(DoNotConvertFilenames, 0);
}
Color DragData::asColor() const
@@ -112,15 +112,17 @@ bool DragData::containsCompatibleContent() const
return containsColor() || containsURL() || m_platformDragData->hasHtml() || m_platformDragData->hasText();
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
+ // FIXME: Use filenamePolicy.
if (!m_platformDragData)
return false;
return m_platformDragData->hasUrls();
}
-String DragData::asURL(String*) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String*) const
{
+ // FIXME: Use filenamePolicy.
if (!m_platformDragData)
return String();
QList<QUrl> urls = m_platformDragData->urls();
diff --git a/WebCore/platform/qt/FileChooserQt.cpp b/WebCore/platform/qt/FileChooserQt.cpp
index 307876c..8b1df0a 100644
--- a/WebCore/platform/qt/FileChooserQt.cpp
+++ b/WebCore/platform/qt/FileChooserQt.cpp
@@ -21,8 +21,8 @@
#include "config.h"
#include "FileChooser.h"
-#include "LocalizedStrings.h"
#include "Font.h"
+#include "LocalizedStrings.h"
#include <QCoreApplication>
#include <QFontMetrics>
diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp
index e42ca67..03dfc8f 100644
--- a/WebCore/platform/qt/FileSystemQt.cpp
+++ b/WebCore/platform/qt/FileSystemQt.cpp
@@ -9,13 +9,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -33,14 +33,12 @@
#include "FileSystem.h"
#include "PlatformString.h"
-#include <wtf/text/CString.h>
-
#include <QDateTime>
+#include <QDir>
#include <QFile>
-#include <QTemporaryFile>
#include <QFileInfo>
-#include <QDateTime>
-#include <QDir>
+#include <QTemporaryFile>
+#include <wtf/text/CString.h>
namespace WebCore {
diff --git a/WebCore/platform/qt/GeolocationServiceQt.cpp b/WebCore/platform/qt/GeolocationServiceQt.cpp
new file mode 100644
index 0000000..e24d497
--- /dev/null
+++ b/WebCore/platform/qt/GeolocationServiceQt.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GeolocationServiceQt.h"
+
+#include "Geolocation.h"
+#include "Geoposition.h"
+#include "PositionError.h"
+#include "PositionOptions.h"
+
+using namespace QtMobility;
+
+namespace WebCore {
+
+GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &GeolocationServiceQt::create;
+
+GeolocationService* GeolocationServiceQt::create(GeolocationServiceClient* client)
+{
+ return new GeolocationServiceQt(client);
+}
+
+GeolocationServiceQt::GeolocationServiceQt(GeolocationServiceClient* client)
+ : GeolocationService(client)
+ , m_lastPosition(0)
+ , m_lastError(0)
+{
+ m_location = QGeoPositionInfoSource::createDefaultSource(this);
+
+ if (m_location)
+ connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
+}
+
+GeolocationServiceQt::~GeolocationServiceQt()
+{
+}
+
+void GeolocationServiceQt::positionUpdated(const QGeoPositionInfo &geoPosition)
+{
+ if (!geoPosition.isValid())
+ errorOccurred();
+
+ QGeoCoordinate coord = geoPosition.coordinate();
+ double latitude = coord.latitude();
+ double longitude = coord.longitude();
+ bool providesAltitude = true;
+ double altitude = coord.altitude();
+
+ double accuracy = geoPosition.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) ?
+ geoPosition.attribute(QGeoPositionInfo::HorizontalAccuracy) : 0.0;
+
+ bool providesAltitudeAccuracy = geoPosition.hasAttribute(QGeoPositionInfo::VerticalAccuracy);
+ double altitudeAccuracy = providesAltitudeAccuracy ? geoPosition.attribute(QGeoPositionInfo::VerticalAccuracy) : 0.0;
+
+ bool providesHeading = geoPosition.hasAttribute(QGeoPositionInfo::Direction);
+ double heading = providesHeading ? geoPosition.attribute(QGeoPositionInfo::Direction) : 0.0;
+
+ bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed);
+ double speed = providesSpeed ? geoPosition.attribute(QGeoPositionInfo::GroundSpeed) : 0.0;
+
+ RefPtr<Coordinates> coordinates = Coordinates::create(latitude, longitude, providesAltitude, altitude,
+ accuracy, providesAltitudeAccuracy, altitudeAccuracy,
+ providesHeading, heading, providesSpeed, speed);
+ m_lastPosition = Geoposition::create(coordinates.release(), geoPosition.timestamp().toTime_t());
+ positionChanged();
+}
+
+bool GeolocationServiceQt::startUpdating(PositionOptions*)
+{
+ m_lastPosition = 0;
+
+ if (!m_location)
+ return false;
+
+ // TODO: handle enableHighAccuracy()
+
+ m_location->startUpdates();
+ return true;
+}
+
+void GeolocationServiceQt::stopUpdating()
+{
+ if (m_location)
+ m_location->stopUpdates();
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/GeolocationServiceQt.h b/WebCore/platform/qt/GeolocationServiceQt.h
new file mode 100644
index 0000000..2525e47
--- /dev/null
+++ b/WebCore/platform/qt/GeolocationServiceQt.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GeolocationServiceQt_h
+#define GeolocationServiceQt_h
+
+#include "GeolocationService.h"
+#include <QGeoPositionInfoSource>
+#include <wtf/RefPtr.h>
+
+// FIXME: Remove usage of "using namespace" in a header file.
+// There is bug in qtMobility signal names are not full qualified when used with namespace
+// QtMobility namespace in slots throws up error and its required to be fixed in qtmobility.
+using namespace QtMobility;
+
+namespace WebCore {
+
+// This class provides a implementation of a GeolocationService for qtWebkit.
+// It uses QtMobility (v1.0.0) location service to get positions
+class GeolocationServiceQt : public QObject, GeolocationService {
+ Q_OBJECT
+
+public:
+ static GeolocationService* create(GeolocationServiceClient*);
+
+ GeolocationServiceQt(GeolocationServiceClient*);
+ virtual ~GeolocationServiceQt();
+
+ virtual bool startUpdating(PositionOptions*);
+ virtual void stopUpdating();
+
+ virtual Geoposition* lastPosition() const { return m_lastPosition.get(); }
+ virtual PositionError* lastError() const { return m_lastError.get(); }
+
+public Q_SLOTS:
+ // QGeoPositionInfoSource
+ void positionUpdated(const QGeoPositionInfo&);
+
+private:
+ RefPtr<Geoposition> m_lastPosition;
+ RefPtr<PositionError> m_lastError;
+
+ QtMobility::QGeoPositionInfoSource* m_location;
+};
+
+} // namespace WebCore
+
+#endif // GeolocationServiceQt_h
diff --git a/WebCore/platform/qt/KURLQt.cpp b/WebCore/platform/qt/KURLQt.cpp
index ea1a795..f6d2a86 100644
--- a/WebCore/platform/qt/KURLQt.cpp
+++ b/WebCore/platform/qt/KURLQt.cpp
@@ -19,11 +19,11 @@
*/
#include "config.h"
#include "KURL.h"
-#include "TextEncoding.h"
-#include <wtf/text/CString.h>
#include "NotImplemented.h"
+#include "TextEncoding.h"
#include "qurl.h"
+#include <wtf/text/CString.h>
namespace WebCore {
diff --git a/WebCore/platform/qt/Localizations.cpp b/WebCore/platform/qt/Localizations.cpp
index 8fdd666..454872a 100644
--- a/WebCore/platform/qt/Localizations.cpp
+++ b/WebCore/platform/qt/Localizations.cpp
@@ -27,15 +27,15 @@
*/
#include "config.h"
+#include "LocalizedStrings.h"
#include "IntSize.h"
-#include "LocalizedStrings.h"
#include "NotImplemented.h"
#include "PlatformString.h"
-#include <wtf/MathExtras.h>
-
#include <QCoreApplication>
#include <QLocale>
+#include <wtf/MathExtras.h>
+
namespace WebCore {
@@ -350,7 +350,7 @@ String AXMenuListActionVerb()
{
return String();
}
-
+
String missingPluginText()
{
return QCoreApplication::translate("QWebPage", "Missing Plug-in", "Label text to be used when a plug-in is missing");
@@ -477,21 +477,18 @@ String localizedMediaTimeDescription(float time)
int minutes = (seconds / 60) % 60;
seconds %= 60;
- if (days) {
+ if (days)
return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
- }
- if (hours) {
+ if (hours)
return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
- }
- if (minutes) {
+ if (minutes)
return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
- }
return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds);
}
-#endif // ENABLE(VIDEO)
+#endif // ENABLE(VIDEO)
String validationMessageValueMissingText()
{
diff --git a/WebCore/platform/qt/LoggingQt.cpp b/WebCore/platform/qt/LoggingQt.cpp
index 2854953..817887d 100644
--- a/WebCore/platform/qt/LoggingQt.cpp
+++ b/WebCore/platform/qt/LoggingQt.cpp
@@ -19,8 +19,8 @@
#include "config.h"
#include "Logging.h"
-#include "PlatformString.h"
+#include "PlatformString.h"
#include <QDebug>
#include <QStringList>
diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp
index 484fa60..86d2cfe 100644
--- a/WebCore/platform/qt/PasteboardQt.cpp
+++ b/WebCore/platform/qt/PasteboardQt.cpp
@@ -162,8 +162,8 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String&)
ASSERT(image);
QPixmap* pixmap = image->nativeImageForCurrentFrame();
- ASSERT(pixmap);
-
+ if (!pixmap)
+ return;
QApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard);
#endif
}
diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
index 56fec70..58ab2bf 100644
--- a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
+++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -31,110 +31,109 @@
#include "NotImplemented.h"
#include "WindowsKeyboardCodes.h"
-#include <ctype.h>
-
#include <QKeyEvent>
+#include <ctype.h>
namespace WebCore {
static String keyIdentifierForQtKeyCode(int keyCode)
{
switch (keyCode) {
- case Qt::Key_Menu:
- case Qt::Key_Alt:
- return "Alt";
- case Qt::Key_Clear:
- return "Clear";
- case Qt::Key_Down:
- return "Down";
- case Qt::Key_End:
- return "End";
- case Qt::Key_Return:
- case Qt::Key_Enter:
- return "Enter";
- case Qt::Key_Execute:
- return "Execute";
- case Qt::Key_F1:
- return "F1";
- case Qt::Key_F2:
- return "F2";
- case Qt::Key_F3:
- return "F3";
- case Qt::Key_F4:
- return "F4";
- case Qt::Key_F5:
- return "F5";
- case Qt::Key_F6:
- return "F6";
- case Qt::Key_F7:
- return "F7";
- case Qt::Key_F8:
- return "F8";
- case Qt::Key_F9:
- return "F9";
- case Qt::Key_F10:
- return "F10";
- case Qt::Key_F11:
- return "F11";
- case Qt::Key_F12:
- return "F12";
- case Qt::Key_F13:
- return "F13";
- case Qt::Key_F14:
- return "F14";
- case Qt::Key_F15:
- return "F15";
- case Qt::Key_F16:
- return "F16";
- case Qt::Key_F17:
- return "F17";
- case Qt::Key_F18:
- return "F18";
- case Qt::Key_F19:
- return "F19";
- case Qt::Key_F20:
- return "F20";
- case Qt::Key_F21:
- return "F21";
- case Qt::Key_F22:
- return "F22";
- case Qt::Key_F23:
- return "F23";
- case Qt::Key_F24:
- return "F24";
- case Qt::Key_Help:
- return "Help";
- case Qt::Key_Home:
- return "Home";
- case Qt::Key_Insert:
- return "Insert";
- case Qt::Key_Left:
- return "Left";
- case Qt::Key_PageDown:
- return "PageDown";
- case Qt::Key_PageUp:
- return "PageUp";
- case Qt::Key_Pause:
- return "Pause";
- case Qt::Key_Print:
- return "PrintScreen";
- case Qt::Key_Right:
- return "Right";
- case Qt::Key_Select:
- return "Select";
- case Qt::Key_Up:
- return "Up";
- // Standard says that DEL becomes U+007F.
- case Qt::Key_Delete:
- return "U+007F";
- case Qt::Key_Backspace:
- return "U+0008";
- case Qt::Key_Tab:
- return "U+0009";
- case Qt::Key_Backtab:
- return "U+0009";
- default:
- return String::format("U+%04X", toupper(keyCode));
+ case Qt::Key_Menu:
+ case Qt::Key_Alt:
+ return "Alt";
+ case Qt::Key_Clear:
+ return "Clear";
+ case Qt::Key_Down:
+ return "Down";
+ case Qt::Key_End:
+ return "End";
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ return "Enter";
+ case Qt::Key_Execute:
+ return "Execute";
+ case Qt::Key_F1:
+ return "F1";
+ case Qt::Key_F2:
+ return "F2";
+ case Qt::Key_F3:
+ return "F3";
+ case Qt::Key_F4:
+ return "F4";
+ case Qt::Key_F5:
+ return "F5";
+ case Qt::Key_F6:
+ return "F6";
+ case Qt::Key_F7:
+ return "F7";
+ case Qt::Key_F8:
+ return "F8";
+ case Qt::Key_F9:
+ return "F9";
+ case Qt::Key_F10:
+ return "F10";
+ case Qt::Key_F11:
+ return "F11";
+ case Qt::Key_F12:
+ return "F12";
+ case Qt::Key_F13:
+ return "F13";
+ case Qt::Key_F14:
+ return "F14";
+ case Qt::Key_F15:
+ return "F15";
+ case Qt::Key_F16:
+ return "F16";
+ case Qt::Key_F17:
+ return "F17";
+ case Qt::Key_F18:
+ return "F18";
+ case Qt::Key_F19:
+ return "F19";
+ case Qt::Key_F20:
+ return "F20";
+ case Qt::Key_F21:
+ return "F21";
+ case Qt::Key_F22:
+ return "F22";
+ case Qt::Key_F23:
+ return "F23";
+ case Qt::Key_F24:
+ return "F24";
+ case Qt::Key_Help:
+ return "Help";
+ case Qt::Key_Home:
+ return "Home";
+ case Qt::Key_Insert:
+ return "Insert";
+ case Qt::Key_Left:
+ return "Left";
+ case Qt::Key_PageDown:
+ return "PageDown";
+ case Qt::Key_PageUp:
+ return "PageUp";
+ case Qt::Key_Pause:
+ return "Pause";
+ case Qt::Key_Print:
+ return "PrintScreen";
+ case Qt::Key_Right:
+ return "Right";
+ case Qt::Key_Select:
+ return "Select";
+ case Qt::Key_Up:
+ return "Up";
+ // Standard says that DEL becomes U+007F.
+ case Qt::Key_Delete:
+ return "U+007F";
+ case Qt::Key_Backspace:
+ return "U+0008";
+ case Qt::Key_Tab:
+ return "U+0009";
+ case Qt::Key_Backtab:
+ return "U+0009";
+ default:
+ return String::format("U+%04X", toupper(keyCode));
}
}
@@ -144,35 +143,35 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false
if (isKeypad) {
switch (keycode) {
case Qt::Key_0:
- return VK_NUMPAD0; // (60) Numeric keypad 0 key
+ return VK_NUMPAD0; // (60) Numeric keypad 0 key
case Qt::Key_1:
- return VK_NUMPAD1; // (61) Numeric keypad 1 key
+ return VK_NUMPAD1; // (61) Numeric keypad 1 key
case Qt::Key_2:
return VK_NUMPAD2; // (62) Numeric keypad 2 key
case Qt::Key_3:
- return VK_NUMPAD3; // (63) Numeric keypad 3 key
+ return VK_NUMPAD3; // (63) Numeric keypad 3 key
case Qt::Key_4:
- return VK_NUMPAD4; // (64) Numeric keypad 4 key
+ return VK_NUMPAD4; // (64) Numeric keypad 4 key
case Qt::Key_5:
- return VK_NUMPAD5; // (65) Numeric keypad 5 key
+ return VK_NUMPAD5; // (65) Numeric keypad 5 key
case Qt::Key_6:
- return VK_NUMPAD6; // (66) Numeric keypad 6 key
+ return VK_NUMPAD6; // (66) Numeric keypad 6 key
case Qt::Key_7:
- return VK_NUMPAD7; // (67) Numeric keypad 7 key
+ return VK_NUMPAD7; // (67) Numeric keypad 7 key
case Qt::Key_8:
- return VK_NUMPAD8; // (68) Numeric keypad 8 key
+ return VK_NUMPAD8; // (68) Numeric keypad 8 key
case Qt::Key_9:
- return VK_NUMPAD9; // (69) Numeric keypad 9 key
+ return VK_NUMPAD9; // (69) Numeric keypad 9 key
case Qt::Key_Asterisk:
return VK_MULTIPLY; // (6A) Multiply key
case Qt::Key_Plus:
- return VK_ADD; // (6B) Add key
+ return VK_ADD; // (6B) Add key
case Qt::Key_Minus:
return VK_SUBTRACT; // (6D) Subtract key
case Qt::Key_Period:
- return VK_DECIMAL; // (6E) Decimal key
+ return VK_DECIMAL; // (6E) Decimal key
case Qt::Key_Slash:
- return VK_DIVIDE; // (6F) Divide key
+ return VK_DIVIDE; // (6F) Divide key
case Qt::Key_PageUp:
return VK_PRIOR; // (21) PAGE UP key
case Qt::Key_PageDown:
@@ -196,311 +195,310 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false
} else
switch (keycode) {
- case Qt::Key_Backspace:
- return VK_BACK; // (08) BACKSPACE key
- case Qt::Key_Backtab:
- case Qt::Key_Tab:
- return VK_TAB; // (09) TAB key
- case Qt::Key_Clear:
- return VK_CLEAR; // (0C) CLEAR key
- case Qt::Key_Enter:
- case Qt::Key_Return:
- return VK_RETURN; //(0D) Return key
- case Qt::Key_Shift:
- return VK_SHIFT; // (10) SHIFT key
- case Qt::Key_Control:
- return VK_CONTROL; // (11) CTRL key
- case Qt::Key_Menu:
- case Qt::Key_Alt:
- return VK_MENU; // (12) ALT key
+ case Qt::Key_Backspace:
+ return VK_BACK; // (08) BACKSPACE key
+ case Qt::Key_Backtab:
+ case Qt::Key_Tab:
+ return VK_TAB; // (09) TAB key
+ case Qt::Key_Clear:
+ return VK_CLEAR; // (0C) CLEAR key
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ return VK_RETURN; // (0D) Return key
+ case Qt::Key_Shift:
+ return VK_SHIFT; // (10) SHIFT key
+ case Qt::Key_Control:
+ return VK_CONTROL; // (11) CTRL key
+ case Qt::Key_Menu:
+ case Qt::Key_Alt:
+ return VK_MENU; // (12) ALT key
- case Qt::Key_F1:
- return VK_F1;
- case Qt::Key_F2:
- return VK_F2;
- case Qt::Key_F3:
- return VK_F3;
- case Qt::Key_F4:
- return VK_F4;
- case Qt::Key_F5:
- return VK_F5;
- case Qt::Key_F6:
- return VK_F6;
- case Qt::Key_F7:
- return VK_F7;
- case Qt::Key_F8:
- return VK_F8;
- case Qt::Key_F9:
- return VK_F9;
- case Qt::Key_F10:
- return VK_F10;
- case Qt::Key_F11:
- return VK_F11;
- case Qt::Key_F12:
- return VK_F12;
- case Qt::Key_F13:
- return VK_F13;
- case Qt::Key_F14:
- return VK_F14;
- case Qt::Key_F15:
- return VK_F15;
- case Qt::Key_F16:
- return VK_F16;
- case Qt::Key_F17:
- return VK_F17;
- case Qt::Key_F18:
- return VK_F18;
- case Qt::Key_F19:
- return VK_F19;
- case Qt::Key_F20:
- return VK_F20;
- case Qt::Key_F21:
- return VK_F21;
- case Qt::Key_F22:
- return VK_F22;
- case Qt::Key_F23:
- return VK_F23;
- case Qt::Key_F24:
- return VK_F24;
+ case Qt::Key_F1:
+ return VK_F1;
+ case Qt::Key_F2:
+ return VK_F2;
+ case Qt::Key_F3:
+ return VK_F3;
+ case Qt::Key_F4:
+ return VK_F4;
+ case Qt::Key_F5:
+ return VK_F5;
+ case Qt::Key_F6:
+ return VK_F6;
+ case Qt::Key_F7:
+ return VK_F7;
+ case Qt::Key_F8:
+ return VK_F8;
+ case Qt::Key_F9:
+ return VK_F9;
+ case Qt::Key_F10:
+ return VK_F10;
+ case Qt::Key_F11:
+ return VK_F11;
+ case Qt::Key_F12:
+ return VK_F12;
+ case Qt::Key_F13:
+ return VK_F13;
+ case Qt::Key_F14:
+ return VK_F14;
+ case Qt::Key_F15:
+ return VK_F15;
+ case Qt::Key_F16:
+ return VK_F16;
+ case Qt::Key_F17:
+ return VK_F17;
+ case Qt::Key_F18:
+ return VK_F18;
+ case Qt::Key_F19:
+ return VK_F19;
+ case Qt::Key_F20:
+ return VK_F20;
+ case Qt::Key_F21:
+ return VK_F21;
+ case Qt::Key_F22:
+ return VK_F22;
+ case Qt::Key_F23:
+ return VK_F23;
+ case Qt::Key_F24:
+ return VK_F24;
- case Qt::Key_Pause:
- return VK_PAUSE; // (13) PAUSE key
- case Qt::Key_CapsLock:
- return VK_CAPITAL; // (14) CAPS LOCK key
- case Qt::Key_Kana_Lock:
- case Qt::Key_Kana_Shift:
- return VK_KANA; // (15) Input Method Editor (IME) Kana mode
- case Qt::Key_Hangul:
- return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode
- // VK_JUNJA (17) IME Junja mode
- // VK_FINAL (18) IME final mode
- case Qt::Key_Hangul_Hanja:
- return VK_HANJA; // (19) IME Hanja mode
- case Qt::Key_Kanji:
- return VK_KANJI; // (19) IME Kanji mode
- case Qt::Key_Escape:
- return VK_ESCAPE; // (1B) ESC key
- // VK_CONVERT (1C) IME convert
- // VK_NONCONVERT (1D) IME nonconvert
- // VK_ACCEPT (1E) IME accept
- // VK_MODECHANGE (1F) IME mode change request
- case Qt::Key_Space:
- return VK_SPACE; // (20) SPACEBAR
- case Qt::Key_PageUp:
- return VK_PRIOR; // (21) PAGE UP key
- case Qt::Key_PageDown:
- return VK_NEXT; // (22) PAGE DOWN key
- case Qt::Key_End:
- return VK_END; // (23) END key
- case Qt::Key_Home:
- return VK_HOME; // (24) HOME key
- case Qt::Key_Left:
- return VK_LEFT; // (25) LEFT ARROW key
- case Qt::Key_Up:
- return VK_UP; // (26) UP ARROW key
- case Qt::Key_Right:
- return VK_RIGHT; // (27) RIGHT ARROW key
- case Qt::Key_Down:
- return VK_DOWN; // (28) DOWN ARROW key
- case Qt::Key_Select:
- return VK_SELECT; // (29) SELECT key
- case Qt::Key_Print:
- return VK_PRINT; // (2A) PRINT key
- case Qt::Key_Execute:
- return VK_EXECUTE;// (2B) EXECUTE key
- //dunno on this
- //case Qt::Key_PrintScreen:
- // return VK_SNAPSHOT; // (2C) PRINT SCREEN key
- case Qt::Key_Insert:
- return VK_INSERT; // (2D) INS key
- case Qt::Key_Delete:
- return VK_DELETE; // (2E) DEL key
- case Qt::Key_Help:
- return VK_HELP; // (2F) HELP key
- case Qt::Key_0:
- case Qt::Key_ParenLeft:
- return VK_0; // (30) 0) key
- case Qt::Key_1:
- return VK_1; // (31) 1 ! key
- case Qt::Key_2:
- case Qt::Key_At:
- return VK_2; // (32) 2 & key
- case Qt::Key_3:
- case Qt::Key_NumberSign:
- return VK_3; //case '3': case '#';
- case Qt::Key_4:
- case Qt::Key_Dollar: // (34) 4 key '$';
- return VK_4;
- case Qt::Key_5:
- case Qt::Key_Percent:
- return VK_5; // (35) 5 key '%'
- case Qt::Key_6:
- case Qt::Key_AsciiCircum:
- return VK_6; // (36) 6 key '^'
- case Qt::Key_7:
- case Qt::Key_Ampersand:
- return VK_7; // (37) 7 key case '&'
- case Qt::Key_8:
- case Qt::Key_Asterisk:
- return VK_8; // (38) 8 key '*'
- case Qt::Key_9:
- case Qt::Key_ParenRight:
- return VK_9; // (39) 9 key '('
- case Qt::Key_A:
- return VK_A; // (41) A key case 'a': case 'A': return 0x41;
- case Qt::Key_B:
- return VK_B; // (42) B key case 'b': case 'B': return 0x42;
- case Qt::Key_C:
- return VK_C; // (43) C key case 'c': case 'C': return 0x43;
- case Qt::Key_D:
- return VK_D; // (44) D key case 'd': case 'D': return 0x44;
- case Qt::Key_E:
- return VK_E; // (45) E key case 'e': case 'E': return 0x45;
- case Qt::Key_F:
- return VK_F; // (46) F key case 'f': case 'F': return 0x46;
- case Qt::Key_G:
- return VK_G; // (47) G key case 'g': case 'G': return 0x47;
- case Qt::Key_H:
- return VK_H; // (48) H key case 'h': case 'H': return 0x48;
- case Qt::Key_I:
- return VK_I; // (49) I key case 'i': case 'I': return 0x49;
- case Qt::Key_J:
- return VK_J; // (4A) J key case 'j': case 'J': return 0x4A;
- case Qt::Key_K:
- return VK_K; // (4B) K key case 'k': case 'K': return 0x4B;
- case Qt::Key_L:
- return VK_L; // (4C) L key case 'l': case 'L': return 0x4C;
- case Qt::Key_M:
- return VK_M; // (4D) M key case 'm': case 'M': return 0x4D;
- case Qt::Key_N:
- return VK_N; // (4E) N key case 'n': case 'N': return 0x4E;
- case Qt::Key_O:
- return VK_O; // (4F) O key case 'o': case 'O': return 0x4F;
- case Qt::Key_P:
- return VK_P; // (50) P key case 'p': case 'P': return 0x50;
- case Qt::Key_Q:
- return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51;
- case Qt::Key_R:
- return VK_R; // (52) R key case 'r': case 'R': return 0x52;
- case Qt::Key_S:
- return VK_S; // (53) S key case 's': case 'S': return 0x53;
- case Qt::Key_T:
- return VK_T; // (54) T key case 't': case 'T': return 0x54;
- case Qt::Key_U:
- return VK_U; // (55) U key case 'u': case 'U': return 0x55;
- case Qt::Key_V:
- return VK_V; // (56) V key case 'v': case 'V': return 0x56;
- case Qt::Key_W:
- return VK_W; // (57) W key case 'w': case 'W': return 0x57;
- case Qt::Key_X:
- return VK_X; // (58) X key case 'x': case 'X': return 0x58;
- case Qt::Key_Y:
- return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59;
- case Qt::Key_Z:
- return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
- case Qt::Key_Meta:
- return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
- //case Qt::Key_Meta_R: FIXME: What to do here?
+ case Qt::Key_Pause:
+ return VK_PAUSE; // (13) PAUSE key
+ case Qt::Key_CapsLock:
+ return VK_CAPITAL; // (14) CAPS LOCK key
+ case Qt::Key_Kana_Lock:
+ case Qt::Key_Kana_Shift:
+ return VK_KANA; // (15) Input Method Editor (IME) Kana mode
+ case Qt::Key_Hangul:
+ return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode
+ // VK_JUNJA (17) IME Junja mode
+ // VK_FINAL (18) IME final mode
+ case Qt::Key_Hangul_Hanja:
+ return VK_HANJA; // (19) IME Hanja mode
+ case Qt::Key_Kanji:
+ return VK_KANJI; // (19) IME Kanji mode
+ case Qt::Key_Escape:
+ return VK_ESCAPE; // (1B) ESC key
+ // VK_CONVERT (1C) IME convert
+ // VK_NONCONVERT (1D) IME nonconvert
+ // VK_ACCEPT (1E) IME accept
+ // VK_MODECHANGE (1F) IME mode change request
+ case Qt::Key_Space:
+ return VK_SPACE; // (20) SPACEBAR
+ case Qt::Key_PageUp:
+ return VK_PRIOR; // (21) PAGE UP key
+ case Qt::Key_PageDown:
+ return VK_NEXT; // (22) PAGE DOWN key
+ case Qt::Key_End:
+ return VK_END; // (23) END key
+ case Qt::Key_Home:
+ return VK_HOME; // (24) HOME key
+ case Qt::Key_Left:
+ return VK_LEFT; // (25) LEFT ARROW key
+ case Qt::Key_Up:
+ return VK_UP; // (26) UP ARROW key
+ case Qt::Key_Right:
+ return VK_RIGHT; // (27) RIGHT ARROW key
+ case Qt::Key_Down:
+ return VK_DOWN; // (28) DOWN ARROW key
+ case Qt::Key_Select:
+ return VK_SELECT; // (29) SELECT key
+ case Qt::Key_Print:
+ return VK_PRINT; // (2A) PRINT key
+ case Qt::Key_Execute:
+ return VK_EXECUTE; // (2B) EXECUTE key
+ // dunno on this
+ // case Qt::Key_PrintScreen:
+ // return VK_SNAPSHOT; // (2C) PRINT SCREEN key
+ case Qt::Key_Insert:
+ return VK_INSERT; // (2D) INS key
+ case Qt::Key_Delete:
+ return VK_DELETE; // (2E) DEL key
+ case Qt::Key_Help:
+ return VK_HELP; // (2F) HELP key
+ case Qt::Key_0:
+ case Qt::Key_ParenLeft:
+ return VK_0; // (30) 0) key
+ case Qt::Key_1:
+ return VK_1; // (31) 1 ! key
+ case Qt::Key_2:
+ case Qt::Key_At:
+ return VK_2; // (32) 2 & key
+ case Qt::Key_3:
+ case Qt::Key_NumberSign:
+ return VK_3; // case '3': case '#';
+ case Qt::Key_4:
+ case Qt::Key_Dollar: // (34) 4 key '$';
+ return VK_4;
+ case Qt::Key_5:
+ case Qt::Key_Percent:
+ return VK_5; // (35) 5 key '%'
+ case Qt::Key_6:
+ case Qt::Key_AsciiCircum:
+ return VK_6; // (36) 6 key '^'
+ case Qt::Key_7:
+ case Qt::Key_Ampersand:
+ return VK_7; // (37) 7 key case '&'
+ case Qt::Key_8:
+ case Qt::Key_Asterisk:
+ return VK_8; // (38) 8 key '*'
+ case Qt::Key_9:
+ case Qt::Key_ParenRight:
+ return VK_9; // (39) 9 key '('
+ case Qt::Key_A:
+ return VK_A; // (41) A key case 'a': case 'A': return 0x41;
+ case Qt::Key_B:
+ return VK_B; // (42) B key case 'b': case 'B': return 0x42;
+ case Qt::Key_C:
+ return VK_C; // (43) C key case 'c': case 'C': return 0x43;
+ case Qt::Key_D:
+ return VK_D; // (44) D key case 'd': case 'D': return 0x44;
+ case Qt::Key_E:
+ return VK_E; // (45) E key case 'e': case 'E': return 0x45;
+ case Qt::Key_F:
+ return VK_F; // (46) F key case 'f': case 'F': return 0x46;
+ case Qt::Key_G:
+ return VK_G; // (47) G key case 'g': case 'G': return 0x47;
+ case Qt::Key_H:
+ return VK_H; // (48) H key case 'h': case 'H': return 0x48;
+ case Qt::Key_I:
+ return VK_I; // (49) I key case 'i': case 'I': return 0x49;
+ case Qt::Key_J:
+ return VK_J; // (4A) J key case 'j': case 'J': return 0x4A;
+ case Qt::Key_K:
+ return VK_K; // (4B) K key case 'k': case 'K': return 0x4B;
+ case Qt::Key_L:
+ return VK_L; // (4C) L key case 'l': case 'L': return 0x4C;
+ case Qt::Key_M:
+ return VK_M; // (4D) M key case 'm': case 'M': return 0x4D;
+ case Qt::Key_N:
+ return VK_N; // (4E) N key case 'n': case 'N': return 0x4E;
+ case Qt::Key_O:
+ return VK_O; // (4F) O key case 'o': case 'O': return 0x4F;
+ case Qt::Key_P:
+ return VK_P; // (50) P key case 'p': case 'P': return 0x50;
+ case Qt::Key_Q:
+ return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51;
+ case Qt::Key_R:
+ return VK_R; // (52) R key case 'r': case 'R': return 0x52;
+ case Qt::Key_S:
+ return VK_S; // (53) S key case 's': case 'S': return 0x53;
+ case Qt::Key_T:
+ return VK_T; // (54) T key case 't': case 'T': return 0x54;
+ case Qt::Key_U:
+ return VK_U; // (55) U key case 'u': case 'U': return 0x55;
+ case Qt::Key_V:
+ return VK_V; // (56) V key case 'v': case 'V': return 0x56;
+ case Qt::Key_W:
+ return VK_W; // (57) W key case 'w': case 'W': return 0x57;
+ case Qt::Key_X:
+ return VK_X; // (58) X key case 'x': case 'X': return 0x58;
+ case Qt::Key_Y:
+ return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59;
+ case Qt::Key_Z:
+ return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
+ case Qt::Key_Meta:
+ return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
+ // case Qt::Key_Meta_R: FIXME: What to do here?
// return VK_RWIN; // (5C) Right Windows key (Natural keyboard)
- // VK_APPS (5D) Applications key (Natural keyboard)
- // VK_SLEEP (5F) Computer Sleep key
- // VK_SEPARATOR (6C) Separator key
- // VK_SUBTRACT (6D) Subtract key
- // VK_DECIMAL (6E) Decimal key
- // VK_DIVIDE (6F) Divide key
- // handled by key code above
+ // VK_APPS (5D) Applications key (Natural keyboard)
+ // VK_SLEEP (5F) Computer Sleep key
+ // VK_SEPARATOR (6C) Separator key
+ // VK_SUBTRACT (6D) Subtract key
+ // VK_DECIMAL (6E) Decimal key
+ // VK_DIVIDE (6F) Divide key
+ // handled by key code above
- case Qt::Key_NumLock:
- return VK_NUMLOCK; // (90) NUM LOCK key
+ case Qt::Key_NumLock:
+ return VK_NUMLOCK; // (90) NUM LOCK key
- case Qt::Key_ScrollLock:
- return VK_SCROLL; // (91) SCROLL LOCK key
+ case Qt::Key_ScrollLock:
+ return VK_SCROLL; // (91) SCROLL LOCK key
- // VK_LSHIFT (A0) Left SHIFT key
- // VK_RSHIFT (A1) Right SHIFT key
- // VK_LCONTROL (A2) Left CONTROL key
- // VK_RCONTROL (A3) Right CONTROL key
- // VK_LMENU (A4) Left MENU key
- // VK_RMENU (A5) Right MENU key
- // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
- // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
- // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
- // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
- // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
- // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
- // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
- // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
- // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
- // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
- // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
- // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
- // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
- // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
- // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
- // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
- // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
- // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
+ // VK_LSHIFT (A0) Left SHIFT key
+ // VK_RSHIFT (A1) Right SHIFT key
+ // VK_LCONTROL (A2) Left CONTROL key
+ // VK_RCONTROL (A3) Right CONTROL key
+ // VK_LMENU (A4) Left MENU key
+ // VK_RMENU (A5) Right MENU key
+ // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
+ // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
+ // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
+ // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
+ // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
+ // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
+ // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
+ // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
+ // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
+ // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
+ // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
+ // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
+ // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
+ // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
+ // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
+ // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
+ // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
+ // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
- // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
- case Qt::Key_Semicolon:
- case Qt::Key_Colon:
- return VK_OEM_1; //case ';': case ':': return 0xBA;
- // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
- case Qt::Key_Plus:
- case Qt::Key_Equal:
- return VK_OEM_PLUS; //case '=': case '+': return 0xBB;
- // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
- case Qt::Key_Comma:
- case Qt::Key_Less:
- return VK_OEM_COMMA; //case ',': case '<': return 0xBC;
- // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
- case Qt::Key_Minus:
- case Qt::Key_Underscore:
- return VK_OEM_MINUS; //case '-': case '_': return 0xBD;
- // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
- case Qt::Key_Period:
- case Qt::Key_Greater:
- return VK_OEM_PERIOD; //case '.': case '>': return 0xBE;
- // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
- case Qt::Key_Slash:
- case Qt::Key_Question:
- return VK_OEM_2; //case '/': case '?': return 0xBF;
- // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
- case Qt::Key_AsciiTilde:
- case Qt::Key_QuoteLeft:
- return VK_OEM_3; //case '`': case '~': return 0xC0;
- // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
- case Qt::Key_BracketLeft:
- case Qt::Key_BraceLeft:
- return VK_OEM_4; //case '[': case '{': return 0xDB;
- // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
- case Qt::Key_Backslash:
- case Qt::Key_Bar:
- return VK_OEM_5; //case '\\': case '|': return 0xDC;
- // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
- case Qt::Key_BracketRight:
- case Qt::Key_BraceRight:
- return VK_OEM_6; // case ']': case '}': return 0xDD;
- // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
- case Qt::Key_QuoteDbl:
- return VK_OEM_7; // case '\'': case '"': return 0xDE;
- // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
- // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
- // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
- // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
- // VK_ATTN (F6) Attn key
- // VK_CRSEL (F7) CrSel key
- // VK_EXSEL (F8) ExSel key
- // VK_EREOF (F9) Erase EOF key
- // VK_PLAY (FA) Play key
- // VK_ZOOM (FB) Zoom key
- // VK_NONAME (FC) Reserved for future use
- // VK_PA1 (FD) PA1 key
- // VK_OEM_CLEAR (FE) Clear key
- default:
- return 0;
+ // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
+ case Qt::Key_Semicolon:
+ case Qt::Key_Colon:
+ return VK_OEM_1; // case ';': case ':': return 0xBA;
+ // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
+ case Qt::Key_Plus:
+ case Qt::Key_Equal:
+ return VK_OEM_PLUS; // case '=': case '+': return 0xBB;
+ // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
+ case Qt::Key_Comma:
+ case Qt::Key_Less:
+ return VK_OEM_COMMA; // case ',': case '<': return 0xBC;
+ // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
+ case Qt::Key_Minus:
+ case Qt::Key_Underscore:
+ return VK_OEM_MINUS; // case '-': case '_': return 0xBD;
+ // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
+ case Qt::Key_Period:
+ case Qt::Key_Greater:
+ return VK_OEM_PERIOD; // case '.': case '>': return 0xBE;
+ // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
+ case Qt::Key_Slash:
+ case Qt::Key_Question:
+ return VK_OEM_2; // case '/': case '?': return 0xBF;
+ // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
+ case Qt::Key_AsciiTilde:
+ case Qt::Key_QuoteLeft:
+ return VK_OEM_3; // case '`': case '~': return 0xC0;
+ // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
+ case Qt::Key_BracketLeft:
+ case Qt::Key_BraceLeft:
+ return VK_OEM_4; // case '[': case '{': return 0xDB;
+ // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
+ case Qt::Key_Backslash:
+ case Qt::Key_Bar:
+ return VK_OEM_5; // case '\\': case '|': return 0xDC;
+ // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
+ case Qt::Key_BracketRight:
+ case Qt::Key_BraceRight:
+ return VK_OEM_6; // case ']': case '}': return 0xDD;
+ // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
+ case Qt::Key_QuoteDbl:
+ return VK_OEM_7; // case '\'': case '"': return 0xDE;
+ // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
+ // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
+ // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
+ // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
+ // VK_ATTN (F6) Attn key
+ // VK_CRSEL (F7) CrSel key
+ // VK_EXSEL (F8) ExSel key
+ // VK_EREOF (F9) Erase EOF key
+ // VK_PLAY (FA) Play key
+ // VK_ZOOM (FB) Zoom key
+ // VK_NONAME (FC) Reserved for future use
+ // VK_PA1 (FD) PA1 key
+ // VK_OEM_CLEAR (FE) Clear key
+ default:
+ return 0;
}
-
}
PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
@@ -511,13 +509,13 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
m_unmodifiedText = event->text(); // FIXME: not correct
m_keyIdentifier = keyIdentifierForQtKeyCode(event->key());
m_autoRepeat = event->isAutoRepeat();
- m_ctrlKey = (state & Qt::ControlModifier) != 0;
- m_altKey = (state & Qt::AltModifier) != 0;
- m_metaKey = (state & Qt::MetaModifier) != 0;
- m_isKeypad = (state & Qt::KeypadModifier) != 0;
+ m_ctrlKey = (state & Qt::ControlModifier);
+ m_altKey = (state & Qt::AltModifier);
+ m_metaKey = (state & Qt::MetaModifier);
+ m_isKeypad = (state & Qt::KeypadModifier);
m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), m_isKeypad);
m_nativeVirtualKeyCode = event->nativeVirtualKey();
- m_shiftKey = (state & Qt::ShiftModifier) != 0 || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
+ m_shiftKey = (state & Qt::ShiftModifier) || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
m_qtEvent = event;
}
diff --git a/WebCore/platform/qt/PlatformMouseEventQt.cpp b/WebCore/platform/qt/PlatformMouseEventQt.cpp
index e486e68..a8956bf 100644
--- a/WebCore/platform/qt/PlatformMouseEventQt.cpp
+++ b/WebCore/platform/qt/PlatformMouseEventQt.cpp
@@ -28,10 +28,9 @@
#include "config.h"
#include "PlatformMouseEvent.h"
-#include <wtf/CurrentTime.h>
-
-#include <QMouseEvent>
#include <QGraphicsSceneMouseEvent>
+#include <QMouseEvent>
+#include <wtf/CurrentTime.h>
namespace WebCore {
@@ -65,10 +64,10 @@ PlatformMouseEvent::PlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clic
m_button = NoButton;
m_clickCount = clickCount;
- m_shiftKey = (event->modifiers() & Qt::ShiftModifier) != 0;
- m_ctrlKey = (event->modifiers() & Qt::ControlModifier) != 0;
- m_altKey = (event->modifiers() & Qt::AltModifier) != 0;
- m_metaKey = (event->modifiers() & Qt::MetaModifier) != 0;
+ m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
+ m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
+ m_altKey = (event->modifiers() & Qt::AltModifier);
+ m_metaKey = (event->modifiers() & Qt::MetaModifier);
}
PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
@@ -94,7 +93,7 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu: {
m_eventType = MouseEventPressed;
- QContextMenuEvent *ce = static_cast<QContextMenuEvent *>(event);
+ QContextMenuEvent* ce = static_cast<QContextMenuEvent*>(event);
m_position = IntPoint(ce->pos());
m_globalPosition = IntPoint(ce->globalPos());
m_button = RightButton;
@@ -120,10 +119,10 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
}
m_clickCount = clickCount;
- m_shiftKey = (event->modifiers() & Qt::ShiftModifier) != 0;
- m_ctrlKey = (event->modifiers() & Qt::ControlModifier) != 0;
- m_altKey = (event->modifiers() & Qt::AltModifier) != 0;
- m_metaKey = (event->modifiers() & Qt::MetaModifier) != 0;
+ m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
+ m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
+ m_altKey = (event->modifiers() & Qt::AltModifier);
+ m_metaKey = (event->modifiers() & Qt::MetaModifier);
}
}
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index ee66a35..9319493 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -47,16 +47,16 @@
#endif
#include "NotImplemented.h"
#include "Page.h"
-#include "QtStyleOptionWebComboBox.h"
#include "QWebPageClient.h"
+#include "QtStyleOptionWebComboBox.h"
#include "RenderBox.h"
#if ENABLE(PROGRESS_TAG)
#include "RenderProgress.h"
#endif
#include "RenderSlider.h"
#include "RenderTheme.h"
-#include "TimeRanges.h"
#include "ScrollbarThemeQt.h"
+#include "TimeRanges.h"
#include "UserAgentStyleSheets.h"
#include "qwebpage.h"
@@ -727,6 +727,9 @@ void RenderThemeQt::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style
bool RenderThemeQt::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& pi, const IntRect& r)
{
+ if (!o->isProgress())
+ return true;
+
StylePainter p(this, pi);
if (!p.isValid())
return true;
diff --git a/WebCore/platform/qt/ScreenQt.cpp b/WebCore/platform/qt/ScreenQt.cpp
index def1995..d648c53 100644
--- a/WebCore/platform/qt/ScreenQt.cpp
+++ b/WebCore/platform/qt/ScreenQt.cpp
@@ -23,18 +23,18 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Screen.h"
-#include "Page.h"
+#include "FloatRect.h"
#include "Frame.h"
#include "FrameView.h"
-#include "Widget.h"
#include "IntRect.h"
-#include "FloatRect.h"
+#include "Page.h"
+#include "Widget.h"
#include <QApplication>
#include <QDesktopWidget>
diff --git a/WebCore/platform/qt/ScrollbarQt.cpp b/WebCore/platform/qt/ScrollbarQt.cpp
index 8eac15f..70aa5db 100644
--- a/WebCore/platform/qt/ScrollbarQt.cpp
+++ b/WebCore/platform/qt/ScrollbarQt.cpp
@@ -29,8 +29,8 @@
#include "Scrollbar.h"
#include "EventHandler.h"
-#include "FrameView.h"
#include "Frame.h"
+#include "FrameView.h"
#include "GraphicsContext.h"
#include "IntRect.h"
#include "PlatformMouseEvent.h"
@@ -38,9 +38,9 @@
#include <QApplication>
#include <QDebug>
+#include <QMenu>
#include <QPainter>
#include <QStyle>
-#include <QMenu>
using namespace std;
diff --git a/WebCore/platform/qt/ScrollbarThemeQt.cpp b/WebCore/platform/qt/ScrollbarThemeQt.cpp
index eb2d934..67226b0 100644
--- a/WebCore/platform/qt/ScrollbarThemeQt.cpp
+++ b/WebCore/platform/qt/ScrollbarThemeQt.cpp
@@ -22,7 +22,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -31,15 +31,15 @@
#include "GraphicsContext.h"
#include "PlatformMouseEvent.h"
#include "RenderThemeQt.h"
-#include "Scrollbar.h"
#include "ScrollView.h"
+#include "Scrollbar.h"
#include <QApplication>
#include <QDebug>
+#include <QMenu>
#include <QPainter>
#include <QStyle>
#include <QStyleOptionSlider>
-#include <QMenu>
namespace WebCore {
@@ -56,20 +56,20 @@ ScrollbarThemeQt::~ScrollbarThemeQt()
static QStyle::SubControl scPart(const ScrollbarPart& part)
{
switch (part) {
- case NoPart:
- return QStyle::SC_None;
- case BackButtonStartPart:
- case BackButtonEndPart:
- return QStyle::SC_ScrollBarSubLine;
- case BackTrackPart:
- return QStyle::SC_ScrollBarSubPage;
- case ThumbPart:
- return QStyle::SC_ScrollBarSlider;
- case ForwardTrackPart:
- return QStyle::SC_ScrollBarAddPage;
- case ForwardButtonStartPart:
- case ForwardButtonEndPart:
- return QStyle::SC_ScrollBarAddLine;
+ case NoPart:
+ return QStyle::SC_None;
+ case BackButtonStartPart:
+ case BackButtonEndPart:
+ return QStyle::SC_ScrollBarSubLine;
+ case BackTrackPart:
+ return QStyle::SC_ScrollBarSubPage;
+ case ThumbPart:
+ return QStyle::SC_ScrollBarSlider;
+ case ForwardTrackPart:
+ return QStyle::SC_ScrollBarAddPage;
+ case ForwardButtonStartPart:
+ case ForwardButtonEndPart:
+ return QStyle::SC_ScrollBarAddLine;
}
return QStyle::SC_None;
@@ -78,18 +78,18 @@ static QStyle::SubControl scPart(const ScrollbarPart& part)
static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc)
{
switch (sc) {
- case QStyle::SC_None:
- return NoPart;
- case QStyle::SC_ScrollBarSubLine:
- return BackButtonStartPart;
- case QStyle::SC_ScrollBarSubPage:
- return BackTrackPart;
- case QStyle::SC_ScrollBarSlider:
- return ThumbPart;
- case QStyle::SC_ScrollBarAddPage:
- return ForwardTrackPart;
- case QStyle::SC_ScrollBarAddLine:
- return ForwardButtonStartPart;
+ case QStyle::SC_None:
+ return NoPart;
+ case QStyle::SC_ScrollBarSubLine:
+ return BackButtonStartPart;
+ case QStyle::SC_ScrollBarSubPage:
+ return BackTrackPart;
+ case QStyle::SC_ScrollBarSlider:
+ return ThumbPart;
+ case QStyle::SC_ScrollBarAddPage:
+ return ForwardTrackPart;
+ case QStyle::SC_ScrollBarAddLine:
+ return ForwardButtonStartPart;
}
return NoPart;
}
@@ -122,9 +122,9 @@ static QStyleOptionSlider* styleOptionSlider(Scrollbar* scrollbar, QWidget* widg
ScrollbarPart hoveredPart = scrollbar->hoveredPart();
if (pressedPart != NoPart) {
opt.activeSubControls = scPart(scrollbar->pressedPart());
- if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart ||
- pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart ||
- pressedPart == ThumbPart)
+ if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart
+ || pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart
+ || pressedPart == ThumbPart)
opt.state |= QStyle::State_Sunken;
} else
opt.activeSubControls = scPart(hoveredPart);
diff --git a/WebCore/platform/qt/SharedTimerQt.cpp b/WebCore/platform/qt/SharedTimerQt.cpp
index 7c0fd05..8a6bd81 100644
--- a/WebCore/platform/qt/SharedTimerQt.cpp
+++ b/WebCore/platform/qt/SharedTimerQt.cpp
@@ -24,18 +24,17 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
-#include <wtf/CurrentTime.h>
-
#include <QBasicTimer>
#include <QCoreApplication>
#include <QDebug>
#include <QPointer>
+#include <wtf/CurrentTime.h>
namespace WebCore {
diff --git a/WebCore/platform/qt/SoundQt.cpp b/WebCore/platform/qt/SoundQt.cpp
index 0996328..bf9e142 100644
--- a/WebCore/platform/qt/SoundQt.cpp
+++ b/WebCore/platform/qt/SoundQt.cpp
@@ -26,11 +26,10 @@
*/
#include "config.h"
+#include "Sound.h"
#include <QApplication>
-#include "Sound.h"
-
namespace WebCore {
void systemBeep()
diff --git a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp
index 432bd2b..51e25b8 100644
--- a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp
+++ b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp
@@ -33,27 +33,21 @@
#include "config.h"
#include "AXObjectCache.h"
-#include "DNS.h"
#include "CachedResource.h"
#include "CookieJar.h"
#include "Cursor.h"
+#include "DNS.h"
+#include "FTPDirectoryDocument.h"
+#include "FileSystem.h"
#include "Font.h"
#include "Frame.h"
#include "FrameLoader.h"
-#include "FTPDirectoryDocument.h"
-#include "IntPoint.h"
-#include "Widget.h"
-#include "GraphicsContext.h"
-#include "Cursor.h"
-#include "loader.h"
-#include "FileSystem.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "IconLoader.h"
#include "IntPoint.h"
#include "KURL.h"
#include "Language.h"
-#include "loader.h"
#include "LocalizedStrings.h"
#include "Node.h"
#include "NotImplemented.h"
@@ -67,9 +61,11 @@
#include "SystemTime.h"
#include "TextBoundaries.h"
#include "Widget.h"
+#include "loader.h"
+
+#include <float.h>
#include <stdio.h>
#include <stdlib.h>
-#include <float.h>
#include <wtf/text/CString.h>
using namespace WebCore;
diff --git a/WebCore/platform/qt/WheelEventQt.cpp b/WebCore/platform/qt/WheelEventQt.cpp
index 9349c70..57a7ebc 100644
--- a/WebCore/platform/qt/WheelEventQt.cpp
+++ b/WebCore/platform/qt/WheelEventQt.cpp
@@ -18,14 +18,15 @@
*/
#include "config.h"
-#include "PlatformWheelEvent.h"
+#include "WheelEvent.h"
#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
#include "Scrollbar.h"
-#include <qapplication.h>
-#include <QWheelEvent>
#include <QGraphicsSceneWheelEvent>
+#include <QWheelEvent>
+#include <qapplication.h>
namespace WebCore {
@@ -57,11 +58,7 @@ void PlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation)
}
PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent* e)
-#ifdef QT_NO_WHEELEVENT
-{
- Q_UNUSED(e);
-}
-#else
+#ifndef QT_NO_WHEELEVENT
: m_position(e->pos().toPoint())
, m_globalPosition(e->screenPos())
, m_granularity(ScrollByPixelWheelEvent)
@@ -70,17 +67,17 @@ PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent* e)
, m_ctrlKey(e->modifiers() & Qt::ControlModifier)
, m_altKey(e->modifiers() & Qt::AltModifier)
, m_metaKey(e->modifiers() & Qt::MetaModifier)
+#endif
{
+#ifndef QT_NO_WHEELEVENT
applyDelta(e->delta(), e->orientation());
+#else
+ Q_UNUSED(e);
+#endif
}
-#endif // QT_NO_WHEELEVENT
PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e)
-#ifdef QT_NO_WHEELEVENT
-{
- Q_UNUSED(e);
-}
-#else
+#ifndef QT_NO_WHEELEVENT
: m_position(e->pos())
, m_globalPosition(e->globalPos())
, m_granularity(ScrollByPixelWheelEvent)
@@ -89,9 +86,13 @@ PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e)
, m_ctrlKey(e->modifiers() & Qt::ControlModifier)
, m_altKey(e->modifiers() & Qt::AltModifier)
, m_metaKey(e->modifiers() & Qt::MetaModifier)
+#endif
{
+#ifndef QT_NO_WHEELEVENT
applyDelta(e->delta(), e->orientation());
+#else
+ Q_UNUSED(e);
+#endif
}
-#endif // QT_NO_WHEELEVENT
} // namespace WebCore
diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp
index 43252a8..00a58a4 100644
--- a/WebCore/platform/qt/WidgetQt.cpp
+++ b/WebCore/platform/qt/WidgetQt.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
- * Copyright (C) 2006 George Stiakos <staikos@kde.org>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2008 Holger Hans Peter Freyther
@@ -37,19 +37,18 @@
#include "GraphicsContext.h"
#include "HostWindow.h"
#include "IntRect.h"
-#include "ScrollView.h"
#include "NotImplemented.h"
#include "QWebPageClient.h"
+#include "ScrollView.h"
#include "qwebframe.h"
#include "qwebframe_p.h"
#include "qwebpage.h"
#include <QCoreApplication>
-#include <QPainter>
-#include <QPaintEngine>
-
#include <QDebug>
+#include <QPaintEngine>
+#include <QPainter>
namespace WebCore {
diff --git a/WebCore/platform/text/SegmentedString.cpp b/WebCore/platform/text/SegmentedString.cpp
index d75032f..9ff1c45 100644
--- a/WebCore/platform/text/SegmentedString.cpp
+++ b/WebCore/platform/text/SegmentedString.cpp
@@ -51,6 +51,7 @@ const SegmentedString& SegmentedString::operator=(const SegmentedString &other)
m_currentChar = &m_pushedChar2;
else
m_currentChar = other.m_currentChar;
+ m_closed = other.m_closed;
return *this;
}
@@ -152,8 +153,7 @@ void SegmentedString::prepend(const SegmentedString &s)
void SegmentedString::advanceSubstring()
{
if (m_composite) {
- m_currentString = m_substrings.first();
- m_substrings.removeFirst();
+ m_currentString = m_substrings.takeFirst();
if (m_substrings.isEmpty())
m_composite = false;
} else {
diff --git a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
index 5a8a812..dda443f 100644
--- a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
+++ b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
@@ -33,31 +33,49 @@
namespace WebCore {
+ static unsigned char buffer[1024];
+
class TextBreakIterator : public QTextBoundaryFinder {
+ public:
+ TextBreakIterator(QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
+ : QTextBoundaryFinder(type, (const QChar*)string, length, buffer, sizeof(buffer))
+ , length(length)
+ , string(string) {}
+ TextBreakIterator()
+ : QTextBoundaryFinder()
+ , length(0)
+ , string(0) {}
+
+ int length;
+ const UChar* string;
};
- static QTextBoundaryFinder* iterator = 0;
- static unsigned char buffer[1024];
- TextBreakIterator* wordBreakIterator(const UChar* string, int length)
+ TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
{
if (!string || !length)
return 0;
- if (!iterator)
- iterator = new QTextBoundaryFinder;
- *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Word, (const QChar *)string, length, buffer, sizeof(buffer));
- return static_cast<TextBreakIterator*>(iterator);
+ if (iterator.isValid() && type == iterator.type() && length == iterator.length
+ && memcmp(string, iterator.string, length) == 0) {
+ iterator.toStart();
+ return &iterator;
+ }
+
+ iterator = TextBreakIterator(type, string, length);
+
+ return &iterator;
}
- TextBreakIterator* characterBreakIterator(const UChar* string, int length)
+ TextBreakIterator* wordBreakIterator(const UChar* string, int length)
{
- if (!string || !length)
- return 0;
- if (!iterator)
- iterator = new QTextBoundaryFinder;
+ static TextBreakIterator staticWordBreakIterator;
+ return setUpIterator(staticWordBreakIterator, QTextBoundaryFinder::Word, string, length);
+ }
- *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Grapheme, (const QChar *)string, length, buffer, sizeof(buffer));
- return static_cast<TextBreakIterator*>(iterator);
+ TextBreakIterator* characterBreakIterator(const UChar* string, int length)
+ {
+ static TextBreakIterator staticCharacterBreakIterator;
+ return setUpIterator(staticCharacterBreakIterator, QTextBoundaryFinder::Grapheme, string, length);
}
TextBreakIterator* cursorMovementIterator(const UChar* string, int length)
@@ -67,25 +85,15 @@ namespace WebCore {
TextBreakIterator* lineBreakIterator(const UChar* string, int length)
{
- static QTextBoundaryFinder *iterator = 0;
- if (!string || !length)
- return 0;
- if (!iterator)
- iterator = new QTextBoundaryFinder;
-
- *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Line, (const QChar *)string, length, buffer, sizeof(buffer));
- return static_cast<TextBreakIterator*>(iterator);
+ static TextBreakIterator staticLineBreakIterator;
+ return setUpIterator(staticLineBreakIterator, QTextBoundaryFinder::Line, string, length);
}
TextBreakIterator* sentenceBreakIterator(const UChar* string, int length)
{
- if (!string || !length)
- return 0;
- if (!iterator)
- iterator = new QTextBoundaryFinder;
+ static TextBreakIterator staticSentenceBreakIterator;
+ return setUpIterator(staticSentenceBreakIterator, QTextBoundaryFinder::Sentence, string, length);
- *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Sentence, (const QChar *)string, length, buffer, sizeof(buffer));
- return static_cast<TextBreakIterator*>(iterator);
}
int textBreakFirst(TextBreakIterator* bi)
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.cpp b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
index d340c89..fbd0011 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.cpp
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
@@ -289,7 +289,7 @@ static bool urlFromPath(CFStringRef path, String& url)
return true;
}
-String getURL(IDataObject* dataObject, bool& success, String* title)
+String getURL(IDataObject* dataObject, DragData::FilenameConversionPolicy filenamePolicy, bool& success, String* title)
{
STGMEDIUM store;
String url;
@@ -311,32 +311,34 @@ String getURL(IDataObject* dataObject, bool& success, String* title)
GlobalUnlock(store.hGlobal);
ReleaseStgMedium(&store);
success = true;
- } else if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) {
- //file using unicode
- wchar_t* data = (wchar_t*)GlobalLock(store.hGlobal);
- if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
- RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
- if (urlFromPath(pathAsCFString.get(), url)) {
- if (title)
- *title = url;
- success = true;
+ } else if (filenamePolicy == DragData::ConvertFilenames) {
+ if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) {
+ // file using unicode
+ wchar_t* data = (wchar_t*)GlobalLock(store.hGlobal);
+ if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
+ RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
+ if (urlFromPath(pathAsCFString.get(), url)) {
+ if (title)
+ *title = url;
+ success = true;
+ }
}
- }
- GlobalUnlock(store.hGlobal);
- ReleaseStgMedium(&store);
- } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) {
- //filename using ascii
- char* data = (char*)GlobalLock(store.hGlobal);
- if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
- RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
- if (urlFromPath(pathAsCFString.get(), url)) {
- if (title)
- *title = url;
- success = true;
+ GlobalUnlock(store.hGlobal);
+ ReleaseStgMedium(&store);
+ } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) {
+ // filename using ascii
+ char* data = (char*)GlobalLock(store.hGlobal);
+ if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
+ RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
+ if (urlFromPath(pathAsCFString.get(), url)) {
+ if (title)
+ *title = url;
+ success = true;
+ }
}
+ GlobalUnlock(store.hGlobal);
+ ReleaseStgMedium(&store);
}
- GlobalUnlock(store.hGlobal);
- ReleaseStgMedium(&store);
}
return url;
}
@@ -350,20 +352,21 @@ String getPlainText(IDataObject* dataObject, bool& success)
//unicode text
UChar* data = (UChar*)GlobalLock(store.hGlobal);
text = String(data);
- GlobalUnlock(store.hGlobal);
+ GlobalUnlock(store.hGlobal);
ReleaseStgMedium(&store);
success = true;
} else if (SUCCEEDED(dataObject->GetData(plainTextFormat(), &store))) {
//ascii text
char* data = (char*)GlobalLock(store.hGlobal);
text = String(data);
- GlobalUnlock(store.hGlobal);
+ GlobalUnlock(store.hGlobal);
ReleaseStgMedium(&store);
success = true;
} else {
- //If a file is dropped on the window, it does not provide either of the
- //plain text formats, so here we try to forcibly get a url.
- text = getURL(dataObject, success);
+ // FIXME: Originally, we called getURL() here because dragging and dropping files doesn't
+ // populate the drag with text data. Per https://bugs.webkit.org/show_bug.cgi?id=38826, this
+ // is undesirable, so maybe this line can be removed.
+ text = getURL(dataObject, DragData::DoNotConvertFilenames, success);
success = true;
}
return text;
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.h b/WebCore/platform/win/ClipboardUtilitiesWin.h
index ec15231..ac5efd8 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.h
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.h
@@ -61,9 +61,10 @@ PassRefPtr<DocumentFragment> fragmentFromFilenames(Document*, const IDataObject*
PassRefPtr<DocumentFragment> fragmentFromHTML(Document*, IDataObject*);
PassRefPtr<DocumentFragment> fragmentFromCF_HTML(Document*, const String& cf_html);
-String getURL(IDataObject*, bool& success, String* title = 0);
+String getURL(IDataObject*, DragData::FilenameConversionPolicy, bool& success, String* title = 0);
String getPlainText(IDataObject*, bool& success);
} // namespace WebCore
-#endif // ClipboardUtilitiesWin_h \ No newline at end of file
+#endif // ClipboardUtilitiesWin_h
+
diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp
index 32b6561..3c3a205 100644
--- a/WebCore/platform/win/ClipboardWin.cpp
+++ b/WebCore/platform/win/ClipboardWin.cpp
@@ -499,7 +499,7 @@ String ClipboardWin::getData(const String& type, bool& success) const
if (dataType == ClipboardDataTypeText)
return getPlainText(m_dataObject.get(), success);
else if (dataType == ClipboardDataTypeURL)
- return getURL(m_dataObject.get(), success);
+ return getURL(m_dataObject.get(), DragData::DoNotConvertFilenames, success);
return "";
}
diff --git a/WebCore/platform/win/CursorWin.cpp b/WebCore/platform/win/CursorWin.cpp
index 48cf10b..22a535d 100644
--- a/WebCore/platform/win/CursorWin.cpp
+++ b/WebCore/platform/win/CursorWin.cpp
@@ -52,8 +52,9 @@ static inline bool supportsAlphaCursors()
return osinfo.dwMajorVersion > 5 || (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion > 0);
}
-Cursor::Cursor(Image* img, const IntPoint& hotspot)
-{
+Cursor::Cursor(Image* img, const IntPoint& hotSpot)
+{
+ IntPoint effectiveHotSpot = determineHotSpot(img, hotSpot);
static bool doAlpha = supportsAlphaCursors();
BitmapInfo cursorImage = BitmapInfo::create(IntSize(img->width(), img->height()));
@@ -74,8 +75,8 @@ Cursor::Cursor(Image* img, const IntPoint& hotspot)
ICONINFO ii;
ii.fIcon = FALSE;
- ii.xHotspot = hotspot.x();
- ii.yHotspot = hotspot.y();
+ ii.xHotspot = effectiveHotSpot.x();
+ ii.yHotspot = effectiveHotSpot.y();
ii.hbmMask = hMask.get();
ii.hbmColor = hCursor.get();
@@ -110,8 +111,8 @@ Cursor::Cursor(Image* img, const IntPoint& hotspot)
ICONINFO icon = {0};
icon.fIcon = FALSE;
- icon.xHotspot = hotspot.x();
- icon.yHotspot = hotspot.y();
+ icon.xHotspot = effectiveHotSpot.x();
+ icon.yHotspot = effectiveHotSpot.y();
icon.hbmMask = andMask.get();
icon.hbmColor = xorMask.get();
m_impl = SharedCursor::create(CreateIconIndirect(&icon));
diff --git a/WebCore/platform/win/DragDataWin.cpp b/WebCore/platform/win/DragDataWin.cpp
index 30487b8..82e537e 100644
--- a/WebCore/platform/win/DragDataWin.cpp
+++ b/WebCore/platform/win/DragDataWin.cpp
@@ -44,18 +44,19 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co
return ClipboardWin::create(true, m_platformDragData, policy);
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
return SUCCEEDED(m_platformDragData->QueryGetData(urlWFormat()))
|| SUCCEEDED(m_platformDragData->QueryGetData(urlFormat()))
- || SUCCEEDED(m_platformDragData->QueryGetData(filenameWFormat()))
- || SUCCEEDED(m_platformDragData->QueryGetData(filenameFormat()));
+ || (filenamePolicy == ConvertFilenames
+ && (SUCCEEDED(m_platformDragData->QueryGetData(filenameWFormat()))
+ || SUCCEEDED(m_platformDragData->QueryGetData(filenameFormat()))));
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
bool success;
- return getURL(m_platformDragData, success, title);
+ return getURL(m_platformDragData, filenamePolicy, success, title);
}
bool DragData::containsFiles() const
diff --git a/WebCore/platform/wince/DragDataWince.cpp b/WebCore/platform/wince/DragDataWince.cpp
index 881d7d4..5f2a7ba 100644
--- a/WebCore/platform/wince/DragDataWince.cpp
+++ b/WebCore/platform/wince/DragDataWince.cpp
@@ -32,12 +32,12 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co
return 0;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
return false;
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
return String();
}
diff --git a/WebCore/platform/wx/DragDataWx.cpp b/WebCore/platform/wx/DragDataWx.cpp
index 97ea38c..278f123 100644
--- a/WebCore/platform/wx/DragDataWx.cpp
+++ b/WebCore/platform/wx/DragDataWx.cpp
@@ -76,12 +76,12 @@ bool DragData::containsCompatibleContent() const
return false;
}
-bool DragData::containsURL() const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
{
return false;
}
-String DragData::asURL(String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
{
return String();
}