aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--converters/wkhtmltopdf/Makefile50
-rw-r--r--converters/wkhtmltopdf/distinfo8
-rw-r--r--converters/wkhtmltopdf/files/patch-libcxx983
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__jit__JITStubs.cpp11
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__Collector.cpp38
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__JSValue.h26
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__HashTable.h40
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__Threading.h91
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__runtime__JSValueInlineMethods.h26
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Atomics.h92
-rw-r--r--converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__WebKit__qt__QtWebKit.pro11
-rw-r--r--converters/wkhtmltopdf/pkg-descr2
-rw-r--r--converters/wkhtmltopdf/pkg-plist4
13 files changed, 1351 insertions, 31 deletions
diff --git a/converters/wkhtmltopdf/Makefile b/converters/wkhtmltopdf/Makefile
index fa31a26fd8d0..fe2c6dd25486 100644
--- a/converters/wkhtmltopdf/Makefile
+++ b/converters/wkhtmltopdf/Makefile
@@ -2,37 +2,41 @@
# $FreeBSD$
PORTNAME= wkhtmltopdf
-DISTVERSION= 0.11.0_rc1
-PORTREVISION= 3
+DISTVERSION= 0.12.0
CATEGORIES= converters
-MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}:wkhtmltopdf \
- ${MASTER_SITE_LOCAL}
+MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= mm/wkhtmltopdf
-DISTFILES= ${DISTNAME}.tar.bz2:wkhtmltopdf \
+DISTFILES= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX} \
wkhtmltopdf-qt-${WKQTVERSION}.tar.xz
MAINTAINER= mm@FreeBSD.org
COMMENT= Convert HTML (or live webpages) to PDF or image files
+
+LICENSE= LGPL3
+LICENSE_FILE_LGPL3= ${INSTALL_WRKSRC}/COPYING
+
LIB_DEPENDS+= libfontconfig.so:${PORTSDIR}/x11-fonts/fontconfig \
libfreetype.so:${PORTSDIR}/print/freetype2
-WRKSRC= ${WRKDIR}/${PORTNAME}-qt
-INSTALL_WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION}
-
-WKQTVERSION= 6053b687
+#USE_GITHUB= yes
+GH_ACCOUNT= wkhtmltopdf
+GH_PROJECT= wkhtmltopdf
+GH_TAGNAME= 0.12.0
+GH_COMMIT= 03c001d
+WKQTVERSION= 0ec3313
USES= pkgconfig gmake perl5
USE_XORG= x11 xext xrender
USE_PERL5= build
USE_LDCONFIG= yes
HAS_CONFIGURE= yes
+WRKSRC= ${WRKDIR}/qt-wk_4.8.5
+INSTALL_WRKSRC= ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT}
+
OPTIONS_DEFINE= BUNDLED_LIBS
BUNDLED_LIBS_DESC= Use Qt-bundled jpeg, mng, png and tiff
-LICENSE= LGPL3
-LICENSE_FILE_LGPL3= ${INSTALL_WRKSRC}/COPYING
-
-CONFIGURE_ARGS= -prefix ${WRKDIR}/wkqt \
+CONFIGURE_ARGS= -prefix ${WRKDIR}/qt-wk \
-release -static -fast -exceptions -no-accessibility -no-stl \
-no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite \
-no-sql-sqlite2 -no-qt3support -xmlpatterns -no-phonon \
@@ -47,15 +51,10 @@ CONFIGURE_ARGS= -prefix ${WRKDIR}/wkqt \
-no-opengl -no-xsync -no-audio-backend -no-sse3 -no-ssse3 -no-sse4.1 \
-no-sse4.2
-MAKE_ARGS+= INSTALL_ROOT="${PREFIX}"
+MAKE_ARGS+= INSTALL_ROOT="${STAGEDIR}${PREFIX}"
-NO_STAGE= yes
.include <bsd.port.pre.mk>
-.if ${OSVERSION} > 1000000
-USE_GCC= yes
-.endif
-
.if ${OSVERSION} < 800000
BROKEN= fails to extract on FreeBSD 7.X
.endif
@@ -85,13 +84,16 @@ post-patch:
post-build:
@cd ${WRKSRC} && \
- ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET} \
- INSTALL_ROOT=
- @cd ${WRKDIR}/${PORTNAME}-${DISTVERSION} && ${WRKDIR}/wkqt/bin/qmake && \
- ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}
+ ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} \
+ ${MAKE_ARGS} ${INSTALL_TARGET} INSTALL_ROOT=
+ @cd ${INSTALL_WRKSRC} && ${WRKDIR}/qt-wk/bin/qmake && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} \
+ ${_MAKE_JOBS} ${MAKE_ARGS:C,^${DESTDIRNAME}=.*,,g} \
+ ${ALL_TARGET}
post-install:
- @${STRIP_CMD} ${PREFIX}/bin/wkhtmltopdf ${PREFIX}/bin/wkhtmltoimage
+ @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/wkhtmltopdf \
+ ${STAGEDIR}${PREFIX}/bin/wkhtmltoimage
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
diff --git a/converters/wkhtmltopdf/distinfo b/converters/wkhtmltopdf/distinfo
index 5240bc2ed0e5..3109afd4f6b2 100644
--- a/converters/wkhtmltopdf/distinfo
+++ b/converters/wkhtmltopdf/distinfo
@@ -1,4 +1,4 @@
-SHA256 (wkhtmltopdf-0.11.0_rc1.tar.bz2) = a36dbfc7cc27604b667f278ff8e9c86ced6777cdd1646d585d4e06e473b1905c
-SIZE (wkhtmltopdf-0.11.0_rc1.tar.bz2) = 97589
-SHA256 (wkhtmltopdf-qt-6053b687.tar.xz) = 6d3f3e2dc7b450ab8c8074e124ca8ee9b90234224aa48a7f8f335b1cd9527a14
-SIZE (wkhtmltopdf-qt-6053b687.tar.xz) = 122782824
+SHA256 (wkhtmltopdf-0.12.0.tar.gz) = 47b35536ca60220c402113c9ceee9b1f68bd7ca0dc831e3242e26684a9fd4baf
+SIZE (wkhtmltopdf-0.12.0.tar.gz) = 135609
+SHA256 (wkhtmltopdf-qt-0ec3313.tar.xz) = cd930bb84124a5cf4f74f430233be4aa5c1c69b5846684f1223ab1a0bc9110a7
+SIZE (wkhtmltopdf-qt-0ec3313.tar.xz) = 132737360
diff --git a/converters/wkhtmltopdf/files/patch-libcxx b/converters/wkhtmltopdf/files/patch-libcxx
new file mode 100644
index 000000000000..1107c65e587f
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-libcxx
@@ -0,0 +1,983 @@
+Several upstream (as in WebKit itself) commits that fix the build with libc++,
+plus a few additional changes made only for the port (the OS(FREEBSD) part for
+time_t). Some of those commits had to be edited because they did not apply
+cleanly to the ancient WebKit checkout present in Qt.
+
+Upstream commit messages:
+
+------------------------------------------------------------------------
+r86529 | abarth@webkit.org | 2011-05-16 09:30:58 +0300 (Mon, 16 May 2011) | 7 lines
+
+2011-05-15 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix Qt build. (Strict PassOwnPtr fix.)
+
+ * dom/XMLDocumentParserQt.cpp:
+ (WebCore::XMLDocumentParser::doEnd):
+
+------------------------------------------------------------------------
+r86530 | abarth@webkit.org | 2011-05-16 09:36:56 +0300 (Mon, 16 May 2011) | 13 lines
+
+2011-05-15 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix Qt build. (Strict PassOwnPtr fix.)
+
+* platform/network/qt/QNetworkReplyHandler.cpp:
+(WebCore::QNetworkReplyWrapper::release):
+(WebCore::QNetworkReplyWrapper::receiveMetaData):
+(WebCore::QNetworkReplyWrapper::receiveSniffedMIMEType):
+(WebCore::QNetworkReplyHandler::release):
+(WebCore::QNetworkReplyHandler::finish):
+(WebCore::QNetworkReplyHandler::redirect):
+(WebCore::QNetworkReplyHandler::start):
+
+------------------------------------------------------------------------
+r86531 | abarth@webkit.org | 2011-05-16 09:41:08 +0300 (Mon, 16 May 2011) | 7 lines
+
+2011-05-15 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix Qt build. (Strict PassOwnPtr fix.)
+
+ * platform/text/qt/TextCodecQt.cpp:
+ (WebCore::newTextCodecQt):
+
+------------------------------------------------------------------------
+r86532 | abarth@webkit.org | 2011-05-16 09:46:33 +0300 (Mon, 16 May 2011) | 8 lines
+
+2011-05-15 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix Qt build. (Strict PassOwnPtr fix.)
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQt::GraphicsLayerQt):
+ (WebCore::GraphicsLayer::create):
+
+
+------------------------------------------------------------------------
+r86533 | abarth@webkit.org | 2011-05-16 09:52:23 +0300 (Mon, 16 May 2011) | 10 lines
+
+2011-05-15 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix the Qt build. (Strict PassOwnPtr fix.)
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebViewPrivate::detachCurrentPage):
+ (QGraphicsWebView::setPage):
+ * Api/qwebpage.cpp:
+ (QWebPage::setView):
+
+------------------------------------------------------------------------
+r86537 | abarth@webkit.org | 2011-05-16 10:24:01 +0300 (Mon, 16 May 2011) | 41 lines
+
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ [Qt] QtPlatformPlugin create methods should use PassOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=60873
+
+ This change is slightly more than a build fix because the patch kind of
+ spidered a bit while I was trying to fix the build the "right way."
+ Hopefully nothing here is controversial.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::adjustPointForClicking):
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::createSelectPopup):
+ * WebCoreSupport/FullScreenVideoQt.cpp:
+ (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+ (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
+ * WebCoreSupport/FullScreenVideoQt.h:
+ * WebCoreSupport/NotificationPresenterClientQt.cpp:
+ (WebCore::NotificationWrapper::NotificationWrapper):
+ (WebCore::NotificationPresenterClientQt::displayNotification):
+ * WebCoreSupport/PopupMenuQt.cpp:
+ (WebCore::PopupMenuQt::PopupMenuQt):
+ (WebCore::PopupMenuQt::~PopupMenuQt):
+ (WebCore::PopupMenuQt::show):
+ * WebCoreSupport/PopupMenuQt.h:
+ * WebCoreSupport/QtPlatformPlugin.cpp:
+ (WebCore::QtPlatformPlugin::createSelectInputMethod):
+ (WebCore::QtPlatformPlugin::createNotificationPresenter):
+ (WebCore::QtPlatformPlugin::createHapticFeedbackPlayer):
+ (WebCore::QtPlatformPlugin::createTouchModifier):
+ (WebCore::QtPlatformPlugin::createFullScreenVideoHandler):
+ * WebCoreSupport/QtPlatformPlugin.h:
+ (WebCore::QtPlatformPlugin::QtPlatformPlugin):
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ [Qt] QtPlatformPlugin create methods should use PassOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=60873
+
+ * plugins/qt/PluginViewQt.cpp:
+ (WebCore::PluginView::platformStart):
+
+------------------------------------------------------------------------
+r86538 | abarth@webkit.org | 2011-05-16 10:27:51 +0300 (Mon, 16 May 2011) | 6 lines
+
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ Missing include.
+
+ * WebCoreSupport/PopupMenuQt.h:
+
+------------------------------------------------------------------------
+r86540 | abarth@webkit.org | 2011-05-16 10:43:22 +0300 (Mon, 16 May 2011) | 10 lines
+
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix Qt build. (Strict PassOwnPtr fix.)
+
+ This patch requires some slightly fancy footwork.
+
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientQt::openInspectorFrontend):
+ (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
+
+------------------------------------------------------------------------
+r86541 | abarth@webkit.org | 2011-05-16 10:51:04 +0300 (Mon, 16 May 2011) | 7 lines
+
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ Sigh. This code is somewhat crazy.
+
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientQt::openInspectorFrontend):
+
+------------------------------------------------------------------------
+r86550 | abarth@webkit.org | 2011-05-16 12:30:40 +0300 (Mon, 16 May 2011) | 13 lines
+
+2011-05-16 Adam Barth <abarth@webkit.org>
+
+ Partial revert of r86537. FullScreenVideoQt.h can't depend on OwnPtr.h
+ because moc_FullScreenVideoQt.cpp fails to include config.h.
+ Apparently, having moc_FullScreenVideoQt.cpp properly include config.h
+ is hard, so we're going back to manual new and delete for this class.
+ Bad times.
+
+ * WebCoreSupport/FullScreenVideoQt.cpp:
+ (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+ (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
+ * WebCoreSupport/FullScreenVideoQt.h:
+
+------------------------------------------------------------------------
+r90915 | andersca@apple.com | 2011-07-13 17:11:49 +0300 (Wed, 13 Jul 2011) | 7 lines
+
+If a compiler has nullptr support, include <cstddef> to get the nullptr_t definition
+https://bugs.webkit.org/show_bug.cgi?id=64429
+
+Include the cstddef which has the nullptr_t typedef according to the C++0x standard.
+
+* wtf/NullPtr.h:
+
+------------------------------------------------------------------------
+r92556 | darin@apple.com | 2011-08-06 23:17:26 +0300 (Sat, 06 Aug 2011) | 17 lines
+
+Fix Timer heap implementation to work with more libraries (other versions of STL)
+https://bugs.webkit.org/show_bug.cgi?id=65782
+
+Reviewed by Anders Carlsson.
+
+No behavior change, so no tests needed. Existing tests pass.
+
+* platform/Timer.cpp: Added TimerHeapPointer and TimerHeapReference class
+alongside the TimerHeapIterator class. Also added a swap function. Also
+added a TimerHeapLessThanFunction class.
+(WebCore::TimerBase::heapDecreaseKey): Pass pointers in to the TimerHeapIterator
+since that's how the class works now. Pass a TimerHeapLessThanFunction object
+instead of letting the library use the < operator directly.
+(WebCore::TimerBase::heapPopMin): Ditto.
+
+* platform/Timer.h: Updated for above changes.
+
+------------------------------------------------------------------------
+r107489 | weinig@apple.com | 2012-02-12 01:10:24 +0200 (Sun, 12 Feb 2012) | 9 lines
+
+Prepare JavaScriptCore to build with libc++
+<rdar://problem/10426673>
+https://bugs.webkit.org/show_bug.cgi?id=78424
+
+Reviewed by Anders Carlsson.
+
+* wtf/NullPtr.cpp:
+* wtf/NullPtr.h:
+libc++ provides std::nullptr emulation, so we don't have to.
+
+------------------------------------------------------------------------
+--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h
++++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h
+@@ -35,10 +35,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #define __has_feature(feature) 0
+ #endif
+
+-#if __has_feature(cxx_nullptr) || (GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && _MSC_VER >= 1600 && !COMPILER(INTEL))
++#include <ciso646>
++
++#if __has_feature(cxx_nullptr) || (GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && _MSC_VER >= 1600 && !COMPILER(INTEL)) || defined(_LIBCPP_VERSION)
+
+ #define HAVE_NULLPTR 1
+
++#include <cstddef>
++
+ #else
+
+ namespace std {
+--- src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp (revision 86528)
++++ src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp (revision 86529)
+@@ -215,7 +215,7 @@
+ {
+ #if ENABLE(XSLT)
+ if (m_sawXSLTransform) {
+- document()->setTransformSource(new TransformSource(m_originalSourceForTransform));
++ document()->setTransformSource(adoptPtr(new TransformSource(m_originalSourceForTransform)));
+ document()->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets.
+ document()->styleSelectorChanged(RecalcStyleImmediately);
+ document()->setParsing(true);
+--- src/3rdparty/webkit/Source/WebCore/platform/Timer.cpp (revision 92555)
++++ src/3rdparty/webkit/Source/WebCore/platform/Timer.cpp (revision 92556)
+@@ -41,6 +41,8 @@
+
+ namespace WebCore {
+
++class TimerHeapReference;
++
+ // Timers are stored in a heap data structure, used to implement a priority queue.
+ // This allows us to efficiently determine which timer needs to fire the soonest.
+ // Then we set a single shared system timer to fire at that time.
+@@ -53,113 +55,141 @@
+ return threadGlobalData().threadTimers().timerHeap();
+ }
+
+-// Class to represent elements in the heap when calling the standard library heap algorithms.
+-// Maintains the m_heapIndex value in the timers themselves, which allows us to do efficient
+-// modification of the heap.
+-class TimerHeapElement {
++// ----------------
++
++class TimerHeapPointer {
+ public:
+- explicit TimerHeapElement(int i)
+- : m_index(i)
+- , m_timer(timerHeap()[m_index])
+- {
+- checkConsistency();
+- }
++ TimerHeapPointer(TimerBase** pointer) : m_pointer(pointer) { }
++ TimerHeapReference operator*() const;
++ TimerBase* operator->() const { return *m_pointer; }
++private:
++ TimerBase** m_pointer;
++};
+
+- TimerHeapElement(const TimerHeapElement&);
+- TimerHeapElement& operator=(const TimerHeapElement&);
+-
+- TimerBase* timer() const { return m_timer; }
+-
+- void checkConsistency() const
+- {
+- ASSERT(m_index >= 0);
+- ASSERT(m_index < static_cast<int>(timerHeap().size()));
+- }
+-
++class TimerHeapReference {
++public:
++ TimerHeapReference(TimerBase*& reference) : m_reference(reference) { }
++ operator TimerBase*() const { return m_reference; }
++ TimerHeapPointer operator&() const { return &m_reference; }
++ TimerHeapReference& operator=(TimerBase*);
++ TimerHeapReference& operator=(TimerHeapReference);
+ private:
+- TimerHeapElement();
+-
+- int m_index;
+- TimerBase* m_timer;
++ TimerBase*& m_reference;
+ };
+
+-inline TimerHeapElement::TimerHeapElement(const TimerHeapElement& o)
+- : m_index(-1), m_timer(o.timer())
++inline TimerHeapReference TimerHeapPointer::operator*() const
+ {
++ return *m_pointer;
+ }
+
+-inline TimerHeapElement& TimerHeapElement::operator=(const TimerHeapElement& o)
++inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer)
+ {
+- TimerBase* t = o.timer();
+- m_timer = t;
+- if (m_index != -1) {
+- checkConsistency();
+- timerHeap()[m_index] = t;
+- t->m_heapIndex = m_index;
+- }
++ m_reference = timer;
++ Vector<TimerBase*>& heap = timerHeap();
++ if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size())
++ timer->m_heapIndex = &m_reference - heap.data();
+ return *this;
+ }
+
+-inline bool operator<(const TimerHeapElement& a, const TimerHeapElement& b)
++inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b)
+ {
+- // The comparisons below are "backwards" because the heap puts the largest
+- // element first and we want the lowest time to be the first one in the heap.
+- double aFireTime = a.timer()->m_nextFireTime;
+- double bFireTime = b.timer()->m_nextFireTime;
+- if (bFireTime != aFireTime)
+- return bFireTime < aFireTime;
+-
+- // We need to look at the difference of the insertion orders instead of comparing the two
+- // outright in case of overflow.
+- unsigned difference = a.timer()->m_heapInsertionOrder - b.timer()->m_heapInsertionOrder;
+- return difference < UINT_MAX / 2;
++ TimerBase* timer = b;
++ return *this = timer;
+ }
+
++inline void swap(TimerHeapReference a, TimerHeapReference b)
++{
++ TimerBase* timerA = a;
++ TimerBase* timerB = b;
++
++ // Invoke the assignment operator, since that takes care of updating m_heapIndex.
++ a = timerB;
++ b = timerA;
++}
++
+ // ----------------
+
+ // Class to represent iterators in the heap when calling the standard library heap algorithms.
+-// Returns TimerHeapElement for elements in the heap rather than the TimerBase pointers themselves.
+-class TimerHeapIterator : public iterator<random_access_iterator_tag, TimerHeapElement, int> {
++// Uses a custom pointer and reference type that update indices for pointers in the heap.
++class TimerHeapIterator : public iterator<random_access_iterator_tag, TimerBase*, ptrdiff_t, TimerHeapPointer, TimerHeapReference> {
+ public:
+- TimerHeapIterator() : m_index(-1) { }
+- TimerHeapIterator(int i) : m_index(i) { checkConsistency(); }
++ explicit TimerHeapIterator(TimerBase** pointer) : m_pointer(pointer) { checkConsistency(); }
+
+- TimerHeapIterator& operator++() { checkConsistency(); ++m_index; checkConsistency(); return *this; }
+- TimerHeapIterator operator++(int) { checkConsistency(); checkConsistency(1); return m_index++; }
++ TimerHeapIterator& operator++() { checkConsistency(); ++m_pointer; checkConsistency(); return *this; }
++ TimerHeapIterator operator++(int) { checkConsistency(1); return TimerHeapIterator(m_pointer++); }
+
+- TimerHeapIterator& operator--() { checkConsistency(); --m_index; checkConsistency(); return *this; }
+- TimerHeapIterator operator--(int) { checkConsistency(); checkConsistency(-1); return m_index--; }
++ TimerHeapIterator& operator--() { checkConsistency(); --m_pointer; checkConsistency(); return *this; }
++ TimerHeapIterator operator--(int) { checkConsistency(-1); return TimerHeapIterator(m_pointer--); }
+
+- TimerHeapIterator& operator+=(int i) { checkConsistency(); m_index += i; checkConsistency(); return *this; }
+- TimerHeapIterator& operator-=(int i) { checkConsistency(); m_index -= i; checkConsistency(); return *this; }
++ TimerHeapIterator& operator+=(ptrdiff_t i) { checkConsistency(); m_pointer += i; checkConsistency(); return *this; }
++ TimerHeapIterator& operator-=(ptrdiff_t i) { checkConsistency(); m_pointer -= i; checkConsistency(); return *this; }
+
+- TimerHeapElement operator*() const { return TimerHeapElement(m_index); }
+- TimerHeapElement operator[](int i) const { return TimerHeapElement(m_index + i); }
++ TimerHeapReference operator*() const { return TimerHeapReference(*m_pointer); }
++ TimerHeapReference operator[](ptrdiff_t i) const { return TimerHeapReference(m_pointer[i]); }
++ TimerBase* operator->() const { return *m_pointer; }
+
+- int index() const { return m_index; }
+-
+- void checkConsistency(int offset = 0) const
++private:
++ void checkConsistency(ptrdiff_t offset = 0) const
+ {
+- ASSERT_UNUSED(offset, m_index + offset >= 0);
+- ASSERT_UNUSED(offset, m_index + offset <= static_cast<int>(timerHeap().size()));
++ ASSERT(m_pointer >= timerHeap().data());
++ ASSERT(m_pointer <= timerHeap().data() + timerHeap().size());
++ ASSERT_UNUSED(offset, m_pointer + offset >= timerHeap().data());
++ ASSERT_UNUSED(offset, m_pointer + offset <= timerHeap().data() + timerHeap().size());
+ }
+
+-private:
+- int m_index;
++ friend bool operator==(TimerHeapIterator, TimerHeapIterator);
++ friend bool operator!=(TimerHeapIterator, TimerHeapIterator);
++ friend bool operator<(TimerHeapIterator, TimerHeapIterator);
++ friend bool operator>(TimerHeapIterator, TimerHeapIterator);
++ friend bool operator<=(TimerHeapIterator, TimerHeapIterator);
++ friend bool operator>=(TimerHeapIterator, TimerHeapIterator);
++
++ friend TimerHeapIterator operator+(TimerHeapIterator, size_t);
++ friend TimerHeapIterator operator+(size_t, TimerHeapIterator);
++
++ friend TimerHeapIterator operator-(TimerHeapIterator, size_t);
++ friend ptrdiff_t operator-(TimerHeapIterator, TimerHeapIterator);
++
++ TimerBase** m_pointer;
+ };
+
+-inline bool operator==(TimerHeapIterator a, TimerHeapIterator b) { return a.index() == b.index(); }
+-inline bool operator!=(TimerHeapIterator a, TimerHeapIterator b) { return a.index() != b.index(); }
+-inline bool operator<(TimerHeapIterator a, TimerHeapIterator b) { return a.index() < b.index(); }
++inline bool operator==(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer == b.m_pointer; }
++inline bool operator!=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer != b.m_pointer; }
++inline bool operator<(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer < b.m_pointer; }
++inline bool operator>(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer > b.m_pointer; }
++inline bool operator<=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer <= b.m_pointer; }
++inline bool operator>=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer >= b.m_pointer; }
+
+-inline TimerHeapIterator operator+(TimerHeapIterator a, int b) { return a.index() + b; }
+-inline TimerHeapIterator operator+(int a, TimerHeapIterator b) { return a + b.index(); }
++inline TimerHeapIterator operator+(TimerHeapIterator a, size_t b) { return TimerHeapIterator(a.m_pointer + b); }
++inline TimerHeapIterator operator+(size_t a, TimerHeapIterator b) { return TimerHeapIterator(a + b.m_pointer); }
+
+-inline TimerHeapIterator operator-(TimerHeapIterator a, int b) { return a.index() - b; }
+-inline int operator-(TimerHeapIterator a, TimerHeapIterator b) { return a.index() - b.index(); }
++inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return TimerHeapIterator(a.m_pointer - b); }
++inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer - b.m_pointer; }
+
+ // ----------------
+
++class TimerHeapLessThanFunction {
++public:
++ bool operator()(TimerBase*, TimerBase*) const;
++};
++
++inline bool TimerHeapLessThanFunction::operator()(TimerBase* a, TimerBase* b) const
++{
++ // The comparisons below are "backwards" because the heap puts the largest
++ // element first and we want the lowest time to be the first one in the heap.
++ double aFireTime = a->m_nextFireTime;
++ double bFireTime = b->m_nextFireTime;
++ if (bFireTime != aFireTime)
++ return bFireTime < aFireTime;
++
++ // We need to look at the difference of the insertion orders instead of comparing the two
++ // outright in case of overflow.
++ unsigned difference = a->m_heapInsertionOrder - b->m_heapInsertionOrder;
++ return difference < numeric_limits<unsigned>::max() / 2;
++}
++
++// ----------------
++
+ TimerBase::TimerBase()
+ : m_nextFireTime(0)
+ , m_repeatInterval(0)
+@@ -225,7 +255,8 @@
+ {
+ ASSERT(m_nextFireTime != 0);
+ checkHeapIndex();
+- push_heap(TimerHeapIterator(0), TimerHeapIterator(m_heapIndex + 1));
++ TimerBase** heapData = timerHeap().data();
++ push_heap(TimerHeapIterator(heapData), TimerHeapIterator(heapData + m_heapIndex + 1), TimerHeapLessThanFunction());
+ checkHeapIndex();
+ }
+
+@@ -274,7 +305,9 @@
+ {
+ ASSERT(this == timerHeap().first());
+ checkHeapIndex();
+- pop_heap(TimerHeapIterator(0), TimerHeapIterator(timerHeap().size()));
++ Vector<TimerBase*>& heap = timerHeap();
++ TimerBase** heapData = heap.data();
++ pop_heap(TimerHeapIterator(heapData), TimerHeapIterator(heapData + heap.size()), TimerHeapLessThanFunction());
+ checkHeapIndex();
+ ASSERT(this == timerHeap().last());
+ }
+--- src/3rdparty/webkit/Source/WebCore/platform/Timer.h (revision 92555)
++++ src/3rdparty/webkit/Source/WebCore/platform/Timer.h (revision 92556)
+@@ -84,9 +84,9 @@
+ ThreadIdentifier m_thread;
+ #endif
+
+- friend class TimerHeapElement;
+ friend class ThreadTimers;
+- friend bool operator<(const TimerHeapElement&, const TimerHeapElement&);
++ friend class TimerHeapLessThanFunction;
++ friend class TimerHeapReference;
+ };
+
+ template <typename TimerFiredClass> class Timer : public TimerBase {
+--- src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp (revision 86531)
++++ src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp (revision 86532)
+@@ -944,7 +944,7 @@
+
+ GraphicsLayerQt::GraphicsLayerQt(GraphicsLayerClient* client)
+ : GraphicsLayer(client)
+- , m_impl(PassOwnPtr<GraphicsLayerQtImpl>(new GraphicsLayerQtImpl(this)))
++ , m_impl(adoptPtr(new GraphicsLayerQtImpl(this)))
+ {
+ }
+
+@@ -955,7 +955,7 @@
+ // This is the hook for WebCore compositor to know that Qt implements compositing with GraphicsLayerQt.
+ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
+ {
+- return new GraphicsLayerQt(client);
++ return adoptPtr(new GraphicsLayerQt(client));
+ }
+
+ /* \reimp (GraphicsLayer.h): The current size might change, thus we need to update the whole display.
+
+--- src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h
++++ src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h
+@@ -38,7 +38,7 @@
+ #include <wtf/OwnPtr.h>
+ #include <wtf/text/StringHash.h>
+
+-#if OS(SOLARIS)
++#if OS(FREEBSD) || OS(SOLARIS)
+ #include <sys/types.h> // For time_t structure.
+ #endif
+
+--- src/3rdparty/webkit/Source/WebCore/page/Page.h
++++ src/3rdparty/webkit/Source/WebCore/page/Page.h
+@@ -29,7 +29,7 @@
+ #include <wtf/HashSet.h>
+ #include <wtf/Noncopyable.h>
+
+-#if OS(SOLARIS)
++#if OS(FREEBSD) || OS(SOLARIS)
+ #include <sys/time.h> // For time_t structure.
+ #endif
+
+--- src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h
++++ src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h
+@@ -35,7 +35,7 @@
+ #include <wtf/PassOwnPtr.h>
+ #include <wtf/RefPtr.h>
+
+-#if OS(SOLARIS)
++#if OS(FREEBSD) || OS(SOLARIS)
+ #include <sys/time.h> // For time_t structure.
+ #endif
+
+--- src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp (revision 86529)
++++ src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp (revision 86530)
+@@ -235,7 +235,7 @@
+ resetConnections();
+ QNetworkReply* reply = m_reply;
+ m_reply = 0;
+- m_sniffer = 0;
++ m_sniffer = nullptr;
+
+ reply->setParent(0);
+ return reply;
+@@ -285,7 +285,7 @@
+
+ Q_ASSERT(!m_sniffer);
+
+- m_sniffer = new QtMIMETypeSniffer(m_reply, m_advertisedMIMEType, isSupportedImageType);
++ m_sniffer = adoptPtr(new QtMIMETypeSniffer(m_reply, m_advertisedMIMEType, isSupportedImageType));
+
+ if (m_sniffer->isFinished()) {
+ receiveSniffedMIMEType();
+@@ -300,7 +300,7 @@
+ Q_ASSERT(m_sniffer);
+
+ m_sniffedMIMEType = m_sniffer->mimeType();
+- m_sniffer = 0;
++ m_sniffer = nullptr;
+
+ emitMetaDataChanged();
+ }
+@@ -417,7 +417,7 @@
+ return 0;
+
+ QNetworkReply* reply = m_replyWrapper->release();
+- m_replyWrapper = 0;
++ m_replyWrapper = nullptr;
+ return reply;
+ }
+
+@@ -440,12 +440,12 @@
+
+ ResourceHandleClient* client = m_resourceHandle->client();
+ if (!client) {
+- m_replyWrapper = 0;
++ m_replyWrapper = nullptr;
+ return;
+ }
+
+ if (m_replyWrapper->wasRedirected()) {
+- m_replyWrapper = 0;
++ m_replyWrapper = nullptr;
+ m_queue.push(&QNetworkReplyHandler::start);
+ return;
+ }
+@@ -465,7 +465,7 @@
+ }
+ }
+
+- m_replyWrapper = 0;
++ m_replyWrapper = nullptr;
+ }
+
+ void QNetworkReplyHandler::sendResponseIfNeeded()
+@@ -539,7 +539,7 @@
+ newUrl.toString(),
+ QCoreApplication::translate("QWebPage", "Redirection limit reached"));
+ client->didFail(m_resourceHandle, error);
+- m_replyWrapper = 0;
++ m_replyWrapper = nullptr;
+ return;
+ }
+
+@@ -660,7 +660,7 @@
+ if (!reply)
+ return;
+
+- m_replyWrapper = new QNetworkReplyWrapper(&m_queue, reply, m_resourceHandle->shouldContentSniff() && d->m_context->mimeSniffingEnabled(), this);
++ m_replyWrapper = adoptPtr(new QNetworkReplyWrapper(&m_queue, reply, m_resourceHandle->shouldContentSniff() && d->m_context->mimeSniffingEnabled(), this));
+
+ if (m_loadType == SynchronousLoad) {
+ m_replyWrapper->synchronousLoad();
+===================================================================
+--- src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextCodecQt.cpp (revision 86530)
++++ src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextCodecQt.cpp (revision 86531)
+@@ -64,7 +64,7 @@
+
+ static PassOwnPtr<TextCodec> newTextCodecQt(const TextEncoding& encoding, const void*)
+ {
+- return new TextCodecQt(encoding);
++ return adoptPtr(new TextCodecQt(encoding));
+ }
+
+ void TextCodecQt::registerCodecs(TextCodecRegistrar registrar)
+
+--- src/3rdparty/webkit/Source/WebKit/qt/Api/qgraphicswebview.cpp (revision 86532)
++++ src/3rdparty/webkit/Source/WebKit/qt/Api/qgraphicswebview.cpp (revision 86533)
+@@ -473,7 +473,7 @@
+ return;
+
+ page->d->view.clear();
+- page->d->client = 0;
++ page->d->client = nullptr;
+
+ // if the page was created by us, we own it and need to
+ // destroy it as well.
+@@ -506,7 +506,7 @@
+ if (!d->page)
+ return;
+
+- d->page->d->client = new PageClientQGraphicsWidget(this, page); // set the page client
++ d->page->d->client = adoptPtr(new PageClientQGraphicsWidget(this, page));
+
+ if (d->overlay())
+ d->overlay()->prepareGraphicsItemGeometryChange();
+--- src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp (revision 86532)
++++ src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp (revision 86550)
+@@ -1319,7 +1319,7 @@
+ void QWebPagePrivate::adjustPointForClicking(QGraphicsSceneMouseEvent* ev)
+ {
+ QtPlatformPlugin platformPlugin;
+- QWebTouchModifier* touchModifier = platformPlugin.createTouchModifier();
++ OwnPtr<QWebTouchModifier> touchModifier = platformPlugin.createTouchModifier();
+ if (!touchModifier)
+ return;
+
+@@ -1328,8 +1328,7 @@
+ unsigned bottomPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Down);
+ unsigned leftPadding = touchModifier->hitTestPaddingForTouch(QWebTouchModifier::Left);
+
+- delete touchModifier;
+- touchModifier = 0;
++ touchModifier = nullptr;
+
+ if (!topPadding && !rightPadding && !bottomPadding && !leftPadding)
+ return;
+@@ -2044,7 +2044,7 @@
+ }
+
+ if (view)
+- d->client = new PageClientQWidget(view, this);
++ d->client = adoptPtr(new PageClientQWidget(view, this));
+ }
+
+ /*!
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.h (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.h (revision 86550)
+@@ -22,6 +22,8 @@
+
+ #include "PopupMenu.h"
+ #include <QObject>
++#include <wtf/OwnPtr.h>
++#include <wtf/PassOwnPtr.h>
+
+ class QWebSelectData;
+ class QWebSelectMethod;
+@@ -49,8 +51,8 @@
+
+ private:
+ PopupMenuClient* m_popupClient;
+- QWebSelectMethod* m_popup;
+- QWebSelectData* m_selectData;
++ OwnPtr<QWebSelectMethod> m_popup;
++ OwnPtr<QWebSelectData> m_selectData;
+ const ChromeClientQt* m_chromeClient;
+ };
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h (revision 86550)
+@@ -22,6 +22,7 @@
+ #define QtPlatformPlugin_h
+
+ #include <QPluginLoader>
++#include <wtf/PassOwnPtr.h>
+
+ class QWebSelectMethod;
+ class QWebKitPlatformPlugin;
+@@ -37,15 +38,20 @@
+
+ class QtPlatformPlugin {
+ public:
+- QtPlatformPlugin() : m_loaded(false), m_plugin(0) {}
++ QtPlatformPlugin()
++ : m_loaded(false)
++ , m_plugin(0)
++ {
++ }
++
+ ~QtPlatformPlugin();
+
+- QWebSelectMethod* createSelectInputMethod();
+- QWebNotificationPresenter* createNotificationPresenter();
+- QWebHapticFeedbackPlayer* createHapticFeedbackPlayer();
+- QWebTouchModifier* createTouchModifier();
++ PassOwnPtr<QWebSelectMethod> createSelectInputMethod();
++ PassOwnPtr<QWebNotificationPresenter> createNotificationPresenter();
++ PassOwnPtr<QWebHapticFeedbackPlayer> createHapticFeedbackPlayer();
++ PassOwnPtr<QWebTouchModifier> createTouchModifier();
+ #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
+- QWebFullScreenVideoHandler* createFullScreenVideoHandler();
++ PassOwnPtr<QWebFullScreenVideoHandler> createFullScreenVideoHandler();
+ #endif
+
+ QWebKitPlatformPlugin* plugin();
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp (revision 86550)
+@@ -696,18 +696,18 @@
+ }
+ #endif
+
+-QWebSelectMethod* ChromeClientQt::createSelectPopup() const
++PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const
+ {
+- QWebSelectMethod* result = m_platformPlugin.createSelectInputMethod();
++ OwnPtr<QWebSelectMethod> result = m_platformPlugin.createSelectInputMethod();
+ if (result)
+- return result;
++ return result.release();
+
+ #if defined(Q_WS_MAEMO_5)
+- return new QtMaemoWebPopup;
++ return adoptPtr(new QtMaemoWebPopup);
+ #elif !defined(QT_NO_COMBOBOX)
+- return new QtFallbackWebPopup(this);
++ return adoptPtr(new QtFallbackWebPopup(this));
+ #else
+- return 0;
++ return nullptr;
+ #endif
+ }
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp (revision 86550)
+@@ -82,8 +82,6 @@
+
+ PopupMenuQt::PopupMenuQt(PopupMenuClient* client, const ChromeClientQt* chromeClient)
+ : m_popupClient(client)
+- , m_popup(0)
+- , m_selectData(0)
+ , m_chromeClient(chromeClient)
+ {
+ }
+@@ -90,8 +88,6 @@
+
+ PopupMenuQt::~PopupMenuQt()
+ {
+- delete m_selectData;
+- delete m_popup;
+ }
+
+ void PopupMenuQt::disconnectClient()
+@@ -107,11 +103,11 @@
+
+ if (!m_popup) {
+ m_popup = m_chromeClient->createSelectPopup();
+- connect(m_popup, SIGNAL(didHide()), this, SLOT(didHide()));
+- connect(m_popup, SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
++ connect(m_popup.get(), SIGNAL(didHide()), this, SLOT(didHide()));
++ connect(m_popup.get(), SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
+ }
+
+- if (QtFallbackWebPopup* fallback = qobject_cast<QtFallbackWebPopup*>(m_popup)) {
++ if (QtFallbackWebPopup* fallback = qobject_cast<QtFallbackWebPopup*>(m_popup.get())) {
+ QRect geometry(rect);
+ geometry.moveTopLeft(view->contentsToWindow(rect.location()));
+ fallback->setGeometry(geometry);
+@@ -118,10 +114,8 @@
+ fallback->setFont(m_popupClient->menuStyle().font().font());
+ }
+
+- if (m_selectData)
+- delete m_selectData;
+- m_selectData = new SelectData(m_popupClient);
+- m_popup->show(*m_selectData);
++ m_selectData = adoptPtr(new SelectData(m_popupClient));
++ m_popup->show(*m_selectData.get());
+ #endif
+ }
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp (revision 86550)
+@@ -136,7 +136,7 @@
+ Q_ASSERT(m_chromeClient);
+
+ #if USE(QT_MULTIMEDIA)
+- m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler();
++ m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler().leakPtr();
+ if (!m_FullScreenVideoHandler)
+ m_FullScreenVideoHandler = new DefaultFullScreenVideoHandler;
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp (revision 86550)
+@@ -102,36 +102,35 @@
+ return m_plugin;
+ }
+
+-QWebSelectMethod* QtPlatformPlugin::createSelectInputMethod()
++PassOwnPtr<QWebSelectMethod> QtPlatformPlugin::createSelectInputMethod()
+ {
+ QWebKitPlatformPlugin* p = plugin();
+- return p ? static_cast<QWebSelectMethod*>(p->createExtension(QWebKitPlatformPlugin::MultipleSelections)) : 0;
++ return adoptPtr(p ? static_cast<QWebSelectMethod*>(p->createExtension(QWebKitPlatformPlugin::MultipleSelections)) : 0);
+ }
+
+-
+-QWebNotificationPresenter* QtPlatformPlugin::createNotificationPresenter()
++PassOwnPtr<QWebNotificationPresenter> QtPlatformPlugin::createNotificationPresenter()
+ {
+ QWebKitPlatformPlugin* p = plugin();
+- return p ? static_cast<QWebNotificationPresenter*>(p->createExtension(QWebKitPlatformPlugin::Notifications)) : 0;
++ return adoptPtr(p ? static_cast<QWebNotificationPresenter*>(p->createExtension(QWebKitPlatformPlugin::Notifications)) : 0);
+ }
+
+-QWebHapticFeedbackPlayer* QtPlatformPlugin::createHapticFeedbackPlayer()
++PassOwnPtr<QWebHapticFeedbackPlayer> QtPlatformPlugin::createHapticFeedbackPlayer()
+ {
+ QWebKitPlatformPlugin* p = plugin();
+- return p ? static_cast<QWebHapticFeedbackPlayer*>(p->createExtension(QWebKitPlatformPlugin::Haptics)) : 0;
++ return adoptPtr(p ? static_cast<QWebHapticFeedbackPlayer*>(p->createExtension(QWebKitPlatformPlugin::Haptics)) : 0);
+ }
+
+-QWebTouchModifier* QtPlatformPlugin::createTouchModifier()
++PassOwnPtr<QWebTouchModifier> QtPlatformPlugin::createTouchModifier()
+ {
+ QWebKitPlatformPlugin* p = plugin();
+- return p ? static_cast<QWebTouchModifier*>(p->createExtension(QWebKitPlatformPlugin::TouchInteraction)) : 0;
++ return adoptPtr(p ? static_cast<QWebTouchModifier*>(p->createExtension(QWebKitPlatformPlugin::TouchInteraction)) : 0);
+ }
+
+ #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
+-QWebFullScreenVideoHandler* QtPlatformPlugin::createFullScreenVideoHandler()
++PassOwnPtr<QWebFullScreenVideoHandler> QtPlatformPlugin::createFullScreenVideoHandler()
+ {
+ QWebKitPlatformPlugin* p = plugin();
+- return p ? static_cast<QWebFullScreenVideoHandler*>(p->createExtension(QWebKitPlatformPlugin::FullScreenVideoPlayer)) : 0;
++ return adoptPtr(p ? static_cast<QWebFullScreenVideoHandler*>(p->createExtension(QWebKitPlatformPlugin::FullScreenVideoPlayer)) : 0);
+ }
+ #endif
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp (revision 86550)
+@@ -203,8 +203,9 @@
+ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* inspectorController)
+ {
+ #if ENABLE(INSPECTOR)
+- QWebView* inspectorView = new QWebView;
+- InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView);
++ OwnPtr<QWebView> inspectorView = adoptPtr(new QWebView);
++ // FIXME: Where does inspectorPage get deleted?
++ InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView.get());
+ inspectorView->setPage(inspectorPage);
+
+ QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector();
+@@ -229,11 +230,14 @@
+ inspectorPage->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects);
+ #endif
+ inspectorView->page()->mainFrame()->load(inspectorUrl);
+- m_inspectedWebPage->d->inspectorFrontend = inspectorView;
+- inspector->d->setFrontend(inspectorView);
++ m_inspectedWebPage->d->inspectorFrontend = inspectorView.get();
++ inspector->d->setFrontend(inspectorView.get());
+
+- m_frontendClient = new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView, this);
+- inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(m_frontendClient);
++ // Is 'controller' the same object as 'inspectorController' (which appears to be unused)?
++ InspectorController* controller = inspectorView->page()->d->page->inspectorController();
++ OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), this));
++ m_frontendClient = frontendClient.get();
++ controller->setInspectorFrontendClient(frontendClient.release());
+ m_frontendWebPage = inspectorPage;
+ #endif
+ }
+@@ -297,7 +301,7 @@
+
+ #if ENABLE(INSPECTOR)
+ InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient)
+- : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, new InspectorFrontendSettingsQt())
++ : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, adoptPtr(new InspectorFrontendSettingsQt()))
+ , m_inspectedWebPage(inspectedWebPage)
+ , m_inspectorView(inspectorView)
+ , m_destroyingInspectorView(false)
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp (revision 86550)
+@@ -73,9 +73,9 @@
+ #if ENABLE(NOTIFICATIONS)
+
+ #ifndef QT_NO_SYSTEMTRAYICON
+- m_notificationIcon = 0;
++ m_notificationIcon = nullptr;
+ #endif
+- m_presenter = 0;
++ m_presenter = nullptr;
+ #endif
+ }
+
+@@ -211,9 +211,9 @@
+ QPixmap pixmap;
+ if (bytes.length() && pixmap.loadFromData(bytes)) {
+ QIcon icon(pixmap);
+- wrapper->m_notificationIcon = new QSystemTrayIcon(icon);
++ wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon(icon));
+ } else
+- wrapper->m_notificationIcon = new QSystemTrayIcon();
++ wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon());
+ #endif
+ }
+
+--- src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h (revision 86536)
++++ src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h (revision 86550)
+@@ -34,6 +34,7 @@
+ #include "KURL.h"
+ #include "PlatformString.h"
+ #include "QtPlatformPlugin.h"
++#include <wtf/PassOwnPtr.h>
+ #include <wtf/RefCounted.h>
+
+ QT_BEGIN_NAMESPACE
+@@ -189,7 +190,7 @@
+ virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+ virtual void populateVisitedLinks();
+
+- QWebSelectMethod* createSelectPopup() const;
++ PassOwnPtr<QWebSelectMethod> createSelectPopup() const;
+
+ virtual void dispatchViewportDataDidChange(const ViewportArguments&) const;
+
+--- src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp (revision 86536)
++++ src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp (revision 86550)
+@@ -950,7 +950,7 @@ bool PluginView::platformStart()
+
+ #if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
+ if (shouldUseAcceleratedCompositing()) {
+- m_platformLayer = new PluginGraphicsLayerQt(this);
++ m_platformLayer = adoptPtr(new PluginGraphicsLayerQt(this));
+ // Trigger layer computation in RenderLayerCompositor
+ m_element->setNeedsStyleRecalc(SyntheticStyleChange);
+ }
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__jit__JITStubs.cpp b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__jit__JITStubs.cpp
new file mode 100644
index 000000000000..093c17420874
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__jit__JITStubs.cpp
@@ -0,0 +1,11 @@
+--- ./src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp.orig 2012-12-12 20:18:37.000000000 +0100
++++ ./src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp 2012-12-17 02:10:50.513375070 +0100
+@@ -80,7 +80,7 @@
+ #define THUMB_FUNC_PARAM(name)
+ #endif
+
+-#if OS(LINUX) && CPU(X86_64)
++#if (OS(LINUX) || OS(FREEBSD)) && CPU(X86_64)
+ #define SYMBOL_STRING_RELOCATION(name) #name "@plt"
+ #else
+ #define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name)
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__Collector.cpp b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__Collector.cpp
new file mode 100644
index 000000000000..95e112ac20eb
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__Collector.cpp
@@ -0,0 +1,38 @@
+From 952b046ba5bc99986f747729681914e21f8fb8b0 Mon Sep 17 00:00:00 2001
+From: "Bradley T. Hughes" <bradley.hughes@nokia.com>
+Date: Wed, 30 May 2012 11:49:40 +0200
+Subject: [PATCH] Compile with clang's libc++
+
+An overload for std::swap() what works with std::pair<A,B> is included
+in libc++ (but not libstdc++). Avoid ambiguity in HashTable.h by
+omitting the version there and using the std::swap() version.
+
+Collector.cpp needs to include pthread.h directly, as it is not
+automatically included by libc++'s headers (libstdc++ does pull in
+pthread.h though).
+
+Cherry-picked from qtscript/48baeef0766ba145d26d374561e152b40245f3b8.
+
+Change-Id: I4dc88638ce8553bb97037b841fc6cc5e8c9911e2
+Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+---
+ src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp | 2 ++
+ src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h | 4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+index 6af1784..711949b 100644
+--- src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
++++ src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+@@ -52,6 +52,8 @@
+ #include <mach/task.h>
+ #include <mach/thread_act.h>
+ #include <mach/vm_map.h>
++// clang's libc++ headers does not pull in pthread.h (but libstdc++ does)
++#include <pthread.h>
+
+ #elif OS(WINDOWS)
+
+--
+1.8.4
+
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__JSValue.h b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__JSValue.h
new file mode 100644
index 000000000000..ab3985eaaf8a
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__runtime__JSValue.h
@@ -0,0 +1,26 @@
+--- ./src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h.orig 2012-12-12 20:18:36.000000000 +0100
++++ ./src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h 2012-12-17 02:13:05.073285539 +0100
+@@ -491,7 +491,11 @@
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
++#if defined(__sparc64__)
++ u.asBits.payload = reinterpret_cast<int64_t>(ptr);
++#else
+ u.asBits.payload = reinterpret_cast<int32_t>(ptr);
++#endif
+ #if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+ #endif
+@@ -503,7 +507,11 @@
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
++#if defined(__sparc64__)
++ u.asBits.payload = reinterpret_cast<int64_t>(const_cast<JSCell*>(ptr));
++#else
+ u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
++#endif
+ #if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+ #endif
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__HashTable.h b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__HashTable.h
new file mode 100644
index 000000000000..20f5b8c74a99
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__HashTable.h
@@ -0,0 +1,40 @@
+From 952b046ba5bc99986f747729681914e21f8fb8b0 Mon Sep 17 00:00:00 2001
+From: "Bradley T. Hughes" <bradley.hughes@nokia.com>
+Date: Wed, 30 May 2012 11:49:40 +0200
+Subject: [PATCH] Compile with clang's libc++
+
+An overload for std::swap() what works with std::pair<A,B> is included
+in libc++ (but not libstdc++). Avoid ambiguity in HashTable.h by
+omitting the version there and using the std::swap() version.
+
+Collector.cpp needs to include pthread.h directly, as it is not
+automatically included by libc++'s headers (libstdc++ does pull in
+pthread.h though).
+
+Cherry-picked from qtscript/48baeef0766ba145d26d374561e152b40245f3b8.
+
+Change-Id: I4dc88638ce8553bb97037b841fc6cc5e8c9911e2
+Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+---
+ src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp | 2 ++
+ src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h | 4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
+index bea9daa..42a9233 100644
+--- src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
++++ src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
+@@ -257,8 +257,8 @@ namespace WTF {
+
+ using std::swap;
+
+-#if !COMPILER(MSVC) && !OS(QNX)
+- // The Dinkumware C++ library (used by MSVC and QNX) has a swap for pairs defined.
++#if !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION)
++ // The Dinkumware C++ library (used by MSVC and QNX) and clang's libc++ have a swap for pairs defined.
+
+ // swap pairs by component, in case of pair members that specialize swap
+ template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b)
+--
+1.8.4
+
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__Threading.h b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__Threading.h
new file mode 100644
index 000000000000..524827951209
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__javascriptcore__JavaScriptCore__wtf__Threading.h
@@ -0,0 +1,91 @@
+From 0de22e80ac645afc3793419300d6271d95809196 Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Tue, 11 Jun 2013 19:25:08 +0300
+Subject: [PATCH] Bring in WebKit revisions 139553 and 139921.
+
+They are primarily useful for getting rid of some libstdc++-specific
+includes which break the build with libc++, and also for simplifying the
+code and removing a Darwin-specific code path.
+
+r139553 by ossy@webkit.org:
+ Use sync_add_and_fetch instead of gnu_cxx::exchange_and_add
+ https://bugs.webkit.org/show_bug.cgi?id=106729
+
+ After r139514 we need atomicIncrement(int64_t volatile*) for all
+ platform. Now the GCC implementation of atomicIncrement() is based on
+ gnu_cxx::exchange_and_add, which doesn't support int64_t type, but
+ sync_add_and_fetch does.
+
+ Reviewed by Benjamin Poulain.
+
+r139921 by benjamin@webkit.org:
+ Use GCC's implementation of atomicIncrement/Decrement on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=106976
+
+ Reviewed by Filip Pizlo.
+
+ wtf/Atomics.h: GCC and LLVM have builtin for atomic ADD and SUB:
+ sync_add_and_fetch, sync_sub_and_fetch.
+
+ Using them let the compiler just generate the atomic operations inline
+ instead of generating a function call to LibC. It also simplify the
+ code a bit.
+
+Cherry-picked from qtscript/184fc178f4c753727445694c4830c250f53da588.
+
+Change-Id: Id785e35944682691725947e0f329668d17ff6903
+Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+---
+ .../javascriptcore/JavaScriptCore/wtf/Threading.h | 18 ++----------------
+ 1 file changed, 2 insertions(+), 16 deletions(-)
+
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 8b76c0f..b3ea7d2 100644
+--- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -71,18 +71,10 @@
+
+ #if OS(WINDOWS) && !OS(WINCE)
+ #include <windows.h>
+-#elif OS(DARWIN)
+-#include <libkern/OSAtomic.h>
+ #elif OS(ANDROID)
+ #include <cutils/atomic.h>
+ #elif OS(QNX)
+ #include <atomic.h>
+-#elif COMPILER(GCC) && !OS(SYMBIAN)
+-#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
+-#include <ext/atomicity.h>
+-#else
+-#include <bits/atomicity.h>
+-#endif
+ #endif
+
+ #if USE(PTHREADS)
+@@ -230,12 +222,6 @@ inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r
+ inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
+ #endif
+
+-#elif OS(DARWIN)
+-#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
+-
+-inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
+-inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
+-
+ #elif OS(ANDROID)
+
+ inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); }
+@@ -250,8 +236,8 @@ inline int atomicDecrement(int volatile* addend) { return (int) atomic_sub_value
+ #elif COMPILER(GCC) && !CPU(SPARC64) && !OS(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+ #define WTF_USE_LOCKFREE_THREADSAFESHARED 1
+
+-inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
+-inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
++inline int atomicIncrement(int volatile* addend) { return __sync_add_and_fetch(addend, 1); }
++inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); }
+
+ #endif
+
+--
+1.8.4
+
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__runtime__JSValueInlineMethods.h b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__runtime__JSValueInlineMethods.h
new file mode 100644
index 000000000000..e2b4f74d54ac
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__runtime__JSValueInlineMethods.h
@@ -0,0 +1,26 @@
+--- ./src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h.orig 2011-12-08 06:06:02.000000000 +0100
++++ ./src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h 2012-01-08 17:18:52.511348683 +0100
+@@ -227,7 +227,11 @@
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
++#if defined(__sparc64__)
++ u.asBits.payload = reinterpret_cast<int64_t>(ptr);
++#else
+ u.asBits.payload = reinterpret_cast<int32_t>(ptr);
++#endif
+ #if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+ #endif
+@@ -239,7 +243,11 @@
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
++#if defined(__sparc64__)
++ u.asBits.payload = reinterpret_cast<int64_t>(const_cast<JSCell*>(ptr));
++#else
+ u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
++#endif
+ #if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+ #endif
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Atomics.h b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Atomics.h
new file mode 100644
index 000000000000..3e08330c3868
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Atomics.h
@@ -0,0 +1,92 @@
+From e3c44790065894f4e7f98ab097fce22c5bcbbd0a Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Tue, 2 Jul 2013 13:48:28 +0300
+Subject: [PATCH] Bring in WebKit revisions 139553 and 139921.
+
+They are primarily useful for getting rid of some libstdc++-specific
+includes which break the build with libc++, and also for simplifying the
+code and removing a Darwin-specific code path.
+
+r139553 by ossy@webkit.org:
+ Use sync_add_and_fetch instead of gnu_cxx::exchange_and_add
+ https://bugs.webkit.org/show_bug.cgi?id=106729
+
+ After r139514 we need atomicIncrement(int64_t volatile*) for all
+ platform. Now the GCC implementation of atomicIncrement() is based on
+ gnu_cxx::exchange_and_add, which doesn't support int64_t type, but
+ sync_add_and_fetch does.
+
+ Reviewed by Benjamin Poulain.
+
+r139921 by benjamin@webkit.org:
+ Use GCC's implementation of atomicIncrement/Decrement on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=106976
+
+ Reviewed by Filip Pizlo.
+
+ wtf/Atomics.h: GCC and LLVM have builtin for atomic ADD and SUB:
+ sync_add_and_fetch, sync_sub_and_fetch.
+
+ Using them let the compiler just generate the atomic operations inline
+ instead of generating a function call to LibC. It also simplify the
+ code a bit.
+
+Cherry-picked from qtwebkit/0baf197 and qtwebkit/801fc96. I'm cherry-picking
+both revisions together to match what was done in 0de22e80.
+
+Change-Id: Ie5c1067980662ff04e8e36d8cf6e9459b7c46aab
+Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
+---
+ .../webkit/Source/JavaScriptCore/wtf/Atomics.h | 18 ++----------------
+ 1 file changed, 2 insertions(+), 16 deletions(-)
+
+diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h
+index bce5fba..acf0e5a 100644
+--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h
++++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h
+@@ -63,18 +63,10 @@
+
+ #if OS(WINDOWS)
+ #include <windows.h>
+-#elif OS(DARWIN)
+-#include <libkern/OSAtomic.h>
+ #elif OS(ANDROID)
+ #include <cutils/atomic.h>
+ #elif OS(QNX)
+ #include <atomic.h>
+-#elif COMPILER(GCC) && !OS(SYMBIAN)
+-#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
+-#include <ext/atomicity.h>
+-#else
+-#include <bits/atomicity.h>
+-#endif
+ #endif
+
+ namespace WTF {
+@@ -90,12 +82,6 @@ inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r
+ inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
+ #endif
+
+-#elif OS(DARWIN)
+-#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+-
+-inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
+-inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
+-
+ #elif OS(ANDROID)
+
+ inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); }
+@@ -109,8 +95,8 @@ inline int atomicDecrement(int volatile* addend) { return (int) atomic_sub_value
+ #elif COMPILER(GCC) && !CPU(SPARC64) && !OS(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+ #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+-inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
+-inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
++inline int atomicIncrement(int volatile* addend) { return __sync_add_and_fetch(addend, 1); }
++inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); }
+
+ #endif
+
+--
+1.8.4
+
diff --git a/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__WebKit__qt__QtWebKit.pro b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__WebKit__qt__QtWebKit.pro
new file mode 100644
index 000000000000..994adda65917
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__WebKit__qt__QtWebKit.pro
@@ -0,0 +1,11 @@
+--- ./src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro.orig 2011-12-08 06:06:03.000000000 +0100
++++ ./src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro 2012-01-08 17:18:52.521346053 +0100
+@@ -84,7 +84,7 @@
+ }
+
+ moduleFile=$$PWD/qt_webkit_version.pri
+-isEmpty(QT_BUILD_TREE):include($$moduleFile)
++include($$moduleFile)
+ VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION}
+
+ symbian {
diff --git a/converters/wkhtmltopdf/pkg-descr b/converters/wkhtmltopdf/pkg-descr
index 7b26c3b8f482..94b8ef098ebb 100644
--- a/converters/wkhtmltopdf/pkg-descr
+++ b/converters/wkhtmltopdf/pkg-descr
@@ -15,4 +15,4 @@ Features of the static version:
For proper functionality you may need to install the following port(s):
x11-fonts/webfonts
-WWW: http://code.google.com/p/wkhtmltopdf/
+WWW: https://github.com/wkhtmltopdf/wkhtmltopdf
diff --git a/converters/wkhtmltopdf/pkg-plist b/converters/wkhtmltopdf/pkg-plist
index d43fa508f0e2..fb1fe078bbd5 100644
--- a/converters/wkhtmltopdf/pkg-plist
+++ b/converters/wkhtmltopdf/pkg-plist
@@ -16,6 +16,6 @@ include/wkhtmltox/utilities.hh
include/wkhtmltox/websettings.hh
lib/libwkhtmltox.so
lib/libwkhtmltox.so.0
-lib/libwkhtmltox.so.0.10
-lib/libwkhtmltox.so.0.10.0
+lib/libwkhtmltox.so.0.12
+lib/libwkhtmltox.so.0.12.0
@dirrm include/wkhtmltox