summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/platform
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-09-24 12:56:11 (GMT)
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2009-09-24 12:56:11 (GMT)
commit512d332d21860b1d08e86d6de96b80ce12d742bf (patch)
tree339a6f5962b587b198f2ed21bf9f64ac338b66eb /src/3rdparty/webkit/WebCore/platform
parentcb89aab6b29fd5761f3b9d41354abcde11e103dc (diff)
downloadQt-512d332d21860b1d08e86d6de96b80ce12d742bf.zip
Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.gz
Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.bz2
Updated WebKit from /home/joce/dev/qtwebkit3/ to qtwebkit-4.6-snapshot-24092009 ( 75c44947a340d74a9e0098a3dfffabce0c9512ef )
Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-09-24 Martin Smith <msmith@trolltech.com> Reviewed by Simon Hausmann. qdoc: Added \brief texts to all the since 4.6 functions. * Api/qwebhistory.cpp: 2009-09-23 J-P Nurmi <jpnurmi@gmail.com> Reviewed by Simon Hausmann. Prevent QWebPage::setView() from changing the viewport size on the fly in case the view doesn't actually change. QWebPage::setView() is called upon every QWebGraphicsItem::hoverMoveEvent(), which forced the viewport size to be equal to the size of the whole graphics view. https://bugs.webkit.org/show_bug.cgi?id=29676 * Api/qwebpage.cpp: (QWebPage::setView): 2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed by Simon Hausmann. [Qt] Crash fix in QWebHistory back and forward methods. QWebHistory::back() and QWebHistory::forward() were crashing on ASSERT in WebCore::BackForwardList. The methods should check canGoBack() and canGoForward() at the beginning. https://bugs.webkit.org/show_bug.cgi?id=29675 * Api/qwebhistory.cpp: (QWebHistory::back): (QWebHistory::forward): 2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed by Simon Hausmann. [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions In QWebHistory's methods that change item count or current item call to QWebPage::updateNavigationActions should be executed. QWebHistory::clear() and QWebHistory::restorState() were changed. New helper method, QWebPagePrivate accesor, were created in QWebHistoryPrivate class. Two autotest were developed. https://bugs.webkit.org/show_bug.cgi?id=29246 * Api/qwebhistory.cpp: (QWebHistory::clear): (QWebHistory::restoreState): (QWebHistoryPrivate::page): * Api/qwebhistory_p.h: * tests/qwebhistory/tst_qwebhistory.cpp: (tst_QWebHistory::saveAndRestore_1): (tst_QWebHistory::clear): 2009-09-23 Norbert Leser <norbert.leser@nokia.com> Reviewed by Tor Arne Vestbø. Need to guard QX11Info include with Q_WS_X11. That class may not be available (in QT 4.5 for Symbian, for instance). Completes fixes in r48627 and r48604. * Api/qwebgraphicsitem.cpp: * Api/qwebview.cpp: 2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. [Qt] Add default timeout while waiting for signals in QWebPage auto tests. https://bugs.webkit.org/show_bug.cgi?id=29637 * tests/qwebpage/tst_qwebpage.cpp: (waitForSignal): 2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reivewed by Simon Hausmann. Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() takes a QWidget*, not a QWebPageClient* * Api/qwebgraphicsitem.cpp: (QWebGraphicsItemPrivate::screenNumber): * Api/qwebview.cpp: (QWebViewPrivate::screenNumber): 2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org> Reviewed by Simon Hausmann. For Qt, platformPageClient() will now return a class derived from the QWebPageClient, so the patch adapts our Qt hooks to go though this class and not depend on the QWebView. * Api/qwebgraphicsitem.cpp: (QWebGraphicsItemPrivate::scroll): (QWebGraphicsItemPrivate::update): (QWebGraphicsItemPrivate::cursor): (QWebGraphicsItemPrivate::updateCursor): (QWebGraphicsItemPrivate::screenNumber): (QWebGraphicsItemPrivate::winId): (QWebGraphicsItem::event): (QWebGraphicsItem::setPage): * Api/qwebgraphicsitem.h: * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): * Api/qwebpage_p.h: * Api/qwebview.cpp: (QWebViewPrivate::scroll): (QWebViewPrivate::update): (QWebViewPrivate::cursor): (QWebViewPrivate::updateCursor): (QWebViewPrivate::screenNumber): (QWebViewPrivate::winId): (QWebView::setPage): (QWebView::event): * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::repaint): (WebCore::ChromeClientQt::scroll): (WebCore::ChromeClientQt::platformPageClient): 2009-09-21 Yael Aharon <yael.aharon@nokia.com> Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=29609 Build fix for windows when using Qt 4.5.0. * Api/qwebpage.cpp: (QWebPage::userAgentForUrl): 2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com> Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=29345 The tests of QWebFrame did not use QTRY_VERIFY for tests involving the event loop. * tests/qwebframe/tst_qwebframe.cpp: * tests/util.h: Added. Copy of tests/shared/util.h of Qt 2009-09-19 Jakub Wieczorek <faw217@gmail.com> Reviewed by Simon Hausmann. [Qt] Add an autotest stub for QWebGraphicsItem. It just calls all the functions and makes sure they don't crash. * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added. * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added. (tst_QWebGraphicsItem::qwebgraphicsitem): * tests/tests.pro: 2009-09-18 Norbert Leser <norbert.leser@nokia.com> Reviewed by Eric Seidel. Corrected the Symbian specific UID3 values to be assigned from the "unprotected" pool that permits self-signing of those test and demo executables. (Added new UID3 values where they were missing for new components.) * QGVLauncher/QGVLauncher.pro: * QtLauncher/QtLauncher.pro: * tests/benchmarks/loading/tst_loading.pro: * tests/benchmarks/painting/tst_painting.pro: * tests/qwebelement/qwebelement.pro: * tests/qwebframe/qwebframe.pro: * tests/qwebhistory/qwebhistory.pro: * tests/qwebhistoryinterface/qwebhistoryinterface.pro: * tests/qwebpage/qwebpage.pro: * tests/qwebplugindatabase/qwebplugindatabase.pro: * tests/qwebview/qwebview.pro: 2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> Reviewed by Simon Hausmann. Make PlatformWindow return something else than PlatformWidget https://bugs.webkit.org/show_bug.cgi?id=29085 Reflect the rename of platformWindow and it's return type. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::platformPageClient): * WebCoreSupport/ChromeClientQt.h: 2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. [Qt] Add persistence support for configuration options in the inspector. * Api/qwebinspector.cpp: * QtLauncher/main.cpp: (main): * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::populateSetting): (WebCore::InspectorClientQt::storeSetting): (WebCore::variantToSetting): (WebCore::settingToVariant): 2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> Reviewed by Simon Hausmann. Improve documentation for Page Cache. * Api/qwebsettings.cpp: 2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed by Simon Hausmann. [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test https://bugs.webkit.org/show_bug.cgi?id=29081 The documentation now specifies that the URL has to be a local file or a a data-URL (with utf-8 and base64-encoded data), as these are the only two schemes that the current code path accepts. The auto-test has been updated to reflect this limitation. At a later point we should concider adding API for the new way of doing both user defined stylesheets and scripts. * Api/qwebsettings.cpp: * tests/qwebpage/tst_qwebpage.cpp:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/HostWindow.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/StaticConstructors.h4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Widget.h7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h8
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h35
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h8
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h50
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h62
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp14
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp15
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/PlatformString.h8
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/String.cpp26
23 files changed, 419 insertions, 45 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/HostWindow.h b/src/3rdparty/webkit/WebCore/platform/HostWindow.h
index 8c74d4f..80f6bdc 100644
--- a/src/3rdparty/webkit/WebCore/platform/HostWindow.h
+++ b/src/3rdparty/webkit/WebCore/platform/HostWindow.h
@@ -48,8 +48,8 @@ public:
virtual IntPoint screenToWindow(const IntPoint&) const = 0;
virtual IntRect windowToScreen(const IntRect&) const = 0;
- // Method for retrieving the native window.
- virtual PlatformWidget platformWindow() const = 0;
+ // Method for retrieving the native client of the page.
+ virtual PlatformPageClient platformPageClient() const = 0;
// For scrolling a rect into view recursively. Useful in the cases where a WebView is embedded inside some containing
// platform-specific ScrollView.
diff --git a/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h b/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h
index 5bc792c..f22383b 100644
--- a/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h
+++ b/src/3rdparty/webkit/WebCore/platform/StaticConstructors.h
@@ -56,7 +56,7 @@
#if COMPILER(MSVC7)
#define DEFINE_GLOBAL(type, name) \
const type name;
-#elif COMPILER(WINSCW)
+#elif PLATFORM(SYMBIAN)
#define DEFINE_GLOBAL(type, name, arg...) \
const type name;
#else
@@ -70,7 +70,7 @@
#if COMPILER(MSVC7)
#define DEFINE_GLOBAL(type, name) \
void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
-#elif COMPILER(WINSCW)
+#elif PLATFORM(SYMBIAN)
#define DEFINE_GLOBAL(type, name, arg...) \
void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
#else
diff --git a/src/3rdparty/webkit/WebCore/platform/Widget.h b/src/3rdparty/webkit/WebCore/platform/Widget.h
index a102b96..e2a7349 100644
--- a/src/3rdparty/webkit/WebCore/platform/Widget.h
+++ b/src/3rdparty/webkit/WebCore/platform/Widget.h
@@ -74,6 +74,13 @@ typedef BView* PlatformWidget;
#include "PlatformWidget.h"
#endif
+#if PLATFORM(QT)
+class QWebPageClient;
+typedef QWebPageClient* PlatformPageClient;
+#else
+typedef PlatformWidget PlatformPageClient;
+#endif
+
#include "IntPoint.h"
#include "IntRect.h"
#include "IntSize.h"
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h
index d953b3b..45a1e83 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h
@@ -36,7 +36,7 @@
typedef struct CGPoint CGPoint;
#endif
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
typedef struct CGPoint NSPoint;
#else
@@ -84,7 +84,8 @@ public:
operator CGPoint() const;
#endif
-#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \
+ || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
FloatPoint(const NSPoint&);
operator NSPoint() const;
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h
index c6a86bc..073f135 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h
@@ -33,7 +33,7 @@
typedef struct CGRect CGRect;
#endif
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
typedef struct CGRect NSRect;
#else
@@ -127,7 +127,8 @@ public:
operator CGRect() const;
#endif
-#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \
+ || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
FloatRect(const NSRect&);
operator NSRect() const;
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h b/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h
index 6e792b6..5a84fd1 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h
@@ -34,7 +34,7 @@
typedef struct CGSize CGSize;
#endif
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
typedef struct CGSize NSSize;
#else
@@ -79,7 +79,8 @@ public:
operator CGSize() const;
#endif
-#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \
+ || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
explicit FloatSize(const NSSize &); // don't do this implicitly since it's lossy
operator NSSize() const;
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h b/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h
index 27b3a05..a60af29 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h
@@ -27,8 +27,8 @@
#include "FontFamily.h"
#include "FontRenderingMode.h"
+#include "FontSmoothingMode.h"
#include "FontTraitsMask.h"
-#include "RenderStyleConstants.h"
namespace WebCore {
@@ -86,7 +86,7 @@ public:
bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == "-webkit-monospace"; }
FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
unsigned keywordSize() const { return m_keywordSize; }
- FontSmoothing fontSmoothing() const { return static_cast<FontSmoothing>(m_fontSmoothing); }
+ FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); }
FontTraitsMask traitsMask() const;
@@ -101,7 +101,7 @@ public:
void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
void setKeywordSize(unsigned s) { m_keywordSize = s; }
- void setFontSmoothing(FontSmoothing smoothing) { m_fontSmoothing = smoothing; }
+ void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
private:
FontFamily m_familyList; // The list of font families to be used.
@@ -124,7 +124,7 @@ private:
// then we can accurately translate across different generic families to adjust for different preference settings
// (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>).
- unsigned m_fontSmoothing : 2; // FontSmoothing
+ unsigned m_fontSmoothing : 2; // FontSmoothingMode
};
inline bool FontDescription::operator==(const FontDescription& other) const
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h b/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h
new file mode 100644
index 0000000..7c23394
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE 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 FontSmoothingMode_h
+#define FontSmoothingMode_h
+
+namespace WebCore {
+
+ enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased };
+
+} // namespace WebCore
+
+#endif // FontSmoothingMode_h
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h
index 7578e6b..97b21bc 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h
@@ -33,7 +33,7 @@
typedef struct CGRect CGRect;
#endif
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
typedef struct CGRect NSRect;
#else
@@ -161,7 +161,8 @@ public:
operator SkIRect() const;
#endif
-#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \
+ || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
operator NSRect() const;
#endif
@@ -198,7 +199,8 @@ inline bool operator!=(const IntRect& a, const IntRect& b)
IntRect enclosingIntRect(const CGRect&);
#endif
-#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
+#if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \
+ || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
IntRect enclosingIntRect(const NSRect&);
#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index be06c14..71c5cd4 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -38,6 +38,9 @@
#include <QUrl>
#include <QEvent>
+#if defined (__SYMBIAN32__)
+#include <phonon/path.h>
+#endif
#include <audiooutput.h>
#include <mediaobject.h>
#include <videowidget.h>
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp
index 73da0a9..e687976 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include "DnsPrefetchHelper.h"
#include "CString.h"
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h
new file mode 100644
index 0000000..f9641ad
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SocketStreamError_h
+#define SocketStreamError_h
+
+#include "SocketStreamErrorBase.h"
+
+namespace WebCore {
+
+ class SocketStreamError : public SocketStreamErrorBase {
+ public:
+ SocketStreamError() { }
+ explicit SocketStreamError(int errorCode)
+ : SocketStreamErrorBase(errorCode)
+ {
+ }
+
+ };
+
+} // namespace WebCore
+
+#endif // SocketStreamError_h
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h
new file mode 100644
index 0000000..64139e5
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SocketStreamHandle_h
+#define SocketStreamHandle_h
+
+#include "SocketStreamHandleBase.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class AuthenticationChallenge;
+ class Credential;
+ class SocketStreamHandleClient;
+
+ class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase {
+ public:
+ static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
+
+ virtual ~SocketStreamHandle();
+
+ protected:
+ virtual int platformSend(const char* data, int length);
+ virtual void platformClose();
+
+ private:
+ SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
+
+ // No authentication for streams per se, but proxy may ask for credentials.
+ void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
+ void receivedCredential(const AuthenticationChallenge&, const Credential&);
+ void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
+ void receivedCancellation(const AuthenticationChallenge&);
+ };
+
+} // namespace WebCore
+
+#endif // SocketStreamHandle_h
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp
new file mode 100644
index 0000000..6aa33fc
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SocketStreamHandle.h"
+
+#include "KURL.h"
+#include "Logging.h"
+#include "NotImplemented.h"
+#include "SocketStreamHandleClient.h"
+
+namespace WebCore {
+
+SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
+ : SocketStreamHandleBase(url, client)
+{
+ LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
+ notImplemented();
+}
+
+SocketStreamHandle::~SocketStreamHandle()
+{
+ LOG(Network, "SocketStreamHandle %p delete", this);
+ setClient(0);
+ notImplemented();
+}
+
+int SocketStreamHandle::platformSend(const char*, int)
+{
+ LOG(Network, "SocketStreamHandle %p platformSend", this);
+ notImplemented();
+ return 0;
+}
+
+void SocketStreamHandle::platformClose()
+{
+ LOG(Network, "SocketStreamHandle %p platformClose", this);
+ notImplemented();
+}
+
+void SocketStreamHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedCredential(const AuthenticationChallenge&, const Credential&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedCancellation(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp
index 56d3372..a27a06e 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp
@@ -48,6 +48,8 @@ namespace WebCore {
#if QT_VERSION >= 0x040400
static QNetworkCookieJar *cookieJar(const Document *document)
{
+ if (!document)
+ return 0;
Frame *frame = document->frame();
if (!frame)
return 0;
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp
index 5dc0963..7ba8350 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp
@@ -36,42 +36,54 @@
#include "FrameView.h"
#include "HostWindow.h"
#include "Widget.h"
+#include "QWebPageClient.h"
#include <QApplication>
#include <QDesktopWidget>
namespace WebCore {
+static int screenNumber(Widget* w)
+{
+ if (!w)
+ return 0;
+
+ QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
+ return client ? client->screenNumber() : 0;
+}
+
int screenDepth(Widget* w)
{
- QDesktopWidget* d = QApplication::desktop();
- QWidget *view = w ? w->root()->hostWindow()->platformWindow() : 0;
- int screenNumber = view ? d->screenNumber(view) : 0;
- return d->screen(screenNumber)->depth();
+ return QApplication::desktop()->screen(screenNumber(w))->depth();
}
int screenDepthPerComponent(Widget* w)
{
- QWidget *view = w ? w->root()->hostWindow()->platformWindow() : 0;
- return view ? view->depth() : QApplication::desktop()->screen(0)->depth();
+ if (w) {
+ QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
+
+ if (client) {
+ QWidget* view = QWidget::find(client->winId());
+ if (view)
+ return view->depth();
+ }
+ }
+ return QApplication::desktop()->screen(0)->depth();
}
bool screenIsMonochrome(Widget* w)
{
- QDesktopWidget* d = QApplication::desktop();
- QWidget *view = w ? w->root()->hostWindow()->platformWindow(): 0;
- int screenNumber = view ? d->screenNumber(view) : 0;
- return d->screen(screenNumber)->numColors() < 2;
+ return QApplication::desktop()->screen(screenNumber(w))->numColors() < 2;
}
FloatRect screenRect(Widget* w)
{
- QRect r = QApplication::desktop()->screenGeometry(w ? w->root()->hostWindow()->platformWindow(): 0);
+ QRect r = QApplication::desktop()->screenGeometry(screenNumber(w));
return FloatRect(r.x(), r.y(), r.width(), r.height());
}
FloatRect screenAvailableRect(Widget* w)
{
- QRect r = QApplication::desktop()->availableGeometry(w ? w->root()->hostWindow()->platformWindow(): 0);
+ QRect r = QApplication::desktop()->availableGeometry(screenNumber(w));
return FloatRect(r.x(), r.y(), r.width(), r.height());
}
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp
index 11dfe41..9ce5838 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp
@@ -30,6 +30,7 @@
#include "FrameView.h"
#include "HostWindow.h"
#include "PopupMenuClient.h"
+#include "QWebPageClient.h"
#include "QWebPopup.h"
#include <QAction>
@@ -85,13 +86,13 @@ void PopupMenu::populate(const IntRect& r)
void PopupMenu::show(const IntRect& r, FrameView* v, int index)
{
- QWidget* window = v->hostWindow()->platformWindow();
+ QWebPageClient* client = v->hostWindow()->platformPageClient();
populate(r);
QRect rect = r;
rect.moveTopLeft(v->contentsToWindow(r.topLeft()));
rect.setHeight(m_popup->sizeHint().height());
- m_popup->setParent(window);
+ m_popup->setParent(QWidget::find(client->winId()));
m_popup->setGeometry(rect);
m_popup->setCurrentIndex(index);
m_popup->exec();
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h
new file mode 100644
index 0000000..1fc29a0
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 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 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 QWebPageClient_h
+#define QWebPageClient_h
+
+#include <QRect>
+
+class QWebPageClient {
+public:
+ virtual void scroll(int dx, int dy, const QRect&) = 0;
+ virtual void update(const QRect&) = 0;
+
+ inline void resetCursor()
+ {
+ if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape())
+ return;
+ updateCursor(m_lastCursor);
+ }
+
+ inline void setCursor(const QCursor& cursor)
+ {
+ m_lastCursor = cursor;
+ if (!cursor.bitmap() && cursor.shape() == this->cursor().shape())
+ return;
+ updateCursor(cursor);
+ }
+
+ virtual int screenNumber() const = 0;
+ virtual WId winId() const = 0;
+
+protected:
+ virtual QCursor cursor() const = 0;
+ virtual void updateCursor(const QCursor& cursor) = 0;
+
+private:
+ QCursor m_lastCursor;
+};
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp
index abcd584..4e82080 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp
@@ -30,6 +30,7 @@
*/
#include "config.h"
+#include "Widget.h"
#include "Cursor.h"
#include "Font.h"
@@ -37,8 +38,8 @@
#include "HostWindow.h"
#include "IntRect.h"
#include "ScrollView.h"
-#include "Widget.h"
#include "NotImplemented.h"
+#include "QWebPageClient.h"
#include "qwebframe.h"
#include "qwebframe_p.h"
@@ -81,15 +82,10 @@ void Widget::setFocus()
void Widget::setCursor(const Cursor& cursor)
{
#ifndef QT_NO_CURSOR
- QWidget* widget = root()->hostWindow()->platformWindow();
-
- if (!widget)
- return;
-
- if (!cursor.impl().bitmap() && widget->cursor().shape() == cursor.impl().shape())
- return;
+ QWebPageClient* pageClient = root()->hostWindow()->platformPageClient();
- widget->setProperty("WebCoreCursor", cursor.impl());
+ if (pageClient)
+ pageClient->setCursor(cursor.impl());
#endif
}
diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp
index 0a236be..a4b2ac8 100644
--- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp
@@ -30,9 +30,10 @@
namespace WebCore {
-SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db)
+SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db, bool readOnly)
: m_db(db)
, m_inProgress(false)
+ , m_readOnly(readOnly)
{
}
@@ -46,7 +47,17 @@ void SQLiteTransaction::begin()
{
if (!m_inProgress) {
ASSERT(!m_db.m_transactionInProgress);
- m_inProgress = m_db.executeCommand("BEGIN;");
+ // Call BEGIN IMMEDIATE for a write transaction to acquire
+ // a RESERVED lock on the DB file. Otherwise, another write
+ // transaction (on another connection) could make changes
+ // to the same DB file before this transaction gets to execute
+ // any statements. If that happens, this transaction will fail.
+ // http://www.sqlite.org/lang_transaction.html
+ // http://www.sqlite.org/lockingv3.html#locking
+ if (m_readOnly)
+ m_inProgress = m_db.executeCommand("BEGIN;");
+ else
+ m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE;");
m_db.m_transactionInProgress = m_inProgress;
}
}
diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h
index cf5a180..557d81cb 100644
--- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h
+++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h
@@ -35,7 +35,7 @@ class SQLiteDatabase;
class SQLiteTransaction : public Noncopyable
{
public:
- SQLiteTransaction(SQLiteDatabase& db);
+ SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false);
~SQLiteTransaction();
void begin();
@@ -47,10 +47,9 @@ public:
private:
SQLiteDatabase& m_db;
bool m_inProgress;
-
+ bool m_readOnly;
};
} // namespace WebCore
#endif // SQLiteTransation_H
-
diff --git a/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h b/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h
index 258b28d..b9b4078 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h
+++ b/src/3rdparty/webkit/WebCore/platform/text/PlatformString.h
@@ -254,6 +254,14 @@ public:
// Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3.
WTF::Unicode::Direction defaultWritingDirection() const { return m_impl ? m_impl->defaultWritingDirection() : WTF::Unicode::LeftToRight; }
+ // Counts the number of grapheme clusters. A surrogate pair or a sequence
+ // of a non-combining character and following combining characters is
+ // counted as 1 grapheme cluster.
+ unsigned numGraphemeClusters() const;
+ // Returns the number of characters which will be less than or equal to
+ // the specified grapheme cluster length.
+ unsigned numCharactersInGraphemeClusters(unsigned) const;
+
private:
RefPtr<StringImpl> m_impl;
};
diff --git a/src/3rdparty/webkit/WebCore/platform/text/String.cpp b/src/3rdparty/webkit/WebCore/platform/text/String.cpp
index 2730939..e892ef6 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/String.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/text/String.cpp
@@ -25,6 +25,7 @@
#include "CString.h"
#include "FloatConversion.h"
#include "StringBuffer.h"
+#include "TextBreakIterator.h"
#include "TextEncoding.h"
#include <wtf/dtoa.h>
#include <limits>
@@ -921,6 +922,31 @@ PassRefPtr<SharedBuffer> utf8Buffer(const String& string)
return SharedBuffer::adoptVector(buffer);
}
+unsigned String::numGraphemeClusters() const
+{
+ TextBreakIterator* it = characterBreakIterator(characters(), length());
+ if (!it)
+ return length();
+
+ unsigned num = 0;
+ while (textBreakNext(it) != TextBreakDone)
+ ++num;
+ return num;
+}
+
+unsigned String::numCharactersInGraphemeClusters(unsigned numGraphemeClusters) const
+{
+ TextBreakIterator* it = characterBreakIterator(characters(), length());
+ if (!it)
+ return min(length(), numGraphemeClusters);
+
+ for (unsigned i = 0; i < numGraphemeClusters; ++i) {
+ if (textBreakNext(it) == TextBreakDone)
+ return length();
+ }
+ return textBreakCurrent(it);
+}
+
} // namespace WebCore
#ifndef NDEBUG