From 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Thu, 2 Jun 2011 12:07:03 +0100 Subject: Merge WebKit at r84325: Initial merge by git. Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b --- .../platform/graphics/qt/Extensions3DQt.cpp | 5 ++ .../WebCore/platform/graphics/qt/Extensions3DQt.h | 1 + .../platform/graphics/qt/GraphicsContext3DQt.cpp | 10 +++- .../platform/graphics/qt/GraphicsContextQt.cpp | 2 +- .../WebCore/platform/graphics/qt/ImageBufferData.h | 54 ---------------------- .../platform/graphics/qt/ImageBufferDataQt.h | 48 +++++++++++++++++++ .../platform/graphics/qt/MediaPlayerPrivateQt.cpp | 12 ++++- .../platform/graphics/qt/SimpleFontDataQt.cpp | 28 +++++++++-- 8 files changed, 97 insertions(+), 63 deletions(-) delete mode 100644 Source/WebCore/platform/graphics/qt/ImageBufferData.h create mode 100644 Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h (limited to 'Source/WebCore/platform/graphics/qt') diff --git a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp index 3adc93f..45d5e9c 100644 --- a/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp @@ -52,6 +52,11 @@ void Extensions3DQt::ensureEnabled(const String& name) ASSERT(supports(name)); } +bool Extensions3DQt::isEnabled(const String& name) +{ + return supports(name); +} + int Extensions3DQt::getGraphicsResetStatusARB() { return GraphicsContext3D::NO_ERROR; diff --git a/Source/WebCore/platform/graphics/qt/Extensions3DQt.h b/Source/WebCore/platform/graphics/qt/Extensions3DQt.h index c67fbed..1bc47b8 100644 --- a/Source/WebCore/platform/graphics/qt/Extensions3DQt.h +++ b/Source/WebCore/platform/graphics/qt/Extensions3DQt.h @@ -37,6 +37,7 @@ public: // Extensions3D methods. virtual bool supports(const String&); virtual void ensureEnabled(const String&); + virtual bool isEnabled(const String&); virtual int getGraphicsResetStatusARB(); virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 4daa4dc..e92f927 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -447,6 +447,12 @@ GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attribut GraphicsContext3DInternal::~GraphicsContext3DInternal() { + m_glWidget->makeCurrent(); + if (m_glWidget->isValid()) { + ::glDeleteTextures(1, &m_texture); + deleteRenderbuffers(1, &m_depthBuffer); + deleteFramebuffers(1, &m_canvasFbo); + } delete m_glWidget; m_glWidget = 0; } @@ -588,7 +594,7 @@ void* GraphicsContext3DInternal::getProcAddress(const String& proc) for (int i = 0; i < 3; i++) { String nameWithExt = proc + ext[i]; - void* addr = m_glWidget->context()->getProcAddress(nameWithExt.utf8().data()); + void* addr = m_glWidget->context()->getProcAddress(QString(nameWithExt)); if (addr) return addr; } @@ -656,7 +662,7 @@ PassRefPtr GraphicsContext3D::paintRenderingResultsToImageData() void GraphicsContext3D::reshape(int width, int height) { - if (width == m_currentWidth && height == m_currentHeight || (!m_internal)) + if ((width == m_currentWidth && height == m_currentHeight) || (!m_internal)) return; m_currentWidth = width; diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index e3e0fa6..a3a08eb 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -900,7 +900,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint&, float, TextChec notImplemented(); } -FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) +FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect, RoundingMode) { // It is not enough just to round to pixels in device space. The rotation part of the // affine transform matrix to device space can mess with this conversion if we have a diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferData.h b/Source/WebCore/platform/graphics/qt/ImageBufferData.h deleted file mode 100644 index 602197e..0000000 --- a/Source/WebCore/platform/graphics/qt/ImageBufferData.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2008 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: - * 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 ImageBufferData_h -#define ImageBufferData_h - -#include "Image.h" -#include - -#include -#include - -#include "OwnPtr.h" - -namespace WebCore { - -class IntSize; - -class ImageBufferData { -public: - ImageBufferData(const IntSize&); - - QImage toQImage() const; - - QPixmap m_pixmap; - OwnPtr m_painter; - RefPtr m_image; -}; - -} // namespace WebCore - -#endif // ImageBufferData_h diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h new file mode 100644 index 0000000..8b49829 --- /dev/null +++ b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Image.h" + +#include "OwnPtr.h" +#include +#include +#include + +namespace WebCore { + +class IntSize; + +class ImageBufferData { +public: + ImageBufferData(const IntSize&); + + QImage toQImage() const; + + QPixmap m_pixmap; + OwnPtr m_painter; + RefPtr m_image; +}; + +} // namespace WebCore diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index bc43acf..e7efdf9 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -84,7 +84,17 @@ MediaPlayer::SupportsType MediaPlayerPrivateQt::supportsType(const String& mime, if (!mime.startsWith("audio/") && !mime.startsWith("video/")) return MediaPlayer::IsNotSupported; - if (QMediaPlayer::hasSupport(mime, QStringList(codec)) >= QtMultimediaKit::ProbablySupported) + // Parse and trim codecs. + QString codecStr = codec; + QStringList codecList = codecStr.split(QLatin1Char(','), QString::SkipEmptyParts); + QStringList codecListTrimmed; + foreach (const QString& codecStrNotTrimmed, codecList) { + QString codecStrTrimmed = codecStrNotTrimmed.trimmed(); + if (!codecStrTrimmed.isEmpty()) + codecListTrimmed.append(codecStrTrimmed); + } + + if (QMediaPlayer::hasSupport(mime, codecListTrimmed) >= QtMultimediaKit::ProbablySupported) return MediaPlayer::IsSupported; return MediaPlayer::MayBeSupported; diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp index 5d0b302..9bf1030 100644 --- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2008, 2009, 2010, 2011 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther This library is free software; you can redistribute it and/or @@ -48,11 +48,29 @@ void SimpleFontData::platformInit() } QFontMetricsF fm(m_platformData.font()); - m_fontMetrics.setAscent(fm.ascent()); - m_fontMetrics.setDescent(fm.descent()); + + // Qt subtracts 1 from the descent to account for the baseline, + // we add it back here to get correct metrics for WebKit. + float descent = fm.descent() + 1; + float ascent = fm.ascent(); + + float lineSpacing = fm.lineSpacing(); + + // The line spacing should always be >= (ascent + descent), but this + // may be false in some cases due to misbehaving platform libraries. + // Workaround from SimpleFontPango.cpp and SimpleFontFreeType.cpp + if (lineSpacing < ascent + descent) + lineSpacing = ascent + descent; + + // QFontMetricsF::leading() may return negative values on platforms + // such as FreeType. Calculate the line gap manually instead. + float lineGap = lineSpacing - ascent - descent; + + m_fontMetrics.setAscent(ascent); + m_fontMetrics.setDescent(descent); + m_fontMetrics.setLineSpacing(lineSpacing); m_fontMetrics.setXHeight(fm.xHeight()); - m_fontMetrics.setLineGap(fm.leading()); - m_fontMetrics.setLineSpacing(fm.lineSpacing()); + m_fontMetrics.setLineGap(lineGap); m_spaceWidth = fm.width(QLatin1Char(' ')); } -- cgit v1.1