summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/qt
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/platform/graphics/qt
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/platform/graphics/qt')
-rw-r--r--Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp5
-rw-r--r--Source/WebCore/platform/graphics/qt/Extensions3DQt.h1
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp10
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp2
-rw-r--r--Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h (renamed from Source/WebCore/platform/graphics/qt/ImageBufferData.h)12
-rw-r--r--Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp12
-rw-r--r--Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp28
7 files changed, 52 insertions, 18 deletions
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<ImageData> 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/ImageBufferDataQt.h
index 602197e..8b49829 100644
--- a/Source/WebCore/platform/graphics/qt/ImageBufferData.h
+++ b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h
@@ -23,16 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ImageBufferData_h
-#define ImageBufferData_h
-
#include "Image.h"
-#include <wtf/RefPtr.h>
+#include "OwnPtr.h"
#include <QPainter>
#include <QPixmap>
-
-#include "OwnPtr.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -49,6 +45,4 @@ public:
RefPtr<Image> m_image;
};
-} // namespace WebCore
-
-#endif // ImageBufferData_h
+} // 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(' '));
}