diff options
Diffstat (limited to 'Source/WebCore')
35 files changed, 45 insertions, 111 deletions
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 2983a2d92..2cddda42c 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -1565,7 +1565,7 @@ void FrameView::adjustMediaTypeForPrinting(bool printing) if (printing) { if (m_mediaTypeWhenNotPrinting.isNull()) m_mediaTypeWhenNotPrinting = mediaType(); - setMediaType("print"); + setMediaType("print"); } else { if (!m_mediaTypeWhenNotPrinting.isNull()) setMediaType(m_mediaTypeWhenNotPrinting); diff --git a/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp b/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp index 9b0fe49fb..6340107aa 100644 --- a/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp +++ b/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp @@ -241,7 +241,7 @@ ALWAYS_INLINE void setDestinationPixels(Uint8ClampedArray* image, int& pixel, fl image->set(pixel++, maxAlpha); } -#if defined(_MSC_VER) && (_MSC_VER >= 1700) +#if COMPILER(MSVC) // Incorrectly diagnosing overwrite of stack in |totals| due to |preserveAlphaValues|. #pragma warning(push) #pragma warning(disable: 4789) @@ -385,7 +385,7 @@ void FEConvolveMatrix::fastSetOuterPixels(PaintingData& paintingData, int x1, in } } -#if defined(_MSC_VER) && (_MSC_VER >= 1700) +#if COMPILER(MSVC) #pragma warning(pop) // Disable of 4789 #endif diff --git a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp index 1222196dd..7be647748 100644 --- a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp @@ -29,7 +29,6 @@ #include "FontDescription.h" #include "FontPlatformData.h" #include <utility> -#include <wtf/ListHashSet.h> #include <wtf/StdLibExtras.h> #include <wtf/text/StringHash.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp b/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp index 1ead333ce..47bcd8df6 100644 --- a/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCascadeQt.cpp @@ -24,9 +24,7 @@ #include "Font.h" -#include "AffineTransform.h" #include "FontDescription.h" -#include "FontSelector.h" #include "GlyphBuffer.h" #include "Gradient.h" #include "GraphicsContext.h" @@ -264,8 +262,13 @@ void FontCascade::initFormatForTextLayout(QTextLayout* layout, const TextRun& ru if (isSmallCaps()) range.format.setFontCapitalization(QFont::SmallCaps); - if (range.format.propertyCount() && range.length) + if (range.format.propertyCount() && range.length) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + layout->setFormats(QVector<QTextLayout::FormatRange>() << range); +#else layout->setAdditionalFormats(QList<QTextLayout::FormatRange>() << range); +#endif + } } bool FontCascade::canReturnFallbackFontsForComplexText() diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h index 31d169f62..c2d0c9fa2 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h @@ -22,7 +22,6 @@ #ifndef FontCustomPlatformData_h #define FontCustomPlatformData_h -#include "TextFlags.h" #include <QRawFont> #include <wtf/FastMalloc.h> #include <wtf/Forward.h> diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index bc65c0511..908d881f1 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -24,7 +24,6 @@ #include "FontPlatformData.h" #include "SharedBuffer.h" -#include "WOFFFileFormat.h" #include <QStringList> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h index c8375ebcd..8c1327e13 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h @@ -29,7 +29,6 @@ #include <QFont> #include <QHash> #include <QRawFont> -#include <wtf/Forward.h> #include <wtf/RefCounted.h> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/qt/GradientQt.cpp b/Source/WebCore/platform/graphics/qt/GradientQt.cpp index 72bb00938..3412cfadd 100644 --- a/Source/WebCore/platform/graphics/qt/GradientQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GradientQt.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "Gradient.h" -#include "CSSParser.h" #include "GraphicsContext.h" #include <QGradient> diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 7f2f07b60..fe63ff7bb 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -24,16 +24,13 @@ #include "GraphicsSurface.h" #include "HostWindow.h" #include "ImageBuffer.h" -#include "ImageData.h" #include "NativeImageQt.h" -#include "NotImplemented.h" #include "QWebPageClient.h" #include "SharedBuffer.h" #include "TextureMapperPlatformLayer.h" #include <QOffscreenSurface> #include <private/qopenglextensions_p.h> #include <qpa/qplatformpixmap.h> -#include <wtf/text/CString.h> #if USE(TEXTURE_MAPPER_GL) #include <texmap/TextureMapperGL.h> diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 59519398e..260081946 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -47,10 +47,8 @@ #include "Color.h" #include "DisplayListRecorder.h" #include "FloatConversion.h" -#include "Font.h" #include "ImageBuffer.h" #include "ImageBufferDataQt.h" -#include "NotImplemented.h" #include "Path.h" #include "Pattern.h" #include "ShadowBlur.h" diff --git a/Source/WebCore/platform/graphics/qt/IconQt.cpp b/Source/WebCore/platform/graphics/qt/IconQt.cpp index 24f13067d..9bd3d5323 100644 --- a/Source/WebCore/platform/graphics/qt/IconQt.cpp +++ b/Source/WebCore/platform/graphics/qt/IconQt.cpp @@ -23,7 +23,6 @@ #include "GraphicsContext.h" #include "IntRect.h" -#include "NotImplemented.h" #include <QMimeDatabase> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp index e76572134..9037ae6ac 100644 --- a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp @@ -32,7 +32,6 @@ #include "GraphicsContext.h" #include "GraphicsSurface.h" -#include "ImageData.h" #include "IntRect.h" #include "StillImageQt.h" diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp index 380d22bb5..2295362aa 100644 --- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -31,14 +31,12 @@ #include "ImageBuffer.h" #include "GraphicsContext.h" -#include "ImageData.h" #include "IntRect.h" #include "MIMETypeRegistry.h" #include "StillImageQt.h" #include "TransparencyLayer.h" #include <runtime/JSCInlines.h> #include <runtime/TypedArrayInlines.h> -#include <wtf/text/CString.h> #include <wtf/text/WTFString.h> #include <QBuffer> diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 95548dff3..9091fdc72 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -25,13 +25,10 @@ #include "GraphicsContext.h" #include "GraphicsLayer.h" #include "HTMLMediaElement.h" -#include "HTMLVideoElement.h" #include "Logging.h" #include "NetworkingContext.h" #include "NotImplemented.h" #include "RenderVideo.h" -#include "TimeRanges.h" -#include "Widget.h" #include <QMediaPlayerControl> #include <QMediaService> diff --git a/Source/WebCore/platform/graphics/qt/PathQt.cpp b/Source/WebCore/platform/graphics/qt/PathQt.cpp index ecafcdb0e..f3d7481ea 100644 --- a/Source/WebCore/platform/graphics/qt/PathQt.cpp +++ b/Source/WebCore/platform/graphics/qt/PathQt.cpp @@ -34,7 +34,6 @@ #include "AffineTransform.h" #include "FloatRect.h" #include "GraphicsContext.h" -#include "ImageBuffer.h" #include "NativeImageQt.h" #include "StrokeStyleApplier.h" #include <QPainterPath> diff --git a/Source/WebCore/platform/graphics/qt/PatternQt.cpp b/Source/WebCore/platform/graphics/qt/PatternQt.cpp index 7aae62599..8795f3547 100644 --- a/Source/WebCore/platform/graphics/qt/PatternQt.cpp +++ b/Source/WebCore/platform/graphics/qt/PatternQt.cpp @@ -26,8 +26,7 @@ #include "config.h" #include "Pattern.h" -#include "AffineTransform.h" -#include "GraphicsContext.h" +#include "Image.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/qt/StillImageQt.cpp b/Source/WebCore/platform/graphics/qt/StillImageQt.cpp index 5569474f0..a2fc59e9f 100644 --- a/Source/WebCore/platform/graphics/qt/StillImageQt.cpp +++ b/Source/WebCore/platform/graphics/qt/StillImageQt.cpp @@ -29,7 +29,6 @@ #include "StillImageQt.h" #include "GraphicsContext.h" -#include "IntSize.h" #include "ShadowBlur.h" #include <QPainter> diff --git a/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp b/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp index 73a0e414f..bf3e8c6c5 100644 --- a/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp +++ b/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp @@ -27,8 +27,6 @@ #include "AffineTransform.h" #include "TransformationMatrix.h" -#include "FloatRect.h" -#include "IntRect.h" namespace WebCore { diff --git a/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp b/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp index b850e2327..8b69383ff 100644 --- a/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -30,10 +30,6 @@ #include "config.h" #include "ResourceHandle.h" -#include "CachedResourceLoader.h" -#include "Frame.h" -#include "FrameNetworkingContext.h" -#include "NotImplemented.h" #include "Page.h" #include "QNetworkReplyHandler.h" #include "ResourceHandleClient.h" diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index d74073ec5..655724a4c 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -101,6 +101,12 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co request.setUrl(newurl); request.setOriginatingObject(context ? context->originatingObject() : 0); +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) + // HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397 + if (newurl.scheme().toLower() == QLatin1String("https")) + request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); +#endif + const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) { diff --git a/Source/WebCore/platform/qt/DeviceMotionClientQt.cpp b/Source/WebCore/platform/qt/DeviceMotionClientQt.cpp index 88fb5c1c6..5c01f29f5 100644 --- a/Source/WebCore/platform/qt/DeviceMotionClientQt.cpp +++ b/Source/WebCore/platform/qt/DeviceMotionClientQt.cpp @@ -23,7 +23,6 @@ #include "DeviceMotionProviderQt.h" -#include <wtf/RefPtr.h> namespace WebCore { diff --git a/Source/WebCore/platform/qt/GamepadsQt.cpp b/Source/WebCore/platform/qt/GamepadsQt.cpp index 6fff52f9a..70b4305de 100644 --- a/Source/WebCore/platform/qt/GamepadsQt.cpp +++ b/Source/WebCore/platform/qt/GamepadsQt.cpp @@ -37,7 +37,6 @@ #include <unistd.h> #include <wtf/HashMap.h> #include <wtf/NeverDestroyed.h> -#include <wtf/text/CString.h> #include <wtf/text/StringHash.h> // Forward declarations for libudev, they are all used opaque so we don't need the definitions. diff --git a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp index 3e3f879ed..ab34c8333 100644 --- a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp +++ b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp @@ -31,7 +31,6 @@ #include <QMimeDatabase> #include <wtf/Assertions.h> -#include <wtf/MainThread.h> namespace WebCore { diff --git a/Source/WebCore/platform/qt/MainThreadSharedTimerQt.cpp b/Source/WebCore/platform/qt/MainThreadSharedTimerQt.cpp index 7aae3f1de..0f0864106 100644 --- a/Source/WebCore/platform/qt/MainThreadSharedTimerQt.cpp +++ b/Source/WebCore/platform/qt/MainThreadSharedTimerQt.cpp @@ -34,7 +34,6 @@ #include <QBasicTimer> #include <QCoreApplication> #include <QPointer> -#include <wtf/CurrentTime.h> namespace WebCore { diff --git a/Source/WebCore/platform/qt/PlatformGestureEvent.h b/Source/WebCore/platform/qt/PlatformGestureEvent.h index 1beac6a68..1a0006842 100644 --- a/Source/WebCore/platform/qt/PlatformGestureEvent.h +++ b/Source/WebCore/platform/qt/PlatformGestureEvent.h @@ -28,7 +28,6 @@ #if ENABLE(QT_GESTURE_EVENTS) -#include "FloatPoint.h" #include "IntPoint.h" #include "IntSize.h" #include "PlatformEvent.h" diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp index 91ff0ab43..2790a0d9c 100644 --- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp @@ -32,7 +32,6 @@ #include "PlatformScreen.h" #include "FloatRect.h" -#include "Frame.h" #include "FrameView.h" #include "HostWindow.h" #include "NotImplemented.h" diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp index 7373acca7..706570399 100644 --- a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp @@ -34,23 +34,17 @@ #include "CSSValueKeywords.h" #include "Chrome.h" #include "ChromeClient.h" -#include "Color.h" #include "Document.h" -#include "Font.h" -#include "FontSelector.h" #include "GraphicsContext.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "LocalizedStrings.h" #include "NotImplemented.h" #include "Page.h" #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" #include "RenderProgress.h" -#include "RenderSlider.h" #include "ScrollbarThemeQStyle.h" -#include "SliderThumbElement.h" #include "StyleResolver.h" #include "UserAgentStyleSheets.h" diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp index 2cd35700a..01968deba 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -31,21 +31,15 @@ #include "RenderThemeQt.h" #include "CSSValueKeywords.h" -#include "Chrome.h" #include "ChromeClient.h" #include "Color.h" #include "ExceptionCodePlaceholder.h" #include "FileList.h" -#include "Font.h" -#include "FontSelector.h" #include "GraphicsContext.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "LocalizedStrings.h" -#if ENABLE(VIDEO) -#include "MediaControlElements.h" -#endif #include "NotImplemented.h" #include "Page.h" #include "PaintInfo.h" @@ -56,9 +50,6 @@ #include "ScrollbarTheme.h" #include "StyleResolver.h" #include "TimeRanges.h" -#if ENABLE(VIDEO) -#include "UserAgentScripts.h" -#endif #include "UserAgentStyleSheets.h" #include <wtf/text/StringBuilder.h> @@ -69,6 +60,10 @@ #include <QStyleHints> +#if ENABLE(VIDEO) +#include "UserAgentScripts.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -542,7 +537,7 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const #if ENABLE(VIDEO) String RenderThemeQt::mediaControlsStyleSheet() { - return ASCIILiteral(mediaControlsBaseUserAgentStyleSheet); + return String(mediaControlsBaseUserAgentStyleSheet, sizeof(mediaControlsBaseUserAgentStyleSheet)); } String RenderThemeQt::mediaControlsScript() diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp index e4a34de29..cf5f6491b 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp @@ -30,11 +30,8 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLSelectElement.h" -#include "LocalizedStrings.h" -#include "NotImplemented.h" #include "Page.h" #include "PaintInfo.h" -#include "QWebPageClient.h" #include "RenderBox.h" #include "RenderProgress.h" #include "StyleResolver.h" diff --git a/Source/WebCore/platform/qt/TemporaryLinkStubsQt.cpp b/Source/WebCore/platform/qt/TemporaryLinkStubsQt.cpp index fb3352675..1ccc38a67 100644 --- a/Source/WebCore/platform/qt/TemporaryLinkStubsQt.cpp +++ b/Source/WebCore/platform/qt/TemporaryLinkStubsQt.cpp @@ -32,42 +32,17 @@ #include "config.h" -#include "AXObjectCache.h" -#include "CachedResource.h" -#include "CookieJar.h" #include "CookieStorage.h" -#include "Cursor.h" -#include "DNS.h" -#include "FTPDirectoryDocument.h" -#include "FileSystem.h" -#include "Font.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "IconLoader.h" -#include "IntPoint.h" -#include "URL.h" -#include "Language.h" -#include "LocalizedStrings.h" -#include "Node.h" #include "NotImplemented.h" -#include "Path.h" -#include "PlatformMouseEvent.h" -#include "RenderTheme.h" -#include "SharedBuffer.h" -#include "TextBoundaries.h" -#include "Widget.h" - -#include <float.h> -#include <stdio.h> -#include <stdlib.h> -#include <wtf/text/CString.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> using namespace WebCore; namespace WebCore { +class URL; + void getSupportedKeySizes(Vector<String>&) { notImplemented(); diff --git a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp index 3f2f572ad..4bfb7244f 100644 --- a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp +++ b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp @@ -20,8 +20,6 @@ #include "config.h" #include "ThirdPartyCookiesQt.h" -#include "Cookie.h" -#include "CookieJar.h" #include "Document.h" #include "NetworkingContext.h" diff --git a/Source/WebCore/platform/qt/URLQt.cpp b/Source/WebCore/platform/qt/URLQt.cpp index 7b588fa5b..00ab8e7ab 100644 --- a/Source/WebCore/platform/qt/URLQt.cpp +++ b/Source/WebCore/platform/qt/URLQt.cpp @@ -20,10 +20,8 @@ #include "config.h" #include "URL.h" -#include "NotImplemented.h" #include "TextEncoding.h" #include "qurl.h" -#include <wtf/text/CString.h> namespace WebCore { diff --git a/Source/WebCore/platform/qt/WidgetQt.cpp b/Source/WebCore/platform/qt/WidgetQt.cpp index 0d1669941..715ed09ea 100644 --- a/Source/WebCore/platform/qt/WidgetQt.cpp +++ b/Source/WebCore/platform/qt/WidgetQt.cpp @@ -33,7 +33,6 @@ #include "Widget.h" #include "Cursor.h" -#include "Font.h" #include "GraphicsContext.h" #include "HostWindow.h" #include "IntRect.h" diff --git a/Source/WebCore/xml/XSLTUnicodeSort.cpp b/Source/WebCore/xml/XSLTUnicodeSort.cpp index 54d5abd10..def0f9482 100644 --- a/Source/WebCore/xml/XSLTUnicodeSort.cpp +++ b/Source/WebCore/xml/XSLTUnicodeSort.cpp @@ -33,6 +33,8 @@ #include <libxslt/templates.h> #include <libxslt/xsltutils.h> +#include <wtf/StringExtras.h> +#include <wtf/Vector.h> #include <wtf/unicode/Collator.h> #if OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) && !PLATFORM(QT) @@ -51,15 +53,19 @@ void xsltTransformErrorTrampoline(xsltTransformContextPtr context, xsltStyleshee { va_list args; va_start(args, message); - char* messageWithArgs; - vasprintf(&messageWithArgs, message, args); + + va_list preflightArgs; + va_copy(preflightArgs, args); + size_t stringLength = vsnprintf(nullptr, 0, message, preflightArgs); + va_end(preflightArgs); + + Vector<char, 1024> buffer(stringLength + 1); + vsnprintf(buffer.data(), stringLength + 1, message, args); va_end(args); static void (*xsltTransformErrorPointer)(xsltTransformContextPtr, xsltStylesheetPtr, xmlNodePtr, const char*, ...) WTF_ATTRIBUTE_PRINTF(4, 5) = reinterpret_cast<void (*)(xsltTransformContextPtr, xsltStylesheetPtr, xmlNodePtr, const char*, ...)>(dlsym(libxsltLibrary(), "xsltTransformError")); - xsltTransformErrorPointer(context, style, node, "%s", messageWithArgs); - - free(messageWithArgs); + xsltTransformErrorPointer(context, style, node, "%s", buffer.data()); } #define xsltTransformError xsltTransformErrorTrampoline diff --git a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp index 0e77eac4d..0bcdc4c92 100644 --- a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp +++ b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp @@ -963,24 +963,19 @@ void XMLDocumentParser::error(XMLErrors::ErrorType type, const char* message, va if (isStopped()) return; -#if HAVE(VASPRINTF) - char* m; - if (vasprintf(&m, message, args) == -1) - return; -#else - char m[1024]; - vsnprintf(m, sizeof(m) - 1, message, args); -#endif + va_list preflightArgs; + va_copy(preflightArgs, args); + size_t stringLength = vsnprintf(nullptr, 0, message, preflightArgs); + va_end(preflightArgs); + + Vector<char, 1024> buffer(stringLength + 1); + vsnprintf(buffer.data(), stringLength + 1, message, args); TextPosition position = textPosition(); if (m_parserPaused) - m_pendingCallbacks->appendErrorCallback(type, reinterpret_cast<const xmlChar*>(m), position.m_line, position.m_column); + m_pendingCallbacks->appendErrorCallback(type, reinterpret_cast<const xmlChar*>(buffer.data()), position.m_line, position.m_column); else - handleError(type, m, textPosition()); - -#if HAVE(VASPRINTF) - free(m); -#endif + handleError(type, buffer.data(), textPosition()); } void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlChar* data) |