summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qjpeghandler.cpp21
-rw-r--r--src/gui/kernel/qcursor.cpp3
-rw-r--r--src/gui/kernel/qevent.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.cpp3
-rw-r--r--src/gui/kernel/qopenglcontext.cpp49
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h3
-rw-r--r--src/gui/kernel/qpalette.cpp3
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.h3
-rw-r--r--src/gui/kernel/qshortcutmap.cpp6
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp3
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp6
-rw-r--r--src/gui/math3d/qgenericmatrix.h3
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp3
-rw-r--r--src/gui/math3d/qquaternion.cpp3
-rw-r--r--src/gui/math3d/qvector2d.cpp3
-rw-r--r--src/gui/math3d/qvector3d.cpp3
-rw-r--r--src/gui/math3d/qvector4d.cpp3
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp26
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h13
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp13
-rw-r--r--src/gui/painting/qbrush.cpp3
-rw-r--r--src/gui/painting/qcolor.cpp3
-rw-r--r--src/gui/painting/qmatrix.cpp3
-rw-r--r--src/gui/painting/qpagelayout.cpp3
-rw-r--r--src/gui/painting/qpagesize.cpp3
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qpen.cpp3
-rw-r--r--src/gui/painting/qpolygon.cpp6
-rw-r--r--src/gui/painting/qtransform.cpp3
-rw-r--r--src/gui/text/qcssparser.cpp24
-rw-r--r--src/gui/text/qcssparser_p.h5
-rw-r--r--src/gui/text/qharfbuzzng.cpp41
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp14
-rw-r--r--src/gui/text/qtextengine.cpp50
-rw-r--r--src/gui/text/qtextformat.cpp6
-rw-r--r--src/gui/text/qtexthtmlparser.cpp270
-rw-r--r--src/gui/util/qlayoutpolicy.cpp3
40 files changed, 491 insertions, 137 deletions
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index aff7b79807..839f90f17c 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -72,8 +72,6 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
-static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32;
-
struct my_error_mgr : public jpeg_error_mgr {
jmp_buf setjmp_buffer;
};
@@ -242,7 +240,9 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
static bool read_jpeg_image(QImage *outImage,
QSize scaledSize, QRect scaledClipRect,
- QRect clipRect, volatile int inQuality, j_decompress_ptr info, struct my_error_mgr* err )
+ QRect clipRect, volatile int inQuality,
+ Rgb888ToRgb32Converter converter,
+ j_decompress_ptr info, struct my_error_mgr* err )
{
if (!setjmp(err->setjmp_buffer)) {
// -1 means default quality.
@@ -383,7 +383,7 @@ static bool read_jpeg_image(QImage *outImage,
if (info->output_components == 3) {
uchar *in = rows[0] + clip.x() * 3;
QRgb *out = (QRgb*)outImage->scanLine(y);
- rgb888ToRgb32ConverterPtr(out, in, clip.width());
+ converter(out, in, clip.width());
} else if (info->out_color_space == JCS_CMYK) {
// Convert CMYK->RGB.
uchar *in = rows[0] + clip.x() * 4;
@@ -714,7 +714,8 @@ public:
};
QJpegHandlerPrivate(QJpegHandler *qq)
- : quality(75), exifOrientation(1), iod_src(0), state(Ready), optimize(false), progressive(false), q(qq)
+ : quality(75), exifOrientation(1), iod_src(0),
+ rgb888ToRgb32ConverterPtr(qt_convert_rgb888_to_rgb32), state(Ready), optimize(false), progressive(false), q(qq)
{}
~QJpegHandlerPrivate()
@@ -745,6 +746,8 @@ public:
struct my_jpeg_source_mgr * iod_src;
struct my_error_mgr err;
+ Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr;
+
State state;
bool optimize;
@@ -968,7 +971,7 @@ bool QJpegHandlerPrivate::read(QImage *image)
if(state == ReadHeader)
{
- bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err);
+ bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err);
if (success) {
for (int i = 0; i < readTexts.size()-1; i+=2)
image->setText(readTexts.at(i), readTexts.at(i+1));
@@ -996,18 +999,18 @@ QJpegHandler::QJpegHandler()
// from qimage_neon.cpp
if (qCpuHasFeature(NEON))
- rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon;
+ d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon;
#endif
#if defined(QT_COMPILER_SUPPORTS_SSSE3)
// from qimage_ssse3.cpps
if (qCpuHasFeature(SSSE3)) {
- rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
+ d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
}
#endif // QT_COMPILER_SUPPORTS_SSSE3
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
if (qCpuHasFeature(DSPR2)) {
- rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm;
+ d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm;
}
#endif // QT_COMPILER_SUPPORTS_DSPR2
}
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 7e073370f2..6ed750eda1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -601,8 +601,9 @@ QCursor::operator QVariant() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QCursor &c)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 7b75a31847..ccd7c37486 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3721,8 +3721,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ", " << button;
if (buttons && button != buttons)
dbg << ", buttons=" << buttons;
- if (const int mods = int(me->modifiers()))
- dbg << ", modifiers=0x" << hex << mods << dec;
+ if (me->modifiers())
+ dbg << ", " << me->modifiers();
dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos();
if (me->source())
dbg << ", " << me->source();
@@ -3744,9 +3744,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
{
const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
dbg << "QKeyEvent(" << type
- << ", key=0x" << hex << ke->key() << dec;
- if (const int mods = ke->modifiers())
- dbg << ", modifiers=0x" << hex << mods << dec;
+ << ", " << static_cast<Qt::Key>(ke->key());
+ if (ke->modifiers())
+ dbg << ", " << ke->modifiers();
if (!ke->text().isEmpty())
dbg << ", text=" << ke->text();
if (ke->isAutoRepeat())
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index bdf401aa2d..23d5f06aa2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1601,8 +1601,9 @@ QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QKeySequence &p)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QKeySequence(" << p.toString() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 90c54c4039..56a3729a4a 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -636,12 +636,21 @@ void QOpenGLContext::destroy()
d->platformGLContext = 0;
delete d->functions;
d->functions = 0;
+
+ foreach (QAbstractOpenGLFunctions *func, d->externalVersionFunctions) {
+ QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func);
+ func_d->owningContext = 0;
+ func_d->initialized = false;
+ }
+ d->externalVersionFunctions.clear();
qDeleteAll(d->versionFunctions);
d->versionFunctions.clear();
qDeleteAll(d->versionFunctionsBackend);
d->versionFunctionsBackend.clear();
+
delete d->textureFunctions;
d->textureFunctions = 0;
+
d->nativeHandle = QVariant();
}
@@ -719,7 +728,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
is current. It is also possible to call this function when the context is not
current, but in that case it is the caller's responsibility to ensure proper
- intiialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
+ initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
afterwards.
Usually one would use the template version of this function to automatically
@@ -851,15 +860,26 @@ bool QOpenGLContext::hasExtension(const QByteArray &extension) const
/*!
Call this to get the default framebuffer object for the current surface.
- On some platforms the default framebuffer object depends on the surface
- being rendered to, and might be different from 0. Thus, instead of calling
- glBindFramebuffer(0), you should call
+ On some platforms (for instance, iOS) the default framebuffer object depends
+ on the surface being rendered to, and might be different from 0. Thus,
+ instead of calling glBindFramebuffer(0), you should call
glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your
application to work across different Qt platforms.
If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to
worry about this, as it automatically binds the current context's
defaultFramebufferObject() when 0 is passed.
+
+ \note Widgets that render via framebuffer objects, like QOpenGLWidget and
+ QQuickWidget, will override the value returned from this function when
+ painting is active, because at that time the correct "default" framebuffer
+ is the widget's associated backing framebuffer, not the platform-specific
+ one belonging to the top-level window's surface. This ensures the expected
+ behavior for this function and other classes relying on it (for example,
+ QOpenGLFramebufferObject::bindDefault() or
+ QOpenGLFramebufferObject::release()).
+
+ \sa QOpenGLFramebufferObject
*/
GLuint QOpenGLContext::defaultFramebufferObject() const
{
@@ -870,6 +890,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
if (!d->surface || !d->surface->surfaceHandle())
return 0;
+ if (d->defaultFboRedirect)
+ return d->defaultFboRedirect;
+
return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
}
@@ -1259,6 +1282,24 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
/*!
\internal
+ */
+void QOpenGLContext::insertExternalFunctions(QAbstractOpenGLFunctions *f)
+{
+ Q_D(QOpenGLContext);
+ d->externalVersionFunctions.insert(f);
+}
+
+/*!
+ \internal
+ */
+void QOpenGLContext::removeExternalFunctions(QAbstractOpenGLFunctions *f)
+{
+ Q_D(QOpenGLContext);
+ d->externalVersionFunctions.remove(f);
+}
+
+/*!
+ \internal
*/
QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
{
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 30a9bc3ad9..a529957ad6 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -229,6 +229,8 @@ private:
void insertFunctionsBackend(const QOpenGLVersionStatus &v,
QOpenGLVersionFunctionsBackend *backend);
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
+ void insertExternalFunctions(QAbstractOpenGLFunctions *f);
+ void removeExternalFunctions(QAbstractOpenGLFunctions *f);
QOpenGLTextureHelper* textureFunctions() const;
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 446efa369c..f9f3ce2c5f 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -204,6 +204,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
+ , defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@@ -216,6 +217,7 @@ public:
mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
mutable QHash<QOpenGLVersionStatus, QOpenGLVersionFunctionsBackend *> versionFunctionsBackend;
+ mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
void *qGLContextHandle;
void (*qGLContextDeleteFunction)(void *handle);
@@ -241,6 +243,7 @@ public:
bool qgl_current_fbo_invalid;
QVariant nativeHandle;
+ GLuint defaultFboRedirect;
static QOpenGLContext *setCurrentContext(QOpenGLContext *context);
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 58bcc2cc5b..cf17e1b5aa 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1152,6 +1152,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
"BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
"HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
"ToolTipBase","ToolTipText" };
+ QDebugStateSaver saver(dbg);
QDebug nospace = dbg.nospace();
const uint mask = p.resolve();
nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
@@ -1171,7 +1172,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
}
}
nospace << ')' << noshowbase << dec;
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 6147a2a53a..f2a92e10df 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -392,6 +392,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval);
case TabFocusBehavior:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
+ case ReplayMousePressOutsidePopup:
+ return true;
}
return 0;
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 24e19f68e6..34639e6929 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -145,7 +145,8 @@ public:
SetFocusOnTouchRelease,
ShowIsMaximized,
MousePressAndHoldInterval,
- TabFocusBehavior
+ TabFocusBehavior,
+ ReplayMousePressOutsidePopup
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 16d278b473..0ff5c36119 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -88,14 +88,16 @@ struct QShortcutEntry
/*! \internal
QDebug operator<< for easy debug output of the shortcut entries.
*/
-static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
+static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se)
+{
+ QDebugStateSaver saver(dbg);
if (!se)
return dbg << "QShortcutEntry(0x0)";
dbg.nospace()
<< "QShortcutEntry(" << se->keyseq
<< "), id(" << se->id << "), enabled(" << se->enabled << "), autorepeat(" << se->autorepeat
<< "), owner(" << se->owner << ')';
- return dbg.space();
+ return dbg;
}
#endif // QT_NO_DEBUGSTREAM
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index d5f5b358b3..d078336d73 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -812,6 +812,7 @@ bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
{
const QSurfaceFormatPrivate * const d = f.d;
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QSurfaceFormat("
<< "version " << d->major << '.' << d->minor
@@ -828,7 +829,7 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
<< ", profile " << d->profile
<< ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 7bf47a1dc8..ee3fc1589f 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -782,10 +782,12 @@ void QWindowSystemInterface::handleEnterWhatsThisEvent()
#endif
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p) {
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
+{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
<< " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index afce9d935e..89bc09f544 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -341,6 +341,7 @@ typedef QGenericMatrix<4, 3, float> QMatrix4x3;
template <int N, int M, typename T>
QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QGenericMatrix<" << N << ", " << M
<< ", " << QTypeInfo<T>::name()
<< ">(" << endl << qSetFieldWidth(10);
@@ -350,7 +351,7 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
dbg << endl;
}
dbg << qSetFieldWidth(0) << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 09b41ac570..eb7c7f4b7a 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -2010,6 +2010,7 @@ QMatrix4x4::operator QVariant() const
QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
{
+ QDebugStateSaver saver(dbg);
// Create a string that represents the matrix type.
QByteArray bits;
if (m.flagBits == QMatrix4x4::Identity) {
@@ -2039,7 +2040,7 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
<< m(2, 0) << m(2, 1) << m(2, 2) << m(2, 3) << endl
<< m(3, 0) << m(3, 1) << m(3, 2) << m(3, 3) << endl
<< qSetFieldWidth(0) << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index 90d90448e0..6914a0b45e 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -950,10 +950,11 @@ QQuaternion::operator QVariant() const
QDebug operator<<(QDebug dbg, const QQuaternion &q)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QQuaternion(scalar:" << q.scalar()
<< ", vector:(" << q.x() << ", "
<< q.y() << ", " << q.z() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index fe4c9f8cc2..2d8a1d3a0f 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -499,8 +499,9 @@ QVector2D::operator QVariant() const
QDebug operator<<(QDebug dbg, const QVector2D &vector)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index ced4ac9d73..19aa4facdb 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -697,9 +697,10 @@ float QVector3D::lengthSquared() const
QDebug operator<<(QDebug dbg, const QVector3D &vector)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector3D("
<< vector.x() << ", " << vector.y() << ", " << vector.z() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 6afe9b8cad..494e6f97f0 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -573,10 +573,11 @@ QVector4D::operator QVariant() const
QDebug operator<<(QDebug dbg, const QVector4D &vector)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector4D("
<< vector.x() << ", " << vector.y() << ", "
<< vector.z() << ", " << vector.w() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index fa4b6cdab0..9bc9926b70 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -3650,7 +3650,7 @@ QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const
}
/*!
- \enum ComparisonFunction
+ \enum QOpenGLTexture::ComparisonFunction
\since 5.5
This enum specifies which comparison operator is used when texture comparison
is enabled on this texture.
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index f3f709c3f0..346a526054 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -67,6 +67,17 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con
context->removeFunctionsBackend(v);
}
+void QAbstractOpenGLFunctionsPrivate::insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
+{
+ Q_ASSERT(context);
+ context->insertExternalFunctions(f);
+}
+
+void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
+{
+ Q_ASSERT(context);
+ context->removeExternalFunctions(f);
+}
/*!
\class QAbstractOpenGLFunctions
@@ -182,6 +193,9 @@ QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
{
+ Q_D(QAbstractOpenGLFunctions);
+ if (d->owningContext)
+ d->removeExternalFunctions(d->owningContext, this);
delete d_ptr;
}
@@ -191,6 +205,18 @@ bool QAbstractOpenGLFunctions::initializeOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
d->initialized = true;
+
+ // For a subclass whose instance is not created via
+ // QOpenGLContext::versionFunctions() owningContext is not set. Set it now
+ // and register such instances to the context as external ones. These are
+ // not owned by the context but still need certain cleanup when the context
+ // is destroyed.
+ if (!d->owningContext) {
+ d->owningContext = QOpenGLContext::currentContext();
+ if (d->owningContext)
+ d->insertExternalFunctions(d->owningContext, this);
+ }
+
return true;
}
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 2ae0f429e5..fcf665f97e 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -114,6 +114,8 @@ public:
QAtomicInt refs;
};
+class QAbstractOpenGLFunctions;
+
class QAbstractOpenGLFunctionsPrivate
{
public:
@@ -128,12 +130,16 @@ public:
const QOpenGLVersionStatus &v,
QOpenGLVersionFunctionsBackend *backend);
static void removeFunctionsBackend(QOpenGLContext *context, const QOpenGLVersionStatus &v);
+ static void insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
+ static void removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
+
+ static QAbstractOpenGLFunctionsPrivate *get(QAbstractOpenGLFunctions *q);
QOpenGLContext *owningContext;
bool initialized;
};
-class QAbstractOpenGLFunctions
+class Q_GUI_EXPORT QAbstractOpenGLFunctions
{
public:
virtual ~QAbstractOpenGLFunctions();
@@ -154,6 +160,11 @@ protected:
friend class QOpenGLContext;
};
+inline QAbstractOpenGLFunctionsPrivate *QAbstractOpenGLFunctionsPrivate::get(QAbstractOpenGLFunctions *q)
+{
+ return q->d_func();
+}
+
#if !defined(QT_OPENGL_ES_2)
class QOpenGLFunctions_1_0_CoreBackend : public QOpenGLVersionFunctionsBackend
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 6b0f2fede7..2a1b7f4bf4 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -189,11 +189,16 @@ bool QOpenGLVertexArrayObjectPrivate::create()
void QOpenGLVertexArrayObjectPrivate::destroy()
{
+ Q_Q(QOpenGLVertexArrayObject);
+
+ if (context) {
+ QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
+ context = 0;
+ }
+
if (!vao)
return;
- Q_Q(QOpenGLVertexArrayObject);
-
switch (vaoFuncsType) {
#ifndef QT_OPENGL_ES_2
case Core_3_2:
@@ -212,10 +217,6 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
break;
}
- Q_ASSERT(context);
- QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- context = 0;
-
vao = 0;
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 27f28f7193..5bf8387400 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1022,8 +1022,9 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
"TexturePattern" // 24
};
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 806c9362ac..b33d7a74fc 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2469,6 +2469,7 @@ void QColor::invalidate()
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QColor &c)
{
+ QDebugStateSaver saver(dbg);
if (!c.isValid())
dbg.nospace() << "QColor(Invalid)";
else if (c.spec() == QColor::Rgb)
@@ -2481,7 +2482,7 @@ QDebug operator<<(QDebug dbg, const QColor &c)
else if (c.spec() == QColor::Hsl)
dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 679b5000cb..acedc6a7ba 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -1130,6 +1130,7 @@ QDataStream &operator>>(QDataStream &s, QMatrix &m)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QMatrix &m)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QMatrix("
<< "11=" << m.m11()
<< " 12=" << m.m12()
@@ -1138,7 +1139,7 @@ QDebug operator<<(QDebug dbg, const QMatrix &m)
<< " dx=" << m.dx()
<< " dy=" << m.dy()
<< ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp
index c1b23960ad..f443bbd5ac 100644
--- a/src/gui/painting/qpagelayout.cpp
+++ b/src/gui/painting/qpagelayout.cpp
@@ -942,6 +942,7 @@ QRect QPageLayout::paintRectPixels(int resolution) const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPageLayout &layout)
{
+ QDebugStateSaver saver(dbg);
if (layout.isValid()) {
QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)");
QString units;
@@ -976,7 +977,7 @@ QDebug operator<<(QDebug dbg, const QPageLayout &layout)
} else {
dbg.nospace() << "QPageLayout()";
}
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index fe445c0aec..c0aae603b7 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -1854,6 +1854,7 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
{
+ QDebugStateSaver saver(dbg);
if (pageSize.isValid()) {
QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)");
output = output.arg(pageSize.name())
@@ -1865,7 +1866,7 @@ QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
} else {
dbg.nospace() << "QPageSize()";
}
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 6f00abfc5f..973c9da96c 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7462,6 +7462,7 @@ start_lengthVariant:
range.format.setFontUnderline(true);
underlineFormats.append(range);
}
+#ifdef Q_OS_MAC
} else if (hidemnmemonic && *cin == QLatin1Char('(') && l >= 4 &&
cin[1] == QLatin1Char('&') && cin[2] != QLatin1Char('&') &&
cin[3] == QLatin1Char(')')) {
@@ -7473,6 +7474,7 @@ start_lengthVariant:
length -= n + 4;
l -= 4;
continue;
+#endif //Q_OS_MAC
}
*cout = *cin;
++cout;
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 4796d2c0ad..6263d18b01 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -1026,12 +1026,13 @@ QDebug operator<<(QDebug dbg, const QPen &p)
"CustomDashLine"
};
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QPen(" << p.width() << ',' << p.brush()
<< ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle())
<< ',' << int(p.joinStyle()) << ',' << p.dashPattern()
<< ',' << p.dashOffset()
<< ',' << p.miterLimit() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 511af49787..efcc8875a5 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -461,11 +461,12 @@ QRect QPolygon::boundingRect() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygon &a)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygon(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
- return dbg.space();
+ return dbg;
}
#endif
@@ -802,11 +803,12 @@ QDataStream &operator>>(QDataStream &s, QPolygonF &a)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygonF &a)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygonF(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 4c1aff92ae..31d7a2300b 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1091,6 +1091,7 @@ QDebug operator<<(QDebug dbg, const QTransform &m)
"TxProject"
};
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QTransform(type=" << typeStr[m.type()] << ','
<< " 11=" << m.m11()
<< " 12=" << m.m12()
@@ -1103,7 +1104,7 @@ QDebug operator<<(QDebug dbg, const QTransform &m)
<< " 33=" << m.m33()
<< ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index f9e6a7e335..3c98cb568d 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -364,6 +364,29 @@ static quint64 findKnownValue(const QString &name, const QCssKnownValue *start,
return prop->id;
}
+static inline bool isInheritable(Property propertyId)
+{
+ switch (propertyId) {
+ case Font:
+ case FontFamily:
+ case FontSize:
+ case FontStyle:
+ case FontWeight:
+ case TextIndent:
+ case Whitespace:
+ case ListStyleType:
+ case ListStyle:
+ case TextAlignment:
+ case FontVariant:
+ case TextTransform:
+ case LineHeight:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////
// Value Extractor
ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette &pal)
@@ -2317,6 +2340,7 @@ bool Parser::parseProperty(Declaration *decl)
{
decl->d->property = lexem();
decl->d->propertyId = static_cast<Property>(findKnownValue(decl->d->property, properties, NumProperties));
+ decl->d->inheritable = isInheritable(decl->d->propertyId);
skipSpace();
return true;
}
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index ebd9904762..75802ba36a 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -426,12 +426,13 @@ struct Q_GUI_EXPORT Declaration
{
struct DeclarationData : public QSharedData
{
- inline DeclarationData() : propertyId(UnknownProperty), important(false) {}
+ inline DeclarationData() : propertyId(UnknownProperty), important(false), inheritable(false) {}
QString property;
Property propertyId;
QVector<Value> values;
QVariant parsed;
- bool important;
+ bool important:1;
+ bool inheritable:1;
};
QExplicitlySharedDataPointer<DeclarationData> d;
inline Declaration() : d(new DeclarationData()) {}
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 4baf1fd03c..102c62ea8a 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -94,6 +94,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_BUHID,
HB_SCRIPT_TAGBANWA,
HB_SCRIPT_COPTIC,
+
+ // Unicode 4.0 additions
HB_SCRIPT_LIMBU,
HB_SCRIPT_TAI_LE,
HB_SCRIPT_LINEAR_B,
@@ -102,6 +104,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_OSMANYA,
HB_SCRIPT_CYPRIOT,
HB_SCRIPT_BRAILLE,
+
+ // Unicode 4.1 additions
HB_SCRIPT_BUGINESE,
HB_SCRIPT_NEW_TAI_LUE,
HB_SCRIPT_GLAGOLITIC,
@@ -109,11 +113,15 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_SYLOTI_NAGRI,
HB_SCRIPT_OLD_PERSIAN,
HB_SCRIPT_KHAROSHTHI,
+
+ // Unicode 5.0 additions
HB_SCRIPT_BALINESE,
HB_SCRIPT_CUNEIFORM,
HB_SCRIPT_PHOENICIAN,
HB_SCRIPT_PHAGS_PA,
HB_SCRIPT_NKO,
+
+ // Unicode 5.1 additions
HB_SCRIPT_SUNDANESE,
HB_SCRIPT_LEPCHA,
HB_SCRIPT_OL_CHIKI,
@@ -125,6 +133,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_CARIAN,
HB_SCRIPT_LYDIAN,
HB_SCRIPT_CHAM,
+
+ // Unicode 5.2 additions
HB_SCRIPT_TAI_THAM,
HB_SCRIPT_TAI_VIET,
HB_SCRIPT_AVESTAN,
@@ -140,16 +150,45 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,
HB_SCRIPT_OLD_TURKIC,
HB_SCRIPT_KAITHI,
+
+ // Unicode 6.0 additions
HB_SCRIPT_BATAK,
HB_SCRIPT_BRAHMI,
HB_SCRIPT_MANDAIC,
+
+ // Unicode 6.1 additions
HB_SCRIPT_CHAKMA,
HB_SCRIPT_MEROITIC_CURSIVE,
HB_SCRIPT_MEROITIC_HIEROGLYPHS,
HB_SCRIPT_MIAO,
HB_SCRIPT_SHARADA,
HB_SCRIPT_SORA_SOMPENG,
- HB_SCRIPT_TAKRI
+ HB_SCRIPT_TAKRI,
+
+ // Unicode 7.0 additions
+ HB_SCRIPT_CAUCASIAN_ALBANIAN,
+ HB_SCRIPT_BASSA_VAH,
+ HB_SCRIPT_DUPLOYAN,
+ HB_SCRIPT_ELBASAN,
+ HB_SCRIPT_GRANTHA,
+ HB_SCRIPT_PAHAWH_HMONG,
+ HB_SCRIPT_KHOJKI,
+ HB_SCRIPT_LINEAR_A,
+ HB_SCRIPT_MAHAJANI,
+ HB_SCRIPT_MANICHAEAN,
+ HB_SCRIPT_MENDE_KIKAKUI,
+ HB_SCRIPT_MODI,
+ HB_SCRIPT_MRO,
+ HB_SCRIPT_OLD_NORTH_ARABIAN,
+ HB_SCRIPT_NABATAEAN,
+ HB_SCRIPT_PALMYRENE,
+ HB_SCRIPT_PAU_CIN_HAU,
+ HB_SCRIPT_OLD_PERMIC,
+ HB_SCRIPT_PSALTER_PAHLAVI,
+ HB_SCRIPT_SIDDHAM,
+ HB_SCRIPT_KHUDAWADI,
+ HB_SCRIPT_TIRHUTA,
+ HB_SCRIPT_WARANG_CITI
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 3c3000da4d..5fa43948aa 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -522,9 +522,11 @@ enum {
VietnameseCsbBit = 8,
SimplifiedChineseCsbBit = 18,
TraditionalChineseCsbBit = 20,
+ ThaiCsbBit = 16,
JapaneseCsbBit = 17,
KoreanCsbBit = 19,
- KoreanJohabCsbBit = 21
+ KoreanJohabCsbBit = 21,
+ SymbolCsbBit = 31
};
/*!
@@ -579,6 +581,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
hasScript = true;
//qDebug("font %s supports Arabic", familyName.latin1());
}
+ if (codePageRange[0] & (1 << ThaiCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Thai);
+ hasScript = true;
+ //qDebug("font %s supports Thai", familyName.latin1());
+ }
if (codePageRange[0] & (1 << VietnameseCsbBit)) {
writingSystems.setSupported(QFontDatabase::Vietnamese);
hasScript = true;
@@ -604,6 +611,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
hasScript = true;
//qDebug("font %s supports Korean", familyName.latin1());
}
+ if (codePageRange[0] & (1 << SymbolCsbBit)) {
+ writingSystems = QSupportedWritingSystems();
+ hasScript = false;
+ }
+
if (!hasScript)
writingSystems.setSupported(QFontDatabase::Symbol);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 076b6bbde4..10a61d3c84 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -881,16 +881,22 @@ static inline void qt_getJustificationOpportunities(const ushort *string, int le
int spaceAs;
switch (si.analysis.script) {
+ case QChar::Script_Arabic:
+ case QChar::Script_Syriac:
case QChar::Script_Nko:
case QChar::Script_Mandaic:
case QChar::Script_Mongolian:
case QChar::Script_PhagsPa:
+ case QChar::Script_Manichaean:
+ case QChar::Script_PsalterPahlavi:
// same as default but inter character justification takes precedence
spaceAs = Justification_Arabic_Space;
break;
+ case QChar::Script_Tibetan:
case QChar::Script_Hiragana:
case QChar::Script_Katakana:
+ case QChar::Script_Bopomofo:
case QChar::Script_Han:
// same as default but inter character justification is the only option
spaceAs = Justification_Character;
@@ -1201,20 +1207,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
uint cluster = infos->cluster;
if (Q_LIKELY(last_cluster != cluster)) {
- if (Q_UNLIKELY(g.glyphs[i] == 0)) {
- // hide characters that should normally be invisible
- switch (string[item_pos + str_pos]) {
- case QChar::LineFeed:
- case 0x000c: // FormFeed
- case QChar::CarriageReturn:
- case QChar::LineSeparator:
- case QChar::ParagraphSeparator:
- g.attributes[i].dontPrint = true;
- break;
- default:
- break;
- }
- }
+ g.attributes[i].clusterStart = true;
// fix up clusters so that the cluster indices will be monotonic
// and thus we never return out-of-order indices
@@ -1222,7 +1215,32 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
log_clusters[str_pos++] = last_glyph_pos;
last_glyph_pos = i + glyphs_shaped;
last_cluster = cluster;
- g.attributes[i].clusterStart = true;
+
+ // hide characters that should normally be invisible
+ switch (string[item_pos + str_pos]) {
+ case QChar::LineFeed:
+ case 0x000c: // FormFeed
+ case QChar::CarriageReturn:
+ case QChar::LineSeparator:
+ case QChar::ParagraphSeparator:
+ g.attributes[i].dontPrint = true;
+ break;
+ case QChar::SoftHyphen:
+ if (!actualFontEngine->symbol) {
+ // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
+ // so we replace its glyph and metrics with ones for
+ // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
+ g.glyphs[i] = actualFontEngine->glyphIndex('-');
+ if (Q_LIKELY(g.glyphs[i] != 0)) {
+ QGlyphLayout tmp = g.mid(i, 1);
+ actualFontEngine->recalcAdvances(&tmp, 0);
+ }
+ g.attributes[i].dontPrint = true;
+ }
+ break;
+ default:
+ break;
+ }
}
}
while (str_pos < item_length)
@@ -1618,10 +1636,10 @@ void QTextEngine::itemize() const
for (int i = 0; i < length; ++i) {
switch (analysis[i].script) {
case QChar::Script_Latin:
- case QChar::Script_Han:
case QChar::Script_Hiragana:
case QChar::Script_Katakana:
case QChar::Script_Bopomofo:
+ case QChar::Script_Han:
analysis[i].script = QChar::Script_Common;
break;
default:
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index efd12b2b15..c60d0cc775 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3458,14 +3458,16 @@ void QTextFormatCollection::setDefaultFont(const QFont &f)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QTextLength &l)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))";
- return dbg.space();
+ return dbg;
}
QDebug operator<<(QDebug dbg, const QTextFormat &f)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index edace3d13c..f8f41bb53d 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1050,25 +1050,14 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// set element specific attributes
switch (id) {
case Html_a:
- charFormat.setAnchor(true);
for (int i = 0; i < attributes.count(); i += 2) {
const QString key = attributes.at(i);
if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
&& !attributes.at(i + 1).isEmpty()) {
hasHref = true;
- charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- charFormat.setForeground(QGuiApplication::palette().link());
}
}
-
- break;
- case Html_em:
- case Html_i:
- case Html_cite:
- case Html_address:
- case Html_var:
- case Html_dfn:
- charFormat.setFontItalic(true);
+ charFormat.setAnchor(true);
break;
case Html_big:
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(1));
@@ -1076,36 +1065,27 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
case Html_small:
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(-1));
break;
- case Html_strong:
- case Html_b:
- charFormat.setFontWeight(QFont::Bold);
- break;
case Html_h1:
- charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(3));
margin[QTextHtmlParser::MarginTop] = 18;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h2:
- charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(2));
margin[QTextHtmlParser::MarginTop] = 16;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h3:
- charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(1));
margin[QTextHtmlParser::MarginTop] = 14;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h4:
- charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(0));
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h5:
- charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(-1));
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 4;
@@ -1114,11 +1094,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
- case Html_center:
- blockFormat.setAlignment(Qt::AlignCenter);
- break;
case Html_ul:
- listStyle = QTextListFormat::ListDisc;
// nested lists don't have margins, except for the toplevel one
if (!isNestedList(parser)) {
margin[QTextHtmlParser::MarginTop] = 12;
@@ -1127,7 +1103,6 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// no left margin as we use indenting instead
break;
case Html_ol:
- listStyle = QTextListFormat::ListDecimal;
// nested lists don't have margins, except for the toplevel one
if (!isNestedList(parser)) {
margin[QTextHtmlParser::MarginTop] = 12;
@@ -1135,26 +1110,12 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
}
// no left margin as we use indenting instead
break;
- case Html_code:
- case Html_tt:
- case Html_kbd:
- case Html_samp:
- charFormat.setFontFamily(QString::fromLatin1("Courier New,courier"));
- // <tt> uses a fixed font, so set the property
- charFormat.setFontFixedPitch(true);
- break;
case Html_br:
text = QChar(QChar::LineSeparator);
- wsm = QTextHtmlParserNode::WhiteSpacePre;
break;
- // ##### sub / sup
case Html_pre:
- charFormat.setFontFamily(QString::fromLatin1("Courier New,courier"));
- wsm = WhiteSpacePre;
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
- // <pre> uses a fixed font
- charFormat.setFontFixedPitch(true);
break;
case Html_blockquote:
margin[QTextHtmlParser::MarginTop] = 12;
@@ -1169,28 +1130,6 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
case Html_dd:
margin[QTextHtmlParser::MarginLeft] = 30;
break;
- case Html_u:
- charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- break;
- case Html_s:
- charFormat.setFontStrikeOut(true);
- break;
- case Html_nobr:
- wsm = WhiteSpaceNoWrap;
- break;
- case Html_th:
- charFormat.setFontWeight(QFont::Bold);
- blockFormat.setAlignment(Qt::AlignCenter);
- break;
- case Html_td:
- blockFormat.setAlignment(Qt::AlignLeft);
- break;
- case Html_sub:
- charFormat.setVerticalAlignment(QTextCharFormat::AlignSubScript);
- break;
- case Html_sup:
- charFormat.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
- break;
default: break;
}
}
@@ -1345,6 +1284,14 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
case QCss::QtListNumberSuffix:
textListNumberSuffix = decl.d->values.first().variant.toString();
break;
+ case QCss::TextAlignment:
+ switch (identifier) {
+ case QCss::Value_Left: blockFormat.setAlignment(Qt::AlignLeft); break;
+ case QCss::Value_Center: blockFormat.setAlignment(Qt::AlignCenter); break;
+ case QCss::Value_Right: blockFormat.setAlignment(Qt::AlignRight); break;
+ default: break;
+ }
+ break;
default: break;
}
}
@@ -1833,6 +1780,189 @@ void QTextHtmlParser::importStyleSheet(const QString &href)
}
}
+QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &node)
+{
+ QVector<QCss::Declaration> decls;
+ QCss::Declaration decl;
+ QCss::Value val;
+ switch (node.id) {
+ case Html_a:
+ case Html_u: {
+ bool needsUnderline = (node.id == Html_u) ? true : false;
+ if (node.id == Html_a) {
+ for (int i = 0; i < node.attributes.count(); i += 2) {
+ const QString key = node.attributes.at(i);
+ if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
+ && !node.attributes.at(i + 1).isEmpty()) {
+ needsUnderline = true;
+ decl.d->property = QLatin1String("color");
+ decl.d->propertyId = QCss::Color;
+ val.type = QCss::Value::Color;
+ val.variant = QVariant(QGuiApplication::palette().link());
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ }
+ }
+ }
+ if (needsUnderline) {
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("text-decoration");
+ decl.d->propertyId = QCss::TextDecoration;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = QVariant(QCss::Value_Underline);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ }
+ break;
+ }
+ case Html_b:
+ case Html_strong:
+ case Html_h1:
+ case Html_h2:
+ case Html_h3:
+ case Html_h4:
+ case Html_h5:
+ case Html_th:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("font-weight");
+ decl.d->propertyId = QCss::FontWeight;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = QVariant(QCss::Value_Bold);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ if (node.id == Html_b || node.id == Html_strong)
+ break;
+ // Delibrate fall through
+ case Html_big:
+ case Html_small:
+ if (node.id != Html_th) {
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("font-size");
+ decl.d->propertyId = QCss::FontSize;
+ decl.d->inheritable = false;
+ val.type = QCss::Value::KnownIdentifier;
+ switch (node.id) {
+ case Html_h1: val.variant = QVariant(QCss::Value_XXLarge); break;
+ case Html_h2: val.variant = QVariant(QCss::Value_XLarge); break;
+ case Html_h3: case Html_big: val.variant = QVariant(QCss::Value_Large); break;
+ case Html_h4: val.variant = QVariant(QCss::Value_Medium); break;
+ case Html_h5: case Html_small: val.variant = QVariant(QCss::Value_Small); break;
+ default: break;
+ }
+ decl.d->values = QVector<QCss::Value>() << val;
+ decls << decl;
+ break;
+ }
+ // Delibrate fall through
+ case Html_center:
+ case Html_td:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("text-align");
+ decl.d->propertyId = QCss::TextAlignment;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = (node.id == Html_td) ? QVariant(QCss::Value_Left) : QVariant(QCss::Value_Center);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ case Html_s:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("text-decoration");
+ decl.d->propertyId = QCss::TextDecoration;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = QVariant(QCss::Value_LineThrough);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ case Html_em:
+ case Html_i:
+ case Html_cite:
+ case Html_address:
+ case Html_var:
+ case Html_dfn:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("font-style");
+ decl.d->propertyId = QCss::FontStyle;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = QVariant(QCss::Value_Italic);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ case Html_sub:
+ case Html_sup:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("vertical-align");
+ decl.d->propertyId = QCss::VerticalAlignment;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = (node.id == Html_sub) ? QVariant(QCss::Value_Sub) : QVariant(QCss::Value_Super);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ case Html_ul:
+ case Html_ol:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("list-style");
+ decl.d->propertyId = QCss::ListStyle;
+ val.type = QCss::Value::KnownIdentifier;
+ val.variant = (node.id == Html_ul) ? QVariant(QCss::Value_Disc) : QVariant(QCss::Value_Decimal);
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ case Html_code:
+ case Html_tt:
+ case Html_kbd:
+ case Html_samp:
+ case Html_pre: {
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("font-family");
+ decl.d->propertyId = QCss::FontFamily;
+ QVector<QCss::Value> values;
+ val.type = QCss::Value::String;
+ val.variant = QLatin1String("Courier New");
+ values << val;
+ val.type = QCss::Value::TermOperatorComma;
+ val.variant = QVariant();
+ values << val;
+ val.type = QCss::Value::String;
+ val.variant = QLatin1String("courier");
+ values << val;
+ decl.d->values = values;
+ decl.d->inheritable = true;
+ decls << decl;
+ }
+ if (node.id != Html_pre)
+ break;
+ // Delibrate fall through
+ case Html_br:
+ case Html_nobr:
+ decl = QCss::Declaration();
+ decl.d->property = QLatin1String("whitespace");
+ decl.d->propertyId = QCss::Whitespace;
+ val.type = QCss::Value::KnownIdentifier;
+ switch (node.id) {
+ case Html_br: val.variant = QVariant(QCss::Value_PreWrap); break;
+ case Html_nobr: val.variant = QVariant(QCss::Value_NoWrap); break;
+ case Html_pre: val.variant = QVariant(QCss::Value_Pre); break;
+ default: break;
+ }
+ decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->inheritable = true;
+ decls << decl;
+ break;
+ default:
+ break;
+ }
+ return decls;
+}
+
QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
{
QVector<QCss::Declaration> decls;
@@ -1860,8 +1990,20 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
const char *extraPseudo = 0;
if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
extraPseudo = "link";
- decls = selector.declarationsForNode(n, extraPseudo);
-
+ // Ensure that our own style is taken into consideration
+ decls = standardDeclarationForNode(nodes.at(node));
+ decls += selector.declarationsForNode(n, extraPseudo);
+ n = selector.parentNode(n);
+ while (!selector.isNullNode(n)) {
+ QVector<QCss::Declaration> inheritedDecls;
+ inheritedDecls = selector.declarationsForNode(n, extraPseudo);
+ for (int i = 0; i < inheritedDecls.size(); ++i) {
+ const QCss::Declaration &decl = inheritedDecls.at(i);
+ if (decl.d->inheritable)
+ decls.prepend(decl);
+ }
+ n = selector.parentNode(n);
+ }
return decls;
}
diff --git a/src/gui/util/qlayoutpolicy.cpp b/src/gui/util/qlayoutpolicy.cpp
index f1900122ac..0a050184a6 100644
--- a/src/gui/util/qlayoutpolicy.cpp
+++ b/src/gui/util/qlayoutpolicy.cpp
@@ -119,9 +119,10 @@ QDataStream &operator>>(QDataStream &stream, QLayoutPolicy &policy)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QLayoutPolicy &p)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QLayoutPolicy(horizontalPolicy = " << p.horizontalPolicy()
<< ", verticalPolicy = " << p.verticalPolicy() << ')';
- return dbg.space();
+ return dbg;
}
#endif