From bbdaf08826a9c93d2c0f56cbe064ee4c47a04f0f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 19 Jun 2009 15:31:04 +1000 Subject: Remove GL filters --- src/declarative/fx/fx.pri | 8 - src/declarative/fx/qfxblurfilter.cpp | 467 ----------------------------- src/declarative/fx/qfxblurfilter.h | 82 ----- src/declarative/fx/qfxhighlightfilter.cpp | 320 -------------------- src/declarative/fx/qfxhighlightfilter.h | 98 ------ src/declarative/fx/qfxreflectionfilter.cpp | 352 ---------------------- src/declarative/fx/qfxreflectionfilter.h | 96 ------ src/declarative/fx/qfxshadowfilter.cpp | 214 ------------- src/declarative/fx/qfxshadowfilter.h | 86 ------ 9 files changed, 1723 deletions(-) delete mode 100644 src/declarative/fx/qfxblurfilter.cpp delete mode 100644 src/declarative/fx/qfxblurfilter.h delete mode 100644 src/declarative/fx/qfxhighlightfilter.cpp delete mode 100644 src/declarative/fx/qfxhighlightfilter.h delete mode 100644 src/declarative/fx/qfxreflectionfilter.cpp delete mode 100644 src/declarative/fx/qfxreflectionfilter.h delete mode 100644 src/declarative/fx/qfxshadowfilter.cpp delete mode 100644 src/declarative/fx/qfxshadowfilter.h diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 1c819e7..166ad58 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -3,7 +3,6 @@ HEADERS += \ fx/qfxanchors_p.h \ fx/qfxanimatedimageitem.h \ fx/qfxblendedimage.h \ - fx/qfxblurfilter.h \ fx/qfxcomponentinstance.h \ fx/qfxcomponentinstance_p.h \ fx/qfxcontentwrapper.h \ @@ -16,7 +15,6 @@ HEADERS += \ fx/qfxfocusrealm.h \ fx/qfxgridview.h \ fx/qfxflowview.h \ - fx/qfxhighlightfilter.h \ fx/qfximage.h \ fx/qfxpainteditem.h \ fx/qfxpainteditem_p.h \ @@ -36,11 +34,9 @@ HEADERS += \ fx/qfxpathview_p.h \ fx/qfxrect.h \ fx/qfxrect_p.h \ - fx/qfxreflectionfilter.h \ fx/qfxrepeater.h \ fx/qfxrepeater_p.h \ fx/qfxscalegrid.h \ - fx/qfxshadowfilter.h \ fx/qfxtextedit.h \ fx/qfxtextedit_p.h \ fx/qfxtext.h \ @@ -55,7 +51,6 @@ SOURCES += \ fx/qfxanchors.cpp \ fx/qfxanimatedimageitem.cpp \ fx/qfxblendedimage.cpp \ - fx/qfxblurfilter.cpp \ fx/qfxcomponentinstance.cpp \ fx/qfxcontentwrapper.cpp \ fx/qfxevents.cpp \ @@ -65,7 +60,6 @@ SOURCES += \ fx/qfxfocusrealm.cpp \ fx/qfxgridview.cpp \ fx/qfxflowview.cpp \ - fx/qfxhighlightfilter.cpp \ fx/qfximage.cpp \ fx/qfxpainteditem.cpp \ fx/qfxitem.cpp \ @@ -77,10 +71,8 @@ SOURCES += \ fx/qfxpath.cpp \ fx/qfxpathview.cpp \ fx/qfxrect.cpp \ - fx/qfxreflectionfilter.cpp \ fx/qfxrepeater.cpp \ fx/qfxscalegrid.cpp \ - fx/qfxshadowfilter.cpp \ fx/qfxtext.cpp \ fx/qfxtextedit.cpp \ fx/qfxtransform.cpp \ diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp deleted file mode 100644 index 84799ec..0000000 --- a/src/declarative/fx/qfxblurfilter.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxblurfilter.h" -#include - -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#include -#endif - -QT_BEGIN_NAMESPACE -class QFxBlurFilterPrivate -{ -public: - QFxBlurFilterPrivate() - : radius(0) - { - } - qreal radius; -}; - -/*! - \qmlclass Blur - \brief The Blur filter blurs an item and its contents. - \inherits Filter - - Blurring reduces the clarity of a visual item. The following example - shows an icon at a blur radius of 0, 5 and 10. - - \table - \row - \o - \qml -HorizontalLayout { - Image { - source: "icon.png" - filter: Blur { radius: 0 } - } - Image { - source: "icon.png" - filter: Blur { radius: 5 } - } - Image { - source: "icon.png" - filter: Blur { radius: 10 } - } -} - \endqml - \row - \o \image blur_example.png - \endtable - - Bluring is only supported when Qt Declarative is compiled for OpenGL ES 2.0. - Otherwise the Blur filter has no effect. - */ -/*! - \internal - \class QFxBlurFilter - \ingroup group_effects - \brief The QFxBlurFilter class allows you to blur an item. -*/ - -QFxBlurFilter::QFxBlurFilter(QObject *parent) -: QSimpleCanvasFilter(parent), d(new QFxBlurFilterPrivate) -{ -} - -QFxBlurFilter::~QFxBlurFilter() -{ - delete d; d = 0; -} - -/*! - \qmlproperty real Blur::radius - - Sets the blur kernel radius. - The larger the radius the more blurry the item will appear. - A radius of 0 (or less) is equivalent to no blur. - */ - -/*! - \property QFxBlurFilter::radius - \brief the radius of the blur. -*/ -qreal QFxBlurFilter::radius() const -{ - return d->radius; -} - -void QFxBlurFilter::setRadius(qreal radius) -{ - if (d->radius == radius) return; - d->radius = radius; - emit radiusChanged(radius); - update(); -} - -QRectF QFxBlurFilter::itemBoundingRect(const QRectF &r) const -{ - QRectF rv = r; - if (d->radius > 0) - rv.adjust(-d->radius, -d->radius, d->radius, d->radius); - return rv; -} - -#include -void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) -{ -#if defined(QFX_RENDER_OPENGL2) -#if 1 - if (d->radius <= 0) { - renderToScreen(); - return; - } - float radius = d->radius; - QSimpleCanvasItem *item = this->item(); - - QRect r = item->itemBoundingRect(); - float blurScale = 1.0; - QRect tr = QRect(QPoint(0, 0), r.size() * blurScale); - radius *= blurScale; - - QGLFramebufferObject *fbo = renderToFBO(blurScale); - if (!fbo) - return; - - float height = r.height(); - float width = r.width(); - - float texWidth = float(tr.width()) / float(fbo->width()); - float texHeight = float(tr.height()) / float(fbo->height()); - - int steps = int(::ceil(radius)); - int dispSteps = int(::ceil(d->radius)); - float xstep = texWidth * radius / float(steps * fbo->width()); - float xinc = steps / float(fbo->width()); - - glDisable(GL_BLEND); - - // Render x pass - QSize xSize(tr.width() + 2 * steps, tr.height()); - QGLFramebufferObject *xBlur = acquireFBO(xSize); - float xWidth = float(xSize.width()) / float(xBlur->width()); - float xHeight = float(xSize.height()) / float(xBlur->height()); - { - xBlur->bind(); - - GLSaveViewport sv; GLSaveScissor ss; - glClearColor(0,0,0,0); - glDisable(GL_SCISSOR_TEST); - glViewport(0, 0, xBlur->width(), xBlur->height()); - glClear(GL_COLOR_BUFFER_BIT); - - float vert[] = { 0, xHeight, - xWidth, xHeight, - 0, 0, - xWidth, 0 }; - float texVert[] = { -xinc, 0, - texWidth + xinc, 0, - -xinc, texHeight, - texWidth + xinc, texHeight }; - - QMatrix4x4 trans; - trans.translate(-1, -1); - trans.scale(2, 2); - BlurTextureShader *shader = item->basicShaders()->blurTexture(); - shader->enable(); - shader->setTransform(trans); - if (steps > 1) { - shader->setStep(xstep * 2); - shader->setSteps(steps / 2); - } else { - shader->setStep(xstep); - shader->setSteps(steps); - } - shader->setMode(BlurTextureShader::Horizontal); - - glBindTexture(GL_TEXTURE_2D, fbo->texture()); - - shader->setAttributeArray(BlurTextureShader::Vertices, vert, 2); - shader->setAttributeArray(BlurTextureShader::TextureCoords, texVert, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(BlurTextureShader::Vertices); - shader->disableAttributeArray(BlurTextureShader::TextureCoords); - xBlur->release(); - } - - // Render y pass - QSize ySize(xSize.width(), tr.height() + 2 * steps); - QGLFramebufferObject *yBlur = acquireFBO(ySize); - - float yWidth = float(ySize.width()) / float(yBlur->width()); - float yHeight = float(ySize.height()) / float(yBlur->height()); - float ystep = radius / float(steps * xBlur->height()); - float yinc = steps / float(xBlur->height()); - { - yBlur->bind(); - - GLSaveViewport sv; GLSaveScissor ss; - glClearColor(0,0,0,0); - glDisable(GL_SCISSOR_TEST); - glViewport(0, 0, yBlur->width(), yBlur->height()); - glClear(GL_COLOR_BUFFER_BIT); - - float vert[] = { 0, yHeight, - yWidth, yHeight, - 0, 0, - yWidth, 0 }; - float texVert[] = { 0, -yinc, - xWidth, -yinc, - 0, xHeight + yinc, - xWidth, xHeight + yinc }; - - QMatrix4x4 trans; - trans.translate(-1, -1); - trans.scale(2, 2); - BlurTextureShader *shader = item->basicShaders()->blurTexture(); - shader->enable(); - shader->setTransform(trans); - if (steps > 1) { - shader->setStep(ystep * 2); - shader->setSteps(steps / 2); - } else { - shader->setStep(ystep); - shader->setSteps(steps); - } - shader->setMode(BlurTextureShader::Vertical); - - glBindTexture(GL_TEXTURE_2D, xBlur->texture()); - - shader->setAttributeArray(BlurTextureShader::Vertices, vert, 2); - shader->setAttributeArray(BlurTextureShader::TextureCoords, texVert, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(BlurTextureShader::Vertices); - shader->disableAttributeArray(BlurTextureShader::TextureCoords); - yBlur->release(); - } - - glEnable(GL_BLEND); - - // Render display pass - { - glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - float vert[] = { -dispSteps, height + dispSteps, - width + dispSteps, height + dispSteps, - -dispSteps, -dispSteps, - width + dispSteps, -dispSteps }; - float texVert[] = { 0, 0, - yWidth, 0, - 0, yHeight, - yWidth, yHeight }; - SingleTextureShader *shader = item->basicShaders()->singleTexture(); - shader->enable(); - shader->setTransform(p.activeTransform); - - glBindTexture(GL_TEXTURE_2D, yBlur->texture()); - - shader->setAttributeArray(SingleTextureShader::Vertices, vert, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVert, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(SingleTextureShader::Vertices); - shader->disableAttributeArray(SingleTextureShader::TextureCoords); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - - releaseFBO(yBlur); - releaseFBO(xBlur); - releaseFBO(fbo); -#else -#if 0 - if (d->radius <= 0) { - renderToScreen(); - return; - } - QSimpleCanvasItem *item = this->item(); - - QRect r = item->itemBoundingRect(); - - float scale = 0.5; - float scalePercent = scale / d->radius; - QGLFramebufferObject *fbo = renderToFBO(scalePercent); - if (!fbo) - return; - - QGLFramebufferObject *xfbo = acquireFBO(QSize(scale * r.width(), fbo->height())); - QGLFramebufferObject *yfbo = acquireFBO(QSize(scale * r.width(), scale * r.height())); - - - BlurTextureShader *shader = item->basicShaders()->blurTexture(); - shader->enable(); - shader->setTransform(QMatrix4x4()); - - // Render up - x - { - shader->setMode(BlurTextureShader::Horizontal); - shader->setStep(1. / float(xfbo->width())); - - GLSaveViewport vp; - xfbo->bind(); - glClearColor(0,0,0,0); - glViewport(0, 0, xfbo->width(), xfbo->height()); - glClear(GL_COLOR_BUFFER_BIT); - - float oWidth = -1. + 2. * float(r.width()) * scale / float(xfbo->width()); - float oHeight = -1. + 2. * float(r.height()) * scalePercent / float(xfbo->height()); - float vert[] = { - -1, -1, - oWidth, -1, - -1, oHeight, - - -1, oHeight, - oWidth, oHeight, - oWidth, -1 - }; - - float tWidth = r.width() * scalePercent / fbo->width(); - float tHeight = r.height() * scalePercent / fbo->height(); - float texVert[] = { - 0, 0, - tWidth, 0, - 0, tHeight, - - 0, tHeight, - tWidth, tHeight, - tWidth, 0 - }; - - glBindTexture(GL_TEXTURE_2D, fbo->texture()); - shader->setAttributeArray(BlurTextureShader::Vertices, vert, 2); - shader->setAttributeArray(BlurTextureShader::TextureCoords, texVert, 2); - - glDrawArrays(GL_TRIANGLES, 0, 6); - - xfbo->release(); - } - - // Render up - y - { - shader->setMode(BlurTextureShader::Vertical); - shader->setStep(1. / float(yfbo->height())); - - GLSaveViewport vp; - yfbo->bind(); - glClearColor(0,0,0,0); - glViewport(0, 0, yfbo->width(), yfbo->height()); - glClear(GL_COLOR_BUFFER_BIT); - - float oWidth = -1. + 2. * r.width() * scale / yfbo->width(); - float oHeight = -1. + 2. * r.height() * scale / yfbo->height(); - float vert[] = { - -1, -1, - oWidth, -1, - -1, oHeight, - - -1, oHeight, - oWidth, oHeight, - oWidth, -1 - }; - - float tWidth = r.width() * scale / xfbo->width(); - float tHeight = r.height() * scalePercent / xfbo->height(); - float texVert[] = { - 0, 0, - tWidth, 0, - 0, tHeight, - - 0, tHeight, - tWidth, tHeight, - tWidth, 0 - }; - - glBindTexture(GL_TEXTURE_2D, xfbo->texture()); - shader->setAttributeArray(BlurTextureShader::Vertices, vert, 2); - shader->setAttributeArray(BlurTextureShader::TextureCoords, texVert, 2); - - glDrawArrays(GL_TRIANGLES, 0, 6); - - yfbo->release(); - } - - shader->disableAttributeArray(BlurTextureShader::Vertices); - shader->disableAttributeArray(BlurTextureShader::TextureCoords); - - float width = r.width(); - float height = r.height(); - //paint to screen - { - float texWidth = r.width() * scale / float(yfbo->width()); - float texHeight = r.height() * scale / float(yfbo->height()); - - GLfloat vertices[] = { 0, height, - width, height, - 0, 0, - width, 0 }; - GLfloat texVertices[] = { 0, 0, - texWidth, 0, - 0, texHeight, - texWidth, texHeight }; - - glBindTexture(GL_TEXTURE_2D, yfbo->texture()); - - SingleTextureOpacityShader *shader = - item->basicShaders()->singleTextureOpacity(); - shader->enable(); - shader->setTransform(p.activeTransform); - shader->setOpacity(p.activeOpacity); - shader->setAttributeArray(SingleTextureVertexOpacityShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureVertexOpacityShader::TextureCoords, texVertices, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::Vertices); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::TextureCoords); - } - - - releaseFBO(fbo); - releaseFBO(xfbo); - releaseFBO(yfbo); -#endif -#endif -#else - Q_UNUSED(p); -#endif - -} - -QML_DEFINE_TYPE(QFxBlurFilter,Blur) -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxblurfilter.h b/src/declarative/fx/qfxblurfilter.h deleted file mode 100644 index 90285de..0000000 --- a/src/declarative/fx/qfxblurfilter.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXBLURFILTER_H -#define QFXBLURFILTER_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxBlurFilterPrivate; -class Q_DECLARATIVE_EXPORT QFxBlurFilter : public QSimpleCanvasFilter -{ - Q_OBJECT - Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) -public: - QFxBlurFilter(QObject *parent=0); - virtual ~QFxBlurFilter(); - - qreal radius() const; - void setRadius(qreal); - -Q_SIGNALS: - void radiusChanged(qreal); - -protected: - virtual QRectF itemBoundingRect(const QRectF &) const; - virtual void filterGL(QSimpleCanvasItem::GLPainter &p); - -private: - QFxBlurFilterPrivate *d; -}; -QML_DECLARE_TYPE(QFxBlurFilter) - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // QFXBLURFILTER_H diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp deleted file mode 100644 index 1671fc6..0000000 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxhighlightfilter.h" -#include -#include - -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#include -#include -#endif - -QT_BEGIN_NAMESPACE - -class QFxHighlightFilterPrivate -{ -public: - QFxHighlightFilterPrivate() - : xOffset(0), yOffset(0), tiled(false) {} - - QUrl url; - int xOffset; - int yOffset; - bool tiled; -#if defined(QFX_RENDER_OPENGL2) - GLTexture tex; -#endif -}; - -/*! - \qmlclass Highlight - \brief The Highlight filter adds a highlight to an item. - \inherits Filter - - \qml -Text { - id: highlighttext - color: "red" - font.size: 32 - text: "Highlight" - filter: Highlight { - source: "pics/highlight.png" - xOffset: NumericAnimation { - running: true - repeat: true - from: 320 - to: -320 - duration: 2000 - } - } -} - \endqml - \image highlight.gif - - Highlighting is only supported when Qt Declarative is compiled for OpenGL ES 2.0. - Otherwise the Highlight filter has no effect. -*/ - -/*! - \internal - \class QFxHighlightFilter - \ingroup group_effects - \brief The QFxHightlightFilter class allows you to add a highlight to an item. -*/ - -QFxHighlightFilter::QFxHighlightFilter(QObject *parent) -: QSimpleCanvasFilter(parent), d(new QFxHighlightFilterPrivate) -{ -#if defined(QFX_RENDER_OPENGL2) - d->tex.setHorizontalWrap(GLTexture::ClampToEdge); - d->tex.setVerticalWrap(GLTexture::ClampToEdge); -#endif -} - -QFxHighlightFilter::~QFxHighlightFilter() -{ - if (!d->url.isEmpty()) - QFxPixmap::cancelGet(d->url, this); - delete d; - d = 0; -} - -/*! - \qmlproperty string Highlight::source - This property holds the URL of the image to be used as the highlight. -*/ - -/*! - \property QFxHighlightFilter::source - \brief the URL of the image to be used as the highlight. -*/ -QUrl QFxHighlightFilter::source() const -{ - return d->url; -} - -void QFxHighlightFilter::imageLoaded() -{ - QPixmap img = QFxPixmap(d->url); -#if defined(QFX_RENDER_OPENGL2) - if (!img.isNull()) - d->tex.setImage(img.toImage()); -#endif - emit sourceChanged(d->url); - update(); -} - -void QFxHighlightFilter::setSource(const QUrl &f) -{ - if (d->url == f) - return; - if (!d->url.isEmpty()) - QFxPixmap::cancelGet(d->url, this); - Q_ASSERT(!f.isRelative()); - d->url = f; -#if defined(QFX_RENDER_OPENGL2) - d->tex.clear(); -#endif - if (!f.isEmpty()) - QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded())); - else - emit sourceChanged(d->url); -} - -/*! - \qmlproperty bool Highlight::tiled - This property holds whether or not the highlight should be tiled. -*/ - -/*! - \property QFxHighlightFilter::tiled - \brief whether or not the highlight should be tiled. -*/ -bool QFxHighlightFilter::tiled() const -{ - return d->tiled; -} - -void QFxHighlightFilter::setTiled(bool t) -{ - if (t == d->tiled) - return; - - d->tiled = t; - -#if defined(QFX_RENDER_OPENGL2) - if (d->tiled) { - d->tex.setHorizontalWrap(GLTexture::ClampToEdge); - d->tex.setVerticalWrap(GLTexture::ClampToEdge); - } else { - d->tex.setHorizontalWrap(GLTexture::Repeat); - d->tex.setVerticalWrap(GLTexture::Repeat); - } -#endif - - emit tiledChanged(d->tiled); -} - -/*! - \qmlproperty int Highlight::xOffset - \qmlproperty int Highlight::yOffset - These properties hold the position of the highlight, relative to the item. -*/ - -/*! - \property QFxHighlightFilter::xOffset - \brief the x position of the highlight, relative to the item. -*/ -int QFxHighlightFilter::xOffset() const -{ - return d->xOffset; -} - -void QFxHighlightFilter::setXOffset(int x) -{ - if (x == d->xOffset) - return; - - d->xOffset = x; - emit offsetChanged(d->xOffset, d->yOffset); -#if defined(QFX_RENDER_OPENGL2) - update(); -#endif -} - -/*! - \property QFxHighlightFilter::yOffset - \brief the y position of the highlight, relative to the item. -*/ -int QFxHighlightFilter::yOffset() const -{ - return d->yOffset; -} - -void QFxHighlightFilter::setYOffset(int y) -{ - if (y == d->yOffset) - return; - - d->yOffset = y; - emit offsetChanged(d->xOffset, d->yOffset); -#if defined(QFX_RENDER_OPENGL2) - update(); -#endif -} - -void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p) -{ -#if defined(QFX_RENDER_OPENGL2) - if (d->tex.isNull()) { - renderToScreen(); - } else { - QSimpleCanvasItem *item = this->item(); - - QRect r = item->itemBoundingRect(); - - QGLFramebufferObject *fbo = renderToFBO(); - - float width = r.width(); - float height = r.height(); - - float texWidth = width / float(fbo->width()); - float texHeight = height / float(fbo->height()); - - GLfloat vert[] = { 0, height, - width, height, - 0, 0, - width, 0 }; - GLfloat texVert[] = { 0, 0, - texWidth, 0, - 0, texHeight, - texWidth, texHeight }; - float texXOffset = 0; - float texYOffset = 0; - - if (xOffset()) - texXOffset = float(xOffset()) / float(d->tex.width()); - if (yOffset()) - texYOffset = float(yOffset()) / float(d->tex.height()); - - GLfloat addTexVert[] = { texXOffset, texYOffset, - 1 + texXOffset, texYOffset, - texXOffset, 1 + texYOffset, - 1 + texXOffset, 1 + texYOffset }; - - glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, fbo->texture()); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - - DualTextureAddShader *shader = item->basicShaders()->dualTextureAdd(); - shader->enable(); - shader->setTransform(p.activeTransform); - shader->setOpacity(p.activeOpacity); - - shader->setAttributeArray(DualTextureAddShader::Vertices, vert, 2); - shader->setAttributeArray(DualTextureAddShader::TextureCoords, texVert, 2); - shader->setAttributeArray(DualTextureAddShader::AddTextureCoords, addTexVert, 2); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - shader->disableAttributeArray(DualTextureAddShader::Vertices); - shader->disableAttributeArray(DualTextureAddShader::TextureCoords); - shader->disableAttributeArray(DualTextureAddShader::AddTextureCoords); - - glActiveTexture(GL_TEXTURE0); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - releaseFBO(fbo); - } -#else - Q_UNUSED(p); -#endif -} - -QML_DEFINE_TYPE(QFxHighlightFilter,Highlight) - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxhighlightfilter.h b/src/declarative/fx/qfxhighlightfilter.h deleted file mode 100644 index 33f0963..0000000 --- a/src/declarative/fx/qfxhighlightfilter.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXHIGHLIGHTFILTER_H -#define QFXHIGHLIGHTFILTER_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxHighlightFilterPrivate; -class Q_DECLARATIVE_EXPORT QFxHighlightFilter : public QSimpleCanvasFilter -{ - Q_OBJECT - - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool tiled READ tiled WRITE setTiled NOTIFY tiledChanged) - Q_PROPERTY(int xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) - Q_PROPERTY(int yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) -public: - QFxHighlightFilter(QObject *parent=0); - virtual ~QFxHighlightFilter(); - - QUrl source() const; - void setSource(const QUrl &); - - bool tiled() const; - void setTiled(bool); - - int xOffset() const; - void setXOffset(int); - int yOffset() const; - void setYOffset(int); - -Q_SIGNALS: - void sourceChanged(const QUrl &); - void offsetChanged(int x, int y); - void tiledChanged(bool); - -private Q_SLOTS: - void imageLoaded(); - -protected: - virtual void filterGL(QSimpleCanvasItem::GLPainter &p); - -private: - QFxHighlightFilterPrivate *d; -}; -QML_DECLARE_TYPE(QFxHighlightFilter) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXHIGHLIGHTFILTER_H diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp deleted file mode 100644 index c66deb7..0000000 --- a/src/declarative/fx/qfxreflectionfilter.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxreflectionfilter.h" - -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#include -#include -#endif - -QT_BEGIN_NAMESPACE -class QFxReflectionFilterPrivate -{ -public: - QFxReflectionFilterPrivate() - : alpha(1), height(-1), offset(0), scale(1) - { - } - qreal alpha; - int height; - int offset; - qreal scale; -}; - -/*! - \qmlclass Reflection - \inherits Filter - \brief The Reflection filter reflects an item and its contents. - - Here is an example of various Reflections applied to an image. - - \qml -HorizontalLayout { - Image { - source: "icon.png" - filter: Reflection { } - } - Image { - source: "icon.png" - filter: Reflection { offset: 1 } - } - Image { - source: "icon.png" - filter: Reflection { offset: 1; alpha: 0.5 } - } - Image { - source: "icon.png" - filter: Reflection { offset: 1; alpha: 0.5; height: 50 } - } - Image { - source: "icon.png" - filter: Reflection { offset: 1; alpha: 0.5; height: 50; scale: 0.5 } - } -} - \endqml - - \image reflection_example.png - - Reflection is only supported when Qt Declarative is compiled for OpenGL ES 2.0. - Otherwise the Reflection filter has no effect. -*/ - -/*! - \internal - \class QFxReflectionFilter - \ingroup group_effects - \brief The QFxReflectionFilter class allows you to add a reflection to an item. -*/ -QFxReflectionFilter::QFxReflectionFilter(QObject *parent) -: QSimpleCanvasFilter(parent), d(new QFxReflectionFilterPrivate) -{ -} - -QFxReflectionFilter::~QFxReflectionFilter() -{ - delete d; d = 0; -} - -/*! - \property QFxReflectionFilter::alpha - \brief the starting opacity of the reflection. - - The starting opacity is the opacity closest to the item. The opacity will fade - from this value to zero over the height of the reflection. -*/ -qreal QFxReflectionFilter::alpha() const -{ - return d->alpha; -} - -void QFxReflectionFilter::setAlpha(qreal a) -{ - if (d->alpha == a) return; - d->alpha = a; - emit alphaChanged(a); - update(); -} - -/*! - \qmlproperty int Reflection::height - - The height property controls how much of the item, in pixels, to reflect. - If it is set to the default value of -1, the whole item is reflected. If - it is set to 50, the bottom 50 pixels of the item are reflected. Data - binding could be used to reflect a percentage of the item. - - \qml -Image { - id: myImage - source: "album.png" - filter: Reflection { - height: myImage.height * 0.5 - } -} - \endqml - */ -/*! - \qmlproperty int Reflection::offset - - The offset controls how far from the base of the item, in pixels, the - start of the reflection is placed. This can be used to create a nice - sliver of space between the item and its reflection or for more advanced - effects. - - The default offset is 0 pixels. -*/ - -/*! - \qmlproperty real Reflection::alpha - - The alpha value controls the starting opacity of the reflected item. If - set to the default value of 1, the reflected item starts completely opaque - and gradually fades to completely transparent. If set to less than one, the - reflection starts out partially transparent as though the item was sitting - on a visually less reflective surface. - - Valid values are from 0 (which would be silly, but is allowed) to 1. -*/ -/*! - \qmlproperty real Reflection::scale - - When set to the default value of 1, the reflection is a 1:1 reflection of - the item. That is, each horizontal pixel in the item corresponds to one - horizontal pixel in the reflection. - - When set a value other than 1, the reflection is scaled acordingly - less - than 1 scales it down and greater than 1 scales it up. The scale is applied - after the height parameter and does not effect the reflection offset. -*/ - -/*! - \property QFxReflectionFilter::height - \brief the height of the reflection, in pixels. -*/ -int QFxReflectionFilter::height() const -{ - return d->height; -} - -void QFxReflectionFilter::setHeight(int h) -{ - if (d->height == h) return; - d->height = h; - emit heightChanged(h); - update(); -} - -/*! - \property QFxReflectionFilter::offset - \brief the distance of the reflection from the item, in pixels. -*/ -int QFxReflectionFilter::offset() -{ - return d->offset; -} - -void QFxReflectionFilter::setOffset(int o) -{ - if (d->offset == o) return; - d->offset = o; - emit offsetChanged(o); - update(); -} - -/*! - \property QFxReflectionFilter::scale - \brief the scale of the reflection relative to the item. -*/ -qreal QFxReflectionFilter::scale() const -{ - return d->scale; -} - -void QFxReflectionFilter::setScale(qreal s) -{ - if (d->scale == s) return; - d->scale = s; - emit scaleChanged(s); - update(); -} - -static inline float floatmin(float a, float b) -{ - return (a < b)?a:b; -} - -void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p) -{ -#if defined(QFX_RENDER_OPENGL2) - QSimpleCanvasItem *item = this->item(); - - QRect r = item->itemBoundingRect(); - if (r.isEmpty()) - return; - float width = r.width(); - float height = r.height(); - - float refHeight = height; - if (d->height > 0) - refHeight = floatmin(height, d->height); - - QSimpleCanvas::Matrix simpMat; - QSimpleCanvasItem *simpItem = 0; - if (isSimpleItem(&simpItem, &simpMat) && - simpItem->glSimpleItemData(0, 0, 0, 0)) { - - GLfloat vertices[8]; - GLfloat texVertices[8]; - GLTexture *texture = 0; - - simpItem->glSimpleItemData(vertices, texVertices, &texture, 8); - - GLfloat opacity[4]; - - float invRefHeight = 1. / refHeight; - for (int ii = 0; ii < 4; ++ii) { - float vertex = vertices[ii * 2 + 1]; - float o = (1. - (height - vertex) * invRefHeight); - opacity[ii] = o * d->alpha * p.activeOpacity; - } - - QSimpleCanvas::Matrix trans = p.activeTransform; - trans.rotate(180, 1, 0, 0); - trans.translate(0, -r.height() - d->offset); - if (d->scale != 1) - trans.scale(1, d->scale, 1); - trans.translate(0, -r.height()); - trans *= simpMat; - - glBindTexture(GL_TEXTURE_2D, texture->texture()); - - SingleTextureVertexOpacityShader *shader = - item->basicShaders()->singleTextureVertexOpacity(); - shader->enable(); - shader->setTransform(trans); - shader->setAttributeArray(SingleTextureVertexOpacityShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureVertexOpacityShader::TextureCoords, texVertices, 2); - shader->setAttributeArray(SingleTextureVertexOpacityShader::OpacityCoords, opacity, 1); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::Vertices); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::TextureCoords); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::OpacityCoords); - - } else { - QGLFramebufferObject *fbo = renderToFBO(); - - float texWidth = width / float(fbo->width()); - float texHeight = refHeight / float(fbo->height()); - - GLfloat invVertices[] = { width, height + d->scale * refHeight + d->offset, - 0, height + d->scale * refHeight + d->offset, - width, height + d->offset, - 0, height + d->offset }; - GLfloat invTexVertices[] = { texWidth, texHeight, - 0, texHeight, - texWidth, 0, - 0, 0 }; - GLfloat invOpacity[] = { 0, 0, d->alpha * p.activeOpacity, d->alpha * p.activeOpacity}; - - glBindTexture(GL_TEXTURE_2D, fbo->texture()); - - SingleTextureVertexOpacityShader *shader = - item->basicShaders()->singleTextureVertexOpacity(); - shader->enable(); - shader->setTransform(p.activeTransform); - shader->setAttributeArray(SingleTextureVertexOpacityShader::Vertices, invVertices, 2); - shader->setAttributeArray(SingleTextureVertexOpacityShader::TextureCoords, invTexVertices, 2); - shader->setAttributeArray(SingleTextureVertexOpacityShader::OpacityCoords, invOpacity, 1); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::Vertices); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::TextureCoords); - shader->disableAttributeArray(SingleTextureVertexOpacityShader::OpacityCoords); - - releaseFBO(fbo); - } - - renderToScreen(); - -#else - Q_UNUSED(p); -#endif -} - -QRectF QFxReflectionFilter::itemBoundingRect(const QRectF &r) const -{ - QRectF rv = r; - rv |= r.translated(0, r.height() + d->offset); - return rv; -} - -QML_DEFINE_TYPE(QFxReflectionFilter,Reflection) -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxreflectionfilter.h b/src/declarative/fx/qfxreflectionfilter.h deleted file mode 100644 index 6e56b5e..0000000 --- a/src/declarative/fx/qfxreflectionfilter.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXREFLECTIONFILTER_H -#define QFXREFLECTIONFILTER_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxReflectionFilterPrivate; -class Q_DECLARATIVE_EXPORT QFxReflectionFilter : public QSimpleCanvasFilter -{ - Q_OBJECT - - Q_PROPERTY(qreal alpha READ alpha WRITE setAlpha NOTIFY alphaChanged) - Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged) - Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) -public: - QFxReflectionFilter(QObject *parent=0); - virtual ~QFxReflectionFilter(); - - qreal alpha() const; - void setAlpha(qreal); - int height() const; - void setHeight(int); - int offset(); - void setOffset(int); - qreal scale() const; - void setScale(qreal); - -Q_SIGNALS: - void alphaChanged(qreal); - void heightChanged(int); - void offsetChanged(int); - void scaleChanged(qreal); - -protected: - virtual void filterGL(QSimpleCanvasItem::GLPainter &p); - virtual QRectF itemBoundingRect(const QRectF &r) const; - -private: - Q_DISABLE_COPY(QFxReflectionFilter) - QFxReflectionFilterPrivate *d; -}; -QML_DECLARE_TYPE(QFxReflectionFilter) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXREFLECTIONFILTER_H diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp deleted file mode 100644 index 10c332c..0000000 --- a/src/declarative/fx/qfxshadowfilter.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxshadowfilter.h" - -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#include -#endif - -class QFxShadowFilterPrivate - -QT_BEGIN_NAMESPACE -{ -public: - QFxShadowFilterPrivate() - : x(0), y(0) - { - } - - int x; - int y; -}; - -/*! - \qmlclass Shadow - \brief The Shadow filter casts a drop shadow. - \inherits Filter - - Shadows work on all visual elements - including transparent and masked - images. - - \table - \row - \o \image shadow_example.png - \o - \qml -Rect { - radius: 5 - color: "lightsteelblue" - width: 100 - height: 100 - filter: Shadow { - yOffset: 8 - xOffset: 8 - } -} - -Image { - source: "pics/qtlogo.png" - filter: Shadow { - yOffset: 8 - xOffset: 8 - } -} - \endqml - \endtable - - Shadows are only supported when Qt Qt Declarative is compiled for OpenGL ES 2.0. - Otherwise the Shadow filter has no effect. -*/ - -/*! - \internal - \class QFxShadowFilter - \ingroup group_effects - \brief The QFxShadowFilter class allows you to add a shadow to an item. -*/ - -QFxShadowFilter::QFxShadowFilter(QObject *parent) -: QSimpleCanvasFilter(parent), d(new QFxShadowFilterPrivate) -{ -} - -QFxShadowFilter::~QFxShadowFilter() -{ - delete d; d = 0; -} - -/*! - \qmlproperty int Shadow::xOffset - \qmlproperty int Shadow::yOffset - - Specify the x and y offset of the shadow relative to the item. -*/ - -int QFxShadowFilter::xOffset() const -{ - return d->x; -} - -/*! - \property QFxShadowFilter::xOffset - \brief the x offset of the shadow relative to the item. -*/ -void QFxShadowFilter::setXOffset(int offset) -{ - if (d->x == offset) return; - d->x = offset; - emit offsetChanged(d->x, d->y); -} - -/*! - \property QFxShadowFilter::yOffset - \brief the y offset of the shadow relative to the item. -*/ -int QFxShadowFilter::yOffset() const -{ - return d->y; -} - -void QFxShadowFilter::setYOffset(int offset) -{ - if (d->y == offset) return; - d->y = offset; - emit offsetChanged(d->x, d->y); -} - -QRectF QFxShadowFilter::itemBoundingRect(const QRectF &r) const -{ - QRectF rv = r; - rv |= r.translated(xOffset(), yOffset()); - return rv; -} - -void QFxShadowFilter::filterGL(QSimpleCanvasItem::GLPainter &p) -{ -#if defined(QFX_RENDER_OPENGL2) - - QSimpleCanvasItem *item = this->item(); - - QRect r = item->itemBoundingRect(); - - QGLFramebufferObject *fbo = renderToFBO(); - - float width = r.width(); - float height = r.height(); - - float texWidth = width / float(fbo->width()); - float texHeight = height / float(fbo->height()); - - GLfloat vertices[] = { d->x, height + d->y, - width + d->x, height + d->y, - d->x, d->y, - d->x + width, d->y }; - GLfloat texVertices[] = { 0, 0, - texWidth, 0, - 0, texHeight, - texWidth, texHeight }; - - SingleTextureShadowShader *shader = item->basicShaders()->singleTextureShadow(); - shader->enable(); - shader->setOpacity(0.8 * p.activeOpacity); - shader->setTransform(p.activeTransform); - - shader->setAttributeArray(SingleTextureShadowShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShadowShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, fbo->texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - shader->disableAttributeArray(SingleTextureShadowShader::Vertices); - shader->disableAttributeArray(SingleTextureShadowShader::TextureCoords); - - releaseFBO(fbo); - - renderToScreen(); -#else - Q_UNUSED(p); -#endif -} - -QML_DEFINE_TYPE(QFxShadowFilter,Shadow) - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxshadowfilter.h b/src/declarative/fx/qfxshadowfilter.h deleted file mode 100644 index 67d165a..0000000 --- a/src/declarative/fx/qfxshadowfilter.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXSHADOWFILTER_H -#define QFXSHADOWFILTER_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxShadowFilterPrivate; -class Q_DECLARATIVE_EXPORT QFxShadowFilter : public QSimpleCanvasFilter -{ - Q_OBJECT - Q_PROPERTY(int xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) - Q_PROPERTY(int yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) -public: - QFxShadowFilter(QObject *parent=0); - virtual ~QFxShadowFilter(); - - int xOffset() const; - void setXOffset(int offset); - - int yOffset() const; - void setYOffset(int offset); - -Q_SIGNALS: - void offsetChanged(int, int); - -protected: - virtual QRectF itemBoundingRect(const QRectF &) const; - virtual void filterGL(QSimpleCanvasItem::GLPainter &p); - -private: - QFxShadowFilterPrivate *d; -}; -QML_DECLARE_TYPE(QFxShadowFilter) - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // _QFXSHADOWFILTER_H_ -- cgit v0.12 From 0b59aed42d27584ef3493305c565dd47f66d179d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 19 Jun 2009 15:58:16 +1000 Subject: Remove OpenGL support from Fluid UI primitives --- src/declarative/canvas/canvas.pri | 11 +- src/declarative/canvas/qsimplecanvas.cpp | 67 -- src/declarative/canvas/qsimplecanvas.h | 29 - src/declarative/canvas/qsimplecanvas_opengl.cpp | 680 -------------------- src/declarative/canvas/qsimplecanvas_opengl1.cpp | 401 ------------ src/declarative/canvas/qsimplecanvas_p.h | 64 -- .../canvas/qsimplecanvasdebugplugin.cpp | 4 - src/declarative/canvas/qsimplecanvasfilter.cpp | 323 ---------- src/declarative/canvas/qsimplecanvasfilter.h | 113 ---- src/declarative/canvas/qsimplecanvasfilter_p.h | 70 -- src/declarative/canvas/qsimplecanvasitem.cpp | 138 ---- src/declarative/canvas/qsimplecanvasitem.h | 67 -- src/declarative/canvas/qsimplecanvasitem_p.h | 47 +- src/declarative/declarative.pro | 2 - src/declarative/fx/fx.pri | 2 - src/declarative/fx/qfxblendedimage.cpp | 308 --------- src/declarative/fx/qfxblendedimage.h | 110 ---- src/declarative/fx/qfxflipable.cpp | 18 - src/declarative/fx/qfxflipable.h | 3 - src/declarative/fx/qfximage.cpp | 358 ----------- src/declarative/fx/qfximage.h | 6 - src/declarative/fx/qfximage_p.h | 12 - src/declarative/fx/qfxitem.cpp | 10 - src/declarative/fx/qfxitem.h | 3 - src/declarative/fx/qfxpainteditem.cpp | 45 -- src/declarative/fx/qfxpainteditem.h | 4 - src/declarative/fx/qfxpainteditem_p.h | 8 - src/declarative/fx/qfxparticles.cpp | 81 --- src/declarative/fx/qfxparticles.h | 8 - src/declarative/fx/qfxrect.cpp | 336 ---------- src/declarative/fx/qfxrect.h | 6 - src/declarative/fx/qfxrect_p.h | 10 - src/declarative/fx/qfxtext.cpp | 88 --- src/declarative/fx/qfxtext.h | 4 - src/declarative/fx/qfxtext_p.h | 7 - src/declarative/fx/qfxtextedit.cpp | 4 - src/declarative/fx/qfxtextedit_p.h | 3 - src/declarative/fx/qfxtransform.cpp | 95 --- src/declarative/fx/qfxtransform.h | 7 - src/declarative/fx/qfxwebview.cpp | 13 - src/declarative/opengl/glbasicshaders.cpp | 707 --------------------- src/declarative/opengl/glbasicshaders.h | 244 ------- src/declarative/opengl/glheaders.h | 49 -- src/declarative/opengl/glsave.cpp | 1 - src/declarative/opengl/glsave.h | 111 ---- src/declarative/opengl/gltexture.cpp | 384 ----------- src/declarative/opengl/gltexture.h | 120 ---- src/declarative/opengl/opengl.pri | 20 - src/declarative/util/qfxglobal.h | 31 +- 49 files changed, 5 insertions(+), 5227 deletions(-) delete mode 100644 src/declarative/canvas/qsimplecanvas_opengl.cpp delete mode 100644 src/declarative/canvas/qsimplecanvas_opengl1.cpp delete mode 100644 src/declarative/canvas/qsimplecanvasfilter.cpp delete mode 100644 src/declarative/canvas/qsimplecanvasfilter.h delete mode 100644 src/declarative/canvas/qsimplecanvasfilter_p.h delete mode 100644 src/declarative/fx/qfxblendedimage.cpp delete mode 100644 src/declarative/fx/qfxblendedimage.h delete mode 100644 src/declarative/opengl/glbasicshaders.cpp delete mode 100644 src/declarative/opengl/glbasicshaders.h delete mode 100644 src/declarative/opengl/glheaders.h delete mode 100644 src/declarative/opengl/glsave.cpp delete mode 100644 src/declarative/opengl/glsave.h delete mode 100644 src/declarative/opengl/gltexture.cpp delete mode 100644 src/declarative/opengl/gltexture.h delete mode 100644 src/declarative/opengl/opengl.pri diff --git a/src/declarative/canvas/canvas.pri b/src/declarative/canvas/canvas.pri index 9bdd3fa..28cab9b 100644 --- a/src/declarative/canvas/canvas.pri +++ b/src/declarative/canvas/canvas.pri @@ -1,19 +1,14 @@ SOURCES += \ canvas/qsimplecanvas.cpp \ canvas/qsimplecanvasitem.cpp \ - canvas/qsimplecanvasfilter.cpp \ - canvas/qsimplecanvasdebugplugin.cpp + canvas/qsimplecanvasdebugplugin.cpp \ + canvas/qsimplecanvas_software.cpp \ + canvas/qsimplecanvas_graphicsview.cpp HEADERS += \ canvas/qsimplecanvas.h \ canvas/qsimplecanvasitem.h \ - canvas/qsimplecanvasfilter.h \ canvas/qsimplecanvas_p.h \ canvas/qsimplecanvasitem_p.h \ - canvas/qsimplecanvasfilter_p.h \ canvas/qsimplecanvasdebugplugin_p.h -contains(QT_CONFIG, opengles2): SOURCES += canvas/qsimplecanvas_opengl.cpp -else:contains(QT_CONFIG, opengles1): SOURCES += canvas/qsimplecanvas_opengl1.cpp -else:SOURCES += canvas/qsimplecanvas_software.cpp -SOURCES += canvas/qsimplecanvas_graphicsview.cpp diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index cb46f94..cbbc26d 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -49,9 +49,6 @@ #include "qtimer.h" #include "qdatetime.h" #include "qgraphicssceneevent.h" -#if defined(QFX_RENDER_OPENGL) -#include -#endif #include "qboxlayout.h" #include "qsimplecanvasdebugplugin_p.h" #include "qsimplecanvas.h" @@ -601,13 +598,6 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode) view->scene()->setItemIndexMethod(QGraphicsScene::NoIndex); view->viewport()->setFocusPolicy(Qt::NoFocus); } - -#if defined(QFX_RENDER_OPENGL) && defined(Q_WS_X11) - QTimer *t = new QTimer(q); - t->setInterval(200); - QObject::connect(t, SIGNAL(timeout()), &egl, SLOT(updateGL())); - t->start(); -#endif } QSimpleCanvas::~QSimpleCanvas() @@ -795,9 +785,6 @@ bool QSimpleCanvas::focusNextPrevChild(bool) void QSimpleCanvas::showEvent(QShowEvent *e) { -#if defined(QFX_RENDER_OPENGL) - d->egl.resize(width(), height()); -#endif if (d->isGraphicsView()) d->view->setSceneRect(rect()); @@ -806,9 +793,6 @@ void QSimpleCanvas::showEvent(QShowEvent *e) void QSimpleCanvas::resizeEvent(QResizeEvent *e) { -#if defined(QFX_RENDER_OPENGL) - d->egl.resize(width(), height()); -#endif if (d->isGraphicsView()) d->view->setSceneRect(rect()); QWidget::resizeEvent(e); @@ -833,21 +817,6 @@ void QSimpleCanvas::addDirty(QSimpleCanvasItem *c) Q_ASSERT(d->isSimpleCanvas()); queueUpdate(); d->oldDirty |= c->d_func()->data()->lastPaintRect; -#if defined(QFX_RENDER_OPENGL) - // ### Is this parent crawl going to be a problem for scenes with nots - // of things changing? - // Check for filters - QSimpleCanvasItem *fi = c->parent(); - while(fi) { - if (fi->d_func()->data()->dirty) { - break; - } else if (fi->filter()) { - fi->update(); - break; - } - fi = fi->parent(); - } -#endif d->dirtyItems.append(c); } @@ -855,15 +824,8 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const { QRect rv; if (isSimpleCanvas()) { -#if defined(QFX_RENDER_OPENGL) - QRectF r; - for (int ii = 0; ii < dirtyItems.count(); ++ii) - r |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect; - rv = egl.map(r); -#else for (int ii = 0; ii < dirtyItems.count(); ++ii) rv |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect; -#endif } return rv; } @@ -871,11 +833,7 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const QRect QSimpleCanvasPrivate::resetDirty() { if (isSimpleCanvas()) { -#if defined(QFX_RENDER_OPENGL) - QRect r = egl.map(oldDirty) | dirtyItemClip(); -#else QRect r = oldDirty | dirtyItemClip(); -#endif if (!r.isEmpty()) r.adjust(-1,-1,2,2); //make sure we get everything (since we rounded from floats to ints) for (int ii = 0; ii < dirtyItems.count(); ++ii) @@ -918,37 +876,16 @@ bool QSimpleCanvas::event(QEvent *e) int tbf = d->frameTimer.restart(); d->timer = 0; d->isSetup = true; -#if defined(QFX_RENDER_OPENGL1) - unsigned int zero = 0; - d->root->d_func()->setupPainting(0, rect(), &zero); -#elif defined(QFX_RENDER_OPENGL2) - ++d->paintVersion; - d->opaqueList = 0; - int z = 0; - d->root->d_func()->setupPainting(0, z, &d->opaqueList); -#else ++d->paintVersion; d->root->d_func()->setupPainting(0, rect()); -#endif QRect r = d->resetDirty(); -#if defined(QFX_RENDER_QPAINTER) if (r.isEmpty() || fullUpdate()) repaint(); else repaint(r); emit framePainted(); -#else - - QRect nr(r.x(), height() - r.y() - r.height(), r.width(), r.height()); - - if (r.isEmpty() || fullUpdate()) - d->egl.updateGL(); - else - d->egl.updateGL(nr); - emit framePainted(); -#endif d->isSetup = false; int frametimer = d->frameTimer.elapsed(); @@ -1016,14 +953,10 @@ void QSimpleCanvas::checkState() QImage QSimpleCanvas::asImage() const { if (d->isSimpleCanvas()) { -#if defined(QFX_RENDER_QPAINTER) QImage img(width(),height(),QImage::Format_RGB32); QPainter p(&img); const_cast(this)->d->paint(p); return img; -#elif defined(QFX_RENDER_OPENGL) - return d->egl.grabFrameBuffer(); -#endif } else { QImage img(width(),height(),QImage::Format_RGB32); QPainter p(&img); diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h index 1cbd3c7..b9f8ddb 100644 --- a/src/declarative/canvas/qsimplecanvas.h +++ b/src/declarative/canvas/qsimplecanvas.h @@ -44,10 +44,6 @@ #include -#ifdef QFX_RENDER_OPENGL -#include -#endif - #include #include #include @@ -65,42 +61,18 @@ namespace QSimpleCanvasConfig { enum ImageType { Opaque, Translucent }; -#ifdef QFX_RENDER_OPENGL - typedef QMatrix4x4 Matrix; - typedef QImage Image; - - inline Matrix transformToMatrix(const QTransform &) - { - return Matrix(); // XXX - } - inline QTransform matrixToTransform(const Matrix &) - { - return QTransform(); // XXX - } - inline bool needConvert(ImageType, const Image &) - { return false; } - inline Image convert(ImageType, const Image &i) - { return i; } - inline Image create(const QSize &s) - { return QImage(s, QImage::Format_ARGB32); } - inline const Image &toImage(const QImage &i) - { return i; } - -#elif defined(QFX_RENDER_QPAINTER) typedef QTransform Matrix; inline Matrix transformToMatrix(const QTransform &t) { return t; } inline QTransform matrixToTransform(const Matrix &t) { return t; } -#endif } class QSimpleCanvas; class QSimpleCanvasLayer; class QGraphicsSceneMouseEvent; -class GLBasicShaders; class QSimpleCanvasItem; class QSimpleCanvasPrivate; class Q_DECLARATIVE_EXPORT QSimpleCanvas : public QWidget @@ -157,7 +129,6 @@ private: friend class QSimpleCanvasPrivate; friend class QSimpleCanvasItem; friend class QSimpleCanvasItemPrivate; - friend class QSimpleCanvasFilter; friend class QSimpleGraphicsItem; void queueUpdate(); diff --git a/src/declarative/canvas/qsimplecanvas_opengl.cpp b/src/declarative/canvas/qsimplecanvas_opengl.cpp deleted file mode 100644 index 7969a2a..0000000 --- a/src/declarative/canvas/qsimplecanvas_opengl.cpp +++ /dev/null @@ -1,680 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvas.h" -#include "qsimplecanvas_p.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvasfilter_p.h" -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE -void CanvasEGLWidget::paintGL() -{ - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - _canvas->paintGL(); -} - -void CanvasEGLWidget::updateGL() -{ - _clip = QRect(); - QGLWidget::updateGL(); -} - -void CanvasEGLWidget::updateGL(const QRect &r) -{ - if (r.isEmpty()) - return; - - _clip = r; - QGLWidget::updateGL(); -} - -void CanvasEGLWidget::resizeGL(int w, int h) -{ - glViewport(0, 0, w, h); -} - -QRect CanvasEGLWidget::map(const QRectF &f) const -{ - return invDefaultTransform.mapRect(f).toAlignedRect(); -} - -void CanvasEGLWidget::resizeEvent(QResizeEvent *e) -{ - defaultTransform.setIdentity(); - defaultTransform.flipCoordinates(); - defaultTransform.translate(-1, -1, 0); - defaultTransform.scale(2. / width(), 2. / height(), 1. / (1024. * 1024.)); - invDefaultTransform = defaultTransform.inverted(); - _canvas->root->d_func()->data()->transformActive = defaultTransform; - _canvas->root->d_func()->data()->transformValid = true; - - QGLWidget::resizeEvent(e); -} - -void CanvasEGLWidget::initializeGL() -{ - glEnable(GL_BLEND); - glEnable(GL_STENCIL_TEST); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, - GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - glStencilFunc(GL_EQUAL, 0, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); -} - -void QSimpleCanvasPrivate::paintGL() -{ - lrpTimer.start(); - - QSimpleCanvasItemPrivate::GLPaintParameters p; - QSimpleCanvasItem::GLPainter painter; - - p.sceneRect = QRect(0, 0, q->width(), q->height()); - p.clipRect = p.sceneRect; - p.stencilValue = 0; - p.opacity = 1; - p.forceParamRefresh = false; - p.painter = &painter; - if (!isSetup) { - opaqueList = 0; - int z = 0; - root->d_func()->setupPainting(0, z, &opaqueList); - } - - glEnable(GL_DEPTH_TEST); - - glDisable(GL_BLEND); - painter.blendEnabled = false; - painter.activeOpacity = 1; - while (opaqueList) { - painter.item = opaqueList; - painter.activeTransform = opaqueList->d_func()->data()->transformActive; - // ### - I don't think this is right - painter.sceneClipRect = p.clipRect; - - opaqueList->paintGLContents(painter); - opaqueList = opaqueList->d_func()->nextOpaque; - } - glEnable(GL_BLEND); - painter.blendEnabled = true; - - root->d_func()->paint(p); - - lrpTime = lrpTimer.elapsed(); -} - -QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h) -{ - if (w <= 0 || h <= 0) - return 0; - - int size = qMax(w, h); - for (int ii = 0; ii < frameBuffers.count(); ++ii) { - if (frameBuffers.at(ii)->width() >= size) { - QGLFramebufferObject *rv = frameBuffers.at(ii); - frameBuffers.removeAt(ii); - return rv; - } - } - - // Find power of two - size--; - size |= size >> 1; - size |= size >> 2; - size |= size >> 4; - size |= size >> 8; - size |= size >> 16; - size++; - - QGLFramebufferObject *fbo = new QGLFramebufferObject(size, size); - return fbo; -} - -void QSimpleCanvasPrivate::release(QGLFramebufferObject *buf) -{ - int size = qMax(buf->width(), buf->height()); - for (int ii = 0; ii < frameBuffers.count(); ++ii) { - if (frameBuffers.at(ii)->width() >= size) { - frameBuffers.insert(ii, buf); - return; - } - } - frameBuffers.append(buf); -} - -GLBasicShaders *QSimpleCanvasItemPrivate::basicShaders() const -{ - return canvas->d->basicShaders(); -} - -QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const -{ - Q_Q(const QSimpleCanvasItem); - - QSimpleCanvas::Matrix trans; - trans.translate(q->x(), q->y()); - QPointF to = transformOrigin(); - trans.translate(to.x(), to.y()); - trans.scale(q->scale(), q->scale()); - trans.translate(-to.x(), -to.y()); - if (data()->transformUser) - trans *= *data()->transformUser; - return trans; -} - -void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters ¶ms, QSimpleCanvasItem *child) -{ - Q_Q(QSimpleCanvasItem); - - GLPaintParameters childParams = params; - if (clip) - ++childParams.stencilValue; - - if (child->d_func()->data()->activeOpacity != 0) { - childParams.boundingRect = child->boundingRect(); - - if (child->filter() && child->filter()->enabled()) { - QSimpleCanvasItem::GLPainter &painter = *params.painter; - painter.item = q; - painter.activeTransform = child->d_func()->data()->transformActive; - painter.activeOpacity = child->d_func()->data()->activeOpacity; - painter.sceneClipRect = params.clipRect; - child->filter()->d->doFilterGL(painter, childParams); - } else { - child->d_func()->paint(childParams); - } - } -} - -void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters ¶ms, - QSimpleCanvasItem *child) -{ - if (params.forceParamRefresh) { - QSimpleCanvas::Matrix t = child->d_func()->data()->transformActive; - qreal o = child->d_func()->data()->activeOpacity; - setupChildState(child); - simplePaintChild(params, child); - child->d_func()->data()->transformActive = t; - child->d_func()->data()->transformValid = true; - child->d_func()->data()->activeOpacity = o; - } else { - simplePaintChild(params, child); - } -} - -void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child) -{ - QSimpleCanvasItemData *const myData = data(); - QSimpleCanvasItemPrivate *const childPrivate = child->d_func(); - QSimpleCanvasItemData *const childData = childPrivate->data(); - - childData->activeOpacity = myData->activeOpacity; - if (childData->visible != 1.) - childData->activeOpacity *= childData->visible; - - if (childData->activeOpacity != 0.) { - QSimpleCanvas::Matrix &am = childData->transformActive; - am = myData->transformActive; - - // Calculate child's transform - const qreal x = childData->x; - const qreal y = childData->y; - const qreal scale = childPrivate->scale; - QSimpleCanvasItem::Flip flip = childData->flip; - - if (x != 0. || y != 0.) - am.translate(x, y); - - if (scale != 1.) { - if (childPrivate->origin == QSimpleCanvasItem::TopLeft) { - am.scale(scale, scale); - } else { - QPointF to = childPrivate->transformOrigin(); - am.translate(to.x(), to.y()); - am.scale(scale, scale); - am.translate(-to.x(), -to.y()); - } - } - - if (childData->transformUser) - am *= *childData->transformUser; - if (flip) { - QRectF br = child->boundingRect(); - am.translate(br.width() / 2., br.height() / 2); - am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0); - am.translate(-br.width() / 2., -br.height() / 2); - } - - childData->transformValid = true; - } -} - -#define QSIMPLECANVAS_DISABLE_TREE_CLIPPING -QRectF QSimpleCanvasItemPrivate::setupPainting(int version, int &z, QSimpleCanvasItem **opaqueList) -{ - static QRectF scene(-1., -1., 2., 2.); - Q_Q(QSimpleCanvasItem); - - bool hasContents = options & QSimpleCanvasItem::HasContents; - - QSimpleCanvasItemData *myData = data(); - - QRectF rv; - if (hasContents) { - QRectF filteredBoundRect = q->boundingRect(); - if (filter) - filteredBoundRect = filter->itemBoundingRect(filteredBoundRect); - const QMatrix4x4 &active = myData->transformActive; - - rv = active.mapRect(filteredBoundRect); - } -#ifdef QSIMPLECANVAS_DISABLE_TREE_CLIPPING - myData->doNotPaint = false; - myData->doNotPaintChildren = false; -#else - myData->doNotPaint = !hasContents || !rv.intersects(scene); - myData->doNotPaintChildren = hasContents && myData->doNotPaint && - (clip != QSimpleCanvasItem::NoClip); -#endif - - if (!myData->doNotPaint && - (options & QSimpleCanvasItem::IsOpaque) && - (myData->activeOpacity == 1.) && - (clip == 0)) { - - nextOpaque = *opaqueList; - *opaqueList = q; - myData->doNotPaint = true; - - } - - int myZ = z++; - - if (myData->doNotPaintChildren) { - rv = QRectF(); - } else { - zOrderChildren(); - - for (int ii = 0; ii < children.count(); ++ii) { - QSimpleCanvasItem *child = children.at(ii); - setupChildState(child); - - QSimpleCanvasItemData *childData = child->d_func()->data(); - if (childData->activeOpacity != 0) - rv |= child->d_func()->setupPainting(version, z, opaqueList); - } - -#ifndef QSIMPLECANVAS_DISABLE_TREE_CLIPPING - myData->doNotPaintChildren |= !rv.intersects(scene); -#endif - } - - myData->transformActive.translate(0, 0, myZ); - - myData->lastPaintRect = rv; - - return rv; -} - - -void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvasFilter::Layer layer) -{ - if (!layer) - return; - - Q_Q(QSimpleCanvasItem); - - bool doNotPaintChildren = data()->doNotPaintChildren; - if (doNotPaintChildren) - return; - - GLPaintParameters params = oldParams; - - qreal width = params.boundingRect.width(); - qreal height = params.boundingRect.height(); - - GLfloat vertices[] = { 0, height, - width, height, - 0, 0, - width, 0 }; - - // XXX Handle separate cliping modes - if (clip) { - if (params.stencilValue == 255) - qWarning() - << "OpenGL: Clip recursion greater than 255 not permitted."; - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - glStencilFunc(GL_EQUAL, params.stencilValue, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); - - ConstantColorShader *shader = basicShaders()->constantColor(); - params.painter->invalidate(); - shader->enable(); - shader->setTransform(data()->transformActive); - - shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - - // XXX Copied from qsimplecanvas_opengl1 scissor based clipping - QRectF r = data()->transformActive.mapRect(params.boundingRect); - r.translate(1, 1); - float xscale = 0.5 * float(params.sceneRect.width()); - float yscale = 0.5 * float(params.sceneRect.height()); - r.moveTo(r.x() * xscale, r.y() * yscale); - r.setSize(QSizeF(r.width() * xscale, r.height() * yscale)); - int sr_x = int(::floorf(r.x())); - int sr_y = int(::floorf(r.y())); - int sr_width = int(::ceilf(r.right())) - sr_x; - int sr_height = int(::ceilf(r.bottom())) - sr_y; - QRect sr(sr_x, sr_y, sr_width, sr_height); - sr.moveTo(sr.x(), params.sceneRect.height() - sr.y() - sr.height()); - sr &= params.clipRect; - params.clipRect = sr; - } - - int upto = 0; - for (upto = 0; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - if (c->z() < 0) { - if (layer & QSimpleCanvasFilter::ChildrenUnderItem) - paintChild(params, c); - } else { - break; - } - } - - bool doNotPaint = data()->doNotPaint; - - if (!doNotPaint && layer & QSimpleCanvasFilter::Item) { - QSimpleCanvasItem::GLPainter &painter = *params.painter; - painter.item = q; - painter.activeTransform = data()->transformActive; - painter.activeOpacity = data()->activeOpacity; - painter.sceneClipRect = params.clipRect; - - q->paintGLContents(painter); - } - - if (layer & QSimpleCanvasFilter::ChildrenAboveItem) { - for (; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - paintChild(params, c); - } - } - - if (clip) { - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR); - - params.painter->invalidate(); - ConstantColorShader *shader = basicShaders()->constantColor(); - shader->enable(); - shader->setTransform(data()->transformActive); - - shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glStencilFunc(GL_EQUAL, params.stencilValue, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } -} - -enum ShaderType { ST_None, ST_SingleTexture, ST_SingleTextureOpacity, ST_Color }; - -QSimpleCanvasItem::GLPainter::GLPainter() -: item(0), activeOpacity(1), blendEnabled(true), flags(0) -{ -} - -QSimpleCanvasItem::GLPainter::GLPainter(QSimpleCanvasItem *i) -: item(i), activeOpacity(1), blendEnabled(true), flags(0) -{ -} - -QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader() -{ - if (activeOpacity == 1.) { - SingleTextureShader *shader = item->basicShaders()->singleTexture(); - if (flags != ST_SingleTexture) { - shader->enable(); - flags = ST_SingleTexture; - } - - shader->setTransform(activeTransform); - return shader; - } else { - SingleTextureOpacityShader *shader = item->basicShaders()->singleTextureOpacity(); - - if (flags != ST_SingleTextureOpacity) { - shader->enable(); - flags = ST_SingleTextureOpacity; - } - - shader->setTransform(activeTransform); - shader->setOpacity(activeOpacity); - return shader; - } -} - -void QSimpleCanvasItem::GLPainter::invalidate() -{ - flags = ST_None; -} - -QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &color) -{ - QColor c = color; - - ConstantColorShader *shader = item->basicShaders()->constantColor(); - - if (flags != ST_Color) { - shader->enable(); - flags = ST_Color; - } - - if (activeOpacity != 1.) - c.setAlpha(int(c.alpha() * activeOpacity)); - - shader->setColor(c); - shader->setTransform(activeTransform); - - return shader; -} - -void QSimpleCanvasItem::GLPainter::drawPixmap(const QPointF &point, - const GLTexture &texture) -{ - drawPixmap(QRectF(point, QSizeF(texture.width(), texture.height())), texture); -} - -void QSimpleCanvasItem::GLPainter::drawPixmap(const QRectF &rect, - const GLTexture &img) -{ - QGLShaderProgram *shader = useTextureShader(); - - GLfloat vertices[8]; - GLfloat texVertices[8]; - - float widthV = img.width(); - float heightV = img.height(); - - vertices[0] = rect.x(); vertices[1] = rect.y()+heightV; - vertices[2] = rect.x()+widthV; vertices[3] = rect.y()+heightV; - vertices[4] = rect.x(); vertices[5] = rect.y(); - vertices[6] = rect.x()+widthV; vertices[7] = rect.y(); - - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = 1; texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = 1; - texVertices[6] = 1; texVertices[7] = 1; - - shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, img.texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); -} - -void QSimpleCanvasItem::GLPainter::fillRect(const QRectF &rect, - const QColor &color) -{ - if (color.alpha() == 0xFF) - glDisable(GL_BLEND); - - QGLShaderProgram *shader = useColorShader(color); - float x = rect.x(); - float y = rect.y(); - float width = rect.width(); - float height = rect.height(); - - GLfloat vertices[] = { x, height, - width, height, - x, y, - - width, height, - x, y, - width, y }; - - shader->setAttributeArray(ConstantColorShader::Vertices, vertices, 2); - glDrawArrays(GL_TRIANGLES, 0, 6); - - if (color.alpha() == 0xFF) - glEnable(GL_BLEND); -} - -void QSimpleCanvasItem::CachedTexture::addRef() -{ - ++r; -} - -void QSimpleCanvasItem::CachedTexture::release() -{ - Q_ASSERT(r > 0); - --r; - - if (r == 0) { - if (!s.isEmpty()) - d->cachedTextures.remove(s); - delete this; - } -} - -int QSimpleCanvasItem::CachedTexture::pixmapWidth() const -{ - return w; -} - -int QSimpleCanvasItem::CachedTexture::pixmapHeight() const -{ - return h; -} - -QSimpleCanvasItem::CachedTexture::CachedTexture() -: r(0), w(0), h(0) -{ -} - -QSimpleCanvasItem::CachedTexture * -QSimpleCanvasItem::cachedTexture(const QString &key) -{ - Q_D(QSimpleCanvasItem); - if (!d->canvas || key.isEmpty()) - return 0; - - QSimpleCanvasPrivate *canvas = d->canvas->d; - QHash::ConstIterator iter = - canvas->cachedTextures.find(key); - if (iter != canvas->cachedTextures.end()) { - (*iter)->addRef(); - return (*iter); - } else { - return 0; - } -} - -QSimpleCanvasItem::CachedTexture * -QSimpleCanvasItem::cachedTexture(const QString &key, const QPixmap &pix) -{ - Q_D(QSimpleCanvasItem); - if (!d->canvas) - return 0; - - QSimpleCanvasPrivate *canvas = d->canvas->d; - QHash::ConstIterator iter = - canvas->cachedTextures.end(); - if (!key.isEmpty()) - iter = canvas->cachedTextures.find(key); - - if (iter != canvas->cachedTextures.end()) { - (*iter)->addRef(); - return (*iter); - } else { - CachedTexture *rv = new CachedTexture; - rv->s = key; - rv->d = canvas; - rv->w = pix.width(); - rv->h = pix.height(); - rv->setImage(pix.toImage(), GLTexture::PowerOfTwo); - rv->setHorizontalWrap(GLTexture::Repeat); - rv->setVerticalWrap(GLTexture::Repeat); - rv->addRef(); - if (!key.isEmpty()) - canvas->cachedTextures.insert(key, rv); - return rv; - } -} - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvas_opengl1.cpp b/src/declarative/canvas/qsimplecanvas_opengl1.cpp deleted file mode 100644 index 6e50ef8..0000000 --- a/src/declarative/canvas/qsimplecanvas_opengl1.cpp +++ /dev/null @@ -1,401 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvas.h" -#include "qsimplecanvas_p.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvasfilter_p.h" -#include -#include -#include - - -QT_BEGIN_NAMESPACE -void CanvasEGLWidget::updateGL() -{ - _clip = QRect(); - QGLWidget::updateGL(); -} - -void CanvasEGLWidget::updateGL(const QRect &r) -{ - if (r.isEmpty()) - return; - - _clip = r; - QGLWidget::updateGL(); -} - -void CanvasEGLWidget::paintGL() -{ - if (!_clip.isEmpty()) { - glEnable(GL_SCISSOR_TEST); - glScissor(_clip.x(), _clip.y(), _clip.width(), _clip.height()); - } else { - glDisable(GL_SCISSOR_TEST); - } - - glDepthMask(GL_TRUE); - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDepthMask(GL_FALSE); - - _canvas->paintGL(); -} - -QRect CanvasEGLWidget::map(const QRectF &f) -{ - return invDefaultTransform.mapRect(f).toAlignedRect(); -} - -void CanvasEGLWidget::resizeGL(int w, int h) -{ - glViewport(0, 0, w, h); -} - -void CanvasEGLWidget::resizeEvent(QResizeEvent *e) -{ - defaultTransform.identity(); - defaultTransform.flipCoordinates(); - defaultTransform.translate(-1, -1, 0); - defaultTransform.scale(2. / width(), 2. / height(), -2. / 65536.); - invDefaultTransform = defaultTransform.inverted(); - _canvas->root->d_func()->transformActive = defaultTransform; - QGLWidget::resizeEvent(e); -} - -void CanvasEGLWidget::initializeGL() -{ - glEnable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthFunc(GL_GREATER); -#ifdef QT_OPENGL_ES - glClearDepthf(0); -#else - glClearDepth(0); -#endif -} - -void QSimpleCanvasPrivate::paintGL() -{ - lrpTimer.start(); - - QSimpleCanvasItemPrivate::GLPaintParameters p; - p.sceneRect = QRect(0, 0, q->width(), q->height()); - p.clipRect = p.sceneRect; - p.opacity = 1; - p.forceParamRefresh = false; - if (!isSetup) { - unsigned int zero = 0; - root->d_func()->setupPainting(0, QRect(), &zero); - } - root->d_func()->paint(p); - - lrpTime = lrpTimer.elapsed(); -} - -QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const -{ - Q_Q(const QSimpleCanvasItem); - - QSimpleCanvas::Matrix trans; - trans.translate(q->x(), q->y()); - QPointF to = transformOrigin(); - trans.translate(to.x(), to.y()); - trans.scale(q->scale().value(), q->scale().value()); - trans.translate(-to.x(), -to.y()); - trans *= transformUser; - return trans; -} - -void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters ¶ms, QSimpleCanvasItem *child) -{ - GLPaintParameters childParams = params; - - if (child->d_func()->activeOpacity != 0) { - childParams.boundingRect = child->boundingRect(); - child->d_func()->paint(childParams); - } -} - -void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters ¶ms, - QSimpleCanvasItem *child) -{ - if (params.forceParamRefresh) { - QSimpleCanvas::Matrix t = child->d_func()->transformActive; - qreal o = child->d_func()->activeOpacity; - setupChildState(child); - simplePaintChild(params, child); - child->d_func()->transformActive = t; - child->d_func()->activeOpacity = o; - } else { - simplePaintChild(params, child); - } -} - - -void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child) -{ - qreal visible = child->visible().value(); - child->d_func()->activeOpacity = activeOpacity; - if (visible != 1) - child->d_func()->activeOpacity *= visible; - - if (child->d_func()->activeOpacity != 0) { - // Calculate child's transform - qreal x = child->x(); - qreal y = child->y(); - qreal scale = child->scale().value(); - QSimpleCanvasItem::Flip flip = child->flip(); - - QSimpleCanvas::Matrix &am = child->d_func()->transformActive; - am = transformActive; - if (x != 0 || y != 0) - am.translate(x, y); - if (scale != 1) { - QPointF to = child->d_func()->transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - am.translate(to.x(), to.y()); - am.scale(scale, scale); - if (to.x() != 0. || to.y() != 0.) - am.translate(-to.x(), -to.y()); - } - if (child->d_func()->transformUserSet) - am *= child->d_func()->transformUser; - if (flip) { - QRectF br = child->boundingRect(); - am.translate(br.width() / 2., br.height() / 2); - am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0); - am.translate(-br.width() / 2., -br.height() / 2); - } - } -} - -QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding, unsigned int *zero) -{ - Q_Q(QSimpleCanvasItem); - - QRectF rv = transformActive.mapRect(q->boundingRect()); - - unsigned int oldZero = *zero; - - for (int ii = 0; ii < children.count(); ++ii) { - QSimpleCanvasItem *child = children.at(ii); - setupChildState(child); - - if (child->d_func()->activeOpacity != 0) - rv |= child->d_func()->setupPainting(version, bounding, zero); - } - - if (clip || oldZero != *zero) - (*zero)++; - transformActive.translate(0, 0, *zero); - - lastPaintRect = rv; - return rv; -} - -void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters ¶ms, QSimpleCanvasFilter::Layer layer) -{ - Q_Q(QSimpleCanvasItem); - - zOrderChildren(); - - int upto = 0; - for (upto = 0; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - if (c->zValue().value() < 0) { - if (layer & QSimpleCanvasFilter::ChildrenUnderItem) - paintChild(params, c); - } else { - break; - } - } - - if (layer & QSimpleCanvasFilter::Item && - q->options() & QSimpleCanvasItem::HasContents) { - QSimpleCanvasItem::GLPainter painter(q); - painter.activeTransform = transformActive; - painter.activeOpacity = activeOpacity; - painter.sceneClipRect = params.clipRect; - - q->paintGLContents(painter); - } - - if (layer & QSimpleCanvasFilter::ChildrenAboveItem) { - for (; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - paintChild(params, c); - } - } -} - -void QSimpleCanvasItemPrivate::paint(GLPaintParameters ¶ms, QSimpleCanvasFilter::Layer layer) -{ - if (!layer) - return; - - // XXX Handle separate cliping modes - if (clip) { - - GLSaveScissor ss; - qreal width = params.boundingRect.width(); - qreal height = params.boundingRect.height(); - float margin = width + height; - - GLfloat clipvertices[] = - { - -margin, -margin, - margin, -margin, - margin, 0, - - -margin, -margin, - -margin, 0, - margin, 0, - - -margin, 0, - -margin, margin, - 0, 0, - - 0, 0, - 0, margin, - -margin, margin, - - 0, height, - 0, margin, - margin, margin, - - margin, margin, - 0, height, - margin, height, - - width, 0, - margin, 0, - margin, height, - - margin, height, - width, height, - width, 0 - }; - - QRectF r = transformActive.mapRect(params.boundingRect); - r.translate(1, 1); - float xscale = 0.5 * float(params.sceneRect.width()); - float yscale = 0.5 * float(params.sceneRect.height()); - r.moveTo(r.x() * xscale, r.y() * yscale); - r.setSize(QSizeF(r.width() * xscale, r.height() * yscale)); - - glEnable(GL_SCISSOR_TEST); - int sr_x = ::floorf(r.x()); - int sr_y = ::floorf(r.y()); - int sr_width = ::ceilf(r.right()) - sr_x; - int sr_height = ::ceilf(r.bottom()) - sr_y; - - QRect sr(sr_x, sr_y, sr_width, sr_height); - if (ss.wasEnabled()) - sr &= ss.rect(); - - glScissor(sr.x(), sr.y(), sr.width(), sr.height()); - - { - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(transformActive.data()); - glDepthMask(GL_TRUE); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, clipvertices); - glDrawArrays(GL_TRIANGLES, 0, 24); - glDisableClientState(GL_VERTEX_ARRAY); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDepthMask(GL_FALSE); - } - - GLPaintParameters newParams = params; - newParams.clipRect = sr; - newParams.clipRect.moveTo(sr.x(), params.sceneRect.height() - sr.y() - sr.height()); - paintNoClip(newParams, layer); - } else { - paintNoClip(params, layer); - } -} - -QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader() -{ - qFatal("Cannot call QSimpleCanvasItem::GLPainter::useTextureShader() when using OpenGL ES 1.1"); - return 0; -} - -QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &color) -{ - Q_UNUSED(color); - qFatal("Cannot call QSimpleCanvasItem::GLPainter::useColorShader() when using OpenGL ES 1.1"); - return 0; -} - -GLBasicShaders *QSimpleCanvasItemPrivate::basicShaders() const -{ - qFatal("Cannot call QSimpleCanvasItem::basicShaders() when using OpenGL ES 1.1"); - return 0; -} - -QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int, int) -{ - return 0; -} - -void QSimpleCanvasPrivate::release(QGLFramebufferObject *) -{ -} - -void QSimpleCanvasItem::GLPainter::drawPixmap(const QPointF &point, - const GLTexture &texture) -{ - drawPixmap(QRectF(point, QSizeF(texture.width(), texture.height())), texture); -} - -void QSimpleCanvasItem::GLPainter::drawPixmap(const QRectF &rect, - const GLTexture &img) -{ - qFatal("Cannot call QSimpleCanvasItem::GLPainter::drawPixmap() when using OpenGL ES 1.1"); -} - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h index 3a0186e..cd76b22 100644 --- a/src/declarative/canvas/qsimplecanvas_p.h +++ b/src/declarative/canvas/qsimplecanvas_p.h @@ -47,41 +47,6 @@ #include #include -#if defined(QFX_RENDER_OPENGL) - -#if defined(QFX_RENDER_OPENGL2) -#include "glbasicshaders.h" -#endif - -#include -QT_BEGIN_NAMESPACE - -class CanvasEGLWidget : public QGLWidget -{ -public: - CanvasEGLWidget(QSimpleCanvas *parent, QSimpleCanvasPrivate *canvas) - : - QGLWidget(parent), - _canvas(canvas) - { - } - - virtual void paintGL(); - virtual void resizeGL(int,int); - virtual void resizeEvent(QResizeEvent *e); - virtual void initializeGL(); - - void updateGL(); - void updateGL(const QRect &); - - QRect map(const QRectF &) const; -private: - QRect _clip; - QSimpleCanvasPrivate *_canvas; - QSimpleCanvas::Matrix defaultTransform; - QSimpleCanvas::Matrix invDefaultTransform; -}; -#endif #include #include @@ -101,7 +66,6 @@ private: QGraphicsScene _scene; }; -class QGLFramebufferObject; class QSimpleCanvasDebugPlugin; class QSimpleCanvasPrivate { @@ -110,9 +74,6 @@ public: : q(canvas), timer(0), root(0), lrpTime(0), debugPlugin(0), focusItem(0), lastFocusItem(0), lastMouseItem(0), isSetup(false), view(0) -#if defined(QFX_RENDER_OPENGL) - ,egl(q, this), basicShadersInstance(0) -#endif , paintVersion(1) { } @@ -122,11 +83,7 @@ public: bool isSimpleCanvas() const { return mode == QSimpleCanvas::SimpleCanvas; } bool isGraphicsView() const { return mode == QSimpleCanvas::GraphicsView; } -#if defined(QFX_RENDER_OPENGL) - QRectF oldDirty; -#else QRect oldDirty; -#endif QRect resetDirty(); void paint(QPainter &p); @@ -174,27 +131,6 @@ public: QSimpleCanvasGraphicsView *view; -#if defined(QFX_RENDER_OPENGL) - CanvasEGLWidget egl; - GLBasicShaders *basicShaders() const - { -#if defined(QFX_RENDER_OPENGL2) - if (!basicShadersInstance) - basicShadersInstance = new GLBasicShaders; - return basicShadersInstance; -#else - return 0; -#endif - } - mutable GLBasicShaders *basicShadersInstance; - - QHash cachedTextures; - - QList frameBuffers; - QGLFramebufferObject *acquire(int, int); - void release(QGLFramebufferObject *); - void paintGL(); -#endif int paintVersion; }; diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp index 12088c1..91ef7dc 100644 --- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp +++ b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp @@ -123,11 +123,7 @@ void QSimpleCanvasSceneDebugPlugin::refresh(QDataStream &ds, ds << QmlDebugServerPlugin::objectToString(item) << item->x() << item->y() << item->z() << item->width() << item->height() << (int)item->transformOrigin() << item->scale() << (int)item->flip() -#ifdef QFX_RENDER_OPENGL - << item->transform().toTransform() -#elif defined(QFX_RENDER_QPAINTER) << item->transform() -#endif << item->hasActiveFocus() << (int)item->options(); QPixmap pix; diff --git a/src/declarative/canvas/qsimplecanvasfilter.cpp b/src/declarative/canvas/qsimplecanvasfilter.cpp deleted file mode 100644 index 5bc6b35..0000000 --- a/src/declarative/canvas/qsimplecanvasfilter.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvasfilter.h" -#include "qsimplecanvasfilter_p.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvas.h" -#include "qsimplecanvas_p.h" - -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#endif - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass Filter - \brief A Filter is a graphical filter that can be applied to items. -*/ - -QSimpleCanvasFilter::QSimpleCanvasFilter(QObject *parent) -: QObject(parent), d(new QSimpleCanvasFilterPrivate(this)) -{ -} - -QSimpleCanvasFilter::~QSimpleCanvasFilter() -{ - if (d->item) d->item->setFilter(0); - delete d; d = 0; -} - -bool QSimpleCanvasFilter::enabled() const -{ - return d->enabled; -} - -/*! - \qmlproperty bool Filter::enabled - \brief Controls whether the filter is applied. -*/ - -void QSimpleCanvasFilter::setEnabled(bool e) -{ - if (e == d->enabled) - return; - d->enabled = e; - emit enabledChanged(); - update(); -} - -QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(float scale, const QRectF &src, const QPoint &offset, Layer) -{ - // XXX - respect src -#if defined(QFX_RENDER_OPENGL2) - Q_UNUSED(src); - Q_UNUSED(offset); - - QSimpleCanvasItem *item = d->item; - QRect br = item->itemBoundingRect(); - if (br.isEmpty()) - return 0; - QGLFramebufferObject *fbo = - item->canvas()->d->acquire(int(br.width() * scale), int(br.height() * scale)); - - GLSaveViewport sv; GLSaveScissor ss; - qreal oldOpacity = item->d_func()->data()->activeOpacity; - item->d_func()->data()->activeOpacity = 1; - - fbo->bind(); - - glClearColor(0,0,0,0); - glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, int(br.width() * scale), int(br.height() * scale)); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, int(br.width() * scale), int(br.height() * scale)); - - QMatrix4x4 mat; - mat.flipCoordinates(); - mat.translate(-1, -1, 0); - mat.scale(2. / (br.width()), 2. / (br.height()), 1. / (1024. * 1024.)); - - renderToScreen(mat); - - fbo->release(); - - item->d_func()->data()->activeOpacity = oldOpacity; - return fbo; -#else - Q_UNUSED(src); - Q_UNUSED(offset); - Q_UNUSED(scale); - return 0; -#endif -} - -QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(const QRectF &src, const QPoint &offset, Layer) -{ - // XXX - respect src -#if defined(QFX_RENDER_OPENGL2) - Q_UNUSED(src); - Q_UNUSED(offset); - - QSimpleCanvasItem *item = d->item; - QRect br = item->itemBoundingRect(); - if (br.isEmpty()) - return 0; - QGLFramebufferObject *fbo = - item->canvas()->d->acquire(br.width(), br.height()); - - GLSaveViewport sv; GLSaveScissor ss; - qreal oldOpacity = item->d_func()->data()->activeOpacity; - item->d_func()->data()->activeOpacity = 1; - - fbo->bind(); - - glClearColor(0,0,0,0); - glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, br.width(), br.height()); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, br.width(), br.height()); - - QMatrix4x4 mat; - mat.flipCoordinates(); - mat.translate(-1, -1, 0); - mat.scale(2. / br.width(), 2. / br.height(), 1. / (1024. * 1024.)); - - renderToScreen(mat); - - fbo->release(); - - item->d_func()->data()->activeOpacity = oldOpacity; - return fbo; -#else - Q_UNUSED(src); - Q_UNUSED(offset); - return 0; -#endif -} - -QGLFramebufferObject *QSimpleCanvasFilter::acquireFBO(const QSize &s) -{ -#if defined(QFX_RENDER_OPENGL2) - QSize size; - QSimpleCanvasItem *item = d->item; - if (size.isNull()) { - QRect br = item->itemBoundingRect(); - size = br.size(); - } else { - size = s; - } - - QGLFramebufferObject *fbo = - item->canvas()->d->acquire(s.width(), s.height()); - - return fbo; -#else - Q_UNUSED(s); - return 0; -#endif -} - -void QSimpleCanvasFilter::releaseFBO(QGLFramebufferObject *fbo) -{ -#if defined(QFX_RENDER_OPENGL2) - d->item->d_func()->canvas->d->release(fbo); -#else - Q_UNUSED(fbo); -#endif -} - -void QSimpleCanvasFilter::renderToScreen(const QRectF &src, Layer layer) -{ - // XXX - respect src -#if defined(QFX_RENDER_OPENGL2) - Q_UNUSED(src); - Q_UNUSED(layer); - d->item->d_func()->paint(d->params, layer); -#else - Q_UNUSED(src); - Q_UNUSED(layer); -#endif -} - -void QSimpleCanvasFilter::renderToScreen(const QSimpleCanvas::Matrix &trans, const QRectF &src, Layer layer) -{ - // XXX - respect src -#if defined(QFX_RENDER_OPENGL2) - Q_UNUSED(src); - QSimpleCanvas::Matrix old = d->item->d_func()->data()->transformActive; - d->item->d_func()->data()->transformActive = trans; - QSimpleCanvasItemPrivate::GLPaintParameters params = d->params; - params.forceParamRefresh = true; - d->item->d_func()->paint(params, layer); - d->item->d_func()->data()->transformActive = old; -#else - Q_UNUSED(trans); - Q_UNUSED(src); - Q_UNUSED(layer); -#endif -} - -QSimpleCanvasItem *QSimpleCanvasFilter::item() const -{ - return d->item; -} - -void QSimpleCanvasFilter::setItem(QSimpleCanvasItem *i) -{ - if (d->item == i) - return; - if (d->item) { - d->item->setFilter(0); - d->item = 0; - } - - if (i->filter() != this) { - i->setFilter(this); - } else { - d->item = i; - } -} - -#if defined(QFX_RENDER_OPENGL2) -void QSimpleCanvasFilterPrivate::doFilterGL(QSimpleCanvasItem::GLPainter &p, const QSimpleCanvasItemPrivate::GLPaintParameters &prms) -{ - params = prms; - q->filterGL(p); -} -#endif - -QRectF QSimpleCanvasFilter::itemBoundingRect(const QRectF &r) const -{ - return r; -} - -void QSimpleCanvasFilter::filterGL(QSimpleCanvasItem::GLPainter &p) -{ - Q_UNUSED(p); -} - -void QSimpleCanvasFilter::filter(QPainter &) -{ -} - -void QSimpleCanvasFilter::update() -{ - if (d->item) - d->item->update(); -} - -#if defined(QFX_RENDER_OPENGL2) -bool QSimpleCanvasFilterPrivate::isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout) -{ - if (item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) { - *out = item; - return true; - } else if (!(item->options() & QSimpleCanvasItem::HasContents) && - item->children().count() == 1) { - QSimpleCanvasItem *child = item->children().first(); - if (child->filter() && child->filter()->enabled()) - return false; - bool rv = isSimpleItem(child, out, mout); - if (rv) - *mout *= child->d_func()->localTransform(); - return rv; - } else { - return false; - } -} -#endif - -bool QSimpleCanvasFilter::isSimpleItem(QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout) -{ -#if defined(QFX_RENDER_OPENGL2) - return d->isSimpleItem(item(), out, mout); -#else - Q_UNUSED(out); - Q_UNUSED(mout); -#endif - - return false; -} - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvasfilter.h b/src/declarative/canvas/qsimplecanvasfilter.h deleted file mode 100644 index 14bb765..0000000 --- a/src/declarative/canvas/qsimplecanvasfilter.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVASFILTER_H -#define QSIMPLECANVASFILTER_H - -#include -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QSimpleCanvasFilterPrivate; -class QRectF; -class QPoint; -class QGLFramebufferObject; -class GLShaderProgram; -class Q_DECLARATIVE_EXPORT QSimpleCanvasFilter : public QObject -{ -Q_OBJECT -public: - QSimpleCanvasFilter(QObject *parent); - virtual ~QSimpleCanvasFilter(); - - enum Layer { ChildrenUnderItem = 0x01, - Item = 0x02, - ChildrenAboveItem = 0x04, - All = 0x07 }; - - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - bool enabled() const; - void setEnabled(bool); - - QSimpleCanvasItem *item() const; - void setItem(QSimpleCanvasItem *); -Q_SIGNALS: - void enabledChanged(); - -protected: - - virtual QRectF itemBoundingRect(const QRectF &) const; - virtual void filterGL(QSimpleCanvasItem::GLPainter &p); - virtual void filter(QPainter &p); - - QGLFramebufferObject *renderToFBO(const QRectF &src = QRect(), const QPoint &offset = QPoint(), Layer = All); - QGLFramebufferObject *renderToFBO(float scale, const QRectF &src = QRect(), const QPoint &offset = QPoint(), Layer = All); - QGLFramebufferObject *acquireFBO(const QSize & = QSize()); - void releaseFBO(QGLFramebufferObject *); - - void renderToScreen(const QRectF &src = QRect(), Layer = All); - void renderToScreen(const QSimpleCanvas::Matrix &trans, const QRectF &src = QRect(), Layer = All); - - void update(); - - bool isSimpleItem(QSimpleCanvasItem **, QSimpleCanvas::Matrix *); - -private: - friend class QSimpleCanvasFilterPrivate; - friend class QSimpleCanvasItemPrivate; - friend class QSimpleCanvasItem; - - QSimpleCanvasFilterPrivate *d; -}; - - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif diff --git a/src/declarative/canvas/qsimplecanvasfilter_p.h b/src/declarative/canvas/qsimplecanvasfilter_p.h deleted file mode 100644 index 1c72993..0000000 --- a/src/declarative/canvas/qsimplecanvasfilter_p.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVASFILTER_P_H -#define QSIMPLECANVASFILTER_P_H - -#include "qsimplecanvasitem.h" -#include "qsimplecanvasitem_p.h" - - -QT_BEGIN_NAMESPACE -class QSimpleCanvasFilterPrivate -{ -public: - QSimpleCanvasFilterPrivate(QSimpleCanvasFilter *_q) - : q(_q), item(0), enabled(true) {} - - QSimpleCanvasFilter *q; - - QSimpleCanvasItem *item; - bool enabled; -#if defined(QFX_RENDER_OPENGL) - QSimpleCanvasItemPrivate::GLPaintParameters params; - - void doFilterGL(QSimpleCanvasItem::GLPainter &, const QSimpleCanvasItemPrivate::GLPaintParameters &); - - bool isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout); -#endif -}; - -QT_END_NAMESPACE -#endif diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index cbdc324..f53ae72 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -199,20 +199,6 @@ void QSimpleCanvasItem::paintContents(QPainter &) { } -void QSimpleCanvasItem::paintGLContents(GLPainter &) -{ -} - -uint QSimpleCanvasItem::glSimpleItemData(float *vertices, float *texVertices, - GLTexture **texture, uint count) -{ - Q_UNUSED(vertices); - Q_UNUSED(texVertices); - Q_UNUSED(texture); - Q_UNUSED(count); - return 0; -} - void QSimpleCanvasItem::canvasChanged() { } @@ -229,15 +215,6 @@ void QSimpleCanvasItem::parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *) { } -GLBasicShaders *QSimpleCanvasItem::basicShaders() const -{ -#if defined(QFX_RENDER_OPENGL2) - return canvas()->d->basicShaders(); -#else - return 0; -#endif -} - /*! Returns the item's (0, 0) point relative to its parent. */ @@ -668,27 +645,6 @@ void QSimpleCanvasItem::remChild(QSimpleCanvasItem *c) childrenChanged(); } -QSimpleCanvasFilter *QSimpleCanvasItem::filter() const -{ - Q_D(const QSimpleCanvasItem); - return d->filter; -} - -/*! -QSimpleCanvasItem takes ownership of filter. -*/ -void QSimpleCanvasItem::setFilter(QSimpleCanvasFilter *f) -{ - Q_D(QSimpleCanvasItem); - if (!d || f == d->filter) - return; - - d->filter = f; - if (d->filter) - d->filter->setItem(this); - update(); -} - const QList &QSimpleCanvasItem::children() const { Q_D(const QSimpleCanvasItem); @@ -795,66 +751,22 @@ QRect QSimpleCanvasItem::itemBoundingRect() QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const { -#if defined(QFX_RENDER_OPENGL) - if (!canvas) - return p; - - QPointF rv(-1. + 2. * p.x() / qreal(canvas->width()), - 1 - 2. * p.y() / qreal(canvas->height())); - - return rv; -#else return p; -#endif } QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const { -#if defined(QFX_RENDER_OPENGL) - if (!canvas) - return r; - - qreal width = r.width() * 2. / qreal(canvas->width()); - qreal height = r.height() * 2. / qreal(canvas->height()); - qreal x = -1. + 2. * r.x() / qreal(canvas->width()); - qreal y = 1. - 2. * r.y() / qreal(canvas->height()) - height; - - return QRectF(x, y, width, height); -#else return r; -#endif } QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const { -#if defined(QFX_RENDER_OPENGL) - if (!canvas) - return p; - - QPointF rv(0.5 * (p.x() + 1.) * qreal(canvas->width()), - 0.5 * (1. - p.y()) * qreal(canvas->height())); - - return rv; -#else return p; -#endif } QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const { -#if defined(QFX_RENDER_OPENGL) - if (!canvas) - return r; - - qreal width = 0.5 * r.width() * qreal(canvas->width()); - qreal height = 0.5 * r.height() * qreal(canvas->height()); - qreal x = 0.5 * (r.x() + 1.) * qreal(canvas->width()); - qreal y = 0.5 * (1. - r.y()) * qreal(canvas->height()) - height; - - return QRectF(x, y, width, height); -#else return r; -#endif } QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const @@ -865,20 +777,7 @@ QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const } else { QPointF mp = d->adjustFrom(p); d->freshenTransforms(); -#if defined(QFX_RENDER_OPENGL) - // m20X + m21Y + m22Z + m23 = 1 - // Z = (1 - m23 - m20X - m21Y) / m22 - - QMatrix4x4 inv = d->data()->transformActive.inverted(); - qreal z_s = (1 - inv(2,3) - inv(2,0) * mp.x() - inv(2, 1) * mp.y()) / inv(2, 2); - - QVector3D vec(mp.x(), mp.y(), z_s); - QVector3D r = inv.map(vec); - - return r.toPointF(); -#else return d->data()->transformActive.inverted().map(mp); -#endif } } @@ -890,32 +789,7 @@ QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const } else { QRectF mr = d->adjustFrom(r); d->freshenTransforms(); -#if defined(QFX_RENDER_OPENGL) - // m20X + m21Y + m22Z + m23 = 1 - // Z = (1 - m23 - m20X - m21Y) / m22 - - QMatrix4x4 inv = d->data()->transformActive.inverted(); - qreal tl_z_s = (1 - inv(2,3) - inv(2,0) * mr.topLeft().x() - inv(2, 1) * mr.topLeft().y()) / inv(2, 2); - qreal tr_z_s = (1 - inv(2,3) - inv(2,0) * mr.topRight().x() - inv(2, 1) * mr.topRight().y()) / inv(2, 2); - qreal bl_z_s = (1 - inv(2,3) - inv(2,0) * mr.bottomLeft().x() - inv(2, 1) * mr.bottomLeft().y()) / inv(2, 2); - qreal br_z_s = (1 - inv(2,3) - inv(2,0) * mr.bottomRight().x() - inv(2, 1) * mr.bottomRight().y()) / inv(2, 2); - - QVector3D tl(mr.topLeft().x(), mr.topLeft().y(), tl_z_s); - QVector3D tr(mr.topRight().x(), mr.topRight().y(), tr_z_s); - QVector3D bl(mr.bottomLeft().x(), mr.bottomLeft().y(), bl_z_s); - QVector3D br(mr.bottomRight().x(), mr.bottomRight().y(), br_z_s); - - tl = inv.map(tl); tr = inv.map(tr); bl = inv.map(bl); br = inv.map(br); - - qreal xmin = qMin(qMin(tl.x(), tr.x()), qMin(bl.x(), br.x())); - qreal xmax = qMax(qMax(tl.x(), tr.x()), qMax(bl.x(), br.x())); - qreal ymin = qMin(qMin(tl.y(), tr.y()), qMin(bl.y(), br.y())); - qreal ymax = qMax(qMax(tl.y(), tr.y()), qMax(bl.y(), br.y())); - - return QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax)); -#else return d->data()->transformActive.inverted().mapRect(mr); -#endif } } @@ -992,20 +866,12 @@ void QSimpleCanvasItemPrivate::doFreshenTransforms() const } Q_Q(const QSimpleCanvasItem); -#if defined(QFX_RENDER_OPENGL) - if (q->d_func()->data()->transformUser) - data()->transformActive *= *q->d_func()->data()->transformUser; -#endif if (data()->flip) { QRectF br = q->boundingRect(); data()->transformActive.translate(br.width() / 2., br.height() / 2); -#if defined(QFX_RENDER_OPENGL) - data()->transformActive.rotate(180, (data()->flip & QSimpleCanvasItem::VerticalFlip)?1:0, (data()->flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0); -#else data()->transformActive.scale((data()->flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, (data()->flip & QSimpleCanvasItem::VerticalFlip)?-1:1); -#endif data()->transformActive.translate(-br.width() / 2., -br.height() / 2); } } @@ -1345,8 +1211,6 @@ QSimpleCanvasItem::~QSimpleCanvasItem() if (prnt && d->canvas->d->focusPanelData.value(prnt) == this) d->canvas->d->focusPanelData.remove(prnt); } - if (d->filter) - delete d->filter; qDeleteAll(children()); if (parent()) @@ -1372,8 +1236,6 @@ QSimpleCanvasItem::~QSimpleCanvasItem() delete child; } - delete d->filter; - if (parent() && d->data_ptr && d->data()->dirty) { QSimpleCanvasLayer *l = parent()->layer(); if (l) { diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index dce3007..74841ea 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -45,9 +45,6 @@ #include #include #include -#if defined(QFX_RENDER_OPENGL) -#include -#endif #include #include @@ -66,9 +63,6 @@ class QSimpleCanvasLayer; class QPointF; class QRectF; class QGraphicsSceneHoverEvent; -class QSimpleCanvasFilter; -class GLTexture; -class QGLShaderProgram; class Q_DECLARATIVE_EXPORT QSimpleCanvasItem : public QObject { @@ -168,39 +162,9 @@ public: QRect itemBoundingRect(); - class GLPainter - { - public: - GLPainter(); - GLPainter(QSimpleCanvasItem *i); - QSimpleCanvasItem *item; - QSimpleCanvas::Matrix activeTransform; - qreal activeOpacity; - QRect sceneClipRect; - - QGLShaderProgram *useTextureShader(); - QGLShaderProgram *useColorShader(const QColor &); - void drawPixmap(const QPointF &, const GLTexture &); - void drawPixmap(const QRectF &, const GLTexture &); - void fillRect(const QRectF &, const QColor &); - - void invalidate(); - - bool blendEnabled; - - private: - int flags; - GLPainter(const GLPainter &); - GLPainter &operator=(const GLPainter &); - }; - - void setPaintMargin(qreal margin); QRectF boundingRect() const; virtual void paintContents(QPainter &); - virtual void paintGLContents(GLPainter &); - virtual uint glSimpleItemData(float *vertices, float *texVertices, - GLTexture **texture, uint count); void update(); @@ -217,9 +181,6 @@ public: QSimpleCanvas::Matrix transform() const; void setTransform(const QSimpleCanvas::Matrix &); - QSimpleCanvasFilter *filter() const; - void setFilter(QSimpleCanvasFilter *); - QSimpleCanvasItem *mouseGrabberItem() const; void ungrabMouse(); void grabMouse(); @@ -238,30 +199,6 @@ public: static QSimpleCanvasItem *findPrevFocus(QSimpleCanvasItem *item); static QSimpleCanvasItem *findNextFocus(QSimpleCanvasItem *item); - GLBasicShaders *basicShaders() const; - -#if defined(QFX_RENDER_OPENGL) - class CachedTexture : public GLTexture - { - public: - void addRef(); - void release(); - - int pixmapWidth() const; - int pixmapHeight() const; - - private: - CachedTexture(); - friend class QSimpleCanvasItem; - QSimpleCanvasPrivate *d; - QString s; - int r, w, h; - }; - - CachedTexture *cachedTexture(const QString &); - CachedTexture *cachedTexture(const QString &, const QPixmap &); -#endif - static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); protected: @@ -299,12 +236,8 @@ private: friend class QSimpleCanvas; friend class QSimpleCanvasPrivate; friend class QSimpleCanvasRootLayer; - friend class QSimpleCanvasItem::GLPainter; - friend class QSimpleCanvasFilter; friend class QGraphicsQSimpleCanvasItem; friend class QSimpleGraphicsItem; - friend class CanvasEGLWidget; - friend class QSimpleCanvasFilterPrivate; public: QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent); diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index 6c21d9f..a062054 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -45,11 +45,6 @@ #include "private/qobject_p.h" #include "qsimplecanvas.h" #include "qsimplecanvasitem.h" -#include "qsimplecanvasfilter.h" - -#if defined(QFX_RENDER_OPENGL2) -#include -#endif #include "qgraphicsitem.h" @@ -106,11 +101,7 @@ public: float activeOpacity; -#if defined(QFX_RENDER_OPENGL) - QRectF lastPaintRect; -#else QRect lastPaintRect; -#endif }; class QSimpleCanvasItemDebuggerStatus : public QmlDebuggerStatus @@ -129,14 +120,13 @@ public: bool selected; }; -class QSimpleCanvasFilter; class QGraphicsQSimpleCanvasItem; class QSimpleCanvasItemPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QSimpleCanvasItem) public: QSimpleCanvasItemPrivate() - : parent(0), canvas(0), debuggerStatus(0), filter(0), + : parent(0), canvas(0), debuggerStatus(0), clip(QSimpleCanvasItem::NoClip), origin(QSimpleCanvasItem::TopLeft), options(QSimpleCanvasItem::NoOption), focusable(false), wantsActiveFocusPanelPendingCanvas(false), @@ -157,7 +147,6 @@ public: QList children; QSimpleCanvasItemDebuggerStatus *debuggerStatus; - QSimpleCanvasFilter *filter; QSimpleCanvasItem::ClipType clip:3; QSimpleCanvasItem::TransformOrigin origin:4; @@ -203,43 +192,9 @@ public: void setParentInternal(QSimpleCanvasItem *); void convertToGraphicsItem(QGraphicsItem * = 0); -#if defined(QFX_RENDER_QPAINTER) void paint(QPainter &); void paintChild(QPainter &, QSimpleCanvasItem *); QRect setupPainting(int version, const QRect &bounding); -#else - struct GLPaintParameters - { - QRect sceneRect; - QRectF boundingRect; - QRect clipRect; -#if defined(QFX_RENDER_OPENGL2) - uchar stencilValue; -#endif - float opacity; - bool forceParamRefresh; - - QSimpleCanvasItem::GLPainter *painter; - }; -#if defined(QFX_RENDER_OPENGL2) - QRectF setupPainting(int version, int &z, QSimpleCanvasItem **); -#elif defined(QFX_RENDER_OPENGL1) - QRectF setupPainting(int version, const QRect &bounding, unsigned int *zero); -#endif - void setupChildState(QSimpleCanvasItem *); - - void paint(GLPaintParameters &, QSimpleCanvasFilter::Layer = QSimpleCanvasFilter::All); -#if defined(QFX_RENDER_OPENGL1) - void paintNoClip(GLPaintParameters &, QSimpleCanvasFilter::Layer = QSimpleCanvasFilter::All); -#endif - void paintChild(const GLPaintParameters &, QSimpleCanvasItem *); - void simplePaintChild(const GLPaintParameters &, QSimpleCanvasItem *); - - inline GLBasicShaders *basicShaders() const; - - QSimpleCanvas::Matrix localTransform() const; - -#endif QSimpleCanvasItem *nextOpaque; diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 382f3cb..31830a0 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -26,6 +26,4 @@ include(widgets/widgets.pri) include(test/test.pri) include(debugger/debugger.pri) -contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1):include(opengl/opengl.pri) - symbian:TARGET.UID3=0x2001E623 diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 166ad58..801725d 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -2,7 +2,6 @@ HEADERS += \ fx/qfxanchors.h \ fx/qfxanchors_p.h \ fx/qfxanimatedimageitem.h \ - fx/qfxblendedimage.h \ fx/qfxcomponentinstance.h \ fx/qfxcomponentinstance_p.h \ fx/qfxcontentwrapper.h \ @@ -50,7 +49,6 @@ HEADERS += \ SOURCES += \ fx/qfxanchors.cpp \ fx/qfxanimatedimageitem.cpp \ - fx/qfxblendedimage.cpp \ fx/qfxcomponentinstance.cpp \ fx/qfxcontentwrapper.cpp \ fx/qfxevents.cpp \ diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp deleted file mode 100644 index 0c93fef..0000000 --- a/src/declarative/fx/qfxblendedimage.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxblendedimage.h" -#include - -#if defined(QFX_RENDER_OPENGL2) -#include -#endif - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass BlendedImage - \brief The BlendedImage elements blends two different images depending on a blend ratio. - - This element can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ - -/*! - \internal - \class QFxBlendedImage - \brief The QFxBlendedImage blends two different images depending on a blend ratio. - - This class can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ -QFxBlendedImage::QFxBlendedImage(QFxItem *parent) -: QFxItem(parent), _blend(0), _smooth(false), dirty(false) -{ -#if defined(QFX_RENDER_OPENGL2) - setOptions(HasContents); -#endif -} - -/*! - Cancels any pending image loads and destroys the image. -*/ -QFxBlendedImage::~QFxBlendedImage() -{ - if (!primUrl.isEmpty()) - QFxPixmap::cancelGet(primUrl,this); - if (!secUrl.isEmpty()) - QFxPixmap::cancelGet(secUrl,this); -} - -/*! - \qmlproperty string BlendedImage::primaryUrl - The URL of the first image to be displayed in this item. -*/ -QUrl QFxBlendedImage::primaryUrl() const -{ - return primUrl; -} - -void QFxBlendedImage::primaryLoaded() -{ - primPix = QFxPixmap(primUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setPrimaryUrl(const QUrl &url) -{ - if (primUrl == url) - return; - if (!primUrl.isEmpty()) - QFxPixmap::cancelGet(primUrl,this); - Q_ASSERT(!url.isRelative()); - primUrl = url; - if (!primUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), primUrl,this,SLOT(primaryLoaded())); -} - -/*! - \qmlproperty string BlendedImage::secondaryUrl - The URL of the second image to be displayed in this item. -*/ -QUrl QFxBlendedImage::secondaryUrl() const -{ - return secUrl; -} - -void QFxBlendedImage::secondaryLoaded() -{ - secPix = QFxPixmap(secUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setSecondaryUrl(const QUrl &url) -{ - if (secUrl == url) - return; - if (!secUrl.isEmpty()) - QFxPixmap::cancelGet(secUrl,this); - Q_ASSERT(!url.isRelative()); - secUrl = url; - if (!secUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), secUrl,this,SLOT(secondaryLoaded())); -} - -/*! - \qmlproperty real BlendedImage::blend - The ratio used to blend the two images. - - If blend has a value of 0, only the first image will be displayed. - If blend has a value of 1, only the second image will be displayed. -*/ -qreal QFxBlendedImage::blend() const -{ - return _blend; -} - -void QFxBlendedImage::setBlend(qreal b) -{ - _blend = b; - update(); -} - -/*! - \qmlproperty bool BlendedImage::smooth - - Set this property if you want the image to be smoothly filtered when scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If - the BlendedImage is displayed at its natural size, this property has no visual or - performance effect. - - \note Generally scaling artifacts are only visible if the image is stationary on - the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. - */ -bool QFxBlendedImage::smoothTransform() const -{ - return _smooth; -} - -void QFxBlendedImage::setSmoothTransform(bool s) -{ - if (_smooth == s) - return; - _smooth = s; - update(); -} - -#if defined(QFX_RENDER_QPAINTER) - -void QFxBlendedImage::paintContents(QPainter &p) -{ - if (primUrl.isEmpty() && secUrl.isEmpty()) - return; - - if (_smooth) { - p.save(); - p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth); - } - - if (_blend < 0.75) - p.drawPixmap(0, 0, primPix); - else - p.drawPixmap(0, 0, secPix); - - if (_smooth) { - p.restore(); - } -} - -#elif defined(QFX_RENDER_OPENGL2) - -void QFxBlendedImage::paintGLContents(GLPainter &p) -{ - static DualTextureBlendShader *shader = 0; - if (!shader) - shader = new DualTextureBlendShader(); - - if (dirty) { - prim.clear(); - sec.clear(); - prim.setImage(primPix.toImage()); - sec.setImage(secPix.toImage()); - - dirty = false; - } - - if (prim.isNull() || sec.isNull()) { - - return; - } - - GLfloat vertices[8]; - GLfloat texVertices[8]; - - float widthV = width(); - float heightV = height(); - if (!widthV) - widthV = qMax(primPix.width(), secPix.width()); - if (!heightV) - heightV = qMax(primPix.height(), secPix.height()); - - vertices[0] = 0; vertices[1] = heightV; - vertices[2] = widthV; vertices[3] = heightV; - vertices[4] = 0; vertices[5] = 0; - vertices[6] = widthV; vertices[7] = 0; - - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = 1; texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = 1; - texVertices[6] = 1; texVertices[7] = 1; - - if (_blend == 0 || _blend == 1) { - QGLShaderProgram *tshader = p.useTextureShader(); - - GLTexture *tex = 0; - - if (_blend == 0) - tex = &prim; - else - tex = &sec; - - tshader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - tshader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, tex->texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - tshader->disableAttributeArray(SingleTextureShader::Vertices); - tshader->disableAttributeArray(SingleTextureShader::TextureCoords); - } else { - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, prim.texture()); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, sec.texture()); - - shader->enable(); - shader->setOpacity(1); - qreal b = _blend; - if (b > 1) b = 1; - else if (b < 0) b = 0; - shader->setBlend(b); - shader->setTransform(p.activeTransform); - - shader->setAttributeArray(DualTextureBlendShader::Vertices, vertices, 2); - shader->setAttributeArray(DualTextureBlendShader::TextureCoords, texVertices, 2); - shader->setAttributeArray(DualTextureBlendShader::BlendTextureCoords, texVertices, 2); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - shader->disableAttributeArray(DualTextureBlendShader::Vertices); - shader->disableAttributeArray(DualTextureBlendShader::TextureCoords); - shader->disableAttributeArray(DualTextureBlendShader::BlendTextureCoords); - - glBindTexture(GL_TEXTURE_2D, 0); - glActiveTexture(GL_TEXTURE0); - } -} -#endif - -QML_DEFINE_TYPE(QFxBlendedImage,BlendedImage) - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h deleted file mode 100644 index 248cc9d..0000000 --- a/src/declarative/fx/qfxblendedimage.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXBLENDEDIMAGE_H -#define QFXBLENDEDIMAGE_H - -#include -#if defined(QFX_RENDER_OPENGL2) -#include -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem -{ - Q_OBJECT - - Q_PROPERTY(QUrl primaryUrl READ primaryUrl WRITE setPrimaryUrl) - Q_PROPERTY(QUrl secondaryUrl READ secondaryUrl WRITE setSecondaryUrl) - Q_PROPERTY(qreal blend READ blend WRITE setBlend) - Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform) -public: - QFxBlendedImage(QFxItem *parent=0); - ~QFxBlendedImage(); - - QUrl primaryUrl() const; - void setPrimaryUrl(const QUrl &); - - QUrl secondaryUrl() const; - void setSecondaryUrl(const QUrl &); - - qreal blend() const; - void setBlend(qreal); - - bool smoothTransform() const; - void setSmoothTransform(bool); - -#if defined(QFX_RENDER_QPAINTER) - void paintContents(QPainter &painter); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif - -private Q_SLOTS: - void primaryLoaded(); - void secondaryLoaded(); - -private: - QUrl primUrl; - QUrl secUrl; - - qreal _blend; - bool _smooth; - bool dirty; -#if defined(QFX_RENDER_OPENGL2) - GLTexture prim; - GLTexture sec; -#endif - QPixmap primPix; - QPixmap secPix; -}; -QML_DECLARE_TYPE(QFxBlendedImage) - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // QFXBLENDEDIMAGE_H diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 4c02e74..0957c2f 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -220,21 +220,12 @@ void QFxFlipablePrivate::setBackTransform() axisRotation.setAngle(rotation); QSimpleCanvas::Matrix mat; -#ifdef QFX_RENDER_OPENGL - mat.translate(back->width()/2,back->height()/2, 0); - if (back->width() && p1.x() >= p2.x()) - mat.rotate(180, 0, 1, 0); - if (back->height() && p2.y() >= p3.y()) - mat.rotate(180, 1, 0, 0); - mat.translate(-back->width()/2,-back->height()/2, 0); -#else mat.translate(back->width()/2,back->height()/2); if (back->width() && p1.x() >= p2.x()) mat.rotate(180, Qt::YAxis); if (back->height() && p2.y() >= p3.y()) mat.rotate(180, Qt::XAxis); mat.translate(-back->width()/2,-back->height()/2); -#endif back->setTransform(mat); } @@ -318,21 +309,12 @@ void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) d->current = newSide; if (d->current==Back) { QSimpleCanvas::Matrix mat; -#ifdef QFX_RENDER_OPENGL - mat.translate(d->back->width()/2,d->back->height()/2, 0); - if (d->back->width() && p1.x() >= p2.x()) - mat.rotate(180, 0, 1, 0); - if (d->back->height() && p2.y() >= p3.y()) - mat.rotate(180, 1, 0, 0); - mat.translate(-d->back->width()/2,-d->back->height()/2, 0); -#else mat.translate(d->back->width()/2,d->back->height()/2); if (d->back->width() && p1.x() >= p2.x()) mat.rotate(180, Qt::YAxis); if (d->back->height() && p2.y() >= p3.y()) mat.rotate(180, Qt::XAxis); mat.translate(-d->back->width()/2,-d->back->height()/2); -#endif d->back->setTransform(mat); } if (d->front) diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h index 6630633..f00e023 100644 --- a/src/declarative/fx/qfxflipable.h +++ b/src/declarative/fx/qfxflipable.h @@ -44,9 +44,6 @@ #include #include -#if defined(QFX_RENDER_OPENGL) -#include -#endif #include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 40389c4..2ac035d 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -42,9 +42,6 @@ #include "qfximage.h" #include "qfximage_p.h" #include -#if defined(QFX_RENDER_OPENGL) -#include -#endif #include #include #include @@ -131,12 +128,6 @@ QFxImage::~QFxImage() QFxPixmap::cancelGet(d->url, this); if (!d->sciurl.isEmpty()) QFxPixmap::cancelGet(d->sciurl, this); -#if defined(QFX_RENDER_OPENGL) - if (d->tex) { - d->tex->release(); - d->tex = 0; - } -#endif } /*! @@ -164,13 +155,6 @@ void QFxImage::setPixmap(const QPixmap &pix) setImplicitWidth(d->pix.width()); setImplicitHeight(d->pix.height()); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - if (d->tex) { - d->tex->release(); - d->tex = 0; - } -#endif update(); } @@ -329,7 +313,6 @@ void QFxImage::dump(int depth) QFxItem::dump(depth); } -#if defined(QFX_RENDER_QPAINTER) void QFxImage::paintContents(QPainter &p) { Q_D(QFxImage); @@ -431,333 +414,6 @@ void QFxImage::paintContents(QPainter &p) if (d->smooth) p.setRenderHints(oldHints); } -#elif defined(QFX_RENDER_OPENGL) -uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, - GLTexture **texture, uint count) -{ - Q_D(QFxImage); - - if (d->pix.isNull() || (d->scaleGrid && !d->scaleGrid->isNull())) - return 0; - - if (count < 8) - return 8; - - d->checkDirty(); - - float widthV = width(); - float heightV = height(); - - vertices[0] = 0; vertices[1] = heightV; - vertices[2] = widthV; vertices[3] = heightV; - vertices[4] = 0; vertices[5] = 0; - vertices[6] = widthV; vertices[7] = 0; - - *texture = d->tex; - - if (d->tiled) { - float tileWidth = widthV / d->pix.width(); - float tileHeight = heightV / d->pix.height(); - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = tileWidth; texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = tileHeight; - texVertices[6] = tileWidth; texVertices[7] = tileHeight; - } else { - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = d->tex->glWidth(); texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = d->tex->glHeight(); - texVertices[6] = d->tex->glWidth(); texVertices[7] = d->tex->glHeight(); - } - - return 8; -} - -void QFxImagePrivate::checkDirty() -{ - Q_Q(QFxImage); - if (texDirty && !pix.isNull()) - tex = q->cachedTexture(url.toString(), pix); - texDirty = false; -} - -#if defined(QFX_RENDER_OPENGL2) -void QFxImage::paintGLContents(GLPainter &p) -{ - Q_D(QFxImage); - if (d->pix.isNull()) - return; - - QGLShaderProgram *shader = p.useTextureShader(); - - bool restoreBlend = false; - if (p.blendEnabled && isOpaque() && p.activeOpacity == 1) { - glDisable(GL_BLEND); - restoreBlend = true; - } - - d->checkDirty(); - - if (d->tiled || (!d->scaleGrid || d->scaleGrid->isNull())) { - - if (!d->tiled) { - - float widthV = width(); - float heightV = height(); - float glWidth = d->tex->glWidth(); - float glHeight = d->tex->glHeight(); - - float deltaX = 0.5 / qreal(d->tex->glSize().width()); - float deltaY = 0.5 / qreal(d->tex->glSize().height()); - glWidth -= deltaX; - glHeight -= deltaY; - - - float vert[] = { - 0, heightV, - widthV, heightV, - 0, 0, - - widthV, heightV, - 0, 0, - widthV, 0 }; - - float tex[] = { - deltaX, deltaY, - glWidth, deltaY, - deltaX, glHeight, - - glWidth, deltaY, - deltaX, glHeight, - glWidth, glHeight - }; - - shader->setAttributeArray(SingleTextureShader::Vertices, vert, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, tex, 2); - glBindTexture(GL_TEXTURE_2D, d->tex->texture()); - glDrawArrays(GL_TRIANGLES, 0, 6); - - } else { - - GLfloat vertices[8]; - GLfloat texVertices[8]; - GLTexture *tex = 0; - - QFxImage::glSimpleItemData(vertices, texVertices, &tex, 8); - - shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, tex->texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - } - - } else { - - float imgWidth = d->pix.width(); - float imgHeight = d->pix.height(); - if (!imgWidth || !imgHeight) { - if (restoreBlend) - glEnable(GL_BLEND); - return; - } - - float widthV = width(); - float heightV = height(); - float glWidth = d->tex->glWidth(); - float glHeight = d->tex->glHeight(); - float deltaX = 0.5 / qreal(d->tex->glSize().width()); - float deltaY = 0.5 / qreal(d->tex->glSize().height()); - glHeight -= deltaY; - glWidth -= deltaX; - - float texleft = deltaX; - float texright = glWidth; - float textop = glHeight; - float texbottom = deltaY; - float imgleft = 0; - float imgright = widthV; - float imgtop = 0; - float imgbottom = heightV; - - const int sgl = d->scaleGrid->left(); - const int sgr = d->scaleGrid->right(); - const int sgt = d->scaleGrid->top(); - const int sgb = d->scaleGrid->bottom(); - - if (sgl) { - texleft = deltaX + d->tex->glWidth() * float(sgl) / imgWidth; - imgleft = sgl; - } - if (sgr) { - texright = d->tex->glWidth() - float(sgr) / imgWidth - deltaX; - imgright = widthV - sgr; - } - if (sgt) { - textop = d->tex->glHeight() - float(sgb) / imgHeight - deltaY; - imgtop = sgt; - } - if (sgb) { - texbottom = deltaY + d->tex->glHeight() * float(sgt) / imgHeight; - imgbottom = heightV - sgb; - } - - float vert1[] = { 0, 0, - 0, imgtop, - imgleft, 0, - - 0, imgtop, - imgleft, 0, - imgleft, imgtop, - - imgleft, 0, - imgleft, imgtop, - imgright, 0, - - imgleft, imgtop, - imgright, 0, - imgright, imgtop, - - imgright, 0, - imgright, imgtop, - widthV, 0, - - imgright, imgtop, - widthV, 0, - widthV, imgtop, - - 0, imgtop, - 0, imgbottom, - imgleft, imgtop, - - 0, imgbottom, - imgleft, imgtop, - imgleft, imgbottom, - - imgleft, imgtop, - imgleft, imgbottom, - imgright, imgtop, - - imgleft, imgbottom, - imgright, imgtop, - imgright, imgbottom, - - imgright, imgtop, - imgright, imgbottom, - widthV, imgtop, - - imgright, imgbottom, - widthV, imgtop, - widthV, imgbottom, - - 0, imgbottom, - 0, heightV, - imgleft, imgbottom, - - 0, heightV, - imgleft, imgbottom, - imgleft, heightV, - - imgleft, imgbottom, - imgleft, heightV, - imgright, imgbottom, - - imgleft, heightV, - imgright, imgbottom, - imgright, heightV, - - imgright, imgbottom, - imgright, heightV, - widthV, imgbottom, - - imgright, heightV, - widthV, imgbottom, - widthV, heightV }; - - float tex1[] = { deltaX, glHeight, - deltaX, textop, - texleft, glHeight, - - deltaX, textop, - texleft, glHeight, - texleft, textop, - - texleft, glHeight, - texleft, textop, - texright, glHeight, - - texleft, textop, - texright, glHeight, - texright, textop, - - texright, glHeight, - texright, textop, - glWidth, glHeight, - - texright, textop, - glWidth, glHeight, - glWidth, textop, - - deltaX, textop, - deltaX, texbottom, - texleft, textop, - - deltaX, texbottom, - texleft, textop, - texleft, texbottom, - - texleft, textop, - texleft, texbottom, - texright, textop, - - texleft, texbottom, - texright, textop, - texright, texbottom, - - texright, textop, - texright, texbottom, - glWidth, textop, - - texright, texbottom, - glWidth, textop, - glWidth, texbottom, - - deltaX, texbottom, - deltaX, deltaY, - texleft, texbottom, - - deltaX, deltaY, - texleft, texbottom, - texleft, deltaY, - - texleft, texbottom, - texleft, deltaY, - texright, texbottom, - - texleft, deltaY, - texright, texbottom, - texright, deltaY, - - texright, texbottom, - texright, deltaY, - glWidth, texbottom, - - texright, deltaY, - glWidth, texbottom, - glWidth, deltaY }; - - glBindTexture(GL_TEXTURE_2D, d->tex->texture()); - - shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2); - glDrawArrays(GL_TRIANGLES, 0, 54); - } - - if (restoreBlend) - glEnable(GL_BLEND); -} -#endif - -#endif QString QFxImage::propertyInfo() const { @@ -867,13 +523,6 @@ void QFxImage::setSource(const QUrl &url) d->progress = 1.0; setImplicitWidth(0); setImplicitHeight(0); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - if (d->tex) { - d->tex->release(); - d->tex = 0; - } -#endif emit statusChanged(d->status); emit sourceChanged(d->url); emit progressChanged(1.0); @@ -931,13 +580,6 @@ void QFxImage::requestFinished() if (d->status == Loading) d->status = Idle; d->progress = 1.0; -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - if (d->tex) { - d->tex->release(); - d->tex = 0; - } -#endif emit statusChanged(d->status); emit sourceChanged(d->url); emit progressChanged(1.0); diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index 35b921a..039334a 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -93,13 +93,7 @@ public: virtual void dump(int depth); virtual QString propertyInfo() const; -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &painter); -#elif defined(QFX_RENDER_OPENGL) - void paintGLContents(GLPainter &); - uint glSimpleItemData(float *vertices, float *texVertices, - GLTexture **texture, uint count); -#endif Q_SIGNALS: void sourceChanged(const QUrl &); diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h index 1785abb..e4a3a90 100644 --- a/src/declarative/fx/qfximage_p.h +++ b/src/declarative/fx/qfximage_p.h @@ -55,10 +55,6 @@ #include "qfxitem_p.h" -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_NAMESPACE class QSvgRenderer; @@ -73,9 +69,6 @@ class QFxImagePrivate : public QFxItemPrivate public: QFxImagePrivate() : scaleGrid(0), tiled(false), smooth(false), opaque(false), -#if defined(QFX_RENDER_OPENGL) - texDirty(true), tex(0), -#endif status(QFxImage::Idle), sciReply(0), progress(0.0) { } @@ -99,11 +92,6 @@ public: bool tiled : 1; bool smooth : 1; bool opaque : 1; -#if defined(QFX_RENDER_OPENGL) - bool texDirty : 1; - void checkDirty(); - QSimpleCanvasItem::CachedTexture *tex; -#endif QFxImage::Status status; QUrl url; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 079d691..b4de109 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -62,7 +62,6 @@ #include "qfxitem_p.h" #include "qfxitem.h" #include "qfxevents_p.h" -#include #include @@ -73,7 +72,6 @@ QT_BEGIN_NAMESPACE QML_DEFINE_NOCREATE_TYPE(QFxContents) QML_DEFINE_TYPE(QFxItem,Item) -QML_DEFINE_NOCREATE_TYPE(QSimpleCanvasFilter) /*! \group group_animation @@ -1483,18 +1481,10 @@ void QFxItem::setRotation(qreal rotation) if (d->_rotation == rotation) return; d->_rotation = rotation; -#if defined(QFX_RENDER_OPENGL) - QMatrix4x4 trans; - QPointF to = transformOriginPoint(); - trans.translate(to.x(), to.y()); - trans.rotate(d->_rotation, 0, 0, 1); - trans.translate(-to.x(), -to.y()); -#else QPointF to = d->transformOrigin(); QTransform trans = QTransform::fromTranslate(to.x(), to.y()); trans.rotate(d->_rotation); trans.translate(-to.x(), -to.y()); -#endif setTransform(trans); emit rotationChanged(); } diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 3c872e1..3188516 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -131,7 +131,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) - Q_PROPERTY(QSimpleCanvasFilter *filter READ filter WRITE setFilter) Q_PROPERTY(bool clip READ clip WRITE setClip) Q_PROPERTY(bool focusable READ isFocusable WRITE setFocusable) Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged) @@ -269,8 +268,6 @@ private: }; QML_DECLARE_TYPE(QFxItem) -QML_DECLARE_TYPE(QSimpleCanvasFilter) - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp index 44adba7..850f20a 100644 --- a/src/declarative/fx/qfxpainteditem.cpp +++ b/src/declarative/fx/qfxpainteditem.cpp @@ -49,11 +49,6 @@ #include #include -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#endif - QT_BEGIN_NAMESPACE /*! @@ -211,26 +206,16 @@ void QFxPaintedItem::init() connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache())); } -#if defined(QFX_RENDER_QPAINTER) /*! \reimp */ void QFxPaintedItem::paintContents(QPainter &p) -#elif defined(QFX_RENDER_OPENGL) -/*! - \reimp -*/ -void QFxPaintedItem::paintGLContents(GLPainter &p) -#else -#error "What render?" -#endif { Q_D(QFxPaintedItem); const QRect content(QPoint(0,0),d->contentsSize); if (content.width() <= 0 || content.height() <= 0) return; -#if defined(QFX_RENDER_QPAINTER) bool oldAntiAliasing = p.testRenderHint(QPainter::Antialiasing); bool oldSmoothPixmap = p.testRenderHint(QPainter::SmoothPixmapTransform); if (d->smooth) { @@ -243,29 +228,12 @@ void QFxPaintedItem::paintGLContents(GLPainter &p) else clipf = mapToScene(clipf); -#elif defined(QFX_RENDER_OPENGL2) - p.useTextureShader(); - const QRectF clipf = p.sceneClipRect; - -#elif defined(QFX_RENDER_OPENGL1) - p.useTextureShader(); - const QRectF clipf = p.sceneClipRect; -#endif - const QRect clip = mapFromScene(clipf).toRect(); QRegion topaint(clip); topaint &= content; QRegion uncached(content); -#if defined(QFX_RENDER_OPENGL2) - glEnableVertexAttribArray(SingleTextureShader::Vertices); - glEnableVertexAttribArray(SingleTextureShader::TextureCoords); -#elif defined(QFX_RENDER_OPENGL1) - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); -#endif - int cachesize=0; for (int i=0; iimagecache.count(); ++i) { QRect area = d->imagecache[i]->area; @@ -312,29 +280,16 @@ void QFxPaintedItem::paintGLContents(GLPainter &p) } QFxPaintedItemPrivate::ImageCacheItem *newitem = new QFxPaintedItemPrivate::ImageCacheItem; newitem->area = r; -#if defined(QFX_RENDER_QPAINTER) newitem->image = img; -#else - newitem->image.setImage(img.toImage()); -#endif d->imagecache.append(newitem); QRectF target(r.x(), r.y(), r.width(), r.height()); p.drawPixmap(target.toRect(), newitem->image); } } -#if defined(QFX_RENDER_OPENGL2) - glDisableVertexAttribArray(SingleTextureShader::Vertices); - glDisableVertexAttribArray(SingleTextureShader::TextureCoords); -#elif defined(QFX_RENDER_OPENGL1) - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#endif -#if defined(QFX_RENDER_QPAINTER) if (d->smooth) { p.setRenderHints(QPainter::Antialiasing, oldAntiAliasing); p.setRenderHints(QPainter::SmoothPixmapTransform, oldSmoothPixmap); } -#endif } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h index e086894..ed254ce 100644 --- a/src/declarative/fx/qfxpainteditem.h +++ b/src/declarative/fx/qfxpainteditem.h @@ -63,11 +63,7 @@ public: Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize) Q_PROPERTY(bool smooth READ isSmooth WRITE setSmooth) -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &painter); -#elif defined(QFX_RENDER_OPENGL) - void paintGLContents(GLPainter &); -#endif bool isSmooth() const; QSize contentsSize() const; diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h index d8d1a2a..ec507fb 100644 --- a/src/declarative/fx/qfxpainteditem_p.h +++ b/src/declarative/fx/qfxpainteditem_p.h @@ -56,10 +56,6 @@ #include #include -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_NAMESPACE class QFxPaintedItemPrivate : public QFxItemPrivate @@ -77,11 +73,7 @@ public: ~ImageCacheItem() { } int age; QRect area; -#if defined(QFX_RENDER_QPAINTER) QPixmap image; -#else - GLTexture image; -#endif }; QList imagecache; diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 4cd34c4..5e84c88 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -40,9 +40,6 @@ ****************************************************************************/ #include "qfxitem_p.h" -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif #include #include @@ -350,11 +347,7 @@ public: maxX = minX = maxY = minY = 0; } -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &p); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif void updateSize(); @@ -375,9 +368,6 @@ public: , angle(0), angleDev(0), velocity(0), velocityDev(0) , addParticleTime(0), addParticleCount(0), lastAdvTime(0), stream(false), streamDelay(0) , emitting(true), motion(0), clock(this) -#if defined(QFX_RENDER_OPENGL) - , texDirty(true) -#endif { } @@ -418,10 +408,6 @@ public: QList particles; QTickAnimationProxy clock; -#if defined(QFX_RENDER_OPENGL) - bool texDirty; - GLTexture tex; -#endif }; //TODO: Stop the clock if no visible particles and not emitting (restart on emittingChanged) @@ -654,10 +640,6 @@ void QFxParticles::imageLoaded() { Q_D(QFxParticles); d->image = QFxPixmap(d->url); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - d->tex.clear(); -#endif update(); } @@ -673,10 +655,6 @@ void QFxParticles::setSource(const QUrl &name) if (name.isEmpty()) { d->url = name; d->image = QPixmap(); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - d->tex.clear(); -#endif update(); } else { d->url = name; @@ -1106,7 +1084,6 @@ void QFxParticlesPainter::updateSize(){ setY(myY); } -#if defined(QFX_RENDER_QPAINTER) void QFxParticles::paintContents(QPainter &p) { Q_UNUSED(p); @@ -1129,64 +1106,6 @@ void QFxParticlesPainter::paintContents(QPainter &p) } update();//Should I need this? (GV does) } -#elif defined(QFX_RENDER_OPENGL2) -void QFxParticles::paintGLContents(GLPainter &) -{ - //painting is done by the ParticlesPainter, so it can have the right size -} - -void QFxParticlesPainter::paintGLContents(GLPainter &p) -{ - - if (d->image.isNull()) - return; - - updateSize(); - - if (d->texDirty && !d->image.isNull()) { - d->tex.setImage(d->image.toImage()); - d->tex.setHorizontalWrap(GLTexture::Repeat); - d->tex.setVerticalWrap(GLTexture::Repeat); - } - d->texDirty = false; - - SingleTextureOpacityShader *shader = basicShaders()->singleTextureOpacity(); - shader->enable(); - shader->setTransform(p.activeTransform); - - glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - - const int myX = (int)(x() + parent()->x()); - const int myY = (int)(y() + parent()->y()); - float widthV = d->image.width(); - float heightV = d->image.height(); - for (int i = 0; i < d->particles.count(); ++i) { - const QFxParticle &particle = d->particles.at(i); - float left = particle.x - myX; - float right = particle.x - myX + widthV; - float top = particle.y - myY; - float bottom = particle.y - myY + heightV; - - GLfloat vertices[] = { left, bottom, - right, bottom, - left, top, - right, top }; - - GLfloat texVertices[] = { 0, 0, - 1, 0, - 0, 1, - 1, 1 }; - - shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - shader->setOpacity(particle.opacity * p.activeOpacity); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - } - - shader->disableAttributeArray(SingleTextureShader::Vertices); - shader->disableAttributeArray(SingleTextureShader::TextureCoords); -} -#endif void QFxParticles::componentComplete() { diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h index b3a569b..a0373d7 100644 --- a/src/declarative/fx/qfxparticles.h +++ b/src/declarative/fx/qfxparticles.h @@ -44,10 +44,6 @@ #include -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -214,11 +210,7 @@ public: virtual void dump(int depth); virtual QString propertyInfo() const; -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &p); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif protected: virtual void componentComplete(); diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index fd8d9ca..03ab426 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -251,17 +251,8 @@ QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent) void QFxRect::doUpdate() { -#if defined(QFX_RENDER_QPAINTER) Q_D(QFxRect); d->rectImage = QPixmap(); -#endif -#if defined(QFX_RENDER_OPENGL) - Q_D(QFxRect); - if (d->rectTexture) { - d->rectTexture->release(); - d->rectTexture = 0; - } -#endif const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; setPaintMargin((pw+1)/2); update(); @@ -361,14 +352,7 @@ void QFxRect::setRadius(qreal radius) return; d->radius = radius; -#if defined(QFX_RENDER_QPAINTER) d->rectImage = QPixmap(); -#elif defined(QFX_RENDER_OPENGL) - if (d->rectTexture) { - d->rectTexture->release(); - d->rectTexture = 0; - } -#endif update(); } @@ -412,15 +396,7 @@ void QFxRect::setColor(const QColor &c) return; d->color = c; -#if defined(QFX_RENDER_QPAINTER) d->rectImage = QPixmap(); -#endif -#if defined(QFX_RENDER_OPENGL) - if (d->rectTexture) { - d->rectTexture->release(); - d->rectTexture = 0; - } -#endif update(); } @@ -488,7 +464,6 @@ QColor QFxRectPrivate::getColor() } -#if defined(QFX_RENDER_QPAINTER) void QFxRect::generateRoundedRect() { Q_D(QFxRect); @@ -528,65 +503,7 @@ void QFxRect::generateBorderedRect() p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, d->rectImage.width()-(pw+1)/2*2, d->rectImage.height()-(pw+1)/2*2); } } -#elif defined(QFX_RENDER_OPENGL) -void QFxRect::generateRoundedRect() -{ - Q_D(QFxRect); - if (!d->rectTexture) { - const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; - QString key = QString("QFxRect://r_%1_%2_%3_%4").arg(pw).arg(d->radius).arg((d->pen && d->pen->isValid())?d->pen->color().name():QString()).arg(d->color.name()); - - d->rectTexture = cachedTexture(key); - - if (!d->rectTexture) { - QPixmap roundRect(d->radius*2 + 4 + pw*2, d->radius*2 + 4 + pw*2); - roundRect.fill(Qt::transparent); - QPainter p(&roundRect); - p.setRenderHint(QPainter::Antialiasing); - if (d->pen && d->pen->isValid()) { - QPen pn(QColor(pen()->color()), pen()->width()); - p.setPen(pn); - } else { - p.setPen(Qt::NoPen); - } - p.setBrush(d->color); - p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->radius, d->radius); - - d->rectTexture = cachedTexture(key, roundRect); - } - } -} -void QFxRect::generateBorderedRect() -{ - Q_D(QFxRect); - if (!d->rectTexture) { - const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; - QString key = QString("QFxRect://b_%1_%2_%3_%4").arg(pw).arg(d->radius).arg((d->pen && d->pen->isValid())?d->pen->color().name():QString()).arg(d->color.name()); - - d->rectTexture = cachedTexture(key); - - if (!d->rectTexture) { - QPixmap borderedRect(pw*2 + 4, pw*2 + 4); - borderedRect.fill(Qt::transparent); - QPainter p(&(borderedRect)); - p.setRenderHint(QPainter::Antialiasing); - if (d->pen && d->pen->isValid()) { - QPen pn(QColor(pen()->color()), pen()->width()); - p.setPen(pn); - } else { - p.setPen(Qt::NoPen); - } - p.setBrush(d->color); - p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2); - d->rectTexture = cachedTexture(key, borderedRect); - } - } -} -#endif - - -#if defined(QFX_RENDER_QPAINTER) void QFxRect::paintContents(QPainter &p) { Q_D(QFxRect); @@ -687,258 +604,5 @@ void QFxRect::drawRect(QPainter &p) QRect(d->rectImage.width()-xOffset, d->rectImage.height() - yOffset, xOffset, yOffset)); } } -#endif - -#if defined(QFX_RENDER_OPENGL2) -#include "glbasicshaders.h" - -void QFxRect::paintGLContents(GLPainter &p) -{ - Q_D(QFxRect); - if (d->radius == 0 && (!d->pen || !d->pen->isValid())) { - if (d->gradient) { - float widthV = width(); - float heightV = height(); - - GLfloat vertices[] = { 0, heightV, - widthV, heightV, - 0, 0, - widthV, 0 }; - - int count = d->gradient->stops()->size(); - GLfloat colors[count*8]; - for (int i = 0; i < count; i += 8) { - QFxGradientStop *g = d->gradient->stops()->at(i); - QColor c = g->color(); - colors[i] = c.redF(); colors[i+4] = colors[i]; - colors[i+1] = c.greenF(); colors[i+5] = colors[i+1]; - colors[i+2] = c.blueF(); colors[i+6] = colors[i+2]; - colors[i+3] = c.alphaF() * p.activeOpacity; colors[i+7] = colors[i+3]; - } - - p.invalidate(); - ColorShader *shader = basicShaders()->color(); - shader->enable(); - shader->setTransform(p.activeTransform); - - shader->setAttributeArray(ColorShader::Vertices, vertices, 2); - shader->setAttributeArray(ColorShader::Colors, colors, 4); - glDrawArrays(GL_TRIANGLE_STRIP, 0, count*2); - shader->disableAttributeArray(ColorShader::Vertices); - shader->disableAttributeArray(ColorShader::Colors); - } else { - - p.fillRect(QRectF(0, 0, width(), height()), d->getColor()); - - } - } else { - qreal offset = 0; - qreal pw = d->pen && d->pen->isValid() ? d->pen->width() : 0.0; - - if (d->radius > 0) { - generateRoundedRect(); - offset = d->radius + pw+1.5; - } else { - generateBorderedRect(); - offset = pw+1.5; - } - - QGLShaderProgram *shader = p.useTextureShader(); - - float texWidth = d->rectTexture->width(); - float texHeight = d->rectTexture->height(); - if (!texWidth || !texHeight) - return; - - float widthV = qreal(width())+pw/2; - float heightV = qreal(height())+pw/2; - - float xOffset = offset; - bool xMiddles = true; - if (xOffset*2 > width()+pw) { - xMiddles = false; - xOffset = (width()+pw)/2; - } - float yOffset = offset; - bool yMiddles = true; - if (yOffset*2 > height()+pw) { - yMiddles = false; - yOffset = (height()+pw)/2; - } - - float texleft = xOffset / texWidth; - float imgleft = xOffset-pw/2; - float texright = (texWidth-xOffset) / texWidth; - float imgright = widthV - xOffset; - - float textop = yOffset / texHeight; - float imgtop = yOffset-pw/2; - float texbottom = (texHeight-yOffset) / texHeight; - float imgbottom = heightV - yOffset; - - //Bug 231768: Inappropriate interpolation was occuring on 3x3 textures - if (offset==1) - texleft=texright=textop=texbottom=0.5; - - texleft *= d->rectTexture->glWidth(); - texright *= d->rectTexture->glWidth(); - textop *= d->rectTexture->glHeight(); - texbottom *= d->rectTexture->glHeight(); - - float vert1[] = { -pw/2, -pw/2, - -pw/2, imgtop, - imgleft, -pw/2, - - -pw/2, imgtop, - imgleft, -pw/2, - imgleft, imgtop, - - imgleft, -pw/2, - imgleft, imgtop, - imgright, -pw/2, - - imgleft, imgtop, - imgright, -pw/2, - imgright, imgtop, - - imgright, -pw/2, - imgright, imgtop, - widthV, -pw/2, - - imgright, imgtop, - widthV, -pw/2, - widthV, imgtop, - - -pw/2, heightV, - -pw/2, imgbottom, - imgleft, heightV, - - -pw/2, imgbottom, - imgleft, heightV, - imgleft, imgbottom, - - imgleft, heightV, - imgleft, imgbottom, - imgright, heightV, - - imgleft, imgbottom, - imgright, heightV, - imgright, imgbottom, - - imgright, heightV, - imgright, imgbottom, - widthV, heightV, - - imgright, imgbottom, - widthV, heightV, - widthV, imgbottom, - - -pw/2, imgtop, - -pw/2, imgbottom, - imgleft, imgtop, - - -pw/2, imgbottom, - imgleft, imgtop, - imgleft, imgbottom, - - imgleft, imgtop, - imgleft, imgbottom, - imgright, imgtop, - - imgleft, imgbottom, - imgright, imgtop, - imgright, imgbottom, - - imgright, imgtop, - imgright, imgbottom, - widthV, imgtop, - - imgright, imgbottom, - widthV, imgtop, - widthV, imgbottom }; - - - float tex1[] = { 0, 0, - 0, textop, - texleft, 0, - - 0, textop, - texleft, 0, - texleft, textop, - - texleft, 0, - texleft, textop, - texright, 0, - - texleft, textop, - texright, 0, - texright, textop, - - texright, 0, - texright, textop, - d->rectTexture->glWidth(), 0, - - texright, textop, - d->rectTexture->glWidth(), 0, - d->rectTexture->glWidth(), textop, - - 0, d->rectTexture->glHeight(), - 0, texbottom, - texleft, d->rectTexture->glHeight(), - - 0, texbottom, - texleft, d->rectTexture->glHeight(), - texleft, texbottom, - - texleft, d->rectTexture->glHeight(), - texleft, texbottom, - texright, d->rectTexture->glHeight(), - - texleft, texbottom, - texright, d->rectTexture->glHeight(), - texright, texbottom, - - texright, d->rectTexture->glHeight(), - texright, texbottom, - d->rectTexture->glWidth(), d->rectTexture->glHeight(), - - texright, texbottom, - d->rectTexture->glWidth(), d->rectTexture->glHeight(), - d->rectTexture->glWidth(), texbottom, - - 0, textop, - 0, texbottom, - texleft, textop, - - 0, texbottom, - texleft, textop, - texleft, texbottom, - - texleft, textop, - texleft, texbottom, - texright, textop, - - texleft, texbottom, - texright, textop, - texright, texbottom, - - texright, textop, - texright, texbottom, - d->rectTexture->glWidth(), textop, - - texright, texbottom, - d->rectTexture->glWidth(), textop, - d->rectTexture->glWidth(), texbottom }; - - - - glBindTexture(GL_TEXTURE_2D, d->rectTexture->texture()); - - shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2); - glDrawArrays(GL_TRIANGLES, 0, 36 + (yMiddles?18:0)); - } -} -#endif QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index c279a1c..d232328 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -160,13 +160,7 @@ public: void setRadius(qreal radius); virtual void dump(int depth); -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &painter); -#endif - -#if defined(QFX_RENDER_OPENGL) - void paintGLContents(GLPainter &); -#endif private Q_SLOTS: void doUpdate(); diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h index 23bb944..3544d36 100644 --- a/src/declarative/fx/qfxrect_p.h +++ b/src/declarative/fx/qfxrect_p.h @@ -55,10 +55,6 @@ #include "qfxitem_p.h" -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_NAMESPACE class QFxGradient; @@ -69,9 +65,6 @@ class QFxRectPrivate : public QFxItemPrivate public: QFxRectPrivate() : -#if defined(QFX_RENDER_OPENGL) - rectTexture(0), -#endif //QFX_RENDER_OPENGL color(Qt::white), gradient(0), pen(0), radius(0) { } @@ -85,9 +78,6 @@ public: { } -#if defined(QFX_RENDER_OPENGL) - QSimpleCanvasItem::CachedTexture *rectTexture; -#endif QColor getColor(); QColor color; QFxGradient *gradient; diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 031c0f8..a5361e1 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -44,10 +44,6 @@ #include -#if defined(QFX_RENDER_OPENGL2) -#include "glbasicshaders.h" -#endif - #include #include #include @@ -695,14 +691,9 @@ void QFxTextPrivate::checkImgCache() break; } -#if defined(QFX_RENDER_OPENGL) - tex.setImage(imgCache.toImage(), GLTexture::PowerOfTwo); -#endif - imgDirty = false; } -#if defined(QFX_RENDER_QPAINTER) void QFxText::paintContents(QPainter &p) { Q_D(QFxText); @@ -752,85 +743,6 @@ void QFxText::paintContents(QPainter &p) p.restore(); } -#elif defined(QFX_RENDER_OPENGL2) -void QFxText::paintGLContents(GLPainter &p) -{ - //return; - Q_D(QFxText); - d->checkImgCache(); - if (d->imgCache.isNull()) - return; - - int w = width(); - int h = height(); - - float x = 0; - float y = 0; - - switch (d->hAlign) { - case AlignLeft: - x = 0; - break; - case AlignRight: - x = w - d->imgCache.width(); - break; - case AlignHCenter: - x = (w - d->imgCache.width()) / 2; - break; - } - - switch (d->vAlign) { - case AlignTop: - y = 0; - break; - case AlignBottom: - y = h - d->imgCache.height(); - break; - case AlignVCenter: - y = (h - d->imgCache.height()) / 2; - break; - } - - float widthV = d->imgCache.width(); - float heightV = d->imgCache.height(); - float glWidth = d->tex.glWidth(); - float glHeight = d->tex.glHeight(); - - QGLShaderProgram *shader = p.useTextureShader(); - - float deltaX = 0.5 / qreal(d->tex.glSize().width()); - float deltaY = 0.5 / qreal(d->tex.glSize().height()); - glWidth -= deltaX; - glHeight -= deltaY; - - GLfloat vertices[] = { x, y + heightV, - x + widthV, y + heightV, - x, y, - - x + widthV, y + heightV, - x, y, - x + widthV, y }; - - GLfloat texVertices[] = { deltaX, deltaY, - glWidth, deltaY, - deltaX, glHeight, - - glWidth, deltaY, - deltaX, glHeight, - glWidth, glHeight }; - - shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - glDrawArrays(GL_TRIANGLES, 0, 6); - - shader->disableAttributeArray(SingleTextureShader::Vertices); - shader->disableAttributeArray(SingleTextureShader::TextureCoords); -} - -#endif - void QFxText::componentComplete() { Q_D(QFxText); diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index 99ab2be..35e8b03 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -117,11 +117,7 @@ public: virtual void dump(int depth); virtual QString propertyInfo() const; -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &p); -#elif defined(QFX_RENDER_OPENGL) - void paintGLContents(GLPainter &); -#endif virtual void componentComplete(); diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h index dfaef63..e0b1909 100644 --- a/src/declarative/fx/qfxtext_p.h +++ b/src/declarative/fx/qfxtext_p.h @@ -58,10 +58,6 @@ #include "qml.h" #include -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_NAMESPACE class QTextLayout; @@ -115,9 +111,6 @@ public: QColor styleColor; QString activeLink; bool imgDirty; -#if defined(QFX_RENDER_OPENGL) - GLTexture tex; -#endif QPixmap imgCache; QPixmap imgStyleCache; QFxText::HAlignment hAlign; diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 5f2f36c..3c117ee 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -44,10 +44,6 @@ #include -#if defined(QFX_RENDER_OPENGL2) -#include "glbasicshaders.h" -#endif - #include #include "qfxevents_p.h" #include diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index f733a4c..403bd18 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -86,9 +86,6 @@ public: QString style; QColor styleColor; bool imgDirty; -#if defined(QFX_RENDER_OPENGL) - GLTexture texture; -#endif QPixmap imgCache; QPixmap imgStyleCache; QFxTextEdit::HAlignment hAlign; diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index a4c5d22..8d9084f 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -254,7 +254,6 @@ bool QFxRotation::isIdentity() const return (_angle == 0.); } -#if defined(QFX_RENDER_QPAINTER) QTransform QFxRotation::transform() const { if (_dirty) { @@ -266,19 +265,6 @@ QTransform QFxRotation::transform() const } return _transform; } -#elif defined(QFX_RENDER_OPENGL) -QMatrix4x4 QFxRotation::transform() const -{ - if (_dirty) { - _transform = QMatrix4x4(); - _dirty = false; - _transform.translate(_originX, _originY); - _transform.rotate(_angle, 0, 0, 1); - _transform.translate(-_originX, -_originY); - } - return _transform; -} -#endif void QFxRotation::update() { @@ -351,7 +337,6 @@ bool QFxRotation3D::isIdentity() const return (_angle == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX()); } -#if defined(QFX_RENDER_QPAINTER) const qreal inv_dist_to_plane = 1. / 1024.; QTransform QFxRotation3D::transform() const { @@ -396,29 +381,6 @@ QTransform QFxRotation3D::transform() const return _transform; } -#elif defined(QFX_RENDER_OPENGL) -QMatrix4x4 QFxRotation3D::transform() const -{ - if (_dirty) { - _dirty = false; - _transform = QMatrix4x4(); - - if (!isIdentity()) { - if (angle() != 0.) { - qreal x = _axis.endX() - _axis.startX(); - qreal y = _axis.endY() - _axis.startY(); - qreal z = _axis.endZ(); - - _transform.translate(_axis.startX(), _axis.startY(), 0); - _transform.rotate(angle(), x, y, z); - _transform.translate(-_axis.startX(), -_axis.startY(), 0); - } - } - } - - return _transform; -} -#endif void QFxRotation3D::update() { @@ -506,7 +468,6 @@ bool QFxTranslation3D::isIdentity() const return (_distance == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX()); } -#if defined(QFX_RENDER_QPAINTER) QTransform QFxTranslation3D::transform() const { if (_dirty) { @@ -526,35 +487,14 @@ QTransform QFxTranslation3D::transform() const return _transform; } -#elif defined(QFX_RENDER_OPENGL) -QMatrix4x4 QFxTranslation3D::transform() const -{ - if (_dirty) { - _dirty = false; - _transform = QMatrix4x4(); - - if (!isIdentity()) { - if (distance() != 0.) - _transform.translate((_axis.endX() - _axis.startX()) * distance(), - (_axis.endY() - _axis.startY()) * distance(), - (_axis.endZ()) * distance()); - - } - } - - return _transform; -} -#endif void QFxTranslation3D::update() { _dirty = true; -#if !defined(QFX_RENDER_OPENGL) if (_axis.endZ() != 0. && distance() != 0.) { qmlInfo(this) << "QTransform cannot translate along Z-axis."; } -#endif QFxTransform::update(); } @@ -579,24 +519,6 @@ QFxPerspective::~QFxPerspective() { } -#if defined(QFX_RENDER_OPENGL) -bool QFxPerspective::isIdentity() const -{ - return false; -} - -QMatrix4x4 QFxPerspective::transform() const -{ - QMatrix4x4 rv; - rv.translate(_x, _y); - rv.perspective(_angle, _aspect, 1, 1024 * 1024); - rv.translate(-_x, -_y, -1); - rv.scale(1, 1, 1. / _scale); - - return rv; -} -#endif - /*! \qmlproperty real Perspective::angle */ @@ -863,7 +785,6 @@ bool QFxSquish::isIdentity() const return false; } -#if defined(QFX_RENDER_QPAINTER) QTransform QFxSquish::transform() const { QPolygonF poly; @@ -875,21 +796,5 @@ QTransform QFxSquish::transform() const QTransform::quadToQuad(poly, poly2, t); return t; } -#elif defined(QFX_RENDER_OPENGL) -QMatrix4x4 QFxSquish::transform() const -{ - QPolygonF poly; - poly << p << QPointF(p.x() + s.width(), p.y()) << QPointF(p.x() + s.width(), p.y() + s.height()) << QPointF(p.x(), p.y() + s.height()); - QPolygonF poly2; - poly2 << p1 << p2 << p4 << p3; - - QTransform t; - QMatrix4x4 rv; - if (QTransform::quadToQuad(poly, poly2, t)) - rv = QMatrix4x4(t); - - return rv; -} -#endif QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h index 7be8adc..0a17917 100644 --- a/src/declarative/fx/qfxtransform.h +++ b/src/declarative/fx/qfxtransform.h @@ -44,9 +44,6 @@ #include #include -#if defined(QFX_RENDER_OPENGL) -#include -#endif #include QT_BEGIN_HEADER @@ -233,10 +230,6 @@ public: qreal scale() const { return _scale; } void setScale(qreal v) { _scale = v; update(); } -#if defined(QFX_RENDER_OPENGL) - virtual bool isIdentity() const; - virtual QMatrix4x4 transform() const; -#endif private: qreal _scale; qreal _x; diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index dc7f60e..91579e9 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -58,16 +58,7 @@ #include "qsimplecanvas.h" #include "qlistmodelinterface.h" -#if defined(QFX_RENDER_OPENGL2) -#include -#include -#endif -#if defined(QFX_RENDER_OPENGL) -#include -#endif - #include "qfxwebview.h" -#include #include QT_BEGIN_NAMESPACE @@ -160,11 +151,7 @@ public: ~ImageCacheItem() { } int age; QRect area; -#if defined(QFX_RENDER_QPAINTER) QPixmap image; -#else - GLTexture image; -#endif }; QList imagecache; void dirtyCache(const QRect& dirt) diff --git a/src/declarative/opengl/glbasicshaders.cpp b/src/declarative/opengl/glbasicshaders.cpp deleted file mode 100644 index 7c1d730..0000000 --- a/src/declarative/opengl/glbasicshaders.cpp +++ /dev/null @@ -1,707 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "glbasicshaders.h" -#include -#include - - -QT_BEGIN_NAMESPACE -SingleTextureVertexOpacityShader::SingleTextureVertexOpacityShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute lowp float myOpacity;\ - attribute mediump vec4 myUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - varying lowp float myFragOpacity;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - myFragOpacity = myOpacity;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - varying mediump vec2 myTexCoord;\ - varying lowp float myFragOpacity;\ - void main(void)\ - {\ - mediump vec4 frag = texture2D(sampler2d,myTexCoord);\ - gl_FragColor = vec4(frag.rgb, frag.a * myFragOpacity);\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); - bindAttributeLocation("myOpacity", OpacityCoords); -} - -bool SingleTextureVertexOpacityShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - enable(); - setUniformValue("sampler2d", 0); - disable(); - return true; -} - -void SingleTextureVertexOpacityShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -BlurTextureShader::BlurTextureShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - }" - ); - -#if 0 - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform bool horizontal; \ - uniform mediump float blurStep; \ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - mediump vec4 accum = vec4(0, 0, 0, 0); \ - mediump vec2 offset; \ - if (horizontal) \ - offset = vec2(blurStep, 0); \ - else \ - offset = vec2(0, blurStep); \ - accum += texture2D(sampler2d, myTexCoord + 2.0 * offset); \ - accum += 2.0 * texture2D(sampler2d, myTexCoord + 1.0 * offset); \ - accum += 4.0 * texture2D(sampler2d, myTexCoord + 0.0 * offset); \ - accum += 2.0 * texture2D(sampler2d, myTexCoord - 1.0 * offset); \ - accum += texture2D(sampler2d, myTexCoord - 2.0 * offset); \ - gl_FragColor = accum / 10.0; \ - }" - ); -#else - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform bool horizontal; \ - uniform mediump float blurStep; \ - uniform int blurSteps; \ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - mediump vec4 accum = vec4(0, 0, 0, 0); \ - mediump vec2 offset; \ - if (horizontal) \ - offset = vec2(blurStep, 0); \ - else \ - offset = vec2(0, blurStep); \ - mediump float sum = 0.0; \ - for (int ii = 0; ii < blurSteps; ++ii) { \ - mediump float frac = float(blurSteps - ii) / float(blurSteps); \ - mediump vec2 coord = myTexCoord + -float(ii) * offset; \ - if (coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \ - accum += texture2D(sampler2d, coord) * frac; \ - sum += frac; \ - } \ - for (int ii = 1; ii < blurSteps; ++ii) { \ - mediump float frac = float(blurSteps - ii) / float(blurSteps); \ - mediump vec2 coord = myTexCoord + float(ii) * offset; \ - if (coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \ - accum += texture2D(sampler2d, coord) * frac; \ - sum += frac; \ - } \ - gl_FragColor = accum / sum; \ - }" - ); -#endif - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); -} - -bool BlurTextureShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - mode = uniformLocation("horizontal"); - step = uniformLocation("blurStep"); - steps = uniformLocation("blurSteps"); - enable(); - setUniformValue("sampler2d", 0); - disable(); - return true; -} - -void BlurTextureShader::setStep(float f) -{ - setUniformValue(step, f); -} - -void BlurTextureShader::setSteps(int s) -{ - setUniformValue(steps, s); -} - -void BlurTextureShader::setMode(Mode m) -{ - if (m == Horizontal) - setUniformValue(mode, 1); - else - setUniformValue(mode, 0); -} - -void BlurTextureShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -DualTextureBlendShader::DualTextureBlendShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - attribute mediump vec4 myBlendUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - varying mediump vec2 myBlendTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - myBlendTexCoord = myBlendUV.st;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform sampler2D sampler2dBlend;\ - uniform lowp float myOpacity;\ - uniform lowp float myBlend; \ - varying mediump vec2 myTexCoord;\ - varying mediump vec2 myBlendTexCoord;\ - void main(void)\ - {\ - mediump vec4 tex = texture2D(sampler2d,myTexCoord);\ - mediump vec4 blendtex = texture2D(sampler2dBlend, myBlendTexCoord);\ - gl_FragColor = mix(tex, blendtex, myBlend) * myOpacity; \ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); - bindAttributeLocation("myBlendUV", BlendTextureCoords); -} - -bool DualTextureBlendShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - opacity = uniformLocation("myOpacity"); - blend = uniformLocation("myBlend"); - enable(); - setUniformValue("sampler2d", 0); - setUniformValue("sampler2dBlend", 1); - disable(); - return true; -} - -void DualTextureBlendShader::setOpacity(GLfloat o) -{ - setUniformValue(opacity, o); -} - -void DualTextureBlendShader::setBlend(GLfloat b) -{ - setUniformValue(blend, b); -} - -void DualTextureBlendShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -DualTextureAddShader::DualTextureAddShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - attribute mediump vec4 myAddUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - varying mediump vec2 myAddTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - myAddTexCoord = myAddUV.st;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform sampler2D sampler2dAdd;\ - uniform lowp float myOpacity;\ - varying mediump vec2 myTexCoord;\ - varying mediump vec2 myAddTexCoord;\ - void main(void)\ - {\ - mediump vec4 tex = texture2D(sampler2d,myTexCoord);\ - mediump vec4 addtex = texture2D(sampler2dAdd, myAddTexCoord);\ - tex = tex + vec4(addtex.rgb * addtex.a * tex.a, 0); \ - tex = min(tex, vec4(1, 1, 1, 1)); \ - gl_FragColor = vec4(tex.rgb, tex.a) * myOpacity;\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); - bindAttributeLocation("myAddUV", AddTextureCoords); -} - -void DualTextureAddShader::setOpacity(GLfloat f) -{ - setUniformValue(opacity, f); -} - -void DualTextureAddShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -bool DualTextureAddShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - opacity = uniformLocation("myOpacity"); - enable(); - setUniformValue("sampler2d", 0); - setUniformValue("sampler2dAdd", 1); - disable(); - return true; -} - -SingleTextureShader::SingleTextureShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - gl_FragColor = texture2D(sampler2d,myTexCoord);\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); -} - -bool SingleTextureShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - enable(); - setUniformValue("sampler2d", 0); - disable(); - return true; -} - -void SingleTextureShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -ConstantColorShader::ConstantColorShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - uniform mediump mat4 myPMVMatrix;\ - attribute highp vec4 myVertex;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex; \ - }" - ); - - frag.compile("\ - uniform lowp vec4 myColor;\ - void main(void)\ - {\ - gl_FragColor = myColor;\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); -} - -void ConstantColorShader::setColor(const QColor &c) -{ - setUniformValue(color, c); -} - -void ConstantColorShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -bool ConstantColorShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - color = uniformLocation("myColor"); - return true; -} - -ColorShader::ColorShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - uniform mediump mat4 myPMVMatrix;\ - attribute highp vec4 myVertex;\ - attribute lowp vec4 myColors;\ - varying lowp vec4 myColor;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex; \ - myColor = myColors; \ - }" - ); - - frag.compile("\ - varying lowp vec4 myColor;\ - void main(void)\ - {\ - gl_FragColor = myColor;\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myColors", Colors); -} - -void ColorShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -bool ColorShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - return true; -} - -class GLBasicShadersPrivate -{ -public: - GLBasicShadersPrivate(); - ~GLBasicShadersPrivate(); - - BlurTextureShader *blurTexture; - SingleTextureShader *singleTexture; - SingleTextureOpacityShader *singleTextureOpacity; - DualTextureAddShader *dualTextureAdd; - SingleTextureShadowShader *singleTextureShadow; - SingleTextureVertexOpacityShader *singleTextureVertexOpacity; - ConstantColorShader *constantColor; - ColorShader *color; -}; - -GLBasicShadersPrivate::GLBasicShadersPrivate() -: blurTexture(0), singleTexture(0), singleTextureOpacity(0), - dualTextureAdd(0), singleTextureShadow(0), singleTextureVertexOpacity(0), - constantColor(0), color(0) -{ -} - -GLBasicShadersPrivate::~GLBasicShadersPrivate() -{ - delete blurTexture; - delete singleTexture; - delete singleTextureOpacity; - delete dualTextureAdd; - delete singleTextureVertexOpacity; - delete singleTextureShadow; - delete constantColor; - delete color; -} - -GLBasicShaders::GLBasicShaders() -: d(new GLBasicShadersPrivate) -{ -} - -GLBasicShaders::~GLBasicShaders() -{ - delete d; -} - -BlurTextureShader *GLBasicShaders::blurTexture() -{ - if (!d->blurTexture) d->blurTexture = new BlurTextureShader(); - return d->blurTexture; -} - -SingleTextureShader *GLBasicShaders::singleTexture() -{ - if (!d->singleTexture) d->singleTexture = new SingleTextureShader(); - return d->singleTexture; -} - -SingleTextureOpacityShader *GLBasicShaders::singleTextureOpacity() -{ - if (!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader(); - return d->singleTextureOpacity; -} - -DualTextureAddShader *GLBasicShaders::dualTextureAdd() -{ - if (!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader(); - return d->dualTextureAdd; -} - -SingleTextureVertexOpacityShader *GLBasicShaders::singleTextureVertexOpacity() -{ - if (!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader(); - return d->singleTextureVertexOpacity; -} - -SingleTextureShadowShader *GLBasicShaders::singleTextureShadow() -{ - if (!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader(); - return d->singleTextureShadow; -} - -ConstantColorShader *GLBasicShaders::constantColor() -{ - if (!d->constantColor) d->constantColor = new ConstantColorShader(); - return d->constantColor; -} - -ColorShader *GLBasicShaders::color() -{ - if (!d->color) d->color = new ColorShader(); - return d->color; -} - -SingleTextureOpacityShader::SingleTextureOpacityShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform lowp float myOpacity;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - mediump vec4 tex = texture2D(sampler2d,myTexCoord);\ - gl_FragColor = vec4(tex.rgb, myOpacity * tex.a);\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); -} - -bool SingleTextureOpacityShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - opacity = uniformLocation("myOpacity"); - enable(); - setUniformValue("sampler2d", 0); - disable(); - return true; -} - -void SingleTextureOpacityShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -void SingleTextureOpacityShader::setOpacity(GLfloat f) -{ - setUniformValue(opacity, f); -} - -SingleTextureShadowShader::SingleTextureShadowShader() -{ - QGLShader vert(QGLShader::VertexShader); - QGLShader frag(QGLShader::FragmentShader); - - vert.compile("\ - attribute highp vec4 myVertex;\ - attribute mediump vec4 myUV;\ - uniform mediump mat4 myPMVMatrix;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - gl_Position = myPMVMatrix * myVertex;\ - myTexCoord = myUV.st;\ - }" - ); - - frag.compile("\ - uniform sampler2D sampler2d;\ - uniform lowp float myOpacity;\ - varying mediump vec2 myTexCoord;\ - void main(void)\ - {\ - mediump vec4 tex = texture2D(sampler2d,myTexCoord);\ - gl_FragColor = vec4(0, 0, 0, myOpacity * tex.a * .75);\ - }" - ); - - addShader(&vert); - addShader(&frag); - - bindAttributeLocation("myVertex", Vertices); - bindAttributeLocation("myUV", TextureCoords); -} - -bool SingleTextureShadowShader::link() -{ - if (!QGLShaderProgram::link()) - return false; - transform = uniformLocation("myPMVMatrix"); - opacity = uniformLocation("myOpacity"); - enable(); - setUniformValue("sampler2d", 0); - disable(); - return true; -} - -void SingleTextureShadowShader::setTransform(const QMatrix4x4 &matrix) -{ - setUniformValue(transform, matrix); -} - -void SingleTextureShadowShader::setOpacity(GLfloat f) -{ - setUniformValue(opacity, f); -} -QT_END_NAMESPACE diff --git a/src/declarative/opengl/glbasicshaders.h b/src/declarative/opengl/glbasicshaders.h deleted file mode 100644 index 7d358d8..0000000 --- a/src/declarative/opengl/glbasicshaders.h +++ /dev/null @@ -1,244 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _GLBASICSHADERS_H_ -#define _GLBASICSHADERS_H_ - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class BlurTextureShader : public QGLShaderProgram -{ - Q_OBJECT -public: - BlurTextureShader(); - - enum { Vertices = 0, - TextureCoords = 1 }; - - enum Mode { Horizontal, Vertical }; - void setMode(Mode); - void setStep(float); - void setSteps(int); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint mode; - GLint step; - GLint steps; - GLint transform; -}; - -class SingleTextureShader : public QGLShaderProgram -{ - Q_OBJECT -public: - SingleTextureShader(); - - enum { Vertices = 0, - TextureCoords = 1 }; - - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; -}; - -class DualTextureBlendShader : public QGLShaderProgram -{ - Q_OBJECT -public: - DualTextureBlendShader(); - enum { Vertices = 0, - TextureCoords = 1, - BlendTextureCoords = 2 }; - - void setOpacity(GLfloat); - void setBlend(GLfloat); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; - GLint opacity; - GLint blend; -}; - -class DualTextureAddShader : public QGLShaderProgram -{ - Q_OBJECT -public: - DualTextureAddShader(); - enum { Vertices = 0, - TextureCoords = 1, - AddTextureCoords = 2 }; - - void setOpacity(GLfloat); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; - GLint opacity; -}; - -class SingleTextureOpacityShader : public QGLShaderProgram -{ - Q_OBJECT -public: - SingleTextureOpacityShader(); - - enum { Vertices = 0, - TextureCoords = 1 }; - - void setOpacity(GLfloat); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; - GLint opacity; -}; - -class SingleTextureVertexOpacityShader : public QGLShaderProgram -{ - Q_OBJECT -public: - SingleTextureVertexOpacityShader(); - - enum { Vertices = 0, - TextureCoords = 1, - OpacityCoords = 2 }; - - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; -}; - - -class SingleTextureShadowShader : public QGLShaderProgram -{ - Q_OBJECT -public: - SingleTextureShadowShader(); - - enum { Vertices = 0, - TextureCoords = 1 }; - - void setOpacity(GLfloat); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; - GLint opacity; -}; - - -class QColor; -class ConstantColorShader : public QGLShaderProgram -{ - Q_OBJECT -public: - ConstantColorShader(); - - enum { Vertices = 0 }; - - void setColor(const QColor &); - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; - GLint color; -}; - -class ColorShader : public QGLShaderProgram -{ - Q_OBJECT -public: - ColorShader(); - - enum { Vertices = 0, Colors = 1 }; - - void setTransform(const QMatrix4x4 &); - virtual bool link(); - -private: - GLint transform; -}; - -class GLBasicShadersPrivate; -class GLBasicShaders -{ -public: - GLBasicShaders(); - virtual ~GLBasicShaders(); - - BlurTextureShader *blurTexture(); - SingleTextureShader *singleTexture(); - SingleTextureOpacityShader *singleTextureOpacity(); - DualTextureAddShader *dualTextureAdd(); - SingleTextureVertexOpacityShader *singleTextureVertexOpacity(); - SingleTextureShadowShader *singleTextureShadow(); - ConstantColorShader *constantColor(); - ColorShader *color(); - -private: - GLBasicShadersPrivate *d; -}; - -#endif // _GLBASICSHADERS_H_ - - -QT_END_NAMESPACE - -QT_END_HEADER diff --git a/src/declarative/opengl/glheaders.h b/src/declarative/opengl/glheaders.h deleted file mode 100644 index fd1da18..0000000 --- a/src/declarative/opengl/glheaders.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _GLHEADERS_H_ -#define _GLHEADERS_H_ - -#include -#define GL_GLEXT_PROTOTYPES 1 -#include - -#endif // _GLHEADERS_H_ diff --git a/src/declarative/opengl/glsave.cpp b/src/declarative/opengl/glsave.cpp deleted file mode 100644 index 125e81b..0000000 --- a/src/declarative/opengl/glsave.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "glsave.h" diff --git a/src/declarative/opengl/glsave.h b/src/declarative/opengl/glsave.h deleted file mode 100644 index ad6c0ec..0000000 --- a/src/declarative/opengl/glsave.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _GLSAVE_H_ -#define _GLSAVE_H_ - -#include -#include -#include -#include "glheaders.h" - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class GLSaveViewport -{ -public: - GLSaveViewport() - { - glGetIntegerv(GL_VIEWPORT, viewport); - } - - ~GLSaveViewport() - { - glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); - } - -private: - Q_DISABLE_COPY(GLSaveViewport) - GLint viewport[4]; -}; - -class GLSaveScissor -{ -public: - GLSaveScissor() - { - enabled = glIsEnabled(GL_SCISSOR_TEST); - glGetIntegerv(GL_SCISSOR_BOX, box); - } - - ~GLSaveScissor() - { - if (enabled) - glEnable(GL_SCISSOR_TEST); - else - glDisable(GL_SCISSOR_TEST); - glScissor(box[0], box[1], box[2], box[3]); - } - - bool wasEnabled() const - { - return enabled == GL_TRUE; - } - - QRect rect() const - { - return QRect(box[0], box[1], box[2], box[3]); - } - -private: - Q_DISABLE_COPY(GLSaveScissor) - GLint box[4]; - GLboolean enabled; -}; - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // _GLSAVE_H_ diff --git a/src/declarative/opengl/gltexture.cpp b/src/declarative/opengl/gltexture.cpp deleted file mode 100644 index c2a02df..0000000 --- a/src/declarative/opengl/gltexture.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "gltexture.h" -#include - - -QT_BEGIN_NAMESPACE -/*! - \internal - \class GLTexture - \brief The GLTexture class simplifies the use of OpenGL textures. -*/ - -// Copied from QGLWidget::convertToGLFormat -static QImage QGLWidget_convertToGLFormat(const QImage& img) -{ - QImage res = img.convertToFormat(QImage::Format_ARGB32); - res = res.mirrored(); - - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - // Qt has ARGB; OpenGL wants RGBA - for (int i=0; i < res.height(); i++) { - uint *p = (uint*)res.scanLine(i); - uint *end = p + res.width(); - while (p < end) { - *p = (*p << 8) | ((*p >> 24) & 0xFF); - p++; - } - } - } - else { - // Qt has ARGB; OpenGL wants ABGR (i.e. RGBA backwards) - res = res.rgbSwapped(); - } - return res; -} -class GLTexturePrivate -{ -public: - GLTexturePrivate(GLTexture *_q) - : q(_q), texture(0), width(0), height(0), - horizWrap(GLTexture::Repeat), vertWrap(GLTexture::Repeat), - minFilter(GLTexture::Linear), magFilter(GLTexture::Linear), - glWidth(1.), glHeight(1.) - { - } - - GLTexture *q; - GLuint texture; - int width; - int height; - GLTexture::WrapMode horizWrap; - GLTexture::WrapMode vertWrap; - GLTexture::FilterMode minFilter; - GLTexture::FilterMode magFilter; - - qreal glWidth; - qreal glHeight; - QSize glSize; - - void genTexture(); -}; - -void GLTexturePrivate::genTexture() -{ - if (texture) - return; - - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); - q->setHorizontalWrap(horizWrap); - q->setVerticalWrap(vertWrap); -} - -GLTexture::GLTexture() -: d(new GLTexturePrivate(this)) -{ -} - -GLTexture::GLTexture(const QString &file) -: d(new GLTexturePrivate(this)) -{ - QImage img(file); - if (!img.isNull()) - setImage(img); -} - -GLTexture::GLTexture(const QImage &img) -: d(new GLTexturePrivate(this)) -{ - setImage(img); -} - -GLTexture::~GLTexture() -{ - if (d->texture) - glDeleteTextures(1, &d->texture); - delete d; - d = 0; -} - -bool GLTexture::isNull() const -{ - return d->texture == 0; -} - -void GLTexture::clear() -{ - if (d->texture) { - glDeleteTextures(1, &d->texture); - d->texture = 0; - d->width = 0; - d->height = 0; - } -} - -static inline int npot(int size) -{ - size--; - size |= size >> 1; - size |= size >> 2; - size |= size >> 4; - size |= size >> 8; - size |= size >> 16; - size++; - return size; -} - -/*! - Set the texture to \a img. If the texture has already been created (either - by explicitly setting the size, or by previously setting an image), it will - be destroyed and a new texture created with \a img's contents and size. - */ -void GLTexture::setImage(const QImage &img, ImageMode mode) -{ - if (img.isNull()) - return; - - d->genTexture(); - - glBindTexture(GL_TEXTURE_2D, d->texture); - - if (mode == NonPowerOfTwo) { - - if (img.format() == QImage::Format_RGB16) { - QImage dataImage = img.mirrored(); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dataImage.width(), - dataImage.height(), 0, - GL_RGB, - GL_UNSIGNED_SHORT_5_6_5, dataImage.bits()); - } else { - QImage dataImage = QGLWidget_convertToGLFormat(img); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dataImage.width(), - dataImage.height(), 0, - (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB, - GL_UNSIGNED_BYTE, dataImage.bits()); - } - d->glWidth = 1.; - d->glHeight = 1.; - d->glSize = img.size(); - - } else { - // mode == PowerOfTwo - int max = (img.width() > img.height())?img.width():img.height(); - max = npot(max); - - if (img.format() == QImage::Format_RGB16) { - QImage dataImage = img.mirrored(); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, max, - max, 0, - GL_RGB, - GL_UNSIGNED_SHORT_5_6_5, 0); - - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dataImage.width(), - dataImage.height(), GL_RGB, GL_UNSIGNED_SHORT_5_6_5, - dataImage.bits()); - - } else { - QImage dataImage = QGLWidget_convertToGLFormat(img); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, max, - max, 0, - (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB, - GL_UNSIGNED_BYTE, 0); - - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dataImage.width(), - dataImage.height(), - (dataImage.format() == QImage::Format_ARGB32)?GL_RGBA:GL_RGB, - GL_UNSIGNED_BYTE, dataImage.bits()); - } - - d->glWidth = qreal(img.width()) / qreal(max); - d->glHeight = qreal(img.height()) / qreal(max); - d->glSize = QSize(max, max); - } - - d->width = img.width(); - d->height = img.height(); -} - -void GLTexture::copyImage(const QImage &img, const QPoint &point, - const QRect &srcRect) -{ - qFatal("Not implemented"); - Q_UNUSED(img); - Q_UNUSED(point); - Q_UNUSED(srcRect); -} - -QSize GLTexture::size() const -{ - return QSize(d->width, d->height); -} - -int GLTexture::width() const -{ - return d->width; -} - -int GLTexture::height() const -{ - return d->height; -} - -qreal GLTexture::glWidth() const -{ - return d->glWidth; -} - -qreal GLTexture::glHeight() const -{ - return d->glHeight; -} - -QSize GLTexture::glSize() const -{ - return d->glSize; -} - -/*! - Sets the \a size of the texture. This will destroy the current contents of - the texture. If an image has been assigned, it will need to be reassigned - using either setImage() or copyImage(). - - If size is invalid (width or height is less than or equal to 0) the texture - will be destroyed. This is equivalent to calling clear(). -*/ -void GLTexture::setSize(const QSize &size) -{ - if (size.width() <= 0 || size.height() <= 0) { - clear(); - return; - } - - d->genTexture(); - glBindTexture(GL_TEXTURE_2D, d->texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - d->width = size.width(); - d->height = size.height(); -} - -GLTexture::WrapMode GLTexture::horizontalWrap() const -{ - return d->horizWrap; -} - -GLTexture::WrapMode GLTexture::verticalWrap() const -{ - return d->vertWrap; -} - -void GLTexture::setHorizontalWrap(WrapMode mode) -{ - d->horizWrap = mode; - if (d->texture) { - GLint last; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &last); - if (GLuint(last) != d->texture) - glBindTexture(GL_TEXTURE_2D, d->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, mode); - if (GLuint(last) != d->texture) - glBindTexture(GL_TEXTURE_2D, last); - } -} - -/*! - Set the veritcal wrap mode to \a mode. - */ -void GLTexture::setVerticalWrap(WrapMode mode) -{ - d->vertWrap = mode; - if (d->texture) { - GLint last; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &last); - if (GLuint(last) != d->texture) - glBindTexture(GL_TEXTURE_2D, d->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode); - if (GLuint(last) != d->texture) - glBindTexture(GL_TEXTURE_2D, last); - } -} - -GLTexture::FilterMode GLTexture::minFilter() const -{ - return d->minFilter; -} - -GLTexture::FilterMode GLTexture::magFilter() const -{ - return d->magFilter; -} - -void GLTexture::setMinFilter(FilterMode f) -{ - if (d->minFilter == f) - return; - d->minFilter = f; - if (d->texture) { - glBindTexture(GL_TEXTURE_2D, d->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, d->minFilter); - } -} - -void GLTexture::setMagFilter(FilterMode f) -{ - if (d->magFilter == f) - return; - d->magFilter = f; - if (d->texture) { - glBindTexture(GL_TEXTURE_2D, d->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, d->magFilter); - } -} - -GLuint GLTexture::texture() const -{ - return d->texture; -} - -QT_END_NAMESPACE diff --git a/src/declarative/opengl/gltexture.h b/src/declarative/opengl/gltexture.h deleted file mode 100644 index c08d68f..0000000 --- a/src/declarative/opengl/gltexture.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _GLTEXTURE_H_ -#define _GLTEXTURE_H_ - -#include - -#include -#include -#include "glheaders.h" - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QString; -class QImage; -class GLTexturePrivate; -class Q_DECLARATIVE_EXPORT GLTexture -{ -public: - GLTexture(); - GLTexture(const QString &file); - GLTexture(const QImage &img); - virtual ~GLTexture(); - - bool isNull() const; - void clear(); - - enum ImageMode { NonPowerOfTwo, PowerOfTwo }; - void setImage(const QImage &, ImageMode = NonPowerOfTwo); - void copyImage(const QImage &, const QPoint & = QPoint(0, 0), const QRect & = QRect()); - - int width() const; - int height() const; - qreal glWidth() const; - qreal glHeight() const; - QSize glSize() const; - QSize size() const; - void setSize(const QSize &); - - enum WrapMode { - Repeat = GL_REPEAT, - ClampToEdge = GL_CLAMP_TO_EDGE, -#if defined(QFX_RENDER_OPENGL2) - MirroredRepeat = GL_MIRRORED_REPEAT, -#else - MirroredRepeat = Repeat -#endif - }; - - WrapMode horizontalWrap() const; - WrapMode verticalWrap() const; - void setHorizontalWrap(WrapMode); - void setVerticalWrap(WrapMode); - - enum FilterMode { - Nearest = GL_NEAREST, - Linear = GL_LINEAR, - MipmapLinear = GL_LINEAR_MIPMAP_LINEAR - }; - - FilterMode minFilter() const; - FilterMode magFilter() const; - void setMinFilter(FilterMode); - void setMagFilter(FilterMode); - - GLuint texture() const; -private: - Q_DISABLE_COPY(GLTexture) - GLTexturePrivate *d; -}; - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // _GLTEXTURE_H_ diff --git a/src/declarative/opengl/opengl.pri b/src/declarative/opengl/opengl.pri deleted file mode 100644 index c9ccefb..0000000 --- a/src/declarative/opengl/opengl.pri +++ /dev/null @@ -1,20 +0,0 @@ -DEPENDPATH += opengl -INCLUDEPATH += opengl -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL -QT += opengl - -contains(QT_CONFIG, opengles1) { - SOURCES += gltexture.cpp \ - glsave.cpp - - HEADERS += gltexture.h \ - glsave.h -} else:contains(QT_CONFIG, opengles2) { - SOURCES += gltexture.cpp \ - glbasicshaders.cpp \ - glsave.cpp - - HEADERS += gltexture.h \ - glbasicshaders.h \ - glsave.h -} diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h index 6ba9409..1f3d561f 100644 --- a/src/declarative/util/qfxglobal.h +++ b/src/declarative/util/qfxglobal.h @@ -51,39 +51,10 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -#if defined(QT_OPENGL_ES_1) -#define QFX_CONFIGURATION_OPENGL1 -#elif defined(QT_OPENGL_ES_2) -#define QFX_CONFIGURATION_OPENGL2 -#else -#define QFX_CONFIGURATION_SOFTWARE -#endif - -/* - The choices of renderer are: - QFX_RENDER_QPAINTER - QFX_RENDER_OPENGL1 - QFX_RENDER_OPENGL2 - To simplify code, if either of the OpenGL renderers are used, - QFX_RENDER_OPENGL is also defined. -*/ - -#if defined(QFX_CONFIGURATION_OPENGL2) - -#define QFX_RENDER_OPENGL -#define QFX_RENDER_OPENGL2 - -#elif defined(QFX_CONFIGURATION_OPENGL1) - -#define QFX_RENDER_OPENGL -#define QFX_RENDER_OPENGL1 - -#elif defined(QFX_CONFIGURATION_SOFTWARE) +#define QFX_CONFIGURATION_SOFTWARE #define QFX_RENDER_QPAINTER -#endif - #define DEFINE_BOOL_CONFIG_OPTION(name, var) \ static bool name() \ { \ -- cgit v0.12 From 5d5ead94bc79a5364d8685707711673f5dc1a35a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Jun 2009 10:56:28 +1000 Subject: Make QSimpleCanvasItem inherit QGraphicsObject --- src/declarative/canvas/canvas.pri | 4 +- src/declarative/canvas/qsimplecanvas.cpp | 120 +-- src/declarative/canvas/qsimplecanvas.h | 18 - .../canvas/qsimplecanvas_graphicsview.cpp | 213 ----- src/declarative/canvas/qsimplecanvas_p.h | 2 - src/declarative/canvas/qsimplecanvas_software.cpp | 232 ------ .../canvas/qsimplecanvasdebugplugin.cpp | 2 +- src/declarative/canvas/qsimplecanvasitem.cpp | 864 +++++---------------- src/declarative/canvas/qsimplecanvasitem.h | 32 +- src/declarative/canvas/qsimplecanvasitem_p.h | 88 +-- src/declarative/fx/qfxanchors.cpp | 4 +- src/declarative/fx/qfxanimatedimageitem.h | 2 +- src/declarative/fx/qfxcomponentinstance.h | 2 +- src/declarative/fx/qfxcontentwrapper.h | 2 +- src/declarative/fx/qfxflickable.h | 2 +- src/declarative/fx/qfxflipable.cpp | 6 +- src/declarative/fx/qfxflipable.h | 4 +- src/declarative/fx/qfxgridview.h | 2 +- src/declarative/fx/qfximage.h | 2 +- src/declarative/fx/qfxitem.cpp | 50 +- src/declarative/fx/qfxitem.h | 11 +- src/declarative/fx/qfxlayouts.h | 2 +- src/declarative/fx/qfxlistview.h | 2 +- src/declarative/fx/qfxmouseregion.h | 2 +- src/declarative/fx/qfxpainteditem.h | 2 +- src/declarative/fx/qfxparticles.h | 2 +- src/declarative/fx/qfxpathview.h | 2 +- src/declarative/fx/qfxrect.h | 2 +- src/declarative/fx/qfxrepeater.cpp | 2 +- src/declarative/fx/qfxrepeater.h | 2 +- src/declarative/fx/qfxtext.h | 2 +- src/declarative/fx/qfxtextedit.h | 2 +- src/declarative/fx/qfxtransform.cpp | 4 +- src/declarative/fx/qfxtransform.h | 16 +- src/declarative/fx/qfxwebview.h | 2 +- src/gui/graphicsview/qgraphicsitem_p.h | 4 + 36 files changed, 264 insertions(+), 1446 deletions(-) delete mode 100644 src/declarative/canvas/qsimplecanvas_graphicsview.cpp delete mode 100644 src/declarative/canvas/qsimplecanvas_software.cpp diff --git a/src/declarative/canvas/canvas.pri b/src/declarative/canvas/canvas.pri index 28cab9b..e7cbb9d 100644 --- a/src/declarative/canvas/canvas.pri +++ b/src/declarative/canvas/canvas.pri @@ -1,9 +1,7 @@ SOURCES += \ canvas/qsimplecanvas.cpp \ canvas/qsimplecanvasitem.cpp \ - canvas/qsimplecanvasdebugplugin.cpp \ - canvas/qsimplecanvas_software.cpp \ - canvas/qsimplecanvas_graphicsview.cpp + canvas/qsimplecanvasdebugplugin.cpp HEADERS += \ canvas/qsimplecanvas.h \ diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index cbbc26d..327d10a 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -114,12 +114,10 @@ private: void QSimpleCanvasRootLayer::addDirty(QSimpleCanvasItem *i) { - _canvas->addDirty(i); } void QSimpleCanvasRootLayer::remDirty(QSimpleCanvasItem *i) { - _canvas->remDirty(i); } void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel) @@ -558,6 +556,7 @@ QSimpleCanvas::QSimpleCanvas(QWidget *parent) void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode) { + mode = QSimpleCanvas::GraphicsView; this->mode = mode; if (mode == QSimpleCanvas::SimpleCanvas) @@ -590,8 +589,7 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode) view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setFrameStyle(0); - static_cast(root->d_ptr)->convertToGraphicsItem(); - view->scene()->addItem(static_cast(root->d_ptr)->graphicsItem); + view->scene()->addItem(root); // These seem to give the best performance view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); @@ -606,24 +604,6 @@ QSimpleCanvas::~QSimpleCanvas() delete d; } -void QSimpleCanvasPrivate::paint(QPainter &p) -{ -#if defined(QFX_RENDER_QPAINTER) - if (!isSetup) { - ++paintVersion; - root->d_func()->setupPainting(0, q->rect()); - } - - lrpTimer.start(); - - root->d_func()->paint(p); - - lrpTime = lrpTimer.elapsed(); -#else - Q_UNUSED(p); -#endif -} - QSimpleCanvas::CanvasMode QSimpleCanvas::canvasMode() const { return d->mode; @@ -798,12 +778,6 @@ void QSimpleCanvas::resizeEvent(QResizeEvent *e) QWidget::resizeEvent(e); } - -void QSimpleCanvas::remDirty(QSimpleCanvasItem *c) -{ - d->dirtyItems.removeAll(c); -} - void QSimpleCanvas::queueUpdate() { if (!d->timer) { @@ -812,44 +786,6 @@ void QSimpleCanvas::queueUpdate() } } -void QSimpleCanvas::addDirty(QSimpleCanvasItem *c) -{ - Q_ASSERT(d->isSimpleCanvas()); - queueUpdate(); - d->oldDirty |= c->d_func()->data()->lastPaintRect; - d->dirtyItems.append(c); -} - -QRect QSimpleCanvasPrivate::dirtyItemClip() const -{ - QRect rv; - if (isSimpleCanvas()) { - for (int ii = 0; ii < dirtyItems.count(); ++ii) - rv |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect; - } - return rv; -} - -QRect QSimpleCanvasPrivate::resetDirty() -{ - if (isSimpleCanvas()) { - QRect r = oldDirty | dirtyItemClip(); - if (!r.isEmpty()) - r.adjust(-1,-1,2,2); //make sure we get everything (since we rounded from floats to ints) - for (int ii = 0; ii < dirtyItems.count(); ++ii) - static_cast(dirtyItems.at(ii)->d_ptr)->data()->dirty = false; - dirtyItems.clear(); - oldDirty = QRect(); - - if (fullUpdate()) - return QRect(); - else - return r; - } else { - return QRect(); - } -} - QSimpleCanvasItem *QSimpleCanvas::focusItem() const { return d->focusItem; @@ -872,33 +808,6 @@ QSimpleCanvasItem *QSimpleCanvas::focusItem(QSimpleCanvasItem *item) const bool QSimpleCanvas::event(QEvent *e) { - if (e->type() == QEvent::User && d->isSimpleCanvas()) { - int tbf = d->frameTimer.restart(); - d->timer = 0; - d->isSetup = true; - ++d->paintVersion; - d->root->d_func()->setupPainting(0, rect()); - - QRect r = d->resetDirty(); - - if (r.isEmpty() || fullUpdate()) - repaint(); - else - repaint(r); - emit framePainted(); - d->isSetup = false; - - int frametimer = d->frameTimer.elapsed(); - gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, d->lrpTime, tbf)); - if (d->debugPlugin) - d->debugPlugin->addTiming(d->lrpTime, frametimer, tbf); - d->lrpTime = 0; - if (continuousUpdate()) - queueUpdate(); - - return true; - } - if (e->type() == QEvent::ShortcutOverride) { if (QSimpleCanvasItem *focus = focusItem()) return focus->event(e); @@ -907,16 +816,6 @@ bool QSimpleCanvas::event(QEvent *e) return QWidget::event(e); } -void QSimpleCanvas::paintEvent(QPaintEvent *) -{ -#if defined(QFX_RENDER_QPAINTER) - if (d->mode == SimpleCanvas) { - QPainter p(this); - d->paint(p); - } -#endif -} - void QSimpleCanvas::dumpTiming() { for (int ii = 0; ii < gfxCanvasTiming.size(); ++ii) { @@ -952,16 +851,9 @@ void QSimpleCanvas::checkState() */ QImage QSimpleCanvas::asImage() const { - if (d->isSimpleCanvas()) { - QImage img(width(),height(),QImage::Format_RGB32); - QPainter p(&img); - const_cast(this)->d->paint(p); - return img; - } else { - QImage img(width(),height(),QImage::Format_RGB32); - QPainter p(&img); - d->view->render(&p); - return img; - } + QImage img(width(),height(),QImage::Format_RGB32); + QPainter p(&img); + d->view->render(&p); + return img; } QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h index b9f8ddb..b260017 100644 --- a/src/declarative/canvas/qsimplecanvas.h +++ b/src/declarative/canvas/qsimplecanvas.h @@ -57,18 +57,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -namespace QSimpleCanvasConfig -{ - enum ImageType { Opaque, Translucent }; - - typedef QTransform Matrix; - - inline Matrix transformToMatrix(const QTransform &t) - { return t; } - inline QTransform matrixToTransform(const Matrix &t) - { return t; } -} - class QSimpleCanvas; class QSimpleCanvasLayer; @@ -79,8 +67,6 @@ class Q_DECLARATIVE_EXPORT QSimpleCanvas : public QWidget { Q_OBJECT public: - typedef QSimpleCanvasConfig::Matrix Matrix; - enum CanvasMode { GraphicsView, SimpleCanvas }; QSimpleCanvas(QWidget *parent = 0); @@ -107,7 +93,6 @@ Q_SIGNALS: protected: virtual bool event(QEvent *); - virtual void paintEvent(QPaintEvent *); virtual void keyPressEvent(QKeyEvent *); virtual void keyReleaseEvent(QKeyEvent *); virtual void mousePressEvent(QMouseEvent *); @@ -129,12 +114,9 @@ private: friend class QSimpleCanvasPrivate; friend class QSimpleCanvasItem; friend class QSimpleCanvasItemPrivate; - friend class QSimpleGraphicsItem; void queueUpdate(); QSimpleCanvasPrivate *d; - void addDirty(QSimpleCanvasItem *); - void remDirty(QSimpleCanvasItem *); }; diff --git a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp b/src/declarative/canvas/qsimplecanvas_graphicsview.cpp deleted file mode 100644 index dd4012b..0000000 --- a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvas.h" -#include "qsimplecanvas_p.h" -#include "qsimplecanvasitem.h" -#include "qsimplecanvasitem_p.h" -#include -#include - - -QT_BEGIN_NAMESPACE -static QHash sceneMap; - -QSimpleCanvasGraphicsView::QSimpleCanvasGraphicsView(QSimpleCanvasPrivate *parent) -: QGraphicsView(parent->q), canvas(parent) -{ - setScene(&_scene); - sceneMap[&_scene] = parent->q; - setFrameShape(QFrame::NoFrame); - viewport()->setAttribute(Qt::WA_OpaquePaintEvent); -} - -QSimpleCanvasGraphicsView::~QSimpleCanvasGraphicsView() -{ - sceneMap.remove(&_scene); -} - -QSimpleGraphicsItem::QSimpleGraphicsItem(QSimpleCanvasItem *canvasItem) -: /*scene(0),*/ owner(canvasItem) -{ - setAcceptedMouseButtons(Qt::NoButton); -} - -QSimpleGraphicsItem::~QSimpleGraphicsItem() -{ - owner->d_func()->graphicsItem = 0; -} - -void QSimpleGraphicsItem::paint(QPainter *painter, - const QStyleOptionGraphicsItem *, QWidget *) -{ - owner->paintContents(*painter); -} - -QRectF QSimpleGraphicsItem::boundingRect() const -{ - return owner->boundingRect(); -} - -void QSimpleGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mousePressEvent(event); -} - -void QSimpleGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mouseReleaseEvent(event); - ungrabMouse(); -} - -void QSimpleGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mouseDoubleClickEvent(event); -} - -void QSimpleGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mouseMoveEvent(event); -} - -bool QSimpleGraphicsItem::sceneEvent(QEvent *event) -{ - bool rv = QGraphicsItem::sceneEvent(event); - if (event->type() == QEvent::UngrabMouse) - owner->mouseUngrabEvent(); - return rv; -} - -QVariant QSimpleGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value) -{ - if (change == ItemSceneHasChanged) { - QSimpleCanvasItemPrivate *owner_d = static_cast(owner->d_ptr); - QSimpleCanvas *oldCanvas = owner_d->canvas; - owner_d->canvas = sceneMap[scene()]; - if (owner_d->canvas){ - if (owner->hasFocus()) - owner->canvas()->d->setFocusItem(owner, Qt::OtherFocusReason); - if (owner->options() & QSimpleCanvasItem::IsFocusPanel) { - if (owner_d->wantsActiveFocusPanelPendingCanvas) { - owner_d->hasBeenActiveFocusPanel = true; - owner->canvas()->d->setActiveFocusPanel(owner); - owner_d->wantsActiveFocusPanelPendingCanvas = false; - } - } - } - if (owner->options() & QSimpleCanvasItem::MouseFilter) - owner_d->gvRemoveMouseFilter(); - - if (oldCanvas != owner_d->canvas) - owner->canvasChanged(); - - if (owner->options() & QSimpleCanvasItem::MouseFilter) - owner_d->gvAddMouseFilter(); - } - - return QGraphicsItem::itemChange(change, value); -} - -void QSimpleGraphicsItem::keyPressEvent(QKeyEvent *event) -{ - owner->keyPressEvent(event); - QGraphicsItem::keyPressEvent(event); -} - -void QSimpleGraphicsItem::keyReleaseEvent(QKeyEvent *event) -{ - owner->keyReleaseEvent(event); - QGraphicsItem::keyReleaseEvent(event); -} - -void QSimpleGraphicsItem::focusInEvent(QFocusEvent *) -{ - if (!owner->hasFocus()) - owner->setFocus(true); -} - -void QSimpleCanvasItemPrivate::gvRemoveMouseFilter() -{ - QGraphicsScene *scene = graphicsItem->scene(); - if (!scene) return; - - scene->removeEventFilter(q_ptr); -} - -void QSimpleCanvasItemPrivate::gvAddMouseFilter() -{ - QGraphicsScene *scene = graphicsItem->scene(); - if (!scene) return; - - scene->installEventFilter(q_ptr); -} -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h index cd76b22..33c889f 100644 --- a/src/declarative/canvas/qsimplecanvas_p.h +++ b/src/declarative/canvas/qsimplecanvas_p.h @@ -84,8 +84,6 @@ public: bool isGraphicsView() const { return mode == QSimpleCanvas::GraphicsView; } QRect oldDirty; - QRect resetDirty(); - void paint(QPainter &p); QSimpleCanvasItem *opaqueList; diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp deleted file mode 100644 index dd5e201..0000000 --- a/src/declarative/canvas/qsimplecanvas_software.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvas.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvas_p.h" - - -QT_BEGIN_NAMESPACE -QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding) -{ - Q_Q(QSimpleCanvasItem); - - bool hasContents = options & QSimpleCanvasItem::HasContents; - - QRect rv; - - if (hasContents || q->clip()) { - QRectF boundingRectActive = q->boundingRect(); - rv = data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding; - } - - data()->doNotPaint = rv.isEmpty(); - data()->doNotPaintChildren = data()->doNotPaint && q->clip(); - QRect myBounding = bounding; - if (q->clip()) - myBounding &= rv; - - if (!data()->doNotPaintChildren) { - for (int ii = 0; ii < children.count(); ++ii) { - QSimpleCanvasItem *child = children.at(ii); - - int childVersion = version; - if (!child->d_func()->data()->transformValid) - childVersion = canvas->d->paintVersion; - - bool recalcNeeded = - (childVersion > child->d_func()->data()->transformVersion); - - if (recalcNeeded) { - qreal visible = child->visible(); - child->d_func()->data()->activeOpacity = data()->activeOpacity; - if (visible != 1) - child->d_func()->data()->activeOpacity *= visible; - } - - if (child->d_func()->data()->activeOpacity != 0) { - if (recalcNeeded) { - // Calculate child's transform - qreal x = child->x(); - qreal y = child->y(); - qreal scale = child->scale(); - QSimpleCanvasItem::Flip flip = child->flip(); - - QSimpleCanvas::Matrix &am = - child->d_func()->data()->transformActive; - am = data()->transformActive; - if (x != 0 || y != 0) - am.translate(x, y); - if (scale != 1) { - QPointF to = child->d_func()->transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - am.translate(to.x(), to.y()); - am.scale(scale, scale); - if (to.x() != 0. || to.y() != 0.) - am.translate(-to.x(), -to.y()); - } - - if (child->d_func()->data()->transformUser) - am = *child->d_func()->data()->transformUser * am; - - if (flip) { - QRectF br = child->boundingRect(); - am.translate(br.width() / 2., br.height() / 2); - am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, - (flip & QSimpleCanvasItem::VerticalFlip)?-1:1); - am.translate(-br.width() / 2., -br.height() / 2); - } - child->d_func()->data()->transformValid = true; - child->d_func()->data()->transformVersion = childVersion; - } - rv |= child->d_func()->setupPainting(child->d_func()->data()->transformVersion, myBounding); - } - } - } - - data()->lastPaintRect = rv; - if (!data()->doNotPaintChildren) { - if (!bounding.intersects(rv)) { - data()->doNotPaintChildren = true; - data()->doNotPaint = true; - } - } - - return rv; -} - -void QSimpleCanvasItemPrivate::paint(QPainter &p) -{ - Q_Q(QSimpleCanvasItem); - - QRect oldUcr; - if (clip) { - - p.save(); - QRectF boundingRectActive = q->boundingRect(); - - QRect cr; - switch(clip) { - case QSimpleCanvasItem::ClipToHeight: - { - qWarning("QSimpleCanvasItem: ClipToHeight not implemented"); - QRect r = p.clipRegion().boundingRect(); - cr = QRect(r.x(), 0, r.width(), - boundingRectActive.height()); - } - break; - case QSimpleCanvasItem::ClipToWidth: - { - qWarning("QSimpleCanvasItem: ClipToWidth not implemented"); - QRect r = p.clipRegion().boundingRect(); - cr = QRect(0, r.y(), boundingRectActive.width(), - r.height()); - } - break; - case QSimpleCanvasItem::ClipToRect: - cr = boundingRectActive.toAlignedRect(); - break; - default: - break; - } - - p.setWorldTransform(data()->transformActive); - if (p.clipRegion().isEmpty()) { - p.setClipRect(cr); - } else { - p.setClipRect(cr, Qt::IntersectClip); - } - - if (p.clipRegion().isEmpty()) { - p.restore(); - return; - } - } - - zOrderChildren(); - - int upto = 0; - if (!data()->doNotPaintChildren) { - for (upto = 0; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - if (c->z() < 0) { - paintChild(p, c); - } else { - break; - } - } - } - - if (!data()->doNotPaint) { - p.setWorldTransform(data()->transformActive); - q->paintContents(p); - } - - if (!data()->doNotPaintChildren) { - for (; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - paintChild(p, c); - } - } - - if (clip) - p.restore(); - - if (debuggerStatus && debuggerStatus->selected) { - p.setWorldTransform(data()->transformActive); - p.fillRect(q->boundingRect(), QColor(255, 0, 0, 80)); - } -} - -void QSimpleCanvasItemPrivate::paintChild(QPainter &p, QSimpleCanvasItem *c) -{ - if (c->d_func()->data()->activeOpacity != 0) { - - qreal op = p.opacity(); - p.setOpacity(c->d_func()->data()->activeOpacity); - - c->d_func()->paint(p); - - p.setOpacity(op); - } -} - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp index 91ef7dc..81bfbfa 100644 --- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp +++ b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp @@ -122,7 +122,7 @@ void QSimpleCanvasSceneDebugPlugin::refresh(QDataStream &ds, { ds << QmlDebugServerPlugin::objectToString(item) << item->x() << item->y() << item->z() << item->width() << item->height() - << (int)item->transformOrigin() << item->scale() << (int)item->flip() + << (int)item->transformOrigin() << item->scale() << (int)0 << item->transform() << item->hasActiveFocus() << (int)item->options(); diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index f53ae72..65c0a45 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -48,20 +48,24 @@ QT_BEGIN_NAMESPACE -QSimpleCanvasItemData::QSimpleCanvasItemData() -: buttons(Qt::NoButton), flip(QSimpleCanvasItem::NoFlip), - dirty(false), transformValid(true), doNotPaint(false), - doNotPaintChildren(false), x(0), y(0), z(0), - visible(1), transformUser(0), transformVersion(0), activeOpacity(1) + +static QHash sceneMap; + +QSimpleCanvasGraphicsView::QSimpleCanvasGraphicsView(QSimpleCanvasPrivate *parent) +: QGraphicsView(parent->q), canvas(parent) { + setScene(&_scene); + sceneMap[&_scene] = parent->q; + setFrameShape(QFrame::NoFrame); + viewport()->setAttribute(Qt::WA_OpaquePaintEvent); } -QSimpleCanvasItemData::~QSimpleCanvasItemData() +QSimpleCanvasGraphicsView::~QSimpleCanvasGraphicsView() { - if (transformUser) - delete transformUser; + sceneMap.remove(&_scene); } + /*! \internal \class QSimpleCanvasItem @@ -105,23 +109,106 @@ bool QSimpleCanvasItem::mouseFilter(QGraphicsSceneMouseEvent *) return false; } +bool QSimpleCanvasItem::sceneEvent(QEvent *event) +{ + bool rv = QGraphicsItem::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) + mouseUngrabEvent(); + return rv; +} + +QVariant QSimpleCanvasItem::itemChange(GraphicsItemChange change, + const QVariant &value) +{ + Q_D(QSimpleCanvasItem); + if (change == ItemSceneHasChanged) { + QSimpleCanvas *oldCanvas = d->canvas; + d->canvas = sceneMap[scene()]; + if (d->canvas){ + if (hasFocus()) + canvas()->d->setFocusItem(this, Qt::OtherFocusReason); + if (options() & QSimpleCanvasItem::IsFocusPanel) { + if (d->wantsActiveFocusPanelPendingCanvas) { + d->hasBeenActiveFocusPanel = true; + canvas()->d->setActiveFocusPanel(this); + d->wantsActiveFocusPanelPendingCanvas = false; + } + } + } + if (options() & QSimpleCanvasItem::MouseFilter) + d->gvRemoveMouseFilter(); + + if (oldCanvas != d->canvas) + canvasChanged(); + + if (options() & QSimpleCanvasItem::MouseFilter) + d->gvAddMouseFilter(); + } + + return QGraphicsItem::itemChange(change, value); +} + + void QSimpleCanvasItem::mousePressEvent(QGraphicsSceneMouseEvent *e) { +#if 0 + QSimpleCanvasItem *p = owner->parent(); + while(p) { + if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { + if (p->mouseFilter(event)) + return; + } + p = p->parent(); + } + owner->mousePressEvent(event); +#endif e->ignore(); } void QSimpleCanvasItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { +#if 0 + QSimpleCanvasItem *p = owner->parent(); + while(p) { + if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { + if (p->mouseFilter(event)) + return; + } + p = p->parent(); + } + owner->mouseReleaseEvent(event); + ungrabMouse(); +#endif e->ignore(); } void QSimpleCanvasItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) { +#if 0 + QSimpleCanvasItem *p = owner->parent(); + while(p) { + if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { + if (p->mouseFilter(event)) + return; + } + p = p->parent(); + } +#endif e->ignore(); } void QSimpleCanvasItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { +#if 0 + QSimpleCanvasItem *p = owner->parent(); + while(p) { + if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { + if (p->mouseFilter(event)) + return; + } + p = p->parent(); + } +#endif e->ignore(); } @@ -156,6 +243,8 @@ void QSimpleCanvasItem::focusOutEvent(QFocusEvent *e) void QSimpleCanvasItem::focusInEvent(QFocusEvent *e) { + if (!hasFocus()) + setFocus(true); e->ignore(); } @@ -292,36 +381,6 @@ QSimpleCanvasItem *QSimpleCanvasItem::parent() const return d->parent; } -void QSimpleCanvasItemPrivate::zOrderChildren() -{ - if (!needsZOrder || children.count() <= 1) - return; - - needsZOrder = false; - // This is a bubble sort for a reason - it is the fastest sort for a mostly - // ordered list. We only expect z ordering to change infrequently. - bool swap = true; - int c = 0; - while(swap) { - ++c; - swap = false; - QSimpleCanvasItem *item = children.first(); - qreal z = item->z(); - for (int ii = 1; ii < children.count(); ++ii) { - QSimpleCanvasItem *i2 = children.at(ii); - qreal z2 = i2->z(); - if (z2 < z) { - swap = true; - children[ii] = item; - children[ii - 1] = i2; - } else { - item = i2; - z = z2; - } - } - } -} - void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCanvas *oldCanvas) { Q_Q(QSimpleCanvasItem); @@ -363,37 +422,10 @@ void QSimpleCanvasItem::setFocus(bool focus) } } -qreal QSimpleCanvasItem::x() const -{ - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return d->graphicsItem->x(); - else if (d->data_ptr) - return d->data()->x; - else - return 0; -} - -qreal QSimpleCanvasItem::y() const -{ - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return d->graphicsItem->y(); - else if (d->data_ptr) - return d->data()->y; - else - return 0; -} - qreal QSimpleCanvasItem::z() const { Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return d->graphicsItem->zValue(); - else if (d->data_ptr) - return d->data()->z; - else - return 0; + return zValue(); } void QSimpleCanvasItem::setX(qreal x) @@ -404,12 +436,7 @@ void QSimpleCanvasItem::setX(qreal x) qreal oldX = this->x(); - if (d->graphicsItem) { - d->graphicsItem->setPos(x, y()); - } else { - d->data()->x = x; - update(); - } + QGraphicsItem::setPos(x, y()); geometryChanged(QRectF(this->x(), y(), width(), height()), QRectF(oldX, y(), width(), height())); @@ -417,18 +444,12 @@ void QSimpleCanvasItem::setX(qreal x) void QSimpleCanvasItem::setY(qreal y) { - Q_D(QSimpleCanvasItem); if (y == this->y()) return; qreal oldY = this->y(); - if (d->graphicsItem) { - d->graphicsItem->setPos(x(), y); - } else { - d->data()->y = y; - update(); - } + QGraphicsItem::setPos(x(), y); geometryChanged(QRectF(x(), this->y(), width(), height()), QRectF(x(), oldY, width(), height())); @@ -436,30 +457,15 @@ void QSimpleCanvasItem::setY(qreal y) void QSimpleCanvasItem::setZ(qreal z) { - Q_D(QSimpleCanvasItem); if (z == this->z()) return; - if (d->graphicsItem) { - - if (z < 0) - d->graphicsItem->setFlag(QGraphicsItem::ItemStacksBehindParent, - true); - else - d->graphicsItem->setFlag(QGraphicsItem::ItemStacksBehindParent, - false); - - d->graphicsItem->setZValue(z); - - } else { - if (d->data()->z == z) - return; + if (z < 0) + setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + setFlag(QGraphicsItem::ItemStacksBehindParent, false); - d->data()->z = z; - if (parent()) - static_cast(parent()->d_ptr)->needsZOrder = true; - update(); - } + setZValue(z); } qreal QSimpleCanvasItem::width() const @@ -550,17 +556,10 @@ bool QSimpleCanvasItem::heightValid() const void QSimpleCanvasItem::setPos(const QPointF &point) { - Q_D(QSimpleCanvasItem); qreal oldX = x(); qreal oldY = y(); - if (d->graphicsItem) { - d->graphicsItem->setPos(point); - } else { - d->data()->x = point.x(); - d->data()->y = point.y(); - update(); - } + QGraphicsItem::setPos(point); geometryChanged(QRectF(x(), y(), width(), height()), QRectF(oldX, oldY, width(), height())); @@ -576,18 +575,14 @@ void QSimpleCanvasItem::setScale(qreal s) { Q_D(QSimpleCanvasItem); d->scale = s; - if (d->graphicsItem) { - QTransform t; - QPointF to = transformOriginPoint(); - if (to.x() != 0. || to.y() != 0.) - t.translate(to.x(), to.y()); - t.scale(s, s); - if (to.x() != 0. || to.y() != 0.) - t.translate(-to.x(), -to.y()); - d->graphicsItem->setTransform(t * d->graphicsItem->transform); - } else { - update(); - } + QTransform t; + QPointF to = transformOriginPoint(); + if (to.x() != 0. || to.y() != 0.) + t.translate(to.x(), to.y()); + t.scale(s, s); + if (to.x() != 0. || to.y() != 0.) + t.translate(-to.x(), -to.y()); + setTransform(t * d->transform); } bool QSimpleCanvasItem::isVisible() const @@ -602,39 +597,18 @@ bool QSimpleCanvasItem::isVisible() const qreal QSimpleCanvasItem::visible() const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return d->graphicsItem->opacity(); - else if (d->data_ptr) - return d->data()->visible; - else - return 1; + return opacity(); } void QSimpleCanvasItem::setVisible(qreal v) { - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - d->graphicsItem->setOpacity(v); - } else { - if (v == visible()) - return; - if (v == 0) - update(); - - d->data()->visible = v; - - if (v != 0) - update(); - } + setOpacity(v); } void QSimpleCanvasItem::addChild(QSimpleCanvasItem *c) { Q_D(QSimpleCanvasItem); d->children.append(c); - if (!d->graphicsItem) - d->needsZOrder = true; childrenChanged(); } @@ -665,28 +639,6 @@ QSimpleCanvasLayer *QSimpleCanvasItem::layer() return 0; } -void QSimpleCanvasItem::update() -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - d->graphicsItem->update(); - } else { - if (!parent()) - return; - - if (d->data()->dirty || 0. == d->data()->visible) return; - - QSimpleCanvasLayer *l = layer(); - if (l == this && parent()) - l = parent()->layer(); - if (l) { - l->addDirty(this); - d->data()->dirty = true; - d->data()->transformValid = false; - } - } -} - bool QSimpleCanvasItem::clip() const { Q_D(const QSimpleCanvasItem); @@ -717,240 +669,57 @@ void QSimpleCanvasItem::setClipType(ClipType c) { Q_D(QSimpleCanvasItem); d->clip = c; - if (d->graphicsItem) - d->graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape, bool(c)); - else - update(); -} - -Qt::MouseButtons QSimpleCanvasItem::acceptedMouseButtons() const -{ - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return d->graphicsItem->acceptedMouseButtons(); - else if (d->data_ptr) - return (Qt::MouseButtons)d->data()->buttons; - else - return Qt::NoButton; + setFlag(QGraphicsItem::ItemClipsChildrenToShape, bool(c)); } -void QSimpleCanvasItem::setAcceptedMouseButtons(Qt::MouseButtons buttons) -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) - d->graphicsItem->setAcceptedMouseButtons(buttons); - else - d->data()->buttons = buttons; -} - - QRect QSimpleCanvasItem::itemBoundingRect() { return boundingRect().toAlignedRect(); } -QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const -{ - return p; -} - -QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const -{ - return r; -} - -QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const -{ - return p; -} - -QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const -{ - return r; -} - QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) { - return d->graphicsItem->mapFromScene(p); - } else { - QPointF mp = d->adjustFrom(p); - d->freshenTransforms(); - return d->data()->transformActive.inverted().map(mp); - } + return QGraphicsItem::mapFromScene(p); } QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) { - return d->graphicsItem->mapFromScene(r).boundingRect(); - } else { - QRectF mr = d->adjustFrom(r); - d->freshenTransforms(); - return d->data()->transformActive.inverted().mapRect(mr); - } + return QGraphicsItem::mapFromScene(r).boundingRect(); } QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) { - return d->graphicsItem->mapToScene(p); - } else { - d->freshenTransforms(); - QPointF rp = d->data()->transformActive.map(p); - return d->adjustTo(rp); - } + return QGraphicsItem::mapToScene(p); } QRectF QSimpleCanvasItem::mapToScene(const QRectF &r) const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) { - return d->graphicsItem->mapToScene(r).boundingRect(); - } else { - d->freshenTransforms(); - QRectF rr = d->data()->transformActive.mapRect(r); - return d->adjustTo(rr); - } -} - -void QSimpleCanvasItemPrivate::freshenTransforms() const -{ - if (freshenNeeded()) - doFreshenTransforms(); + return QGraphicsItem::mapToScene(r).boundingRect(); } -bool QSimpleCanvasItemPrivate::freshenNeeded() const -{ -#if 0 - return parent && - (data()->transformVersion == -1 || - data()->parentTransformVersion == -1 || - parent->d_func()->data()->transformVersion != data()->parentTransformVersion); -#else - const QSimpleCanvasItemPrivate *me = this; - while(me) { - if (me->data_ptr && !me->data_ptr->transformValid) - return true; - if (me->parent) - me = me->parent->d_func(); - else - me = 0; - } - return false; -#endif -} - -void QSimpleCanvasItemPrivate::doFreshenTransforms() const -{ - Q_Q(const QSimpleCanvasItem); - if (parent) - parent->d_func()->doFreshenTransforms(); - - if (freshenNeeded()) { - if (parent) - data()->transformActive = parent->d_func()->data()->transformActive; - else - data()->transformActive = QSimpleCanvas::Matrix(); - data()->transformActive.translate(q->x(), q->y()); - if (scale != 1.) { - QPointF to = transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - data()->transformActive.translate(to.x(), to.y()); - data()->transformActive.scale(scale, scale); - if (to.x() != 0. || to.y() != 0.) - data()->transformActive.translate(-to.x(), -to.y()); - } - - Q_Q(const QSimpleCanvasItem); - - if (data()->flip) { - QRectF br = q->boundingRect(); - data()->transformActive.translate(br.width() / 2., br.height() / 2); - data()->transformActive.scale((data()->flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, - (data()->flip & QSimpleCanvasItem::VerticalFlip)?-1:1); - data()->transformActive.translate(-br.width() / 2., -br.height() / 2); - } - } -} - -QSimpleCanvas::Matrix QSimpleCanvasItem::transform() const +QTransform QSimpleCanvasItem::transform() const { Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return QSimpleCanvasConfig::transformToMatrix(d->graphicsItem->transform); - else if (d->data()->transformUser) - return *d->data()->transformUser; - else - return QSimpleCanvas::Matrix(); + return d->transform; } -void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m) +void QSimpleCanvasItem::setTransform(const QTransform &m) { Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - d->graphicsItem->transform = QSimpleCanvasConfig::matrixToTransform(m); - d->graphicsItem->setTransform(QTransform::fromScale(d->scale, d->scale) * d->graphicsItem->transform); - } else { - if (!d->data()->transformUser) - d->data()->transformUser = new QSimpleCanvas::Matrix; - *d->data()->transformUser = m; - update(); - } + d->transform = m; + QGraphicsItem::setTransform(QTransform::fromScale(d->scale, d->scale) * d->transform); } QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const { - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) { - QGraphicsScene *s = d->graphicsItem->scene(); - if (s) { - QGraphicsItem *item = s->mouseGrabberItem(); - QSimpleGraphicsItem *dgi = static_cast(item); - return dgi?static_cast(dgi->owner):0; - } - } else { - QSimpleCanvas *c = canvas(); - if (c) - return c->d->lastMouseItem; + QGraphicsScene *s = scene(); + if (s) { + QGraphicsItem *item = s->mouseGrabberItem(); + return static_cast(item); // ### } return 0; } -void QSimpleCanvasItem::ungrabMouse() -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - d->graphicsItem->ungrabMouse(); - } else { - QSimpleCanvas *c = canvas(); - if (c && c->d->lastMouseItem == this) { - c->d->lastMouseItem->mouseUngrabEvent(); - c->d->lastMouseItem = 0; - } - } -} - -void QSimpleCanvasItem::grabMouse() -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - d->graphicsItem->grabMouse(); - } else { - QSimpleCanvas *c = canvas(); - if (c) { - if (c->d->lastMouseItem != this) { - if (c->d->lastMouseItem) - c->d->lastMouseItem->mouseUngrabEvent(); - c->d->lastMouseItem = this; - } - } - } -} - bool QSimpleCanvasItem::isFocusable() const { Q_D(const QSimpleCanvasItem); @@ -976,159 +745,32 @@ void QSimpleCanvasItemPrivate::setFocus(bool f) void QSimpleCanvasItemPrivate::setActiveFocus(bool f) { + Q_Q(QSimpleCanvasItem); hasActiveFocus = f; - if (graphicsItem) { - if (f) { - if (!(graphicsItem->flags() & QGraphicsItem::ItemIsFocusable)) - graphicsItem->setFlag(QGraphicsItem::ItemIsFocusable); - graphicsItem->setFocus(); - } else { - graphicsItem->clearFocus(); - if ((graphicsItem->flags() & QGraphicsItem::ItemIsFocusable) && !focusable) - graphicsItem->setFlag(QGraphicsItem::ItemIsFocusable, false); - } - + if (f) { + if (!(q->flags() & QGraphicsItem::ItemIsFocusable)) + q->setFlag(QGraphicsItem::ItemIsFocusable); + q->QGraphicsItem::setFocus(); + } else { + q->clearFocus(); + if ((q->flags() & QGraphicsItem::ItemIsFocusable) && !focusable) + q->setFlag(QGraphicsItem::ItemIsFocusable, false); } } -QSimpleCanvasItem::Flip QSimpleCanvasItem::flip() const -{ - Q_D(const QSimpleCanvasItem); - if (d->graphicsItem) - return NoFlip; - else if (d->data_ptr) - return d->data()->flip; - else - return NoFlip; -} - -void QSimpleCanvasItem::setFlip(Flip f) -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) - return; - - if (d->data()->flip == f) - return; - - d->data()->flip = f; - update(); -} - -/*! - Places the item under \a item in the parent item's stack. - - The item itself and \a item must be siblings, or this method has no effect. - - \sa stackOver(), stackAt() - */ -void QSimpleCanvasItem::stackUnder(QSimpleCanvasItem *item) -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) - return; // XXX - - QSimpleCanvasItem *p = parent(); - if (!p || !item || item == this) return; - - QSimpleCanvasItemPrivate *parent_d_ptr = static_cast(p->d_ptr); - int idx = parent_d_ptr->children.indexOf(item); - if (idx == -1) return; - - parent_d_ptr->children.removeAll(this); - idx = parent_d_ptr->children.indexOf(item); - parent_d_ptr->children.insert(idx + 1, this); - parent_d_ptr->needsZOrder = true; - - p->childrenChanged(); -} - -/*! - Places the item over \a item in the parent item's stack. - - The item itself and \a item must be siblings, or this method has no effect. - - \sa stackUnder(), stackAt() - */ -void QSimpleCanvasItem::stackOver(QSimpleCanvasItem *item) -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) - return; // XXX - - QSimpleCanvasItem *p = parent(); - if (!p || !item || item == this) return; - - QSimpleCanvasItemPrivate *parent_d_ptr = static_cast(p->d_ptr); - int idx = parent_d_ptr->children.indexOf(item); - if (idx == -1) return; - - parent_d_ptr->children.removeAll(this); - idx = parent_d_ptr->children.indexOf(item); - parent_d_ptr->children.insert(idx, this); - parent_d_ptr->needsZOrder = true; - - p->childrenChanged(); -} - -/*! - Places the item at position \a index in the parent item's stack. - - If index is zero or less, the item is placed at the beginning of the - stack. If the index is greater than the number of items in the stack, the - item is placed at the end. - - \sa stackOver(), stackUnder() - */ -void QSimpleCanvasItem::stackAt(int index) -{ - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) - return; // XXX - - QSimpleCanvasItem *p = parent(); - if (!p) return; - - QSimpleCanvasItemPrivate *parent_d_ptr = static_cast(p->d_ptr); - parent_d_ptr->children.removeAll(this); - - if (index < 0) index = 0; - if (index > parent_d_ptr->children.size()) index = parent_d_ptr->children.size(); - - parent_d_ptr->children.insert(index, this); - parent_d_ptr->needsZOrder = true; - p->childrenChanged(); -} - -/*! - Returns the current stacking index for the child \a item. - - If \a item is not a child, -1 is returned. - - \sa stackAt() - */ -int QSimpleCanvasItem::indexForChild(QSimpleCanvasItem *item) -{ - Q_D(QSimpleCanvasItem); - return d->children.indexOf(item); -} - bool QSimpleCanvasItem::eventFilter(QObject *o, QEvent *e) { - Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - switch(e->type()) { - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: - if (mouseFilter(static_cast(e))) - return true; - break; - default: - break; - } + switch(e->type()) { + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseRelease: + if (mouseFilter(static_cast(e))) + return true; + break; + default: + break; } return QObject::eventFilter(o, e); @@ -1166,102 +808,49 @@ void QSimpleCanvasItem::setOptions(Options options, bool set) d->options &= ~IsFocusRealm; } - if (d->graphicsItem) - d->graphicsItem->setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); + setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); if ((old & MouseFilter) != (d->options & MouseFilter)) { - if (d->graphicsItem) { - if (d->options & MouseFilter) - d->gvAddMouseFilter(); - else - d->gvRemoveMouseFilter(); - - } else { - QSimpleCanvas *c = canvas(); - if (c) { - if (d->options & MouseFilter) - c->d->installMouseFilter(this); - else - c->d->removeMouseFilter(this); - } - } + if (d->options & MouseFilter) + d->gvAddMouseFilter(); + else + d->gvRemoveMouseFilter(); } } QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent) -: QObject(dd, parent) +: QGraphicsObject(dd, parent, 0) { + setFlag(QGraphicsItem::ItemHasNoContents, true); } QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItem *p) -: QObject(*(new QSimpleCanvasItemPrivate), p) +: QGraphicsObject(*(new QSimpleCanvasItemPrivate), p, 0) { + setFlag(QGraphicsItem::ItemHasNoContents, true); } QSimpleCanvasItem::~QSimpleCanvasItem() { Q_D(QSimpleCanvasItem); - if (d->graphicsItem) { - if ((d->options & (IsFocusPanel|IsFocusRealm)) && d->canvas) - d->canvas->d->focusPanelData.remove(this); - if (d->hasFocus && d->canvas) { - QSimpleCanvasItem *prnt = parent(); - while (prnt && !(prnt->options() & (IsFocusPanel|IsFocusRealm))) - prnt = prnt->parent(); - if (prnt && d->canvas->d->focusPanelData.value(prnt) == this) - d->canvas->d->focusPanelData.remove(prnt); - } - - qDeleteAll(children()); - if (parent()) - parent()->remChild(this); - delete d->graphicsItem; - } else { - update(); - setOptions(MouseFilter, false); - - if (d->canvas){ - if (d->canvas->focusItem() == this) - d->canvas->d->focusItem = 0; - if (d->canvas->d->lastFocusItem == this) - d->canvas->d->lastFocusItem = 0; - if (d->hasBeenActiveFocusPanel) - d->canvas->d->clearFocusPanel(this); - if (d->hasFocus) - d->canvas->d->clearFocusItem(this); - } - - while(!d->children.isEmpty()) { - QSimpleCanvasItem *child = d->children.takeFirst(); - delete child; - } - - if (parent() && d->data_ptr && d->data()->dirty) { - QSimpleCanvasLayer *l = parent()->layer(); - if (l) { - l->remDirty(this); - } - } - if (d->parent) - d->parent->remChild(this); - - - if (d->data_ptr) - delete d->data_ptr; + if ((d->options & (IsFocusPanel|IsFocusRealm)) && d->canvas) + d->canvas->d->focusPanelData.remove(this); + if (d->hasFocus && d->canvas) { + QSimpleCanvasItem *prnt = parent(); + while (prnt && !(prnt->options() & (IsFocusPanel|IsFocusRealm))) + prnt = prnt->parent(); + if (prnt && d->canvas->d->focusPanelData.value(prnt) == this) + d->canvas->d->focusPanelData.remove(prnt); } + + qDeleteAll(children()); + if (parent()) + parent()->remChild(this); } QSimpleCanvasItem::operator QGraphicsItem *() { - Q_D(QSimpleCanvasItem); - if (!d->graphicsItem) { - if (parent()) { - qWarning("QSimpleCanvasItem: Only the root item can be converted into a QGraphicsItem"); - return 0; - } - d->convertToGraphicsItem(); - } - return d->graphicsItem; + return this; } QSimpleCanvasItem::operator QmlDebuggerStatus *() @@ -1305,82 +894,14 @@ void QSimpleCanvasItemPrivate::setParentInternal(QSimpleCanvasItem *p) { Q_Q(QSimpleCanvasItem); QSimpleCanvasItem *oldParent = parent; - if (graphicsItem) { - if (oldParent) - oldParent->remChild(q); - - parent = p; - graphicsItem->setParentItem(p->d_func()->graphicsItem); + if (oldParent) + oldParent->remChild(q); - if (parent) - p->addChild(q); + parent = p; + q->setParentItem(p); - } else { - bool canvasChange = false; - if (p) - canvasChange = (p->d_func()->canvas != canvas); - QSimpleCanvas *old = canvas; - - QSimpleCanvasLayer *o = q->layer(); - if (q->parent()) { - q->update(); - q->parent()->remChild(q); - } - parent = p; - QSimpleCanvasLayer *n = 0; - if (q->parent()) { - q->parent()->addChild(q); - n = q->layer(); - } - - if (o != n) { - data()->dirty = false; - data()->transformValid = false; - if (o) o->remDirty(q); - if (n) n->addDirty(q); - } - - if (canvasChange) - canvasChanged(p->d_func()->canvas, old); - - q->update(); - } -} - -void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent) -{ - Q_Q(QSimpleCanvasItem); - Q_ASSERT(!graphicsItem); - graphicsItem = new QSimpleGraphicsItem(q); - graphicsItem->setFlag(QGraphicsItem::ItemHasNoContents, !(q->options() & QSimpleCanvasItem::HasContents)); if (parent) - graphicsItem->setParentItem(parent); - - QSimpleCanvasItemData *old = data_ptr; - data_ptr = 0; - - if (old) { - q->QSimpleCanvasItem::setX(old->x); - q->QSimpleCanvasItem::setY(old->y); - q->QSimpleCanvasItem::setZ(old->z); - q->QSimpleCanvasItem::setVisible(old->visible); - if (old->transformUser) - q->QSimpleCanvasItem::setTransform(*old->transformUser); - q->QSimpleCanvasItem::setFlip(old->flip); - q->QSimpleCanvasItem::setAcceptedMouseButtons((Qt::MouseButtons)old->buttons); - delete old; - } - - if (scale != 1) { - qreal s = scale; - scale = 1; - q->QSimpleCanvasItem::setScale(s); - } - - q->setClipType(clip); - - for (int ii = 0; ii < children.count(); ++ii) - static_cast(children.at(ii)->d_ptr)->convertToGraphicsItem(graphicsItem); + p->addChild(q); } /*! @@ -1395,14 +916,6 @@ void QSimpleCanvasItem::setParent(QSimpleCanvasItem *p) QObject::setParent(p); - if (d->graphicsItem && !static_cast(p->d_ptr)->graphicsItem) - qWarning("QSimpleCanvasItem: Cannot reparent a QGraphicsView item to a QSimpleCanvas item"); - - if (static_cast(p->d_ptr)->graphicsItem && !d->graphicsItem) { - d->setParentInternal(0); - d->convertToGraphicsItem(); - } - QSimpleCanvasItem *oldParent = d->parent; d->setParentInternal(p); parentChanged(p, oldParent); @@ -1462,7 +975,7 @@ int QSimpleCanvasItemPrivate::dump(int indent) QFxItem *i = qobject_cast(q); if (i) name = i->id().toLatin1(); - qWarning().nospace() << ba.constData() << state.constData() << " " << children.count() << " " << q << " " << name.constData(); + qWarning().nospace() << ba.constData() << state.constData() << " " << children.count() << " " << " " << name.constData(); int rv = 0; @@ -1731,8 +1244,31 @@ QPixmap QSimpleCanvasItem::string(const QString &str, const QColor &c, const QFo return img; } +void QSimpleCanvasItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +{ + paintContents(*p); +} + void QSimpleCanvasItem::geometryChanged(const QRectF &, const QRectF &) { } +void QSimpleCanvasItemPrivate::gvRemoveMouseFilter() +{ + Q_Q(QSimpleCanvasItem); + QGraphicsScene *scene = q->scene(); + if (!scene) return; + + scene->removeEventFilter(q); +} + +void QSimpleCanvasItemPrivate::gvAddMouseFilter() +{ + Q_Q(QSimpleCanvasItem); + QGraphicsScene *scene = q->scene(); + if (!scene) return; + + scene->installEventFilter(q); +} + QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index 74841ea..eb7bcea 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -64,12 +64,12 @@ class QPointF; class QRectF; class QGraphicsSceneHoverEvent; -class Q_DECLARATIVE_EXPORT QSimpleCanvasItem : public QObject +class Q_DECLARATIVE_EXPORT QSimpleCanvasItem : public QGraphicsObject { Q_OBJECT Q_CAST_INTERFACES(QGraphicsItem) Q_CAST_INTERFACES(QmlDebuggerStatus) - Q_DECLARE_PRIVATE(QSimpleCanvasItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QSimpleCanvasItem) Q_ENUMS(TransformOrigin) Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) @@ -104,11 +104,6 @@ public: Options options() const; void setOptions(Options, bool set = true); - Qt::MouseButtons acceptedMouseButtons() const; - void setAcceptedMouseButtons(Qt::MouseButtons buttons); - - qreal x() const; - qreal y() const; qreal z() const; QPointF pos() const; void setX(qreal); @@ -140,13 +135,6 @@ public: qreal scale() const; virtual void setScale(qreal); - enum Flip { NoFlip = 0, - VerticalFlip = 0x01, - HorizontalFlip = 0x02, - VerticalAndHorizontalFlip = 0x03 }; - Flip flip() const; - void setFlip(Flip); - qreal visible() const; virtual void setVisible(qreal); bool isVisible() const; @@ -155,10 +143,6 @@ public: QSimpleCanvasItem *parent() const; void setParent(QSimpleCanvasItem *); - void stackUnder(QSimpleCanvasItem *); - void stackOver(QSimpleCanvasItem *); - void stackAt(int idx); - int indexForChild(QSimpleCanvasItem *); QRect itemBoundingRect(); @@ -166,8 +150,6 @@ public: QRectF boundingRect() const; virtual void paintContents(QPainter &); - void update(); - virtual QSimpleCanvasLayer *layer(); bool hasChildren() const; @@ -178,12 +160,10 @@ public: QPointF mapToScene(const QPointF &) const; QRectF mapToScene(const QRectF &) const; - QSimpleCanvas::Matrix transform() const; - void setTransform(const QSimpleCanvas::Matrix &); + QTransform transform() const; + void setTransform(const QTransform &); QSimpleCanvasItem *mouseGrabberItem() const; - void ungrabMouse(); - void grabMouse(); virtual bool isFocusable() const; void setFocusable(bool); @@ -202,6 +182,7 @@ public: static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); protected: + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); virtual void addChild(QSimpleCanvasItem *); @@ -215,6 +196,8 @@ protected: public: // Events + virtual bool sceneEvent(QEvent *); + virtual QVariant itemChange(GraphicsItemChange, const QVariant &); virtual bool mouseFilter(QGraphicsSceneMouseEvent *); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); @@ -241,6 +224,7 @@ private: public: QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent); + }; Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItem::Options) diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index a062054..39a1c48 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -43,6 +43,7 @@ #define QSIMPLECANVASITEM_P_H #include "private/qobject_p.h" +#include "private/qgraphicsitem_p.h" #include "qsimplecanvas.h" #include "qsimplecanvasitem.h" @@ -50,60 +51,6 @@ QT_BEGIN_NAMESPACE -class QSimpleGraphicsItem : public QGraphicsItem -{ -public: - QSimpleGraphicsItem(QSimpleCanvasItem *); - virtual ~QSimpleGraphicsItem(); - - virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - virtual QRectF boundingRect() const; - - QTransform transform; -protected: - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual bool sceneEvent(QEvent *); - virtual QVariant itemChange(GraphicsItemChange, const QVariant &); - virtual void keyPressEvent(QKeyEvent *event); - virtual void keyReleaseEvent(QKeyEvent *event); - virtual void focusInEvent(QFocusEvent *event); - -private: - friend class QSimpleCanvasItem; - QSimpleCanvasItem *owner; -}; - -class QSimpleCanvasItemData -{ -public: - QSimpleCanvasItemData(); - ~QSimpleCanvasItemData(); - - // 5 bits is all that's needed to store Qt::MouseButtons - int buttons:5; - QSimpleCanvasItem::Flip flip:2; - bool dirty:1; - bool transformValid:1; - bool doNotPaint:1; - bool doNotPaintChildren:1; - - qreal x; - qreal y; - qreal z; - float visible; - - QSimpleCanvas::Matrix *transformUser; - QSimpleCanvas::Matrix transformActive; - int transformVersion; - - float activeOpacity; - - QRect lastPaintRect; -}; - class QSimpleCanvasItemDebuggerStatus : public QmlDebuggerStatus { public: @@ -121,7 +68,7 @@ public: }; class QGraphicsQSimpleCanvasItem; -class QSimpleCanvasItemPrivate : public QObjectPrivate +class QSimpleCanvasItemPrivate : public QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QSimpleCanvasItem) public: @@ -131,9 +78,8 @@ public: origin(QSimpleCanvasItem::TopLeft), options(QSimpleCanvasItem::NoOption), focusable(false), wantsActiveFocusPanelPendingCanvas(false), hasBeenActiveFocusPanel(false), - hasFocus(false), hasActiveFocus(false), needsZOrder(false), - widthValid(false), heightValid(false), width(0), height(0), paintmargin(0), scale(1), - graphicsItem(0), data_ptr(0) + hasFocus(false), hasActiveFocus(false), + widthValid(false), heightValid(false), width(0), height(0), paintmargin(0), scale(1) { } @@ -156,7 +102,6 @@ public: bool hasBeenActiveFocusPanel:1; bool hasFocus:1; bool hasActiveFocus:1; - bool needsZOrder:1; bool widthValid:1; bool heightValid:1; @@ -168,39 +113,16 @@ public: qreal paintmargin; qreal scale; - QSimpleGraphicsItem *graphicsItem; - inline QSimpleCanvasItemData *data() const { - if (!data_ptr) data_ptr = new QSimpleCanvasItemData; - return data_ptr; - } - mutable QSimpleCanvasItemData *data_ptr; + QTransform transform; void gvRemoveMouseFilter(); void gvAddMouseFilter(); void canvasChanged(QSimpleCanvas *newCanvas, QSimpleCanvas *oldCanvas); - void freshenTransforms() const; - - QPointF adjustFrom(const QPointF &) const; - QRectF adjustFrom(const QRectF &) const; - QPointF adjustTo(const QPointF &) const; - QRectF adjustTo(const QRectF &) const; - QPointF transformOrigin() const; void setParentInternal(QSimpleCanvasItem *); - void convertToGraphicsItem(QGraphicsItem * = 0); - - void paint(QPainter &); - void paintChild(QPainter &, QSimpleCanvasItem *); - QRect setupPainting(int version, const QRect &bounding); - - QSimpleCanvasItem *nextOpaque; - - void zOrderChildren(); - bool freshenNeeded() const; - void doFreshenTransforms() const; // Debugging int dump(int); diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 09d6178..d25b679 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -223,7 +223,7 @@ void QFxAnchorsPrivate::addDepend(QFxItem *item) if (!item) return; QFxItemPrivate *p = - static_cast(QObjectPrivate::get(item)); + static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.append(q); } @@ -233,7 +233,7 @@ void QFxAnchorsPrivate::remDepend(QFxItem *item) if (!item) return; QFxItemPrivate *p = - static_cast(QObjectPrivate::get(item)); + static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.removeAll(q); } diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/fx/qfxanimatedimageitem.h index 5d115d7..8ef2b1c 100644 --- a/src/declarative/fx/qfxanimatedimageitem.h +++ b/src/declarative/fx/qfxanimatedimageitem.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QFxAnimatedImageItem) - Q_DECLARE_PRIVATE(QFxAnimatedImageItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxAnimatedImageItem) }; QML_DECLARE_TYPE(QFxAnimatedImageItem) diff --git a/src/declarative/fx/qfxcomponentinstance.h b/src/declarative/fx/qfxcomponentinstance.h index e749272..97b8b7b 100644 --- a/src/declarative/fx/qfxcomponentinstance.h +++ b/src/declarative/fx/qfxcomponentinstance.h @@ -78,7 +78,7 @@ protected: QFxComponentInstance(QFxComponentInstancePrivate &dd, QFxItem *parent); private: - Q_DECLARE_PRIVATE(QFxComponentInstance) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxComponentInstance) }; QML_DECLARE_TYPE(QFxComponentInstance) diff --git a/src/declarative/fx/qfxcontentwrapper.h b/src/declarative/fx/qfxcontentwrapper.h index d8fe0b8..f1678d0 100644 --- a/src/declarative/fx/qfxcontentwrapper.h +++ b/src/declarative/fx/qfxcontentwrapper.h @@ -71,7 +71,7 @@ protected: QFxContentWrapper(QFxContentWrapperPrivate &dd, QFxItem *parent); private: - Q_DECLARE_PRIVATE(QFxContentWrapper) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxContentWrapper) }; QML_DECLARE_TYPE(QFxContentWrapper) diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index 77aaf50..71e409e 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -184,7 +184,7 @@ protected: private: Q_DISABLE_COPY(QFxFlickable) - Q_DECLARE_PRIVATE(QFxFlickable) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxFlickable) }; QML_DECLARE_TYPE(QFxFlickable) diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 0957c2f..d6222f3 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -219,7 +219,7 @@ void QFxFlipablePrivate::setBackTransform() p3 = axisRotation.transform().map(p3); axisRotation.setAngle(rotation); - QSimpleCanvas::Matrix mat; + QTransform mat; mat.translate(back->width()/2,back->height()/2); if (back->width() && p1.x() >= p2.x()) mat.rotate(180, Qt::YAxis); @@ -284,7 +284,7 @@ QFxFlipable::Side QFxFlipable::side() const //in some cases the user may want to specify a more complex transformation. //in that case, we still allow the generic use of transform. //(the logic here should be kept in sync with setBackTransform and setRotation) -void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) +void QFxFlipable::transformChanged(const QTransform &trans) { Q_D(QFxFlipable); QPointF p1(0, 0); @@ -308,7 +308,7 @@ void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) if (newSide != d->current) { d->current = newSide; if (d->current==Back) { - QSimpleCanvas::Matrix mat; + QTransform mat; mat.translate(d->back->width()/2,d->back->height()/2); if (d->back->width() && p1.x() >= p2.x()) mat.rotate(180, Qt::YAxis); diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h index f00e023..5a6271b 100644 --- a/src/declarative/fx/qfxflipable.h +++ b/src/declarative/fx/qfxflipable.h @@ -84,7 +84,7 @@ public: Side side() const; protected: - virtual void transformChanged(const QSimpleCanvas::Matrix &); + virtual void transformChanged(const QTransform &); Q_SIGNALS: void sideChanged(); @@ -92,7 +92,7 @@ Q_SIGNALS: private: Q_PRIVATE_SLOT(d_func(), void _q_updateAxis()) Q_DISABLE_COPY(QFxFlipable) - Q_DECLARE_PRIVATE(QFxFlipable) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxFlipable) }; QML_DECLARE_TYPE(QFxFlipable) diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 1514451..954f4eb 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -54,7 +54,7 @@ class QFxGridViewPrivate; class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable { Q_OBJECT - Q_DECLARE_PRIVATE(QFxGridView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxGridView) Q_PROPERTY(QVariant model READ model WRITE setModel) Q_CLASSINFO("DefaultProperty", "delegate") diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index 039334a..e2205e5 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -111,7 +111,7 @@ private Q_SLOTS: private: Q_DISABLE_COPY(QFxImage) - Q_DECLARE_PRIVATE(QFxImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxImage) void setGridScaledImage(const QFxGridScaledImage& sci); }; QML_DECLARE_TYPE(QFxImage) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index b4de109..7938c63 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1070,52 +1070,6 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, } } -/*! - \qmlproperty bool Item::flipVertically - \qmlproperty bool Item::flipHorizontally - - When set, the item will be displayed flipped horizontally or vertically - about its center. - */ - -/*! - \property QFxItem::flipVertically - - When set, the item will be displayed flipped horizontally or vertically - about its center. - */ -bool QFxItem::flipVertically() const -{ - return flip() & VerticalFlip; -} - -void QFxItem::setFlipVertically(bool v) -{ - if (v) - setFlip((QSimpleCanvasItem::Flip)(flip() | VerticalFlip)); - else - setFlip((QSimpleCanvasItem::Flip)(flip() & ~VerticalFlip)); -} - -/*! - \property QFxItem::flipHorizontally - - When set, the item will be displayed flipped horizontally or vertically - about its center. - */ -bool QFxItem::flipHorizontally() const -{ - return flip() & HorizontalFlip; -} - -void QFxItem::setFlipHorizontally(bool v) -{ - if (v) - setFlip((QSimpleCanvasItem::Flip)(flip() | HorizontalFlip)); - else - setFlip((QSimpleCanvasItem::Flip)(flip() & ~HorizontalFlip)); -} - /*! \fn void QFxItem::keyPress(QFxKeyEvent *event) This signal is emitted by keyPressEvent() for the \a event. */ @@ -2035,7 +1989,7 @@ void QFxItem::reparentItems() void QFxItem::updateTransform() { Q_D(QFxItem); - QSimpleCanvas::Matrix trans; + QTransform trans; for (int ii = d->_transform.count() - 1; ii >= 0; --ii) { QFxTransform *a = d->_transform.at(ii); if (!a->isIdentity()) @@ -2049,7 +2003,7 @@ void QFxItem::updateTransform() /*! \internal */ -void QFxItem::transformChanged(const QSimpleCanvas::Matrix &) +void QFxItem::transformChanged(const QTransform &) { } diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 3188516..ef69fd3 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -117,8 +117,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(qreal y READ y WRITE setY NOTIFY topChanged) Q_PROPERTY(qreal z READ z WRITE setZ) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(bool flipVertically READ flipVertically WRITE setFlipVertically) - Q_PROPERTY(bool flipHorizontally READ flipHorizontally WRITE setFlipHorizontally) Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) Q_PROPERTY(int baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QFxAnchorLine left READ left) @@ -173,11 +171,6 @@ public: QUrl qml() const; void setQml(const QUrl &); - bool flipVertically() const; - void setFlipVertically(bool); - bool flipHorizontally() const; - void setFlipHorizontally(bool); - int baselineOffset() const; void setBaselineOffset(int); @@ -231,7 +224,7 @@ Q_SIGNALS: void newChildCreated(const QString &url, QScriptValue); protected: - virtual void transformChanged(const QSimpleCanvas::Matrix &); + virtual void transformChanged(const QTransform &); virtual void classBegin(); virtual void classComplete(); virtual void componentComplete(); @@ -264,7 +257,7 @@ private: friend class QmlStatePrivate; friend class QFxAnchors; Q_DISABLE_COPY(QFxItem) - Q_DECLARE_PRIVATE(QFxItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxItem) }; QML_DECLARE_TYPE(QFxItem) diff --git a/src/declarative/fx/qfxlayouts.h b/src/declarative/fx/qfxlayouts.h index b119d6f..abf4bb2 100644 --- a/src/declarative/fx/qfxlayouts.h +++ b/src/declarative/fx/qfxlayouts.h @@ -115,7 +115,7 @@ private: void applyTransition(const QList >& changes, QFxItem* target, QmlTransition* transition); Q_DISABLE_COPY(QFxBaseLayout) - Q_DECLARE_PRIVATE(QFxBaseLayout) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxBaseLayout) }; class Q_DECLARATIVE_EXPORT QFxVerticalLayout : public QFxBaseLayout diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 5dfb0e4..7fa2050 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -55,7 +55,7 @@ class QFxListViewPrivate; class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable { Q_OBJECT - Q_DECLARE_PRIVATE(QFxListView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxListView) Q_ENUMS(CurrentItemPositioning) Q_PROPERTY(QVariant model READ model WRITE setModel) diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h index d7db1dc..d8586e9 100644 --- a/src/declarative/fx/qfxmouseregion.h +++ b/src/declarative/fx/qfxmouseregion.h @@ -152,7 +152,7 @@ protected: private: Q_DISABLE_COPY(QFxMouseRegion) - Q_DECLARE_PRIVATE(QFxMouseRegion) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxMouseRegion) }; QML_DECLARE_TYPE(QFxMouseRegion) diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h index ed254ce..35f8f89 100644 --- a/src/declarative/fx/qfxpainteditem.h +++ b/src/declarative/fx/qfxpainteditem.h @@ -82,7 +82,7 @@ protected Q_SLOTS: private: void init(); Q_DISABLE_COPY(QFxPaintedItem) - Q_DECLARE_PRIVATE(QFxPaintedItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxPaintedItem) }; QML_DECLARE_TYPE(QFxPaintedItem) diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h index a0373d7..bb84df2 100644 --- a/src/declarative/fx/qfxparticles.h +++ b/src/declarative/fx/qfxparticles.h @@ -221,7 +221,7 @@ private Q_SLOTS: private: Q_DISABLE_COPY(QFxParticles) - Q_DECLARE_PRIVATE(QFxParticles) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxParticles) }; QML_DECLARE_TYPE(QFxParticles) diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index cbdafa8..a40f1f2 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -125,7 +125,7 @@ private: friend class QFxPathViewAttached; static QHash attachedProperties; Q_DISABLE_COPY(QFxPathView) - Q_DECLARE_PRIVATE(QFxPathView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxPathView) }; QML_DECLARE_TYPE(QFxPathView) diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index d232328..eee1f86 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -176,7 +176,7 @@ protected: private: Q_DISABLE_COPY(QFxRect) - Q_DECLARE_PRIVATE(QFxRect) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxRect) }; QML_DECLARE_TYPE(QFxRect) diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 0211ebb..a6d68cb 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -62,7 +62,7 @@ QFxItem *QFxRepeaterPrivate::addItem(QmlContext *ctxt, QFxItem *lastItem) QFxItem *item = qobject_cast(nobj); if (item) { item->setParent(q->itemParent()); - item->stackUnder(lastItem); +// item->stackUnder(lastItem); deletables << nobj; } else { delete nobj; diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h index c1b194a..17ffa57 100644 --- a/src/declarative/fx/qfxrepeater.h +++ b/src/declarative/fx/qfxrepeater.h @@ -78,7 +78,7 @@ protected: private: Q_DISABLE_COPY(QFxRepeater) - Q_DECLARE_PRIVATE(QFxRepeater) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxRepeater) }; QML_DECLARE_TYPE(QFxRepeater) diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index 35e8b03..83e7299 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -138,7 +138,7 @@ protected: private: Q_DISABLE_COPY(QFxText) - Q_DECLARE_PRIVATE(QFxText) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxText) }; QML_DECLARE_TYPE(QFxText) diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index b761a1b..920bd04 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -200,7 +200,7 @@ private: friend class QmlFont; Q_DISABLE_COPY(QFxTextEdit) - Q_DECLARE_PRIVATE(QFxTextEdit) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxTextEdit) }; QML_DECLARE_TYPE(QFxTextEdit) diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index 8d9084f..8973295 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -71,9 +71,9 @@ bool QFxTransform::isIdentity() const return true; } -QSimpleCanvas::Matrix QFxTransform::transform() const +QTransform QFxTransform::transform() const { - return QSimpleCanvas::Matrix(); + return QTransform(); } void QFxTransform::update() diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h index 0a17917..a549b30 100644 --- a/src/declarative/fx/qfxtransform.h +++ b/src/declarative/fx/qfxtransform.h @@ -62,7 +62,7 @@ public: void update(); virtual bool isIdentity() const; - virtual QSimpleCanvas::Matrix transform() const; + virtual QTransform transform() const; }; QML_DECLARE_TYPE(QFxTransform) @@ -127,7 +127,7 @@ public: void setAngle(qreal); virtual bool isIdentity() const; - virtual QSimpleCanvas::Matrix transform() const; + virtual QTransform transform() const; Q_SIGNALS: void angleChanged(); @@ -140,7 +140,7 @@ private: qreal _angle; mutable bool _dirty; - mutable QSimpleCanvas::Matrix _transform; + mutable QTransform _transform; }; QML_DECLARE_TYPE(QFxRotation) @@ -160,7 +160,7 @@ public: void setAngle(qreal); virtual bool isIdentity() const; - virtual QSimpleCanvas::Matrix transform() const; + virtual QTransform transform() const; private Q_SLOTS: void update(); @@ -169,7 +169,7 @@ private: qreal _angle; mutable bool _dirty; - mutable QSimpleCanvas::Matrix _transform; + mutable QTransform _transform; }; QML_DECLARE_TYPE(QFxRotation3D) @@ -189,7 +189,7 @@ public: void setDistance(qreal); virtual bool isIdentity() const; - virtual QSimpleCanvas::Matrix transform() const; + virtual QTransform transform() const; private Q_SLOTS: void update(); @@ -198,7 +198,7 @@ private: qreal _distance; mutable bool _dirty; - mutable QSimpleCanvas::Matrix _transform; + mutable QTransform _transform; }; QML_DECLARE_TYPE(QFxTranslation3D) @@ -296,7 +296,7 @@ public: void setbottomRight_x(qreal); virtual bool isIdentity() const; - virtual QSimpleCanvas::Matrix transform() const; + virtual QTransform transform() const; private: QPointF p; diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index f30fd0d..115bddc 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -205,7 +205,7 @@ private: void init(); virtual void componentComplete(); Q_DISABLE_COPY(QFxWebView) - Q_DECLARE_PRIVATE(QFxWebView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxWebView) }; QML_DECLARE_TYPE(QFxWebView) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index b9e7041..10e03de 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -426,6 +426,10 @@ public: // Optional stacking order int globalStackingOrder; QGraphicsItem *q_ptr; + + static QGraphicsItemPrivate *get(QGraphicsItem *o) { + return o->d_func(); + } }; struct QGraphicsItemPrivate::TransformData { -- cgit v0.12 From c1283b68d5b02afb5f225d455ae057753b91a5b9 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Jun 2009 14:21:45 +1000 Subject: Remove simple canvas --- src/declarative/canvas/canvas.pri | 12 - src/declarative/canvas/qsimplecanvas.cpp | 859 ------------- src/declarative/canvas/qsimplecanvas.h | 126 -- src/declarative/canvas/qsimplecanvas_p.h | 137 --- .../canvas/qsimplecanvasdebugplugin.cpp | 151 --- .../canvas/qsimplecanvasdebugplugin_p.h | 85 -- src/declarative/canvas/qsimplecanvasitem.cpp | 1274 -------------------- src/declarative/canvas/qsimplecanvasitem.h | 255 ---- src/declarative/canvas/qsimplecanvasitem_p.h | 147 --- src/declarative/declarative.pro | 2 - src/declarative/fx/fx.pri | 4 - src/declarative/fx/qfxcontentwrapper.cpp | 6 +- src/declarative/fx/qfxcontentwrapper.h | 2 +- src/declarative/fx/qfxflickable.cpp | 2 +- src/declarative/fx/qfxfocuspanel.cpp | 104 -- src/declarative/fx/qfxfocuspanel.h | 81 -- src/declarative/fx/qfxfocusrealm.cpp | 72 -- src/declarative/fx/qfxfocusrealm.h | 67 - src/declarative/fx/qfximage.cpp | 8 - src/declarative/fx/qfximage.h | 1 - src/declarative/fx/qfxitem.cpp | 585 ++++++++- src/declarative/fx/qfxitem.h | 112 +- src/declarative/fx/qfxitem_p.h | 34 +- src/declarative/fx/qfxkeyactions.cpp | 2 +- src/declarative/fx/qfxkeyproxy.cpp | 16 +- src/declarative/fx/qfxlayouts.cpp | 24 +- src/declarative/fx/qfxmouseregion.cpp | 4 +- src/declarative/fx/qfxmouseregion_p.h | 2 +- src/declarative/fx/qfxpainteditem_p.h | 1 - src/declarative/fx/qfxparticles.cpp | 16 +- src/declarative/fx/qfxparticles.h | 1 - src/declarative/fx/qfxpath.cpp | 1 + src/declarative/fx/qfxpathview_p.h | 2 +- src/declarative/fx/qfxpixmap.cpp | 1 + src/declarative/fx/qfxpixmap.h | 3 +- src/declarative/fx/qfxrect.cpp | 8 - src/declarative/fx/qfxrect.h | 2 +- src/declarative/fx/qfxrepeater.cpp | 2 +- src/declarative/fx/qfxrepeater.h | 2 +- src/declarative/fx/qfxscalegrid.h | 1 - src/declarative/fx/qfxtext.cpp | 7 - src/declarative/fx/qfxtext.h | 1 - src/declarative/fx/qfxtextedit.cpp | 10 - src/declarative/fx/qfxtextedit.h | 1 - src/declarative/fx/qfxvisualitemmodel.cpp | 1 + src/declarative/fx/qfxwebview.cpp | 8 - src/declarative/fx/qfxwebview.h | 1 - src/declarative/fx/qfxwidgetcontainer.cpp | 13 +- src/declarative/test/qfxtestengine.cpp | 463 ------- src/declarative/test/qfxtestengine.h | 85 -- src/declarative/test/qfxtestobjects.cpp | 354 ------ src/declarative/test/qfxtestobjects.h | 212 ---- src/declarative/test/qfxtestview.cpp | 82 -- src/declarative/test/qfxtestview.h | 74 -- src/declarative/test/test.pri | 9 - src/declarative/util/qfxview.cpp | 50 +- src/declarative/util/qfxview.h | 7 +- tools/qmlviewer/main.cpp | 15 +- tools/qmlviewer/qmlviewer.cpp | 29 +- tools/qmlviewer/qmlviewer.h | 4 +- 60 files changed, 736 insertions(+), 4904 deletions(-) delete mode 100644 src/declarative/canvas/canvas.pri delete mode 100644 src/declarative/canvas/qsimplecanvas.cpp delete mode 100644 src/declarative/canvas/qsimplecanvas.h delete mode 100644 src/declarative/canvas/qsimplecanvas_p.h delete mode 100644 src/declarative/canvas/qsimplecanvasdebugplugin.cpp delete mode 100644 src/declarative/canvas/qsimplecanvasdebugplugin_p.h delete mode 100644 src/declarative/canvas/qsimplecanvasitem.cpp delete mode 100644 src/declarative/canvas/qsimplecanvasitem.h delete mode 100644 src/declarative/canvas/qsimplecanvasitem_p.h delete mode 100644 src/declarative/fx/qfxfocuspanel.cpp delete mode 100644 src/declarative/fx/qfxfocuspanel.h delete mode 100644 src/declarative/fx/qfxfocusrealm.cpp delete mode 100644 src/declarative/fx/qfxfocusrealm.h delete mode 100644 src/declarative/test/qfxtestengine.cpp delete mode 100644 src/declarative/test/qfxtestengine.h delete mode 100644 src/declarative/test/qfxtestobjects.cpp delete mode 100644 src/declarative/test/qfxtestobjects.h delete mode 100644 src/declarative/test/qfxtestview.cpp delete mode 100644 src/declarative/test/qfxtestview.h delete mode 100644 src/declarative/test/test.pri diff --git a/src/declarative/canvas/canvas.pri b/src/declarative/canvas/canvas.pri deleted file mode 100644 index e7cbb9d..0000000 --- a/src/declarative/canvas/canvas.pri +++ /dev/null @@ -1,12 +0,0 @@ -SOURCES += \ - canvas/qsimplecanvas.cpp \ - canvas/qsimplecanvasitem.cpp \ - canvas/qsimplecanvasdebugplugin.cpp - -HEADERS += \ - canvas/qsimplecanvas.h \ - canvas/qsimplecanvasitem.h \ - canvas/qsimplecanvas_p.h \ - canvas/qsimplecanvasitem_p.h \ - canvas/qsimplecanvasdebugplugin_p.h - diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp deleted file mode 100644 index 327d10a..0000000 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ /dev/null @@ -1,859 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidget.h" -#include "qmutex.h" -#include "qdebug.h" -#include "qcoreapplication.h" -#include "qsimplecanvasitem.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvas_p.h" -#include "qtimer.h" -#include "qdatetime.h" -#include "qgraphicssceneevent.h" -#include "qboxlayout.h" -#include "qsimplecanvasdebugplugin_p.h" -#include "qsimplecanvas.h" - - -QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(fullUpdate, GFX_CANVAS_FULL_UPDATE); -DEFINE_BOOL_CONFIG_OPTION(continuousUpdate, GFX_CANVAS_CONTINUOUS_UPDATE); -DEFINE_BOOL_CONFIG_OPTION(useSimpleCanvas, QFX_USE_SIMPLECANVAS); - -template -class CircularList -{ -public: - CircularList() - : _first(0), _size(0) {} - - void append(const T &t) - { - int entry = (_first + _size) % s; - _array[entry] = t; - if (_size == s) - _first = (_first + 1) % s; - else - _size++; - } - - int size() const - { - return _size; - } - - T &operator[](int idx) - { - Q_ASSERT(idx < _size); - int entry = (_first + idx) % s; - return _array[entry]; - } - - void clear() - { - _first = 0; - _size = 0; - } -private: - int _first; - int _size; - T _array[s]; -}; - - -class QSimpleCanvasRootLayer : public QSimpleCanvasLayer -{ -public: - QSimpleCanvasRootLayer(QSimpleCanvas *); - virtual void addDirty(QSimpleCanvasItem *); - virtual void remDirty(QSimpleCanvasItem *); - -private: - friend class QSimpleCanvasItem; - QSimpleCanvas *_canvas; -}; - -void QSimpleCanvasRootLayer::addDirty(QSimpleCanvasItem *i) -{ -} - -void QSimpleCanvasRootLayer::remDirty(QSimpleCanvasItem *i) -{ -} - -void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel) -{ - if (q->activeFocusPanel() == panel) { - focusPanels.pop(); - - switchToFocusPanel(q->activeFocusPanel(), panel, Qt::OtherFocusReason); - panel->activePanelOutEvent(); - } else { - for (int ii = 0; ii < focusPanels.count(); ++ii) - if (focusPanels.at(ii) == panel) { - focusPanels.remove(ii); - break; - } - } -} - -void QSimpleCanvasPrivate::switchToFocusPanel(QSimpleCanvasItem *panel, QSimpleCanvasItem *wasPanel, Qt::FocusReason focusReason) -{ - if (panel) - panel->activePanelInEvent(); - - QSimpleCanvasItem *wasFocusRoot = focusPanelData.value(wasPanel); - if (wasFocusRoot) - clearActiveFocusItem(wasFocusRoot, focusReason); - - QSimpleCanvasItem *newFocusRoot = focusPanelData.value(panel); - if (newFocusRoot) - setFocusItem(newFocusRoot, focusReason); -} - -void QSimpleCanvasPrivate::setActiveFocusPanel(QSimpleCanvasItem *panel, Qt::FocusReason focusReason) -{ - if (q->activeFocusPanel() == panel) - return; - - if (panel) { - for (int ii = 0; ii < focusPanels.count(); ++ii) - if (focusPanels.at(ii) == panel) { - focusPanels.remove(ii); - break; - } - } - QSimpleCanvasItem *old = q->activeFocusPanel(); - if (panel) - focusPanels << panel; - switchToFocusPanel(panel, old, focusReason); - if (old) - old->activePanelOutEvent(); -} - -void QSimpleCanvasPrivate::clearActiveFocusItem(QSimpleCanvasItem *item, - Qt::FocusReason focusReason) -{ - if (!item || !item->d_func()) - return; - - if (!item->d_func()->hasActiveFocus) - return; - - item->d_func()->hasActiveFocus = false; - if (item->options() & QSimpleCanvasItem::IsFocusRealm) { - QSimpleCanvasItem *newItem = focusPanelData.value(item); - if (newItem) { - clearActiveFocusItem(newItem, focusReason); - } else { - focusItem = 0; - QFocusEvent event(QEvent::FocusOut, focusReason); - item->focusOutEvent(&event); - } - } else { - focusItem = 0; - QFocusEvent event(QEvent::FocusOut, focusReason); - item->focusOutEvent(&event); - } - - if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){ - if (q->testAttribute(Qt::WA_InputMethodEnabled)) - q->setAttribute(Qt::WA_InputMethodEnabled,false); - } - item->activeFocusChanged(true); -} - -void QSimpleCanvasPrivate::setActiveFocusItem(QSimpleCanvasItem *item, - Qt::FocusReason focusReason) -{ - while(true) { - item->d_func()->setActiveFocus(true); - item->activeFocusChanged(true); - if (item->options() & QSimpleCanvasItem::IsFocusRealm) { - QSimpleCanvasItem *newItem = focusPanelData.value(item); - if (newItem) - item = newItem; - else - break; - } else { - break; - } - } - - if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){ - if (!q->testAttribute(Qt::WA_InputMethodEnabled)) - q->setAttribute(Qt::WA_InputMethodEnabled,true); - } - focusItem = item; - QFocusEvent event(QEvent::FocusIn, focusReason); - focusItem->focusInEvent(&event); -} - -void QSimpleCanvasPrivate::clearFocusItem(QSimpleCanvasItem *item) -{ - // XXX -#if 0 - while(item->focusProxy()) - item = item->focusProxy(); -#endif - - QSimpleCanvasItem *scope = 0; - QSimpleCanvasItem *citem = item; - while(citem && !scope) { - if (citem->options() & QSimpleCanvasItem::IsFocusPanel) - scope = citem; - else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm) - scope = citem; - citem = citem->parent(); - } - Q_ASSERT(scope); // At the very least we'll find the canvas root - - bool isActive = false; - - if (scope->options() & QSimpleCanvasItem::IsFocusPanel) - isActive = (scope == q->activeFocusPanel()); - else if (scope->options() & QSimpleCanvasItem::IsFocusRealm) - isActive = scope->hasActiveFocus(); - - if (isActive) clearActiveFocusItem(item, Qt::OtherFocusReason); - item->d_func()->setFocus(false); - item->focusChanged(false); - - focusPanelData.insert(scope, 0); - - if (lastFocusItem == item) - lastFocusItem = 0; - if (focusItem == item) - focusItem = 0; - - if (scope->options() & QSimpleCanvasItem::IsFocusRealm && scope->hasActiveFocus()) { - setActiveFocusItem(scope, Qt::OtherFocusReason); - } else { - QSimpleCanvasItem *item = QSimpleCanvasItem::findNextFocus(scope); - if (item) - item->setFocus(true); - } -} - -void QSimpleCanvasPrivate::setFocusItem(QSimpleCanvasItem *item, - Qt::FocusReason focusReason, - bool overwrite) -{ - Q_ASSERT(item); - - // XXX -#if 0 - while(item->focusProxy()) - item = item->focusProxy(); -#endif - - if (item == focusItem) - return; - - QSimpleCanvasItem *scope = 0; - QSimpleCanvasItem *citem = item; - while(citem && !scope) { - if (citem->options() & QSimpleCanvasItem::IsFocusPanel) - scope = citem; - else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm) - scope = citem; - citem = citem->parent(); - } - Q_ASSERT(scope); // At the very least we'll find the canvas root - - if (!overwrite && focusPanelData.contains(scope)) { - item->d_func()->setFocus(false); - item->focusChanged(false); - return; - } - - QSimpleCanvasItem *oldFocus = focusPanelData.value(scope); - bool isActive = false; - - if (scope->options() & QSimpleCanvasItem::IsFocusPanel) - isActive = (scope == q->activeFocusPanel()); - else if (scope->options() & QSimpleCanvasItem::IsFocusRealm) - isActive = scope->hasActiveFocus(); - - if (oldFocus) { - if (isActive) clearActiveFocusItem(oldFocus, focusReason); - oldFocus->d_func()->setFocus(false); - oldFocus->focusChanged(false); - } - - focusPanelData.insert(scope, item); - - if (isActive) - lastFocusItem = item; - - if (item) { - item->d_func()->setFocus(true); - item->focusChanged(true); - if (isActive) - setActiveFocusItem(item, focusReason); - } -} - - -bool QSimpleCanvas::eventFilter(QObject *obj, QEvent *event) -{ - Q_UNUSED(obj); - switch (event->type()) { - case QEvent::GraphicsSceneMouseMove: { - QGraphicsSceneMouseEvent *me = (QGraphicsSceneMouseEvent*)event; - if (!me->buttons()) - break; - } - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: { - //same logic as filter() function - for (int ii = 0; ii < d->mouseFilters.count(); ++ii) { - if (d->mouseFilters.at(ii)->mouseFilter((QGraphicsSceneMouseEvent*)event)) - return true; - } - break; - } - default: - break; - } - return false; -} - -void QSimpleCanvasPrivate::installMouseFilter(QSimpleCanvasItem *item) -{ - mouseFilters << item; -} - -void QSimpleCanvasPrivate::removeMouseFilter(QSimpleCanvasItem *item) -{ - mouseFilters.removeAll(item); -} - -bool QSimpleCanvasPrivate::filter(QMouseEvent *e) -{ - if (mouseFilters.isEmpty()) - return false; - - QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, e->pos()); - for (int ii = 0; ii < mouseFilters.count(); ++ii) { - if (mouseFilters.at(ii)->mouseFilter(me)) { - delete me; - return true; - } - } - delete me; - return false; -} - -QGraphicsSceneMouseEvent *QSimpleCanvasPrivate::mouseEventToSceneMouseEvent(QMouseEvent *e, const QPoint &item) -{ - QEvent::Type t; - switch(e->type()) { - default: - case QEvent::MouseButtonPress: - t = QEvent::GraphicsSceneMousePress; - break; - case QEvent::MouseButtonRelease: - t = QEvent::GraphicsSceneMouseRelease; - break; - case QEvent::MouseMove: - t = QEvent::GraphicsSceneMouseMove; - break; - case QEvent::MouseButtonDblClick: - t = QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick; - break; - } - - QGraphicsSceneMouseEvent *me = new QGraphicsSceneMouseEvent(t); - me->setButton(e->button()); - me->setButtons(e->buttons()); - me->setModifiers(e->modifiers()); - me->setPos(item); - me->setScreenPos(e->pos()); - me->setScenePos(e->pos()); - return me; -} - -bool QSimpleCanvasPrivate::deliverMousePress(QSimpleCanvasItem *base, QMouseEvent *e, bool seenChildFilter) -{ - if (base->clipType()) { - QRectF br = base->boundingRect(); - QPointF pos = base->mapFromScene(e->pos()); - if (!br.contains(pos.toPoint())) - return false; - } - - const QList &children = base->d_func()->children; - - if (base->options() & QSimpleCanvasItem::ChildMouseFilter) - seenChildFilter = true; - - for (int ii = children.count() - 1; ii >= 0; --ii) { - if (children.at(ii)->visible() != 0.) - if (deliverMousePress(children.at(ii), e, seenChildFilter)) - return true; - } - - if (base->acceptedMouseButtons() & e->button() || base->options() & QSimpleCanvasItem::ChildMouseFilter) { - - QRectF br = base->boundingRect(); - QPoint pos = base->mapFromScene(e->pos()).toPoint(); - - if (br.contains(pos)) { - QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, pos); - - sendMouseEvent(base, me); - bool isAccepted = me->isAccepted(); - delete me; - if (isAccepted) { - lastMouseItem = base; - return true; - } - } - } - return false; -} - -// Delivers e to item -void QSimpleCanvasPrivate::sendMouseEvent(QSimpleCanvasItem *item, QGraphicsSceneMouseEvent *e) -{ - QSimpleCanvasItem *p = item->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(e)) - return; - } - p = p->parent(); - } - switch(e->type()) { - case QEvent::GraphicsSceneMousePress: - item->mousePressEvent(e); - break; - case QEvent::GraphicsSceneMouseRelease: - item->mouseReleaseEvent(e); - break; - case QEvent::GraphicsSceneMouseMove: - item->mouseMoveEvent(e); - break; - case QEvent::GraphicsSceneMouseDoubleClick: - item->mouseDoubleClickEvent(e); - break; - default: - break; - } -} - - -QSimpleCanvasRootLayer::QSimpleCanvasRootLayer(QSimpleCanvas *c) -: _canvas(c) -{ - QSimpleCanvasItem::d_func()->canvas = c; - setOptions(IsFocusPanel); - update(); -} - - -struct QSimpleCanvasTiming -{ - QSimpleCanvasTiming() - : time(-1), paintTime(-1), timeBetweenFrames(-1) {} - QSimpleCanvasTiming(const QRegion &_r, int _time, int _paintTime, - int _timeBetweenFrames) - : region(_r), time(_time), paintTime(_paintTime), - timeBetweenFrames(_timeBetweenFrames) {} - QSimpleCanvasTiming(const QSimpleCanvasTiming &other) - : region(other.region), time(other.time), paintTime(other.paintTime), - timeBetweenFrames(other.timeBetweenFrames) {} - QSimpleCanvasTiming &operator=(const QSimpleCanvasTiming &other) { - region = other.region; time = other.time; paintTime = other.paintTime; - timeBetweenFrames = other.timeBetweenFrames; return *this; - } - QRegion region; - int time; - int paintTime; - int timeBetweenFrames; -}; - -// XXX -static CircularList gfxCanvasTiming; - -void QSimpleCanvasGraphicsView::paintEvent(QPaintEvent *pe) -{ - QRegion r = pe->region(); - int tbf = canvas->frameTimer.restart(); - - canvas->lrpTimer.start(); - QGraphicsView::paintEvent(pe); - canvas->lrpTime = canvas->lrpTimer.elapsed(); - - int frametimer = canvas->frameTimer.elapsed(); - gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, canvas->lrpTime, tbf)); - canvas->lrpTime = 0; - if (canvas->debugPlugin) - canvas->debugPlugin->addTiming(canvas->lrpTime, frametimer, tbf); -} - -void QSimpleCanvasGraphicsView::focusInEvent(QFocusEvent *) -{ -} - -/*! - \internal - \class QSimpleCanvas - \brief The QSimpleCanvas class implements the canvas used by Qt Declarative - */ - -QSimpleCanvas::QSimpleCanvas(CanvasMode mode, QWidget *parent) -: QWidget(parent), d(new QSimpleCanvasPrivate(this)) -{ - d->init(mode); -} - -QSimpleCanvas::QSimpleCanvas(QWidget *parent) -: QWidget(parent), d(new QSimpleCanvasPrivate(this)) -{ - d->init(useSimpleCanvas()?SimpleCanvas:GraphicsView); -} - -void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode) -{ - mode = QSimpleCanvas::GraphicsView; - this->mode = mode; - - if (mode == QSimpleCanvas::SimpleCanvas) - qWarning("QSimpleCanvas: Using simple canvas"); - else - qWarning("QSimpleCanvas: Using GraphicsView canvas"); - - if (fullUpdate()) - qWarning("QSimpleCanvas: Full update enabled"); - if (continuousUpdate()) - qWarning("QSimpleCanvas: Continuous update enabled"); - - if (QmlDebugServerPlugin::isDebuggingEnabled()) { - debugPlugin = new QSimpleCanvasDebugPlugin(q); - new QSimpleCanvasSceneDebugPlugin(q); - } - - root = new QSimpleCanvasRootLayer(q); - root->setActiveFocusPanel(true); - q->setFocusPolicy(Qt::StrongFocus); - - if (mode == QSimpleCanvas::GraphicsView) { - view = new QSimpleCanvasGraphicsView(this); - QHBoxLayout *layout = new QHBoxLayout(q); - layout->setSpacing(0); - layout->setContentsMargins(0, 0, 0, 0); - q->setLayout(layout); - layout->addWidget(view); - view->setOptimizationFlags(QGraphicsView::DontSavePainterState); - view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view->setFrameStyle(0); - view->scene()->addItem(root); - - // These seem to give the best performance - view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - view->scene()->setItemIndexMethod(QGraphicsScene::NoIndex); - view->viewport()->setFocusPolicy(Qt::NoFocus); - } -} - -QSimpleCanvas::~QSimpleCanvas() -{ - delete d->root; - delete d; -} - -QSimpleCanvas::CanvasMode QSimpleCanvas::canvasMode() const -{ - return d->mode; -} - -QSimpleCanvasItem *QSimpleCanvas::root() -{ - return d->root; -} - -void QSimpleCanvas::keyPressEvent(QKeyEvent *event) -{ - if (d->focusItem) - d->focusItem->keyPressEvent(event); - QWidget::keyPressEvent(event); -} - -void QSimpleCanvas::keyReleaseEvent(QKeyEvent *event) -{ - if (d->focusItem) - d->focusItem->keyReleaseEvent(event); - QWidget::keyReleaseEvent(event); -} - -void QSimpleCanvas::inputMethodEvent(QInputMethodEvent *event) -{ - if (d->focusItem) - d->focusItem->inputMethodEvent(event); - else - QWidget::inputMethodEvent(event); -} - -QVariant QSimpleCanvas::inputMethodQuery(Qt::InputMethodQuery query) const -{ - if (d->focusItem) - return d->focusItem->inputMethodQuery(query); - return QWidget::inputMethodQuery(query); -} - -void QSimpleCanvas::mousePressEvent(QMouseEvent *e) -{ - if (d->isSimpleCanvas() && - (d->filter(e) || d->deliverMousePress(d->root, e))) { - e->accept(); - } else { - QWidget::mousePressEvent(e); - } -} - -void QSimpleCanvas::mouseDoubleClickEvent(QMouseEvent *e) -{ - if (d->isSimpleCanvas() && - (d->filter(e) || d->deliverMousePress(d->root, e))) { - e->accept(); - } else { - QWidget::mouseDoubleClickEvent(e); - } -} - -void QSimpleCanvas::mouseMoveEvent(QMouseEvent *e) -{ - if (d->isSimpleCanvas() && d->filter(e)) { - e->accept(); - } else if (d->isSimpleCanvas() && d->lastMouseItem) { - QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint(); - QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p); - d->sendMouseEvent(d->lastMouseItem, me); - e->setAccepted(me->isAccepted()); - delete me; - } else { - QWidget::mouseMoveEvent(e); - } -} - -void QSimpleCanvas::mouseReleaseEvent(QMouseEvent *e) -{ - if (d->isSimpleCanvas() && d->filter(e)) { - e->accept(); - } else if (d->isSimpleCanvas() && d->lastMouseItem) { - QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint(); - QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p); - d->sendMouseEvent(d->lastMouseItem, me); - d->lastMouseItem->mouseUngrabEvent(); - e->setAccepted(me->isAccepted()); - delete me; - d->lastMouseItem = 0; - } else { - QWidget::mouseReleaseEvent(e); - } -} - -void QSimpleCanvas::focusInEvent(QFocusEvent *event) -{ - // XXX -#if 0 - if (d->lastFocusItem && event->reason() == Qt::ActiveWindowFocusReason) { - d->setFocusItem(d->lastFocusItem, event->reason()); - } else { - QSimpleCanvasItem *panel = activeFocusPanel(); - QSimpleCanvasItem *focusItem = 0; - if (panel->isFocusable()) - focusItem = panel; - else - focusItem = QSimpleCanvasItem::findNextFocus(panel); - - if (focusItem) - d->setFocusItem(focusItem, event->reason()); - else - QWidget::focusNextPrevChild(true); - } -#endif - QWidget::focusInEvent(event); -} - -void QSimpleCanvas::focusOutEvent(QFocusEvent *event) -{ - // XXX -#if 0 - if (event->reason() == Qt::ActiveWindowFocusReason) { - d->lastFocusItem = activeFocusPanel(); - d->setActiveFocusPanel(0, Qt::ActiveWindowFocusReason); - } -#endif - QWidget::focusOutEvent(event); -} - -bool QSimpleCanvas::focusNextPrevChild(bool) -{ - // XXX -#if 0 - if (d->focusItem) { - QSimpleCanvasItem *item = next ? QSimpleCanvasItem::findNextFocus(d->focusItem) : QSimpleCanvasItem::findPrevFocus(d->focusItem); - if (item) { - d->setFocusItem(item, - next ? Qt::TabFocusReason : Qt::BacktabFocusReason); - return true; - } - } - - QSimpleCanvasItem *panel = activeFocusPanel(); - QSimpleCanvasItem *item = 0; - if (panel->isFocusable()) - item = panel; - else - item = next ? QSimpleCanvasItem::findNextFocus(panel) : QSimpleCanvasItem::findPrevFocus(panel); - if (item && item != d->focusItem) { - d->setFocusItem(item, - next ? Qt::TabFocusReason : Qt::BacktabFocusReason); - return true; - } - - if (d->focusItem) - d->setActiveFocusPanel(0, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); - -#endif - return false; -} - - -void QSimpleCanvas::showEvent(QShowEvent *e) -{ - if (d->isGraphicsView()) - d->view->setSceneRect(rect()); - - QWidget::showEvent(e); -} - -void QSimpleCanvas::resizeEvent(QResizeEvent *e) -{ - if (d->isGraphicsView()) - d->view->setSceneRect(rect()); - QWidget::resizeEvent(e); -} - -void QSimpleCanvas::queueUpdate() -{ - if (!d->timer) { - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); - d->timer = 1; - } -} - -QSimpleCanvasItem *QSimpleCanvas::focusItem() const -{ - return d->focusItem; -} - -QSimpleCanvasItem *QSimpleCanvas::activeFocusPanel() const -{ - if (d->focusPanels.isEmpty()) - return 0; - else - return d->focusPanels.top(); -} - -QSimpleCanvasItem *QSimpleCanvas::focusItem(QSimpleCanvasItem *item) const -{ - while (item && d->focusPanelData.contains(item)) - item = d->focusPanelData.value(item); - return item; -} - -bool QSimpleCanvas::event(QEvent *e) -{ - if (e->type() == QEvent::ShortcutOverride) { - if (QSimpleCanvasItem *focus = focusItem()) - return focus->event(e); - } - - return QWidget::event(e); -} - -void QSimpleCanvas::dumpTiming() -{ - for (int ii = 0; ii < gfxCanvasTiming.size(); ++ii) { - const QSimpleCanvasTiming &t = gfxCanvasTiming[ii]; - - qreal repaintFps = 1000. / qreal(t.time); - qreal paintFps = 1000. / qreal(t.paintTime); - qreal tbfFps = 1000. / qreal(t.timeBetweenFrames); - - qWarning() << "repaint():" << t.time << "ms," << repaintFps << "fps. paint():" << t.paintTime << "ms," << paintFps << "fps. timeSinceLastFrame:" << t.timeBetweenFrames << "ms," << tbfFps << "fps."; - qWarning() << t.region; - } - gfxCanvasTiming.clear(); -} - -void QSimpleCanvas::dumpItems() -{ - int items = d->root->d_func()->dump(0); - qWarning() << "Total:" << items; -} - -void QSimpleCanvas::checkState() -{ - if (d->isSimpleCanvas()) { - QSimpleCanvasItemPrivate::FocusStateCheckRDatas r; - if (d->root->d_func()->checkFocusState(0, &r)) - qWarning() << "State OK"; - } -} - -/*! - Returns canvas as an image. Not a fast operation. -*/ -QImage QSimpleCanvas::asImage() const -{ - QImage img(width(),height(),QImage::Format_RGB32); - QPainter p(&img); - d->view->render(&p); - return img; -} -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h deleted file mode 100644 index b260017..0000000 --- a/src/declarative/canvas/qsimplecanvas.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVAS_H -#define QSIMPLECANVAS_H - -#include - -#include -#include -#include -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QSimpleCanvas; -class QSimpleCanvasLayer; - -class QGraphicsSceneMouseEvent; -class QSimpleCanvasItem; -class QSimpleCanvasPrivate; -class Q_DECLARATIVE_EXPORT QSimpleCanvas : public QWidget -{ -Q_OBJECT -public: - enum CanvasMode { GraphicsView, SimpleCanvas }; - - QSimpleCanvas(QWidget *parent = 0); - QSimpleCanvas(CanvasMode, QWidget *parent = 0); - virtual ~QSimpleCanvas(); - - CanvasMode canvasMode() const; - - QSimpleCanvasItem *root(); - - // Debugging - void dumpTiming(); - void dumpItems(); - void checkState(); - - QSimpleCanvasItem *focusItem() const; - QSimpleCanvasItem *focusItem(QSimpleCanvasItem *item) const; - - QSimpleCanvasItem *activeFocusPanel() const; - QImage asImage() const; - -Q_SIGNALS: - void framePainted(); - -protected: - virtual bool event(QEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseDoubleClickEvent(QMouseEvent *); - virtual void mouseMoveEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void focusInEvent(QFocusEvent *event); - virtual void focusOutEvent(QFocusEvent *event); - virtual bool focusNextPrevChild(bool next); - virtual bool eventFilter(QObject *obj, QEvent *event); - virtual void inputMethodEvent(QInputMethodEvent *event); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - - virtual void showEvent(QShowEvent *); - virtual void resizeEvent(QResizeEvent *); -private: - - friend class QSimpleCanvasRootLayer; - friend class QSimpleCanvasPrivate; - friend class QSimpleCanvasItem; - friend class QSimpleCanvasItemPrivate; - - void queueUpdate(); - QSimpleCanvasPrivate *d; -}; - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h deleted file mode 100644 index 33c889f..0000000 --- a/src/declarative/canvas/qsimplecanvas_p.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVAS_P_H -#define QSIMPLECANVAS_P_H - -#include "qsimplecanvas.h" -#include "qsimplecanvasitem.h" -#include -#include - - -#include -#include - -struct QSimpleCanvasGraphicsView : public QGraphicsView -{ -public: - QSimpleCanvasGraphicsView(QSimpleCanvasPrivate *parent); - ~QSimpleCanvasGraphicsView(); - -protected: - virtual void paintEvent(QPaintEvent *); - virtual void focusInEvent(QFocusEvent *); - -private: - QSimpleCanvasPrivate *canvas; - QGraphicsScene _scene; -}; - -class QSimpleCanvasDebugPlugin; -class QSimpleCanvasPrivate -{ -public: - QSimpleCanvasPrivate(QSimpleCanvas *canvas) - : q(canvas), timer(0), root(0), lrpTime(0), debugPlugin(0), focusItem(0), - lastFocusItem(0), lastMouseItem(0), - isSetup(false), view(0) - , paintVersion(1) - { - } - - QSimpleCanvas *q; - QSimpleCanvas::CanvasMode mode; - bool isSimpleCanvas() const { return mode == QSimpleCanvas::SimpleCanvas; } - bool isGraphicsView() const { return mode == QSimpleCanvas::GraphicsView; } - - QRect oldDirty; - - QSimpleCanvasItem *opaqueList; - - int timer; - - QSimpleCanvasLayer *root; - QList dirtyItems; - int lrpTime; - - QTime frameTimer; - QTime lrpTimer; - - QSimpleCanvasDebugPlugin *debugPlugin; - - QStack focusPanels; - QHash focusPanelData; - QSimpleCanvasItem *focusItem; - QSimpleCanvasItem *lastFocusItem; - - QRect dirtyItemClip() const; - void clearFocusPanel(QSimpleCanvasItem *); - void setActiveFocusPanel(QSimpleCanvasItem *, Qt::FocusReason focusReason = Qt::OtherFocusReason); - void switchToFocusPanel(QSimpleCanvasItem *, QSimpleCanvasItem *, Qt::FocusReason focusReason); - - void setFocusItem(QSimpleCanvasItem *item, Qt::FocusReason focusReason, - bool overwrite = true); - void clearFocusItem(QSimpleCanvasItem *item); - - void clearActiveFocusItem(QSimpleCanvasItem *, Qt::FocusReason focusReason); - void setActiveFocusItem(QSimpleCanvasItem *, Qt::FocusReason focusReason); - void installMouseFilter(QSimpleCanvasItem *); - void removeMouseFilter(QSimpleCanvasItem *); - QList mouseFilters; - bool filter(QMouseEvent *e); - bool deliverMousePress(QSimpleCanvasItem *, QMouseEvent *, bool = false); - QGraphicsSceneMouseEvent *mouseEventToSceneMouseEvent(QMouseEvent *, const QPoint &); - QSimpleCanvasItem *lastMouseItem; - void sendMouseEvent(QSimpleCanvasItem *, QGraphicsSceneMouseEvent *); - - bool isSetup; - - void init(QSimpleCanvas::CanvasMode mode); - - QSimpleCanvasGraphicsView *view; - - int paintVersion; -}; - -#endif - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp deleted file mode 100644 index 81bfbfa..0000000 --- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvasdebugplugin_p.h" -#include "qdebug.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class FrameBreakAnimation : public QAbstractAnimation -{ -public: - FrameBreakAnimation(QSimpleCanvasDebugPlugin *s) - : QAbstractAnimation(s), server(s) - { - start(); - } - - virtual int duration() const { return -1; } - virtual void updateCurrentTime(int msecs) { - Q_UNUSED(msecs); - server->frameBreak(); - } - -private: - QSimpleCanvasDebugPlugin *server; -}; - -QSimpleCanvasDebugPlugin::QSimpleCanvasDebugPlugin(QObject *parent) -: QmlDebugServerPlugin(QLatin1String("CanvasFrameRate"), parent), _breaks(0) -{ - _time.start(); - new FrameBreakAnimation(this); -} - -void QSimpleCanvasDebugPlugin::addTiming(quint32 paint, - quint32 repaint, - quint32 timeBetweenFrames) -{ - if (!isEnabled()) - return; - - bool isFrameBreak = _breaks > 1; - _breaks = 0; - int e = _time.elapsed(); - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << (int)paint << (int)repaint << (int)timeBetweenFrames << (int)e - << (bool)isFrameBreak; - sendMessage(data); -} - -void QSimpleCanvasDebugPlugin::frameBreak() -{ - _breaks++; -} - -QSimpleCanvasSceneDebugPlugin::QSimpleCanvasSceneDebugPlugin(QSimpleCanvas *parent) -: QmlDebugServerPlugin(QLatin1String("CanvasScene"), parent), m_canvas(parent) -{ -} - -void QSimpleCanvasSceneDebugPlugin::messageReceived(const QByteArray &) -{ - refresh(); -} - -void QSimpleCanvasSceneDebugPlugin::refresh() -{ - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - const QList &children = m_canvas->root()->children(); - ds << children.count(); - for (int ii = 0; ii < children.count(); ++ii) - refresh(ds, children.at(ii)); - - sendMessage(data); -} - -void QSimpleCanvasSceneDebugPlugin::refresh(QDataStream &ds, - QSimpleCanvasItem *item) -{ - ds << QmlDebugServerPlugin::objectToString(item) << item->x() << item->y() - << item->z() << item->width() << item->height() - << (int)item->transformOrigin() << item->scale() << (int)0 - << item->transform() - << item->hasActiveFocus() << (int)item->options(); - - QPixmap pix; - - if(item->options() & QSimpleCanvasItem::HasContents && - item->width() > 0 && item->height() > 0) { - - pix = QPixmap(item->width(), item->height()); - pix.fill(QColor(0,0,0,0)); - QPainter p(&pix); - item->paintContents(p); - - } - - ds << pix; - - const QList &children = item->children(); - ds << children.count(); - - for(int ii = 0; ii < children.count(); ++ii) - refresh(ds, children.at(ii)); -} - -QT_END_NAMESPACE - diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin_p.h b/src/declarative/canvas/qsimplecanvasdebugplugin_p.h deleted file mode 100644 index 270b78c..0000000 --- a/src/declarative/canvas/qsimplecanvasdebugplugin_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVASDEBUGPLUGIN_P_H -#define QSIMPLECANVASDEBUGPLUGIN_P_H - -#include "qobject.h" -#include "qtcpserver.h" -#include "qtcpsocket.h" -#include "qdatetime.h" -#include - -QT_BEGIN_NAMESPACE -class QSimpleCanvasDebugPlugin : public QmlDebugServerPlugin -{ -public: - QSimpleCanvasDebugPlugin(QObject *parent = 0); - - void addTiming(quint32, quint32, quint32); - -private: - friend class FrameBreakAnimation; - void frameBreak(); - int _breaks; - QTime _time; -}; - -class QSimpleCanvas; -class QSimpleCanvasItem; -class QSimpleCanvasSceneDebugPlugin : public QmlDebugServerPlugin -{ -public: - QSimpleCanvasSceneDebugPlugin(QSimpleCanvas *parent = 0); - - virtual void messageReceived(const QByteArray &); - -private: - void refresh(); - void refresh(QDataStream &, QSimpleCanvasItem *); - QSimpleCanvas *m_canvas; -}; - - -QT_END_NAMESPACE - -#endif // QSIMPLECANVASDEBUGPLUGIN_P_H - diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp deleted file mode 100644 index 65c0a45..0000000 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ /dev/null @@ -1,1274 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimplecanvasitem.h" -#include "qsimplecanvas.h" -#include "qsimplecanvasitem_p.h" -#include "qsimplecanvas_p.h" -#include -#include - - -QT_BEGIN_NAMESPACE - -static QHash sceneMap; - -QSimpleCanvasGraphicsView::QSimpleCanvasGraphicsView(QSimpleCanvasPrivate *parent) -: QGraphicsView(parent->q), canvas(parent) -{ - setScene(&_scene); - sceneMap[&_scene] = parent->q; - setFrameShape(QFrame::NoFrame); - viewport()->setAttribute(Qt::WA_OpaquePaintEvent); -} - -QSimpleCanvasGraphicsView::~QSimpleCanvasGraphicsView() -{ - sceneMap.remove(&_scene); -} - - -/*! - \internal - \class QSimpleCanvasItem - \brief The QSimpleCanvasItem class is the base class of canvas items. - */ -QSimpleCanvasLayer::QSimpleCanvasLayer() -{ -} - -QSimpleCanvasLayer::QSimpleCanvasLayer(QSimpleCanvasItem *parent) -: QSimpleCanvasItem(parent) -{ -} - -void QSimpleCanvasLayer::addChild(QSimpleCanvasItem *c) -{ - QSimpleCanvasItem::addChild(c); -} - -void QSimpleCanvasLayer::addDirty(QSimpleCanvasItem *) -{ -} - -void QSimpleCanvasLayer::remDirty(QSimpleCanvasItem *) -{ -} - -QSimpleCanvasLayer *QSimpleCanvasLayer::layer() -{ - return this; -} - -QSimpleCanvasItem::Options QSimpleCanvasItem::options() const -{ - Q_D(const QSimpleCanvasItem); - return (QSimpleCanvasItem::Options)d->options; -} - -bool QSimpleCanvasItem::mouseFilter(QGraphicsSceneMouseEvent *) -{ - return false; -} - -bool QSimpleCanvasItem::sceneEvent(QEvent *event) -{ - bool rv = QGraphicsItem::sceneEvent(event); - if (event->type() == QEvent::UngrabMouse) - mouseUngrabEvent(); - return rv; -} - -QVariant QSimpleCanvasItem::itemChange(GraphicsItemChange change, - const QVariant &value) -{ - Q_D(QSimpleCanvasItem); - if (change == ItemSceneHasChanged) { - QSimpleCanvas *oldCanvas = d->canvas; - d->canvas = sceneMap[scene()]; - if (d->canvas){ - if (hasFocus()) - canvas()->d->setFocusItem(this, Qt::OtherFocusReason); - if (options() & QSimpleCanvasItem::IsFocusPanel) { - if (d->wantsActiveFocusPanelPendingCanvas) { - d->hasBeenActiveFocusPanel = true; - canvas()->d->setActiveFocusPanel(this); - d->wantsActiveFocusPanelPendingCanvas = false; - } - } - } - if (options() & QSimpleCanvasItem::MouseFilter) - d->gvRemoveMouseFilter(); - - if (oldCanvas != d->canvas) - canvasChanged(); - - if (options() & QSimpleCanvasItem::MouseFilter) - d->gvAddMouseFilter(); - } - - return QGraphicsItem::itemChange(change, value); -} - - -void QSimpleCanvasItem::mousePressEvent(QGraphicsSceneMouseEvent *e) -{ -#if 0 - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mousePressEvent(event); -#endif - e->ignore(); -} - -void QSimpleCanvasItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) -{ -#if 0 - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } - owner->mouseReleaseEvent(event); - ungrabMouse(); -#endif - e->ignore(); -} - -void QSimpleCanvasItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) -{ -#if 0 - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } -#endif - e->ignore(); -} - -void QSimpleCanvasItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) -{ -#if 0 - QSimpleCanvasItem *p = owner->parent(); - while(p) { - if (p->options() & QSimpleCanvasItem::ChildMouseFilter) { - if (p->mouseFilter(event)) - return; - } - p = p->parent(); - } -#endif - e->ignore(); -} - -void QSimpleCanvasItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) -{ - e->ignore(); -} - -void QSimpleCanvasItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) -{ - e->ignore(); -} - -void QSimpleCanvasItem::mouseUngrabEvent() -{ -} - -void QSimpleCanvasItem::keyPressEvent(QKeyEvent *e) -{ - e->ignore(); -} - -void QSimpleCanvasItem::keyReleaseEvent(QKeyEvent *e) -{ - e->ignore(); -} - -void QSimpleCanvasItem::focusOutEvent(QFocusEvent *e) -{ - e->ignore(); -} - -void QSimpleCanvasItem::focusInEvent(QFocusEvent *e) -{ - if (!hasFocus()) - setFocus(true); - e->ignore(); -} - -void QSimpleCanvasItem::activePanelInEvent() -{ -} - -void QSimpleCanvasItem::activePanelOutEvent() -{ -} - -void QSimpleCanvasItem::inputMethodEvent(QInputMethodEvent *e) -{ - e->ignore(); -} - -QVariant QSimpleCanvasItem::inputMethodQuery(Qt::InputMethodQuery) const -{ - return QVariant(); -} - -void QSimpleCanvasItem::childrenChanged() -{ -} - -void QSimpleCanvasItem::setPaintMargin(qreal margin) -{ - Q_D(QSimpleCanvasItem); - if (margin < d->paintmargin) - update(); // schedule repaint of old boundingRect - d->paintmargin = margin; -} - -QRectF QSimpleCanvasItem::boundingRect() const -{ - Q_D(const QSimpleCanvasItem); - return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); -} - -void QSimpleCanvasItem::paintContents(QPainter &) -{ -} - -void QSimpleCanvasItem::canvasChanged() -{ -} - -void QSimpleCanvasItem::focusChanged(bool) -{ -} - -void QSimpleCanvasItem::activeFocusChanged(bool) -{ -} - -void QSimpleCanvasItem::parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *) -{ -} - -/*! - Returns the item's (0, 0) point relative to its parent. - */ -QPointF QSimpleCanvasItem::pos() const -{ - return QPointF(x(),y()); -} - -/*! - Returns the item's (0, 0) point mapped to scene coordinates. - */ -QPointF QSimpleCanvasItem::scenePos() const -{ - return mapToScene(QPointF(0, 0)); -} - -/*! - \enum QSimpleCanvasItem::TransformOrigin - - Controls the point about which simple transforms like scale apply. - - \value TopLeft The top-left corner of the item. - \value TopCenter The center point of the top of the item. - \value TopRight The top-right corner of the item. - \value MiddleLeft The left most point of the vertical middle. - \value Center The center of the item. - \value MiddleRight The right most point of the vertical middle. - \value BottomLeft The bottom-left corner of the item. - \value BottomCenter The center point of the bottom of the item. - \value BottomRight The bottom-right corner of the item. -*/ - -/*! - Returns the current transform origin. -*/ -QSimpleCanvasItem::TransformOrigin QSimpleCanvasItem::transformOrigin() const -{ - Q_D(const QSimpleCanvasItem); - return d->origin; -} - -/*! - Set the transform \a origin. -*/ -void QSimpleCanvasItem::setTransformOrigin(TransformOrigin origin) -{ - Q_D(QSimpleCanvasItem); - if (origin != d->origin) { - d->origin = origin; - update(); - } -} - -QPointF QSimpleCanvasItem::transformOriginPoint() const -{ - Q_D(const QSimpleCanvasItem); - return d->transformOrigin(); -} - -/*! - Returns the canvas the item is on, or 0 if the item is not on a canvas. - */ -QSimpleCanvas *QSimpleCanvasItem::canvas() const -{ - Q_D(const QSimpleCanvasItem); - return d->canvas; -} - -/*! - Returns the parent if the item, or 0 if the item has no parent. - */ -QSimpleCanvasItem *QSimpleCanvasItem::parent() const -{ - Q_D(const QSimpleCanvasItem); - return d->parent; -} - -void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCanvas *oldCanvas) -{ - Q_Q(QSimpleCanvasItem); - canvas = newCanvas; - if (options & QSimpleCanvasItem::MouseFilter) { - if (oldCanvas) oldCanvas->d->removeMouseFilter(q); - if (newCanvas) newCanvas->d->installMouseFilter(q); - } - if (newCanvas) { - if (!oldCanvas && hasFocus) - newCanvas->d->setFocusItem(q, Qt::OtherFocusReason, false); - if (wantsActiveFocusPanelPendingCanvas) { - hasBeenActiveFocusPanel = true; - newCanvas->d->setActiveFocusPanel(q); - wantsActiveFocusPanelPendingCanvas = false; - } - } - - for (int ii = 0; ii < children.count(); ++ii) - children.at(ii)->d_func()->canvasChanged(newCanvas, oldCanvas); - q->canvasChanged(); -} - -void QSimpleCanvasItem::setFocus(bool focus) -{ - Q_D(QSimpleCanvasItem); - if (d->hasFocus == focus) - return; - QSimpleCanvas *c = canvas(); - - if (c) { - if (focus) - c->d->setFocusItem(this, Qt::OtherFocusReason); - else - c->d->clearFocusItem(this); - } else { - d->setFocus(focus); - focusChanged(d->hasFocus); - } -} - -qreal QSimpleCanvasItem::z() const -{ - Q_D(const QSimpleCanvasItem); - return zValue(); -} - -void QSimpleCanvasItem::setX(qreal x) -{ - Q_D(QSimpleCanvasItem); - if (x == this->x()) - return; - - qreal oldX = this->x(); - - QGraphicsItem::setPos(x, y()); - - geometryChanged(QRectF(this->x(), y(), width(), height()), - QRectF(oldX, y(), width(), height())); -} - -void QSimpleCanvasItem::setY(qreal y) -{ - if (y == this->y()) - return; - - qreal oldY = this->y(); - - QGraphicsItem::setPos(x(), y); - - geometryChanged(QRectF(x(), this->y(), width(), height()), - QRectF(x(), oldY, width(), height())); -} - -void QSimpleCanvasItem::setZ(qreal z) -{ - if (z == this->z()) - return; - - if (z < 0) - setFlag(QGraphicsItem::ItemStacksBehindParent, true); - else - setFlag(QGraphicsItem::ItemStacksBehindParent, false); - - setZValue(z); -} - -qreal QSimpleCanvasItem::width() const -{ - Q_D(const QSimpleCanvasItem); - return d->width; -} - -void QSimpleCanvasItem::setWidth(qreal w) -{ - Q_D(QSimpleCanvasItem); - d->widthValid = true; - if (d->width == w) - return; - - qreal oldWidth = d->width; - - d->width = w; - update(); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(x(), y(), oldWidth, height())); -} - -void QSimpleCanvasItem::setImplicitWidth(qreal w) -{ - Q_D(QSimpleCanvasItem); - if (d->width == w || widthValid()) - return; - - qreal oldWidth = d->width; - - d->width = w; - update(); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(x(), y(), oldWidth, height())); -} - -bool QSimpleCanvasItem::widthValid() const -{ - Q_D(const QSimpleCanvasItem); - return d->widthValid; -} - -qreal QSimpleCanvasItem::height() const -{ - Q_D(const QSimpleCanvasItem); - return d->height; -} - -void QSimpleCanvasItem::setHeight(qreal h) -{ - Q_D(QSimpleCanvasItem); - d->heightValid = true; - if (d->height == h) - return; - - qreal oldHeight = d->height; - - d->height = h; - update(); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(x(), y(), width(), oldHeight)); -} - -void QSimpleCanvasItem::setImplicitHeight(qreal h) -{ - Q_D(QSimpleCanvasItem); - if (d->height == h || heightValid()) - return; - - qreal oldHeight = d->height; - - d->height = h; - update(); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(x(), y(), width(), oldHeight)); -} - -bool QSimpleCanvasItem::heightValid() const -{ - Q_D(const QSimpleCanvasItem); - return d->heightValid; -} - -void QSimpleCanvasItem::setPos(const QPointF &point) -{ - qreal oldX = x(); - qreal oldY = y(); - - QGraphicsItem::setPos(point); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(oldX, oldY, width(), height())); -} - -qreal QSimpleCanvasItem::scale() const -{ - Q_D(const QSimpleCanvasItem); - return d->scale; -} - -void QSimpleCanvasItem::setScale(qreal s) -{ - Q_D(QSimpleCanvasItem); - d->scale = s; - QTransform t; - QPointF to = transformOriginPoint(); - if (to.x() != 0. || to.y() != 0.) - t.translate(to.x(), to.y()); - t.scale(s, s); - if (to.x() != 0. || to.y() != 0.) - t.translate(-to.x(), -to.y()); - setTransform(t * d->transform); -} - -bool QSimpleCanvasItem::isVisible() const -{ - if (visible() <= 0) - return false; - else if (!parent()) - return true; - else - return parent()->isVisible(); -} - -qreal QSimpleCanvasItem::visible() const -{ - return opacity(); -} - -void QSimpleCanvasItem::setVisible(qreal v) -{ - setOpacity(v); -} - -void QSimpleCanvasItem::addChild(QSimpleCanvasItem *c) -{ - Q_D(QSimpleCanvasItem); - d->children.append(c); - childrenChanged(); -} - -void QSimpleCanvasItem::remChild(QSimpleCanvasItem *c) -{ - Q_D(QSimpleCanvasItem); - d->children.removeAll(c); - childrenChanged(); -} - -const QList &QSimpleCanvasItem::children() const -{ - Q_D(const QSimpleCanvasItem); - return d->children; -} - -bool QSimpleCanvasItem::hasChildren() const -{ - Q_D(const QSimpleCanvasItem); - return !d->children.isEmpty(); -} - -QSimpleCanvasLayer *QSimpleCanvasItem::layer() -{ - if (parent()) - return parent()->layer(); - else - return 0; -} - -bool QSimpleCanvasItem::clip() const -{ - Q_D(const QSimpleCanvasItem); - return d->clip; -} - -void QSimpleCanvasItem::setClip(bool c) -{ - Q_D(const QSimpleCanvasItem); - if (bool(d->clip) == c) - return; - - if (c) - setClipType(ClipToRect); - else - setClipType(NoClip); - - update(); -} - -QSimpleCanvasItem::ClipType QSimpleCanvasItem::clipType() const -{ - Q_D(const QSimpleCanvasItem); - return d->clip; -} - -void QSimpleCanvasItem::setClipType(ClipType c) -{ - Q_D(QSimpleCanvasItem); - d->clip = c; - setFlag(QGraphicsItem::ItemClipsChildrenToShape, bool(c)); -} - -QRect QSimpleCanvasItem::itemBoundingRect() -{ - return boundingRect().toAlignedRect(); -} - -QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const -{ - return QGraphicsItem::mapFromScene(p); -} - -QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const -{ - return QGraphicsItem::mapFromScene(r).boundingRect(); -} - -QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const -{ - return QGraphicsItem::mapToScene(p); -} - -QRectF QSimpleCanvasItem::mapToScene(const QRectF &r) const -{ - return QGraphicsItem::mapToScene(r).boundingRect(); -} - -QTransform QSimpleCanvasItem::transform() const -{ - Q_D(const QSimpleCanvasItem); - return d->transform; -} - -void QSimpleCanvasItem::setTransform(const QTransform &m) -{ - Q_D(QSimpleCanvasItem); - d->transform = m; - QGraphicsItem::setTransform(QTransform::fromScale(d->scale, d->scale) * d->transform); -} - -QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const -{ - QGraphicsScene *s = scene(); - if (s) { - QGraphicsItem *item = s->mouseGrabberItem(); - return static_cast(item); // ### - } - return 0; -} - -bool QSimpleCanvasItem::isFocusable() const -{ - Q_D(const QSimpleCanvasItem); - return d->focusable; -} - -void QSimpleCanvasItem::setFocusable(bool f) -{ - Q_D(QSimpleCanvasItem); - d->focusable = f; -} - -bool QSimpleCanvasItem::hasFocus() const -{ - Q_D(const QSimpleCanvasItem); - return d->hasFocus; -} - -void QSimpleCanvasItemPrivate::setFocus(bool f) -{ - hasFocus = f; -} - -void QSimpleCanvasItemPrivate::setActiveFocus(bool f) -{ - Q_Q(QSimpleCanvasItem); - hasActiveFocus = f; - - if (f) { - if (!(q->flags() & QGraphicsItem::ItemIsFocusable)) - q->setFlag(QGraphicsItem::ItemIsFocusable); - q->QGraphicsItem::setFocus(); - } else { - q->clearFocus(); - if ((q->flags() & QGraphicsItem::ItemIsFocusable) && !focusable) - q->setFlag(QGraphicsItem::ItemIsFocusable, false); - } -} - -bool QSimpleCanvasItem::eventFilter(QObject *o, QEvent *e) -{ - switch(e->type()) { - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: - if (mouseFilter(static_cast(e))) - return true; - break; - default: - break; - } - - return QObject::eventFilter(o, e); -} - -void QSimpleCanvasItem::setOptions(Options options, bool set) -{ - Q_D(QSimpleCanvasItem); - Options old = (Options)d->options; - - if (options & IsFocusPanel) { - if (!set) { - qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusPanel"); - return; - } else if (hasChildren()) { - qWarning("QSimpleCanvasItem::setOptions: Cannot set IsFocusPanel once item has children"); - return; - } - } - - if (options & IsFocusRealm) { - if (!set) { - qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusRealm"); - return; - } - } - - if (set) - d->options |= options; - else - d->options &= ~options; - - if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) { - qWarning("QSimpleCanvasItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset."); - d->options &= ~IsFocusRealm; - } - - setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); - - if ((old & MouseFilter) != (d->options & MouseFilter)) { - if (d->options & MouseFilter) - d->gvAddMouseFilter(); - else - d->gvRemoveMouseFilter(); - } -} - -QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent) -: QGraphicsObject(dd, parent, 0) -{ - setFlag(QGraphicsItem::ItemHasNoContents, true); -} - -QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItem *p) -: QGraphicsObject(*(new QSimpleCanvasItemPrivate), p, 0) -{ - setFlag(QGraphicsItem::ItemHasNoContents, true); -} - -QSimpleCanvasItem::~QSimpleCanvasItem() -{ - Q_D(QSimpleCanvasItem); - if ((d->options & (IsFocusPanel|IsFocusRealm)) && d->canvas) - d->canvas->d->focusPanelData.remove(this); - if (d->hasFocus && d->canvas) { - QSimpleCanvasItem *prnt = parent(); - while (prnt && !(prnt->options() & (IsFocusPanel|IsFocusRealm))) - prnt = prnt->parent(); - if (prnt && d->canvas->d->focusPanelData.value(prnt) == this) - d->canvas->d->focusPanelData.remove(prnt); - } - - qDeleteAll(children()); - if (parent()) - parent()->remChild(this); -} - -QSimpleCanvasItem::operator QGraphicsItem *() -{ - return this; -} - -QSimpleCanvasItem::operator QmlDebuggerStatus *() -{ - Q_D(QSimpleCanvasItem); - if(!d->debuggerStatus) - d->debuggerStatus = new QSimpleCanvasItemDebuggerStatus(this); - return d->debuggerStatus; -} - -QPointF QSimpleCanvasItemPrivate::transformOrigin() const -{ - Q_Q(const QSimpleCanvasItem); - - QRectF br = q->boundingRect(); - - switch(origin) { - default: - case QSimpleCanvasItem::TopLeft: - return QPointF(0, 0); - case QSimpleCanvasItem::TopCenter: - return QPointF(br.width() / 2., 0); - case QSimpleCanvasItem::TopRight: - return QPointF(br.width(), 0); - case QSimpleCanvasItem::MiddleLeft: - return QPointF(0, br.height() / 2.); - case QSimpleCanvasItem::Center: - return QPointF(br.width() / 2., br.height() / 2.); - case QSimpleCanvasItem::MiddleRight: - return QPointF(br.width(), br.height() / 2.); - case QSimpleCanvasItem::BottomLeft: - return QPointF(0, br.height()); - case QSimpleCanvasItem::BottomCenter: - return QPointF(br.width() / 2., br.height()); - case QSimpleCanvasItem::BottomRight: - return QPointF(br.width(), br.height()); - } -} - -void QSimpleCanvasItemPrivate::setParentInternal(QSimpleCanvasItem *p) -{ - Q_Q(QSimpleCanvasItem); - QSimpleCanvasItem *oldParent = parent; - if (oldParent) - oldParent->remChild(q); - - parent = p; - q->setParentItem(p); - - if (parent) - p->addChild(q); -} - -/*! - \fn void QSimpleCanvasItem::setParent(QSimpleCanvasItem *parent) - - Sets the parent of the item to \a parent. - */ -void QSimpleCanvasItem::setParent(QSimpleCanvasItem *p) -{ - Q_D(QSimpleCanvasItem); - if (p == parent() || !p) return; - - QObject::setParent(p); - - QSimpleCanvasItem *oldParent = d->parent; - d->setParentInternal(p); - parentChanged(p, oldParent); -} - -int QSimpleCanvasItemPrivate::dump(int indent) -{ - Q_Q(QSimpleCanvasItem); - QByteArray ba(indent * 2, ' '); - - QByteArray state; - if (options & QSimpleCanvasItem::MouseFilter) - state.append("i"); - else - state.append("-"); - if (options & QSimpleCanvasItem::HoverEvents) - state.append("h"); - else - state.append("-"); - if (options & QSimpleCanvasItem::MouseEvents) - state.append("m"); - else - state.append("-"); - if (options & QSimpleCanvasItem::HasContents) - state.append("c"); - else - state.append("-"); - if (options & QSimpleCanvasItem::SimpleItem) - state.append("s"); - else - state.append("-"); - if (options & QSimpleCanvasItem::IsFocusPanel) { - if (q->activeFocusPanel()) - state.append("P"); - else - state.append("p"); - } else { - state.append("-"); - } - if (options & QSimpleCanvasItem::IsFocusRealm) - state.append("r"); - else - state.append("-"); - if (q->hasFocus()) { - if (q->hasActiveFocus()) - state.append("F"); - else - state.append("f"); - } else { - if (q->hasActiveFocus()) - state.append("X"); - else - state.append("-"); - } - - QByteArray name; - QFxItem *i = qobject_cast(q); - if (i) - name = i->id().toLatin1(); - qWarning().nospace() << ba.constData() << state.constData() << " " << children.count() << " " << " " << name.constData(); - - int rv = 0; - - for (int ii = 0; ii < children.count(); ++ii) - rv += children.at(ii)->d_func()->dump(indent + 1); - - return rv + 1; -} - -bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d, - FocusStateCheckRDatas *r) -{ - Q_Q(QSimpleCanvasItem); - - bool rv = true; - bool isRealm = (options & QSimpleCanvasItem::IsFocusPanel || - options & QSimpleCanvasItem::IsFocusRealm); - - if (options & QSimpleCanvasItem::IsFocusPanel) { - - if (q->activeFocusPanel()) { - if (d & InActivePanel) { - qWarning() << "State ERROR: Nested active focus panels"; - rv = false; - } - - d |= InActivePanel; - } else { - d &= ~InActivePanel; - } - - } - - if (q->hasActiveFocus()) { - if (!(d & InActivePanel)) { - qWarning() << "State ERROR: Active focus in non-active panel"; - rv = false; - } - - if (d & InRealm && !(d & InActiveFocusedRealm)) { - qWarning() << "State ERROR: Active focus in non-active-focused realm"; - rv = false; - } - - if (!q->hasFocus()) { - qWarning() << "State ERROR: Active focus on element that does not have focus"; - rv = false; - } - - if (*r & SeenActiveFocus) { - qWarning() << "State ERROR: Two active focused elements in same realm"; - rv = false; - } - - *r |= SeenActiveFocus; - } - - if (q->hasFocus()) { - if (*r & SeenFocus) { - qWarning() << "State ERROR: Two focused elements in same realm"; - rv = false; - } - - *r |= SeenFocus; - } - - if (options & QSimpleCanvasItem::IsFocusRealm) { - d |= InRealm; - - if (q->hasActiveFocus()) - d |= InActiveFocusedRealm; - else - d &= ~InActiveFocusedRealm; - } - - FocusStateCheckRDatas newR = NoCheckRData; - if (isRealm) - r = &newR; - - for (int ii = 0; ii < children.count(); ++ii) - rv &= children.at(ii)->d_func()->checkFocusState(d, r); - - return rv; -} - -bool QSimpleCanvasItem::activeFocusPanel() const -{ - QSimpleCanvas *c = canvas(); - if (!c) { - Q_D(const QSimpleCanvasItem); - return d->wantsActiveFocusPanelPendingCanvas; - } else { - return c->activeFocusPanel() == this; - } -} - -void QSimpleCanvasItem::setActiveFocusPanel(bool b) -{ - if (!(options() & IsFocusPanel)) { - qWarning("QSimpleCanvasItem::setActiveFocusPanel: Item is not a focus panel"); - return; - } - - QSimpleCanvas *c = canvas(); - Q_D(QSimpleCanvasItem); - if (c) { - if (b) { - d->hasBeenActiveFocusPanel = true; - c->d->setActiveFocusPanel(this); - } else if (d->hasBeenActiveFocusPanel) { - d->hasBeenActiveFocusPanel = false; - c->d->clearFocusPanel(this); - } - } else { - d->wantsActiveFocusPanelPendingCanvas = b; - } -} - -bool QSimpleCanvasItem::hasActiveFocus() const -{ - Q_D(const QSimpleCanvasItem); - return d->hasActiveFocus; -} - -QSimpleCanvasItem *QSimpleCanvasItem::findFirstFocusChild() const -{ - Q_D(const QSimpleCanvasItem); - - const QList &children = d->children; - - for (int i = 0; i < children.count(); ++i) { - QSimpleCanvasItem *child = children.at(i); - if (child->options() & IsFocusPanel) - continue; - - if (child->isFocusable()) - return child; - - QSimpleCanvasItem *testFocus = child->findFirstFocusChild(); - if (testFocus) - return testFocus; - } - - return 0; -} - -QSimpleCanvasItem *QSimpleCanvasItem::findLastFocusChild() const -{ - Q_D(const QSimpleCanvasItem); - - const QList &children = d->children; - - for (int i = children.count()-1; i >= 0; --i) { - QSimpleCanvasItem *child = children.at(i); - if (child->options() & IsFocusPanel) - continue; - - if (child->isFocusable()) - return child; - QSimpleCanvasItem *testFocus = child->findLastFocusChild(); - if (testFocus) - return testFocus; - } - - return 0; -} - -QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item) -{ - QSimpleCanvasItem *focusChild = item->findLastFocusChild(); - if (focusChild) - return focusChild; - - if (item->options() & IsFocusPanel) { - if (item->isFocusable()) - return item; - else - return 0; - } - - QSimpleCanvasItem *parent = item->parent(); - while (parent) { - const QList &children = parent->d_func()->children; - - int idx = children.indexOf(item); - QSimpleCanvasItem *testFocus = 0; - if (idx > 0) { - while (--idx >= 0) { - testFocus = children.at(idx); - if (testFocus->options() & IsFocusPanel) - continue; - if (testFocus->isFocusable()) - return testFocus; - testFocus = testFocus->findLastFocusChild(); - if (testFocus) - return testFocus; - } - } - if (parent->options() & IsFocusPanel) { - if (parent->isFocusable()) - return parent; - else - return 0; - } - item = parent; - parent = parent->parent(); - } - - return 0; -} - -QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item) -{ - QSimpleCanvasItem *focusChild = item->findFirstFocusChild(); - if (focusChild) - return focusChild; - - if (item->options() & IsFocusPanel) { - if (item->isFocusable()) - return item; - else - return 0; - } - - QSimpleCanvasItem *parent = item->parent(); - while (parent) { - const QList &children = parent->d_func()->children; - - int idx = children.indexOf(item); - QSimpleCanvasItem *testFocus = 0; - if (idx >= 0) { - while (++idx < children.count()) { - testFocus = children.at(idx); - if (testFocus->options() & IsFocusPanel) - continue; - if (testFocus->isFocusable()) - return testFocus; - testFocus = testFocus->findFirstFocusChild(); - if (testFocus) - return testFocus; - } - } - if (parent->options() & IsFocusPanel) { - if (parent->isFocusable()) - return parent; - else - return 0; - } - item = parent; - parent = parent->parent(); - } - - return 0; -} - -QPixmap QSimpleCanvasItem::string(const QString &str, const QColor &c, const QFont &f) -{ - QFontMetrics fm(f); - QSize size(fm.width(str), fm.height()*(str.count(QLatin1Char('\n'))+1)); //fm.boundingRect(str).size(); - QPixmap img(size); - img.fill(Qt::transparent); - QPainter p(&img); - p.setPen(c); - p.setFont(f); - p.drawText(img.rect(), Qt::AlignVCenter, str); - return img; -} - -void QSimpleCanvasItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) -{ - paintContents(*p); -} - -void QSimpleCanvasItem::geometryChanged(const QRectF &, const QRectF &) -{ -} - -void QSimpleCanvasItemPrivate::gvRemoveMouseFilter() -{ - Q_Q(QSimpleCanvasItem); - QGraphicsScene *scene = q->scene(); - if (!scene) return; - - scene->removeEventFilter(q); -} - -void QSimpleCanvasItemPrivate::gvAddMouseFilter() -{ - Q_Q(QSimpleCanvasItem); - QGraphicsScene *scene = q->scene(); - if (!scene) return; - - scene->installEventFilter(q); -} - -QT_END_NAMESPACE diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h deleted file mode 100644 index eb7bcea..0000000 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVASITEM_H -#define QSIMPLECANVASITEM_H - -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QPainter; -class QRect; -class QSimpleCanvas; -class QMouseEvent; -class QKeyEvent; -class QSimpleCanvasItemPrivate; -class QSimpleCanvasLayer; -class QPointF; -class QRectF; -class QGraphicsSceneHoverEvent; - -class Q_DECLARATIVE_EXPORT QSimpleCanvasItem : public QGraphicsObject -{ - Q_OBJECT - Q_CAST_INTERFACES(QGraphicsItem) - Q_CAST_INTERFACES(QmlDebuggerStatus) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QSimpleCanvasItem) - Q_ENUMS(TransformOrigin) - Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) - -public: - enum ClipType { NoClip = 0x00, - ClipToHeight = 0x01, - ClipToWidth = 0x02, - ClipToRect = 0x03 }; - enum Option { NoOption = 0x00000000, - MouseFilter = 0x00000001, - ChildMouseFilter = 0x00000002, - HoverEvents = 0x00000004, - MouseEvents = 0x00000008, - HasContents = 0x00000010, - SimpleItem = 0x00000020, - IsFocusPanel = 0x00000040, - IsFocusRealm = 0x00000080, - AcceptsInputMethods = 0x00000100, - IsOpaque = 0x00000200 }; - Q_DECLARE_FLAGS(Options, Option) - - QSimpleCanvasItem(QSimpleCanvasItem *parent=0); - virtual ~QSimpleCanvasItem(); - operator QGraphicsItem *(); - operator QmlDebuggerStatus *(); - - bool clip() const; - void setClip(bool); - ClipType clipType() const; - void setClipType(ClipType); - - Options options() const; - void setOptions(Options, bool set = true); - - qreal z() const; - QPointF pos() const; - void setX(qreal); - void setY(qreal); - virtual void setZ(qreal); - void setPos(const QPointF &); - - qreal width() const; - void setWidth(qreal); - void setImplicitWidth(qreal); - bool widthValid() const; - qreal height() const; - void setHeight(qreal); - void setImplicitHeight(qreal); - bool heightValid() const; - - QPointF scenePos() const; - - enum TransformOrigin { - TopLeft, TopCenter, TopRight, - MiddleLeft, Center, MiddleRight, - BottomLeft, BottomCenter, BottomRight - }; - TransformOrigin transformOrigin() const; - void setTransformOrigin(TransformOrigin); - QPointF transformOriginPoint() const; - - - qreal scale() const; - virtual void setScale(qreal); - - qreal visible() const; - virtual void setVisible(qreal); - bool isVisible() const; - - QSimpleCanvas *canvas() const; - - QSimpleCanvasItem *parent() const; - void setParent(QSimpleCanvasItem *); - - QRect itemBoundingRect(); - - void setPaintMargin(qreal margin); - QRectF boundingRect() const; - virtual void paintContents(QPainter &); - - virtual QSimpleCanvasLayer *layer(); - - bool hasChildren() const; - const QList &children() const; - - QPointF mapFromScene(const QPointF &) const; - QRectF mapFromScene(const QRectF &) const; - QPointF mapToScene(const QPointF &) const; - QRectF mapToScene(const QRectF &) const; - - QTransform transform() const; - void setTransform(const QTransform &); - - QSimpleCanvasItem *mouseGrabberItem() const; - - virtual bool isFocusable() const; - void setFocusable(bool); - virtual bool hasFocus() const; - void setFocus(bool); - bool activeFocusPanel() const; - void setActiveFocusPanel(bool); - - bool hasActiveFocus() const; - - QSimpleCanvasItem *findFirstFocusChild() const; - QSimpleCanvasItem *findLastFocusChild() const; - static QSimpleCanvasItem *findPrevFocus(QSimpleCanvasItem *item); - static QSimpleCanvasItem *findNextFocus(QSimpleCanvasItem *item); - - static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); - -protected: - virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual void addChild(QSimpleCanvasItem *); - virtual void remChild(QSimpleCanvasItem *); - virtual void canvasChanged(); - virtual void childrenChanged(); - virtual void parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *); - virtual void focusChanged(bool); - virtual void activeFocusChanged(bool); - virtual bool eventFilter(QObject *, QEvent *); - -public: - // Events - virtual bool sceneEvent(QEvent *); - virtual QVariant itemChange(GraphicsItemChange, const QVariant &); - virtual bool mouseFilter(QGraphicsSceneMouseEvent *); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *); - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseUngrabEvent(); - virtual void keyPressEvent(QKeyEvent *event); - virtual void keyReleaseEvent(QKeyEvent *event); - virtual void focusOutEvent(QFocusEvent *e); - virtual void focusInEvent(QFocusEvent *e); - virtual void activePanelInEvent(); - virtual void activePanelOutEvent(); - virtual void inputMethodEvent(QInputMethodEvent* event); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - -private: - friend class QSimpleCanvas; - friend class QSimpleCanvasPrivate; - friend class QSimpleCanvasRootLayer; - friend class QGraphicsQSimpleCanvasItem; - friend class QSimpleGraphicsItem; - -public: - QSimpleCanvasItem(QSimpleCanvasItemPrivate &dd, QSimpleCanvasItem *parent); - -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItem::Options) - -class QSimpleCanvasLayer : public QSimpleCanvasItem -{ -public: - QSimpleCanvasLayer(QSimpleCanvasItem *parent); - - virtual void addChild(QSimpleCanvasItem *); - virtual void addDirty(QSimpleCanvasItem *); - virtual void remDirty(QSimpleCanvasItem *); - virtual QSimpleCanvasLayer *layer(); - -private: - friend class QSimpleCanvas; - friend class QSimpleCanvasRootLayer; - QSimpleCanvasLayer(); -}; - - - -#endif // _GFXCANVASITEM_H_ - - -QT_END_NAMESPACE - -QT_END_HEADER diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h deleted file mode 100644 index 39a1c48..0000000 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIMPLECANVASITEM_P_H -#define QSIMPLECANVASITEM_P_H - -#include "private/qobject_p.h" -#include "private/qgraphicsitem_p.h" -#include "qsimplecanvas.h" -#include "qsimplecanvasitem.h" - -#include "qgraphicsitem.h" - - -QT_BEGIN_NAMESPACE -class QSimpleCanvasItemDebuggerStatus : public QmlDebuggerStatus -{ -public: - QSimpleCanvasItemDebuggerStatus(QSimpleCanvasItem *i) - : item(i), selected(false) {} - - virtual void setSelectedState(bool state) - { - selected = state; - item->update(); - } - - QSimpleCanvasItem *item; - bool selected; -}; - -class QGraphicsQSimpleCanvasItem; -class QSimpleCanvasItemPrivate : public QGraphicsItemPrivate -{ - Q_DECLARE_PUBLIC(QSimpleCanvasItem) -public: - QSimpleCanvasItemPrivate() - : parent(0), canvas(0), debuggerStatus(0), - clip(QSimpleCanvasItem::NoClip), - origin(QSimpleCanvasItem::TopLeft), options(QSimpleCanvasItem::NoOption), - focusable(false), wantsActiveFocusPanelPendingCanvas(false), - hasBeenActiveFocusPanel(false), - hasFocus(false), hasActiveFocus(false), - widthValid(false), heightValid(false), width(0), height(0), paintmargin(0), scale(1) - { - } - - virtual ~QSimpleCanvasItemPrivate() - { - if(debuggerStatus) delete debuggerStatus; - } - - QSimpleCanvasItem *parent; - QSimpleCanvas *canvas; - QList children; - - QSimpleCanvasItemDebuggerStatus *debuggerStatus; - - QSimpleCanvasItem::ClipType clip:3; - QSimpleCanvasItem::TransformOrigin origin:4; - int options:10; - bool focusable:1; - bool wantsActiveFocusPanelPendingCanvas:1; - bool hasBeenActiveFocusPanel:1; - bool hasFocus:1; - bool hasActiveFocus:1; - bool widthValid:1; - bool heightValid:1; - - void setFocus(bool f); - void setActiveFocus(bool f); - - qreal width; - qreal height; - qreal paintmargin; - qreal scale; - - QTransform transform; - - void gvRemoveMouseFilter(); - void gvAddMouseFilter(); - - void canvasChanged(QSimpleCanvas *newCanvas, QSimpleCanvas *oldCanvas); - - QPointF transformOrigin() const; - - void setParentInternal(QSimpleCanvasItem *); - - // Debugging - int dump(int); - enum FocusStateCheckData { NoCheckData = 0x00, - InActivePanel = 0x01, - InRealm = 0x02, - InActiveFocusedRealm = 0x04 - }; - Q_DECLARE_FLAGS(FocusStateCheckDatas, FocusStateCheckData) - enum FocusStateCheckRData { NoCheckRData = 0x00, - SeenFocus = 0x01, - SeenActiveFocus = 0x02 }; - Q_DECLARE_FLAGS(FocusStateCheckRDatas, FocusStateCheckRData) - bool checkFocusState(FocusStateCheckDatas, FocusStateCheckRDatas *); -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItemPrivate::FocusStateCheckDatas) -Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItemPrivate::FocusStateCheckRDatas) - -#endif // QSIMPLECANVASITEM_P_H - -QT_END_NAMESPACE diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 31830a0..e2954e5 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -18,12 +18,10 @@ include(../qbase.pri) include(3rdparty/3rdparty.pri) include(util/util.pri) include(fx/fx.pri) -include(canvas/canvas.pri) include(qml/qml.pri) include(timeline/timeline.pri) include(extra/extra.pri) include(widgets/widgets.pri) -include(test/test.pri) include(debugger/debugger.pri) symbian:TARGET.UID3=0x2001E623 diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 801725d..7d8f565 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -10,8 +10,6 @@ HEADERS += \ fx/qfxflickable.h \ fx/qfxflickable_p.h \ fx/qfxflipable.h \ - fx/qfxfocuspanel.h \ - fx/qfxfocusrealm.h \ fx/qfxgridview.h \ fx/qfxflowview.h \ fx/qfximage.h \ @@ -54,8 +52,6 @@ SOURCES += \ fx/qfxevents.cpp \ fx/qfxflickable.cpp \ fx/qfxflipable.cpp \ - fx/qfxfocuspanel.cpp \ - fx/qfxfocusrealm.cpp \ fx/qfxgridview.cpp \ fx/qfxflowview.cpp \ fx/qfximage.cpp \ diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp index 482442b..1fa0fde 100644 --- a/src/declarative/fx/qfxcontentwrapper.cpp +++ b/src/declarative/fx/qfxcontentwrapper.cpp @@ -106,7 +106,7 @@ void QFxContentWrapper::componentComplete() if (content()->size() < 1) return; - QList nodes; + QList nodes; nodes.append(this); QFxItem *target = findContent(nodes); if (!target) @@ -118,9 +118,9 @@ void QFxContentWrapper::componentComplete() myContent.at(ii)->setParent(target); } -QFxItem *QFxContentWrapper::findContent(QList &nodes) +QFxItem *QFxContentWrapper::findContent(QList &nodes) { - QSimpleCanvasItem *item = nodes.takeFirst(); + QGraphicsItem *item = nodes.takeFirst(); if (qobject_cast(item)) return static_cast(item); nodes << item->children(); diff --git a/src/declarative/fx/qfxcontentwrapper.h b/src/declarative/fx/qfxcontentwrapper.h index f1678d0..898d695 100644 --- a/src/declarative/fx/qfxcontentwrapper.h +++ b/src/declarative/fx/qfxcontentwrapper.h @@ -64,7 +64,7 @@ public: private: void create(); - QFxItem *findContent(QList &nodes); + QFxItem *findContent(QList &nodes); protected: void componentComplete(); diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index bc4a5fc..f85f3dc 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -111,7 +111,7 @@ void QFxFlickablePrivate::init() QObject::connect(&_tl, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&_tl, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); - q->setOptions(QSimpleCanvasItem::ChildMouseFilter | QSimpleCanvasItem::MouseEvents); + q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents); QObject::connect(_flick, SIGNAL(leftChanged()), q, SIGNAL(positionChanged())); QObject::connect(_flick, SIGNAL(topChanged()), q, SIGNAL(positionChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp deleted file mode 100644 index 6da8564..0000000 --- a/src/declarative/fx/qfxfocuspanel.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxfocuspanel.h" - - -QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(QFxFocusPanel,FocusPanel) - -/*! - \qmlclass FocusPanel - \brief The FocusPanel object explicitly creates a focus panel. - \inherits Item - - Focus panels assist in keyboard focus handling when building QML - applications. All the details are covered in the - \l {qmlfocus}{keyboard focus documentation}. -*/ - -/*! - \internal - \class QFxFocusPanel -*/ - -QFxFocusPanel::QFxFocusPanel(QFxItem *parent) : - QFxItem(parent) -{ - setOptions(IsFocusPanel); -} - -QFxFocusPanel::~QFxFocusPanel() -{ -} - -/*! - \qmlproperty bool FocusPanel::active - - Sets whether the object is the active focus panel. -*/ - -bool QFxFocusPanel::isActive() const -{ - QSimpleCanvas *canvas = QSimpleCanvasItem::canvas(); - if (canvas) - return canvas->activeFocusPanel() == this; - else - return false; -} - -void QFxFocusPanel::setActive(bool a) -{ - setActiveFocusPanel(a); -} - -void QFxFocusPanel::activePanelInEvent() -{ - QFxItem::activePanelInEvent(); - emit activeChanged(); -} - -void QFxFocusPanel::activePanelOutEvent() -{ - QFxItem::activePanelOutEvent(); - emit activeChanged(); -} -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocuspanel.h b/src/declarative/fx/qfxfocuspanel.h deleted file mode 100644 index 60f9118..0000000 --- a/src/declarative/fx/qfxfocuspanel.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXFOCUSPANEL_H -#define QFXFOCUSPANEL_H - -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxFocusPanel : public QFxItem -{ - Q_OBJECT - Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) -public: - QFxFocusPanel(QFxItem *parent=0); - virtual ~QFxFocusPanel(); - - bool isActive() const; - void setActive(bool); - -Q_SIGNALS: - void activeChanged(); - -protected: - virtual void activePanelInEvent(); - virtual void activePanelOutEvent(); - -private: - Q_DISABLE_COPY(QFxFocusPanel) -}; - -QML_DECLARE_TYPE(QFxFocusPanel) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXFOCUSPANEL_H diff --git a/src/declarative/fx/qfxfocusrealm.cpp b/src/declarative/fx/qfxfocusrealm.cpp deleted file mode 100644 index 9270bb2..0000000 --- a/src/declarative/fx/qfxfocusrealm.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxfocusrealm.h" - - -QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(QFxFocusRealm,FocusRealm) - -/*! - \qmlclass FocusRealm - \brief The FocusRealm object explicitly creates a focus realm. - \inherits Item - - Focus realms assist in keyboard focus handling when building reusable QML - components. All the details are covered in the - \l {qmlfocus}{keyboard focus documentation}. -*/ - -/*! - \internal - \class QFxFocusRealm -*/ - -QFxFocusRealm::QFxFocusRealm(QFxItem *parent) : - QFxItem(parent) -{ - setOptions(IsFocusRealm); -} - -QFxFocusRealm::~QFxFocusRealm() -{ -} -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocusrealm.h b/src/declarative/fx/qfxfocusrealm.h deleted file mode 100644 index d2aadce..0000000 --- a/src/declarative/fx/qfxfocusrealm.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXFOCUSREALM_H -#define QFXFOCUSREALM_H - -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxFocusRealm : public QFxItem -{ - Q_OBJECT -public: - QFxFocusRealm(QFxItem *parent=0); - virtual ~QFxFocusRealm(); -}; - -QML_DECLARE_TYPE(QFxFocusRealm) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXFOCUSREALM_H diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 2ac035d..48957e5 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -305,14 +305,6 @@ void QFxImage::setSmoothTransform(bool s) update(); } -void QFxImage::dump(int depth) -{ - Q_D(QFxImage); - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "URL:" << d->url; - QFxItem::dump(depth); -} - void QFxImage::paintContents(QPainter &p) { Q_D(QFxImage); diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index e2205e5..72530ee 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -91,7 +91,6 @@ public: QUrl source() const; virtual void setSource(const QUrl &url); - virtual void dump(int depth); virtual QString propertyInfo() const; void paintContents(QPainter &painter); diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 7938c63..d4a5b06 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -151,9 +151,10 @@ void QFxContents::calcHeight() int top = INT_MAX; int bottom = 0; - const QList &children = _item->QSimpleCanvasItem::children(); + QList children = _item->childItems(); + for (int i = 0; i < children.count(); ++i) { - const QSimpleCanvasItem *child = children.at(i); + QFxItem *child = qobject_cast(children.at(i)); int y = int(child->y()); if (y + child->height() > bottom) bottom = y + child->height(); @@ -173,9 +174,10 @@ void QFxContents::calcWidth() int left = INT_MAX; int right = 0; - const QList &children = _item->QSimpleCanvasItem::children(); + QList children = _item->childItems(); + for (int i = 0; i < children.count(); ++i) { - const QSimpleCanvasItem *child = children.at(i); + QFxItem *child = qobject_cast(children.at(i)); int x = int(child->x()); if (x + child->width() > right) right = x + child->width(); @@ -192,9 +194,9 @@ void QFxContents::setItem(QFxItem *item) { _item = item; - const QList &children = _item->QSimpleCanvasItem::children(); + QList children = _item->childItems(); for (int i = 0; i < children.count(); ++i) { - const QSimpleCanvasItem *child = children.at(i); + QFxItem *child = qobject_cast(children.at(i)); connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(topChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); @@ -372,7 +374,7 @@ void QFxContents::setItem(QFxItem *item) This signal is emitted when the item's focus state changes. - \sa QSimpleCanvasItem::setFocus() + \sa QFxItem::setFocus() */ /*! @@ -381,7 +383,7 @@ void QFxContents::setItem(QFxItem *item) Constructs a QFxItem with the given \a parent. */ QFxItem::QFxItem(QFxItem* parent) - : QSimpleCanvasItem(*(new QFxItemPrivate), parent) + : QGraphicsObject(*(new QFxItemPrivate), parent, 0) { Q_D(QFxItem); d->init(parent); @@ -390,7 +392,7 @@ QFxItem::QFxItem(QFxItem* parent) /*! \internal */ QFxItem::QFxItem(QFxItemPrivate &dd, QFxItem *parent) - : QSimpleCanvasItem(dd, parent) + : QGraphicsObject(dd, parent, 0) { Q_D(QFxItem); d->init(parent); @@ -523,7 +525,12 @@ void QFxItem::moveToParent(QFxItem *parent) */ QFxItem *QFxItem::itemParent() const { - return qobject_cast(QObject::parent()); + return qobject_cast(QGraphicsItem::parentItem()); +} + +QFxItem *QFxItem::parentItem() const +{ + return itemParent(); } /*! @@ -687,7 +694,7 @@ int QFxItemPrivate::children_count() const void QFxItemPrivate::children_append(QFxItem *i) { Q_Q(QFxItem); - i->setParent(q); + i->setParentItem(q); } void QFxItemPrivate::children_insert(int, QFxItem *) @@ -775,6 +782,16 @@ QFxContents *QFxItem::contents() return d->_contents; } +bool QFxItem::clip() const +{ + return flags() & ItemClipsChildrenToShape; +} + +void QFxItem::setClip(bool c) +{ + setFlag(ItemClipsChildrenToShape, c); +} + /*! \internal \property QFxItem::qmlItem @@ -1493,18 +1510,6 @@ void QFxItem::setRotation(qreal rotation) Scaling is from the item's origin (0,0). */ -qreal QFxItem::scale() const -{ - return QSimpleCanvasItem::scale(); -} - -void QFxItem::setScale(qreal s) -{ - if (QSimpleCanvasItem::scale() == s) return; - QSimpleCanvasItem::setScale(s); - emit scaleChanged(); - update(); -} /*! \qmlproperty real Item::opacity @@ -1562,19 +1567,12 @@ void QFxItem::setScale(qreal s) also applied individually to child items. */ -qreal QFxItem::opacity() const -{ - return QSimpleCanvasItem::visible(); -} - void QFxItem::setOpacity(qreal v) { - if (v == QSimpleCanvasItem::visible()) + if (v == opacity()) return; - if (v < 0) v = 0; - else if (v > 1) v = 1; - QSimpleCanvasItem::setVisible(v); + QGraphicsItem::setOpacity(v); emit opacityChanged(); } @@ -1882,14 +1880,6 @@ void QFxItem::setVisible(bool visible) /*! \internal */ -void QFxItem::dump(int depth) -{ - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << metaObject()->className() << "(" << (void *)static_cast(this) << ", " << (void *)static_cast(this) << "):" << x() << y() << width() << height() << (void *) itemParent(); -} - -/*! \internal -*/ QString QFxItem::propertyInfo() const { return QString(); @@ -1969,20 +1959,6 @@ void QFxItem::componentComplete() updateTransform(); } -/*! \internal -*/ -void QFxItem::parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *) -{ - emit parentChanged(); -} - -/*! \internal -*/ -void QFxItem::reparentItems() -{ - qFatal("EEK"); -} - /*! \internal */ @@ -2039,4 +2015,505 @@ QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) baseline.anchorLine = QFxAnchorLine::Baseline; } +QPointF QFxItemPrivate::transformOrigin() const +{ + Q_Q(const QFxItem); + + QRectF br = q->boundingRect(); + + switch(origin) { + default: + case QFxItem::TopLeft: + return QPointF(0, 0); + case QFxItem::TopCenter: + return QPointF(br.width() / 2., 0); + case QFxItem::TopRight: + return QPointF(br.width(), 0); + case QFxItem::MiddleLeft: + return QPointF(0, br.height() / 2.); + case QFxItem::Center: + return QPointF(br.width() / 2., br.height() / 2.); + case QFxItem::MiddleRight: + return QPointF(br.width(), br.height() / 2.); + case QFxItem::BottomLeft: + return QPointF(0, br.height()); + case QFxItem::BottomCenter: + return QPointF(br.width() / 2., br.height()); + case QFxItem::BottomRight: + return QPointF(br.width(), br.height()); + } +} + +QFxItem::Options QFxItem::options() const +{ + Q_D(const QFxItem); + return (QFxItem::Options)d->options; +} + +bool QFxItem::mouseFilter(QGraphicsSceneMouseEvent *) +{ + return false; +} + +bool QFxItem::sceneEvent(QEvent *event) +{ + bool rv = QGraphicsItem::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) + mouseUngrabEvent(); + return rv; +} + +QVariant QFxItem::itemChange(GraphicsItemChange change, + const QVariant &value) +{ + Q_D(QFxItem); + if (change == ItemSceneHasChanged) { + if (options() & QFxItem::MouseFilter) + d->gvRemoveMouseFilter(); + + d->canvas = qvariant_cast(value); + + if (options() & QFxItem::MouseFilter) + d->gvAddMouseFilter(); + } else if (change == ItemChildAddedChange || + change == ItemChildRemovedChange) { + childrenChanged(); + } + + return QGraphicsItem::itemChange(change, value); +} + + +void QFxItem::mouseUngrabEvent() +{ +} + +void QFxItem::childrenChanged() +{ +} + +void QFxItem::setPaintMargin(qreal margin) +{ + Q_D(QFxItem); + if (margin < d->paintmargin) + update(); // schedule repaint of old boundingRect + d->paintmargin = margin; +} + +QRectF QFxItem::boundingRect() const +{ + Q_D(const QFxItem); + return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); +} + +void QFxItem::paintContents(QPainter &) +{ +} + +void QFxItem::parentChanged(QFxItem *, QFxItem *) +{ + emit parentChanged(); +} + +/*! + Returns the item's (0, 0) point relative to its parent. + */ +QPointF QFxItem::pos() const +{ + return QPointF(x(),y()); +} + +/*! + Returns the item's (0, 0) point mapped to scene coordinates. + */ +QPointF QFxItem::scenePos() const +{ + return mapToScene(QPointF(0, 0)); +} + +/*! + \enum QFxItem::TransformOrigin + + Controls the point about which simple transforms like scale apply. + + \value TopLeft The top-left corner of the item. + \value TopCenter The center point of the top of the item. + \value TopRight The top-right corner of the item. + \value MiddleLeft The left most point of the vertical middle. + \value Center The center of the item. + \value MiddleRight The right most point of the vertical middle. + \value BottomLeft The bottom-left corner of the item. + \value BottomCenter The center point of the bottom of the item. + \value BottomRight The bottom-right corner of the item. +*/ + +/*! + Returns the current transform origin. +*/ +QFxItem::TransformOrigin QFxItem::transformOrigin() const +{ + Q_D(const QFxItem); + return d->origin; +} + +/*! + Set the transform \a origin. +*/ +void QFxItem::setTransformOrigin(TransformOrigin origin) +{ + Q_D(QFxItem); + if (origin != d->origin) { + d->origin = origin; + update(); + } +} + +QPointF QFxItem::transformOriginPoint() const +{ + Q_D(const QFxItem); + return d->transformOrigin(); +} + +void QFxItem::setFocus(bool focus) +{ + return; +} + +qreal QFxItem::z() const +{ + Q_D(const QFxItem); + return zValue(); +} + +void QFxItem::setX(qreal x) +{ + Q_D(QFxItem); + if (x == this->x()) + return; + + qreal oldX = this->x(); + + QGraphicsItem::setPos(x, y()); + + geometryChanged(QRectF(this->x(), y(), width(), height()), + QRectF(oldX, y(), width(), height())); +} + +void QFxItem::setY(qreal y) +{ + if (y == this->y()) + return; + + qreal oldY = this->y(); + + QGraphicsItem::setPos(x(), y); + + geometryChanged(QRectF(x(), this->y(), width(), height()), + QRectF(x(), oldY, width(), height())); +} + +void QFxItem::setZ(qreal z) +{ + if (z == this->z()) + return; + + if (z < 0) + setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + setFlag(QGraphicsItem::ItemStacksBehindParent, false); + + setZValue(z); +} + +qreal QFxItem::width() const +{ + Q_D(const QFxItem); + return d->width; +} + +void QFxItem::setWidth(qreal w) +{ + Q_D(QFxItem); + d->widthValid = true; + if (d->width == w) + return; + + qreal oldWidth = d->width; + + d->width = w; + update(); + + geometryChanged(QRectF(x(), y(), width(), height()), + QRectF(x(), y(), oldWidth, height())); +} + +void QFxItem::setImplicitWidth(qreal w) +{ + Q_D(QFxItem); + if (d->width == w || widthValid()) + return; + + qreal oldWidth = d->width; + + d->width = w; + update(); + + geometryChanged(QRectF(x(), y(), width(), height()), + QRectF(x(), y(), oldWidth, height())); +} + +bool QFxItem::widthValid() const +{ + Q_D(const QFxItem); + return d->widthValid; +} + +qreal QFxItem::height() const +{ + Q_D(const QFxItem); + return d->height; +} + +void QFxItem::setHeight(qreal h) +{ + Q_D(QFxItem); + d->heightValid = true; + if (d->height == h) + return; + + qreal oldHeight = d->height; + + d->height = h; + update(); + + geometryChanged(QRectF(x(), y(), width(), height()), + QRectF(x(), y(), width(), oldHeight)); +} + +void QFxItem::setImplicitHeight(qreal h) +{ + Q_D(QFxItem); + if (d->height == h || heightValid()) + return; + + qreal oldHeight = d->height; + + d->height = h; + update(); + + geometryChanged(QRectF(x(), y(), width(), height()), + QRectF(x(), y(), width(), oldHeight)); +} + +bool QFxItem::heightValid() const +{ + Q_D(const QFxItem); + return d->heightValid; +} + +void QFxItem::setPos(const QPointF &point) +{ + qreal oldX = x(); + qreal oldY = y(); + + QGraphicsItem::setPos(point); + + geometryChanged(QRectF(x(), y(), width(), height()), + QRectF(oldX, oldY, width(), height())); +} + +qreal QFxItem::scale() const +{ + Q_D(const QFxItem); + return d->scale; +} + +void QFxItem::setScale(qreal s) +{ + Q_D(QFxItem); + if (d->scale == s) + return; + + d->scale = s; + QTransform t; + QPointF to = transformOriginPoint(); + if (to.x() != 0. || to.y() != 0.) + t.translate(to.x(), to.y()); + t.scale(s, s); + if (to.x() != 0. || to.y() != 0.) + t.translate(-to.x(), -to.y()); + setTransform(t * d->transform); + + emit scaleChanged(); +} + +QRect QFxItem::itemBoundingRect() +{ + return boundingRect().toAlignedRect(); +} + +QPointF QFxItem::mapFromScene(const QPointF &p) const +{ + return QGraphicsItem::mapFromScene(p); +} + +QRectF QFxItem::mapFromScene(const QRectF &r) const +{ + return QGraphicsItem::mapFromScene(r).boundingRect(); +} + +QPointF QFxItem::mapToScene(const QPointF &p) const +{ + return QGraphicsItem::mapToScene(p); +} + +QRectF QFxItem::mapToScene(const QRectF &r) const +{ + return QGraphicsItem::mapToScene(r).boundingRect(); +} + +QTransform QFxItem::transform() const +{ + Q_D(const QFxItem); + return d->transform; +} + +void QFxItem::setTransform(const QTransform &m) +{ + Q_D(QFxItem); + d->transform = m; + QGraphicsItem::setTransform(QTransform::fromScale(d->scale, d->scale) * d->transform); +} + +QFxItem *QFxItem::mouseGrabberItem() const +{ + QGraphicsScene *s = scene(); + if (s) { + QGraphicsItem *item = s->mouseGrabberItem(); + return static_cast(item); // ### + } + return 0; +} + +bool QFxItem::isFocusable() const +{ + return false; +} + +void QFxItem::setFocusable(bool) +{ +} + +bool QFxItem::hasFocus() const +{ + return false; +} + +bool QFxItem::eventFilter(QObject *o, QEvent *e) +{ + switch(e->type()) { + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseRelease: + if (mouseFilter(static_cast(e))) + return true; + break; + default: + break; + } + + return QObject::eventFilter(o, e); +} + +void QFxItem::setOptions(Options options, bool set) +{ + Q_D(QFxItem); + Options old = (Options)d->options; + + if (set) + d->options |= options; + else + d->options &= ~options; + + if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) { + qWarning("QFxItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset."); + d->options &= ~IsFocusRealm; + } + + setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); + + if ((old & MouseFilter) != (d->options & MouseFilter)) { + if (d->options & MouseFilter) + d->gvAddMouseFilter(); + else + d->gvRemoveMouseFilter(); + } +} + +/*! + \fn void QFxItem::setParent(QFxItem *parent) + + Sets the parent of the item to \a parent. + */ +void QFxItem::setParent(QFxItem *p) +{ + Q_D(QFxItem); + if (p == parent() || !p) return; + + QObject::setParent(p); + + QFxItem *oldParent = itemParent(); + setParentItem(p); + parentChanged(p, oldParent); +} + +bool QFxItem::activeFocusPanel() const +{ + return false; +} + +void QFxItem::setActiveFocusPanel(bool b) +{ +} + +bool QFxItem::hasActiveFocus() const +{ + return false; +} + +void QFxItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +{ + paintContents(*p); +} + +void QFxItemPrivate::gvRemoveMouseFilter() +{ + Q_Q(QFxItem); + if (!canvas) return; + + canvas->removeEventFilter(q); +} + +void QFxItemPrivate::gvAddMouseFilter() +{ + Q_Q(QFxItem); + if (!canvas) return; + + canvas->installEventFilter(q); +} + +QPixmap QFxItem::string(const QString &str, const QColor &c, const QFont &f) +{ + QFontMetrics fm(f); + QSize size(fm.width(str), fm.height()*(str.count(QLatin1Char('\n'))+1)); //fm.boundingRect(str).size(); + QPixmap img(size); + img.fill(Qt::transparent); + QPainter p(&img); + p.setPen(c); + p.setFont(f); + p.drawText(img.rect(), Qt::AlignVCenter, str); + return img; +} + QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index ef69fd3..050cc3e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -49,10 +49,10 @@ #include #include #include -#include #include #include - +#include +#include QT_BEGIN_HEADER @@ -95,7 +95,7 @@ class QmlTransition; class QFxTransform; class QFxKeyEvent; class QFxItemPrivate; -class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserStatus +class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserStatus { Q_OBJECT Q_INTERFACES(QmlParserStatus) @@ -134,16 +134,38 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged) Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged) Q_PROPERTY(QList* transform READ transform) - Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) + Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") typedef QHash QmlChildren; public: + enum Option { NoOption = 0x00000000, + MouseFilter = 0x00000003, // ### GV + ChildMouseFilter = 0x00000002, + HoverEvents = 0x00000004, + MouseEvents = 0x00000008, + HasContents = 0x00000010, + SimpleItem = 0x00000020, + IsFocusPanel = 0x00000040, + IsFocusRealm = 0x00000080, + AcceptsInputMethods = 0x00000100, + IsOpaque = 0x00000200 }; + Q_DECLARE_FLAGS(Options, Option) + + enum TransformOrigin { + TopLeft, TopCenter, TopRight, + MiddleLeft, Center, MiddleRight, + BottomLeft, BottomCenter, BottomRight + }; + QFxItem(QFxItem *parent = 0); virtual ~QFxItem(); QFxItem *itemParent() const; + QFxItem *parentItem() const; void setItemParent(QFxItem *parent); void moveToParent(QFxItem *parent); @@ -159,6 +181,9 @@ public: QFxContents *contents(); + bool clip() const; + void setClip(bool); + QmlList* states(); QmlState *findState(const QString &name) const; @@ -180,15 +205,13 @@ public: qreal scale() const; void setScale(qreal); - qreal opacity() const; - virtual void setOpacity(qreal); + void setOpacity(qreal); QList *transform(); bool isVisible() const; void setVisible(bool); - virtual void dump(int depth = 0); virtual QString propertyInfo() const; bool isClassComplete() const; @@ -201,6 +224,60 @@ public: bool keepMouseGrab() const; void setKeepMouseGrab(bool); + Options options() const; + void setOptions(Options, bool set = true); + + qreal z() const; + QPointF pos() const; + void setX(qreal); + void setY(qreal); + virtual void setZ(qreal); + void setPos(const QPointF &); + + qreal width() const; + void setWidth(qreal); + void setImplicitWidth(qreal); + bool widthValid() const; + qreal height() const; + void setHeight(qreal); + void setImplicitHeight(qreal); + bool heightValid() const; + + QPointF scenePos() const; + + TransformOrigin transformOrigin() const; + void setTransformOrigin(TransformOrigin); + QPointF transformOriginPoint() const; + + void setParent(QFxItem *); + + QRect itemBoundingRect(); + + void setPaintMargin(qreal margin); + QRectF boundingRect() const; + virtual void paintContents(QPainter &); + + QPointF mapFromScene(const QPointF &) const; + QRectF mapFromScene(const QRectF &) const; + QPointF mapToScene(const QPointF &) const; + QRectF mapToScene(const QRectF &) const; + + QTransform transform() const; + void setTransform(const QTransform &); + + QFxItem *mouseGrabberItem() const; + + virtual bool isFocusable() const; + void setFocusable(bool); + virtual bool hasFocus() const; + void setFocus(bool); + bool activeFocusPanel() const; + void setActiveFocusPanel(bool); + + bool hasActiveFocus() const; + + static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); + public Q_SLOTS: void newChild(const QString &url); @@ -224,12 +301,19 @@ Q_SIGNALS: void newChildCreated(const QString &url, QScriptValue); protected: + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + virtual void childrenChanged(); + virtual bool eventFilter(QObject *, QEvent *); + virtual bool sceneEvent(QEvent *); + virtual QVariant itemChange(GraphicsItemChange, const QVariant &); + virtual bool mouseFilter(QGraphicsSceneMouseEvent *); + virtual void mouseUngrabEvent(); + virtual void transformChanged(const QTransform &); virtual void classBegin(); virtual void classComplete(); virtual void componentComplete(); - virtual void parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *); - virtual void reparentItems(); + virtual void parentChanged(QFxItem *, QFxItem *); virtual void focusChanged(bool); virtual void activeFocusChanged(bool); void keyPressEvent(QKeyEvent *event); @@ -260,6 +344,16 @@ private: Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxItem) }; QML_DECLARE_TYPE(QFxItem) +Q_DECLARE_OPERATORS_FOR_FLAGS(QFxItem::Options) + +template +T qobject_cast(QGraphicsItem *item) +{ + if (!item) return 0; + QObject *o = item->toGraphicsObject(); + return qobject_cast(o); +} + QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index b38d877..113c860 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -54,17 +54,18 @@ // #include -#include #include #include #include #include +#include +#include QT_BEGIN_NAMESPACE class QNetworkReply; -class QFxItemPrivate : public QSimpleCanvasItemPrivate +class QFxItemPrivate : public QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QFxItem) @@ -75,8 +76,11 @@ public: : _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0), _baselineOffset(0), _rotation(0.), _classComplete(true), _componentComplete(true), _keepMouse(false), - visible(true), _anchorLines(0), visibleOp(1), reparentedChildren(0), - _stateGroup(0) + visible(true), _anchorLines(0), visibleOp(1), + _stateGroup(0), canvas(0), origin(QFxItem::TopLeft), + options(QFxItem::NoOption), + widthValid(false), heightValid(false), width(0), height(0), + paintmargin(0), scale(1) {} ~QFxItemPrivate() { delete _anchors; } @@ -89,6 +93,7 @@ public: q->setItemParent(parent); _baselineOffset.invalidate(); q->setAcceptedMouseButtons(Qt::NoButton); + q->setFlag(QGraphicsItem::ItemHasNoContents, true); } QString _id; @@ -168,10 +173,27 @@ public: float visibleOp; - int reparentedChildren; - QmlStateGroup *states(); QmlStateGroup *_stateGroup; + + + QGraphicsScene *canvas; + + QFxItem::TransformOrigin origin:4; + int options:10; + bool widthValid:1; + bool heightValid:1; + + qreal width; + qreal height; + qreal paintmargin; + qreal scale; + + QPointF transformOrigin() const; + QTransform transform; + + void gvRemoveMouseFilter(); + void gvAddMouseFilter(); }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp index 4aae74f..2c662a6 100644 --- a/src/declarative/fx/qfxkeyactions.cpp +++ b/src/declarative/fx/qfxkeyactions.cpp @@ -41,7 +41,7 @@ #include "qfxkeyactions.h" #include - +#include QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(QFxKeyActions,KeyActions) diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index e80f2c7..e76a9b7 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -93,24 +93,12 @@ QList *QFxKeyProxy::targets() const void QFxKeyProxy::keyPressEvent(QKeyEvent *e) { - for (int ii = 0; ii < d->targets.count(); ++ii) { - QSimpleCanvasItem *i = canvas()->focusItem(d->targets.at(ii)); - if (i) - i->keyPressEvent(e); - if (e->isAccepted()) - return; - } + // ### GV } void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) { - for (int ii = 0; ii < d->targets.count(); ++ii) { - QSimpleCanvasItem *i = canvas()->focusItem(d->targets.at(ii)); - if (i) - i->keyReleaseEvent(e); - if (e->isAccepted()) - return; - } + // ### GV } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp index a975778..67cf00a 100644 --- a/src/declarative/fx/qfxlayouts.cpp +++ b/src/declarative/fx/qfxlayouts.cpp @@ -314,8 +314,9 @@ void QFxBaseLayout::preLayout() delete d->stateGroup; d->stateGroup = 0; } QSet allItems; - for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { - QFxItem *child = qobject_cast(this->QSimpleCanvasItem::children().at(ii)); + QList children = childItems(); + for (int ii = 0; ii < children.count(); ++ii) { + QFxItem *child = qobject_cast(children.at(ii)); if (!child) continue; if (!d->_items.contains(child)){ @@ -624,8 +625,10 @@ void QFxVerticalLayout::doLayout() applyRemove(changes, item); } } - for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { - QFxItem *child = qobject_cast(this->QSimpleCanvasItem::children().at(ii)); + + QList children = childItems(); + for (int ii = 0; ii < children.count(); ++ii) { + QFxItem *child = qobject_cast(children.at(ii)); if (!child || !child->isVisible()) continue; @@ -790,8 +793,9 @@ void QFxHorizontalLayout::doLayout() applyRemove(changes, item); } } - for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { - QFxItem *child = qobject_cast(this->QSimpleCanvasItem::children().at(ii)); + QList children = childItems(); + for (int ii = 0; ii < children.count(); ++ii) { + QFxItem *child = qobject_cast(children.at(ii)); if (!child || !child->isVisible()) continue; @@ -1019,15 +1023,17 @@ void QFxGridLayout::doLayout() QList maxColWidth; QList maxRowHeight; int childIndex =0; + QList children = childItems(); for (int i=0; iQSimpleCanvasItem::children().count()) + + if (childIndex == children.count()) continue; - QFxItem *child = qobject_cast(this->QSimpleCanvasItem::children().at(childIndex++)); + QFxItem *child = qobject_cast(children.at(childIndex++)); if (!child || !child->isVisible()) continue; if (child->width() > maxColWidth[j]) @@ -1047,7 +1053,7 @@ void QFxGridLayout::doLayout() applyRemove(changes, item); } } - foreach(QSimpleCanvasItem* schild, this->QSimpleCanvasItem::children()){ + foreach(QGraphicsItem* schild, children){ QFxItem *child = qobject_cast(schild); if (!child || !child->isVisible()) continue; diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index 6eb358b..38a0bd1 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -373,8 +373,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF startLocalPos; QPointF curLocalPos; if (drag()->target()->parent()) { - startLocalPos = drag()->target()->parent()->mapFromScene(d->startScene); - curLocalPos = drag()->target()->parent()->mapFromScene(event->scenePos()); + startLocalPos = drag()->target()->parentItem()->mapFromScene(d->startScene); + curLocalPos = drag()->target()->parentItem()->mapFromScene(event->scenePos()); } else { startLocalPos = d->startScene; curLocalPos = event->scenePos(); diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h index e444bf2..ad0866f 100644 --- a/src/declarative/fx/qfxmouseregion_p.h +++ b/src/declarative/fx/qfxmouseregion_p.h @@ -74,7 +74,7 @@ public: { Q_Q(QFxMouseRegion); q->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); - q->setOptions(QSimpleCanvasItem::HoverEvents | QSimpleCanvasItem::MouseEvents); + q->setOptions(QFxItem::HoverEvents | QFxItem::MouseEvents); } void saveEvent(QGraphicsSceneMouseEvent *event) { diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h index ec507fb..9d5733c 100644 --- a/src/declarative/fx/qfxpainteditem_p.h +++ b/src/declarative/fx/qfxpainteditem_p.h @@ -54,7 +54,6 @@ // #include -#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 5e84c88..0a6a628 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -1037,14 +1037,6 @@ void QFxParticles::setMotion(QFxParticleMotion *motion) d->motion = motion; } -void QFxParticles::dump(int depth) -{ - Q_D(QFxParticles); - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "URL:" << d->url << "Count:" << d->count; - QFxItem::dump(depth); -} - QString QFxParticles::propertyInfo() const { Q_D(const QFxParticles); @@ -1057,8 +1049,8 @@ void QFxParticlesPainter::updateSize(){ setWidth(1000); setHeight(1000); return ; - const int parentX = parent()->x(); - const int parentY = parent()->y(); + const int parentX = parentItem()->x(); + const int parentY = parentItem()->y(); //Have to use statistical approach to needed size as arbitrary particle //motions make it impossible to calculate. //max/min vars stored to give a never shrinking rect @@ -1096,8 +1088,8 @@ void QFxParticlesPainter::paintContents(QPainter &p) return; updateSize(); - const int myX = x() + parent()->x(); - const int myY = y() + parent()->y(); + const int myX = x() + parentItem()->x(); + const int myY = y() + parentItem()->y(); for (int i = 0; i < d->particles.count(); ++i) { const QFxParticle &particle = d->particles.at(i); diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h index bb84df2..be4dc91 100644 --- a/src/declarative/fx/qfxparticles.h +++ b/src/declarative/fx/qfxparticles.h @@ -207,7 +207,6 @@ public: QFxParticleMotion *motion() const; void setMotion(QFxParticleMotion *); - virtual void dump(int depth); virtual QString propertyInfo() const; void paintContents(QPainter &p); diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index be731b1..ee2a272 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -43,6 +43,7 @@ #include "qfxpath_p.h" #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index b5c5ba2..fea207f 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -88,7 +88,7 @@ public: Q_Q(QFxPathView); _offset = 0; q->setAcceptedMouseButtons(Qt::NoButton); - q->setOptions(QSimpleCanvasItem::MouseFilter | QSimpleCanvasItem::MouseEvents | QSimpleCanvasItem::IsFocusRealm); + q->setOptions(QFxItem::MouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp index 0ea94f5..f2c6217 100644 --- a/src/declarative/fx/qfxpixmap.cpp +++ b/src/declarative/fx/qfxpixmap.cpp @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE class QSharedNetworkReply; diff --git a/src/declarative/fx/qfxpixmap.h b/src/declarative/fx/qfxpixmap.h index ae693c1..f63299b 100644 --- a/src/declarative/fx/qfxpixmap.h +++ b/src/declarative/fx/qfxpixmap.h @@ -44,9 +44,8 @@ #include #include -#include #include - +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 03ab426..a068fd4 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -356,14 +356,6 @@ void QFxRect::setRadius(qreal radius) update(); } -void QFxRect::dump(int depth) -{ - Q_D(QFxRect); - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "QFxRect:" << d->color; - QFxItem::dump(depth); -} - /*! \qmlproperty color Rect::color This property holds the color used to fill the rect. diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index eee1f86..46f918b 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -43,6 +43,7 @@ #define QFXRECT_H #include +#include QT_BEGIN_HEADER @@ -159,7 +160,6 @@ public: qreal radius() const; void setRadius(qreal radius); - virtual void dump(int depth); void paintContents(QPainter &painter); private Q_SLOTS: diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index a6d68cb..3ed47cd 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -243,7 +243,7 @@ void QFxRepeater::componentComplete() /*! \internal */ -void QFxRepeater::parentChanged(QSimpleCanvasItem *o, QSimpleCanvasItem *n) +void QFxRepeater::parentChanged(QFxItem *o, QFxItem *n) { QFxItem::parentChanged(o, n); regenerate(); diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h index 17ffa57..2c903d1 100644 --- a/src/declarative/fx/qfxrepeater.h +++ b/src/declarative/fx/qfxrepeater.h @@ -73,7 +73,7 @@ private: protected: virtual void componentComplete(); - virtual void parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *); + virtual void parentChanged(QFxItem *, QFxItem *); QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent); private: diff --git a/src/declarative/fx/qfxscalegrid.h b/src/declarative/fx/qfxscalegrid.h index c59cb32..4a9a72f 100644 --- a/src/declarative/fx/qfxscalegrid.h +++ b/src/declarative/fx/qfxscalegrid.h @@ -45,7 +45,6 @@ #include #include #include -#include #include #include diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index a5361e1..36c8b23 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -506,13 +506,6 @@ void QFxTextPrivate::updateSize() // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); -void QFxText::dump(int depth) -{ - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << propertyInfo(); - QFxItem::dump(depth); -} - QString QFxText::propertyInfo() const { Q_D(const QFxText); diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index 83e7299..10b85f0 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -114,7 +114,6 @@ public: QString activeLink() const; - virtual void dump(int depth); virtual QString propertyInfo() const; void paintContents(QPainter &p); diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 3c117ee..addbd58 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -495,16 +495,6 @@ void QFxTextEdit::geometryChanged(const QRectF &newGeometry, } /*! - \internal -*/ -void QFxTextEdit::dump(int depth) -{ - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << propertyInfo(); - QFxPaintedItem::dump(depth); -} - -/*! \internal */ QString QFxTextEdit::propertyInfo() const diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 920bd04..93540a4 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -138,7 +138,6 @@ public: qreal textMargin() const; void setTextMargin(qreal margin); - virtual void dump(int depth); virtual QString propertyInfo() const; virtual void componentComplete(); diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index c60a379..7d260ab 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -51,6 +51,7 @@ #include "qmlopenmetaobject.h" #include "qmllistaccessor.h" #include "qfxvisualitemmodel.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 91579e9..a9cb673 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -55,7 +55,6 @@ #include "qmlstate.h" #include "qfxtransform.h" #include "qfxscalegrid.h" -#include "qsimplecanvas.h" #include "qlistmodelinterface.h" #include "qfxwebview.h" @@ -535,13 +534,6 @@ void QFxWebView::setCacheSize(int pixels) d->max_imagecache_size = pixels; } -void QFxWebView::dump(int depth) -{ - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "url:" << url(); - QFxPaintedItem::dump(depth); -} - void QFxWebView::drawContents(QPainter *p, const QRect &r) { page()->mainFrame()->render(p,r); diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index 115bddc..85c17d7 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -140,7 +140,6 @@ public: QAction *forwardAction() const; QAction *stopAction() const; - virtual void dump(int depth); virtual QString propertyInfo() const; QWebPage *page() const; diff --git a/src/declarative/fx/qfxwidgetcontainer.cpp b/src/declarative/fx/qfxwidgetcontainer.cpp index 421c2f7..ea702db 100644 --- a/src/declarative/fx/qfxwidgetcontainer.cpp +++ b/src/declarative/fx/qfxwidgetcontainer.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qfxwidgetcontainer.h" -#include #include QT_BEGIN_NAMESPACE @@ -83,17 +82,7 @@ void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget) _graphicsWidget = widget; - QSimpleCanvas *c = canvas(); - if (!c) - return; - - if (c->canvasMode() != QSimpleCanvas::GraphicsView) { - qWarning("QFxWidgetContainer: Cannot add a widget to a non-graphicsview canvas. You might need to set QFX_USE_GRAPHICSVIEW=1"); - return; - } - - QGraphicsItem *item = (QGraphicsItem *)(*this); - _graphicsWidget->setParentItem(item); + _graphicsWidget->setParentItem(this); } void QFxWidgetContainer::canvasChanged() diff --git a/src/declarative/test/qfxtestengine.cpp b/src/declarative/test/qfxtestengine.cpp deleted file mode 100644 index 0d7e5df..0000000 --- a/src/declarative/test/qfxtestengine.cpp +++ /dev/null @@ -1,463 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "qfxtestengine.h" -#include "qfxtestobjects.h" -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#define MAX_MISMATCHED_FRAMES 5 -#define MAX_MISMATCHED_PIXELS 5 - -class QFxTestEnginePrivate : public QAbstractAnimation -{ -public: - QFxTestEnginePrivate(QFxTestEngine *p) - : q(p), canvas(0), testMode(QFxTestEngine::NoTest), fullFrame(true), - status(Working), exitOnFail(true), mismatchedFrames(0), - lastFrameMismatch(false) {} - - QFxTestEngine *q; - - QmlEngine engine; - QSimpleCanvas *canvas; - QFxTestEngine::TestMode testMode; - QString testDirectory; - - TestLog testData; - TestLog playbackTestData; - bool fullFrame; - QList fullFrames; - - virtual void updateCurrentTime(int); - - void recordFrameEvent(const QImage &img); - void recordFullFrameEvent(const QImage &img); - void recordKeyEvent(QKeyEvent *e); - void recordMouseEvent(QMouseEvent *e); - void testPass(); - void save(const QString &filename, bool = true); - - enum MessageType { Success, Fail }; - void message(MessageType t, const char *); - - enum Status { Working, Failed, Passed }; - Status status; - bool exitOnFail; - - QList toPost; - QSet postedEvents; - - // OpenGL seems to give inconsistent rendering results. We allow a small - // tolerance to compensate - a maximum number of mismatched frames and only - // one mismatch in a row - int mismatchedFrames; - bool lastFrameMismatch; - - bool compare(const QImage &img1, const QImage &img2); - - virtual int duration() const { return -1; } - - int elapsed() { return currentTime(); } -}; - -bool QFxTestEnginePrivate::compare(const QImage &img1, const QImage &img2) -{ - if (img1.size() != img2.size()) { - qWarning() << "Image size mismatch" << img1.size() << img2.size(); - return false; - } - - int errorCount = 0; - for (int yy = 0; yy < img1.height(); ++yy) { - for (int xx = 0; xx < img1.width(); ++xx) { - if (img1.pixel(xx, yy) != img2.pixel(xx, yy)) { - errorCount++; - if (errorCount > MAX_MISMATCHED_PIXELS) { - return false; - } - } - } - } - - return true; -} - -QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, - QSimpleCanvas *canvas, QObject *parent) -: QObject(parent), d(new QFxTestEnginePrivate(this)) -{ - Q_ASSERT(canvas); - - d->canvas = canvas; - d->start(); - - d->testDirectory = dir; - d->testMode = mode; - if (d->testMode == RecordTest) { - qWarning("QFxTestEngine: Record ON"); - } else if (d->testMode == PlaybackTest) { - - QString fileName(d->testDirectory + QLatin1String("/manifest.qml")); - QFile f(fileName); - if (!f.open(QIODevice::ReadOnly)) { - qWarning() << "QFxTestEngine: Unable to open file" << fileName; - return; - } - - QByteArray data = f.readAll(); - QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.qml"))); - QObject *o = c.create(); - TestLog *log = qobject_cast(o); - if (log) { - log->setParent(this); - d->playbackTestData.actions() = log->actions(); - qWarning() << "QFxTestEngine: Playback ON," << d->playbackTestData.actions().count() << "actions"; - } else { - delete o; - qWarning() << "QFxTestEngine: File" << fileName << "is corrupt."; - return; - } - } - - if (d->testMode != NoTest) { - QUnifiedTimer::instance()->setConsistentTiming(true); - QObject::connect(canvas, SIGNAL(framePainted()), - this, SLOT(framePainted())); - - canvas->installEventFilter(this); - for (int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) { - TestObject *o = d->playbackTestData.actions().at(ii); - if (TestMouse *m = qobject_cast(o)) - d->toPost << m; - else if (TestKey *k = qobject_cast(o)) - d->toPost << k; - } - } -} - -QFxTestEngine::~QFxTestEngine() -{ - delete d; d = 0; -} - -void QFxTestEngine::framePainted() -{ - QImage img = d->canvas->asImage(); - - if (d->fullFrame) { - d->fullFrame = false; - d->recordFullFrameEvent(img); - } else { - d->recordFrameEvent(img); - } -} - -void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img) -{ - TestFullFrame *ff = new TestFullFrame(q); - ff->setTime(elapsed()); - ff->setFrameId(fullFrames.count()); - - fullFrames << img; - testData.actions() << ff; - - if (testMode == QFxTestEngine::PlaybackTest) { - TestFullFrame *pf = qobject_cast(playbackTestData.next()); - QString filename = testDirectory + QLatin1String("/image") + QString::number(pf->frameId()) + QLatin1String(".png"); - QImage recImg(filename); - if (!pf || !compare(recImg, img) || pf->time() != elapsed()) { - qDebug() << pf << pf->time() << elapsed(); - message(Fail, "FFrame mismatch"); - } else { - message(Success, "FFrame OK"); - } - - testPass(); - } -} - -static QByteArray toHex(uchar c) -{ - QByteArray rv; - uint h = c / 16; - uint l = c % 16; - if (h >= 10) - rv.append(h - 10 + 'A'); - else - rv.append(h + '0'); - if (l >= 10) - rv.append(l - 10 + 'A'); - else - rv.append(l + '0'); - return rv; -} - -void QFxTestEnginePrivate::recordFrameEvent(const QImage &img) -{ - QCryptographicHash hash(QCryptographicHash::Md5); - - hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height()); - - QByteArray result = hash.result(); - QByteArray hexResult; - for (int ii = 0; ii < result.count(); ++ii) - hexResult.append(toHex(result.at(ii))); - - TestFrame *f = new TestFrame(q); - f->setTime(elapsed()); - - f->setHash(QLatin1String(hexResult)); - testData.actions() << f; - if (testMode == QFxTestEngine::PlaybackTest) { - TestObject *o = playbackTestData.next(); - TestFrame *f = qobject_cast(o); - if (!f || f->time() != elapsed() || - f->hash() != QLatin1String(hexResult)) { - mismatchedFrames++; - if (mismatchedFrames > MAX_MISMATCHED_FRAMES || - lastFrameMismatch) - message(Fail, "Frame mismatch"); - else - message(Success, "Frame mismatch - within tolerance"); - lastFrameMismatch = true; - } else { - message(Success, "Frame OK"); - lastFrameMismatch = false; - } - - testPass(); - } -} - -void QFxTestEnginePrivate::updateCurrentTime(int) -{ - if (status != Working) - return; - - while(!toPost.isEmpty()) { - int t = elapsed(); - TestObject *o = toPost.first(); - if (testMode == QFxTestEngine::RecordTest) - o->setTime(t); - else if (o->time() != t) - return; - toPost.takeFirst(); - if (TestMouse *m = qobject_cast(o)) { - QMouseEvent e((QEvent::Type)m->type(), m->pos(), m->globalPos(), (Qt::MouseButton)m->button(), (Qt::MouseButtons)m->buttons(), (Qt::KeyboardModifiers)0); - postedEvents.insert(&e); - QApplication::sendEvent(canvas, &e); - } else if (TestKey *k = qobject_cast(o)) { - QKeyEvent e((QEvent::Type)k->type(), k->key(), (Qt::KeyboardModifiers)k->modifiers(), k->text()); - postedEvents.insert(&e); - QApplication::sendEvent(canvas, &e); - } - } -} - -bool QFxTestEngine::eventFilter(QObject *, QEvent *event) -{ - if (d->status != QFxTestEnginePrivate::Working) - return false; - - if (event->type() == QEvent::MouseButtonPress || - event->type() == QEvent::MouseButtonDblClick || - event->type() == QEvent::MouseButtonRelease || - event->type() == QEvent::MouseMove) { - if (d->testMode == RecordTest && d->postedEvents.contains(event)) { - d->postedEvents.remove(event); - } else { - d->recordMouseEvent(static_cast(event)); - return d->testMode == RecordTest; - } - } else if (event->type() == QEvent::KeyPress || - event->type() == QEvent::KeyRelease) { - QKeyEvent *key = static_cast(event); - if (key->key() < Qt::Key_F1 || key->key() > Qt::Key_F9) { - - if (d->testMode == RecordTest && d->postedEvents.contains(event)) { - d->postedEvents.remove(event); - } else { - d->recordKeyEvent(key); - return d->testMode == RecordTest; - } - - } - } - - return false; -} - -void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) -{ - TestMouse *m = new TestMouse(q); - m->setTime(elapsed()); - m->setType(e->type()); - m->setButton(e->button()); - m->setButtons(e->buttons()); - m->setGlobalPos(e->globalPos()); - m->setPos(e->pos()); - testData.actions() << m; - - if (testMode == QFxTestEngine::PlaybackTest) { - TestMouse *m = qobject_cast(playbackTestData.next()); - if (!m || m->time() != elapsed() || - m->type() != e->type() || - m->button() != e->button() || - m->buttons() != e->buttons() || -// m->globalPos() != e->globalPos() || - m->pos() != e->pos()) { - if (m) - qWarning() << m->time() << elapsed(); - message(Fail, "Mouse mismatch"); - } else - message(Success, "Mouse OK"); - - testPass(); - } else { - toPost << m; - } - -} - -void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e) -{ - TestKey *k = new TestKey(q); - k->setTime(elapsed()); - k->setType(e->type()); - k->setModifiers(e->QInputEvent::modifiers()); - k->setText(e->text()); - k->setKey(e->key()); - testData.actions() << k; - if (testMode == QFxTestEngine::PlaybackTest) { - TestKey *f = qobject_cast(playbackTestData.next()); - if (!f || f->time() != elapsed() || - f->type() != e->type() || - f->modifiers() != e->QInputEvent::modifiers() || - f->text() != e->text() || - f->key() != e->key()) - message(Fail, "Key mismatch"); - else - message(Success, "Key OK"); - - testPass(); - } else { - toPost << k; - } -} - -void QFxTestEngine::captureFullFrame() -{ - d->fullFrame = true; -} - -void QFxTestEnginePrivate::message(MessageType t, const char *message) -{ - if (exitOnFail) - qWarning("%s", message); - if (t == Fail) { - if (exitOnFail) { - save(QLatin1String("manifest-fail.qml"), false); - qFatal("Failed"); - } else { - status = Failed; - } - } -} - -void QFxTestEnginePrivate::save(const QString &filename, bool images) -{ - qWarning() << "QFxTestEngine: Writing test data"; - - QFile manifest(testDirectory + QLatin1String("/") + filename); - manifest.open(QIODevice::WriteOnly); - testData.save(&manifest); - manifest.close(); - - if (images) { - for (int ii = 0; ii < fullFrames.count(); ++ii) - fullFrames.at(ii).save(testDirectory + QLatin1String("/image") + QString::number(ii) + QLatin1String(".png")); - } -} - -void QFxTestEngine::save() -{ - if (d->testMode != RecordTest) - return; - - d->save(QLatin1String("manifest.qml")); -} - -void QFxTestEnginePrivate::testPass() -{ - if (playbackTestData.atEnd()) { - qWarning("Test PASSED"); - if (exitOnFail) { - save(QLatin1String("manifest-play.qml")); - exit(0); - } else { - status = Passed; - } - } -} - -bool QFxTestEngine::runTest() -{ - d->exitOnFail = false; - while(d->status == QFxTestEnginePrivate::Working) - QApplication::processEvents(); - d->exitOnFail = true; - qWarning() << d->status; - return d->status == QFxTestEnginePrivate::Passed; -} - -QT_END_NAMESPACE diff --git a/src/declarative/test/qfxtestengine.h b/src/declarative/test/qfxtestengine.h deleted file mode 100644 index 44a140f..0000000 --- a/src/declarative/test/qfxtestengine.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _QFXTESTENGINE_H_ -#define _QFXTESTENGINE_H_ - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QSimpleCanvas; -class QFxTestEnginePrivate; -class Q_DECLARATIVE_EXPORT QFxTestEngine : public QObject -{ -Q_OBJECT -public: - enum TestMode { NoTest, RecordTest, PlaybackTest }; - - QFxTestEngine(TestMode, const QString &, - QSimpleCanvas *canvas, QObject * = 0); - virtual ~QFxTestEngine(); - - void captureFullFrame(); - void save(); - - bool runTest(); - -protected: - virtual bool eventFilter(QObject *, QEvent *); - -private Q_SLOTS: - void framePainted(); - -private: - QFxTestEnginePrivate *d; -}; - -#endif // _QFXTESTENGINE_H_ - - -QT_END_NAMESPACE - -QT_END_HEADER diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp deleted file mode 100644 index 12fc7fb..0000000 --- a/src/declarative/test/qfxtestobjects.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qfxtestobjects.h" -#include -#include -#include - - -QT_BEGIN_NAMESPACE -QML_DECLARE_TYPE(TestObject) -QML_DEFINE_TYPE(TestObject,TestObject) -QML_DECLARE_TYPE(TestFrame) -QML_DEFINE_TYPE(TestFrame,TestFrame) -QML_DECLARE_TYPE(TestFullFrame) -QML_DEFINE_TYPE(TestFullFrame,TestFullFrame) -QML_DECLARE_TYPE(TestMouse) -QML_DEFINE_TYPE(TestMouse,TestMouse) -QML_DECLARE_TYPE(TestKey) -QML_DEFINE_TYPE(TestKey,TestKey) -QML_DECLARE_TYPE(TestLog) -QML_DEFINE_TYPE(TestLog,TestLog) - -static QString padding(int pad) -{ - QString p; - while (pad--) - p += QLatin1Char(' '); - return p; -} - -TestObject::TestObject(QObject *parent) -: QObject(parent), _time(-1) -{ -} - -int TestObject::time() const -{ - return _time; -} - -void TestObject::setTime(int t) -{ - if (t == _time) - return; - _time = t; - emit dataChanged(); -} - -void TestObject::save(QTextStream &device, int pad) -{ - device << padding(pad) << QLatin1String("TestObject {") << endl; - device << padding(pad) << QLatin1String("time: ") << QString::number(time()) << endl; - device << padding(pad) << QLatin1String("}") << endl; -} - - -TestFrame::TestFrame(QObject *parent) -: TestObject(parent) -{ -} - -QString TestFrame::hash() const -{ - return _hash; -} - -void TestFrame::setHash(const QString &h) -{ - if (_hash == h) - return; - _hash = h; - emit frameChanged(); -} - -void TestFrame::save(QTextStream &device, int pad) -{ - device << padding(pad) << QLatin1String("TestFrame {") << endl; - device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; - device << padding(pad+4)<< QLatin1String("hash: '") << hash() << QLatin1String("'") << endl; - device << padding(pad) << QLatin1Char('}') << endl; -} - -TestFullFrame::TestFullFrame(QObject *parent) -: TestObject(parent), _frameId(-1) -{ -} - -int TestFullFrame::frameId() const -{ - return _frameId; -} - -void TestFullFrame::setFrameId(int id) -{ - if (id == _frameId) - return; - _frameId = id; - emit frameChanged(); -} - -void TestFullFrame::save(QTextStream &device, int pad) -{ - device << padding(pad) << QLatin1String("TestFullFrame {") << endl; - device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; - device << padding(pad+4) << QLatin1String("frameId: ") << QLatin1String(QByteArray::number(frameId())) << endl; - device << padding(pad) << QLatin1String("}") << endl; -} - -TestMouse::TestMouse(QObject *parent) -: TestObject(parent), _type(-1), _button(-1), _buttons(-1) -{ -} - -int TestMouse::type() const -{ - return _type; -} - -void TestMouse::setType(int t) -{ - if (_type == t) - return; - _type = t; - emit mouseChanged(); -} - -int TestMouse::button() const -{ - return _button; -} - -void TestMouse::setButton(int b) -{ - if (b == _button) - return; - _button = b; - emit mouseChanged(); -} - -int TestMouse::buttons() const -{ - return _buttons; -} - -void TestMouse::setButtons(int buttons) -{ - if (_buttons == buttons) - return; - _buttons = buttons; - emit mouseChanged(); -} - -QPoint TestMouse::globalPos() const -{ - return _globalPos; -} - -void TestMouse::setGlobalPos(const QPoint &g) -{ - if (_globalPos == g) - return; - _globalPos = g; - emit mouseChanged(); -} - -QPoint TestMouse::pos() const -{ - return _pos; -} - -void TestMouse::setPos(const QPoint &p) -{ - if (p == _pos) - return; - _pos = p; - emit mouseChanged(); -} - -void TestMouse::save(QTextStream &device, int pad) -{ - device << padding(pad) << QLatin1String("TestMouse {") << endl; - device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; - device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; - device << padding(pad+4) << QLatin1String("button: ") << QString::number(button()) << endl; - device << padding(pad+4) << QLatin1String("buttons: ") << QString::number(buttons()) << endl; - device << padding(pad+4) << QLatin1String("globalPos: '") << QString::number(globalPos().x()) + QLatin1String(",") + QString::number(globalPos().y()) << QLatin1String("'") << endl; - device << padding(pad+4) << QLatin1String("pos: '") << QString::number(pos().x()) + QLatin1String(",") + QString::number(pos().y()) << QLatin1String("'") << endl; - device << padding(pad) << QLatin1String("}") << endl; -} - -TestKey::TestKey(QObject *parent) -: TestObject(parent), _type(-1), _modifiers(-1), _key(-1) -{ -} - -int TestKey::type() const -{ - return _type; -} - -void TestKey::setType(int t) -{ - if (t == _type) - return; - _type = t; - emit keyChanged(); -} - -int TestKey::modifiers() const -{ - return _modifiers; -} - -void TestKey::setModifiers(int m) -{ - if (m == _modifiers) - return; - _modifiers = m; - emit keyChanged(); -} - -QString TestKey::text() const -{ - return _text; -} - -void TestKey::setText(const QString &t) -{ - if (_text == t) - return; - _text = t; - emit keyChanged(); -} - -int TestKey::key() const -{ - return _key; -} - -void TestKey::setKey(int k) -{ - if (_key == k) - return; - _key = k; - emit keyChanged(); -} - -void TestKey::save(QTextStream &device, int pad) -{ - device << padding(pad) << QLatin1String("TestKey {") << endl; - device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; - device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; - device << padding(pad+4) << QLatin1String("modifiers: ") << QString::number(modifiers()) << endl; - device << padding(pad+4) << QLatin1String("key: ") << QString::number(key()) << endl; - if (key() != Qt::Key_Escape) - device << padding(pad+4) << QLatin1String("text: '") << text() << QLatin1String("'")<< endl; - device << padding(pad) << QLatin1String("}") << endl; -} - -TestLog::TestLog(QObject *parent) -: QObject(parent), _current(0) -{ -} - -QList *TestLog::qmlActions() -{ - return &_actions; -} - -QList &TestLog::actions() -{ - return _actions; -} - -bool lessThan(TestObject *lhs, TestObject *rhs) -{ - return lhs->time() < rhs->time(); -} - -void TestLog::save(QIODevice *device) -{ - // Order correctly - qStableSort(_actions.begin(), _actions.end(), lessThan); - - QTextStream writer(device); - writer << QLatin1String("TestLog {") << endl; - for (int ii = 0; ii < _actions.count(); ++ii) - _actions.at(ii)->save(writer, 4); - writer << QLatin1String("}") << endl; -} - -TestObject *TestLog::next() -{ - if (atEnd()) - return 0; - TestObject *rv = _actions.at(_current); - _current++; - return rv; -} - -bool TestLog::atEnd() const -{ - if (_current >= _actions.count()) - return true; - else - return false; -} - -int TestLog::current() const -{ - return _current; -} - -QT_END_NAMESPACE diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h deleted file mode 100644 index 80fcfe7..0000000 --- a/src/declarative/test/qfxtestobjects.h +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _QFXTESTOBJECTS_H_ -#define _QFXTESTOBJECTS_H_ - -#include -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QIODevice; -class TestObject : public QObject -{ -Q_OBJECT -public: - TestObject(QObject * = 0); - - Q_PROPERTY(int time READ time WRITE setTime NOTIFY dataChanged) - int time() const; - void setTime(int); - - virtual void save(QTextStream &, int pad); -Q_SIGNALS: - void dataChanged(); - -private: - int _time; -}; - -class TestFrame : public TestObject -{ -Q_OBJECT -public: - TestFrame(QObject * = 0); - - Q_PROPERTY(QString hash READ hash WRITE setHash NOTIFY frameChanged) - QString hash() const; - void setHash(const QString &); - - virtual void save(QTextStream &, int pad); -Q_SIGNALS: - void frameChanged(); - -private: - QString _hash; -}; - -class TestFullFrame : public TestObject -{ -Q_OBJECT -public: - TestFullFrame(QObject * = 0); - - Q_PROPERTY(int frameId READ frameId WRITE setFrameId NOTIFY frameChanged) - int frameId() const; - void setFrameId(int); - - virtual void save(QTextStream &, int pad); -Q_SIGNALS: - void frameChanged(); - -private: - int _frameId; -}; - -class TestMouse : public TestObject -{ -Q_OBJECT -public: - TestMouse(QObject * = 0); - - Q_PROPERTY(int type READ type WRITE setType NOTIFY mouseChanged) - int type() const; - void setType(int); - - Q_PROPERTY(int button READ button WRITE setButton NOTIFY mouseChanged) - int button() const; - void setButton(int); - - Q_PROPERTY(int buttons READ buttons WRITE setButtons NOTIFY mouseChanged) - int buttons() const; - void setButtons(int); - - Q_PROPERTY(QPoint globalPos READ globalPos WRITE setGlobalPos NOTIFY mouseChanged) - QPoint globalPos() const; - void setGlobalPos(const QPoint &); - - Q_PROPERTY(QPoint pos READ pos WRITE setPos NOTIFY mouseChanged) - QPoint pos() const; - void setPos(const QPoint &); - - virtual void save(QTextStream &, int pad); - -Q_SIGNALS: - void mouseChanged(); - -private: - int _type; - int _button; - int _buttons; - QPoint _globalPos; - QPoint _pos; -}; - -class TestKey : public TestObject -{ -Q_OBJECT -public: - TestKey(QObject * = 0); - - Q_PROPERTY(int type READ type WRITE setType NOTIFY keyChanged) - int type() const; - void setType(int); - - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers NOTIFY keyChanged) - int modifiers() const; - void setModifiers(int); - - Q_PROPERTY(QString text READ text WRITE setText NOTIFY keyChanged) - QString text() const; - void setText(const QString &); - - Q_PROPERTY(int key READ key WRITE setKey NOTIFY keyChanged) - int key() const; - void setKey(int); - - virtual void save(QTextStream &, int pad); - -Q_SIGNALS: - void keyChanged(); - -private: - int _type; - int _modifiers; - int _key; - QString _text; -}; - -class TestLog : public QObject -{ -Q_OBJECT -public: - TestLog(QObject * = 0); - - Q_CLASSINFO("DefaultProperty", "actions") - Q_PROPERTY(QList *actions READ qmlActions) - QList *qmlActions(); - - QList &actions(); - - int current() const; - void save(QIODevice *); - - TestObject *next(); - bool atEnd() const; - -private: - int _current; - QList _actions; -}; - -#endif // _QFXTESTOBJECTS_H_ - - -QT_END_NAMESPACE - -QT_END_HEADER diff --git a/src/declarative/test/qfxtestview.cpp b/src/declarative/test/qfxtestview.cpp deleted file mode 100644 index 0bd5a6b..0000000 --- a/src/declarative/test/qfxtestview.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxtestview.h" -#include -#include -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE -QFxTestView::QFxTestView(const QString &filename, const QString &testdir) -: testEngine(0) -{ - QObject::connect(this, SIGNAL(sceneResized(QSize)), - this, SLOT(setSceneSize(QSize))); - - testEngine = new QFxTestEngine(QFxTestEngine::PlaybackTest, testdir, this, this); - - qWarning() << "Testing:" << filename; - QFile file(filename); - file.open(QFile::ReadOnly); - QString qml = QString::fromUtf8(file.readAll()); - setQml(qml, filename); - - execute(); -} - -void QFxTestView::setSceneSize(QSize s) -{ - if (s.isNull()) - qWarning() << "Scene size is invalid"; - setFixedSize(s); -} - -bool QFxTestView::runTest() -{ - show(); - return testEngine->runTest(); -} - -QT_END_NAMESPACE diff --git a/src/declarative/test/qfxtestview.h b/src/declarative/test/qfxtestview.h deleted file mode 100644 index a8f78bf..0000000 --- a/src/declarative/test/qfxtestview.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _QFXTESTVIEW_H_ -#define _QFXTESTVIEW_H_ - -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxTestEngine; -class Q_DECLARATIVE_EXPORT QFxTestView : public QFxView -{ -Q_OBJECT -public: - QFxTestView(const QString &filename, const QString &testdir); - - bool runTest(); - -private Q_SLOTS: - void setSceneSize(QSize); - -private: - QFxTestEngine *testEngine; -}; - -#endif // _QFXTESTVIEW_H_ - - -QT_END_NAMESPACE - -QT_END_HEADER diff --git a/src/declarative/test/test.pri b/src/declarative/test/test.pri deleted file mode 100644 index eacd00f..0000000 --- a/src/declarative/test/test.pri +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += \ - test/qfxtestengine.cpp \ - test/qfxtestobjects.cpp \ - test/qfxtestview.cpp - -HEADERS += \ - test/qfxtestengine.h \ - test/qfxtestobjects.h \ - test/qfxtestview.h diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index d8d9ba1..43c10bb 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -64,7 +64,6 @@ QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(itemTreeDump, ITEMTREE_DUMP); DEFINE_BOOL_CONFIG_OPTION(qmlDebugger, QML_DEBUGGER); static QVariant stringToPixmap(const QString &str) @@ -104,6 +103,8 @@ public: bool resizable; void init(); + + QGraphicsScene scene; }; /*! @@ -133,21 +134,7 @@ public: Constructs a QFxView with the given \a parent. */ QFxView::QFxView(QWidget *parent) -: QSimpleCanvas(parent), d(new QFxViewPrivate(this)) -{ - setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - d->init(); -} - -/*! - \fn QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent) - \internal - Constructs a QFxView with the given \a parent. The canvas - \a mode can be QSimpleCanvas::GraphicsView or - QSimpleCanvas::SimpleCanvas. -*/ -QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent) -: QSimpleCanvas(mode, parent), d(new QFxViewPrivate(this)) +: QGraphicsView(parent), d(new QFxViewPrivate(this)) { setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); @@ -166,6 +153,20 @@ void QFxViewPrivate::init() QFxPerfTimer perf; #endif QFontDatabase database; + + q->setScene(&scene); + + q->setOptimizationFlags(QGraphicsView::DontSavePainterState); + q->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + q->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + q->setFrameStyle(0); + + // These seem to give the best performance + q->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + q->viewport()->setFocusPolicy(Qt::NoFocus); + + } /*! @@ -320,15 +321,14 @@ void QFxView::continueExecute() if (obj) { if (QFxItem *item = qobject_cast(obj)) { - item->QSimpleCanvasItem::setParent(QSimpleCanvas::root()); - if (itemTreeDump()) - item->dump(); + d->scene.addItem(item); if(qmlDebugger()) { QmlDebugger *debugger = new QmlDebugger; debugger->setDebugObject(item); - debugger->setCanvas(this); + // ### GV + //debugger->setCanvas(this); debugger->show(); raise(); debugger->raise(); @@ -532,7 +532,8 @@ void QFxView::resizeEvent(QResizeEvent *e) d->root->setWidth(width()); d->root->setHeight(height()); } - QSimpleCanvas::resizeEvent(e); + setSceneRect(rect()); + QGraphicsView::resizeEvent(e); } /*! \fn void QFxView::focusInEvent(QFocusEvent *e) @@ -554,11 +555,4 @@ void QFxView::focusOutEvent(QFocusEvent *) // Do nothing (do not call QWidget::update()) } -/*! - \internal - */ -void QFxView::dumpRoot() -{ - root()->dump(); -} QT_END_NAMESPACE diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index 05bf005..b1386a2 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -44,9 +44,9 @@ #include #include +#include #include #include -#include QT_BEGIN_HEADER @@ -60,12 +60,11 @@ class QmlContext; class QmlError; class QFxViewPrivate; -class Q_DECLARATIVE_EXPORT QFxView : public QSimpleCanvas +class Q_DECLARATIVE_EXPORT QFxView : public QGraphicsView { Q_OBJECT public: explicit QFxView(QWidget *parent = 0); - QFxView(QSimpleCanvas::CanvasMode mode, QWidget* parent = 0); virtual ~QFxView(); @@ -86,8 +85,6 @@ public: bool contentResizable() const; QSize sizeHint() const; - void dumpRoot(); - static void printErrorLine(const QmlError &); Q_SIGNALS: void sceneResized(QSize size); diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index 0b370fb..448437c 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -76,7 +76,6 @@ int main(int argc, char ** argv) QString skin; bool devkeys = false; bool cache = false; - QFxTestEngine::TestMode testMode = QFxTestEngine::NoTest; QString testDir; QString translationFile; @@ -104,18 +103,6 @@ int main(int argc, char ** argv) autorecord_to = range.mid(dash+1).toInt(); } else if (arg == "-devicekeys") { devkeys = true; - } else if (arg == "-recordtest") { - testMode = QFxTestEngine::RecordTest; - if(i + 1 >= argc) - usage(); - testDir = argv[i + 1]; - ++i; - } else if (arg == "-runtest") { - testMode = QFxTestEngine::PlaybackTest; - if(i + 1 >= argc) - usage(); - testDir = argv[i + 1]; - ++i; } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { fprintf(stderr, "Qt Declarative UI Viewer version %s\n", QT_VERSION_STR); return 0; @@ -139,7 +126,7 @@ int main(int argc, char ** argv) app.installTranslator(&qmlTranslator); } - QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + QmlViewer viewer(testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); foreach (QString lib, libraries) viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 21cadda..c8b4250 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -40,6 +40,7 @@ #include #include #include +#include class PreviewDeviceSkin : public DeviceSkin { @@ -124,10 +125,9 @@ void PreviewDeviceSkin::slotPopupMenu() } -QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, QWidget *parent, Qt::WindowFlags flags) +QmlViewer::QmlViewer(const QString &testDir, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), frame_stream(0), scaleSkin(true), mb(0) { - testEngine = 0; devicemode = false; skin = 0; canvas = 0; @@ -142,9 +142,6 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q canvas->setAttribute(Qt::WA_NoSystemBackground); canvas->setContentResizable(!skin || !scaleSkin); - if(testMode != QFxTestEngine::NoTest) - testEngine = new QFxTestEngine(testMode, testDir, canvas, this); - QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); QVBoxLayout *layout = new QVBoxLayout; @@ -294,7 +291,8 @@ void QmlViewer::takeSnapShot() { static int snapshotcount = 1; QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount); - canvas->asImage().save(snapFileName); + // ### GV + // canvas->asImage().save(snapFileName); qDebug() << "Wrote" << snapFileName; ++snapshotcount; } @@ -516,22 +514,11 @@ void QmlViewer::keyPressEvent(QKeyEvent *event) toggleRecording(); } else if (event->key() == Qt::Key_F3 || (event->key() == Qt::Key_3 && devicemode)) { takeSnapShot(); - } else if (event->key() == Qt::Key_F4 || (event->key() == Qt::Key_4 && devicemode)) { - canvas->dumpItems(); - canvas->checkState(); } else if (event->key() == Qt::Key_F5 || (event->key() == Qt::Key_5 && devicemode)) { reload(); - } else if (event->key() == Qt::Key_F6 || (event->key() == Qt::Key_6 && devicemode)) { - canvas->dumpRoot(); - } else if (event->key() == Qt::Key_F7 || (event->key() == Qt::Key_7 && devicemode)) { - canvas->dumpTiming(); } else if (event->key() == Qt::Key_F8 || (event->key() == Qt::Key_8 && devicemode)) { QPerformanceLog::displayData(); QPerformanceLog::clear(); - } else if (event->key() == Qt::Key_F9) { - if(testEngine) testEngine->save(); - } else if (event->key() == Qt::Key_F10) { - if(testEngine) testEngine->captureFullFrame(); } QWidget::keyPressEvent(event); @@ -659,10 +646,12 @@ void QmlViewer::timerEvent(QTimerEvent *event) { if (event->timerId() == recordTimer.timerId()) { if (frame_stream) { - QImage frame(canvas->asImage()); - frame_stream->write((char*)frame.bits(),frame.numBytes()); + // ### GV + // QImage frame(canvas->asImage()); + // frame_stream->write((char*)frame.bits(),frame.numBytes()); } else { - frames.append(new QImage(canvas->asImage())); + // ### GV + // frames.append(new QImage(canvas->asImage())); } if (record_autotime && autoTimer.elapsed() >= record_autotime) setRecording(false); diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 9de47a8..d97760f 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -30,7 +30,7 @@ class QmlViewer : public QWidget { Q_OBJECT public: - QmlViewer(QFxTestEngine::TestMode = QFxTestEngine::NoTest, const QString &testDir = QString(), QWidget *parent=0, Qt::WindowFlags flags=0); + QmlViewer(const QString &testDir = QString(), QWidget *parent=0, Qt::WindowFlags flags=0); void setRecordDither(const QString& s) { record_dither = s; } void setRecordPeriod(int ms); @@ -90,8 +90,6 @@ private: QString currentSkin; bool scaleSkin; mutable QMenuBar *mb; - - QFxTestEngine *testEngine; }; #endif -- cgit v0.12 From 970bfaba5a1a3c1ed84040ab1bbabbde10f2bf1b Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 23 Jun 2009 15:39:53 +0200 Subject: Export QGraphicsItemPrivate from QtGui, QFxItemPrivate in QtDeclarative subclasses it --- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 10e03de..83806c0 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -92,7 +92,7 @@ public: void purge(); }; -class Q_AUTOTEST_EXPORT QGraphicsItemPrivate +class Q_GUI_EXPORT QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QGraphicsItem) public: -- cgit v0.12 From 8391e67dce6011bc8b418125686a5a4699d5e2d8 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 23 Jun 2009 15:41:31 +0200 Subject: Get rid of some compiler warnings. --- src/declarative/fx/qfxitem.cpp | 2 ++ src/declarative/fx/qfxrepeater.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index d4a5b06..6cffecf 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2176,6 +2176,7 @@ QPointF QFxItem::transformOriginPoint() const void QFxItem::setFocus(bool focus) { + Q_UNUSED(focus) return; } @@ -2475,6 +2476,7 @@ bool QFxItem::activeFocusPanel() const void QFxItem::setActiveFocusPanel(bool b) { + Q_UNUSED(b) } bool QFxItem::hasActiveFocus() const diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 3ed47cd..a4dc809 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -57,6 +57,7 @@ QFxRepeaterPrivate::~QFxRepeaterPrivate() QFxItem *QFxRepeaterPrivate::addItem(QmlContext *ctxt, QFxItem *lastItem) { + Q_UNUSED(lastItem) Q_Q(QFxRepeater); QObject *nobj = component->create(ctxt); QFxItem *item = qobject_cast(nobj); -- cgit v0.12 From 435f6f842c116de641917d0b352f1c21cec666ee Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 24 Jun 2009 14:22:15 +1000 Subject: Compile --- src/declarative/fx/qfxwebview.cpp | 8 -------- src/declarative/fx/qfxwebview.h | 3 +++ tools/qmlviewer/main.cpp | 4 +--- tools/qmlviewer/qmlviewer.cpp | 3 +-- tools/qmlviewer/qmlviewer.h | 4 +--- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index f7979e5..ec7c548 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -461,7 +461,6 @@ void QFxWebView::paintPage(const QRect& r) update(); } -<<<<<<< HEAD:src/declarative/fx/qfxwebview.cpp /*! \qmlproperty int WebView::cacheSize @@ -507,13 +506,6 @@ void QFxWebView::setCacheSize(int pixels) } } d->max_imagecache_size = pixels; -======= -void QFxWebView::dump(int depth) -{ - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "url:" << url(); - QFxPaintedItem::dump(depth); ->>>>>>> 124f5714e8e6ec1945d536e622b51304f2b32dd7:src/declarative/fx/qfxwebview.cpp } void QFxWebView::drawContents(QPainter *p, const QRect &r) diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index 897b6cc..d4b70d3 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -159,6 +159,9 @@ public: QString status() const; + int cacheSize() const; + void setCacheSize(int pixels); + Q_SIGNALS: void idealWidthChanged(); void idealHeightChanged(); diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index 448437c..db0a28f 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -15,7 +15,6 @@ #include "qmlviewer.h" #include #include -#include "qfxtestengine.h" #include #include #include @@ -76,7 +75,6 @@ int main(int argc, char ** argv) QString skin; bool devkeys = false; bool cache = false; - QString testDir; QString translationFile; for (int i = 1; i < argc; ++i) { @@ -126,7 +124,7 @@ int main(int argc, char ** argv) app.installTranslator(&qmlTranslator); } - QmlViewer viewer(testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + QmlViewer viewer(0, frameless ? Qt::FramelessWindowHint : Qt::Widget); foreach (QString lib, libraries) viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index c8b4250..19866cc 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -19,7 +19,6 @@ #include #include "qml.h" #include "qperformancelog.h" -#include "qfxtestengine.h" #include "deviceskin.h" #include @@ -125,7 +124,7 @@ void PreviewDeviceSkin::slotPopupMenu() } -QmlViewer::QmlViewer(const QString &testDir, QWidget *parent, Qt::WindowFlags flags) +QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), frame_stream(0), scaleSkin(true), mb(0) { devicemode = false; diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index d97760f..22f07a0 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -17,7 +17,6 @@ #include #include #include -#include #include @@ -30,7 +29,7 @@ class QmlViewer : public QWidget { Q_OBJECT public: - QmlViewer(const QString &testDir = QString(), QWidget *parent=0, Qt::WindowFlags flags=0); + QmlViewer(QWidget *parent=0, Qt::WindowFlags flags=0); void setRecordDither(const QString& s) { record_dither = s; } void setRecordPeriod(int ms); @@ -74,7 +73,6 @@ private: PreviewDeviceSkin *skin; QSize skinscreensize; QFxView *canvas; - void init(QFxTestEngine::TestMode, const QString &, const QString& fileName); QBasicTimer recordTimer; QList frames; QProcess* frame_stream; -- cgit v0.12 From 296da87493aafe7097a9fe2c3ab1e21d0b3bc918 Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Thu, 2 Jul 2009 14:06:25 +0200 Subject: Add QGraphicsView::filtersChildEvents property. This obsoletes QGraphicsView::handlesChildEvents. --- src/gui/graphicsview/qgraphicsitem.cpp | 49 +++++++++++++++++++++++++++++++-- src/gui/graphicsview/qgraphicsitem.h | 3 ++ src/gui/graphicsview/qgraphicsitem_p.h | 13 +++++---- src/gui/graphicsview/qgraphicsscene.cpp | 23 +++++++++++++++- src/gui/graphicsview/qgraphicsscene_p.h | 1 + 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e8ed97f..209094d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -659,6 +659,10 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch // For root items only. This is the item that has either enabled or // disabled \a childFlag, or has been reparented. switch (int(childFlag)) { + case -2: + flag = AncestorFiltersChildEvents; + enabled = q->filtersChildEvents(); + break; case -1: flag = AncestorHandlesChildEvents; enabled = q->handlesChildEvents(); @@ -679,7 +683,8 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch // Inherit the enabled-state from our parents. if ((parent && ((parent->d_ptr->ancestorFlags & flag) || (int(parent->d_ptr->flags & childFlag) == childFlag) - || (childFlag == -1 && parent->d_ptr->handlesChildEvents)))) { + || (childFlag == -1 && parent->d_ptr->handlesChildEvents) + || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)))) { enabled = true; ancestorFlags |= flag; } @@ -700,7 +705,9 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch ancestorFlags &= ~flag; // Don't process children if the item has the main flag set on itself. - if ((childFlag != -1 && int(flags & childFlag) == childFlag) || (int(childFlag) == -1 && handlesChildEvents)) + if ((childFlag != -1 && int(flags & childFlag) == childFlag) + || (int(childFlag) == -1 && handlesChildEvents) + || (int(childFlag) == -2 && filtersDescendantEvents)) return; } @@ -921,6 +928,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } // Inherit ancestor flags from the new parent. + updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape); updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations); @@ -937,6 +945,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } else { // Inherit ancestor flags from the new parent. + updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape); updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations); @@ -2317,6 +2326,40 @@ void QGraphicsItem::setAcceptTouchEvents(bool enabled) } /*! + Returns true if this item filters child events (i.e., all events + intended for any of its children are instead sent to this item); + otherwise, false is returned. + + The default value is false; child events are not filtered. + + \sa setFiltersChildEvents() +*/ +bool QGraphicsItem::filtersChildEvents() const +{ + return d_ptr->filtersDescendantEvents; +} + +/*! + If \a enabled is true, this item is set to filter all events for + all its children (i.e., all events intented for any of its + children are instead sent to this item); otherwise, if \a enabled + is false, this item will only handle its own events. The default + value is false. + + \sa filtersChildEvents() +*/ +void QGraphicsItem::setFiltersChildEvents(bool enabled) +{ + if (d_ptr->filtersDescendantEvents == enabled) + return; + + d_ptr->filtersDescendantEvents = enabled; + d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); +} + +/*! + \obsolete + Returns true if this item handles child events (i.e., all events intended for any of its children are instead sent to this item); otherwise, false is returned. @@ -2337,6 +2380,8 @@ bool QGraphicsItem::handlesChildEvents() const } /*! + \obsolete + If \a enabled is true, this item is set to handle all events for all its children (i.e., all events intented for any of its children are instead sent to this item); otherwise, if \a enabled diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 3a3d1a1..6697165 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -215,6 +215,9 @@ public: bool acceptTouchEvents() const; void setAcceptTouchEvents(bool enabled); + bool filtersChildEvents() const; + void setFiltersChildEvents(bool enabled); + bool handlesChildEvents() const; void setHandlesChildEvents(bool enabled); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a0d061b..999b7f1 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -116,7 +116,8 @@ public: NoFlag = 0, AncestorHandlesChildEvents = 0x1, AncestorClipsChildren = 0x2, - AncestorIgnoresTransformations = 0x4 + AncestorIgnoresTransformations = 0x4, + AncestorFiltersChildEvents = 0x8 }; inline QGraphicsItemPrivate() @@ -163,6 +164,7 @@ public: ignoreOpacity(0), acceptTouchEvents(0), acceptedTouchBeginEvent(0), + filtersDescendantEvents(0), globalStackingOrder(-1), q_ptr(0) { @@ -431,7 +433,7 @@ public: quint32 handlesChildEvents : 1; quint32 itemDiscovered : 1; quint32 hasCursor : 1; - quint32 ancestorFlags : 3; + quint32 ancestorFlags : 4; quint32 cacheMode : 2; quint32 hasBoundingRegionGranularity : 1; quint32 isWidget : 1; @@ -443,13 +445,13 @@ public: quint32 inSetPosHelper : 1; quint32 needSortChildren : 1; quint32 allChildrenDirty : 1; - quint32 fullUpdatePending : 1; // New 32 bits + quint32 fullUpdatePending : 1; quint32 flags : 12; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; - quint32 dirtySceneTransform : 1; + quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; quint32 inDestructor : 1; quint32 isObject : 1; @@ -457,7 +459,8 @@ public: quint32 ignoreOpacity : 1; quint32 acceptTouchEvents : 1; quint32 acceptedTouchBeginEvent : 1; - quint32 unused : 10; // feel free to use + quint32 filtersDescendantEvents : 1; + quint32 unused : 8; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index d790640..90c5224 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1185,6 +1185,24 @@ void QGraphicsScenePrivate::removeSceneEventFilter(QGraphicsItem *watched, QGrap } /*! + \internal +*/ +bool QGraphicsScenePrivate::filterDescendantEvent(QGraphicsItem *item, QEvent *event) +{ + if (item && (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) { + QGraphicsItem *parent = item->parentItem(); + while (parent) { + if (parent->d_ptr->filtersDescendantEvents && parent->sceneEventFilter(item, event)) + return true; + if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) + return false; + parent = parent->parentItem(); + } + } + return false; +} + +/*! \internal */ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) @@ -1216,7 +1234,9 @@ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) { if (filterEvent(item, event)) return false; - return (item && item->isEnabled()) ? item->sceneEvent(event) : false; + if (filterDescendantEvent(item, event)) + return false; + return (item && item->isEnabled() ? item->sceneEvent(event) : false); } /*! @@ -4123,6 +4143,7 @@ void QGraphicsScenePrivate::sendGestureEvent(const QSet &gestures, co } QGesturePrivate *gd = g->d_func(); QGraphicsItem *item = gd->graphicsItem; + Q_UNUSED(item); // ### REMOVE gd->graphicsItem = 0; //### THIS IS BS, DONT FORGET TO REWRITE THIS CODE diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 3c3a811..53ed129 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -194,6 +194,7 @@ public: QMultiMap sceneEventFilters; void installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter); void removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter); + bool filterDescendantEvent(QGraphicsItem *item, QEvent *event); bool filterEvent(QGraphicsItem *item, QEvent *event); bool sendEvent(QGraphicsItem *item, QEvent *event); -- cgit v0.12 From 5eab82d13202e81f344ecde7798b607f318331ef Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Thu, 2 Jul 2009 15:48:08 +0200 Subject: Add auto-tests for QGraphicsItem::filtersChildEvents. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 123 +++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 7552f18..ed1f9a5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -182,6 +182,8 @@ private slots: void handlesChildEvents(); void handlesChildEvents2(); void handlesChildEvents3(); + void filtersChildEvents(); + void filtersChildEvents2(); void ensureVisible(); void cursor(); //void textControlGetterSetter(); @@ -3405,6 +3407,127 @@ void tst_QGraphicsItem::handlesChildEvents3() QCOMPARE(group2->counter, 3); } + +class ChildEventFilterTester : public ChildEventTester +{ +public: + ChildEventFilterTester(const QRectF &rect, QGraphicsItem *parent = 0) + : ChildEventTester(rect, parent), filter(QEvent::None) + { } + + QEvent::Type filter; + +protected: + bool sceneEventFilter(QGraphicsItem *item, QEvent *event) + { + Q_UNUSED(item); + if (event->type() == filter) { + ++counter; + return true; + } + return false; + } +}; + +void tst_QGraphicsItem::filtersChildEvents() +{ + QGraphicsScene scene; + ChildEventFilterTester *root = new ChildEventFilterTester(QRectF(0, 0, 10, 10)); + ChildEventFilterTester *filter = new ChildEventFilterTester(QRectF(10, 10, 10, 10), root); + ChildEventTester *child = new ChildEventTester(QRectF(20, 20, 10, 10), filter); + + // setup filter + filter->setFiltersChildEvents(true); + filter->filter = QEvent::GraphicsSceneMousePress; + + scene.addItem(root); + + QGraphicsView view(&scene); + view.show(); + + QTest::qWait(1000); + + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); + + // send event to child + pressEvent.setButton(Qt::LeftButton); + pressEvent.setScenePos(QPointF(25, 25));//child->mapToScene(5, 5)); + pressEvent.setScreenPos(view.mapFromScene(pressEvent.scenePos())); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setScenePos(QPointF(25, 25));//child->mapToScene(5, 5)); + releaseEvent.setScreenPos(view.mapFromScene(pressEvent.scenePos())); + QApplication::sendEvent(&scene, &pressEvent); + QApplication::sendEvent(&scene, &releaseEvent); + + QCOMPARE(child->counter, 1); // mouse release is not filtered + QCOMPARE(filter->counter, 1); // mouse press is filtered + QCOMPARE(root->counter, 0); + + // add another filter + root->setFiltersChildEvents(true); + root->filter = QEvent::GraphicsSceneMouseRelease; + + // send event to child + QApplication::sendEvent(&scene, &pressEvent); + QApplication::sendEvent(&scene, &releaseEvent); + + QCOMPARE(child->counter, 1); + QCOMPARE(filter->counter, 2); // mouse press is filtered + QCOMPARE(root->counter, 1); // mouse release is filtered + + // reparent to another sub-graph + ChildEventTester *parent = new ChildEventTester(QRectF(10, 10, 10, 10), root); + child->setParentItem(parent); + + // send event to child + QApplication::sendEvent(&scene, &pressEvent); + QApplication::sendEvent(&scene, &releaseEvent); + + QCOMPARE(child->counter, 2); // mouse press is _not_ filtered + QCOMPARE(parent->counter, 0); + QCOMPARE(filter->counter, 2); + QCOMPARE(root->counter, 2); // mouse release is filtered +} + +void tst_QGraphicsItem::filtersChildEvents2() +{ + ChildEventFilterTester *root = new ChildEventFilterTester(QRectF(0, 0, 10, 10)); + root->setFiltersChildEvents(true); + root->filter = QEvent::GraphicsSceneMousePress; + QVERIFY(root->filtersChildEvents()); + + ChildEventTester *child = new ChildEventTester(QRectF(0, 0, 10, 10), root); + QVERIFY(!child->filtersChildEvents()); + + ChildEventTester *child2 = new ChildEventTester(QRectF(0, 0, 10, 10)); + ChildEventTester *child3 = new ChildEventTester(QRectF(0, 0, 10, 10), child2); + ChildEventTester *child4 = new ChildEventTester(QRectF(0, 0, 10, 10), child3); + + child2->setParentItem(root); + QVERIFY(!child2->filtersChildEvents()); + QVERIFY(!child3->filtersChildEvents()); + QVERIFY(!child4->filtersChildEvents()); + + QGraphicsScene scene; + scene.addItem(root); + + QGraphicsView view(&scene); + view.show(); + + QTestEventLoop::instance().enterLoop(1); + + QMouseEvent event(QEvent::MouseButtonPress, view.mapFromScene(5, 5), + view.viewport()->mapToGlobal(view.mapFromScene(5, 5)), Qt::LeftButton, 0, 0); + QApplication::sendEvent(view.viewport(), &event); + + QCOMPARE(child->counter, 0); + QCOMPARE(child2->counter, 0); + QCOMPARE(child3->counter, 0); + QCOMPARE(child4->counter, 0); + QCOMPARE(root->counter, 1); +} + class CustomItem : public QGraphicsItem { public: -- cgit v0.12 From 22ff3df15cc3143e6410b02f39b967d1d76cf2d6 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Jul 2009 17:37:43 +1000 Subject: Manual cherrypick of QLineControl from kinetic-declarativeui-qfxlineedit Splits out the control logic of QLineEdit into QLineControl, which is somewhat similar to QTextEdit. This was originally worked on in the ianws-qt-lineedit-textedit-research repository, and then further developed in kinetic in the kinetic-declarativeui-qfxlineedit branch. Note that this also includes a tiny change to qvalidator.h which allows validators to be used in qml. --- src/gui/widgets/qlinecontrol.cpp | 1707 ++++++++++++++++++++++++++++++++ src/gui/widgets/qlinecontrol_p.h | 715 ++++++++++++++ src/gui/widgets/qlinecontrol_p_p.h | 105 ++ src/gui/widgets/qlineedit.cpp | 1885 ++++-------------------------------- src/gui/widgets/qlineedit.h | 2 + src/gui/widgets/qlineedit_p.cpp | 253 +++++ src/gui/widgets/qlineedit_p.h | 174 +--- src/gui/widgets/qvalidator.h | 6 +- src/gui/widgets/widgets.pri | 3 + 9 files changed, 3010 insertions(+), 1840 deletions(-) create mode 100644 src/gui/widgets/qlinecontrol.cpp create mode 100644 src/gui/widgets/qlinecontrol_p.h create mode 100644 src/gui/widgets/qlinecontrol_p_p.h create mode 100644 src/gui/widgets/qlineedit_p.cpp diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp new file mode 100644 index 0000000..b762a00 --- /dev/null +++ b/src/gui/widgets/qlinecontrol.cpp @@ -0,0 +1,1707 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qlinecontrol_p.h" + +#ifndef QT_NO_LINEEDIT + +#include "qabstractitemview.h" +#include "qclipboard.h" +#ifndef QT_NO_ACCESSIBILITY +#include "qaccessible.h" +#endif +#ifndef QT_NO_IM +#include "qinputcontext.h" +#include "qlist.h" +#endif +#include "qapplication.h" +#ifndef QT_NO_GRAPHICSVIEW +#include "qgraphicssceneevent.h" +#endif + +QT_BEGIN_NAMESPACE + +/* + Updates the display text based of the current edit text + If the text has changed will emit displayTextChanged() +*/ +void QLineControl::updateDisplayText() +{ + QString orig = textLayout.text(); + QString str; + if (m_echoMode == QLineEdit::NoEcho) + str = QString::fromLatin1(""); + else + str = m_text; + + if (m_echoMode == QLineEdit::Password || (m_echoMode == QLineEdit::PasswordEchoOnEdit + && !m_passwordEchoEditing)) + str.fill(m_passwordCharacter); + + // replace certain non-printable characters with spaces (to avoid + // drawing boxes when using fonts that don't have glyphs for such + // characters) + QChar* uc = str.data(); + for (int i = 0; i < (int)str.length(); ++i) { + if ((uc[i] < 0x20 && uc[i] != 0x09) + || uc[i] == QChar::LineSeparator + || uc[i] == QChar::ParagraphSeparator + || uc[i] == QChar::ObjectReplacementCharacter) + uc[i] = QChar(0x0020); + } + + textLayout.setText(str); + + QTextOption option; + option.setTextDirection(m_layoutDirection); + option.setFlags(QTextOption::IncludeTrailingSpaces); + textLayout.setTextOption(option); + + textLayout.beginLayout(); + QTextLine l = textLayout.createLine(); + textLayout.endLayout(); + m_ascent = qRound(l.ascent()); + + if (str != orig) + emit displayTextChanged(str); +} + +#ifndef QT_NO_CLIPBOARD +/* + Copies the currently selected text into the clipboard using the given + \a mode. + + \note If the echo mode is set to a mode other than Normal then copy + will not work. This is to prevent using copy as a method of bypassing + password features of the line control. +*/ +void QLineControl::copy(QClipboard::Mode mode) const +{ + QString t = selectedText(); + if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) { + disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); + QApplication::clipboard()->setText(t, mode); + connect(QApplication::clipboard(), SIGNAL(selectionChanged()), + this, SLOT(_q_clipboardChanged())); + } +} + +/* + Inserts the text stored in the application clipboard into the line + control. + + \sa insert() +*/ +void QLineControl::paste() +{ + insert(QApplication::clipboard()->text(QClipboard::Clipboard)); +} + +#endif // !QT_NO_CLIPBOARD + +/* + Handles the behavior for the backspace key or function. + Removes the current selection if there is a selection, otherwise + removes the character prior to the cursor position. + + \sa del() +*/ +void QLineControl::backspace() +{ + int priorState = undoState; + if (hasSelectedText()) { + removeSelectedText(); + } else if (m_cursor) { + --m_cursor; + if (maskData) + m_cursor = prevMaskBlank(m_cursor); + QChar uc = m_text.at(m_cursor); + if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + // second half of a surrogate, check if we have the first half as well, + // if yes delete both at once + uc = m_text.at(m_cursor - 1); + if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { + p_del(true); + --m_cursor; + } + } + p_del(true); + } + finishChange(priorState); +} + +/* + Handles the behavior for the delete key or function. + Removes the current selection if there is a selection, otherwise + removes the character after the cursor position. + + \sa del() +*/ +void QLineControl::del() +{ + int priorState = undoState; + if (hasSelectedText()) { + removeSelectedText(); + } else { + int n = textLayout.nextCursorPosition(m_cursor) - m_cursor; + while (n--) + p_del(); + } + finishChange(priorState); +} + +/* + Inserts the given \a newText at the current cursor position. + If there is any selected text it is removed prior to insertion of + the new text. +*/ +void QLineControl::insert(const QString &newText) +{ + int priorState = undoState; + removeSelectedText(); + p_insert(newText); + finishChange(priorState); +} + +/* + Clears the line control text. +*/ +void QLineControl::clear() +{ + int priorState = undoState; + selstart = 0; + selend = m_text.length(); + removeSelectedText(); + separate(); + finishChange(priorState, /*update*/false, /*edited*/false); +} + +/* + Sets \a length characters from the given \a start position as selected. + The given \a start position must be within the current text for + the line control. If \a length characters cannot be selected, then + the selection will extend to the end of the current text. +*/ +void QLineControl::setSelection(int start, int length) +{ + Q_ASSERT_X(start >= 0 && start <= (int)m_text.length(), + "QLineControl::setSelection", "Invalid start position"); + + if (length > 0) { + selstart = start; + selend = qMin(start + length, (int)m_text.length()); + m_cursor = selend; + } else { + selstart = qMax(start + length, 0); + selend = start; + m_cursor = selstart; + } +} + +void QLineControl::_q_clipboardChanged() +{ +} + +void QLineControl::_q_deleteSelected() +{ + if (!hasSelectedText()) + return; + + int priorState = undoState; + emit resetInputContext(); + removeSelectedText(); + separate(); + finishChange(priorState); +} + +/* + Initializes the line control with a starting text value of \a txt. +*/ +void QLineControl::init(const QString& txt) +{ + m_text = txt; + updateDisplayText(); + m_cursor = m_text.length(); +} + +/* + Sets the password echo editing to \a editing. If password echo editing + is true, then the text of the password is displayed even if the echo + mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing + does not affect other echo modes. +*/ +void QLineControl::updatePasswordEchoEditing(bool editing) +{ + m_passwordEchoEditing = editing; + updateDisplayText(); +} + +/* + Returns the cursor position of the given \a x pixel value in relation + to the displayed text. The given \a betweenOrOn specified what kind + of cursor position is requested. +*/ +int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const +{ + return textLayout.lineAt(0).xToCursor(x, betweenOrOn); +} + +/* + Returns the bounds of the current cursor, as defined as a + between characters cursor. +*/ +QRect QLineControl::cursorRect() const +{ + QTextLine l = textLayout.lineAt(0); + int c = m_cursor; + if (m_preeditCursor != -1) + c += m_preeditCursor; + int cix = qRound(l.cursorToX(c)); + int w = m_cursorWidth; + int ch = l.height() + 1; + + return QRect(cix-5, 0, w+9, ch); +} + +/* + Fixes the current text so that it is valid given any set validators. + + Returns true if the text was changed. Otherwise returns false. +*/ +bool QLineControl::fixup() // this function assumes that validate currently returns != Acceptable +{ +#ifndef QT_NO_VALIDATOR + if (m_validator) { + QString textCopy = m_text; + int cursorCopy = m_cursor; + m_validator->fixup(textCopy); + if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) { + if (textCopy != m_text || cursorCopy != m_cursor) + p_setText(textCopy, cursorCopy); + return true; + } + } +#endif + return false; +} + +/* + Moves the cursor to the given position \a pos. If \a mark is true will + adjust the currently selected text. +*/ +void QLineControl::moveCursor(int pos, bool mark) +{ + if (pos != m_cursor) { + separate(); + if (maskData) + pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); + } + if (mark) { + int anchor; + if (selend > selstart && m_cursor == selstart) + anchor = selend; + else if (selend > selstart && m_cursor == selend) + anchor = selstart; + else + anchor = m_cursor; + selstart = qMin(anchor, pos); + selend = qMax(anchor, pos); + updateDisplayText(); + } else { + p_deselect(); + } + m_cursor = pos; + if (mark || selDirty) { + selDirty = false; + emit selectionChanged(); + } + emitCursorPositionChanged(); +} + +/* + Applies the given input method event \a event to the text of the line + control +*/ +void QLineControl::processInputMethodEvent(QInputMethodEvent *event) +{ + int priorState = undoState; + removeSelectedText(); + + int c = m_cursor; // cursor position after insertion of commit string + if (event->replacementStart() <= 0) + c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength()); + + m_cursor += event->replacementStart(); + + // insert commit string + if (event->replacementLength()) { + selstart = m_cursor; + selend = selstart + event->replacementLength(); + removeSelectedText(); + } + if (!event->commitString().isEmpty()) + insert(event->commitString()); + + m_cursor = qMin(c, m_text.length()); + + setPreeditArea(m_cursor, event->preeditString()); + m_preeditCursor = event->preeditString().length(); + hideCursor = false; + QList formats; + for (int i = 0; i < event->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = event->attributes().at(i); + if (a.type == QInputMethodEvent::Cursor) { + m_preeditCursor = a.start; + hideCursor = !a.length; + } else if (a.type == QInputMethodEvent::TextFormat) { + QTextCharFormat f = qvariant_cast(a.value).toCharFormat(); + if (f.isValid()) { + QTextLayout::FormatRange o; + o.start = a.start + m_cursor; + o.length = a.length; + o.format = f; + formats.append(o); + } + } + } + textLayout.setAdditionalFormats(formats); + updateDisplayText(); + if (!event->commitString().isEmpty()) + emitCursorPositionChanged(); + finishChange(priorState); +} + +/* + Draws the display text for the line control using the given + \a painter, \a clip, and \a offset. Which aspects of the display text + are drawn is specified by the given \a flags. + + If the flags contain DrawSelections, then the selection or input mask + backgrounds and foregrounds will be applied before drawing the text. + + If the flags contain DrawCursor a cursor of the current cursorWidth() + will be drawn after drawing the text. + + The display text will only be drawn if the flags contain DrawText +*/ +void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags) +{ + QVector selections; + if (flags & DrawSelections) { + QTextLayout::FormatRange o; + if (selstart < selend) { + o.start = selstart; + o.length = selend - selstart; + o.format.setBackground(m_palette.brush(QPalette::Highlight)); + o.format.setForeground(m_palette.brush(QPalette::HighlightedText)); + } else { + // mask selection + o.start = m_cursor; + o.length = 1; + o.format.setBackground(m_palette.brush(QPalette::Text)); + o.format.setForeground(m_palette.brush(QPalette::Window)); + } + selections.append(o); + } + + if (flags & DrawText) + textLayout.draw(painter, offset, selections, clip); + + if (flags & DrawCursor){ + if(!m_blinkPeriod || m_blinkStatus) + textLayout.drawCursor(painter, offset, m_cursor, m_cursorWidth); + } +} + +/* + Sets the selection to cover the word at the given cursor position. + The word boundries is defined by the behavior of QTextLayout::SkipWords + cursor mode. +*/ +void QLineControl::selectWordAtPos(int cursor) +{ + int c = textLayout.previousCursorPosition(cursor, QTextLayout::SkipWords); + moveCursor(c, false); + // ## text layout should support end of words. + int end = textLayout.nextCursorPosition(cursor, QTextLayout::SkipWords); + while (end > cursor && m_text[end-1].isSpace()) + --end; + moveCursor(end, true); +} + +/* + Completes a change to the line control text. If the change is not valid + will undo the line control state back to the given \a validateFromState. + + If \a edited is true and the change is valid, will emit textEdited() in + addition to textChanged(). Otherwise only emits textChanged() on a valid + change. + + The \a update value is currently unused. +*/ + +bool QLineControl::finishChange(int validateFromState, bool update, bool edited) +{ + Q_UNUSED(update) + bool lineDirty = selDirty; + if (textDirty) { + // do validation + bool wasValidInput = validInput; + validInput = true; +#ifndef QT_NO_VALIDATOR + if (m_validator) { + validInput = false; + QString textCopy = m_text; + int cursorCopy = m_cursor; + validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid); + if (validInput) { + if (m_text != textCopy) { + p_setText(textCopy, cursorCopy); + return true; + } + m_cursor = cursorCopy; + } + } +#endif + if (validateFromState >= 0 && wasValidInput && !validInput) { + if (transactions.count()) + return false; + p_undo(validateFromState); + history.resize(undoState); + if (modifiedState > undoState) + modifiedState = -1; + validInput = true; + textDirty = false; + } + updateDisplayText(); + lineDirty |= textDirty; + if (textDirty) { + textDirty = false; + QString actualText = text(); + if (edited) + emit textEdited(actualText); + emit textChanged(actualText); + } + } + if (selDirty) { + selDirty = false; + emit selectionChanged(); + } + emitCursorPositionChanged(); + return true; +} + +/* + An internal function for setting the text of the line control. +*/ +void QLineControl::p_setText(const QString& txt, int pos, bool edited) +{ + p_deselect(); + emit resetInputContext(); + QString oldText = m_text; + if (maskData) { + m_text = maskString(0, txt, true); + m_text += clearString(m_text.length(), m_maxLength - m_text.length()); + } else { + m_text = txt.isEmpty() ? txt : txt.left(m_maxLength); + } + history.clear(); + modifiedState = undoState = 0; + m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; + textDirty = (oldText != m_text); + finishChange(-1, true, edited); +} + + +/* + Adds the given \a command to the undo history + of the line control. Does not apply the command. +*/ +void QLineControl::addCommand(const Command& cmd) +{ + if (separator && undoState && history[undoState-1].type != Separator) { + history.resize(undoState + 2); + history[undoState++] = Command(Separator, m_cursor, 0, selstart, selend); + } else { + history.resize(undoState + 1); + } + separator = false; + history[undoState++] = cmd; +} + +/* + Inserts the given string \a s into the line + control. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QLineControl::p_insert(const QString& s) +{ + if (hasSelectedText()) + addCommand(Command(SetSelection, m_cursor, 0, selstart, selend)); + if (maskData) { + QString ms = maskString(m_cursor, s); + for (int i = 0; i < (int) ms.length(); ++i) { + addCommand (Command(DeleteSelection, m_cursor+i, m_text.at(m_cursor+i), -1, -1)); + addCommand(Command(Insert, m_cursor+i, ms.at(i), -1, -1)); + } + m_text.replace(m_cursor, ms.length(), ms); + m_cursor += ms.length(); + m_cursor = nextMaskBlank(m_cursor); + textDirty = true; + } else { + int remaining = m_maxLength - m_text.length(); + if (remaining != 0) { + m_text.insert(m_cursor, s.left(remaining)); + for (int i = 0; i < (int) s.left(remaining).length(); ++i) + addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); + textDirty = true; + } + } +} + +/* + \internal + deletes a single character from the current text. If \a wasBackspace, + the character prior to the cursor is removed. Otherwise the character + after the cursor is removed. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QLineControl::p_del(bool wasBackspace) +{ + if (m_cursor < (int) m_text.length()) { + if (hasSelectedText()) + addCommand(Command(SetSelection, m_cursor, 0, selstart, selend)); + addCommand (Command((CommandType)((maskData?2:0)+(wasBackspace?Remove:Delete)), m_cursor, m_text.at(m_cursor), -1, -1)); + if (maskData) { + m_text.replace(m_cursor, 1, clearString(m_cursor, 1)); + addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1)); + } else { + m_text.remove(m_cursor, 1); + } + textDirty = true; + } +} + +/* + \internal + removes the currently selected text from the line control. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QLineControl::removeSelectedText() +{ + if (selstart < selend && selend <= (int) m_text.length()) { + separate(); + int i ; + addCommand(Command(SetSelection, m_cursor, 0, selstart, selend)); + if (selstart <= m_cursor && m_cursor < selend) { + // cursor is within the selection. Split up the commands + // to be able to restore the correct cursor position + for (i = m_cursor; i >= selstart; --i) + addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); + for (i = selend - 1; i > m_cursor; --i) + addCommand (Command(DeleteSelection, i - m_cursor + selstart - 1, m_text.at(i), -1, -1)); + } else { + for (i = selend-1; i >= selstart; --i) + addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); + } + if (maskData) { + m_text.replace(selstart, selend - selstart, clearString(selstart, selend - selstart)); + for (int i = 0; i < selend - selstart; ++i) + addCommand(Command(Insert, selstart + i, m_text.at(selstart + i), -1, -1)); + } else { + m_text.remove(selstart, selend - selstart); + } + if (m_cursor > selstart) + m_cursor -= qMin(m_cursor, selend) - selstart; + p_deselect(); + textDirty = true; + } +} + +/* + Parses the input mask specified by \a maskFields to generate + the mask data used to handle input masks. +*/ +void QLineControl::parseInputMask(const QString &maskFields) +{ + int delimiter = maskFields.indexOf(QLatin1Char(';')); + if (maskFields.isEmpty() || delimiter == 0) { + if (maskData) { + delete [] maskData; + maskData = 0; + m_maxLength = 32767; + p_setText(QString()); + } + return; + } + + if (delimiter == -1) { + blank = QLatin1Char(' '); + m_inputMask = maskFields; + } else { + m_inputMask = maskFields.left(delimiter); + blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' '); + } + + // calculate m_maxLength / maskData length + m_maxLength = 0; + QChar c = 0; + for (int i=0; i 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) { + m_maxLength++; + continue; + } + if (c != QLatin1Char('\\') && c != QLatin1Char('!') && + c != QLatin1Char('<') && c != QLatin1Char('>') && + c != QLatin1Char('{') && c != QLatin1Char('}') && + c != QLatin1Char('[') && c != QLatin1Char(']')) + m_maxLength++; + } + + delete [] maskData; + maskData = new MaskInputData[m_maxLength]; + + MaskInputData::Casemode m = MaskInputData::NoCaseMode; + c = 0; + bool s; + bool escape = false; + int index = 0; + for (int i = 0; i < m_inputMask.length(); i++) { + c = m_inputMask.at(i); + if (escape) { + s = true; + maskData[index].maskChar = c; + maskData[index].separator = s; + maskData[index].caseMode = m; + index++; + escape = false; + } else if (c == QLatin1Char('<')) { + m = MaskInputData::Lower; + } else if (c == QLatin1Char('>')) { + m = MaskInputData::Upper; + } else if (c == QLatin1Char('!')) { + m = MaskInputData::NoCaseMode; + } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) { + switch (c.unicode()) { + case 'A': + case 'a': + case 'N': + case 'n': + case 'X': + case 'x': + case '9': + case '0': + case 'D': + case 'd': + case '#': + case 'H': + case 'h': + case 'B': + case 'b': + s = false; + break; + case '\\': + escape = true; + default: + s = true; + break; + } + + if (!escape) { + maskData[index].maskChar = c; + maskData[index].separator = s; + maskData[index].caseMode = m; + index++; + } + } + } + p_setText(m_text); +} + + +/* checks if the key is valid compared to the inputMask */ +bool QLineControl::isValidInput(QChar key, QChar mask) const +{ + switch (mask.unicode()) { + case 'A': + if (key.isLetter()) + return true; + break; + case 'a': + if (key.isLetter() || key == blank) + return true; + break; + case 'N': + if (key.isLetterOrNumber()) + return true; + break; + case 'n': + if (key.isLetterOrNumber() || key == blank) + return true; + break; + case 'X': + if (key.isPrint()) + return true; + break; + case 'x': + if (key.isPrint() || key == blank) + return true; + break; + case '9': + if (key.isNumber()) + return true; + break; + case '0': + if (key.isNumber() || key == blank) + return true; + break; + case 'D': + if (key.isNumber() && key.digitValue() > 0) + return true; + break; + case 'd': + if ((key.isNumber() && key.digitValue() > 0) || key == blank) + return true; + break; + case '#': + if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == blank) + return true; + break; + case 'B': + if (key == QLatin1Char('0') || key == QLatin1Char('1')) + return true; + break; + case 'b': + if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == blank) + return true; + break; + case 'H': + if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F'))) + return true; + break; + case 'h': + if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == blank) + return true; + break; + default: + break; + } + return false; +} + +/* + Returns true if the given text \a str is valid for any + validator or input mask set for the line control. + + Otherwise returns false +*/ +bool QLineControl::hasAcceptableInput(const QString &str) const +{ +#ifndef QT_NO_VALIDATOR + QString textCopy = str; + int cursorCopy = m_cursor; + if (m_validator && m_validator->validate(textCopy, cursorCopy) + != QValidator::Acceptable) + return false; +#endif + + if (!maskData) + return true; + + if (str.length() != m_maxLength) + return false; + + for (int i=0; i < m_maxLength; ++i) { + if (maskData[i].separator) { + if (str.at(i) != maskData[i].maskChar) + return false; + } else { + if (!isValidInput(str.at(i), maskData[i].maskChar)) + return false; + } + } + return true; +} + +/* + Applies the inputMask on \a str starting from position \a pos in the mask. \a clear + specifies from where characters should be gotten when a separator is met in \a str - true means + that blanks will be used, false that previous input is used. + Calling this when no inputMask is set is undefined. +*/ +QString QLineControl::maskString(uint pos, const QString &str, bool clear) const +{ + if (pos >= (uint)m_maxLength) + return QString::fromLatin1(""); + + QString fill; + fill = clear ? clearString(0, m_maxLength) : m_text; + + int strIndex = 0; + QString s = QString::fromLatin1(""); + int i = pos; + while (i < m_maxLength) { + if (strIndex < str.length()) { + if (maskData[i].separator) { + s += maskData[i].maskChar; + if (str[(int)strIndex] == maskData[i].maskChar) + strIndex++; + ++i; + } else { + if (isValidInput(str[(int)strIndex], maskData[i].maskChar)) { + switch (maskData[i].caseMode) { + case MaskInputData::Upper: + s += str[(int)strIndex].toUpper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].toLower(); + break; + default: + s += str[(int)strIndex]; + } + ++i; + } else { + // search for separator first + int n = findInMask(i, true, true, str[(int)strIndex]); + if (n != -1) { + if (str.length() != 1 || i == 0 || (i > 0 && (!maskData[i-1].separator || maskData[i-1].maskChar != str[(int)strIndex]))) { + s += fill.mid(i, n-i+1); + i = n + 1; // update i to find + 1 + } + } else { + // search for valid blank if not + n = findInMask(i, true, false, str[(int)strIndex]); + if (n != -1) { + s += fill.mid(i, n-i); + switch (maskData[n].caseMode) { + case MaskInputData::Upper: + s += str[(int)strIndex].toUpper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].toLower(); + break; + default: + s += str[(int)strIndex]; + } + i = n + 1; // updates i to find + 1 + } + } + } + strIndex++; + } + } else + break; + } + + return s; +} + + + +/* + Returns a "cleared" string with only separators and blank chars. + Calling this when no inputMask is set is undefined. +*/ +QString QLineControl::clearString(uint pos, uint len) const +{ + if (pos >= (uint)m_maxLength) + return QString(); + + QString s; + int end = qMin((uint)m_maxLength, pos + len); + for (int i=pos; i= m_maxLength || pos < 0) + return -1; + + int end = forward ? m_maxLength : -1; + int step = forward ? 1 : -1; + int i = pos; + + while (i != end) { + if (findSeparator) { + if (maskData[i].separator && maskData[i].maskChar == searchChar) + return i; + } else { + if (!maskData[i].separator) { + if (searchChar.isNull()) + return i; + else if (isValidInput(searchChar, maskData[i].maskChar)) + return i; + } + } + i += step; + } + return -1; +} + +void QLineControl::p_undo(int until) +{ + if (!isUndoAvailable()) + return; + p_deselect(); + while (undoState && undoState > until) { + Command& cmd = history[--undoState]; + switch (cmd.type) { + case Insert: + m_text.remove(cmd.pos, 1); + m_cursor = cmd.pos; + break; + case SetSelection: + selstart = cmd.selStart; + selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Remove: + case RemoveSelection: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos + 1; + break; + case Delete: + case DeleteSelection: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos; + break; + case Separator: + continue; + } + if (until < 0 && undoState) { + Command& next = history[undoState-1]; + if (next.type != cmd.type && next.type < RemoveSelection + && (cmd.type < RemoveSelection || next.type == Separator)) + break; + } + } + textDirty = true; + emitCursorPositionChanged(); +} + +void QLineControl::p_redo() { + if (!isRedoAvailable()) + return; + p_deselect(); + while (undoState < (int)history.size()) { + Command& cmd = history[undoState++]; + switch (cmd.type) { + case Insert: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos + 1; + break; + case SetSelection: + selstart = cmd.selStart; + selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Remove: + case Delete: + case RemoveSelection: + case DeleteSelection: + m_text.remove(cmd.pos, 1); + selstart = cmd.selStart; + selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Separator: + selstart = cmd.selStart; + selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + } + if (undoState < (int)history.size()) { + Command& next = history[undoState]; + if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator + && (next.type < RemoveSelection || cmd.type == Separator)) + break; + } + } + textDirty = true; + emitCursorPositionChanged(); +} + +/* + If the current cursor position differs from the last emited cursor + position, emits cursorPositionChanged(). +*/ +void QLineControl::emitCursorPositionChanged() +{ + if (m_cursor != lastCursorPos) { + const int oldLast = lastCursorPos; + lastCursorPos = m_cursor; + cursorPositionChanged(oldLast, m_cursor); + } +} + +#ifndef QT_NO_COMPLETER +// iterating forward(dir=1)/backward(dir=-1) from the +// current row based. dir=0 indicates a new completion prefix was set. +bool QLineControl::advanceToEnabledItem(int dir) +{ + int start = m_completer->currentRow(); + if (start == -1) + return false; + int i = start + dir; + if (dir == 0) dir = 1; + do { + if (!m_completer->setCurrentRow(i)) { + if (!m_completer->wrapAround()) + break; + i = i > 0 ? 0 : m_completer->completionCount() - 1; + } else { + QModelIndex currentIndex = m_completer->currentIndex(); + if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled) + return true; + i += dir; + } + } while (i != start); + + m_completer->setCurrentRow(start); // restore + return false; +} + +void QLineControl::complete(int key) +{ + if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal) + return; + + QString text = this->text(); + if (m_completer->completionMode() == QCompleter::InlineCompletion) { + if (key == Qt::Key_Backspace) + return; + int n = 0; + if (key == Qt::Key_Up || key == Qt::Key_Down) { + if (textAfterSelection().length()) + return; + QString prefix = hasSelectedText() ? textBeforeSelection() + : text; + if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0 + || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) { + m_completer->setCompletionPrefix(prefix); + } else { + n = (key == Qt::Key_Up) ? -1 : +1; + } + } else { + m_completer->setCompletionPrefix(text); + } + if (!advanceToEnabledItem(n)) + return; + } else { +#ifndef QT_KEYPAD_NAVIGATION + if (text.isEmpty()) { + m_completer->popup()->hide(); + return; + } +#endif + m_completer->setCompletionPrefix(text); + } + + m_completer->complete(); +} +#endif + +void QLineControl::setCursorBlinkPeriod(int msec) +{ + if(msec == m_blinkPeriod) + return; + if(m_blinkTimer){ + killTimer(m_blinkTimer); + } + if(msec){ + m_blinkTimer = startTimer(msec/2); + m_blinkStatus = 1; + }else{ + m_blinkTimer = 0; + if(m_blinkStatus == 0) + emit updateNeeded(inputMask().isEmpty()?cursorRect():QRect()); + } + m_blinkPeriod = msec; +} + +void QLineControl::timerEvent ( QTimerEvent * event ) +{ + if(event->timerId() == m_blinkTimer) { + m_blinkStatus = !m_blinkStatus; + emit updateNeeded(inputMask().isEmpty()?cursorRect():QRect()); + }else if(event->timerId() == m_deleteAllTimer){ + killTimer(m_deleteAllTimer); + m_deleteAllTimer = 0; + clear(); + }else if(event->timerId() == m_tripleClickTimer){ + killTimer(m_tripleClickTimer); + m_tripleClickTimer = 0; + } +} + +bool QLineControl::processEvent(QEvent* ev) +{ +#ifdef QT_KEYPAD_NAVIGATION + if (QApplication::keypadNavigationEnabled()) { + if ((ev->type() == QEvent::KeyPress) || (ev->type() == QEvent::KeyRelease)) { + QKeyEvent *ke = (QKeyEvent *)ev; + if (ke->key() == Qt::Key_Back) { + if (ke->isAutoRepeat()) { + // Swallow it. We don't want back keys running amok. + ke->accept(); + return true; + } + if ((ev->type() == QEvent::KeyRelease) + && !isReadOnly() + && deleteAllTimer) { + killTimer(m_deleteAllTimer); + m_deleteAllTimer = 0; + backspace(); + ke->accept(); + return true; + } + } + //TODO: Needs a call to processKeyEvent? + } else if (e->type() == QEvent::EnterEditFocus) { + end(false); + int cft = QApplication::cursorFlashTime(); + control->setCursorBlinkPeriod(cft/2); + } else if (e->type() == QEvent::LeaveEditFocus) { + d->setCursorVisible(false);//!!! + control->setCursorBlinkPeriod(0); + if (!m_emitingEditingFinished) { + if (hasAcceptableInput() || fixup()) { + m_emitingEditingFinished = true; + emit editingFinished(); + m_emitingEditingFinished = false; + } + } + } + return; + } +#endif + switch(ev->type()){ +#ifndef QT_NO_GRAPHICSVIEW + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMouseRelease: + case QEvent::GraphicsSceneMousePress:{ + QGraphicsSceneMouseEvent *gvEv = static_cast(ev); + QMouseEvent* mouse = new QMouseEvent(ev->type(), + gvEv->pos().toPoint(), gvEv->button(), gvEv->buttons(), gvEv->modifiers()); + processMouseEvent(mouse); break; + } +#endif + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + processMouseEvent(static_cast(ev)); break; + case QEvent::KeyPress: + case QEvent::KeyRelease: + processKeyEvent(static_cast(ev)); break; + case QEvent::InputMethod: + processInputMethodEvent(static_cast(ev)); break; +#ifndef QT_NO_SHORTCUT + case QEvent::ShortcutOverride:{ + QKeyEvent* ke = static_cast(ev); + if (ke == QKeySequence::Copy + || ke == QKeySequence::Paste + || ke == QKeySequence::Cut + || ke == QKeySequence::Redo + || ke == QKeySequence::Undo + || ke == QKeySequence::MoveToNextWord + || ke == QKeySequence::MoveToPreviousWord + || ke == QKeySequence::MoveToStartOfDocument + || ke == QKeySequence::MoveToEndOfDocument + || ke == QKeySequence::SelectNextWord + || ke == QKeySequence::SelectPreviousWord + || ke == QKeySequence::SelectStartOfLine + || ke == QKeySequence::SelectEndOfLine + || ke == QKeySequence::SelectStartOfBlock + || ke == QKeySequence::SelectEndOfBlock + || ke == QKeySequence::SelectStartOfDocument + || ke == QKeySequence::SelectAll + || ke == QKeySequence::SelectEndOfDocument) { + ke->accept(); + } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier + || ke->modifiers() == Qt::KeypadModifier) { + if (ke->key() < Qt::Key_Escape) { + ke->accept(); + } else { + switch (ke->key()) { + case Qt::Key_Delete: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Backspace: + case Qt::Key_Left: + case Qt::Key_Right: + ke->accept(); + default: + break; + } + } + } + } +#endif + default: + return false; + } + return true; +} + +void QLineControl::processMouseEvent(QMouseEvent* ev) +{ + + switch (ev->type()){ + case QEvent::GraphicsSceneMousePress: + case QEvent::MouseButtonPress:{ + if (m_tripleClickTimer && (ev->pos() - m_tripleClick).manhattanLength() < + QApplication::startDragDistance()) { + selectAll(); + return; + } + if (ev->button() == Qt::RightButton) + return; +#ifdef QT_KEYPAD_NAVIGATION + if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { + setEditFocus(true); + // Get the completion list to pop up. + if (m_completer) + m_completer->complete(); + } +#endif + + bool mark = ev->modifiers() & Qt::ShiftModifier; + int cursor = xToPos(ev->pos().x()); + moveCursor(cursor, mark); + break; + } + case QEvent::MouseButtonDblClick: + if (ev->button() == Qt::LeftButton) { + selectWordAtPos(xToPos(ev->pos().x())); + if(m_tripleClickTimer) + killTimer(m_tripleClickTimer); + m_tripleClickTimer = startTimer(QApplication::doubleClickInterval()); + m_tripleClick = ev->pos(); + } + break; + case QEvent::GraphicsSceneMouseRelease: + case QEvent::MouseButtonRelease: +#ifndef QT_NO_CLIPBOARD + if (QApplication::clipboard()->supportsSelection()) { + if (ev->button() == Qt::LeftButton) { + copy(QClipboard::Selection); + } else if (!isReadOnly() && ev->button() == Qt::MidButton) { + deselect(); + insert(QApplication::clipboard()->text(QClipboard::Selection)); + } + } +#endif + break; + case QEvent::GraphicsSceneMouseMove: + case QEvent::MouseMove: + if (ev->buttons() & Qt::LeftButton) { + moveCursor(xToPos(ev->pos().x()), true); + } + break; + default: + break; + } +} + +void QLineControl::processKeyEvent(QKeyEvent* event) +{ + + bool inlineCompletionAccepted = false; + +#ifndef QT_NO_COMPLETER + if (m_completer) { + QCompleter::CompletionMode completionMode = m_completer->completionMode(); + if ((completionMode == QCompleter::PopupCompletion + || completionMode == QCompleter::UnfilteredPopupCompletion) + && m_completer->popup() + && m_completer->popup()->isVisible()) { + // The following keys are forwarded by the completer to the widget + // Ignoring the events lets the completer provide suitable default behavior + switch (event->key()) { + case Qt::Key_Escape: + event->ignore(); + return; + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F4: +#ifdef QT_KEYPAD_NAVIGATION + case Qt::Key_Select: + if (!QApplication::keypadNavigationEnabled()) + break; +#endif + m_completer->popup()->hide(); // just hide. will end up propagating to parent + default: + break; // normal key processing + } + } else if (completionMode == QCompleter::InlineCompletion) { + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F4: +#ifdef QT_KEYPAD_NAVIGATION + case Qt::Key_Select: + if (!QApplication::keypadNavigationEnabled()) + break; +#endif + if (!m_completer->currentCompletion().isEmpty() && hasSelectedText() + && textAfterSelection().isEmpty()) { + setText(m_completer->currentCompletion()); + inlineCompletionAccepted = true; + } + default: + break; // normal key processing + } + } + } +#endif // QT_NO_COMPLETER + + + + if (echoMode() == QLineEdit::PasswordEchoOnEdit + && !passwordEchoEditing() + && !isReadOnly() + && !event->text().isEmpty() +#ifdef QT_KEYPAD_NAVIGATION + && event->key() != Qt::Key_Select + && event->key() != Qt::Key_Up + && event->key() != Qt::Key_Down + && event->key() != Qt::Key_Back +#endif + && !(event->modifiers() & Qt::ControlModifier)) { + // Clear the edit and reset to normal echo mode while editing; the + // echo mode switches back when the edit loses focus + // ### resets current content. dubious code; you can + // navigate with keys up, down, back, and select(?), but if you press + // "left" or "right" it clears? + updatePasswordEchoEditing(true);//TODO: used to set a WA too + clear(); + } + + //setCursorVisible(true);TODO: Who handles this? + if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { + if (hasAcceptableInput() || fixup()) { + emit accepted(); + emitingEditingFinished = true; + emit editingFinished(); + emitingEditingFinished = false; + } + if (inlineCompletionAccepted) + event->accept(); + else + event->ignore(); + return; + } + bool unknown = false; + + if (false) { + } +#ifndef QT_NO_SHORTCUT + else if (event == QKeySequence::Undo) { + if (!isReadOnly()) + undo(); + } + else if (event == QKeySequence::Redo) { + if (!isReadOnly()) + redo(); + } + else if (event == QKeySequence::SelectAll) { + selectAll(); + } +#ifndef QT_NO_CLIPBOARD + else if (event == QKeySequence::Copy) { + copy(); + } + else if (event == QKeySequence::Paste) { + if (!isReadOnly()) + paste(); + } + else if (event == QKeySequence::Cut) { + if (!isReadOnly()) { + copy(); + del(); + } + } + else if (event == QKeySequence::DeleteEndOfLine) { + if (!isReadOnly()) { + setSelection(cursor(), end()); + copy(); + del(); + } + } +#endif //QT_NO_CLIPBOARD + else if (event == QKeySequence::MoveToStartOfLine) { + home(0); + } + else if (event == QKeySequence::MoveToEndOfLine) { + end(0); + } + else if (event == QKeySequence::SelectStartOfLine) { + home(1); + } + else if (event == QKeySequence::SelectEndOfLine) { + end(1); + } + else if (event == QKeySequence::MoveToNextChar) { +#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) + if (hasSelectedText()) { +#else + if (hasSelectedText() && m_completer + && m_completer->completionMode() == QCompleter::InlineCompletion) { +#endif + moveCursor(selectionEnd(), false); + } else { + cursorForward(0, layoutDirection() == Qt::LeftToRight ? 1 : -1); + } + } + else if (event == QKeySequence::SelectNextChar) { + cursorForward(1, layoutDirection() == Qt::LeftToRight ? 1 : -1); + } + else if (event == QKeySequence::MoveToPreviousChar) { +#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) + if (hasSelectedText()) { +#else + if (hasSelectedText() && m_completer + && m_completer->completionMode() == QCompleter::InlineCompletion) { +#endif + moveCursor(selectionStart(), false); + } else { + cursorForward(0, layoutDirection() == Qt::LeftToRight ? -1 : 1); + } + } + else if (event == QKeySequence::SelectPreviousChar) { + cursorForward(1, layoutDirection() == Qt::LeftToRight ? -1 : 1); + } + else if (event == QKeySequence::MoveToNextWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); + else + layoutDirection() == Qt::LeftToRight ? end(0) : home(0); + } + else if (event == QKeySequence::MoveToPreviousWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); + else if (!isReadOnly()) { + layoutDirection() == Qt::LeftToRight ? home(0) : end(0); + } + } + else if (event == QKeySequence::SelectNextWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); + else + layoutDirection() == Qt::LeftToRight ? end(1) : home(1); + } + else if (event == QKeySequence::SelectPreviousWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); + else + layoutDirection() == Qt::LeftToRight ? home(1) : end(1); + } + else if (event == QKeySequence::Delete) { + if (!isReadOnly()) + del(); + } + else if (event == QKeySequence::DeleteEndOfWord) { + if (!isReadOnly()) { + cursorWordForward(true); + del(); + } + } + else if (event == QKeySequence::DeleteStartOfWord) { + if (!isReadOnly()) { + cursorWordBackward(true); + del(); + } + } +#endif // QT_NO_SHORTCUT + else { +#ifdef Q_WS_MAC + if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { + Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); + if (myModifiers & Qt::ShiftModifier) { + if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) + || myModifiers == (Qt::AltModifier|Qt::ShiftModifier) + || myModifiers == Qt::ShiftModifier) { + + event->key() == Qt::Key_Up ? home(1) : end(1); + } + } else { + if ((myModifiers == Qt::ControlModifier + || myModifiers == Qt::AltModifier + || myModifiers == Qt::NoModifier)) { + event->key() == Qt::Key_Up ? home(0) : end(0); + } + } + } +#endif + if (event->modifiers() & Qt::ControlModifier) { + switch (event->key()) { + case Qt::Key_Backspace: + if (!isReadOnly()) { + cursorWordBackward(true); + del(); + } + break; +#ifndef QT_NO_COMPLETER + case Qt::Key_Up: + case Qt::Key_Down: + complete(event->key()); + break; +#endif +#if defined(Q_WS_X11) + case Qt::Key_E: + end(0); + break; + + case Qt::Key_U: + if (!isReadOnly()) { + setSelection(0, text().size()); +#ifndef QT_NO_CLIPBOARD + copy(); +#endif + del(); + } + break; +#endif + default: + unknown = true; + } + } else { // ### check for *no* modifier + switch (event->key()) { + case Qt::Key_Backspace: + if (!isReadOnly()) { + backspace(); +#ifndef QT_NO_COMPLETER + complete(Qt::Key_Backspace); +#endif + } + break; +#ifdef QT_KEYPAD_NAVIGATION//TODO: This section + case Qt::Key_Back: + if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() + && !isReadOnly()) { + if (text().length() == 0) { + setText(d->origText); + + if (d->passwordEchoEditing) + d->updatePasswordEchoEditing(false); + + setEditFocus(false); + } else if (!d->deleteAllTimer.isActive()) { + d->deleteAllTimer.start(750, this); + } + } else { + unknown = true; + } + break; +#endif + + default: + unknown = true; + } + } + } + + if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) { + setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); + unknown = false; + } + + if (unknown && !isReadOnly()) { + QString t = event->text(); + if (!t.isEmpty() && t.at(0).isPrint()) { + insert(t); +#ifndef QT_NO_COMPLETER + complete(event->key()); +#endif + event->accept(); + return; + } + } + + if (unknown) + event->ignore(); + else + event->accept(); +} + + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h new file mode 100644 index 0000000..bb27778 --- /dev/null +++ b/src/gui/widgets/qlinecontrol_p.h @@ -0,0 +1,715 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINECONTROL_P_H +#define QLINECONTROL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qglobal.h" + +#ifndef QT_NO_LINEEDIT +#include "private/qwidget_p.h" +#include "QtGui/qlineedit.h" +#include "QtGui/qtextlayout.h" +#include "QtGui/qstyleoption.h" +#include "QtCore/qpointer.h" +#include "QtGui/qlineedit.h" +#include "QtGui/qclipboard.h" +#include "QtCore/qpoint.h" +#include "QtGui/qcompleter.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QLineControl : public QObject +{ + Q_OBJECT +public: + + QLineControl(const QString &txt = QString()) + : emitingEditingFinished(0), + m_cursor(0), m_preeditCursor(0), m_layoutDirection(Qt::LeftToRight), + hideCursor(false), separator(0), readOnly(0), + dragEnabled(0), m_echoMode(0), textDirty(0), selDirty(0), + validInput(1), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), + m_ascent(0), m_maxLength(32767), lastCursorPos(-1), + m_tripleClickTimer(0), maskData(0), modifiedState(0), undoState(0), + selstart(0), selend(0), m_passwordEchoEditing(false) + { + init(txt); + } + + ~QLineControl() + { + delete [] maskData; + } + + int nextMaskBlank(int pos); + int prevMaskBlank(int pos); + + bool isUndoAvailable() const; + bool isRedoAvailable() const; + void clearUndo(); + bool isModified() const; + void setModified(bool modified); + + bool allSelected() const; + bool hasSelectedText() const; + + int width() const; + int height() const; + int ascent() const; + + void setSelection(int start, int length); + + QString selectedText() const; + QString textBeforeSelection() const; + QString textAfterSelection() const; + + int selectionStart() const; + int selectionEnd() const; + bool inSelection(int x) const; + + void removeSelection(); + + int start() const; + int end() const; + +#ifndef QT_NO_CLIPBOARD + void copy(QClipboard::Mode mode = QClipboard::Clipboard) const; + void paste(); +#endif + + int cursor() const; + int preeditCursor() const; + + int cursorWidth() const; + void setCursorWidth(int value); + + void moveCursor(int pos, bool mark = false); + void cursorForward(bool mark, int steps); + void cursorWordForward(bool mark); + void cursorWordBackward(bool mark); + void home(bool mark); + void end(bool mark); + + int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; + QRect cursorRect() const; + + qreal cursorToX(int cursor) const; + qreal cursorToX() const; + + bool isReadOnly() const; + void setReadOnly(bool enable); + + QString text() const; + void setText(const QString &); + + QString displayText() const; + + void backspace(); + void del(); + void deselect(); + void selectAll(); + void insert(const QString &); + void clear(); + void undo(); + void redo(); + void selectWordAtPos(int); + + uint echoMode() const; + void setEchoMode(uint mode); + + void setMaxLength(int maxLength); + int maxLength() const; + + const QValidator *validator() const; + void setValidator(const QValidator *); + +#ifndef QT_NO_COMPLETER + QCompleter *completer() const; + void setCompleter(const QCompleter*); + void complete(int key); +#endif + + void setCursorPosition(int pos); + int cursorPosition() const; + + bool hasAcceptableInput() const; + bool fixup(); + + QString inputMask() const; + void setInputMask(const QString &mask); + + // input methods +#ifndef QT_NO_IM + bool composeMode() const; + void setPreeditArea(int cursor, const QString &text); +#endif + + QString preeditAreaText() const; + + void updatePasswordEchoEditing(bool editing); + bool passwordEchoEditing() const; + + QChar passwordCharacter() const; + void setPasswordCharacter(const QChar &character); + + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection(Qt::LayoutDirection direction); + void setFont(const QFont &font); + + void processInputMethodEvent(QInputMethodEvent *event); + void processMouseEvent(QMouseEvent* ev); + void processKeyEvent(QKeyEvent* ev); + + int cursorBlinkPeriod() const; + void setCursorBlinkPeriod(int msec); + + enum DrawFlags { + DrawText = 0x01, + DrawSelections = 0x02, + DrawCursor = 0x04, + DrawAll = DrawText | DrawSelections | DrawCursor + }; + void draw(QPainter *, const QPoint &, const QRect &, int flags = DrawAll); + + bool processEvent(QEvent* ev); + + bool emitingEditingFinished;//Needed in QLineEdit FocusOut event +private: + void init(const QString&); + void removeSelectedText(); + void p_setText(const QString& txt, int pos = -1, bool edited = true); + void updateDisplayText(); + + void p_insert(const QString& s); + void p_del(bool wasBackspace = false); + void p_remove(int pos); + inline void p_deselect() { selDirty |= (selend > selstart); selstart = selend = 0; } + void p_undo(int until = -1); + void p_redo(); + + QString m_text; + QPalette m_palette; + int m_cursor; + int m_preeditCursor; + int m_cursorWidth; + Qt::LayoutDirection m_layoutDirection; + uint hideCursor : 1; // used to hide the m_cursor inside preedit areas + uint separator : 1; + uint readOnly : 1; + uint dragEnabled : 1; + uint m_echoMode : 2; + uint textDirty : 1; + uint selDirty : 1; + uint validInput : 1; + int m_blinkPeriod; // 0 for non-blinking cursor + int m_blinkTimer; + int m_deleteAllTimer; + int m_blinkStatus; + int m_ascent; + int m_maxLength; + int lastCursorPos; + QList transactions; + QPoint m_tripleClick; + int m_tripleClickTimer; + + void emitCursorPositionChanged(); + + bool finishChange(int validateFromState = -1, bool update = false, bool edited = true); + + QPointer m_validator; + QPointer m_completer; +#ifndef QT_NO_COMPLETER + bool advanceToEnabledItem(int dir); +#endif + + struct MaskInputData { + enum Casemode { NoCaseMode, Upper, Lower }; + QChar maskChar; // either the separator char or the inputmask + bool separator; + Casemode caseMode; + }; + QString m_inputMask; + QChar blank; + MaskInputData *maskData; + + + // undo/redo handling + enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection, SetSelection }; + struct Command { + inline Command() {} + inline Command(CommandType t, int p, QChar c, int ss, int se) : type(t),uc(c),pos(p),selStart(ss),selEnd(se) {} + uint type : 4; + QChar uc; + int pos, selStart, selEnd; + }; + int modifiedState; + int undoState; + QVector history; + void addCommand(const Command& cmd); + + inline void separate() { separator = true; } + + // selection + int selstart, selend; + + // masking + void parseInputMask(const QString &maskFields); + bool isValidInput(QChar key, QChar mask) const; + bool hasAcceptableInput(const QString &text) const; + QString maskString(uint pos, const QString &str, bool clear = false) const; + QString clearString(uint pos, uint len) const; + QString stripString(const QString &str) const; + int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const; + + + // complex text layout + QTextLayout textLayout; + + bool m_passwordEchoEditing; + QChar m_passwordCharacter; + +Q_SIGNALS: + void cursorPositionChanged(int, int); + void selectionChanged(); + + void displayTextChanged(const QString &); + void textChanged(const QString &); + void textEdited(const QString &); + + void resetInputContext(); + + void accepted(); + void editingFinished(); + void updateNeeded(const QRect &); +protected: + virtual void timerEvent ( QTimerEvent * event ); +private slots: + void _q_clipboardChanged(); + void _q_deleteSelected(); + +}; + +inline int QLineControl::nextMaskBlank(int pos) +{ + int c = findInMask(pos, true, false); + separator |= (c != pos); + return (c != -1 ? c : m_maxLength); +} + +inline int QLineControl::prevMaskBlank(int pos) +{ + int c = findInMask(pos, false, false); + separator |= (c != pos); + return (c != -1 ? c : 0); +} + +inline bool QLineControl::isUndoAvailable() const +{ + return !readOnly && undoState; +} + +inline bool QLineControl::isRedoAvailable() const +{ + return !readOnly && undoState < (int)history.size(); +} + +inline void QLineControl::clearUndo() +{ + history.clear(); + modifiedState = undoState = 0; +} + +inline bool QLineControl::isModified() const +{ + return modifiedState != undoState; +} + +inline void QLineControl::setModified(bool modified) +{ + modifiedState = modified ? -1 : undoState; +} + +inline bool QLineControl::allSelected() const +{ + return !m_text.isEmpty() && selstart == 0 && selend == (int)m_text.length(); +} + +inline bool QLineControl::hasSelectedText() const +{ + return !m_text.isEmpty() && selend > selstart; +} + +inline int QLineControl::width() const +{ + return qRound(textLayout.lineAt(0).width()) + 1; +} + +inline int QLineControl::height() const +{ + return qRound(textLayout.lineAt(0).height()) + 1; +} + +inline int QLineControl::ascent() const +{ + return m_ascent; +} + +inline QString QLineControl::selectedText() const +{ + if (hasSelectedText()) + return m_text.mid(selstart, selend - selstart); + return QString(); +} + +inline QString QLineControl::textBeforeSelection() const +{ + if (hasSelectedText()) + return m_text.left(selstart); + return QString(); +} + +inline QString QLineControl::textAfterSelection() const +{ + if (hasSelectedText()) + return m_text.mid(selend); + return QString(); +} + +inline int QLineControl::selectionStart() const +{ + return hasSelectedText() ? selstart : -1; +} + +inline int QLineControl::selectionEnd() const +{ + return hasSelectedText() ? selend : -1; +} + +inline int QLineControl::start() const +{ + return 0; +} + +inline int QLineControl::end() const +{ + return m_text.length(); +} + +inline void QLineControl::removeSelection() +{ + int priorState = undoState; + removeSelectedText(); + finishChange(priorState); +} + +inline bool QLineControl::inSelection(int x) const +{ + if (selstart >= selend) return false; + int pos = xToPos(x, QTextLine::CursorOnCharacter); return pos >= selstart && pos < selend; +} + +inline int QLineControl::cursor() const +{ + return m_cursor; +} + +inline int QLineControl::preeditCursor() const +{ + return m_preeditCursor; +} + +inline int QLineControl::cursorWidth() const +{ + return m_cursorWidth; +} + +inline void QLineControl::setCursorWidth(int value) +{ + m_cursorWidth = value; +} + +inline void QLineControl::cursorForward(bool mark, int steps) +{ + int c = m_cursor; + if (steps > 0) { + while(steps--) + c = textLayout.nextCursorPosition(c); + } else if (steps < 0) { + while (steps++) + c = textLayout.previousCursorPosition(c); + } + moveCursor(c, mark); +} + +inline void QLineControl::cursorWordForward(bool mark) +{ + moveCursor(textLayout.nextCursorPosition(m_cursor, QTextLayout::SkipWords), mark); +} + +inline void QLineControl::home(bool mark) +{ + moveCursor(0, mark); +} + +inline void QLineControl::end(bool mark) +{ + moveCursor(text().length(), mark); +} + +inline void QLineControl::cursorWordBackward(bool mark) +{ + moveCursor(textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); +} + +inline qreal QLineControl::cursorToX(int cursor) const +{ + return textLayout.lineAt(0).cursorToX(cursor); +} + +inline qreal QLineControl::cursorToX() const +{ + return cursorToX(m_cursor); +} + +inline bool QLineControl::isReadOnly() const +{ + return readOnly; +} + +inline void QLineControl::setReadOnly(bool enable) +{ + readOnly = enable; +} + +inline QString QLineControl::text() const +{ + QString res = maskData ? stripString(m_text) : m_text; + return (res.isNull() ? QString::fromLatin1("") : res); +} + +inline void QLineControl::setText(const QString &txt) +{ + p_setText(txt, -1, false); +} + +inline QString QLineControl::displayText() const +{ + return textLayout.text(); +} + +inline void QLineControl::deselect() +{ + p_deselect(); finishChange(); +} + +inline void QLineControl::selectAll() +{ + selstart = selend = m_cursor = 0; moveCursor(m_text.length(), true); +} + +inline void QLineControl::undo() +{ + p_undo(), finishChange(-1, true); +} + +inline void QLineControl::redo() +{ + p_redo(), finishChange(); +} + +inline uint QLineControl::echoMode() const +{ + return m_echoMode; +} + +inline void QLineControl::setEchoMode(uint mode) +{ + m_echoMode = mode; + m_passwordEchoEditing = false; + updateDisplayText(); +} + +inline void QLineControl::setMaxLength(int maxLength) +{ + if (maskData) + return; + m_maxLength = maxLength; + setText(m_text); +} + +inline int QLineControl::maxLength() const +{ + return m_maxLength; +} + +inline const QValidator *QLineControl::validator() const +{ + return m_validator; +} + +inline void QLineControl::setValidator(const QValidator *v) +{ + m_validator = const_cast(v); +} + +#ifndef QT_NO_COMPLETER +inline QCompleter *QLineControl::completer() const +{ + return m_completer; +} + +/* Note that you must set the widget for the completer seperately */ +inline void QLineControl::setCompleter(const QCompleter* c) +{ + m_completer = const_cast(c); +} +#endif + +inline void QLineControl::setCursorPosition(int pos) +{ + if (pos < 0) pos = 0; + if (pos < m_text.length()) + moveCursor(pos); +} + +inline int QLineControl::cursorPosition() const +{ + return m_cursor; +} + +inline bool QLineControl::hasAcceptableInput() const +{ + return hasAcceptableInput(m_text); +} + +inline QString QLineControl::inputMask() const +{ + return maskData ? m_inputMask + QLatin1Char(';') + blank : QString(); +} + +inline void QLineControl::setInputMask(const QString &mask) +{ + parseInputMask(mask); + if (maskData) + moveCursor(nextMaskBlank(0)); +} + +// input methods +#ifndef QT_NO_IM +inline bool QLineControl::composeMode() const +{ + return !textLayout.preeditAreaText().isEmpty(); +} + +inline void QLineControl::setPreeditArea(int cursor, const QString &text) +{ + textLayout.setPreeditArea(cursor, text); +} +#endif + +inline QString QLineControl::preeditAreaText() const +{ + return textLayout.preeditAreaText(); +} + +inline bool QLineControl::passwordEchoEditing() const +{ + return m_passwordEchoEditing; +} + +inline QChar QLineControl::passwordCharacter() const +{ + return m_passwordCharacter; +} + +inline void QLineControl::setPasswordCharacter(const QChar &character) +{ + m_passwordCharacter = character; + updateDisplayText(); +} + +inline Qt::LayoutDirection QLineControl::layoutDirection() const +{ + return m_layoutDirection; +} + +inline void QLineControl::setLayoutDirection(Qt::LayoutDirection direction) +{ + if (direction != m_layoutDirection) { + m_layoutDirection = direction; + updateDisplayText(); + } +} + +inline void QLineControl::setFont(const QFont &font) +{ + textLayout.setFont(font); + updateDisplayText(); +} + +inline int QLineControl::cursorBlinkPeriod() const +{ + return m_blinkPeriod; +} + +QT_END_NAMESPACE + +QT_END_HEADER +#endif // QT_NO_LINEEDIT + + +#endif // QLINECONTROL_P_H diff --git a/src/gui/widgets/qlinecontrol_p_p.h b/src/gui/widgets/qlinecontrol_p_p.h new file mode 100644 index 0000000..e76794b --- /dev/null +++ b/src/gui/widgets/qlinecontrol_p_p.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINECONTROL_P_P_H +#define QLINECONTROL_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qobject_p.h" +#include "QtGui/qtextlayout.h" + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QAbstractScrollArea; +class QInputContext; + +class QLineControlPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QLineControl) +public: + QLineControlPrivate() + : cursor(0), preeditCursor(0), cursorWidth(1), cursorTimer(0), + maxLength(32767), modifiedState(0), undoState(0), + selStart(0), selEnd(0), textInteractionFlags(0), + cursorVisible(0), hideCursor(0), echoMode(0) + {} + + QPalette palette; + QVector history; + QTextLayout textLayout; // display text + QString text; + + int cursor; + int preeditCursor; + int lastCursorPos; + int cursorWidth; + int cursorTimer; + + int maxLength; + + int modifiedState; + int undoState; + + int selStart, selEnd; + + Qt::TextInteractionFlags textInteractionFlags; + + // keep together and at end + uint cursorVisible : 1; + uint hideCursor : 1; // used to hide the cursor inside preedit areas + uint echoMode : 2; +}; + +QT_END_NAMESPACE + +#endif // QLINECONTROL_P_H + diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index d1067a8..baaad32 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -86,21 +86,12 @@ #include -#define verticalMargin 1 -#define horizontalMargin 2 - QT_BEGIN_NAMESPACE #ifdef Q_WS_MAC extern void qt_mac_secure_keyboard(bool); //qapplication_mac.cpp #endif -static inline bool shouldEnableInputMethod(QLineEdit *lineedit) -{ - const QLineEdit::EchoMode mode = lineedit->echoMode(); - return !lineedit->isReadOnly() && (mode == QLineEdit::Normal || mode == QLineEdit::PasswordEchoOnEdit); -} - /*! Initialize \a option with the values from this QLineEdit. This method is useful for subclasses when they need a QStyleOptionFrame or QStyleOptionFrameV2, but don't want @@ -122,7 +113,7 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const : 0; option->midLineWidth = 0; option->state |= QStyle::State_Sunken; - if (d->readOnly) + if (d->control->isReadOnly()) option->state |= QStyle::State_ReadOnly; #ifdef QT_KEYPAD_NAVIGATION if (hasEditFocus()) @@ -350,14 +341,14 @@ QLineEdit::QLineEdit(const QString& contents, const QString &inputMask, QWidget* { Q_D(QLineEdit); setObjectName(QString::fromAscii(name)); - d->parseInputMask(inputMask); - if (d->maskData) { - QString ms = d->maskString(0, contents); - d->init(ms + d->clearString(ms.length(), d->maxLength - ms.length())); - d->cursor = d->nextMaskBlank(ms.length()); - } else { + //d->control->parseInputMask(inputMask); + //if (d->control->maskData) { + // QString ms = d->control->maskString(0, contents); + // d->init(ms + d->control->clearString(ms.length(), d->control->maxLength() - ms.length())); + // d->control->moveCursor(d->control->nextMaskBlank(ms.length())); + // } else { d->init(contents); - } + // } } #endif @@ -388,19 +379,13 @@ QLineEdit::~QLineEdit() QString QLineEdit::text() const { Q_D(const QLineEdit); - QString res = d->text; - if (d->maskData) - res = d->stripString(d->text); - return (res.isNull() ? QString::fromLatin1("") : res); + return d->control->text(); } void QLineEdit::setText(const QString& text) { Q_D(QLineEdit); - d->setText(text, -1, false); -#ifdef QT_KEYPAD_NAVIGATION - d->origText = d->text; -#endif + d->control->setText(text); } @@ -421,17 +406,7 @@ void QLineEdit::setText(const QString& text) QString QLineEdit::displayText() const { Q_D(const QLineEdit); - if (d->echoMode == NoEcho) - return QString::fromLatin1(""); - QString res = d->text; - - if (d->echoMode == Password || (d->echoMode == PasswordEchoOnEdit - && !d->passwordEchoEditing)) { - QStyleOptionFrameV2 opt; - initStyleOption(&opt); - res.fill(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); - } - return (res.isNull() ? QString::fromLatin1("") : res); + return d->control->displayText(); } @@ -456,20 +431,15 @@ QString QLineEdit::displayText() const int QLineEdit::maxLength() const { Q_D(const QLineEdit); - return d->maxLength; + return d->control->maxLength(); } void QLineEdit::setMaxLength(int maxLength) { Q_D(QLineEdit); - if (d->maskData) - return; - d->maxLength = maxLength; - setText(d->text); + d->control->setMaxLength(maxLength); } - - /*! \property QLineEdit::frame \brief whether the line edit draws itself with a frame @@ -536,22 +506,20 @@ void QLineEdit::setFrame(bool enable) QLineEdit::EchoMode QLineEdit::echoMode() const { Q_D(const QLineEdit); - return (EchoMode) d->echoMode; + return (EchoMode) d->control->echoMode(); } void QLineEdit::setEchoMode(EchoMode mode) { Q_D(QLineEdit); - if (mode == (EchoMode)d->echoMode) + if (mode == (EchoMode)d->control->echoMode()) return; - setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); - d->echoMode = mode; - d->passwordEchoEditing = false; - d->updateTextLayout(); + setAttribute(Qt::WA_InputMethodEnabled, d->shouldEnableInputMethod()); + d->control->setEchoMode(mode); update(); #ifdef Q_WS_MAC if (hasFocus()) - qt_mac_secure_keyboard(d->echoMode == Password || d->echoMode == NoEcho); + qt_mac_secure_keyboard(mode == Password || mode == NoEcho); #endif } @@ -567,7 +535,7 @@ void QLineEdit::setEchoMode(EchoMode mode) const QValidator * QLineEdit::validator() const { Q_D(const QLineEdit); - return d->validator; + return d->control->validator(); } /*! @@ -585,7 +553,7 @@ const QValidator * QLineEdit::validator() const void QLineEdit::setValidator(const QValidator *v) { Q_D(QLineEdit); - d->validator = const_cast(v); + d->control->setValidator(v); } #endif // QT_NO_VALIDATOR @@ -609,23 +577,23 @@ void QLineEdit::setValidator(const QValidator *v) void QLineEdit::setCompleter(QCompleter *c) { Q_D(QLineEdit); - if (c == d->completer) + if (c == d->control->completer()) return; - if (d->completer) { - disconnect(d->completer, 0, this, 0); - d->completer->setWidget(0); - if (d->completer->parent() == this) - delete d->completer; + if (d->control->completer()) { + disconnect(d->control->completer(), 0, this, 0); + d->control->completer()->setWidget(0); + if (d->control->completer()->parent() == this) + delete d->control->completer(); } - d->completer = c; + d->control->setCompleter(c); if (!c) return; if (c->widget() == 0) c->setWidget(this); if (hasFocus()) { - QObject::connect(d->completer, SIGNAL(activated(QString)), + QObject::connect(d->control->completer(), SIGNAL(activated(QString)), this, SLOT(setText(QString))); - QObject::connect(d->completer, SIGNAL(highlighted(QString)), + QObject::connect(d->control->completer(), SIGNAL(highlighted(QString)), this, SLOT(_q_completionHighlighted(QString))); } } @@ -638,83 +606,9 @@ void QLineEdit::setCompleter(QCompleter *c) QCompleter *QLineEdit::completer() const { Q_D(const QLineEdit); - return d->completer; -} - -// looks for an enabled item iterating forward(dir=1)/backward(dir=-1) from the -// current row based. dir=0 indicates a new completion prefix was set. -bool QLineEditPrivate::advanceToEnabledItem(int dir) -{ - int start = completer->currentRow(); - if (start == -1) - return false; - int i = start + dir; - if (dir == 0) dir = 1; - do { - if (!completer->setCurrentRow(i)) { - if (!completer->wrapAround()) - break; - i = i > 0 ? 0 : completer->completionCount() - 1; - } else { - QModelIndex currentIndex = completer->currentIndex(); - if (completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled) - return true; - i += dir; - } - } while (i != start); - - completer->setCurrentRow(start); // restore - return false; -} - -void QLineEditPrivate::complete(int key) -{ - if (!completer || readOnly || echoMode != QLineEdit::Normal) - return; - - if (completer->completionMode() == QCompleter::InlineCompletion) { - if (key == Qt::Key_Backspace) - return; - int n = 0; - if (key == Qt::Key_Up || key == Qt::Key_Down) { - if (selend != 0 && selend != text.length()) - return; - QString prefix = hasSelectedText() ? text.left(selstart) : text; - if (text.compare(completer->currentCompletion(), completer->caseSensitivity()) != 0 - || prefix.compare(completer->completionPrefix(), completer->caseSensitivity()) != 0) { - completer->setCompletionPrefix(prefix); - } else { - n = (key == Qt::Key_Up) ? -1 : +1; - } - } else { - completer->setCompletionPrefix(text); - } - if (!advanceToEnabledItem(n)) - return; - } else { -#ifndef QT_KEYPAD_NAVIGATION - if (text.isEmpty()) { - completer->popup()->hide(); - return; - } -#endif - completer->setCompletionPrefix(text); - } - - completer->complete(); + return d->control->completer(); } -void QLineEditPrivate::_q_completionHighlighted(QString newText) -{ - Q_Q(QLineEdit); - if (completer->completionMode() != QCompleter::InlineCompletion) - q->setText(newText); - else { - int c = cursor; - q->setText(text.left(c) + newText.mid(c)); - q->setSelection(text.length(), c - newText.length()); - } -} #endif // QT_NO_COMPLETER /*! @@ -729,10 +623,10 @@ QSize QLineEdit::sizeHint() const Q_D(const QLineEdit); ensurePolished(); QFontMetrics fm(font()); - int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin + int h = qMax(fm.lineSpacing(), 14) + 2*d->verticalMargin + d->topTextMargin + d->bottomTextMargin + d->topmargin + d->bottommargin; - int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin + int w = fm.width(QLatin1Char('x')) * 17 + 2*d->horizontalMargin + d->leftTextMargin + d->rightTextMargin + d->leftmargin + d->rightmargin; // "some" QStyleOptionFrameV2 opt; @@ -753,7 +647,7 @@ QSize QLineEdit::minimumSizeHint() const Q_D(const QLineEdit); ensurePolished(); QFontMetrics fm = fontMetrics(); - int h = fm.height() + qMax(2*verticalMargin, fm.leading()) + int h = fm.height() + qMax(2*d->verticalMargin, fm.leading()) + d->topmargin + d->bottommargin; int w = fm.maxWidth() + d->leftmargin + d->rightmargin; QStyleOptionFrameV2 opt; @@ -775,17 +669,13 @@ QSize QLineEdit::minimumSizeHint() const int QLineEdit::cursorPosition() const { Q_D(const QLineEdit); - return d->cursor; + return d->control->cursorPosition(); } void QLineEdit::setCursorPosition(int pos) { Q_D(QLineEdit); - if (pos < 0) - pos = 0; - - if (pos <= d->text.length()) - d->moveCursor(pos); + d->control->setCursorPosition(pos); } /*! @@ -807,22 +697,12 @@ int QLineEdit::cursorPositionAt(const QPoint &pos) bool QLineEdit::validateAndSet(const QString &newText, int newPos, int newMarkAnchor, int newMarkDrag) { - Q_D(QLineEdit); - int priorState = d->undoState; - d->selstart = 0; - d->selend = d->text.length(); - d->removeSelectedText(); - d->insert(newText); - d->finishChange(priorState); - if (d->undoState > priorState) { - d->cursor = newPos; - d->selstart = qMin(newMarkAnchor, newMarkDrag); - d->selend = qMax(newMarkAnchor, newMarkDrag); - update(); - d->emitCursorPositionChanged(); - return true; - } - return false; + // Note, this doesn't validate', but then neither + // does the suggested functions above in the docs. + setText(newText); + setCursorPosition(newPos); + setSelection(qMin(newMarkAnchor, newMarkDrag), qAbs(newMarkAnchor - newMarkDrag)); + return true; } #endif //QT3_SUPPORT @@ -863,15 +743,7 @@ void QLineEdit::setAlignment(Qt::Alignment alignment) void QLineEdit::cursorForward(bool mark, int steps) { Q_D(QLineEdit); - int cursor = d->cursor; - if (steps > 0) { - while(steps--) - cursor = d->textLayout.nextCursorPosition(cursor); - } else if (steps < 0) { - while (steps++) - cursor = d->textLayout.previousCursorPosition(cursor); - } - d->moveCursor(cursor, mark); + d->control->cursorForward(mark, steps); } @@ -896,7 +768,7 @@ void QLineEdit::cursorBackward(bool mark, int steps) void QLineEdit::cursorWordForward(bool mark) { Q_D(QLineEdit); - d->moveCursor(d->textLayout.nextCursorPosition(d->cursor, QTextLayout::SkipWords), mark); + d->control->cursorWordForward(mark); } /*! @@ -909,7 +781,7 @@ void QLineEdit::cursorWordForward(bool mark) void QLineEdit::cursorWordBackward(bool mark) { Q_D(QLineEdit); - d->moveCursor(d->textLayout.previousCursorPosition(d->cursor, QTextLayout::SkipWords), mark); + d->control->cursorWordBackward(mark); } @@ -924,26 +796,7 @@ void QLineEdit::cursorWordBackward(bool mark) void QLineEdit::backspace() { Q_D(QLineEdit); - int priorState = d->undoState; - if (d->hasSelectedText()) { - d->removeSelectedText(); - } else if (d->cursor) { - --d->cursor; - if (d->maskData) - d->cursor = d->prevMaskBlank(d->cursor); - QChar uc = d->text.at(d->cursor); - if (d->cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { - // second half of a surrogate, check if we have the first half as well, - // if yes delete both at once - uc = d->text.at(d->cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { - d->del(true); - --d->cursor; - } - } - d->del(true); - } - d->finishChange(priorState); + d->control->backspace(); } /*! @@ -957,15 +810,7 @@ void QLineEdit::backspace() void QLineEdit::del() { Q_D(QLineEdit); - int priorState = d->undoState; - if (d->hasSelectedText()) { - d->removeSelectedText(); - } else { - int n = d->textLayout.nextCursorPosition(d->cursor) - d->cursor; - while (n--) - d->del(); - } - d->finishChange(priorState); + d->control->del(); } /*! @@ -980,7 +825,7 @@ void QLineEdit::del() void QLineEdit::home(bool mark) { Q_D(QLineEdit); - d->moveCursor(0, mark); + d->control->home(mark); } /*! @@ -995,7 +840,7 @@ void QLineEdit::home(bool mark) void QLineEdit::end(bool mark) { Q_D(QLineEdit); - d->moveCursor(d->text.length(), mark); + d->control->end(mark); } @@ -1020,16 +865,13 @@ void QLineEdit::end(bool mark) bool QLineEdit::isModified() const { Q_D(const QLineEdit); - return d->modifiedState != d->undoState; + return d->control->isModified(); } void QLineEdit::setModified(bool modified) { Q_D(QLineEdit); - if (modified) - d->modifiedState = -1; - else - d->modifiedState = d->undoState; + d->control->setModified(modified); } @@ -1057,7 +899,7 @@ Use setModified(false) instead. bool QLineEdit::hasSelectedText() const { Q_D(const QLineEdit); - return d->hasSelectedText(); + return d->control->hasSelectedText(); } /*! @@ -1075,9 +917,7 @@ bool QLineEdit::hasSelectedText() const QString QLineEdit::selectedText() const { Q_D(const QLineEdit); - if (d->hasSelectedText()) - return d->text.mid(d->selstart, d->selend - d->selstart); - return QString(); + return d->control->selectedText(); } /*! @@ -1090,7 +930,7 @@ QString QLineEdit::selectedText() const int QLineEdit::selectionStart() const { Q_D(const QLineEdit); - return d->hasSelectedText() ? d->selstart : -1; + return d->control->selectionStart(); } @@ -1120,9 +960,10 @@ void QLineEdit::setEdited(bool on) { setModified(on); } int QLineEdit::characterAt(int xpos, QChar *chr) const { Q_D(const QLineEdit); - int pos = d->xToPos(xpos + contentsRect().x() - d->hscroll + horizontalMargin); - if (chr && pos < (int) d->text.length()) - *chr = d->text.at(pos); + int pos = d->xToPos(xpos + contentsRect().x() - d->hscroll + d->horizontalMargin); + QString txt = d->control->text(); + if (chr && pos < (int) txt.length()) + *chr = txt.at(pos); return pos; } @@ -1133,9 +974,9 @@ int QLineEdit::characterAt(int xpos, QChar *chr) const bool QLineEdit::getSelection(int *start, int *end) { Q_D(QLineEdit); - if (d->hasSelectedText() && start && end) { - *start = d->selstart; - *end = d->selend; + if (d->control->hasSelectedText() && start && end) { + *start = selectionStart(); + *end = *start + selectedText().length(); return true; } return false; @@ -1153,30 +994,19 @@ bool QLineEdit::getSelection(int *start, int *end) void QLineEdit::setSelection(int start, int length) { Q_D(QLineEdit); - if (start < 0 || start > (int)d->text.length()) { + if (start < 0 || start > (int)d->control->text().length()) { qWarning("QLineEdit::setSelection: Invalid start position (%d)", start); return; - } else { - if (length > 0) { - d->selstart = start; - d->selend = qMin(start + length, (int)d->text.length()); - d->cursor = d->selend; - } else { - d->selstart = qMax(start + length, 0); - d->selend = start; - d->cursor = d->selstart; - } } - if (d->hasSelectedText()){ + d->control->setSelection(start, length); + + if (d->control->hasSelectedText()){ QStyleOptionFrameV2 opt; initStyleOption(&opt); if (!style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) d->setCursorVisible(false); } - - update(); - d->emitCursorPositionChanged(); } @@ -1192,7 +1022,7 @@ void QLineEdit::setSelection(int start, int length) bool QLineEdit::isUndoAvailable() const { Q_D(const QLineEdit); - return d->isUndoAvailable(); + return d->control->isUndoAvailable(); } /*! @@ -1208,7 +1038,7 @@ bool QLineEdit::isUndoAvailable() const bool QLineEdit::isRedoAvailable() const { Q_D(const QLineEdit); - return d->isRedoAvailable(); + return d->control->isRedoAvailable(); } /*! @@ -1244,7 +1074,7 @@ void QLineEdit::setDragEnabled(bool b) bool QLineEdit::hasAcceptableInput() const { Q_D(const QLineEdit); - return d->hasAcceptableInput(d->text); + return d->control->hasAcceptableInput(); } /*! @@ -1350,15 +1180,13 @@ void QLineEdit::getTextMargins(int *left, int *top, int *right, int *bottom) con QString QLineEdit::inputMask() const { Q_D(const QLineEdit); - return (d->maskData ? d->inputMask + QLatin1Char(';') + d->blank : QString()); + return d->control->inputMask(); } void QLineEdit::setInputMask(const QString &inputMask) { Q_D(QLineEdit); - d->parseInputMask(inputMask); - if (d->maskData) - d->moveCursor(d->nextMaskBlank(0)); + d->control->setInputMask(inputMask); } /*! @@ -1373,8 +1201,7 @@ void QLineEdit::setInputMask(const QString &inputMask) void QLineEdit::selectAll() { Q_D(QLineEdit); - d->selstart = d->selend = d->cursor = 0; - d->moveCursor(d->text.length(), true); + d->control->selectAll(); } /*! @@ -1386,8 +1213,7 @@ void QLineEdit::selectAll() void QLineEdit::deselect() { Q_D(QLineEdit); - d->deselect(); - d->finishChange(); + d->control->deselect(); } @@ -1402,10 +1228,7 @@ void QLineEdit::insert(const QString &newText) { // q->resetInputContext(); //#### FIX ME IN QT Q_D(QLineEdit); - int priorState = d->undoState; - d->removeSelectedText(); - d->insert(newText); - d->finishChange(priorState); + d->control->insert(newText); } /*! @@ -1416,13 +1239,8 @@ void QLineEdit::insert(const QString &newText) void QLineEdit::clear() { Q_D(QLineEdit); - int priorState = d->undoState; resetInputContext(); - d->selstart = 0; - d->selend = d->text.length(); - d->removeSelectedText(); - d->separate(); - d->finishChange(priorState, /*update*/false, /*edited*/false); + d->control->clear(); } /*! @@ -1435,8 +1253,7 @@ void QLineEdit::undo() { Q_D(QLineEdit); resetInputContext(); - d->undo(); - d->finishChange(-1, true); + d->control->undo(); } /*! @@ -1447,8 +1264,7 @@ void QLineEdit::redo() { Q_D(QLineEdit); resetInputContext(); - d->redo(); - d->finishChange(); + d->control->redo(); } @@ -1470,16 +1286,16 @@ void QLineEdit::redo() bool QLineEdit::isReadOnly() const { Q_D(const QLineEdit); - return d->readOnly; + return d->control->isReadOnly(); } void QLineEdit::setReadOnly(bool enable) { Q_D(QLineEdit); - if (d->readOnly != enable) { - d->readOnly = enable; - setAttribute(Qt::WA_MacShowFocusRect, !d->readOnly); - setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); + if (d->control->isReadOnly() != enable) { + d->control->setReadOnly(enable); + setAttribute(Qt::WA_MacShowFocusRect, !enable); + setAttribute(Qt::WA_InputMethodEnabled, d->shouldEnableInputMethod()); #ifndef QT_NO_CURSOR setCursor(enable ? Qt::ArrowCursor : Qt::IBeamCursor); #endif @@ -1518,7 +1334,7 @@ void QLineEdit::cut() void QLineEdit::copy() const { Q_D(const QLineEdit); - d->copy(); + d->control->copy(); } /*! @@ -1535,23 +1351,7 @@ void QLineEdit::copy() const void QLineEdit::paste() { Q_D(QLineEdit); - if (echoMode() == PasswordEchoOnEdit && !d->passwordEchoEditing) { - // Clear the edit and reset to normal echo mode when pasting; the echo - // mode switches back when the edit loses focus. ### changes a public - // property, resets current content - d->updatePasswordEchoEditing(true); - clear(); - } - insert(QApplication::clipboard()->text(QClipboard::Clipboard)); -} - -void QLineEditPrivate::copy(bool clipboard) const -{ - Q_Q(const QLineEdit); - QString t = q->selectedText(); - if (!t.isEmpty() && echoMode == QLineEdit::Normal) { - QApplication::clipboard()->setText(t, clipboard ? QClipboard::Clipboard : QClipboard::Selection); - } + d->control->paste(); } #endif // !QT_NO_CLIPBOARD @@ -1561,57 +1361,10 @@ void QLineEditPrivate::copy(bool clipboard) const bool QLineEdit::event(QEvent * e) { Q_D(QLineEdit); -#ifndef QT_NO_SHORTCUT - if (e->type() == QEvent::ShortcutOverride && !d->readOnly) { - QKeyEvent* ke = (QKeyEvent*) e; - if (ke == QKeySequence::Copy - || ke == QKeySequence::Paste - || ke == QKeySequence::Cut - || ke == QKeySequence::Redo - || ke == QKeySequence::Undo - || ke == QKeySequence::MoveToNextWord - || ke == QKeySequence::MoveToPreviousWord - || ke == QKeySequence::MoveToStartOfDocument - || ke == QKeySequence::MoveToEndOfDocument - || ke == QKeySequence::SelectNextWord - || ke == QKeySequence::SelectPreviousWord - || ke == QKeySequence::SelectStartOfLine - || ke == QKeySequence::SelectEndOfLine - || ke == QKeySequence::SelectStartOfBlock - || ke == QKeySequence::SelectEndOfBlock - || ke == QKeySequence::SelectStartOfDocument - || ke == QKeySequence::SelectAll - || ke == QKeySequence::SelectEndOfDocument) { - ke->accept(); - } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier - || ke->modifiers() == Qt::KeypadModifier) { - if (ke->key() < Qt::Key_Escape) { - ke->accept(); - } else { - switch (ke->key()) { - case Qt::Key_Delete: - case Qt::Key_Home: - case Qt::Key_End: - case Qt::Key_Backspace: - case Qt::Key_Left: - case Qt::Key_Right: - ke->accept(); - default: - break; - } - } - } - } else -#endif if (e->type() == QEvent::Timer) { // should be timerEvent, is here for binary compatibility int timerId = ((QTimerEvent*)e)->timerId(); - if (timerId == d->cursorTimer) { - QStyleOptionFrameV2 opt; - initStyleOption(&opt); - if(!hasSelectedText() - || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) - d->setCursorVisible(!d->cursorVisible); + if (false) { #ifndef QT_NO_DRAGANDDROP } else if (timerId == d->dndTimer.timerId()) { d->drag(); @@ -1619,62 +1372,20 @@ bool QLineEdit::event(QEvent * e) } else if (timerId == d->tripleClickTimer.timerId()) d->tripleClickTimer.stop(); -#ifdef QT_KEYPAD_NAVIGATION - else if (timerId == d->deleteAllTimer.timerId()) { - d->deleteAllTimer.stop(); - clear(); - } -#endif } else if (e->type() == QEvent::ContextMenu) { #ifndef QT_NO_IM - if (d->composeMode()) + if (d->control->composeMode()) return true; #endif - d->separate(); + //d->separate(); } else if (e->type() == QEvent::WindowActivate) { QTimer::singleShot(0, this, SLOT(_q_handleWindowActivate())); + }else if(e->type() == QEvent::ShortcutOverride){ + d->control->processEvent(e); + }else if(e->type() == QEvent::LayoutDirectionChange){ + d->control->setLayoutDirection((layoutDirection())); } -#ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { - if ((e->type() == QEvent::KeyPress) || (e->type() == QEvent::KeyRelease)) { - QKeyEvent *ke = (QKeyEvent *)e; - if (ke->key() == Qt::Key_Back) { - if (ke->isAutoRepeat()) { - // Swallow it. We don't want back keys running amok. - ke->accept(); - return true; - } - if ((e->type() == QEvent::KeyRelease) - && !isReadOnly() - && d->deleteAllTimer.isActive()) { - d->deleteAllTimer.stop(); - backspace(); - ke->accept(); - return true; - } - } - } else if (e->type() == QEvent::EnterEditFocus) { - end(false); - if (!d->cursorTimer) { - int cft = QApplication::cursorFlashTime(); - d->cursorTimer = cft ? startTimer(cft/2) : -1; - } - } else if (e->type() == QEvent::LeaveEditFocus) { - d->setCursorVisible(false); - if (d->cursorTimer > 0) - killTimer(d->cursorTimer); - d->cursorTimer = 0; - - if (!d->emitingEditingFinished) { - if (hasAcceptableInput() || d->fixup()) { - d->emitingEditingFinished = true; - emit editingFinished(); - d->emitingEditingFinished = false; - } - } - } - } -#endif + return QWidget::event(e); } @@ -1684,37 +1395,35 @@ void QLineEdit::mousePressEvent(QMouseEvent* e) { Q_D(QLineEdit); if (d->sendMouseEventToInputContext(e)) - return; + return; if (e->button() == Qt::RightButton) return; #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { setEditFocus(true); // Get the completion list to pop up. - if (d->completer) - d->completer->complete(); + if (d->control->completer()) + d->control->completer()->complete(); } #endif if (d->tripleClickTimer.isActive() && (e->pos() - d->tripleClick).manhattanLength() < QApplication::startDragDistance()) { selectAll(); - return; + return; } bool mark = e->modifiers() & Qt::ShiftModifier; int cursor = d->xToPos(e->pos().x()); #ifndef QT_NO_DRAGANDDROP - if (!mark && d->dragEnabled && d->echoMode == Normal && - e->button() == Qt::LeftButton && d->inSelection(e->pos().x())) { - d->cursor = cursor; - update(); + if (!mark && d->dragEnabled && d->control->echoMode() == Normal && + e->button() == Qt::LeftButton && d->control->inSelection(e->pos().x())) { + d->control->moveCursor(cursor); d->dndPos = e->pos(); if (!d->dndTimer.isActive()) d->dndTimer.start(QApplication::startDragTime(), this); - d->emitCursorPositionChanged(); } else #endif { - d->moveCursor(cursor, mark); + d->control->moveCursor(cursor, mark); } } @@ -1724,7 +1433,7 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e) { Q_D(QLineEdit); if (d->sendMouseEventToInputContext(e)) - return; + return; if (e->buttons() & Qt::LeftButton) { #ifndef QT_NO_DRAGANDDROP @@ -1734,7 +1443,7 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e) } else #endif { - d->moveCursor(d->xToPos(e->pos().x()), true); + d->control->moveCursor(d->xToPos(e->pos().x()), true); } } } @@ -1745,26 +1454,19 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) { Q_D(QLineEdit); if (d->sendMouseEventToInputContext(e)) - return; + return; + + if (e->buttons() & Qt::LeftButton) { #ifndef QT_NO_DRAGANDDROP - if (e->button() == Qt::LeftButton) { if (d->dndTimer.isActive()) { - d->dndTimer.stop(); - deselect(); - return; - } - } + if ((d->dndPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) + d->drag(); + } else #endif -#ifndef QT_NO_CLIPBOARD - if (QApplication::clipboard()->supportsSelection()) { - if (e->button() == Qt::LeftButton) { - d->copy(false); - } else if (!d->readOnly && e->button() == Qt::MidButton) { - d->deselect(); - insert(QApplication::clipboard()->text(QClipboard::Selection)); + { + d->control->moveCursor(d->xToPos(e->pos().x()), true); } } -#endif } /*! \reimp @@ -1773,16 +1475,9 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e) { Q_D(QLineEdit); if (d->sendMouseEventToInputContext(e)) - return; + return; if (e->button() == Qt::LeftButton) { - deselect(); - d->cursor = d->xToPos(e->pos().x()); - d->cursor = d->textLayout.previousCursorPosition(d->cursor, QTextLayout::SkipWords); - // ## text layout should support end of words. - int end = d->textLayout.nextCursorPosition(d->cursor, QTextLayout::SkipWords); - while (end > d->cursor && d->text[end-1].isSpace()) - --end; - d->moveCursor(end, true); + d->control->selectWordAtPos(d->xToPos(e->pos().x())); d->tripleClickTimer.start(QApplication::doubleClickInterval(), this); d->tripleClick = e->pos(); } @@ -1822,65 +1517,15 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e) void QLineEdit::keyPressEvent(QKeyEvent *event) { Q_D(QLineEdit); - - bool inlineCompletionAccepted = false; - -#ifndef QT_NO_COMPLETER - if (d->completer) { - QCompleter::CompletionMode completionMode = d->completer->completionMode(); - if ((completionMode == QCompleter::PopupCompletion - || completionMode == QCompleter::UnfilteredPopupCompletion) - &&d->completer->popup() - && d->completer->popup()->isVisible()) { - // The following keys are forwarded by the completer to the widget - // Ignoring the events lets the completer provide suitable default behavior - switch (event->key()) { - case Qt::Key_Escape: - event->ignore(); - return; - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_F4: -#ifdef QT_KEYPAD_NAVIGATION - case Qt::Key_Select: - if (!QApplication::keypadNavigationEnabled()) - break; -#endif - d->completer->popup()->hide(); // just hide. will end up propagating to parent - default: - break; // normal key processing - } - } else if (completionMode == QCompleter::InlineCompletion) { - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_F4: -#ifdef QT_KEYPAD_NAVIGATION - case Qt::Key_Select: - if (!QApplication::keypadNavigationEnabled()) - break; -#endif - if (!d->completer->currentCompletion().isEmpty() && d->selend > d->selstart - && d->selend == d->text.length()) { - setText(d->completer->currentCompletion()); - inlineCompletionAccepted = true; - } - default: - break; // normal key processing - } - } - } -#endif // QT_NO_COMPLETER - -#ifdef QT_KEYPAD_NAVIGATION + #ifdef QT_KEYPAD_NAVIGATION bool select = false; switch (event->key()) { case Qt::Key_Select: if (QApplication::keypadNavigationEnabled()) { if (hasEditFocus()) { setEditFocus(false); - if (d->completer && d->completer->popup()->isVisible()) - d->completer->popup()->hide(); + if (d->control->completer() && d->control->completer()->popup()->isVisible()) + d->control->completer()->popup()->hide(); select = true; } } @@ -1916,274 +1561,7 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) return; // Just start. No action. } #endif - - if (echoMode() == PasswordEchoOnEdit - && !d->passwordEchoEditing - && !isReadOnly() - && !event->text().isEmpty() -#ifdef QT_KEYPAD_NAVIGATION - && event->key() != Qt::Key_Select - && event->key() != Qt::Key_Up - && event->key() != Qt::Key_Down - && event->key() != Qt::Key_Back -#endif - && !(event->modifiers() & Qt::ControlModifier)) { - // Clear the edit and reset to normal echo mode while editing; the - // echo mode switches back when the edit loses focus. ### changes a - // public property, resets current content. dubious code; you can - // navigate with keys up, down, back, and select(?), but if you press - // "left" or "right" it clears? - d->updatePasswordEchoEditing(true); - clear(); - } - - d->setCursorVisible(true); - if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { - if (hasAcceptableInput() || d->fixup()) { - emit returnPressed(); - d->emitingEditingFinished = true; - emit editingFinished(); - d->emitingEditingFinished = false; - } - if (inlineCompletionAccepted) - event->accept(); - else - event->ignore(); - return; - } - bool unknown = false; - - if (false) { - } -#ifndef QT_NO_SHORTCUT - else if (event == QKeySequence::Undo) { - if (!d->readOnly) - undo(); - } - else if (event == QKeySequence::Redo) { - if (!d->readOnly) - redo(); - } - else if (event == QKeySequence::SelectAll) { - selectAll(); - } -#ifndef QT_NO_CLIPBOARD - else if (event == QKeySequence::Copy) { - copy(); - } - else if (event == QKeySequence::Paste) { - if (!d->readOnly) - paste(); - } - else if (event == QKeySequence::Cut) { - if (!d->readOnly) { - cut(); - } - } - else if (event == QKeySequence::DeleteEndOfLine) { - if (!d->readOnly) { - setSelection(d->cursor, d->text.size()); - copy(); - del(); - } - } -#endif //QT_NO_CLIPBOARD - else if (event == QKeySequence::MoveToStartOfLine) { - home(0); - } - else if (event == QKeySequence::MoveToEndOfLine) { - end(0); - } - else if (event == QKeySequence::SelectStartOfLine) { - home(1); - } - else if (event == QKeySequence::SelectEndOfLine) { - end(1); - } - else if (event == QKeySequence::MoveToNextChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) - if (d->hasSelectedText()) { -#else - if (d->hasSelectedText() && d->completer - && d->completer->completionMode() == QCompleter::InlineCompletion) { -#endif - d->moveCursor(d->selend, false); - } else { - cursorForward(0, layoutDirection() == Qt::LeftToRight ? 1 : -1); - } - } - else if (event == QKeySequence::SelectNextChar) { - cursorForward(1, layoutDirection() == Qt::LeftToRight ? 1 : -1); - } - else if (event == QKeySequence::MoveToPreviousChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) - if (d->hasSelectedText()) { -#else - if (d->hasSelectedText() && d->completer - && d->completer->completionMode() == QCompleter::InlineCompletion) { -#endif - d->moveCursor(d->selstart, false); - } else { - cursorBackward(0, layoutDirection() == Qt::LeftToRight ? 1 : -1); - } - } - else if (event == QKeySequence::SelectPreviousChar) { - cursorBackward(1, layoutDirection() == Qt::LeftToRight ? 1 : -1); - } - else if (event == QKeySequence::MoveToNextWord) { - if (echoMode() == Normal) - layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); - else - layoutDirection() == Qt::LeftToRight ? end(0) : home(0); - } - else if (event == QKeySequence::MoveToPreviousWord) { - if (echoMode() == Normal) - layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); - else if (!d->readOnly) { - layoutDirection() == Qt::LeftToRight ? home(0) : end(0); - } - } - else if (event == QKeySequence::SelectNextWord) { - if (echoMode() == Normal) - layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); - else - layoutDirection() == Qt::LeftToRight ? end(1) : home(1); - } - else if (event == QKeySequence::SelectPreviousWord) { - if (echoMode() == Normal) - layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); - else - layoutDirection() == Qt::LeftToRight ? home(1) : end(1); - } - else if (event == QKeySequence::Delete) { - if (!d->readOnly) - del(); - } - else if (event == QKeySequence::DeleteEndOfWord) { - if (!d->readOnly) { - cursorWordForward(true); - del(); - } - } - else if (event == QKeySequence::DeleteStartOfWord) { - if (!d->readOnly) { - cursorWordBackward(true); - del(); - } - } -#endif // QT_NO_SHORTCUT - else { -#ifdef Q_WS_MAC - if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { - Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); - if (myModifiers & Qt::ShiftModifier) { - if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) - || myModifiers == (Qt::AltModifier|Qt::ShiftModifier) - || myModifiers == Qt::ShiftModifier) { - - event->key() == Qt::Key_Up ? home(1) : end(1); - } - } else { - if ((myModifiers == Qt::ControlModifier - || myModifiers == Qt::AltModifier - || myModifiers == Qt::NoModifier)) { - event->key() == Qt::Key_Up ? home(0) : end(0); - } - } - } -#endif - if (event->modifiers() & Qt::ControlModifier) { - switch (event->key()) { - case Qt::Key_Backspace: - if (!d->readOnly) { - cursorWordBackward(true); - del(); - } - break; -#ifndef QT_NO_COMPLETER - case Qt::Key_Up: - case Qt::Key_Down: - d->complete(event->key()); - break; -#endif -#if defined(Q_WS_X11) - case Qt::Key_E: - end(0); - break; - - case Qt::Key_U: - if (!d->readOnly) { - setSelection(0, d->text.size()); -#ifndef QT_NO_CLIPBOARD - copy(); -#endif - del(); - } - break; -#endif - default: - unknown = true; - } - } else { // ### check for *no* modifier - switch (event->key()) { - case Qt::Key_Backspace: - if (!d->readOnly) { - backspace(); -#ifndef QT_NO_COMPLETER - d->complete(Qt::Key_Backspace); -#endif - } - break; -#ifdef QT_KEYPAD_NAVIGATION - case Qt::Key_Back: - if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() - && !isReadOnly()) { - if (text().length() == 0) { - setText(d->origText); - - if (d->passwordEchoEditing) - d->updatePasswordEchoEditing(false); - - setEditFocus(false); - } else if (!d->deleteAllTimer.isActive()) { - d->deleteAllTimer.start(750, this); - } - } else { - unknown = true; - } - break; -#endif - - default: - unknown = true; - } - } - } - - if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) { - setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); - d->updateTextLayout(); - update(); - unknown = false; - } - - if (unknown && !d->readOnly) { - QString t = event->text(); - if (!t.isEmpty() && t.at(0).isPrint() && - ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) { - insert(t); -#ifndef QT_NO_COMPLETER - d->complete(event->key()); -#endif - event->accept(); - return; - } - } - - if (unknown) - event->ignore(); - else - event->accept(); + d->control->processKeyEvent(event); } /*! @@ -2197,50 +1575,17 @@ QRect QLineEdit::cursorRect() const return d->cursorRect(); } -/*! - This function is not intended as polymorphic usage. Just a shared code - fragment that calls QInputContext::mouseHandler for this - class. -*/ -bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e ) -{ -#if !defined QT_NO_IM - Q_Q(QLineEdit); - if ( composeMode() ) { - int tmp_cursor = xToPos(e->pos().x()); - int mousePos = tmp_cursor - cursor; - if ( mousePos < 0 || mousePos > textLayout.preeditAreaText().length() ) { - mousePos = -1; - // don't send move events outside the preedit area - if ( e->type() == QEvent::MouseMove ) - return true; - } - - QInputContext *qic = q->inputContext(); - if ( qic ) - // may be causing reset() in some input methods - qic->mouseHandler(mousePos, e); - if (!textLayout.preeditAreaText().isEmpty()) - return true; - } -#else - Q_UNUSED(e); -#endif - - return false; -} - /*! \reimp */ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) { Q_D(QLineEdit); - if (d->readOnly) { + if (d->control->isReadOnly()) { e->ignore(); return; } - if (echoMode() == PasswordEchoOnEdit && !d->passwordEchoEditing) { + if (echoMode() == PasswordEchoOnEdit && !d->control->passwordEchoEditing()) { // Clear the edit and reset to normal echo mode while entering input // method data; the echo mode switches back when the edit loses focus. // ### changes a public property, resets current content. @@ -2248,6 +1593,8 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) clear(); } + d->control->processInputMethodEvent(e); + #ifdef QT_KEYPAD_NAVIGATION // Focus in if currently in navigation focus on the widget // Only focus in on preedits, to allow input methods to @@ -2260,55 +1607,9 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) } #endif - int priorState = d->undoState; - d->removeSelectedText(); - - int c = d->cursor; // cursor position after insertion of commit string - if (e->replacementStart() <= 0) - c += e->commitString().length() + qMin(-e->replacementStart(), e->replacementLength()); - - d->cursor += e->replacementStart(); - - // insert commit string - if (e->replacementLength()) { - d->selstart = d->cursor; - d->selend = d->selstart + e->replacementLength(); - d->removeSelectedText(); - } - if (!e->commitString().isEmpty()) - d->insert(e->commitString()); - - d->cursor = qMin(c, d->text.length()); - - d->textLayout.setPreeditArea(d->cursor, e->preeditString()); - d->preeditCursor = e->preeditString().length(); - d->hideCursor = false; - QList formats; - for (int i = 0; i < e->attributes().size(); ++i) { - const QInputMethodEvent::Attribute &a = e->attributes().at(i); - if (a.type == QInputMethodEvent::Cursor) { - d->preeditCursor = a.start; - d->hideCursor = !a.length; - } else if (a.type == QInputMethodEvent::TextFormat) { - QTextCharFormat f = qvariant_cast(a.value).toCharFormat(); - if (f.isValid()) { - QTextLayout::FormatRange o; - o.start = a.start + d->cursor; - o.length = a.length; - o.format = f; - formats.append(o); - } - } - } - d->textLayout.setAdditionalFormats(formats); - d->updateTextLayout(); - update(); - if (!e->commitString().isEmpty()) - d->emitCursorPositionChanged(); - d->finishChange(priorState); #ifndef QT_NO_COMPLETER if (!e->commitString().isEmpty()) - d->complete(Qt::Key_unknown); + d->control->complete(Qt::Key_unknown); #endif } @@ -2323,9 +1624,9 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImFont: return font(); case Qt::ImCursorPosition: - return QVariant((d->selend - d->selstart == 0) ? d->cursor : d->selend); + return QVariant(d->control->hasSelectedText() ? d->control->selectionEnd() : d->control->cursor()); case Qt::ImSurroundingText: - return QVariant(d->text); + return QVariant(text()); case Qt::ImCurrentSelection: return QVariant(selectedText()); default: @@ -2342,36 +1643,34 @@ void QLineEdit::focusInEvent(QFocusEvent *e) if (e->reason() == Qt::TabFocusReason || e->reason() == Qt::BacktabFocusReason || e->reason() == Qt::ShortcutFocusReason) { - if (d->maskData) - d->moveCursor(d->nextMaskBlank(0)); - else if (!d->hasSelectedText()) + if (!d->control->inputMask().isEmpty()) + d->control->moveCursor(d->control->nextMaskBlank(0)); + else if (!d->control->hasSelectedText()) selectAll(); } #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)) #endif - if (!d->cursorTimer) { - int cft = QApplication::cursorFlashTime(); - d->cursorTimer = cft ? startTimer(cft/2) : -1; - } + int cft = QApplication::cursorFlashTime(); + d->control->setCursorBlinkPeriod(cft/2); QStyleOptionFrameV2 opt; initStyleOption(&opt); - if((!hasSelectedText() && d->textLayout.preeditAreaText().isEmpty()) + if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) d->setCursorVisible(true); #ifdef Q_WS_MAC - if (d->echoMode == Password || d->echoMode == NoEcho) + if (d->control->echoMode() == Password || d->control->echoMode() == NoEcho) qt_mac_secure_keyboard(true); #endif #ifdef QT_KEYPAD_NAVIGATION d->origText = d->text; #endif #ifndef QT_NO_COMPLETER - if (d->completer) { - d->completer->setWidget(this); - QObject::connect(d->completer, SIGNAL(activated(QString)), + if (d->control->completer()) { + d->control->completer()->setWidget(this); + QObject::connect(d->control->completer(), SIGNAL(activated(QString)), this, SLOT(setText(QString))); - QObject::connect(d->completer, SIGNAL(highlighted(QString)), + QObject::connect(d->control->completer(), SIGNAL(highlighted(QString)), this, SLOT(_q_completionHighlighted(QString))); } #endif @@ -2384,7 +1683,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) void QLineEdit::focusOutEvent(QFocusEvent *e) { Q_D(QLineEdit); - if (d->passwordEchoEditing) { + if (d->control->passwordEchoEditing()) { // Reset the echomode back to PasswordEchoOnEdit when the widget loses // focus. d->updatePasswordEchoEditing(false); @@ -2396,21 +1695,18 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) deselect(); d->setCursorVisible(false); - if (d->cursorTimer > 0) - killTimer(d->cursorTimer); - d->cursorTimer = 0; - + d->control->setCursorBlinkPeriod(0); #ifdef QT_KEYPAD_NAVIGATION // editingFinished() is already emitted on LeaveEditFocus if (!QApplication::keypadNavigationEnabled()) #endif if (reason != Qt::PopupFocusReason || !(QApplication::activePopupWidget() && QApplication::activePopupWidget()->parentWidget() == this)) { - if (!d->emitingEditingFinished) { - if (hasAcceptableInput() || d->fixup()) { - d->emitingEditingFinished = true; + if (!d->control->emitingEditingFinished) { + if (hasAcceptableInput() || d->control->fixup()) { + d->control->emitingEditingFinished = true; emit editingFinished(); - d->emitingEditingFinished = false; + d->control->emitingEditingFinished = false; } } #ifdef QT3_SUPPORT @@ -2418,15 +1714,15 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) #endif } #ifdef Q_WS_MAC - if (d->echoMode == Password || d->echoMode == NoEcho) + if (d->control->echoMode() == Password || d->control->echoMode() == NoEcho) qt_mac_secure_keyboard(false); #endif #ifdef QT_KEYPAD_NAVIGATION d->origText = QString(); #endif #ifndef QT_NO_COMPLETER - if (d->completer) { - QObject::disconnect(d->completer, 0, this, 0); + if (d->control->completer()) { + QObject::disconnect(d->control->completer(), 0, this, 0); } #endif update(); @@ -2456,24 +1752,19 @@ void QLineEdit::paintEvent(QPaintEvent *) Qt::Alignment va = QStyle::visualAlignment(layoutDirection(), QFlag(d->alignment)); switch (va & Qt::AlignVertical_Mask) { case Qt::AlignBottom: - d->vscroll = r.y() + r.height() - fm.height() - verticalMargin; + d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin; break; case Qt::AlignTop: - d->vscroll = r.y() + verticalMargin; + d->vscroll = r.y() + d->verticalMargin; break; default: //center d->vscroll = r.y() + (r.height() - fm.height() + 1) / 2; break; } - QRect lineRect(r.x() + horizontalMargin, d->vscroll, r.width() - 2*horizontalMargin, fm.height()); - QTextLine line = d->textLayout.lineAt(0); + QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height()); - int cursor = d->cursor; - if (d->preeditCursor != -1) - cursor += d->preeditCursor; - // locate cursor position - int cix = qRound(line.cursorToX(cursor)); + int cix = qRound(d->control->cursorToX()); // horizontal scrolling. d->hscroll is the left indent from the beginning // of the text line to the left edge of lineRect. we update this value @@ -2483,7 +1774,7 @@ void QLineEdit::paintEvent(QPaintEvent *) // (cix). int minLB = qMax(0, -fm.minLeftBearing()); int minRB = qMax(0, -fm.minRightBearing()); - int widthUsed = qRound(line.naturalTextWidth()) + 1 + minRB; + int widthUsed = d->control->width() + minRB; if ((minLB + widthUsed) <= lineRect.width()) { // text fits in lineRect; use hscroll for alignment switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { @@ -2511,7 +1802,7 @@ void QLineEdit::paintEvent(QPaintEvent *) d->hscroll = widthUsed - lineRect.width() + 1; } // the y offset is there to keep the baseline constant in case we have script changes in the text. - QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->ascent - fm.ascent()); + QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent()); // draw text, selections and cursors #ifndef QT_NO_STYLE_STYLESHEET @@ -2521,33 +1812,23 @@ void QLineEdit::paintEvent(QPaintEvent *) #endif p.setPen(pal.text().color()); - QVector selections; + int flags = QLineControl::DrawText; + #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || hasEditFocus()) #endif - if (d->selstart < d->selend || (d->cursorVisible && d->maskData && !d->readOnly)) { - QTextLayout::FormatRange o; - if (d->selstart < d->selend) { - o.start = d->selstart; - o.length = d->selend - d->selstart; - o.format.setBackground(pal.brush(QPalette::Highlight)); - o.format.setForeground(pal.brush(QPalette::HighlightedText)); - } else { - // mask selection - o.start = d->cursor; - o.length = 1; - o.format.setBackground(pal.brush(QPalette::Text)); - o.format.setForeground(pal.brush(QPalette::Window)); - } - selections.append(o); - } + if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())) + flags |= QLineControl::DrawSelections; // Asian users see an IM selection text as cursor on candidate // selection phase of input method, so the ordinary cursor should be // invisible if we have a preedit string. - d->textLayout.draw(&p, topLeft, selections, r); - if (d->cursorVisible && !d->readOnly && !d->hideCursor) - d->textLayout.drawCursor(&p, topLeft, cursor, style()->pixelMetric(QStyle::PM_TextCursorWidth)); + if (d->cursorVisible && !d->control->isReadOnly()) + flags |= QLineControl::DrawCursor; + + d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth)); + d->control->draw(&p, topLeft, r, flags); + } @@ -2557,12 +1838,11 @@ void QLineEdit::paintEvent(QPaintEvent *) void QLineEdit::dragMoveEvent(QDragMoveEvent *e) { Q_D(QLineEdit); - if (!d->readOnly && e->mimeData()->hasFormat(QLatin1String("text/plain"))) { + if (!d->control->isReadOnly() && e->mimeData()->hasFormat(QLatin1String("text/plain"))) { e->acceptProposedAction(); - d->cursor = d->xToPos(e->pos().x()); + d->control->moveCursor(d->xToPos(e->pos().x()), false); d->cursorVisible = true; update(); - d->emitCursorPositionChanged(); } } @@ -2588,13 +1868,14 @@ void QLineEdit::dropEvent(QDropEvent* e) Q_D(QLineEdit); QString str = e->mimeData()->text(); - if (!str.isNull() && !d->readOnly) { + if (!str.isNull() && !d->control->isReadOnly()) { if (e->source() == this && e->dropAction() == Qt::CopyAction) deselect(); - d->cursor =d->xToPos(e->pos().x()); - int selStart = d->cursor; - int oldSelStart = d->selstart; - int oldSelEnd = d->selend; + int cursorPos = d->xToPos(e->pos().x()); + int selStart = cursorPos; + int oldSelStart = d->control->selectionStart(); + int oldSelEnd = d->control->selectionEnd(); + d->control->moveCursor(cursorPos, false); d->cursorVisible = false; e->acceptProposedAction(); insert(str); @@ -2616,22 +1897,6 @@ void QLineEdit::dropEvent(QDropEvent* e) } } -void QLineEditPrivate::drag() -{ - Q_Q(QLineEdit); - dndTimer.stop(); - QMimeData *data = new QMimeData; - data->setText(q->selectedText()); - QDrag *drag = new QDrag(q); - drag->setMimeData(data); - Qt::DropAction action = drag->start(); - if (action == Qt::MoveAction && !readOnly && drag->target() != q) { - int priorState = undoState; - removeSelectedText(); - finishChange(priorState); - } -} - #endif // QT_NO_DRAGANDDROP #ifndef QT_NO_CONTEXTMENU @@ -2676,37 +1941,37 @@ QMenu *QLineEdit::createStandardContextMenu() popup->setObjectName(QLatin1String("qt_edit_menu")); QAction *action = popup->addAction(QLineEdit::tr("&Undo") + ACCEL_KEY(QKeySequence::Undo)); - action->setEnabled(d->isUndoAvailable()); + action->setEnabled(d->control->isUndoAvailable()); connect(action, SIGNAL(triggered()), SLOT(undo())); action = popup->addAction(QLineEdit::tr("&Redo") + ACCEL_KEY(QKeySequence::Redo)); - action->setEnabled(d->isRedoAvailable()); + action->setEnabled(d->control->isRedoAvailable()); connect(action, SIGNAL(triggered()), SLOT(redo())); popup->addSeparator(); #ifndef QT_NO_CLIPBOARD action = popup->addAction(QLineEdit::tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut)); - action->setEnabled(!d->readOnly && d->hasSelectedText() && d->echoMode == QLineEdit::Normal); + action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText()); connect(action, SIGNAL(triggered()), SLOT(cut())); action = popup->addAction(QLineEdit::tr("&Copy") + ACCEL_KEY(QKeySequence::Copy)); - action->setEnabled(d->hasSelectedText() && d->echoMode == QLineEdit::Normal); + action->setEnabled(d->control->hasSelectedText()); connect(action, SIGNAL(triggered()), SLOT(copy())); action = popup->addAction(QLineEdit::tr("&Paste") + ACCEL_KEY(QKeySequence::Paste)); - action->setEnabled(!d->readOnly && !QApplication::clipboard()->text().isEmpty()); + action->setEnabled(!d->control->isReadOnly() && !QApplication::clipboard()->text().isEmpty()); connect(action, SIGNAL(triggered()), SLOT(paste())); #endif action = popup->addAction(QLineEdit::tr("Delete")); - action->setEnabled(!d->readOnly && !d->text.isEmpty() && d->hasSelectedText()); + action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText()); connect(action, SIGNAL(triggered()), SLOT(_q_deleteSelected())); popup->addSeparator(); action = popup->addAction(QLineEdit::tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll)); - action->setEnabled(!d->text.isEmpty() && !d->allSelected()); + action->setEnabled(!d->control->text().isEmpty() && !d->control->allSelected()); d->selectAllAction = action; connect(action, SIGNAL(triggered()), SLOT(selectAll())); @@ -2720,9 +1985,9 @@ QMenu *QLineEdit::createStandardContextMenu() #endif #if defined(Q_WS_WIN) - if (!d->readOnly && qt_use_rtl_extensions) { + if (!d->control->isReadOnly() && qt_use_rtl_extensions) { #else - if (!d->readOnly) { + if (!d->control->isReadOnly()) { #endif popup->addSeparator(); QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup); @@ -2736,806 +2001,26 @@ QMenu *QLineEdit::createStandardContextMenu() void QLineEdit::changeEvent(QEvent *ev) { Q_D(QLineEdit); - if(ev->type() == QEvent::ActivationChange) { + switch(ev->type()) + { + case QEvent::ActivationChange: if (!palette().isEqual(QPalette::Active, QPalette::Inactive)) update(); - } else if (ev->type() == QEvent::FontChange - || ev->type() == QEvent::StyleChange - || ev->type() == QEvent::LayoutDirectionChange) { - d->updateTextLayout(); - } - QWidget::changeEvent(ev); -} - -void QLineEditPrivate::_q_handleWindowActivate() -{ - Q_Q(QLineEdit); - if (!q->hasFocus() && q->hasSelectedText()) - q->deselect(); -} - -void QLineEditPrivate::_q_deleteSelected() -{ - Q_Q(QLineEdit); - if (!hasSelectedText()) - return; - - int priorState = undoState; - q->resetInputContext(); - removeSelectedText(); - separate(); - finishChange(priorState); -} - -void QLineEditPrivate::init(const QString& txt) -{ - Q_Q(QLineEdit); -#ifndef QT_NO_CURSOR - q->setCursor(Qt::IBeamCursor); -#endif - q->setFocusPolicy(Qt::StrongFocus); - q->setAttribute(Qt::WA_InputMethodEnabled); - // Specifies that this widget can use more, but is able to survive on - // less, horizontal space; and is fixed vertically. - q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::LineEdit)); - q->setBackgroundRole(QPalette::Base); - q->setAttribute(Qt::WA_KeyCompression); - q->setMouseTracking(true); - q->setAcceptDrops(true); - text = txt; - updateTextLayout(); - cursor = text.length(); - - q->setAttribute(Qt::WA_MacShowFocusRect); -} - -void QLineEditPrivate::updatePasswordEchoEditing(bool editing) -{ - Q_Q(QLineEdit); - passwordEchoEditing = editing; - q->setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(q)); - updateTextLayout(); - q->update(); -} - -void QLineEditPrivate::updateTextLayout() -{ - // replace certain non-printable characters with spaces (to avoid - // drawing boxes when using fonts that don't have glyphs for such - // characters) - Q_Q(QLineEdit); - QString str = q->displayText(); - QChar* uc = str.data(); - for (int i = 0; i < (int)str.length(); ++i) { - if ((uc[i] < 0x20 && uc[i] != 0x09) - || uc[i] == QChar::LineSeparator - || uc[i] == QChar::ParagraphSeparator - || uc[i] == QChar::ObjectReplacementCharacter) - uc[i] = QChar(0x0020); - } - textLayout.setFont(q->font()); - textLayout.setText(str); - QTextOption option; - option.setTextDirection(q->layoutDirection()); - option.setFlags(QTextOption::IncludeTrailingSpaces); - textLayout.setTextOption(option); - - textLayout.beginLayout(); - QTextLine l = textLayout.createLine(); - textLayout.endLayout(); - ascent = qRound(l.ascent()); -} - -int QLineEditPrivate::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const -{ - QRect cr = adjustedContentsRect(); - x-= cr.x() - hscroll + horizontalMargin; - QTextLine l = textLayout.lineAt(0); - return l.xToCursor(x, betweenOrOn); -} - -QRect QLineEditPrivate::cursorRect() const -{ - Q_Q(const QLineEdit); - QRect cr = adjustedContentsRect(); - int cix = cr.x() - hscroll + horizontalMargin; - QTextLine l = textLayout.lineAt(0); - int c = cursor; - if (preeditCursor != -1) - c += preeditCursor; - cix += qRound(l.cursorToX(c)); - int ch = qMin(cr.height(), q->fontMetrics().height() + 1); - int w = q->style()->pixelMetric(QStyle::PM_TextCursorWidth); - return QRect(cix-5, vscroll, w + 9, ch); -} - -QRect QLineEditPrivate::adjustedContentsRect() const -{ - Q_Q(const QLineEdit); - QStyleOptionFrameV2 opt; - q->initStyleOption(&opt); - QRect r = q->style()->subElementRect(QStyle::SE_LineEditContents, &opt, q); - r.setX(r.x() + leftTextMargin); - r.setY(r.y() + topTextMargin); - r.setRight(r.right() - rightTextMargin); - r.setBottom(r.bottom() - bottomTextMargin); - return r; -} - -bool QLineEditPrivate::fixup() // this function assumes that validate currently returns != Acceptable -{ -#ifndef QT_NO_VALIDATOR - if (validator) { - QString textCopy = text; - int cursorCopy = cursor; - validator->fixup(textCopy); - if (validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) { - if (textCopy != text || cursorCopy != cursor) - setText(textCopy, cursorCopy); - return true; - } - } -#endif - return false; -} - -void QLineEditPrivate::moveCursor(int pos, bool mark) -{ - Q_Q(QLineEdit); - if (pos != cursor) { - separate(); - if (maskData) - pos = pos > cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); - } - bool fullUpdate = mark || hasSelectedText(); - if (mark) { - int anchor; - if (selend > selstart && cursor == selstart) - anchor = selend; - else if (selend > selstart && cursor == selend) - anchor = selstart; - else - anchor = cursor; - selstart = qMin(anchor, pos); - selend = qMax(anchor, pos); - updateTextLayout(); - } else { - deselect(); - } - if (fullUpdate) { - cursor = pos; - q->update(); - } else { - setCursorVisible(false); - cursor = pos; - setCursorVisible(true); - if (!adjustedContentsRect().contains(cursorRect())) - q->update(); - } - QStyleOptionFrameV2 opt; - q->initStyleOption(&opt); - if (mark && !q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q)) - setCursorVisible(false); - if (mark || selDirty) { - selDirty = false; - emit q->selectionChanged(); - } - emitCursorPositionChanged(); -} - -void QLineEditPrivate::finishChange(int validateFromState, bool update, bool edited) -{ - Q_Q(QLineEdit); - bool lineDirty = selDirty; - if (textDirty) { - // do validation - bool wasValidInput = validInput; - validInput = true; -#ifndef QT_NO_VALIDATOR - if (validator) { - validInput = false; - QString textCopy = text; - int cursorCopy = cursor; - validInput = (validator->validate(textCopy, cursorCopy) != QValidator::Invalid); - if (validInput) { - if (text != textCopy) { - setText(textCopy, cursorCopy); - return; - } - cursor = cursorCopy; - } - } -#endif - if (validateFromState >= 0 && wasValidInput && !validInput) { - undo(validateFromState); - history.resize(undoState); - if (modifiedState > undoState) - modifiedState = -1; - validInput = true; - textDirty = false; - } - updateTextLayout(); - lineDirty |= textDirty; - if (textDirty) { - textDirty = false; - QString actualText = maskData ? stripString(text) : text; - if (edited) - emit q->textEdited(actualText); - q->updateMicroFocus(); -#ifndef QT_NO_COMPLETER - if (edited && completer && completer->completionMode() != QCompleter::InlineCompletion) - complete(-1); // update the popup on cut/paste/del -#endif - emit q->textChanged(actualText); - } -#ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged); -#endif - } - if (selDirty) { - selDirty = false; - emit q->selectionChanged(); - } - if (lineDirty || update) - q->update(); - emitCursorPositionChanged(); -} - -void QLineEditPrivate::emitCursorPositionChanged() -{ - Q_Q(QLineEdit); - if (cursor != lastCursorPos) { - const int oldLast = lastCursorPos; - lastCursorPos = cursor; - emit q->cursorPositionChanged(oldLast, cursor); - } -} - -void QLineEditPrivate::setText(const QString& txt, int pos, bool edited) -{ - Q_Q(QLineEdit); - q->resetInputContext(); - deselect(); - QString oldText = text; - if (maskData) { - text = maskString(0, txt, true); - text += clearString(text.length(), maxLength - text.length()); - } else { - text = txt.isEmpty() ? txt : txt.left(maxLength); - } - history.clear(); - modifiedState = undoState = 0; - cursor = (pos < 0 || pos > text.length()) ? text.length() : pos; - textDirty = (oldText != text); - finishChange(-1, true, edited); -} - - -void QLineEditPrivate::setCursorVisible(bool visible) -{ - Q_Q(QLineEdit); - if ((bool)cursorVisible == visible) - return; - if (cursorTimer) - cursorVisible = visible; - QRect r = cursorRect(); - if (maskData) - q->update(); - else - q->update(r); -} - -void QLineEditPrivate::addCommand(const Command& cmd) -{ - if (separator && undoState && history[undoState-1].type != Separator) { - history.resize(undoState + 2); - history[undoState++] = Command(Separator, cursor, 0, selstart, selend); - } else { - history.resize(undoState + 1); - } - separator = false; - history[undoState++] = cmd; -} - -void QLineEditPrivate::insert(const QString& s) -{ - if (hasSelectedText()) - addCommand(Command(SetSelection, cursor, 0, selstart, selend)); - if (maskData) { - QString ms = maskString(cursor, s); - for (int i = 0; i < (int) ms.length(); ++i) { - addCommand (Command(DeleteSelection, cursor+i, text.at(cursor+i), -1, -1)); - addCommand(Command(Insert, cursor+i, ms.at(i), -1, -1)); - } - text.replace(cursor, ms.length(), ms); - cursor += ms.length(); - cursor = nextMaskBlank(cursor); - textDirty = true; - } else { - int remaining = maxLength - text.length(); - if (remaining != 0) { - text.insert(cursor, s.left(remaining)); - for (int i = 0; i < (int) s.left(remaining).length(); ++i) - addCommand(Command(Insert, cursor++, s.at(i), -1, -1)); - textDirty = true; - } - } -} - -void QLineEditPrivate::del(bool wasBackspace) -{ - if (cursor < (int) text.length()) { - if (hasSelectedText()) - addCommand(Command(SetSelection, cursor, 0, selstart, selend)); - addCommand (Command((CommandType)((maskData?2:0)+(wasBackspace?Remove:Delete)), cursor, text.at(cursor), -1, -1)); - if (maskData) { - text.replace(cursor, 1, clearString(cursor, 1)); - addCommand(Command(Insert, cursor, text.at(cursor), -1, -1)); - } else { - text.remove(cursor, 1); - } - textDirty = true; - } -} - -void QLineEditPrivate::removeSelectedText() -{ - if (selstart < selend && selend <= (int) text.length()) { - separate(); - int i ; - addCommand(Command(SetSelection, cursor, 0, selstart, selend)); - if (selstart <= cursor && cursor < selend) { - // cursor is within the selection. Split up the commands - // to be able to restore the correct cursor position - for (i = cursor; i >= selstart; --i) - addCommand (Command(DeleteSelection, i, text.at(i), -1, 1)); - for (i = selend - 1; i > cursor; --i) - addCommand (Command(DeleteSelection, i - cursor + selstart - 1, text.at(i), -1, -1)); - } else { - for (i = selend-1; i >= selstart; --i) - addCommand (Command(RemoveSelection, i, text.at(i), -1, -1)); - } - if (maskData) { - text.replace(selstart, selend - selstart, clearString(selstart, selend - selstart)); - for (int i = 0; i < selend - selstart; ++i) - addCommand(Command(Insert, selstart + i, text.at(selstart + i), -1, -1)); - } else { - text.remove(selstart, selend - selstart); - } - if (cursor > selstart) - cursor -= qMin(cursor, selend) - selstart; - deselect(); - textDirty = true; - - // adjust hscroll to avoid gap - const int minRB = qMax(0, -q_func()->fontMetrics().minRightBearing()); - updateTextLayout(); - const QTextLine line = textLayout.lineAt(0); - const int widthUsed = qRound(line.naturalTextWidth()) + 1 + minRB; - hscroll = qMin(hscroll, widthUsed); - } -} - -void QLineEditPrivate::parseInputMask(const QString &maskFields) -{ - int delimiter = maskFields.indexOf(QLatin1Char(';')); - if (maskFields.isEmpty() || delimiter == 0) { - if (maskData) { - delete [] maskData; - maskData = 0; - maxLength = 32767; - setText(QString()); - } - return; - } - - if (delimiter == -1) { - blank = QLatin1Char(' '); - inputMask = maskFields; - } else { - inputMask = maskFields.left(delimiter); - blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' '); - } - - // calculate maxLength / maskData length - maxLength = 0; - QChar c = 0; - for (int i=0; i 0 && inputMask.at(i-1) == QLatin1Char('\\')) { - maxLength++; - continue; - } - if (c != QLatin1Char('\\') && c != QLatin1Char('!') && - c != QLatin1Char('<') && c != QLatin1Char('>') && - c != QLatin1Char('{') && c != QLatin1Char('}') && - c != QLatin1Char('[') && c != QLatin1Char(']')) - maxLength++; - } - - delete [] maskData; - maskData = new MaskInputData[maxLength]; - - MaskInputData::Casemode m = MaskInputData::NoCaseMode; - c = 0; - bool s; - bool escape = false; - int index = 0; - for (int i = 0; i < inputMask.length(); i++) { - c = inputMask.at(i); - if (escape) { - s = true; - maskData[index].maskChar = c; - maskData[index].separator = s; - maskData[index].caseMode = m; - index++; - escape = false; - } else if (c == QLatin1Char('<')) { - m = MaskInputData::Lower; - } else if (c == QLatin1Char('>')) { - m = MaskInputData::Upper; - } else if (c == QLatin1Char('!')) { - m = MaskInputData::NoCaseMode; - } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) { - switch (c.unicode()) { - case 'A': - case 'a': - case 'N': - case 'n': - case 'X': - case 'x': - case '9': - case '0': - case 'D': - case 'd': - case '#': - case 'H': - case 'h': - case 'B': - case 'b': - s = false; - break; - case '\\': - escape = true; - default: - s = true; - break; - } - - if (!escape) { - maskData[index].maskChar = c; - maskData[index].separator = s; - maskData[index].caseMode = m; - index++; - } - } - } - setText(text); -} - - -/* checks if the key is valid compared to the inputMask */ -bool QLineEditPrivate::isValidInput(QChar key, QChar mask) const -{ - switch (mask.unicode()) { - case 'A': - if (key.isLetter()) - return true; - break; - case 'a': - if (key.isLetter() || key == blank) - return true; - break; - case 'N': - if (key.isLetterOrNumber()) - return true; - break; - case 'n': - if (key.isLetterOrNumber() || key == blank) - return true; - break; - case 'X': - if (key.isPrint()) - return true; - break; - case 'x': - if (key.isPrint() || key == blank) - return true; - break; - case '9': - if (key.isNumber()) - return true; - break; - case '0': - if (key.isNumber() || key == blank) - return true; - break; - case 'D': - if (key.isNumber() && key.digitValue() > 0) - return true; - break; - case 'd': - if ((key.isNumber() && key.digitValue() > 0) || key == blank) - return true; - break; - case '#': - if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == blank) - return true; break; - case 'B': - if (key == QLatin1Char('0') || key == QLatin1Char('1')) - return true; + case QEvent::FontChange: + d->control->setFont(font()); break; - case 'b': - if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == blank) - return true; + case QEvent::StyleChange: + d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + update(); break; - case 'H': - if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F'))) - return true; - break; - case 'h': - if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == blank) - return true; + case QEvent::LayoutDirectionChange: + d->control->setLayoutDirection(layoutDirection()); break; default: break; } - return false; -} - -bool QLineEditPrivate::hasAcceptableInput(const QString &str) const -{ -#ifndef QT_NO_VALIDATOR - QString textCopy = str; - int cursorCopy = cursor; - if (validator && validator->validate(textCopy, cursorCopy) - != QValidator::Acceptable) - return false; -#endif - - if (!maskData) - return true; - - if (str.length() != maxLength) - return false; - - for (int i=0; i < maxLength; ++i) { - if (maskData[i].separator) { - if (str.at(i) != maskData[i].maskChar) - return false; - } else { - if (!isValidInput(str.at(i), maskData[i].maskChar)) - return false; - } - } - return true; -} - -/* - Applies the inputMask on \a str starting from position \a pos in the mask. \a clear - specifies from where characters should be gotten when a separator is met in \a str - true means - that blanks will be used, false that previous input is used. - Calling this when no inputMask is set is undefined. -*/ -QString QLineEditPrivate::maskString(uint pos, const QString &str, bool clear) const -{ - if (pos >= (uint)maxLength) - return QString::fromLatin1(""); - - QString fill; - fill = clear ? clearString(0, maxLength) : text; - - int strIndex = 0; - QString s = QString::fromLatin1(""); - int i = pos; - while (i < maxLength) { - if (strIndex < str.length()) { - if (maskData[i].separator) { - s += maskData[i].maskChar; - if (str[(int)strIndex] == maskData[i].maskChar) - strIndex++; - ++i; - } else { - if (isValidInput(str[(int)strIndex], maskData[i].maskChar)) { - switch (maskData[i].caseMode) { - case MaskInputData::Upper: - s += str[(int)strIndex].toUpper(); - break; - case MaskInputData::Lower: - s += str[(int)strIndex].toLower(); - break; - default: - s += str[(int)strIndex]; - } - ++i; - } else { - // search for separator first - int n = findInMask(i, true, true, str[(int)strIndex]); - if (n != -1) { - if (str.length() != 1 || i == 0 || (i > 0 && (!maskData[i-1].separator || maskData[i-1].maskChar != str[(int)strIndex]))) { - s += fill.mid(i, n-i+1); - i = n + 1; // update i to find + 1 - } - } else { - // search for valid blank if not - n = findInMask(i, true, false, str[(int)strIndex]); - if (n != -1) { - s += fill.mid(i, n-i); - switch (maskData[n].caseMode) { - case MaskInputData::Upper: - s += str[(int)strIndex].toUpper(); - break; - case MaskInputData::Lower: - s += str[(int)strIndex].toLower(); - break; - default: - s += str[(int)strIndex]; - } - i = n + 1; // updates i to find + 1 - } - } - } - strIndex++; - } - } else - break; - } - - return s; -} - - - -/* - Returns a "cleared" string with only separators and blank chars. - Calling this when no inputMask is set is undefined. -*/ -QString QLineEditPrivate::clearString(uint pos, uint len) const -{ - if (pos >= (uint)maxLength) - return QString(); - - QString s; - int end = qMin((uint)maxLength, pos + len); - for (int i=pos; i= maxLength || pos < 0) - return -1; - - int end = forward ? maxLength : -1; - int step = forward ? 1 : -1; - int i = pos; - - while (i != end) { - if (findSeparator) { - if (maskData[i].separator && maskData[i].maskChar == searchChar) - return i; - } else { - if (!maskData[i].separator) { - if (searchChar.isNull()) - return i; - else if (isValidInput(searchChar, maskData[i].maskChar)) - return i; - } - } - i += step; - } - return -1; -} - -void QLineEditPrivate::undo(int until) -{ - if (!isUndoAvailable()) - return; - deselect(); - while (undoState && undoState > until) { - Command& cmd = history[--undoState]; - switch (cmd.type) { - case Insert: - text.remove(cmd.pos, 1); - cursor = cmd.pos; - break; - case SetSelection: - selstart = cmd.selStart; - selend = cmd.selEnd; - cursor = cmd.pos; - break; - case Remove: - case RemoveSelection: - text.insert(cmd.pos, cmd.uc); - cursor = cmd.pos + 1; - break; - case Delete: - case DeleteSelection: - text.insert(cmd.pos, cmd.uc); - cursor = cmd.pos; - break; - case Separator: - continue; - } - if (until < 0 && undoState) { - Command& next = history[undoState-1]; - if (next.type != cmd.type && next.type < RemoveSelection - && (cmd.type < RemoveSelection || next.type == Separator)) - break; - } - } - textDirty = true; - emitCursorPositionChanged(); -} - -void QLineEditPrivate::redo() { - if (!isRedoAvailable()) - return; - deselect(); - while (undoState < (int)history.size()) { - Command& cmd = history[undoState++]; - switch (cmd.type) { - case Insert: - text.insert(cmd.pos, cmd.uc); - cursor = cmd.pos + 1; - break; - case SetSelection: - selstart = cmd.selStart; - selend = cmd.selEnd; - cursor = cmd.pos; - break; - case Remove: - case Delete: - case RemoveSelection: - case DeleteSelection: - text.remove(cmd.pos, 1); - selstart = cmd.selStart; - selend = cmd.selEnd; - cursor = cmd.pos; - break; - case Separator: - selstart = cmd.selStart; - selend = cmd.selEnd; - cursor = cmd.pos; - break; - } - if (undoState < (int)history.size()) { - Command& next = history[undoState]; - if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator - && (next.type < RemoveSelection || cmd.type == Separator)) - break; - } - } - textDirty = true; - emitCursorPositionChanged(); + QWidget::changeEvent(ev); } /*! diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index a97dc9a..daac6a7 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -268,6 +268,8 @@ private: Q_DECLARE_PRIVATE(QLineEdit) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) + Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) #ifndef QT_NO_COMPLETER Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString)) #endif diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp new file mode 100644 index 0000000..0e39304 --- /dev/null +++ b/src/gui/widgets/qlineedit_p.cpp @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qlineedit.h" +#include "qlineedit_p.h" + +#ifndef QT_NO_LINEEDIT + +#include "qabstractitemview.h" +#include "qclipboard.h" +#ifndef QT_NO_ACCESSIBILITY +#include "qaccessible.h" +#endif +#ifndef QT_NO_IM +#include "qinputcontext.h" +#include "qlist.h" +#endif + +QT_BEGIN_NAMESPACE + +const int QLineEditPrivate::verticalMargin(1); +const int QLineEditPrivate::horizontalMargin(2); + +int QLineEditPrivate::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const +{ + QRect cr = adjustedContentsRect(); + x-= cr.x() - hscroll + horizontalMargin; + return control->xToPos(x, betweenOrOn); +} + +QRect QLineEditPrivate::cursorRect() const +{ + QRect cr = adjustedContentsRect(); + int cix = cr.x() - hscroll + horizontalMargin; + QRect crect = control->cursorRect(); + crect.moveTo(crect.topLeft() + QPoint(cix, vscroll)); + return crect; +} + +#ifndef QT_NO_COMPLETER + +void QLineEditPrivate::_q_completionHighlighted(QString newText) +{ + Q_Q(QLineEdit); + if (control->completer()->completionMode() != QCompleter::InlineCompletion) { + q->setText(newText); + } else { + int c = control->cursor(); + QString text = control->text(); + q->setText(text.left(c) + newText.mid(c)); + control->moveCursor(control->end(), false); + control->moveCursor(c, true); + } +} + +#endif // QT_NO_COMPLETER + +void QLineEditPrivate::_q_clipboardChanged() +{ +} + +void QLineEditPrivate::_q_handleWindowActivate() +{ + Q_Q(QLineEdit); + if (!q->hasFocus() && control->hasSelectedText()) + control->deselect(); +} + +void QLineEditPrivate::_q_deleteSelected() +{ +} + +void QLineEditPrivate::_q_textEdited(const QString &text) +{ + Q_Q(QLineEdit); +#ifndef QT_NO_COMPLETER + if (control->completer() && + control->completer()->completionMode() != QCompleter::InlineCompletion) + control->complete(-1); // update the popup on cut/paste/del +#endif + emit q->textEdited(text); +} + +void QLineEditPrivate::_q_cursorPositionChanged(int from, int to) +{ + Q_Q(QLineEdit); + q->update(); + emit q->cursorPositionChanged(from, to); +} + +void QLineEditPrivate::init(const QString& txt) +{ + Q_Q(QLineEdit); + control = new QLineControl(txt); + QObject::connect(control, SIGNAL(textChanged(const QString &)), + q, SIGNAL(textChanged(const QString &))); + QObject::connect(control, SIGNAL(textEdited(const QString &)), + q, SLOT(_q_textEdited(const QString &))); + QObject::connect(control, SIGNAL(cursorPositionChanged(int, int)), + q, SLOT(_q_cursorPositionChanged(int, int))); + QObject::connect(control, SIGNAL(selectionChanged()), + q, SIGNAL(selectionChanged())); + QObject::connect(control, SIGNAL(accepted()), + q, SIGNAL(returnPressed())); + QObject::connect(control, SIGNAL(editingFinished()), + q, SIGNAL(editingFinished())); + + // for now, going completely overboard with updates. + QObject::connect(control, SIGNAL(selectionChanged()), + q, SLOT(update())); + + QObject::connect(control, SIGNAL(displayTextChanged(const QString &)), + q, SLOT(update())); + control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); +#ifndef QT_NO_CURSOR + q->setCursor(Qt::IBeamCursor); +#endif + q->setFocusPolicy(Qt::StrongFocus); + q->setAttribute(Qt::WA_InputMethodEnabled); + // Specifies that this widget can use more, but is able to survive on + // less, horizontal space; and is fixed vertically. + q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::LineEdit)); + q->setBackgroundRole(QPalette::Base); + q->setAttribute(Qt::WA_KeyCompression); + q->setMouseTracking(true); + q->setAcceptDrops(true); + + q->setAttribute(Qt::WA_MacShowFocusRect); +} + +QRect QLineEditPrivate::adjustedContentsRect() const +{ + Q_Q(const QLineEdit); + QStyleOptionFrameV2 opt; + q->initStyleOption(&opt); + QRect r = q->style()->subElementRect(QStyle::SE_LineEditContents, &opt, q); + r.setX(r.x() + leftTextMargin); + r.setY(r.y() + topTextMargin); + r.setRight(r.right() - rightTextMargin); + r.setBottom(r.bottom() - bottomTextMargin); + return r; +} + +void QLineEditPrivate::setCursorVisible(bool visible) +{ + Q_Q(QLineEdit); + if ((bool)cursorVisible == visible) + return; + cursorVisible = visible; + QRect r = cursorRect(); + if (control->inputMask().isEmpty()) + q->update(r); + else + q->update(); +} + +void QLineEditPrivate::updatePasswordEchoEditing(bool editing) +{ + Q_Q(QLineEdit); + control->updatePasswordEchoEditing(editing); + q->setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod()); +} + +/*! + This function is not intended as polymorphic usage. Just a shared code + fragment that calls QInputContext::mouseHandler for this + class. +*/ +bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e ) +{ +#if !defined QT_NO_IM + Q_Q(QLineEdit); + if ( control->composeMode() ) { + int tmp_cursor = xToPos(e->pos().x()); + int mousePos = tmp_cursor - control->cursor(); + if ( mousePos < 0 || mousePos > control->preeditAreaText().length() ) { + mousePos = -1; + // don't send move events outside the preedit area + if ( e->type() == QEvent::MouseMove ) + return true; + } + + QInputContext *qic = q->inputContext(); + if ( qic ) + // may be causing reset() in some input methods + qic->mouseHandler(mousePos, e); + if (!control->preeditAreaText().isEmpty()) + return true; + } +#else + Q_UNUSED(e); +#endif + + return false; +} + +#ifndef QT_NO_DRAGANDDROP +void QLineEditPrivate::drag() +{ + Q_Q(QLineEdit); + dndTimer.stop(); + QMimeData *data = new QMimeData; + data->setText(control->selectedText()); + QDrag *drag = new QDrag(q); + drag->setMimeData(data); + Qt::DropAction action = drag->start(); + if (action == Qt::MoveAction && !control->isReadOnly() && drag->target() != q) + control->removeSelection(); +} + +#endif // QT_NO_DRAGANDDROP + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 7a4ff26..c6d7496 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -65,6 +65,8 @@ #include "QtCore/qpointer.h" #include "QtGui/qlineedit.h" +#include "private/qlinecontrol_p.h" + QT_BEGIN_NAMESPACE class QLineEditPrivate : public QWidgetPrivate @@ -73,168 +75,66 @@ class QLineEditPrivate : public QWidgetPrivate public: QLineEditPrivate() - : cursor(0), preeditCursor(0), cursorTimer(0), frame(1), - cursorVisible(0), hideCursor(false), separator(0), readOnly(0), - dragEnabled(0), contextMenuEnabled(1), echoMode(0), textDirty(0), - selDirty(0), validInput(1), alignment(Qt::AlignLeading | Qt::AlignVCenter), ascent(0), - maxLength(32767), hscroll(0), vscroll(0), lastCursorPos(-1), maskData(0), - modifiedState(0), undoState(0), selstart(0), selend(0), userInput(false), - emitingEditingFinished(false), passwordEchoEditing(false) -#ifndef QT_NO_COMPLETER - , completer(0) -#endif - , leftTextMargin(0), topTextMargin(0), rightTextMargin(0), bottomTextMargin(0) - { - } + : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0), + dragEnabled(0), hscroll(0), vscroll(0), + alignment(Qt::AlignLeading | Qt::AlignVCenter), + leftTextMargin(0), topTextMargin(0), rightTextMargin(0), bottomTextMargin(0) + { + } ~QLineEditPrivate() { - delete [] maskData; } + + QLineControl *control; + +#ifndef QT_NO_CONTEXTMENU + QPointer selectAllAction; +#endif void init(const QString&); - QString text; - int cursor; - int preeditCursor; - int cursorTimer; // -1 for non blinking cursor. + int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; + QRect cursorRect() const; + void setCursorVisible(bool visible); + + void updatePasswordEchoEditing(bool); + + inline bool shouldEnableInputMethod() const + { + return !control->isReadOnly() && (control->echoMode() == QLineEdit::Normal || control->echoMode() == QLineEdit::PasswordEchoOnEdit); + } + QPoint tripleClick; QBasicTimer tripleClickTimer; uint frame : 1; + uint contextMenuEnabled : 1; uint cursorVisible : 1; - uint hideCursor : 1; // used to hide the cursor inside preedit areas - uint separator : 1; - uint readOnly : 1; uint dragEnabled : 1; - uint contextMenuEnabled : 1; - uint echoMode : 2; - uint textDirty : 1; - uint selDirty : 1; - uint validInput : 1; - uint alignment; - int ascent; - int maxLength; int hscroll; int vscroll; - int lastCursorPos; - -#ifndef QT_NO_CONTEXTMENU - QPointer selectAllAction; -#endif + uint alignment; + static const int verticalMargin; + static const int horizontalMargin; - inline void emitCursorPositionChanged(); bool sendMouseEventToInputContext(QMouseEvent *e); - void finishChange(int validateFromState = -1, bool update = false, bool edited = true); - - QPointer validator; - struct MaskInputData { - enum Casemode { NoCaseMode, Upper, Lower }; - QChar maskChar; // either the separator char or the inputmask - bool separator; - Casemode caseMode; - }; - QString inputMask; - QChar blank; - MaskInputData *maskData; - inline int nextMaskBlank(int pos) { - int c = findInMask(pos, true, false); - separator |= (c != pos); - return (c != -1 ? c : maxLength); - } - inline int prevMaskBlank(int pos) { - int c = findInMask(pos, false, false); - separator |= (c != pos); - return (c != -1 ? c : 0); - } - - void setCursorVisible(bool visible); + QRect adjustedContentsRect() const; + void _q_clipboardChanged(); + void _q_handleWindowActivate(); + void _q_deleteSelected(); + void _q_textEdited(const QString &); + void _q_cursorPositionChanged(int, int); - // undo/redo handling - enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection, SetSelection }; - struct Command { - inline Command() {} - inline Command(CommandType t, int p, QChar c, int ss, int se) : type(t),uc(c),pos(p),selStart(ss),selEnd(se) {} - uint type : 4; - QChar uc; - int pos, selStart, selEnd; - }; - int modifiedState; - int undoState; - QVector history; - void addCommand(const Command& cmd); - void insert(const QString& s); - void del(bool wasBackspace = false); - void remove(int pos); - - inline void separate() { separator = true; } - void undo(int until = -1); - void redo(); - inline bool isUndoAvailable() const { return !readOnly && undoState; } - inline bool isRedoAvailable() const { return !readOnly && undoState < (int)history.size(); } - - // selection - int selstart, selend; - inline bool allSelected() const { return !text.isEmpty() && selstart == 0 && selend == (int)text.length(); } - inline bool hasSelectedText() const { return !text.isEmpty() && selend > selstart; } - inline void deselect() { selDirty |= (selend > selstart); selstart = selend = 0; } - void removeSelectedText(); -#ifndef QT_NO_CLIPBOARD - void copy(bool clipboard = true) const; +#ifndef QT_NO_COMPLETER + void _q_completionHighlighted(QString); #endif - inline bool inSelection(int x) const - { if (selstart >= selend) return false; - int pos = xToPos(x, QTextLine::CursorOnCharacter); return pos >= selstart && pos < selend; } - - // masking - void parseInputMask(const QString &maskFields); - bool isValidInput(QChar key, QChar mask) const; - bool hasAcceptableInput(const QString &text) const; - QString maskString(uint pos, const QString &str, bool clear = false) const; - QString clearString(uint pos, uint len) const; - QString stripString(const QString &str) const; - int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const; - - // input methods - bool composeMode() const { return !textLayout.preeditAreaText().isEmpty(); } - - // complex text layout - QTextLayout textLayout; - void updateTextLayout(); - void moveCursor(int pos, bool mark = false); - void setText(const QString& txt, int pos = -1, bool edited = true); - int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; - QRect cursorRect() const; - bool fixup(); - - QRect adjustedContentsRect() const; - #ifndef QT_NO_DRAGANDDROP - // drag and drop QPoint dndPos; QBasicTimer dndTimer; void drag(); #endif - void _q_handleWindowActivate(); - void _q_deleteSelected(); - bool userInput; - bool emitingEditingFinished; - -#ifdef QT_KEYPAD_NAVIGATION - QBasicTimer deleteAllTimer; // keypad navigation - QString origText; -#endif - - bool passwordEchoEditing; - void updatePasswordEchoEditing(bool editing); - -#ifndef QT_NO_COMPLETER - QPointer completer; - void complete(int key = -1); - void _q_completionHighlighted(QString); - bool advanceToEnabledItem(int n); -#endif int leftTextMargin; int topTextMargin; diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index ce78959..5ddc44e 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -61,7 +61,7 @@ class Q_GUI_EXPORT QValidator : public QObject { Q_OBJECT public: - explicit QValidator(QObject * parent); + explicit QValidator(QObject * parent=0); ~QValidator(); enum State { @@ -100,7 +100,7 @@ class Q_GUI_EXPORT QIntValidator : public QValidator Q_PROPERTY(int top READ top WRITE setTop) public: - explicit QIntValidator(QObject * parent); + explicit QIntValidator(QObject * parent=0); QIntValidator(int bottom, int top, QObject * parent); ~QIntValidator(); @@ -120,7 +120,7 @@ public: #endif private: - Q_DISABLE_COPY(QIntValidator) + /*Q_DISABLE_COPY(QIntValidator)*/ int b; int t; diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri index 2d809a1..8f24fac 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/gui/widgets/widgets.pri @@ -30,6 +30,7 @@ HEADERS += \ widgets/qlcdnumber.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ + widgets/qlinecontrol_p.h \ widgets/qmainwindow.h \ widgets/qmainwindowlayout_p.h \ widgets/qmdiarea.h \ @@ -101,7 +102,9 @@ SOURCES += \ widgets/qgroupbox.cpp \ widgets/qlabel.cpp \ widgets/qlcdnumber.cpp \ + widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ + widgets/qlinecontrol.cpp \ widgets/qmainwindow.cpp \ widgets/qmainwindowlayout.cpp \ widgets/qmdiarea.cpp \ -- cgit v0.12 From 043a9b2eb3dd346126cf13817b67ed0790a72f7a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Jul 2009 17:45:56 +1000 Subject: Manually integrate 099a32d121 to QLineControl This change to QLineEdit didn't merge, as it needs to be applied to QLineControl in this case. --- src/gui/widgets/qlinecontrol.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index b762a00..08574b5 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1685,7 +1685,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event) if (unknown && !isReadOnly()) { QString t = event->text(); - if (!t.isEmpty() && t.at(0).isPrint()) { + if (!t.isEmpty() && t.at(0).isPrint() && + ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) { insert(t); #ifndef QT_NO_COMPLETER complete(event->key()); -- cgit v0.12 From 96d3be9039baaebc64f5de5d6917dd56d7ed192b Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Jul 2009 18:13:18 +1000 Subject: Finish remaining TODOs for QLineControl Didn't notice there were still some TODO markers left. They have now all been done. --- src/gui/widgets/qlinecontrol.cpp | 16 +++++++--------- src/gui/widgets/qlinecontrol_p.h | 14 ++++++++++++++ src/gui/widgets/qlineedit.cpp | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 08574b5..fc0a173 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1232,7 +1232,6 @@ bool QLineControl::processEvent(QEvent* ev) return true; } } - //TODO: Needs a call to processKeyEvent? } else if (e->type() == QEvent::EnterEditFocus) { end(false); int cft = QApplication::cursorFlashTime(); @@ -1450,11 +1449,10 @@ void QLineControl::processKeyEvent(QKeyEvent* event) // ### resets current content. dubious code; you can // navigate with keys up, down, back, and select(?), but if you press // "left" or "right" it clears? - updatePasswordEchoEditing(true);//TODO: used to set a WA too + updatePasswordEchoEditing(true); clear(); } - //setCursorVisible(true);TODO: Who handles this? if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput() || fixup()) { emit accepted(); @@ -1652,19 +1650,19 @@ void QLineControl::processKeyEvent(QKeyEvent* event) #endif } break; -#ifdef QT_KEYPAD_NAVIGATION//TODO: This section +#ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Back: if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() && !isReadOnly()) { if (text().length() == 0) { - setText(d->origText); + setText(m_cancelText); - if (d->passwordEchoEditing) - d->updatePasswordEchoEditing(false); + if (passwordEchoEditing) + updatePasswordEchoEditing(false); setEditFocus(false); - } else if (!d->deleteAllTimer.isActive()) { - d->deleteAllTimer.start(750, this); + } else if (!deleteAllTimer) { + deleteAllTimer = startTimer(750); } } else { unknown = true; diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index bb27778..600206d 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -217,6 +217,9 @@ public: int cursorBlinkPeriod() const; void setCursorBlinkPeriod(int msec); + QString cancelText() const; + void setCancelText(QString); + enum DrawFlags { DrawText = 0x01, DrawSelections = 0x02, @@ -265,6 +268,7 @@ private: QList transactions; QPoint m_tripleClick; int m_tripleClickTimer; + QString m_cancelText; void emitCursorPositionChanged(); @@ -706,6 +710,16 @@ inline int QLineControl::cursorBlinkPeriod() const return m_blinkPeriod; } +QString QLineControl::cancelText() const +{ + return m_cancelText; +} + +void QLineControl::setCancelText(QString s) +{ + m_cancelText = s; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index baaad32..7fdda6c 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1663,7 +1663,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) qt_mac_secure_keyboard(true); #endif #ifdef QT_KEYPAD_NAVIGATION - d->origText = d->text; + d->control->setCancelText(d->text); #endif #ifndef QT_NO_COMPLETER if (d->control->completer()) { @@ -1718,7 +1718,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) qt_mac_secure_keyboard(false); #endif #ifdef QT_KEYPAD_NAVIGATION - d->origText = QString(); + d->control->setCancelText(QString()); #endif #ifndef QT_NO_COMPLETER if (d->control->completer()) { -- cgit v0.12 From fe6ca9332cf4516c84d9a1b8ca9ea2846458f98f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Jul 2009 18:28:54 +1000 Subject: Forgot to bring in the change to QAbstractSpinBox QAbstractSpinBox had some code using QLineEdit internals, this had to be move to use QLineControl as well. This commit also includes fixing some typos in my last commit. --- src/gui/widgets/qabstractspinbox.cpp | 2 +- src/gui/widgets/qlinecontrol_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 25acd6e..1d62ab4 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -970,7 +970,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) #endif case Qt::Key_Enter: case Qt::Key_Return: - d->edit->d_func()->modifiedState = d->edit->d_func()->undoState = 0; + d->edit->d_func()->control->clearUndo(); d->interpret(d->keyboardTracking ? AlwaysEmit : EmitIfChanged); selectAll(); event->ignore(); diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 600206d..4ecedcd 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -710,12 +710,12 @@ inline int QLineControl::cursorBlinkPeriod() const return m_blinkPeriod; } -QString QLineControl::cancelText() const +inline QString QLineControl::cancelText() const { return m_cancelText; } -void QLineControl::setCancelText(QString s) +inline void QLineControl::setCancelText(QString s) { m_cancelText = s; } -- cgit v0.12 From 3528101647e7320d07623e659138005d7d603980 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 8 Jul 2009 15:54:33 +1000 Subject: Fixed one of the QT3_SUPPORT constructors. It was accidentally left commented out instead of working with QLineControl. --- src/gui/widgets/qlineedit.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 7fdda6c..8e7fdec 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -341,14 +341,9 @@ QLineEdit::QLineEdit(const QString& contents, const QString &inputMask, QWidget* { Q_D(QLineEdit); setObjectName(QString::fromAscii(name)); - //d->control->parseInputMask(inputMask); - //if (d->control->maskData) { - // QString ms = d->control->maskString(0, contents); - // d->init(ms + d->control->clearString(ms.length(), d->control->maxLength() - ms.length())); - // d->control->moveCursor(d->control->nextMaskBlank(ms.length())); - // } else { - d->init(contents); - // } + d->init(contents); + d->control->setInputMask(inputMask); + d->control->moveCursor(d->control->nextMaskBlank(contents.length())); } #endif -- cgit v0.12 From 5ed43fa92a0110dce36a38853932187287a153b6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Jul 2009 18:26:07 +0200 Subject: Doc: Added information about newer Visual Studio libraries. Reviewed-by: Trust Me As-seen-on: #pyqt (freenode.net) --- doc/src/deployment.qdoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index 0866930..1da2c06 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -715,17 +715,19 @@ \table 100% \header - \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005) + \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005) \o VC++ 9.0 (2008) \row \o The C run-time \o \c msvcrt.dll \o \c msvcr71.dll \o \c msvcr80.dll + \o \c msvcr90.dll \row \o The C++ run-time \o \c msvcp60.dll \o \c msvcp71.dll \o \c msvcp80.dll + \o \c msvcp90.dll \endtable To verify that the application now can be successfully deployed, @@ -893,7 +895,7 @@ \o \l{qt-conf.html}{Using \c qt.conf}. This approach is the recommended if you have executables in different places sharing the same plugins. - + \o Using QApplication::addLibraryPath() or QApplication::setLibraryPaths(). This approach is recommended if you only have one executable that will use the plugin. @@ -902,10 +904,10 @@ hard-coded paths in the QtCore library. \endlist - + If you add a custom path using QApplication::addLibraryPath it could look like this: - + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 54 Then qApp->libraryPaths() would return something like this: -- cgit v0.12 From e6897a209981d86db3b8bc21944bbbb7a10490a6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Jul 2009 18:27:27 +0200 Subject: Doc: Post review fixes to the SQL data types table. Reviewed-by: Trust Me --- doc/src/qsqldatatype-table.qdoc | 123 ++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/doc/src/qsqldatatype-table.qdoc b/doc/src/qsqldatatype-table.qdoc index 5ab6413..567bb65 100644 --- a/doc/src/qsqldatatype-table.qdoc +++ b/doc/src/qsqldatatype-table.qdoc @@ -40,30 +40,28 @@ ****************************************************************************/ /*! - \module QtSql - - \page qsqldatatype-table.html - - \title QtSql Module - Recommended use of data types + \page sql-types.html + \title QtSql Module - Recommended Use of Data Types - \section1 Recommended use of types and widgets in Qt supported Databases + \section1 Recommended Use of Types in Qt Supported Databases This table shows the recommended data types used when extracting data from the databases supported in Qt. It is important to note that the - types used in Qt not necessary are valid as input to the specific - database. One example could be that a double would work perfect as - input for floating point records in a database, but not necessary - as output to the database since it would be stored with 64-bit in C++. + types used in Qt are not necessarily valid as input to the specific + database. One example could be that a double would work perfectly as + input for floating point records in a database, but not necessarily + as a storage format for output from the database since it would be stored + with 64-bit precision in C++. \tableofcontents - \section2 IBM DB2 data type + \section2 IBM DB2 Data Types - \table - \row - \header IBM DB2 data type - \header SQL Type Description - \header Recommended input (C++ data type and Qt ) + \table 90% + \header + \o IBM DB2 data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o SMALLINT \o 16-bit signed integer @@ -124,13 +122,13 @@ \o Mapped to QDateTime \endtable - \section2 Borland InterBase data type + \section2 Borland InterBase Data Types - \table - \row - \header Borland InterBase data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Borland InterBase data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BOOLEAN \o Boolean @@ -189,13 +187,13 @@ \o Mapped to QDateTime \endtable - \section2 MySQL data type + \section2 MySQL Data Types - \table - \row - \header MySQL data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o MySQL data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o TINYINT \o 8 bit signed integer @@ -290,13 +288,13 @@ \o Mapped to QString \endtable - \section2 Oracle Call Interface data type + \section2 Oracle Call Interface Data Types - \table - \row - \header Oracle Call Interface data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Oracle Call Interface data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o NUMBER \o FLOAT, DOUBLE, PRECISIONc REAL @@ -338,13 +336,13 @@ \o Mapped to QDateTime \endtable - \section2 ODBC data type + \section2 ODBC Data Types - \table - \row - \header ODBC data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o ODBC data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BIT \o Boolean @@ -407,13 +405,13 @@ \o Mapped to QDateTime \endtable - \section2 PostgreSQL data type + \section2 PostgreSQL Data Types - \table - \row - \header PostgreSQL data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o PostgreSQL data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BOOLEAN \o Boolean @@ -484,13 +482,13 @@ \o Mapped to QDateTime \endtable - \section2 QSQLITE SQLite version 3 data type + \section2 QSQLITE SQLite version 3 Data Types - \table - \row - \header QSQLITE SQLite version 3 data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o QSQLITE SQLite version 3 data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o NULL \o NULL value. @@ -518,13 +516,13 @@ \o Mapped to QByteArray \endtable - \section2 Sybase Adaptive Server data type + \section2 Sybase Adaptive Server Data Types - \table - \row - \header Sybase Adaptive Server data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Sybase Adaptive Server data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BINARY \o Describes a fixed-length binary value up to 255 bytes in size. @@ -535,8 +533,7 @@ \o Mapped to QString \row \o DATETIME - \o Date and time. Range: 1753-01-01 00:00:00 through - 9999-12-31 23:59:59. + \o Date and time. Range: 1753-01-01 00:00:00 through 9999-12-31 23:59:59. \o Mapped to QDateTime \row \o NCHAR @@ -577,8 +574,8 @@ \endtable \section2 SQLite Version 2 - SQLite V.2 is "typeless". This means that you can store any kind of - data you want in any column of any table, regardless of the declared - data type of that column. We recommend that you map the data to QString. + SQLite version 2 is "typeless". This means that you can store any kind of + data you want in any column of any table, regardless of the declared + data type of that column. We recommend that you map the data to QString. */ -- cgit v0.12 From 53228e1b1993524fb1422a8363647b468b3c7c8d Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 9 Jul 2009 09:41:21 +1000 Subject: Hopefully fix isnan/isinf for good (for all platforms) --- src/sql/drivers/psql/qsql_psql.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 33f2e2b..4eccf4b 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -59,21 +59,29 @@ #include #include -#if defined(_MSC_VER) -#include -#define isnan(x) _isnan(x) -int isinf(double x) -{ - if(_fpclass(x) == _FPCLASS_NINF) - return -1; - else if(_fpclass(x) == _FPCLASS_PINF) - return 1; - else return 0; -} -#else #include +// below code taken from an example at http://www.gnu.org/software/hello/manual/autoconf/Function-Portability.html +#ifndef isnan + # define isnan(x) \ + (sizeof (x) == sizeof (long double) ? isnan_ld (x) \ + : sizeof (x) == sizeof (double) ? isnan_d (x) \ + : isnan_f (x)) + static inline int isnan_f (float x) { return x != x; } + static inline int isnan_d (double x) { return x != x; } + static inline int isnan_ld (long double x) { return x != x; } #endif +#ifndef isinf + # define isinf(x) \ + (sizeof (x) == sizeof (long double) ? isinf_ld (x) \ + : sizeof (x) == sizeof (double) ? isinf_d (x) \ + : isinf_f (x)) + static inline int isinf_f (float x) { return isnan (x - x); } + static inline int isinf_d (double x) { return isnan (x - x); } + static inline int isinf_ld (long double x) { return isnan (x - x); } +#endif + + // workaround for postgres defining their OIDs in a private header file #define QBOOLOID 16 #define QINT8OID 20 -- cgit v0.12 From b9fc86cd9f51c80a1103e5e896940b49bf552b07 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 9 Jul 2009 09:47:18 +1000 Subject: Accidental Behavioural changes have been identified and rectified. createStandardContextMenu should still only cut/copy in normal echo mode and the Qt3Support function validateAndSet will again only set if it is validated. --- src/gui/widgets/qlineedit.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 8e7fdec..2d6ef03 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -692,9 +692,14 @@ int QLineEdit::cursorPositionAt(const QPoint &pos) bool QLineEdit::validateAndSet(const QString &newText, int newPos, int newMarkAnchor, int newMarkDrag) { - // Note, this doesn't validate', but then neither - // does the suggested functions above in the docs. + // The suggested functions above in the docs don't seem to validate, + // below code tries to mimic previous behaviour. + QString oldText = text(); setText(newText); + if(!hasAcceptableInput()){ + setText(oldText); + return false; + } setCursorPosition(newPos); setSelection(qMin(newMarkAnchor, newMarkDrag), qAbs(newMarkAnchor - newMarkDrag)); return true; @@ -1947,11 +1952,13 @@ QMenu *QLineEdit::createStandardContextMenu() #ifndef QT_NO_CLIPBOARD action = popup->addAction(QLineEdit::tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut)); - action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText()); + action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText() + && d->control->echoMode() == QLineEdit::Normal); connect(action, SIGNAL(triggered()), SLOT(cut())); action = popup->addAction(QLineEdit::tr("&Copy") + ACCEL_KEY(QKeySequence::Copy)); - action->setEnabled(d->control->hasSelectedText()); + action->setEnabled(d->control->hasSelectedText() + && d->control->echoMode() == QLineEdit::Normal); connect(action, SIGNAL(triggered()), SLOT(copy())); action = popup->addAction(QLineEdit::tr("&Paste") + ACCEL_KEY(QKeySequence::Paste)); -- cgit v0.12 From 99cda3446c6ff5c3da4fe8fb4bc8869497f8da8b Mon Sep 17 00:00:00 2001 From: Stian Sandvik Thomassen Date: Thu, 9 Jul 2009 13:26:18 +1000 Subject: Plugged possible memory leak in getPSQLVersion() Call PQclear() regardless of the status of the result returned by PQexec(). Reviewed-by: Bill King --- src/sql/drivers/psql/qsql_psql.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 4eccf4b..147cd6d 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -626,10 +626,9 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection) { QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6; PGresult* result = PQexec(connection, "select version()"); - int status = PQresultStatus(result); + int status = PQresultStatus(result); if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) { QString val = QString::fromAscii(PQgetvalue(result, 0, 0)); - PQclear(result); QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)")); rx.setMinimal(true); // enforce non-greedy RegExp if (rx.indexIn(val) != -1) { @@ -670,6 +669,7 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection) } } } + PQclear(result); if (serverVersion < QPSQLDriver::Version71) qWarning("This version of PostgreSQL is not supported and may not work."); -- cgit v0.12 From 5142a27c19fb01ec80010d2d1de12b0e3082751f Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 9 Jul 2009 13:58:28 +1000 Subject: emit dataChanged() signal Task-number:207874 --- src/sql/models/qsqltablemodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 1acc846..591b506 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -538,6 +538,7 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in isOk = updateRowInTable(index.row(), d->editBuffer); if (isOk) select(); + emit dataChanged(index, index); break; } case OnRowChange: if (index.row() == d->insertIndex) { -- cgit v0.12 From 13bc92c6c9c0b1b7b6c9915848175a77ec082a85 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 8 Jul 2009 16:02:55 -0700 Subject: Pass the device arg to the keyboard drivers. We didn't use to pass the device in to the keyboard handlers rendering them mostly useless. Reviewed-by: TrustMe --- src/plugins/kbddrivers/sl5000/main.cpp | 3 +-- src/plugins/kbddrivers/usb/main.cpp | 3 +-- src/plugins/kbddrivers/vr41xx/main.cpp | 3 +-- src/plugins/kbddrivers/yopy/main.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/kbddrivers/sl5000/main.cpp b/src/plugins/kbddrivers/sl5000/main.cpp index 4d61266..cc68747 100644 --- a/src/plugins/kbddrivers/sl5000/main.cpp +++ b/src/plugins/kbddrivers/sl5000/main.cpp @@ -66,10 +66,9 @@ QStringList QSL5000KbdDriver::keys() const QWSKeyboardHandler* QSL5000KbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("SL5000"), Qt::CaseInsensitive)) return 0; - return new QWSSL5000KeyboardHandler(driver); + return new QWSSL5000KeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwssl5000kbddriver, QSL5000KbdDriver) diff --git a/src/plugins/kbddrivers/usb/main.cpp b/src/plugins/kbddrivers/usb/main.cpp index 8f49366..38d460c 100644 --- a/src/plugins/kbddrivers/usb/main.cpp +++ b/src/plugins/kbddrivers/usb/main.cpp @@ -66,10 +66,9 @@ QStringList QUsbKbdDriver::keys() const QWSKeyboardHandler* QUsbKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("Usb"), Qt::CaseInsensitive)) return 0; - return new QWSUsbKeyboardHandler(driver); + return new QWSUsbKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsusbkbddriver, QUsbKbdDriver) diff --git a/src/plugins/kbddrivers/vr41xx/main.cpp b/src/plugins/kbddrivers/vr41xx/main.cpp index 2cba1f7..c9ba4d7 100644 --- a/src/plugins/kbddrivers/vr41xx/main.cpp +++ b/src/plugins/kbddrivers/vr41xx/main.cpp @@ -66,10 +66,9 @@ QStringList QVr41xxKbdDriver::keys() const QWSKeyboardHandler* QVr41xxKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("VR41xx"), Qt::CaseInsensitive)) return 0; - return new QWSVr41xxKeyboardHandler(driver); + return new QWSVr41xxKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsvr41xxkbddriver, QVr41xxKbdDriver) diff --git a/src/plugins/kbddrivers/yopy/main.cpp b/src/plugins/kbddrivers/yopy/main.cpp index bfddabe..7079d88 100644 --- a/src/plugins/kbddrivers/yopy/main.cpp +++ b/src/plugins/kbddrivers/yopy/main.cpp @@ -66,10 +66,9 @@ QStringList QYopyKbdDriver::keys() const QWSKeyboardHandler* QYopyKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("Yopy"), Qt::CaseInsensitive)) return 0; - return new QWSYopyKeyboardHandler(driver); + return new QWSYopyKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsyopykbddriver, QYopyKbdDriver) -- cgit v0.12 From cdedc4374b02c0c291c110fd03c77eb6cd1ce69d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 2 Jul 2009 13:42:09 +0200 Subject: QNAM: httpDownloadPerformance auto test Reviewed-by: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 126 +++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 0dd3cd1..18919a7 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -219,6 +219,9 @@ private Q_SLOTS: void proxyChange(); void authorizationError_data(); void authorizationError(); + + void httpDownloadPerformance_data(); + void httpDownloadPerformance(); }; QT_BEGIN_NAMESPACE @@ -3066,5 +3069,128 @@ void tst_QNetworkReply::authorizationError() QCOMPARE(QString(reply->readAll()), httpBody); } +class HttpDownloadPerformanceClient : QObject { + Q_OBJECT; + QIODevice *device; + public: + HttpDownloadPerformanceClient (QIODevice *dev) : device(dev){ + connect(dev, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + } + + public slots: + void readyReadSlot() { + device->readAll(); + } + +}; + +class HttpDownloadPerformanceServer : QObject { + Q_OBJECT; + qint64 dataSize; + qint64 dataSent; + QTcpServer server; + QTcpSocket *client; + bool serverSendsContentLength; + bool chunkedEncoding; + +public: + HttpDownloadPerformanceServer (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0), + client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) { + server.listen(); + connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot())); + } + + int serverPort() { + return server.serverPort(); + } + +public slots: + + void newConnectionSlot() { + client = server.nextPendingConnection(); + client->setParent(this); + connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64))); + } + + void readyReadSlot() { + client->readAll(); + client->write("HTTP/1.0 200 OK\n"); + if (serverSendsContentLength) + client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); + if (chunkedEncoding) + client->write(QString("Transfer-Encoding: chunked\n").toAscii()); + client->write("Connection: close\n\n"); + } + + void bytesWrittenSlot(qint64 amount) { + if (dataSent == dataSize && client) { + // close eventually + + // chunked encoding: we have to send a last "empty" chunk + if (chunkedEncoding) + client->write(QString("0\r\n\r\n").toAscii()); + + client->disconnectFromHost(); + server.close(); + client = 0; + return; + } + + // send data + if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) { + qint64 amount = qMin(qint64(16*1024), dataSize - dataSent); + QByteArray data(amount, '@'); + + if (chunkedEncoding) { + client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); + client->write(data.constData(), amount); + client->write(QString("\r\n").toAscii()); + } else { + client->write(data.constData(), amount); + } + + dataSent += amount; + } + } +}; + +void tst_QNetworkReply::httpDownloadPerformance_data() +{ + QTest::addColumn("serverSendsContentLength"); + QTest::addColumn("chunkedEncoding"); + + QTest::newRow("Server sends no Content-Length") << false << false; + QTest::newRow("Server sends Content-Length") << true << false; + QTest::newRow("Server uses chunked encoding") << false << true; + +} + +void tst_QNetworkReply::httpDownloadPerformance() +{ + QFETCH(bool, serverSendsContentLength); + QFETCH(bool, chunkedEncoding); + + enum {UploadSize = 1000*1024*1024}; // 1000 MB + HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); + QNetworkReply* reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + HttpDownloadPerformanceClient client(reply); + + QTime time; + time.start(); + QTestEventLoop::instance().enterLoop(40); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qint64 elapsed = time.elapsed(); + qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; + + delete reply; +} + QTEST_MAIN(tst_QNetworkReply) #include "tst_qnetworkreply.moc" -- cgit v0.12 From d64754db278e9fe07dbd6c8b7d297600a10d3ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 8 Jul 2009 19:21:37 +0200 Subject: Stop showing then hiding windows on starting designer in top-level mode Kind of like f37bd111f7622a34b3a7bd63f5a82f6042dc0f0d, but the real thing. The widget box wasn't showing on Linux when switching to top-level mode. Incidentally, this was the main window there... Reviewed-by: Friedemann Kleint After some persuasion the Cat also came to see things this way. --- tools/designer/src/designer/qdesigner_workbench.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index ce8dde6..5f8d2a9 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -462,7 +462,6 @@ void QDesignerWorkbench::switchToTopLevelMode() // make sure that the widgetbox is visible if it is different from neutral. QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); Q_ASSERT(widgetBoxWrapper); - const bool needWidgetBoxWrapperVisible = widgetBoxWrapper->action()->isChecked(); switchToNeutralMode(); const QPoint desktopOffset = desktopGeometry().topLeft(); @@ -501,9 +500,6 @@ void QDesignerWorkbench::switchToTopLevelMode() found_visible_window |= tw->isVisible(); } - if (needWidgetBoxWrapperVisible) - widgetBoxWrapper->action()->trigger(); - if (!m_toolWindows.isEmpty() && !found_visible_window) m_toolWindows.first()->show(); -- cgit v0.12 From ed99255e8e998ef3f51de22b31c76107bb9aa0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 9 Jul 2009 10:55:37 +0200 Subject: Designer: Restore Widget box title when switching to docked mode Reviewed-by: Friedemann Kleint --- tools/designer/src/designer/qdesigner_workbench.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index 5f8d2a9..c9d9fc4 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -410,6 +410,12 @@ void QDesignerWorkbench::switchToDockedMode() switchToNeutralMode(); +#ifndef Q_WS_MAC + QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); + widgetBoxWrapper->action()->setVisible(true); + widgetBoxWrapper->setWindowTitle(tr("Widget Box")); +#endif + m_mode = DockedMode; const QDesignerSettings settings(m_core); m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows); -- cgit v0.12 From 61084f0e8dcbd9b7ecaa250c74cd53ba042210e1 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 10 Jul 2009 10:33:20 +1000 Subject: Fix some minor mistakes --- src/gui/widgets/qlineedit.cpp | 6 +++--- src/gui/widgets/qvalidator.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 2d6ef03..977d00c 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1409,7 +1409,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e) if (d->tripleClickTimer.isActive() && (e->pos() - d->tripleClick).manhattanLength() < QApplication::startDragDistance()) { selectAll(); - return; + return; } bool mark = e->modifiers() & Qt::ShiftModifier; int cursor = d->xToPos(e->pos().x()); @@ -1593,8 +1593,6 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) clear(); } - d->control->processInputMethodEvent(e); - #ifdef QT_KEYPAD_NAVIGATION // Focus in if currently in navigation focus on the widget // Only focus in on preedits, to allow input methods to @@ -1607,6 +1605,8 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) } #endif + d->control->processInputMethodEvent(e); + #ifndef QT_NO_COMPLETER if (!e->commitString().isEmpty()) d->control->complete(Qt::Key_unknown); diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index 5ddc44e..5c27d1d 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -120,7 +120,7 @@ public: #endif private: - /*Q_DISABLE_COPY(QIntValidator)*/ + Q_DISABLE_COPY(QIntValidator) int b; int t; -- cgit v0.12 From 5f798ce8208fd5b1f2212246bc6b8ee2ec4652f0 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 2 Jul 2009 18:16:42 -0700 Subject: Fix QDFBPaintEngine::drawTiledPixmap/fillRect Until this fix very few cases of drawTiledPixmap and fillRect(r, textureBrush) have been handled by DirectFB. This patch makes it possible to accelerate such operations. Reviewed-By: Donald --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 168 ++++++++++++++------- 1 file changed, 111 insertions(+), 57 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 947cc76..27df0da 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -241,7 +241,7 @@ public: void fillRects(const QRectF *rects, int count); void drawRects(const QRectF *rects, int count); - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap); + void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos); void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); inline void updateClip(); @@ -284,6 +284,7 @@ private: bool unsupportedCompositionMode; QDirectFBPaintEngine *q; + QRect currentClip; friend class QDirectFBPaintEngine; }; @@ -343,6 +344,7 @@ bool QDirectFBPaintEngine::end() #if (Q_DIRECTFB_VERSION >= 0x010000) d->surface->ReleaseSource(d->surface); #endif + d->currentClip = QRect(); d->surface->SetClip(d->surface, NULL); d->surface = 0; return QRasterPaintEngine::end(); @@ -613,30 +615,26 @@ void QDirectFBPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, - const QPointF &sp) + const QPointF &offset) { Q_D(QDirectFBPaintEngine); d->updateClip(); if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); d->lock(); - QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); - } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull() + QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); + } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); const QImage *img = static_cast(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(*img, Qt::AutoColor); const QPixmap pix(data); - QRasterPaintEngine::drawTiledPixmap(r, pix, sp); + QRasterPaintEngine::drawTiledPixmap(r, pix, offset); } else { d->unlock(); - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast(data); - dfbData->unlockDirectFB(); - d->drawTiledPixmap(r, pixmap); + d->drawTiledPixmap(r, pixmap, offset); } } @@ -733,14 +731,17 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); return; } - case Qt::TexturePattern: - if (state()->brushOrigin == QPointF() && brush.transform().isIdentity()) { - //could handle certain types of brush.transform() E.g. scale - d->unlock(); - d->drawTiledPixmap(rect, brush.texture()); - return; - } - break; + case Qt::TexturePattern: { + if (d->scale == QDirectFBPaintEnginePrivate::NegativeScale) + break; + + const QPixmap texture = brush.texture(); + if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass) + break; + + d->unlock(); + d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin); + return; } default: break; } @@ -1077,55 +1078,105 @@ void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); } -void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, - const QPixmap &pixmap) +static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) { + qreal pos = rect_pos - offset; + while (pos > rect_pos) + pos -= pixmapSize; + while (pos + pixmapSize < rect_pos) + pos += pixmapSize; + return pos; +} + +void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off) +{ + Q_ASSERT(!dirtyClip); + const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); + QRect newClip = destinationRect; + if (!currentClip.isEmpty()) + newClip &= currentClip; + + if (newClip.isNull()) + return; + + const DFBRegion clip = { + newClip.x(), + newClip.y(), + newClip.x() + newClip.width() - 1, + newClip.y() + newClip.height() - 1 + }; + surface->SetClip(surface, &clip); + + QPointF offset = off; + Q_ASSERT(transform.type() <= QTransform::TxScale); prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast(data); - IDirectFBSurface *s = dfbData->directFBSurface(); - const QRect dr = transform.mapRect(dest).toRect(); - DFBResult result = DFB_OK; - - if (scale == NoScale && dr == QRect(0, 0, fbWidth, fbHeight)) { - result = surface->TileBlit(surface, s, 0, 0, 0); - } else if (scale == NoScale) { - const int dx = pixmap.width(); - const int dy = pixmap.height(); - const DFBRectangle rect = { 0, 0, dx, dy }; - QVarLengthArray rects; - QVarLengthArray points; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - rects.append(rect); - const DFBPoint point = { x, y }; - points.append(point); + dfbData->unlockDirectFB(); + const QSize pixmapSize = dfbData->size(); + IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); + if (transform.isScaling()) { + Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); + offset.rx() *= transform.m11(); + offset.ry() *= transform.m22(); + + const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22()); + qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); + const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); + while (y < destinationRect.bottom()) { + qreal x = startX; + while (x < destinationRect.right()) { + const DFBRectangle destination = { qRound(x), qRound(y), mappedSize.width(), mappedSize.height() }; + surface->StretchBlit(surface, sourceSurface, 0, &destination); + x += mappedSize.width(); } + y += mappedSize.height(); } - result = surface->BatchBlit(surface, s, rects.constData(), - points.constData(), points.size()); } else { - const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); - const int dx = sr.width(); - const int dy = sr.height(); - const DFBRectangle sRect = { 0, 0, dx, dy }; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - const DFBRectangle dRect = { x, y, dx, dy }; - result = surface->StretchBlit(surface, s, &sRect, &dRect); - if (result != DFB_OK) { - y = dr.bottom() + 1; - break; - } + qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y()); + const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x()); + int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1; + if (startX != destinationRect.x()) + ++horizontal; + int vertical = qMax(1, destinationRect.height() / pixmapSize.height()) + 1; + if (y != destinationRect.y()) + ++vertical; + + const int maxCount = (vertical * horizontal); + QVarLengthArray sourceRects(maxCount); + QVarLengthArray points(maxCount); + + int i = 0; + while (y < destinationRect.bottom()) { + Q_ASSERT(i < maxCount); + qreal x = startX; + while (x < destinationRect.right()) { + points[i].x = qRound(x); + points[i].y = qRound(y); + sourceRects[i].x = 0; + sourceRects[i].y = 0; + sourceRects[i].w = int(pixmapSize.width()); + sourceRects[i].h = int(pixmapSize.height()); + x += pixmapSize.width(); + ++i; } + y += pixmapSize.height(); } + surface->BatchBlit(surface, sourceSurface, sourceRects.constData(), points.constData(), i); } - if (result != DFB_OK) - DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result); + if (currentClip.isEmpty()) { + surface->SetClip(surface, 0); + } else { + const DFBRegion clip = { + currentClip.x(), + currentClip.y(), + currentClip.x() + currentClip.width(), + currentClip.y() + currentClip.height() + }; + surface->SetClip(surface, &clip); + } } void QDirectFBPaintEnginePrivate::updateClip() @@ -1133,6 +1184,7 @@ void QDirectFBPaintEnginePrivate::updateClip() if (!dirtyClip) return; + currentClip = QRect(); const QClipData *clipData = clip(); if (!clipData || !clipData->enabled) { surface->SetClip(surface, NULL); @@ -1145,6 +1197,8 @@ void QDirectFBPaintEnginePrivate::updateClip() clipData->clipRect.y() + clipData->clipRect.height() }; surface->SetClip(surface, &r); + currentClip = clipData->clipRect.normalized(); + // ### is this guaranteed to always be normalized? dfbHandledClip = true; } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) { dfbHandledClip = true; -- cgit v0.12 From 2f67ba6d618228946ce35364c32d89a49385166a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 10 Jul 2009 15:47:09 +1000 Subject: Fix ChildMouseFilter --- src/declarative/fx/qfxflickable.cpp | 2 +- src/declarative/fx/qfxitem.cpp | 15 +++++++-------- src/declarative/fx/qfxitem.h | 2 +- src/declarative/fx/qfxpathview_p.h | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 59191c9..47b7aa1 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -1047,7 +1047,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; } grabber = static_cast(mouseGrabberItem()); - if (grabber && d->stealMouse && !grabber->keepMouseGrab()) + if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) grabMouse(); return d->stealMouse; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index da4f1b3..686ec8d 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2428,7 +2428,7 @@ bool QFxItem::hasFocus() const return false; } -bool QFxItem::eventFilter(QObject *o, QEvent *e) +bool QFxItem::sceneEventFilter(QGraphicsItem *w, QEvent *e) { switch(e->type()) { case QEvent::GraphicsSceneMouseDoubleClick: @@ -2442,7 +2442,7 @@ bool QFxItem::eventFilter(QObject *o, QEvent *e) break; } - return QObject::eventFilter(o, e); + return QGraphicsItem::sceneEventFilter(w, e); } void QFxItem::setOptions(Options options, bool set) @@ -2461,6 +2461,7 @@ void QFxItem::setOptions(Options options, bool set) } setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); + setFiltersChildEvents(d->options & ChildMouseFilter); if ((old & MouseFilter) != (d->options & MouseFilter)) { if (d->options & MouseFilter) @@ -2510,17 +2511,15 @@ void QFxItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) void QFxItemPrivate::gvRemoveMouseFilter() { Q_Q(QFxItem); - if (!canvas) return; - - canvas->removeEventFilter(q); + if (q->scene()) + q->removeSceneEventFilter(q); } void QFxItemPrivate::gvAddMouseFilter() { Q_Q(QFxItem); - if (!canvas) return; - - canvas->installEventFilter(q); + if (q->scene()) + q->installSceneEventFilter(q); } QPixmap QFxItem::string(const QString &str, const QColor &c, const QFont &f) diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index bb48d16..0203e6e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -302,7 +302,7 @@ Q_SIGNALS: protected: virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); virtual void childrenChanged(); - virtual bool eventFilter(QObject *, QEvent *); + virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); virtual bool sceneEvent(QEvent *); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); virtual bool mouseFilter(QGraphicsSceneMouseEvent *); diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index f996d1d..63c8224 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -87,7 +87,7 @@ public: Q_Q(QFxPathView); _offset = 0; q->setAcceptedMouseButtons(Qt::NoButton); - q->setOptions(QFxItem::MouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); + q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } -- cgit v0.12 From 5425853ec6a9f29af3378c982f12a0cca4bcb0e0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 14:46:44 +0200 Subject: make tests independent of PATH contents use absolute paths for the tested executables --- tests/auto/linguist/lconvert/tst_lconvert.cpp | 9 +++++---- tests/auto/linguist/lrelease/tst_lrelease.cpp | 16 +++++++++++----- tests/auto/linguist/lupdate/testlupdate.cpp | 5 +++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 40be55a..3ad2925 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -47,7 +47,7 @@ class tst_lconvert : public QObject Q_OBJECT public: - tst_lconvert() : dataDir("data/") {} + tst_lconvert() : dataDir("data/"), binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {} private slots: void initTestCase(); @@ -73,6 +73,7 @@ private: const QList &args); QString dataDir; + QString binDir; }; void tst_lconvert::initTestCase() @@ -151,7 +152,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; - cvt.start("lconvert", QStringList() << (dataDir + fn)); + cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); QVERIFY(cvt.waitForFinished(1000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); @@ -178,7 +179,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF if (!argList.isEmpty()) args += argList[i]; args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; - cvts.at(i)->start("lconvert", args); + cvts.at(i)->start(binDir + "/lconvert", args); } int st = 0; foreach (QProcess *cvt, cvts) @@ -242,7 +243,7 @@ void tst_lconvert::converts() QString outFileNameFq = dataDir + outFileName; QProcess cvt; - cvt.start("lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); + cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); doWait(&cvt, 0); if (QTest::currentTestFailed()) return; diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 512987d..858e477 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -49,6 +49,10 @@ class tst_lrelease : public QObject { Q_OBJECT + +public: + tst_lrelease() : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {} + private: private slots: @@ -59,6 +63,8 @@ private slots: private: void doCompare(const QStringList &actual, const QString &expectedFn); + + QString binDir; }; void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn) @@ -111,7 +117,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF void tst_lrelease::translate() { - QVERIFY(!QProcess::execute("lrelease testdata/translate.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/translate.ts")); QTranslator translator; QVERIFY(translator.load("testdata/translate.qm")); @@ -161,8 +167,8 @@ void tst_lrelease::translate() void tst_lrelease::mixedcodecs() { - QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts11.ts")); - QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts20.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts11.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts20.ts")); QVERIFY(!QProcess::execute("cmp testdata/mixedcodecs-ts11.qm testdata/mixedcodecs-ts20.qm")); QTranslator translator; QVERIFY(translator.load("testdata/mixedcodecs-ts11.qm")); @@ -176,7 +182,7 @@ void tst_lrelease::mixedcodecs() void tst_lrelease::compressed() { - QVERIFY(!QProcess::execute("lrelease -compress testdata/compressed.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease -compress testdata/compressed.ts")); QTranslator translator; QVERIFY(translator.load("testdata/compressed.qm")); @@ -194,7 +200,7 @@ void tst_lrelease::compressed() void tst_lrelease::dupes() { QProcess proc; - proc.start("lrelease testdata/dupes.ts"); + proc.start(binDir + "/lrelease testdata/dupes.ts"); QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors"); diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index 8abc2b0..04c03f1 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -56,8 +56,9 @@ TestLUpdate::TestLUpdate() { childProc = 0; - m_cmdLupdate = QLatin1String("lupdate"); - m_cmdQMake = QLatin1String("qmake"); + QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + m_cmdLupdate = binPath + QLatin1String("/lupdate"); + m_cmdQMake = binPath + QLatin1String("/qmake"); } TestLUpdate::~TestLUpdate() -- cgit v0.12 From 593f8a322895dc011d88fbe112987f2189d43724 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 18:05:30 +0200 Subject: rewrite makeplurals.sh in perl ... so it works under windows as well. --- tests/auto/linguist/lconvert/data/makeplurals.pl | 42 +++++++++++++++++++++++ tests/auto/linguist/lconvert/data/makeplurals.sh | 43 ------------------------ tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 +- 3 files changed, 43 insertions(+), 44 deletions(-) create mode 100755 tests/auto/linguist/lconvert/data/makeplurals.pl delete mode 100755 tests/auto/linguist/lconvert/data/makeplurals.sh diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl new file mode 100755 index 0000000..19bffe0 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/makeplurals.pl @@ -0,0 +1,42 @@ +#! /usr/bin/env perl + +sub makeit2($$$) +{ + for (my $i = 0; $i < (1 << $_[0]); $i++) { + print OUTFILE "\n"; + print OUTFILE "$_[2]\n" unless $3 eq ""; + print OUTFILE "msgid \"singular $_[1] $i\"\n"; + print OUTFILE "msgid_plural \"plural $_[1] $i\"\n"; + for (my $j = 0; $j < $_[0]; $j++) { + my $tr; + if (($i & (1 << $j)) == 0) { + $tr = "translated $_[1] $i $j"; + } + print OUTFILE "msgstr[$j] \"$tr\"\n"; + } + } +} + +sub makeit($$) +{ + open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR"; + print OUTFILE < ${OUTDIR}plural-$1.po -} - -OUTDIR=$1 -makeit 1 zh_CN -makeit 2 de_DE -makeit 3 pl_PL diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 3ad2925..1ed71ab 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -79,7 +79,7 @@ private: void tst_lconvert::initTestCase() { if (!QFile::exists(QLatin1String("data/plural-1.po"))) - QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/")); + QProcess::execute(QLatin1String("perl"), QStringList() << QLatin1String("data/makeplurals.pl") << QLatin1String("data/")); QVERIFY(QFile::exists(QLatin1String("data/plural-1.po"))); } -- cgit v0.12 From baacf493e1c968ee2ffa59a8b87754388cb7a61a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 10 Jul 2009 19:15:25 +0200 Subject: Fixed a crash with input methods The inputContext's focusWidget was not reset when disabling input methods. Thanks to Benjamin P. Task-number: 257832 Reviewed-by: Denis --- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qwidget.cpp | 7 ++----- tests/auto/qwidget/tst_qwidget.cpp | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index c6af728..114ebb2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -126,7 +126,7 @@ int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly QApplication::Type qt_appType=QApplication::Tty; QApplicationPrivate *QApplicationPrivate::self = 0; -QInputContext *QApplicationPrivate::inputContext; +QInputContext *QApplicationPrivate::inputContext = 0; bool QApplicationPrivate::quitOnLastWindowClosed = true; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9d40b00..fb9084e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -9879,11 +9879,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) QInputContextPrivate::updateImeStatus(this, true); #endif QInputContext *ic = d->ic; - if (!ic) { - // implicitly create input context only if we have a focus - if (hasFocus()) - ic = d->inputContext(); - } + if (!ic && (!on || hasFocus())) + ic = d->inputContext(); if (ic) { if (on && hasFocus() && ic->focusWidget() != this) { ic->setFocusWidget(this); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 7b68732..1db6eb2 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -350,6 +350,7 @@ private slots: #endif void updateOnDestroyedSignal(); void toplevelLineEditFocus(); + void inputFocus_task257832(); private: bool ensureScreenSize(int width, int height); @@ -8965,5 +8966,19 @@ void tst_QWidget::toplevelLineEditFocus() QCOMPARE(QApplication::focusWidget(), &w); } +void tst_QWidget::inputFocus_task257832() +{ + QLineEdit *widget = new QLineEdit; + QInputContext *context = widget->inputContext(); + if (!context) + QSKIP("No input context", SkipSingle); + widget->setFocus(); + context->setFocusWidget(widget); + QCOMPARE(context->focusWidget(), widget); + widget->setReadOnly(true); + QVERIFY(!context->focusWidget()); + delete widget; +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v0.12 From 357d4598512b4b42fc515b4fc0d2d419db604544 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 11 May 2009 17:35:20 +0200 Subject: remove dead code cherry-picked d8b1cc5f0ecbb8de734d241d72a05b325c2bbb2c from creator --- tools/linguist/shared/profileevaluator.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 8605733..c68ac46 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1511,16 +1511,6 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu if (result) *result = false; } -/* if (ok && readFeatures) { - QStringList configs = values("CONFIG"); - QSet processed; - foreach (const QString &fn, configs) { - if (!processed.contains(fn)) { - processed.insert(fn); - evaluateFeatureFile(fn, 0); - } - } - } */ return ok; } -- cgit v0.12 From b7cfdc075ce53a5aaf243161c849ee1ee079885c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 May 2009 15:02:32 +0200 Subject: remove totally pointless conditional cherry-picked 167a09b20614d282ec898f69fc2a3f0bafa11229 from creator --- tools/linguist/shared/profileevaluator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index c68ac46..c56f1d4 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1501,7 +1501,7 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu ProFile *pro = q->parsedProFile(fileName); if (pro) { m_profileStack.push(pro); - ok = (currentProFile() ? pro->Accept(this) : false); + ok = pro->Accept(this); m_profileStack.pop(); q->releaseParsedProFile(pro); -- cgit v0.12 From 3f9a894acb30ff3fb5907f82327af088f96a088d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 4 Jun 2009 15:18:14 +0200 Subject: Fix memory leak in $$system() calls from .pro files cherry-picked 07730341bd739aac823ac9b4336d8294510a35e2 from creator --- tools/linguist/shared/profileevaluator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index c56f1d4..4ea9c10 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -58,8 +58,10 @@ #ifdef Q_OS_WIN32 #define QT_POPEN _popen +#define QT_PCLOSE _pclose #else #define QT_POPEN popen +#define QT_PCLOSE pclose #endif QT_BEGIN_NAMESPACE @@ -1204,6 +1206,8 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun output += QLatin1String(buff); } ret += split_value_list(output); + if (proc) + QT_PCLOSE(proc); } } break; } -- cgit v0.12 From a701175aef8912b69afe61d23749dcfca765a231 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 16:56:28 +0200 Subject: ItemViews: make dragging faster when lots of items are selected QListView know exactly what they have on their viewport and we only paint items clipped to the viewport. So we don't need to ask for each item its visualRect. NB: QTreeView and QTableView probably deservee the same treatment --- src/gui/itemviews/qabstractitemview.cpp | 33 ++++++++++++++++++++++----------- src/gui/itemviews/qabstractitemview_p.h | 5 +++++ src/gui/itemviews/qlistview.cpp | 26 ++++++++++++++++++++++++++ src/gui/itemviews/qlistview_p.h | 2 ++ 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 5f347dd..a4a69c3 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3881,34 +3881,45 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even return true; } -QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const +/* + \internal + + returns the pair QRect/QModelIndex that should be painted on the viewports's rect + */ + +QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const { Q_ASSERT(r); Q_Q(const QAbstractItemView); QRect &rect = *r; const QRect viewportRect = viewport->rect(); - QList rects; - QModelIndexList paintedIndexes; + QItemViewPaintPairs ret; for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); const QRect current = q->visualRect(index); if (current.intersects(viewportRect)) { - paintedIndexes += index; - rects += current; + ret += qMakePair(current, index); rect |= current; } } - rect = rect.intersected(viewportRect); - if (rect.isEmpty()) + rect &= viewportRect; + return ret; +} + +QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r); + if (paintPairs.isEmpty()) return QPixmap(); - QPixmap pixmap(rect.size()); + QPixmap pixmap(r->size()); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); QStyleOptionViewItemV4 option = viewOptionsV4(); option.state |= QStyle::State_Selected; - for (int j = 0; j < paintedIndexes.count(); ++j) { - const QModelIndex ¤t = paintedIndexes.at(j); - option.rect = QRect(rects.at(j).topLeft() - rect.topLeft(), rects.at(j).size()); + for (int j = 0; j < paintPairs.count(); ++j) { + option.rect = paintPairs.at(j).first.translated(r->topLeft()); + const QModelIndex ¤t = paintPairs.at(j).second; delegateForIndex(current)->paint(&painter, option, current); } return pixmap; diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 7443d50..557e98b 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -86,6 +86,9 @@ struct QEditorInfo }; +typedef QPair QItemViewPaintPair; +typedef QList QItemViewPaintPairs; + class QEmptyModel : public QAbstractItemModel { public: @@ -176,7 +179,9 @@ public: q_func()->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemDrop, &opt, painter, q_func()); } } + #endif + virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; inline void releaseEditor(QWidget *editor) const { if (editor) { diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 6ff516a..44bcf6f 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -709,6 +709,32 @@ void QListViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) selectionModel->select(selection, command); } +/*! + \reimp + + We have a QListView way of knowing what elements are on the viewport + through the intersectingSet function +*/ +QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + Q_Q(const QListView); + QRect &rect = *r; + const QRect viewportRect = viewport->rect(); + QItemViewPaintPairs ret; + intersectingSet(viewportRect); + const QSet visibleIndexes = intersectVector.toList().toSet(); + for (int i = 0; i < indexes.count(); ++i) { + const QModelIndex &index = indexes.at(i); + if (visibleIndexes.contains(index)) { + const QRect current = q->visualRect(index); + ret += qMakePair(current, index); + rect |= current; + } + } + rect &= viewportRect; + return ret; +} /*! \internal diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index a7a7000..16f2de9 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -351,6 +351,8 @@ public: void scrollElasticBandBy(int dx, int dy); + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + // ### FIXME: we only need one at a time QDynamicListViewBase *dynamicListView; QStaticListViewBase *staticListView; -- cgit v0.12 From 69a3c65d177a4a6ecc3d3fd63455dcd53d62b75f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 15:49:51 +0200 Subject: build fix on windows --- src/gui/graphicsview/qgraphicsview_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 28b4bdc..0fa8b34 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -59,6 +59,7 @@ #include #include "qgraphicssceneevent.h" +#include #include QT_BEGIN_NAMESPACE -- cgit v0.12 From cbf18d5b24e9ae541bc7e6a7b6698666cce30478 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 16:20:40 +0200 Subject: ItemViews selection: improve performance of QItemSelection::indexes On windows it makes it 2x faster --- src/gui/itemviews/qitemselectionmodel.cpp | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index e4cb0f0..87825d9 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -270,24 +270,35 @@ QItemSelectionRange QItemSelectionRange::intersect(const QItemSelectionRange &ot */ -/*! - Returns the list of model index items stored in the selection. -*/ +/* + \internal -QModelIndexList QItemSelectionRange::indexes() const + utility function for getting the indexes from a range + it avoid concatenating list and works on one + */ + +static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList &result) { - QModelIndex index; - QModelIndexList result; - if (isValid() && model()) { - for (int column = left(); column <= right(); ++column) { - for (int row = top(); row <= bottom(); ++row) { - index = model()->index(row, column, parent()); - Qt::ItemFlags flags = model()->flags(index); + if (range.isValid() && range.model()) { + for (int column = range.left(); column <= range.right(); ++column) { + for (int row = range.top(); row <= range.bottom(); ++row) { + QModelIndex index = range.model()->index(row, column, range.parent()); + Qt::ItemFlags flags = range.model()->flags(index); if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) result.append(index); } } } +} + +/*! + Returns the list of model index items stored in the selection. +*/ + +QModelIndexList QItemSelectionRange::indexes() const +{ + QModelIndexList result; + indexesFromRange(*this, result); return result; } @@ -404,7 +415,7 @@ QModelIndexList QItemSelection::indexes() const QModelIndexList result; QList::const_iterator it = begin(); for (; it != end(); ++it) - result += (*it).indexes(); + indexesFromRange(*it, result); return result; } -- cgit v0.12 From e84e16954e9b96479964368e2dcb3114dd2bd5f1 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 18:01:49 +0200 Subject: QListView: small refactoring It is useless to store the vector of modelindex from intersectingSet --- src/gui/itemviews/qlistview.cpp | 106 ++++++++++++++++++++-------------------- src/gui/itemviews/qlistview_p.h | 22 +++------ 2 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 44bcf6f..9a94b31 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -723,7 +723,7 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList const QRect viewportRect = viewport->rect(); QItemViewPaintPairs ret; intersectingSet(viewportRect); - const QSet visibleIndexes = intersectVector.toList().toSet(); + const QSet visibleIndexes = intersectingSet(viewportRect).toList().toSet(); for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); if (visibleIndexes.contains(index)) { @@ -951,9 +951,9 @@ void QListView::dragMoveEvent(QDragMoveEvent *e) QModelIndex index; if (d->movement == Snap) { QRect rect(d->dynamicListView->snapToGrid(e->pos() + d->offset()), d->gridSize()); - d->intersectingSet(rect); - index = d->intersectVector.count() > 0 - ? d->intersectVector.last() : QModelIndex(); + const QVector intersectVector = d->intersectingSet(rect); + index = intersectVector.count() > 0 + ? intersectVector.last() : QModelIndex(); } else { index = indexAt(e->pos()); } @@ -1126,10 +1126,8 @@ void QListView::paintEvent(QPaintEvent *e) return; QStyleOptionViewItemV4 option = d->viewOptionsV4(); QPainter painter(d->viewport); - QRect area = e->rect(); - d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false); - const QVector toBeRendered = d->intersectVector; + const QVector toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false); const QModelIndex current = currentIndex(); const QModelIndex hover = d->hover; @@ -1251,9 +1249,9 @@ QModelIndex QListView::indexAt(const QPoint &p) const { Q_D(const QListView); QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1); - d->intersectingSet(rect); - QModelIndex index = d->intersectVector.count() > 0 - ? d->intersectVector.last() : QModelIndex(); + const QVector intersectVector = d->intersectingSet(rect); + QModelIndex index = intersectVector.count() > 0 + ? intersectVector.last() : QModelIndex(); if (index.isValid() && visualRect(index).contains(p)) return index; return QModelIndex(); @@ -1351,38 +1349,38 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie if (d->gridSize().isValid()) rect.setSize(d->gridSize()); QSize contents = d->contentsSize(); - d->intersectVector.clear(); + QVector intersectVector; switch (cursorAction) { case MoveLeft: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(-rect.width(), 0); if (rect.right() <= 0) return current; if (rect.left() < 0) rect.setLeft(0); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MoveRight: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(rect.width(), 0); if (rect.left() >= contents.width()) return current; if (rect.right() > contents.width()) rect.setRight(contents.width()); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MovePageUp: rect.moveTop(rect.top() - d->viewport->height()); if (rect.top() < rect.height()) rect.moveTop(rect.height()); case MovePrevious: case MoveUp: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(0, -rect.height()); if (rect.bottom() <= 0) { #ifdef QT_KEYPAD_NAVIGATION @@ -1398,17 +1396,17 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } if (rect.top() < 0) rect.setTop(0); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MovePageDown: rect.moveTop(rect.top() + d->viewport->height()); if (rect.bottom() > contents.height() - rect.height()) rect.moveBottom(contents.height() - rect.height()); case MoveNext: case MoveDown: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(0, rect.height()); if (rect.top() >= contents.height()) { #ifdef QT_KEYPAD_NAVIGATION @@ -1425,10 +1423,10 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } if (rect.bottom() > contents.height()) rect.setBottom(contents.height()); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MoveHome: return d->model->index(0, d->column, d->root); case MoveEnd: @@ -1503,10 +1501,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl QItemSelection selection; if (rect.width() == 1 && rect.height() == 1) { - d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset())); + const QVector intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset())); QModelIndex tl; - if (!d->intersectVector.isEmpty()) - tl = d->intersectVector.last(); // special case for mouse press; only select the top item + if (!intersectVector.isEmpty()) + tl = intersectVector.last(); // special case for mouse press; only select the top item if (tl.isValid() && d->isIndexEnabled(tl)) selection.select(tl, tl); } else { @@ -1516,14 +1514,14 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl QModelIndex tl, br; // get the first item const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1); - d->intersectingSet(topLeft); - if (!d->intersectVector.isEmpty()) - tl = d->intersectVector.last(); + QVector intersectVector = d->intersectingSet(topLeft); + if (!intersectVector.isEmpty()) + tl = intersectVector.last(); // get the last item const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1); - d->intersectingSet(bottomRight); - if (!d->intersectVector.isEmpty()) - br = d->intersectVector.last(); + intersectVector = d->intersectingSet(bottomRight); + if (!intersectVector.isEmpty()) + br = intersectVector.last(); // get the ranges if (tl.isValid() && br.isValid() @@ -2144,8 +2142,8 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const { QItemSelection selection; QModelIndex tl, br; - intersectingSet(rect); - QVector::iterator it = intersectVector.begin(); + const QVector intersectVector = intersectingSet(rect); + QVector::const_iterator it = intersectVector.begin(); for (; it != intersectVector.end(); ++it) { if (!tl.isValid() && !br.isValid()) { tl = br = *it; @@ -2436,9 +2434,9 @@ void QStaticListViewBase::doStaticLayout(const QListViewLayoutInfo &info) Finds the set of items intersecting with \a area. In this function, itemsize is counted from topleft to the start of the next item. */ -void QStaticListViewBase::intersectingStaticSet(const QRect &area) const +QVector QStaticListViewBase::intersectingStaticSet(const QRect &area) const { - clearIntersections(); + QVector ret; int segStartPosition; int segEndPosition; int flowStartPosition; @@ -2455,7 +2453,7 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const flowEndPosition = area.bottom(); } if (segmentPositions.count() < 2 || flowPositions.isEmpty()) - return; + return ret; // the last segment position is actually the edge of the last segment const int segLast = segmentPositions.count() - 2; int seg = qBinarySearch(segmentPositions, segStartPosition, 0, segLast + 1); @@ -2470,13 +2468,14 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const continue; QModelIndex index = modelIndex(row); if (index.isValid()) - appendToIntersections(index); + ret += index; #if 0 // for debugging else qWarning("intersectingStaticSet: row %d was invalid", row); #endif } } + return ret; } int QStaticListViewBase::itemIndex(const QListViewItem &item) const @@ -2797,12 +2796,15 @@ void QDynamicListViewBase::doDynamicLayout(const QListViewLayoutInfo &info) viewport()->update(); } -void QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const +QVector QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const { - clearIntersections(); - QListViewPrivate *that = const_cast(dd); + QDynamicListViewBase *that = const_cast(this); QBspTree::Data data(static_cast(that)); - that->dynamicListView->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data); + QVector res; + that->interSectingVector = &res; + that->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data); + that->interSectingVector = 0; + return res; } void QDynamicListViewBase::createItems(int to) @@ -2879,20 +2881,20 @@ int QDynamicListViewBase::itemIndex(const QListViewItem &item) const } void QDynamicListViewBase::addLeaf(QVector &leaf, const QRect &area, - uint visited, QBspTree::Data data) + uint visited, QBspTree::Data data) { QListViewItem *vi; - QListViewPrivate *_this = static_cast(data.ptr); + QDynamicListViewBase *_this = static_cast(data.ptr); for (int i = 0; i < leaf.count(); ++i) { int idx = leaf.at(i); - if (idx < 0 || idx >= _this->dynamicListView->items.count()) + if (idx < 0 || idx >= _this->items.count()) continue; - vi = &_this->dynamicListView->items[idx]; + vi = &_this->items[idx]; Q_ASSERT(vi); if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) { - QModelIndex index = _this->listViewItemToIndex(*vi); + QModelIndex index = _this->dd->listViewItemToIndex(*vi); Q_ASSERT(index.isValid()); - _this->intersectVector.append(index); + _this->interSectingVector->append(index); vi->visited = visited; } } diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index 16f2de9..1727ba4 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -153,9 +153,6 @@ public: inline bool isHidden(int row) const; inline int hiddenCount() const; - inline void clearIntersections() const; - inline void appendToIntersections(const QModelIndex &idx) const; - inline bool isRightToLeft() const; QListViewPrivate *dd; @@ -186,7 +183,7 @@ public: QPoint initStaticLayout(const QListViewLayoutInfo &info); void doStaticLayout(const QListViewLayoutInfo &info); - void intersectingStaticSet(const QRect &area) const; + QVector intersectingStaticSet(const QRect &area) const; int itemIndex(const QListViewItem &item) const; @@ -216,7 +213,7 @@ class QDynamicListViewBase : public QCommonListViewBase friend class QListViewPrivate; public: QDynamicListViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d), - batchStartRow(0), batchSavedDeltaSeg(0) {} + batchStartRow(0), batchSavedDeltaSeg(0), interSectingVector(0) {} QBspTree tree; QVector items; @@ -230,6 +227,7 @@ public: // used when laying out in batches int batchStartRow; int batchSavedDeltaSeg; + QVector *interSectingVector; //used from within intersectingDynamicSet void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); @@ -237,7 +235,7 @@ public: void initBspTree(const QSize &contents); QPoint initDynamicLayout(const QListViewLayoutInfo &info); void doDynamicLayout(const QListViewLayoutInfo &info); - void intersectingDynamicSet(const QRect &area) const; + QVector intersectingDynamicSet(const QRect &area) const; static void addLeaf(QVector &leaf, const QRect &area, uint visited, QBspTree::Data data); @@ -277,11 +275,11 @@ public: bool doItemsLayout(int num); - inline void intersectingSet(const QRect &area, bool doLayout = true) const { + inline QVector intersectingSet(const QRect &area, bool doLayout = true) const { if (doLayout) executePostedLayout(); QRect a = (q_func()->isRightToLeft() ? flipX(area.normalized()) : area.normalized()); - if (viewMode == QListView::ListMode) staticListView->intersectingStaticSet(a); - else dynamicListView->intersectingDynamicSet(a); + return (viewMode == QListView::ListMode) ? staticListView->intersectingStaticSet(a) + : dynamicListView->intersectingDynamicSet(a); } // ### FIXME: @@ -385,9 +383,6 @@ public: QRect layoutBounds; - // used for intersecting set - mutable QVector intersectVector; - // timers QBasicTimer batchLayoutTimer; @@ -440,9 +435,6 @@ inline QAbstractItemDelegate *QCommonListViewBase::delegate(const QModelIndex &i inline bool QCommonListViewBase::isHidden(int row) const { return dd->isHidden(row); } inline int QCommonListViewBase::hiddenCount() const { return dd->hiddenRows.count(); } -inline void QCommonListViewBase::clearIntersections() const { dd->intersectVector.clear(); } -inline void QCommonListViewBase::appendToIntersections(const QModelIndex &idx) const { dd->intersectVector.append(idx); } - inline bool QCommonListViewBase::isRightToLeft() const { return qq->isRightToLeft(); } QT_END_NAMESPACE -- cgit v0.12 From 6fbd79e45330044b059aa55873eaf2b73bdc49b2 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 08:14:02 +1000 Subject: Fixes merge mixup. --- src/sql/drivers/ibase/qsql_ibase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index c7409e1..0c4fff0 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1621,7 +1621,7 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const "b.RDB$FIELD_SCALE, b.RDB$FIELD_PRECISION, a.RDB$NULL_FLAG " "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " - "AND UPPER(a.RDB$RELATION_NAME) = '") + table.toUpper() + QLatin1String("' " + "AND a.RDB$RELATION_NAME = '") + table + QLatin1String("' " "ORDER BY a.RDB$FIELD_POSITION")); while (q.next()) { @@ -1660,7 +1660,7 @@ QSqlIndex QIBaseDriver::primaryIndex(const QString &table) const q.exec(QLatin1String("SELECT a.RDB$INDEX_NAME, b.RDB$FIELD_NAME, d.RDB$FIELD_TYPE, d.RDB$FIELD_SCALE " "FROM RDB$RELATION_CONSTRAINTS a, RDB$INDEX_SEGMENTS b, RDB$RELATION_FIELDS c, RDB$FIELDS d " "WHERE a.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' " - "AND UPPER(a.RDB$RELATION_NAME) = '") + tablename.toUpper() + + "AND a.RDB$RELATION_NAME = '") + tablename + QLatin1String(" 'AND a.RDB$INDEX_NAME = b.RDB$INDEX_NAME " "AND c.RDB$RELATION_NAME = a.RDB$RELATION_NAME " "AND c.RDB$FIELD_NAME = b.RDB$FIELD_NAME " -- cgit v0.12 From c402f363d8502c688433eb4f21ba3528d9ac89e5 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 13 Jul 2009 10:36:51 +1000 Subject: Fixed linking of QtSvg with MSVC. --- src/gui/graphicsview/qgraphicsitem_p.h | 17 +++++++++++++++++ src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 18 ------------------ src/gui/widgets/qabstractscrollarea_p.h | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index ed1982e..9bdd273 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -506,6 +506,23 @@ struct QGraphicsItemPrivate::TransformData { /*! \internal */ +inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Return true if sibling item1 is on top of item2. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; + bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; + if (f1 != f2) + return f2; + if (d1->z != d2->z) + return d1->z > d2->z; + return d1->siblingIndex > d2->siblingIndex; +} + +/*! + \internal +*/ static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) { return qt_closestLeaf(item2, item1); } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 3ac922b..2e02458 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -164,24 +164,6 @@ public: bool cached, bool onlyTopLevelItems = false); }; - -/*! - \internal -*/ -inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Return true if sibling item1 is on top of item2. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; - bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; - if (f1 != f2) - return f2; - if (d1->z != d2->z) - return d1->z > d2->z; - return d1->siblingIndex > d2->siblingIndex; -} - static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) { qreal xp = s.left(); diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 7e0f444..aef8ac5 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QScrollBar; class QAbstractScrollAreaScrollBarContainer; -class QAbstractScrollAreaPrivate: public QFramePrivate +class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate { Q_DECLARE_PUBLIC(QAbstractScrollArea) -- cgit v0.12 From de07df9001586cc18ae267591359541b7ea494a0 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 13:28:52 +1000 Subject: Fixes failure when table has null fields to update Fixes an issue where too many parameters are bound when updating QSqlTableModel where the stored record has NULLs in it. Reviewed-by: Justin McPherson --- src/sql/models/qsqltablemodel.cpp | 2 +- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 62 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 591b506..18d89b4 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -202,7 +202,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement, editQuery.addBindValue(rec.value(i)); } for (i = 0; i < whereValues.count(); ++i) { - if (whereValues.isGenerated(i)) + if (whereValues.isGenerated(i) && !whereValues.isNull(i)) editQuery.addBindValue(whereValues.value(i)); } diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 5d1f9d4..24bc42b 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -116,6 +116,8 @@ private slots: void insertRecordsInLoop(); void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); } void sqlite_attachedDatabase(); // For task 130799 + void tableModifyWithBlank_data() { generic_data(); } + void tableModifyWithBlank(); // For mail task private: void generic_data(const QString& engine=QString()); @@ -141,6 +143,7 @@ void tst_QSqlTableModel::dropTestTables() tableNames << qTableName("test") << qTableName("test2") << qTableName("test3") + << qTableName("test4") << qTableName("emptytable") << qTableName("bigtable") << qTableName("foo"); @@ -167,6 +170,8 @@ void tst_QSqlTableModel::createTestTables() QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id int, random varchar(20), randomtwo varchar(20))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test4") + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable") + "(id int)")); if (testWhiteSpaceNames(db.driverName())) { @@ -922,5 +927,62 @@ void tst_QSqlTableModel::sqlite_attachedDatabase() QCOMPARE(model.data(model.index(0, 1), Qt::DisplayRole).toString(), QLatin1String("main")); } + +void tst_QSqlTableModel::tableModifyWithBlank() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlTableModel model(0, db); + model.setTable(qTableName("test4")); + model.select(); + + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) + QVERIFY_SQL(model, insertRow(0)); + QVERIFY_SQL(model, setData(model.index(0,0),timeString)); + QVERIFY_SQL(model, submitAll()); + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database + model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row + QVERIFY_SQL(model, select()); + + //Make sure we only get one record, and that it is the one we just made + QCOMPARE(model.rowCount(), 1); //verify only one entry + QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record + + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" + QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); + + //do a quick check to make sure that the setData command properly set the value in the model + QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); + + //submit the changed data to the database + //This is where I have been getting errors. + QVERIFY_SQL(model, submitAll()); + + //make sure the model has the most current data for our record + QVERIFY_SQL(model, select()); + + //verify that our new record was the only record returned + QCOMPARE(model.rowCount(), 1); + + //And that the record returned is, in fact, our test record. + QCOMPARE(model.record(0).value(0).toString(), timeString); + + //Make sure the value of the first column matches what we set it to previously. + QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); +} + QTEST_MAIN(tst_QSqlTableModel) #include "tst_qsqltablemodel.moc" -- cgit v0.12 From f2c275992245b1e5e90bbac97c7d5f73f4710311 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 13 Jul 2009 14:43:15 +1000 Subject: Check if scripttools is enabled. --- src/declarative/qml/qml.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index fa09935..310632e 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -69,7 +69,7 @@ HEADERS += qml/qmlparser_p.h \ qml/qpodvector_p.h # for qtscript debugger -QT += scripttools +contains(QT_CONFIG, scripttools):QT += scripttools include(script/script.pri) include(parser/parser.pri) -- cgit v0.12 From c2f6c3eb4381a987df47601fcbab4e3a98d40813 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 14:56:24 +1000 Subject: Fixes up the autotest for mysql over ODBC connection. --- tests/auto/qsqldriver/tst_qsqldriver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 6d428df..b79c093 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -158,7 +158,7 @@ void tst_QSqlDriver::record() //check that we can't get records using incorrect tablename casing that's been quoted rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); - if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match else QCOMPARE(rec.count(), 0); @@ -204,7 +204,7 @@ void tst_QSqlDriver::primaryIndex() tablename = tablename.toUpper(); index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); - if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing else QCOMPARE(index.count(), 0); -- cgit v0.12 From 049ff0b4f74400ab3c8571f6ba3a73106ca3a9dd Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 15:21:01 +1000 Subject: Fixes autotest to match the new code (db level precisionPolicy). --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 82e25d7..994a3d7 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -918,7 +918,7 @@ void tst_QSqlDatabase::recordOCI() FieldDef("varchar(20)", QVariant::String, QString("blah2")), FieldDef("nchar(20)", QVariant::String, QString("blah3")), FieldDef("nvarchar2(20)", QVariant::String, QString("blah4")), - FieldDef("number(10,5)", QVariant::String, 1.1234567), + FieldDef("number(10,5)", QVariant::Double, 1.1234567), FieldDef("date", QVariant::DateTime, dt), #ifdef QT3_SUPPORT //X? FieldDef("long raw", QVariant::ByteArray, QByteArray(Q3CString("blah5"))), -- cgit v0.12 From f6079b8407e20942a27f1fe40c4ce0e0a11d3320 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:16:17 +0200 Subject: Fix broken tst_QGraphicsItem::sorting. A top-level window on Windows cannot have a smaller width than 120. Increase the width by 20 and expect another row of items to be painted. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4ca1b48..96ee070 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7113,7 +7113,7 @@ void tst_QGraphicsItem::sorting() QGraphicsView view(&scene); view.setResizeAnchor(QGraphicsView::NoAnchor); view.setTransformationAnchor(QGraphicsView::NoAnchor); - view.resize(100, 100); + view.resize(120, 100); view.setFrameStyle(0); view.show(); #ifdef Q_WS_X11 @@ -7130,6 +7130,7 @@ void tst_QGraphicsItem::sorting() << grid[1][0] << grid[1][1] << grid[1][2] << grid[1][3] << grid[2][0] << grid[2][1] << grid[2][2] << grid[2][3] << grid[3][0] << grid[3][1] << grid[3][2] << grid[3][3] + << grid[4][0] << grid[4][1] << grid[4][2] << grid[4][3] << item1 << item2); } -- cgit v0.12 From dacfd67ad35ed3edb079e9795088f852b98717e3 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:27:15 +0200 Subject: Stabilize tst_QGraphicsView::mouseTracking2 (on Windows). Use QApplication::sendEvent directly instead of calling the static sendMouseMove function, which also calls QTest::mouseMove. This test failed with spy.count() being 2 instead of 1 (which is correct since we both use QTest::mouseMove and QApplication::sendEvent). --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 77ab977..9a5089b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3311,7 +3311,9 @@ void tst_QGraphicsView::mouseTracking2() EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove); QCOMPARE(spy.count(), 0); - sendMouseMove(view.viewport(), view.viewport()->rect().center()); + QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton, + Qt::MouseButtons(Qt::NoButton), 0); + QApplication::sendEvent(view.viewport(), &event); QCOMPARE(spy.count(), 1); } -- cgit v0.12 From d705f5cd9d3bac765346af361038f2f9249183e7 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:48:43 +0200 Subject: Fix crash after "Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support" tst_QGraphicsProxyWidget crashed because the QAlphaWidget tried to access a deleted widget. Before we had the if check, but that was removed with this commit: 55137901. Completely wrong, we must check the widget pointer before using it. Reviewed-by: jbache --- src/gui/widgets/qeffects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index d6d0a16..f3b1b76 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -128,7 +128,8 @@ QAlphaWidget::~QAlphaWidget() { #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) // Restore user-defined opacity value - widget->setWindowOpacity(windowOpacity); + if (widget) + widget->setWindowOpacity(windowOpacity); #endif } -- cgit v0.12 From e8e6e8c1722618a48cb4a2e46b24ecad4b056270 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:41 +0200 Subject: Added QSyntaxHighlighter::rehighlightBlock(QTextBlock) Merge-request: 379 Reviewed-by: Simon Hausmann --- src/gui/text/qsyntaxhighlighter.cpp | 27 +++++++++++++++++++++++++++ src/gui/text/qsyntaxhighlighter.h | 1 + 2 files changed, 28 insertions(+) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index db1a38e..ccf229e 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -356,6 +356,8 @@ QTextDocument *QSyntaxHighlighter::document() const \since 4.2 Redoes the highlighting of the whole document. + + \sa rehighlightBlock() */ void QSyntaxHighlighter::rehighlight() { @@ -375,6 +377,31 @@ void QSyntaxHighlighter::rehighlight() } /*! + \since 4.6 + + Redoes the highlighting of the given QTextBlock \a block. + + \sa rehighlight() +*/ +void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) +{ + Q_D(QSyntaxHighlighter); + if (!d->doc) + return; + + disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); + QTextCursor cursor(block); + cursor.beginEditBlock(); + int from = cursor.position(); + cursor.movePosition(QTextCursor::EndOfBlock); + d->_q_reformatBlocks(from, 0, cursor.position() - from); + cursor.endEditBlock(); + connect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); +} + +/*! \fn void QSyntaxHighlighter::highlightBlock(const QString &text) Highlights the given text block. This function is called when diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 4e5271b..ee249b8 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -78,6 +78,7 @@ public: public Q_SLOTS: void rehighlight(); + void rehighlightBlock(const QTextBlock &block); protected: virtual void highlightBlock(const QString &text) = 0; -- cgit v0.12 From 9a46bc5f02866134fb66ff1a03863d09382f7d40 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:42 +0200 Subject: Added QSyntaxHighlighter::rehighlightBlock() auto test Merge-request: 379 Reviewed-by: Simon Hausmann --- .../qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 22e9455..1699e72 100644 --- a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -99,7 +99,8 @@ private slots: void avoidUnnecessaryRehighlight(); void noContentsChangedDuringHighlight(); void rehighlight(); - + void rehighlightBlock(); + private: QTextDocument *doc; QTestDocumentLayout *lout; @@ -517,6 +518,32 @@ void tst_QSyntaxHighlighter::rehighlight() QCOMPARE(hl->callCount, 1); } +void tst_QSyntaxHighlighter::rehighlightBlock() +{ + TestHighlighter *hl = new TestHighlighter(doc); + + cursor.movePosition(QTextCursor::Start); + cursor.beginEditBlock(); + cursor.insertText("Hello"); + cursor.insertBlock(); + cursor.insertText("World"); + cursor.endEditBlock(); + + hl->callCount = 0; + hl->highlightedText.clear(); + QTextBlock block = doc->begin(); + hl->rehighlightBlock(block); + + QCOMPARE(hl->highlightedText, QString("Hello")); + QCOMPARE(hl->callCount, 1); + + hl->callCount = 0; + hl->highlightedText.clear(); + hl->rehighlightBlock(block.next()); + + QCOMPARE(hl->highlightedText, QString("World")); + QCOMPARE(hl->callCount, 1); +} QTEST_MAIN(tst_QSyntaxHighlighter) #include "tst_qsyntaxhighlighter.moc" -- cgit v0.12 From d5c71b7ede48fd832145cc3921da77b10772053c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:44 +0200 Subject: Unified common code in QSyntaxHighlighter::rehighlight() and QSyntaxHighlighter::rehighlightBlock() Merge-request: 379 Reviewed-by: Simon Hausmann --- src/gui/text/qsyntaxhighlighter.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index ccf229e..f69562d 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -65,6 +65,18 @@ public: void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlock(QTextBlock block); + + inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) { + QObject::disconnect(doc, SIGNAL(contentsChange(int,int,int)), + q_func(), SLOT(_q_reformatBlocks(int,int,int))); + cursor.beginEditBlock(); + int from = cursor.position(); + cursor.movePosition(operation); + _q_reformatBlocks(from, 0, cursor.position() - from); + cursor.endEditBlock(); + QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), + q_func(), SLOT(_q_reformatBlocks(int,int,int))); + } inline void _q_delayedRehighlight() { if (!rehighlightPending) @@ -365,15 +377,8 @@ void QSyntaxHighlighter::rehighlight() if (!d->doc) return; - disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); QTextCursor cursor(d->doc); - cursor.beginEditBlock(); - cursor.movePosition(QTextCursor::End); - d->_q_reformatBlocks(0, 0, cursor.position()); - cursor.endEditBlock(); - connect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + d->rehighlight(cursor, QTextCursor::End); } /*! @@ -389,16 +394,8 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) if (!d->doc) return; - disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); QTextCursor cursor(block); - cursor.beginEditBlock(); - int from = cursor.position(); - cursor.movePosition(QTextCursor::EndOfBlock); - d->_q_reformatBlocks(from, 0, cursor.position() - from); - cursor.endEditBlock(); - connect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + d->rehighlight(cursor, QTextCursor::EndOfBlock); } /*! -- cgit v0.12 From 425f9035d6309111cdc8f30e1fdb4995e96c38a6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 13 Jul 2009 11:25:02 +0200 Subject: Fix line endings. --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 24bc42b..ded29d7 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -938,49 +938,49 @@ void tst_QSqlTableModel::tableModifyWithBlank() model.setTable(qTableName("test4")); model.select(); - //generate a time stamp for the test. Add one second to the current time to make sure - //it is different than the QSqlQuery test. - QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); - - //insert a new row, with column0 being the timestamp. - //Should be equivalent to QSqlQuery INSERT INTO... command) + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); QVERIFY_SQL(model, submitAll()); - - //set a filter on the table so the only record we get is the one we just made - //I could just do another setData command, but I want to make sure the TableModel - //matches exactly what is stored in the database + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row QVERIFY_SQL(model, select()); - //Make sure we only get one record, and that it is the one we just made + //Make sure we only get one record, and that it is the one we just made QCOMPARE(model.rowCount(), 1); //verify only one entry QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record - //At this point we know that the intial value (timestamp) was succsefully stored in the database - //Attempt to modify the data in the new record - //equivalent to query.exec("update test set column3="... command in direct test - //set the data in the first column to "col1ModelData" + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); - //do a quick check to make sure that the setData command properly set the value in the model + //do a quick check to make sure that the setData command properly set the value in the model QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); - //submit the changed data to the database - //This is where I have been getting errors. + //submit the changed data to the database + //This is where I have been getting errors. QVERIFY_SQL(model, submitAll()); - //make sure the model has the most current data for our record + //make sure the model has the most current data for our record QVERIFY_SQL(model, select()); - //verify that our new record was the only record returned + //verify that our new record was the only record returned QCOMPARE(model.rowCount(), 1); - //And that the record returned is, in fact, our test record. + //And that the record returned is, in fact, our test record. QCOMPARE(model.record(0).value(0).toString(), timeString); - //Make sure the value of the first column matches what we set it to previously. + //Make sure the value of the first column matches what we set it to previously. QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } -- cgit v0.12 From 839fbd22a602aa4b9fa20e6c302329008c3aab09 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 10 Jul 2009 14:44:53 +0200 Subject: Removed an assert from the QNetworkReply. It is possible that finished() function will be called several times, for example if the user calls QNetworkReply::close() as a result of the authenticationRequired() signal, the connection will be closed (which results in emitting a finished() signal), and then the authentication will be cancelled, which will also try to emit the same signal, however the connection state will already be set to Finished. The fix is to just make sure if the finished() signal has already been emitted by checking if the connection state is not Finished or Aborted. Reviewed-by: Thiago Macieira --- src/network/access/qnetworkreplyimpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index de39970..28319bb 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -461,8 +461,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) void QNetworkReplyImplPrivate::finished() { Q_Q(QNetworkReplyImpl); - Q_ASSERT_X(state != Finished, "QNetworkReplyImpl", - "Backend called finished/finishedWithError more than once"); + if (state == Finished || state == Aborted) + return; state = Finished; pendingNotifications.clear(); -- cgit v0.12 From 5cf6c626c6a1a23291dfe65662b914497ce81c05 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 13 Jul 2009 11:36:37 +0200 Subject: Fixed the lineendings in the tst_qsqltablemodel.cpp --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index a30fbdb..576c190 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -943,49 +943,49 @@ void tst_QSqlTableModel::tableModifyWithBlank() model.setTable(qTableName("test4")); model.select(); - //generate a time stamp for the test. Add one second to the current time to make sure - //it is different than the QSqlQuery test. - QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); - - //insert a new row, with column0 being the timestamp. - //Should be equivalent to QSqlQuery INSERT INTO... command) + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); QVERIFY_SQL(model, submitAll()); - - //set a filter on the table so the only record we get is the one we just made - //I could just do another setData command, but I want to make sure the TableModel - //matches exactly what is stored in the database + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row QVERIFY_SQL(model, select()); - //Make sure we only get one record, and that it is the one we just made + //Make sure we only get one record, and that it is the one we just made QCOMPARE(model.rowCount(), 1); //verify only one entry QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record - //At this point we know that the intial value (timestamp) was succsefully stored in the database - //Attempt to modify the data in the new record - //equivalent to query.exec("update test set column3="... command in direct test - //set the data in the first column to "col1ModelData" + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); - //do a quick check to make sure that the setData command properly set the value in the model + //do a quick check to make sure that the setData command properly set the value in the model QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); - //submit the changed data to the database - //This is where I have been getting errors. + //submit the changed data to the database + //This is where I have been getting errors. QVERIFY_SQL(model, submitAll()); - //make sure the model has the most current data for our record + //make sure the model has the most current data for our record QVERIFY_SQL(model, select()); - //verify that our new record was the only record returned + //verify that our new record was the only record returned QCOMPARE(model.rowCount(), 1); - //And that the record returned is, in fact, our test record. + //And that the record returned is, in fact, our test record. QCOMPARE(model.record(0).value(0).toString(), timeString); - //Make sure the value of the first column matches what we set it to previously. + //Make sure the value of the first column matches what we set it to previously. QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } -- cgit v0.12 From b9ea022e206bad5d80b4b9a7b957e8b8521d9fb9 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 10 Jul 2009 11:33:48 +0200 Subject: fix warning in qstringbuilder.h by using QLatin1Char Reviewed-by: Volker Hilsheimer --- src/corelib/tools/qstringbuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 97f13ee..3b43253 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -211,7 +211,7 @@ template <> struct QConcatenable { const char *data = ba.constData(); while (*data) - *out++ = *data++; + *out++ = QLatin1Char(*data++); } }; #endif -- cgit v0.12 From 486bd135faa2c8269044f9c03597bc6b05644540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 10 Jul 2009 15:36:02 +0200 Subject: Revert "Fixed leak of plugin instances" mjansen reported on #qt-labs that this change crashes KDE applications that were calling delete on their plugins. It turns out that is also how QPluginLoader works, so the commit was a bad idea to start with. This reverts commit 4c7004122a858cd6d891efc7923ba11484fbf997. Reviewed-by: Thiago Macieira --- src/corelib/plugin/qplugin.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index ff2b412..233b4f9 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -63,21 +63,6 @@ typedef QObject *(*QtPluginInstanceFunction)(); void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function); -struct qt_plugin_instance_deleter -{ - qt_plugin_instance_deleter(QPointer &instance) - : instance_(instance) - { - } - - ~qt_plugin_instance_deleter() - { - delete instance_; - } - - QPointer &instance_; -}; - #define Q_IMPORT_PLUGIN(PLUGIN) \ extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \ class Static##PLUGIN##PluginInstance{ \ @@ -91,10 +76,8 @@ struct qt_plugin_instance_deleter #define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ { \ static QT_PREPEND_NAMESPACE(QPointer) _instance; \ - if (!_instance) { \ - static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \ + if (!_instance) \ _instance = new IMPLEMENTATION; \ - } \ return _instance; \ } -- cgit v0.12 From 3d55ab91148c13f1905a4c1983d144efb4315297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 13 Jul 2009 13:00:06 +0200 Subject: Cut-off in QGraphicsView not hit if setting a scene rect. QGraphicsScene::sceneRect() returns the growingItemsBoundingRect if not a particular scene rect is set; otherwise the sceneRect is returned. This cut-off aims to do less processing when the exposed region covers the entire scene, but it won't get hit in case of a sceneRect because we always check against the growingItemsBoundingRect. Task-number: 257192 --- src/gui/graphicsview/qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3a8a696..bcfd68c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -971,7 +971,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg // rect does not take into account untransformable items. const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) .boundingRect(); - if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) { + if (exposedRegionSceneBounds.contains(scene->sceneRect())) { Q_ASSERT(allItems); *allItems = true; -- cgit v0.12 From 0aca5cf05288dc4d2175d1c4a78bf62a5ea96b21 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Jul 2009 12:48:33 +0200 Subject: doc: Clarified what Qt::HANDLE is on Windows. Task-number: 193615 --- doc/src/qnamespace.qdoc | 5 +++-- src/corelib/thread/qthread.cpp | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index b691ac7..85b020d 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -1246,8 +1246,9 @@ /*! \typedef Qt::HANDLE Platform-specific handle type for system objects. This is - equivalent to \c{void *} on Windows and Mac OS X, and embedded - Linux, and to \c{unsigned long} on X11. + equivalent to \c{void *} on Mac OS X and embedded Linux, + and to \c{unsigned long} on X11. On Windows it is the + DWORD returned by the Win32 function getCurrentThreadId(). \warning Using this type is not portable. */ diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 24522f2..2e31c6d 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -261,9 +261,14 @@ void QAdoptedThread::run() Returns the thread handle of the currently executing thread. \warning The handle returned by this function is used for internal - purposes and should not be used in any application code. On - Windows, the returned value is a pseudo-handle for the current - thread that cannot be used for numerical comparison. + purposes and should not be used in any application code. + + \warning On Windows, the returned value is a pseudo-handle for the + current thread. It can't be used for numerical comparison. i.e., + this function returns the DWORD (Windows-Thread ID) returned by + the Win32 function getCurrentThreadId(), not the HANDLE + (Windows-Thread HANDLE) returned by the Win32 function + getCurrentThread(). */ /*! -- cgit v0.12 From cc24c46c117248ecb98200416e7f25375e6bb476 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 13 Jul 2009 13:02:20 +0200 Subject: QFlags::testFlag(): handle the zero case appropriately. Brought up by Andy. See perforce change 314809, 17b07e3ab6192b31f77fd2f126705b9ab53b3937. Related to task 221708. Reviewed-By: Andy Shaw --- src/corelib/global/qglobal.h | 2 +- tests/auto/qflags/tst_qflags.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a139a55..d6c708c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2062,7 +2062,7 @@ public: inline bool operator!() const { return !i; } - inline bool testFlag(Enum f) const { return (i & f) == f; } + inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); } }; #define Q_DECLARE_FLAGS(Flags, Enum)\ diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp index a5f68dc..87d8258 100644 --- a/tests/auto/qflags/tst_qflags.cpp +++ b/tests/auto/qflags/tst_qflags.cpp @@ -45,6 +45,7 @@ class tst_QFlags: public QObject Q_OBJECT private slots: void testFlag() const; + void testFlagZeroFlag() const; void testFlagMultiBits() const; }; @@ -59,8 +60,31 @@ void tst_QFlags::testFlag() const QVERIFY(!btn.testFlag(Qt::LeftButton)); } +void tst_QFlags::testFlagZeroFlag() const +{ + { + Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton; + /* Qt::NoButton has the value 0. */ + + QVERIFY(!btn.testFlag(Qt::NoButton)); + } + + { + /* A zero enum set should test true with zero. */ + QVERIFY(Qt::MouseButtons().testFlag(Qt::NoButton)); + } + + { + Qt::MouseButtons btn = Qt::NoButton; + QVERIFY(btn.testFlag(Qt::NoButton)); + } +} + void tst_QFlags::testFlagMultiBits() const { + /* Qt::Window is 0x00000001 + * Qt::Dialog is 0x00000002 | Window + */ { const Qt::WindowFlags onlyWindow(Qt::Window); QVERIFY(!onlyWindow.testFlag(Qt::Dialog)); -- cgit v0.12 From 9b6eacab99673d7d9848b341c4cf36a7c35f07c0 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 13 Jul 2009 13:02:20 +0200 Subject: QFlags::testFlag(): handle the zero case appropriately. Brought up by Andy. See perforce change 314809, 17b07e3ab6192b31f77fd2f126705b9ab53b3937. Related to task 221708. Reviewed-By: Andy Shaw (cherry picked from commit cc24c46c117248ecb98200416e7f25375e6bb476) --- src/corelib/global/qglobal.h | 2 +- tests/auto/qflags/tst_qflags.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 63f6c31..f650bd2 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2017,7 +2017,7 @@ public: inline bool operator!() const { return !i; } - inline bool testFlag(Enum f) const { return (i & f) == f; } + inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); } }; #define Q_DECLARE_FLAGS(Flags, Enum)\ diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp index a5f68dc..87d8258 100644 --- a/tests/auto/qflags/tst_qflags.cpp +++ b/tests/auto/qflags/tst_qflags.cpp @@ -45,6 +45,7 @@ class tst_QFlags: public QObject Q_OBJECT private slots: void testFlag() const; + void testFlagZeroFlag() const; void testFlagMultiBits() const; }; @@ -59,8 +60,31 @@ void tst_QFlags::testFlag() const QVERIFY(!btn.testFlag(Qt::LeftButton)); } +void tst_QFlags::testFlagZeroFlag() const +{ + { + Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton; + /* Qt::NoButton has the value 0. */ + + QVERIFY(!btn.testFlag(Qt::NoButton)); + } + + { + /* A zero enum set should test true with zero. */ + QVERIFY(Qt::MouseButtons().testFlag(Qt::NoButton)); + } + + { + Qt::MouseButtons btn = Qt::NoButton; + QVERIFY(btn.testFlag(Qt::NoButton)); + } +} + void tst_QFlags::testFlagMultiBits() const { + /* Qt::Window is 0x00000001 + * Qt::Dialog is 0x00000002 | Window + */ { const Qt::WindowFlags onlyWindow(Qt::Window); QVERIFY(!onlyWindow.testFlag(Qt::Dialog)); -- cgit v0.12 From 1ed4c52dd7ad3cb6b0d846464b69489031ab68a5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:31:36 +0200 Subject: QNAM: Fix double sending of a HTTP request In some cases, weird timing issues could occur. In those cases, an EOF was sent twice for the upload data, leading to the HTTP code being confused and sending the request headers twice. Task-number: 257662 Reviewed-by: Thiago Macieira --- src/network/access/qnetworkaccesshttpbackend.cpp | 4 ++++ src/network/access/qnetworkreplyimpl.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index ce800c2..c57157e 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -628,6 +628,10 @@ void QNetworkAccessHttpBackend::closeUpstreamChannel() { // this indicates that the user finished uploading the data for POST Q_ASSERT(uploadDevice); + + if (uploadDevice->eof) + return; // received a 2nd time. should fix 257662 and 256369 + uploadDevice->eof = true; emit uploadDevice->readChannelFinished(); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 63a9c2d..98944fd 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -92,6 +92,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() void QNetworkReplyImplPrivate::_q_sourceReadyRead() { + if (state != Working) + return; + // read data from the outgoingData QIODevice into our internal buffer enum { DesiredBufferSize = 32 * 1024 }; @@ -131,6 +134,8 @@ void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); + if (state != Working) + return; if (!copyDevice || !q->isOpen()) return; -- cgit v0.12 From 85fbffa12bcd38b08030561335305c3226312bc6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Jul 2009 13:46:46 +0200 Subject: Doc: Explicitly declare the module for each namespace to prevent strange omissions when qdoc is used in certain Windows environments. Task-number: 256415 Reviewed-by: Trust Me --- doc/src/qnamespace.qdoc | 1 + doc/src/qsql.qdoc | 2 +- src/corelib/concurrent/qtconcurrentmap.cpp | 1 + src/opengl/qgl.cpp | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index b691ac7..d509912 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -41,6 +41,7 @@ /*! \namespace Qt + \inmodule QtCore \brief The Qt namespace contains miscellaneous identifiers used throughout the Qt library. diff --git a/doc/src/qsql.qdoc b/doc/src/qsql.qdoc index 5315413..0f690e8 100644 --- a/doc/src/qsql.qdoc +++ b/doc/src/qsql.qdoc @@ -41,12 +41,12 @@ /*! \namespace QSql + \inmodule QtSql \brief The QSql namespace contains miscellaneous identifiers used throughout the Qt SQL library. \ingroup database \mainclass - \omit ### \module sql \endomit \sa {QtSql Module} */ diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index b8c753a..46d2400 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -41,6 +41,7 @@ /*! \namespace QtConcurrent + \inmodule QtCore \since 4.4 \brief The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a9f8ede..0169ea2 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -142,6 +142,7 @@ QGLSignalProxy *QGLSignalProxy::instance() /*! \namespace QGL + \inmodule QtOpenGL \brief The QGL namespace specifies miscellaneous identifiers used in the Qt OpenGL module. -- cgit v0.12 From 3af223d89836fbde213aa2f54d775c9cd840f693 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 13 Jul 2009 13:37:23 +0200 Subject: Fix font propagation issues with QComboBox and the popup menu. This has always been a bit bumpy, the problem is that the popup normally has its own styling from the desktop, plus it's its own top-level and that is normally a boundary for propagation. Of course, people are surprised by this (especially when it works for editable). So, we need to be a bit better propagating the info. Also the QStyleOptionMenuItem has the correct font, but if it's set on a window, by the time it reaches the popup, its resolve mask is very weak, so it will fail to resolve at all. Setting the point size allows the font to have a bit of strength. Task-number: 257486 Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qcleanlooksstyle.cpp | 6 ++++++ src/gui/styles/qmacstyle_mac.mm | 8 ++++++-- src/gui/widgets/qcombobox.cpp | 6 ++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 3855ba7..01f19c6 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2042,6 +2042,12 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o s = s.left(t); } QFont font = menuitem->font; + // font may not have any "hard" flags set. We override + // the point size so that when it is resolved against the device, this font will win. + // This is mainly to handle cases where someone sets the font on the window + // and then the combo inherits it and passes it onward. At that point the resolve mask + // is very, very weak. This makes it stonger. + font.setPointSizeF(menuItem->font.pointSizeF()); if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index b20db5b..c08009b 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3991,8 +3991,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter const int xm = macItemFrame + maxpmw + macItemHMargin; QFont myFont = mi->font; - if (mi->state & QStyle::State_Mini) - myFont.setPointSize(mi->font.pointSize()); + // myFont may not have any "hard" flags set. We override + // the point size so that when it is resolved against the device, this font will win. + // This is mainly to handle cases where someone sets the font on the window + // and then the combo inherits it and passes it onward. At that point the resolve mask + // is very, very weak. This makes it stonger. + myFont.setPointSizeF(mi->font.pointSizeF()); p->setFont(myFont); p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1, contentRect.height(), text_flags ^ Qt::AlignRight, s); diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 1ca878d..097f3d0 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -148,8 +148,10 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt menuOption.rect = option.rect; // Make sure fonts set on the combo box also overrides the font for the popup menu. - if (mCombo->testAttribute(Qt::WA_SetFont) || mCombo->testAttribute(Qt::WA_MacSmallSize) - || mCombo->testAttribute(Qt::WA_MacMiniSize)) + if (mCombo->testAttribute(Qt::WA_SetFont) + || mCombo->testAttribute(Qt::WA_MacSmallSize) + || mCombo->testAttribute(Qt::WA_MacMiniSize) + || mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont())) menuOption.font = mCombo->font(); else menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font()); -- cgit v0.12 From cb3bddc9a5e4a664500eec3997dedadd67de3652 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:47:50 +0200 Subject: tst_qnetworkreply: qDebug instead of qWarning --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 18919a7..ff315de 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3186,7 +3186,7 @@ void tst_QNetworkReply::httpDownloadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; delete reply; -- cgit v0.12 From d54224252d56a50b42c8991308840ea1acde8f30 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:51:25 +0200 Subject: tst_qnetworkreply: qDebug instead of qWarning --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 8318b60..cb1cb9b 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3185,7 +3185,7 @@ void tst_QNetworkReply::httpUploadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; reader.exit(); @@ -3815,7 +3815,7 @@ void tst_QNetworkReply::httpDownloadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; delete reply; -- cgit v0.12 From 32182d107fa75e5619ecc91a81f50626f429ebe1 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 13 Jul 2009 14:03:39 +0200 Subject: QTreeView: now dragging lots of items is fast --- src/corelib/kernel/qabstractitemmodel.cpp | 2 +- src/corelib/kernel/qmimedata.cpp | 2 +- src/corelib/kernel/qvariant.cpp | 4 +-- src/gui/itemviews/qabstractitemview.cpp | 2 +- src/gui/itemviews/qlistview.cpp | 1 - src/gui/itemviews/qtreeview.cpp | 44 +++++++++++++++++++++++++++++++ src/gui/itemviews/qtreeview_p.h | 2 ++ 7 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 914f44f..1c3371f 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1407,7 +1407,7 @@ QMap QAbstractItemModel::itemData(const QModelIndex &index) const QMap roles; for (int i = 0; i < Qt::UserRole; ++i) { QVariant variantData = data(index, i); - if (variantData.type() != QVariant::Invalid) + if (variantData.isValid()) roles.insert(i, variantData); } return roles; diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 3d2a7cb..4a1ba9f 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -105,7 +105,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty Q_Q(const QMimeData); QVariant data = q->retrieveData(format, type); - if (data.type() == type || data.type() == QVariant::Invalid) + if (data.type() == type || !data.isValid()) return data; // provide more conversion possiblities than just what QVariant provides diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 8bf70cb..2ef9de4 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1905,7 +1905,7 @@ void QVariant::load(QDataStream &s) create(static_cast(u), 0); d.is_null = is_null; - if (d.type == QVariant::Invalid) { + if (!isValid()) { // Since we wrote something, we should read something QString x; s >> x; @@ -1949,7 +1949,7 @@ void QVariant::save(QDataStream &s) const s << QMetaType::typeName(userType()); } - if (d.type == QVariant::Invalid) { + if (!isValid()) { s << QString(); return; } diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index a4a69c3..8887977 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3918,7 +3918,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QStyleOptionViewItemV4 option = viewOptionsV4(); option.state |= QStyle::State_Selected; for (int j = 0; j < paintPairs.count(); ++j) { - option.rect = paintPairs.at(j).first.translated(r->topLeft()); + option.rect = paintPairs.at(j).first.translated(-r->topLeft()); const QModelIndex ¤t = paintPairs.at(j).second; delegateForIndex(current)->paint(&painter, option, current); } diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 9a94b31..40f28d4 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -722,7 +722,6 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList QRect &rect = *r; const QRect viewportRect = viewport->rect(); QItemViewPaintPairs ret; - intersectingSet(viewportRect); const QSet visibleIndexes = intersectingSet(viewportRect).toList().toSet(); for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index f13ff0c..7084e6d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1321,6 +1321,50 @@ void QTreeViewPrivate::_q_modelDestroyed() } /*! + \reimp + + We have a QTreeView way of knowing what elements are on the viewport +*/ +QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r); + Q_Q(const QTreeView); + QRect &rect = *r; + const QRect viewportRect = viewport->rect(); + int itemOffset = 0; + int row = firstVisibleItem(&itemOffset); + QPair startEnd = startAndEndColumns(viewportRect); + QVector columns; + for (int i = startEnd.first; i <= startEnd.second; ++i) { + int logical = header->logicalIndex(i); + if (!header->isSectionHidden(logical)) + columns += logical; + } + QSet visibleIndexes; + for (; itemOffset < viewportRect.bottom() && row < viewItems.count(); ++row) { + const QModelIndex &index = viewItems.at(row).index; + for (int colIndex = 0; colIndex < columns.count(); ++colIndex) + visibleIndexes += index.sibling(index.row(), columns.at(colIndex)); + itemOffset += itemHeight(row); + } + + //now that we have the visible indexes, we can try to find those which are selected + QItemViewPaintPairs ret; + for (int i = 0; i < indexes.count(); ++i) { + const QModelIndex &index = indexes.at(i); + if (visibleIndexes.contains(index)) { + const QRect current = q->visualRect(index); + ret += qMakePair(current, index); + rect |= current; + } + } + rect &= viewportRect; + return ret; +} + + +/*! \since 4.2 Draws the part of the tree intersecting the given \a region using the specified \a painter. diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 6fb2e41..546dc75 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -89,6 +89,8 @@ public: ~QTreeViewPrivate() {} void initialize(); + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + #ifndef QT_NO_ANIMATION struct AnimatedOperation : public QVariantAnimation { -- cgit v0.12 From eb594be13ae17361c1de3539e34e84a1d8c324c5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Jul 2009 15:14:19 +0200 Subject: fix bug in qmake DEPLOYMENT variable The documentation states "The default deployment target path for Windows CE is %CSIDL_PROGRAM_FILES%\target, which usually gets expanded to \Program Files\target." Now this statement is true. Task-number: 257053 Reviewed-by: mauricek --- qmake/generators/win32/msvc_vcproj.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 50f78d7..5f250bf 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1239,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool() foreach(QString item, project->values("DEPLOYMENT")) { // get item.path QString devicePath = project->first(item + ".path"); - // if the path does not exist, skip it if (devicePath.isEmpty()) - continue; + devicePath = targetPath; // check if item.path is relative (! either /,\ or %) if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') -- cgit v0.12 From f7a11ee28484320129fec25c00e0f616ff6751bc Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Jul 2009 15:29:37 +0200 Subject: doc: Use \inheaderfile to show which include file to include. Letting qdoc output it automatically produces the wrong header file name. Task-number: 217268 210171 220664 --- doc/src/qsql.qdoc | 1 + src/corelib/concurrent/qtconcurrentmap.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/src/qsql.qdoc b/doc/src/qsql.qdoc index 0f690e8..bb8f090 100644 --- a/doc/src/qsql.qdoc +++ b/doc/src/qsql.qdoc @@ -45,6 +45,7 @@ \brief The QSql namespace contains miscellaneous identifiers used throughout the Qt SQL library. + \inheaderfile QtSql \ingroup database \mainclass diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index 46d2400..797f335 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -48,7 +48,7 @@ threading primitives. See the \l {threads.html#qtconcurrent-intro}{Qt Concurrent} section in the \l{threads.html}{threading} documentation. - + \inheaderfile QtCore \ingroup thread */ -- cgit v0.12 From 45efa082135cbf97820a5ce7025685d22bd926ce Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 22:19:46 +0200 Subject: factor out linguist-specific part it is simpler to keep it in sync with creator then. --- tools/linguist/lrelease/main.cpp | 2 +- tools/linguist/lupdate/main.cpp | 1 + tools/linguist/shared/profileevaluator.cpp | 60 ---------------- tools/linguist/shared/profileevaluator.h | 6 -- tools/linguist/shared/proparser.pri | 2 + tools/linguist/shared/proreader.cpp | 108 +++++++++++++++++++++++++++++ tools/linguist/shared/proreader.h | 56 +++++++++++++++ 7 files changed, 168 insertions(+), 67 deletions(-) create mode 100644 tools/linguist/shared/proreader.cpp create mode 100644 tools/linguist/shared/proreader.h diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 905a399..845dcb8 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -41,7 +41,7 @@ #include "translator.h" #include "translatortools.h" -#include "profileevaluator.h" +#include "proreader.h" #include #include diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 52a57fb..6e8b941 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -42,6 +42,7 @@ #include "translator.h" #include "translatortools.h" #include "profileevaluator.h" +#include "proreader.h" #include #include diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 4ea9c10..54c5d9a 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1726,64 +1726,4 @@ void ProFileEvaluator::setVerbose(bool on) d->m_verbose = on; } -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) -{ - QStringList sourceFiles; - QString codecForTr; - QString codecForSource; - QStringList tsFileNames; - - // app/lib template - sourceFiles += visitor.values(QLatin1String("SOURCES")); - sourceFiles += visitor.values(QLatin1String("HEADERS")); - tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); - - QStringList trcodec = visitor.values(QLatin1String("CODEC")) - + visitor.values(QLatin1String("DEFAULTCODEC")) - + visitor.values(QLatin1String("CODECFORTR")); - if (!trcodec.isEmpty()) - codecForTr = trcodec.last(); - - QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC")); - if (!srccodec.isEmpty()) - codecForSource = srccodec.last(); - - QStringList forms = visitor.values(QLatin1String("INTERFACES")) - + visitor.values(QLatin1String("FORMS")) - + visitor.values(QLatin1String("FORMS3")); - sourceFiles << forms; - - sourceFiles.sort(); - sourceFiles.removeDuplicates(); - tsFileNames.sort(); - tsFileNames.removeDuplicates(); - - varMap->insert("SOURCES", sourceFiles); - varMap->insert("CODECFORTR", QStringList() << codecForTr); - varMap->insert("CODECFORSRC", QStringList() << codecForSource); - varMap->insert("TRANSLATIONS", tsFileNames); -} - -bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap) -{ - QFileInfo fi(fileName); - if (!fi.exists()) - return false; - - ProFile pro(fi.absoluteFilePath()); - - ProFileEvaluator visitor; - visitor.setVerbose(verbose); - - if (!visitor.queryProFile(&pro)) - return false; - - if (!visitor.accept(&pro)) - return false; - - evaluateProFile(visitor, varMap); - - return true; -} - QT_END_NAMESPACE diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index 5f35ea8..78d8fce 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -52,12 +52,6 @@ QT_BEGIN_NAMESPACE -class ProFile; -class ProFileEvaluator; - -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); -bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); - class ProFileEvaluator { public: diff --git a/tools/linguist/shared/proparser.pri b/tools/linguist/shared/proparser.pri index 372247e..99d32e7 100644 --- a/tools/linguist/shared/proparser.pri +++ b/tools/linguist/shared/proparser.pri @@ -2,11 +2,13 @@ INCLUDEPATH *= $$PWD HEADERS += \ + $$PWD/proreader.h \ $$PWD/abstractproitemvisitor.h \ $$PWD/proitems.h \ $$PWD/profileevaluator.h \ $$PWD/proparserutils.h SOURCES += \ + $$PWD/proreader.cpp \ $$PWD/proitems.cpp \ $$PWD/profileevaluator.cpp diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp new file mode 100644 index 0000000..492c2ef --- /dev/null +++ b/tools/linguist/shared/proreader.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "profileevaluator.h" + +#include + +QT_BEGIN_NAMESPACE + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) +{ + QStringList sourceFiles; + QString codecForTr; + QString codecForSource; + QStringList tsFileNames; + + // app/lib template + sourceFiles += visitor.values(QLatin1String("SOURCES")); + sourceFiles += visitor.values(QLatin1String("HEADERS")); + tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); + + QStringList trcodec = visitor.values(QLatin1String("CODEC")) + + visitor.values(QLatin1String("DEFAULTCODEC")) + + visitor.values(QLatin1String("CODECFORTR")); + if (!trcodec.isEmpty()) + codecForTr = trcodec.last(); + + QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC")); + if (!srccodec.isEmpty()) + codecForSource = srccodec.last(); + + QStringList forms = visitor.values(QLatin1String("INTERFACES")) + + visitor.values(QLatin1String("FORMS")) + + visitor.values(QLatin1String("FORMS3")); + sourceFiles << forms; + + sourceFiles.sort(); + sourceFiles.removeDuplicates(); + tsFileNames.sort(); + tsFileNames.removeDuplicates(); + + varMap->insert("SOURCES", sourceFiles); + varMap->insert("CODECFORTR", QStringList() << codecForTr); + varMap->insert("CODECFORSRC", QStringList() << codecForSource); + varMap->insert("TRANSLATIONS", tsFileNames); +} + +bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap) +{ + QFileInfo fi(fileName); + if (!fi.exists()) + return false; + + ProFile pro(fi.absoluteFilePath()); + + ProFileEvaluator visitor; + visitor.setVerbose(verbose); + + if (!visitor.queryProFile(&pro)) + return false; + + if (!visitor.accept(&pro)) + return false; + + evaluateProFile(visitor, varMap); + + return true; +} + +QT_END_NAMESPACE diff --git a/tools/linguist/shared/proreader.h b/tools/linguist/shared/proreader.h new file mode 100644 index 0000000..31e2e6f --- /dev/null +++ b/tools/linguist/shared/proreader.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PROREADER_H +#define PROREADER_H + +#include + +QT_BEGIN_NAMESPACE + +class ProFileEvaluator; + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); +bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); + +QT_END_NAMESPACE + +#endif // PROREADER_H -- cgit v0.12 From e2f381365bf2158095c5c7236fc4b2f842b9fa8c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 13 Jul 2009 16:20:44 +0200 Subject: implement proper vpath handling this also removes the bogus special casing of various filename-containing variables inside the pro parser. while this is a feature as such, it restores backwards compatibility without damaging the correct behavior again, so it qualifies for 4.5. based on a2f40fce2a1cf3c19a13fa27eea08192493ab76e from creator Task-number: 254098 --- .../testdata/good/proparsingpaths/file1.cpp | 9 ++ .../testdata/good/proparsingpaths/filter.cpp | 9 ++ .../testdata/good/proparsingpaths/project.pro | 10 ++ .../good/proparsingpaths/project.ts.result | 31 +++++ .../testdata/good/proparsingpaths/sub/sub.pri | 3 + .../testdata/good/proparsingpaths/sub/subfile1.cpp | 9 ++ .../good/proparsingpaths/sub/subfilter.cpp | 9 ++ tools/linguist/lupdate/main.cpp | 2 +- tools/linguist/shared/profileevaluator.cpp | 155 +++++++-------------- tools/linguist/shared/profileevaluator.h | 4 + tools/linguist/shared/proreader.cpp | 43 ++++-- tools/linguist/shared/proreader.h | 3 +- 12 files changed, 173 insertions(+), 114 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp new file mode 100644 index 0000000..ad87e70 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp new file mode 100644 index 0000000..912963d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level direct"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro new file mode 100644 index 0000000..820b4fa --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro @@ -0,0 +1,10 @@ +SOURCES += file*.cpp filter.cpp non-existing.cpp + +include(sub/sub.pri) + +TRANSLATIONS = project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result new file mode 100644 index 0000000..470d6eb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result @@ -0,0 +1,31 @@ + + + + + QApplication + + + Hello world + top-level wildcard + + + + + Hello world + top-level direct + + + + + Hello world + nested wildcard + + + + + Hello world + nested direct + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri new file mode 100644 index 0000000..a6079f9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri @@ -0,0 +1,3 @@ +VPATH += $$PWD + +SOURCES += sub/subfile?.cpp subfilter.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp new file mode 100644 index 0000000..807d296 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp new file mode 100644 index 0000000..6e5dd25 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested direct"); +} + + diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6e8b941..78e5b5f 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -452,7 +452,7 @@ int main(int argc, char **argv) continue; } - evaluateProFile(visitor, &variables); + evaluateProFile(visitor, &variables, pfi.absolutePath()); sourceFiles = variables.value("SOURCES"); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 54c5d9a..3b8a1b8 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -107,9 +107,6 @@ public: QString propertyValue(const QString &val) const; bool isActiveConfig(const QString &config, bool regex = false); - QStringList expandPattern(const QString &pattern); - void expandPatternHelper(const QString &relName, const QString &absName, - QStringList &sources_out); QStringList expandVariableReferences(const QString &value); QStringList evaluateExpandFunction(const QString &function, const QString &arguments); QString format(const char *format) const; @@ -559,29 +556,6 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) m_prevLineNo = m_lineNo; m_prevProFile = currentProFile(); - // The following two blocks fix bug 180128 by making all "interesting" - // file name absolute in each .pro file, not just the top most one - if (varName == QLatin1String("SOURCES") - || varName == QLatin1String("HEADERS") - || varName == QLatin1String("INTERFACES") - || varName == QLatin1String("FORMS") - || varName == QLatin1String("FORMS3") - || varName == QLatin1String("RESOURCES")) { - // matches only existent files, expand certain(?) patterns - QStringList vv; - for (int i = v.count(); --i >= 0; ) - vv << expandPattern(v[i]); - v = vv; - } - - if (varName == QLatin1String("TRANSLATIONS")) { - // also matches non-existent files, but does not expand pattern - QString dir = QFileInfo(currentFileName()).absolutePath(); - dir += QLatin1Char('/'); - for (int i = v.count(); --i >= 0; ) - v[i] = QFileInfo(dir, v[i]).absoluteFilePath(); - } - switch (m_variableOperator) { case ProVariable::UniqueAddOperator: // * insertUnique(&m_valuemap, varName, v, true); @@ -1537,82 +1511,6 @@ bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName, boo return fn.isEmpty() ? false : evaluateFile(fn, result); } -void ProFileEvaluator::Private::expandPatternHelper(const QString &relName, const QString &absName, - QStringList &sources_out) -{ - const QStringList vpaths = values(QLatin1String("VPATH")) - + values(QLatin1String("QMAKE_ABSOLUTE_SOURCE_PATH")) - + values(QLatin1String("DEPENDPATH")) - + values(QLatin1String("VPATH_SOURCES")); - - QFileInfo fi(absName); - bool found = fi.exists(); - // Search in all vpaths - if (!found) { - foreach (const QString &vpath, vpaths) { - fi.setFile(vpath + QDir::separator() + relName); - if (fi.exists()) { - found = true; - break; - } - } - } - - if (found) { - sources_out += fi.absoluteFilePath(); // Not resolving symlinks - } else { - QString val = relName; - QString dir; - QString wildcard = val; - QString real_dir; - if (wildcard.lastIndexOf(QLatin1Char('/')) != -1) { - dir = wildcard.left(wildcard.lastIndexOf(QLatin1Char('/')) + 1); - real_dir = dir; - wildcard = wildcard.right(wildcard.length() - dir.length()); - } - - if (real_dir.isEmpty() || QFileInfo(real_dir).exists()) { - QStringList files = QDir(real_dir).entryList(QStringList(wildcard)); - if (files.isEmpty()) { - q->logMessage(format("Failure to find %1").arg(val)); - } else { - QString a; - for (int i = files.count() - 1; i >= 0; --i) { - if (files[i] == QLatin1String(".") || files[i] == QLatin1String("..")) - continue; - a = dir + files[i]; - sources_out += a; - } - } - } else { - q->logMessage(format("Cannot match %1/%2, as %3 does not exist.") - .arg(real_dir).arg(wildcard).arg(real_dir)); - } - } -} - - -/* - * Lookup of files are done in this order: - * 1. look in pwd - * 2. look in vpaths - * 3. expand wild card files relative from the profiles folder - **/ - -// FIXME: This code supports something that I'd consider a flaw in .pro file syntax -// which is not even documented. So arguably this can be ditched completely... -QStringList ProFileEvaluator::Private::expandPattern(const QString& pattern) -{ - if (!currentProFile()) - return QStringList(); - - QStringList sources_out; - const QString absName = QDir::cleanPath(QDir::current().absoluteFilePath(pattern)); - - expandPatternHelper(pattern, absName, sources_out); - return sources_out; -} - QString ProFileEvaluator::Private::format(const char *fmt) const { ProFile *pro = currentProFile(); @@ -1654,6 +1552,59 @@ QStringList ProFileEvaluator::values(const QString &variableName, const ProFile return d->values(variableName, pro); } +QStringList ProFileEvaluator::absolutePathValues( + const QString &variable, const QString &baseDirectory) const +{ + QStringList result; + foreach (const QString &el, values(variable)) { + const QFileInfo info = QFileInfo(baseDirectory, el); + if (info.isDir()) + result << QDir::cleanPath(info.absoluteFilePath()); + } + return result; +} + +QStringList ProFileEvaluator::absoluteFileValues( + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + const ProFile *pro) const +{ + QStringList result; + foreach (const QString &el, pro ? values(variable, pro) : values(variable)) { + QFileInfo info(el); + if (info.isAbsolute()) { + if (info.exists()) { + result << QDir::cleanPath(el); + goto next; + } + } else { + foreach (const QString &dir, searchDirs) { + QFileInfo info(dir, el); + if (info.isFile()) { + result << QDir::cleanPath(info.filePath()); + goto next; + } + } + if (baseDirectory.isEmpty()) + goto next; + info = QFileInfo(baseDirectory, el); + } + { + QFileInfo baseInfo(info.absolutePath()); + if (baseInfo.exists()) { + QString wildcard = info.fileName(); + if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) { + QDir theDir(QDir::cleanPath(baseInfo.filePath())); + foreach (const QString &fn, theDir.entryList(QStringList(wildcard))) + if (fn != QLatin1String(".") && fn != QLatin1String("..")) + result << theDir.absoluteFilePath(fn); + } + } + } + next: ; + } + return result; +} + ProFileEvaluator::TemplateType ProFileEvaluator::templateType() { QStringList templ = values(QLatin1String("TEMPLATE")); diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index 78d8fce..ae09a59 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -76,6 +76,10 @@ public: void addProperties(const QHash &properties); QStringList values(const QString &variableName) const; QStringList values(const QString &variableName, const ProFile *pro) const; + QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const; + QStringList absoluteFileValues( + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + const ProFile *pro) const; QString propertyValue(const QString &val) const; // for our descendents diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp index 492c2ef..3400f20 100644 --- a/tools/linguist/shared/proreader.cpp +++ b/tools/linguist/shared/proreader.cpp @@ -41,21 +41,49 @@ #include "profileevaluator.h" +#include #include QT_BEGIN_NAMESPACE -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) +static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, + const QString &projectDir, const ProFileEvaluator &visitor) { + QStringList vPaths = + visitor.absolutePathValues(QLatin1String(vvar), projectDir); + vPaths += baseVPaths; + vPaths.removeDuplicates(); + return visitor.absoluteFileValues(QLatin1String(var), projectDir, vPaths, 0); +} + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap, + const QString &projectDir) +{ + QStringList baseVPaths; + baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir); + baseVPaths << projectDir; // QMAKE_ABSOLUTE_SOURCE_PATH + baseVPaths += visitor.absolutePathValues(QLatin1String("DEPENDPATH"), projectDir); + baseVPaths.removeDuplicates(); + QStringList sourceFiles; QString codecForTr; QString codecForSource; QStringList tsFileNames; // app/lib template - sourceFiles += visitor.values(QLatin1String("SOURCES")); - sourceFiles += visitor.values(QLatin1String("HEADERS")); - tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); + sourceFiles += getSources("SOURCES", "VPATH_SOURCES", baseVPaths, projectDir, visitor); + + sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor); + sourceFiles += getSources("FORMS3", "VPATH_FORMS3", baseVPaths, projectDir, visitor); + + QStringList vPathsInc = baseVPaths; + vPathsInc += visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir); + vPathsInc.removeDuplicates(); + sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0); + + QDir proDir(projectDir); + foreach (const QString &tsFile, visitor.values(QLatin1String("TRANSLATIONS"))) + tsFileNames << QFileInfo(proDir, tsFile).filePath(); QStringList trcodec = visitor.values(QLatin1String("CODEC")) + visitor.values(QLatin1String("DEFAULTCODEC")) @@ -67,11 +95,6 @@ void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap, + const QString &projectDir); bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); QT_END_NAMESPACE -- cgit v0.12 From 8f65472671406ad5881b119ba32b075b828bbb1a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 16:57:38 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( eb4957a561d3f85d4cd5602832375c66f378b521 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit since the last update: ++ b/LayoutTests/ChangeLog 2009-06-04 Ariya Hidayat Rubber-stamped by Tor Arne Vestbø. Added Qt-specific expected result for Canvas pointInPath's test. Qt's QPainterPath::contains(point) returns false if the point is exactly along one of the edges (except the origin). Until we find a workaround for this, compensate it in the expected result. * platform/qt/fast/canvas/pointInPath-expected.txt: Added. 2009-01-11 Simon Fraser Reviewed by Oliver Hunt https://bugs.webkit.org/show_bug.cgi?id=23242 Add testcase for incremental repaint after use of ctx.transform(), and enhanced isPointInPath testcase to do testing after use of ctx.transform(). * fast/canvas/canvas-incremental-repaint-2.html: Added. * fast/canvas/pointInPath-expected.txt: * fast/canvas/pointInPath.js: * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.checksum: Added. * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.png: Added. * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.txt: Added. ++ b/WebCore/ChangeLog 2008-12-18 Bernhard Rosenkraenzer Reviewed by Darin Adler. https://bugs.webkit.org/show_bug.cgi?id=22205 Fix compatibility with bison 2.4, partially based on older patch by Priit Laes * WebCore/css/CSSGrammar.y: Made compatible with bison 2.4 2009-07-13 Cédric Luthi Reviewed by Tor Arne Vestbø. Fix NPWindow clip rect in PluginViewMac The rect should be in window-coordinates. This bug can be observed with Flash 10 here: http://www.permadi.com/tutorial/cursorTracker/ * plugins/mac/PluginViewMac.cpp: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix Qt implementation of WebCore::directoryName to return the absolute directory name instead of the base file name. * platform/qt/FileSystemQt.cpp: (WebCore::directoryName): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix WebCore::Path::isEmpty() for the Qt port to return true if there is no element in the path. QPainterPath::isEmpty() returns also true if there is one single MoveTo element inside, which makes sense but doesn't patch Webcore's is-empty definition. * platform/graphics/qt/PathQt.cpp: (WebCore::Path::isEmpty): Use elementCount() == 0. 2009-01-11 Simon Fraser Reviewed by Oliver Hunt https://bugs.webkit.org/show_bug.cgi?id=23242 Fix CanvasRenderingContext2D::transform to do a pre-multiply, rather than a post-multiply into m_transform. This bug did not affect drawing, but did cause m_transform to be incorrect, which impacted willDraw(), and isPointInPath. Test: fast/canvas/canvas-incremental-repaint-2.html * html/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::transform): 2009-07-04 Sriram Yadavalli Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=26439 QtWebKit fails in loading www.nytimes.com in Windows/Linux QNetworkReplyHandler is ignoring content associated with 401 error. This causes the XHR response handling to fail. Simon: Added also ProxyAuthenticationRequiredError, to handle the same case when going through proxies, as suggested by Prasanth. * platform/network/qt/QNetworkReplyHandler.cpp: (WebCore::QNetworkReplyHandler::finish): ++ b/WebKit/qt/ChangeLog Fix crash with plugins when the plugin stream is cancelled. Similar to r26667 handle the case where didReceiveResponse on the plugin view results in failure to set up the stream and setMainDocumentError being called instead. This will set the m_pluginView back to 0 and we need check for it before calling didReceiveData. This was triggered by consecutive execution of LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::committedLoad): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. --- .../webkit/JavaScriptCore/generated/Grammar.cpp | 1002 ++++++--- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 78 + src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 10 +- .../webkit/WebCore/generated/CSSGrammar.cpp | 2342 ++++++++++++-------- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 231 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 1002 ++++++--- src/3rdparty/webkit/WebCore/generated/Grammar.h | 109 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 418 ++-- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- .../WebCore/html/CanvasRenderingContext2D.cpp | 4 +- .../webkit/WebCore/platform/graphics/qt/PathQt.cpp | 4 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 6 +- .../webkit/WebCore/platform/qt/FileSystemQt.cpp | 2 +- .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 8 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 19 + .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 5 + 18 files changed, 3375 insertions(+), 2040 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp index 1652b24..d25683a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,159 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse jscyyparse -#define yylex jscyylex -#define yyerror jscyyerror -#define yylval jscyylval -#define yychar jscyychar -#define yydebug jscyydebug -#define yynerrs jscyynerrs -#define yylloc jscyylloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NULLTOKEN = 258, - TRUETOKEN = 259, - FALSETOKEN = 260, - BREAK = 261, - CASE = 262, - DEFAULT = 263, - FOR = 264, - NEW = 265, - VAR = 266, - CONSTTOKEN = 267, - CONTINUE = 268, - FUNCTION = 269, - RETURN = 270, - VOIDTOKEN = 271, - DELETETOKEN = 272, - IF = 273, - THISTOKEN = 274, - DO = 275, - WHILE = 276, - INTOKEN = 277, - INSTANCEOF = 278, - TYPEOF = 279, - SWITCH = 280, - WITH = 281, - RESERVED = 282, - THROW = 283, - TRY = 284, - CATCH = 285, - FINALLY = 286, - DEBUGGER = 287, - IF_WITHOUT_ELSE = 288, - ELSE = 289, - EQEQ = 290, - NE = 291, - STREQ = 292, - STRNEQ = 293, - LE = 294, - GE = 295, - OR = 296, - AND = 297, - PLUSPLUS = 298, - MINUSMINUS = 299, - LSHIFT = 300, - RSHIFT = 301, - URSHIFT = 302, - PLUSEQUAL = 303, - MINUSEQUAL = 304, - MULTEQUAL = 305, - DIVEQUAL = 306, - LSHIFTEQUAL = 307, - RSHIFTEQUAL = 308, - URSHIFTEQUAL = 309, - ANDEQUAL = 310, - MODEQUAL = 311, - XOREQUAL = 312, - OREQUAL = 313, - OPENBRACE = 314, - CLOSEBRACE = 315, - NUMBER = 316, - IDENT = 317, - STRING = 318, - AUTOPLUSPLUS = 319, - AUTOMINUSMINUS = 320 - }; -#endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - - - +#define yyparse jscyyparse +#define yylex jscyylex +#define yyerror jscyyerror +#define yylval jscyylval +#define yychar jscyychar +#define yydebug jscyydebug +#define yynerrs jscyynerrs +#define yylloc jscyylloc /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 3 "../parser/Grammar.y" @@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD +/* Line 189 of yacc.c */ +#line 236 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NULLTOKEN = 258, + TRUETOKEN = 259, + FALSETOKEN = 260, + BREAK = 261, + CASE = 262, + DEFAULT = 263, + FOR = 264, + NEW = 265, + VAR = 266, + CONSTTOKEN = 267, + CONTINUE = 268, + FUNCTION = 269, + RETURN = 270, + VOIDTOKEN = 271, + DELETETOKEN = 272, + IF = 273, + THISTOKEN = 274, + DO = 275, + WHILE = 276, + INTOKEN = 277, + INSTANCEOF = 278, + TYPEOF = 279, + SWITCH = 280, + WITH = 281, + RESERVED = 282, + THROW = 283, + TRY = 284, + CATCH = 285, + FINALLY = 286, + DEBUGGER = 287, + IF_WITHOUT_ELSE = 288, + ELSE = 289, + EQEQ = 290, + NE = 291, + STREQ = 292, + STRNEQ = 293, + LE = 294, + GE = 295, + OR = 296, + AND = 297, + PLUSPLUS = 298, + MINUSMINUS = 299, + LSHIFT = 300, + RSHIFT = 301, + URSHIFT = 302, + PLUSEQUAL = 303, + MINUSEQUAL = 304, + MULTEQUAL = 305, + DIVEQUAL = 306, + LSHIFTEQUAL = 307, + RSHIFTEQUAL = 308, + URSHIFTEQUAL = 309, + ANDEQUAL = 310, + MODEQUAL = 311, + XOREQUAL = 312, + OREQUAL = 313, + OPENBRACE = 314, + CLOSEBRACE = 315, + NUMBER = 316, + IDENT = 317, + STRING = 318, + AUTOPLUSPLUS = 319, + AUTOMINUSMINUS = 320 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../parser/Grammar.y" { + +/* Line 214 of yacc.c */ +#line 157 "../parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -414,13 +363,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 187 of yacc.c. */ -#line 420 "Grammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 371 "Grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -440,8 +391,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 445 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 396 "Grammar.tab.c" #ifdef short # undef short @@ -516,14 +467,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -642,12 +593,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2714,10 +2666,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2741,88 +2692,97 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -2861,6 +2821,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2882,9 +2843,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2905,6 +2866,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2913,16 +2877,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2954,20 +2918,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -3008,31 +2968,43 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 290 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NullNode(GLOBAL_DATA), 0, 1); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 291 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, true), 0, 1); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 292 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, false), 0, 1); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 293 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 294 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;} break; case 7: + +/* Line 1455 of yacc.c */ #line 295 "../parser/Grammar.y" { Lexer& l = *LEXER; @@ -3046,6 +3018,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 304 "../parser/Grammar.y" { Lexer& l = *LEXER; @@ -3059,26 +3033,36 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 316 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 317 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 318 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 319 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 321 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -3091,6 +3075,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 332 "../parser/Grammar.y" { (yyval.propertyList).m_node.head = new PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node); (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head; @@ -3099,6 +3085,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 336 "../parser/Grammar.y" { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head; (yyval.propertyList).m_node.tail = new PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail); @@ -3107,51 +3095,71 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 344 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 345 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 347 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 351 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ThisNode(GLOBAL_DATA), ThisFeature, 0); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 354 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 355 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 359 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;} break; case 26: + +/* Line 1455 of yacc.c */ #line 360 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;} break; case 27: + +/* Line 1455 of yacc.c */ #line 361 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;} break; case 28: + +/* Line 1455 of yacc.c */ #line 365 "../parser/Grammar.y" { (yyval.elementList).m_node.head = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node); (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head; @@ -3160,6 +3168,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 370 "../parser/Grammar.y" { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head; (yyval.elementList).m_node.tail = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node); @@ -3168,26 +3178,36 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 377 "../parser/Grammar.y" { (yyval.intValue) = 0; ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 382 "../parser/Grammar.y" { (yyval.intValue) = 1; ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 383 "../parser/Grammar.y" { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;} break; case 35: + +/* Line 1455 of yacc.c */ #line 388 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 389 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3196,6 +3216,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 393 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3204,6 +3226,8 @@ yyreduce: break; case 38: + +/* Line 1455 of yacc.c */ #line 397 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3212,6 +3236,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 405 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3220,6 +3246,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 409 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3228,6 +3256,8 @@ yyreduce: break; case 42: + +/* Line 1455 of yacc.c */ #line 413 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3236,6 +3266,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 421 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3244,6 +3276,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 429 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3252,16 +3286,22 @@ yyreduce: break; case 47: + +/* Line 1455 of yacc.c */ #line 436 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 437 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 438 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3270,6 +3310,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 442 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3277,16 +3319,22 @@ yyreduce: break; case 51: + +/* Line 1455 of yacc.c */ #line 448 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 449 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 53: + +/* Line 1455 of yacc.c */ #line 450 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3295,6 +3343,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 454 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3303,16 +3353,22 @@ yyreduce: break; case 55: + +/* Line 1455 of yacc.c */ #line 461 "../parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA), 0, 0); ;} break; case 56: + +/* Line 1455 of yacc.c */ #line 462 "../parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 466 "../parser/Grammar.y" { (yyval.argumentList).m_node.head = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node); (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head; @@ -3321,6 +3377,8 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 470 "../parser/Grammar.y" { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head; (yyval.argumentList).m_node.tail = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node); @@ -3329,181 +3387,253 @@ yyreduce: break; case 64: + +/* Line 1455 of yacc.c */ #line 488 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 489 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 494 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 495 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 499 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 500 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 501 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 502 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 503 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 74: + +/* Line 1455 of yacc.c */ #line 504 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 75: + +/* Line 1455 of yacc.c */ #line 505 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 76: + +/* Line 1455 of yacc.c */ #line 506 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 77: + +/* Line 1455 of yacc.c */ #line 507 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 78: + +/* Line 1455 of yacc.c */ #line 508 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 509 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 523 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 86: + +/* Line 1455 of yacc.c */ #line 524 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 87: + +/* Line 1455 of yacc.c */ #line 525 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 531 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 533 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 535 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 540 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 541 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 547 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 97: + +/* Line 1455 of yacc.c */ #line 549 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 554 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 555 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 556 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 561 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 562 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 563 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 568 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 569 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 570 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 571 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 572 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3511,6 +3641,8 @@ yyreduce: break; case 112: + +/* Line 1455 of yacc.c */ #line 575 "../parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3518,26 +3650,36 @@ yyreduce: break; case 114: + +/* Line 1455 of yacc.c */ #line 582 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 583 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 584 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 585 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 587 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3545,26 +3687,36 @@ yyreduce: break; case 120: + +/* Line 1455 of yacc.c */ #line 594 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 595 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 596 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 597 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 599 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3572,6 +3724,8 @@ yyreduce: break; case 125: + +/* Line 1455 of yacc.c */ #line 603 "../parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3579,156 +3733,218 @@ yyreduce: break; case 127: + +/* Line 1455 of yacc.c */ #line 610 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 611 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 612 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 613 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 619 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 621 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 623 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 625 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 631 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 632 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 634 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 636 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 641 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 647 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 652 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 657 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 663 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 669 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 674 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 680 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 686 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 160: + +/* Line 1455 of yacc.c */ #line 691 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 697 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 703 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 166: + +/* Line 1455 of yacc.c */ #line 708 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 714 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 170: + +/* Line 1455 of yacc.c */ #line 719 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 172: + +/* Line 1455 of yacc.c */ #line 725 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 174: + +/* Line 1455 of yacc.c */ #line 731 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 176: + +/* Line 1455 of yacc.c */ #line 737 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 178: + +/* Line 1455 of yacc.c */ #line 743 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3736,6 +3952,8 @@ yyreduce: break; case 180: + +/* Line 1455 of yacc.c */ #line 751 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3743,6 +3961,8 @@ yyreduce: break; case 182: + +/* Line 1455 of yacc.c */ #line 759 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3750,99 +3970,137 @@ yyreduce: break; case 183: + +/* Line 1455 of yacc.c */ #line 765 "../parser/Grammar.y" { (yyval.op) = OpEqual; ;} break; case 184: + +/* Line 1455 of yacc.c */ #line 766 "../parser/Grammar.y" { (yyval.op) = OpPlusEq; ;} break; case 185: + +/* Line 1455 of yacc.c */ #line 767 "../parser/Grammar.y" { (yyval.op) = OpMinusEq; ;} break; case 186: + +/* Line 1455 of yacc.c */ #line 768 "../parser/Grammar.y" { (yyval.op) = OpMultEq; ;} break; case 187: + +/* Line 1455 of yacc.c */ #line 769 "../parser/Grammar.y" { (yyval.op) = OpDivEq; ;} break; case 188: + +/* Line 1455 of yacc.c */ #line 770 "../parser/Grammar.y" { (yyval.op) = OpLShift; ;} break; case 189: + +/* Line 1455 of yacc.c */ #line 771 "../parser/Grammar.y" { (yyval.op) = OpRShift; ;} break; case 190: + +/* Line 1455 of yacc.c */ #line 772 "../parser/Grammar.y" { (yyval.op) = OpURShift; ;} break; case 191: + +/* Line 1455 of yacc.c */ #line 773 "../parser/Grammar.y" { (yyval.op) = OpAndEq; ;} break; case 192: + +/* Line 1455 of yacc.c */ #line 774 "../parser/Grammar.y" { (yyval.op) = OpXOrEq; ;} break; case 193: + +/* Line 1455 of yacc.c */ #line 775 "../parser/Grammar.y" { (yyval.op) = OpOrEq; ;} break; case 194: + +/* Line 1455 of yacc.c */ #line 776 "../parser/Grammar.y" { (yyval.op) = OpModEq; ;} break; case 196: + +/* Line 1455 of yacc.c */ #line 781 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 198: + +/* Line 1455 of yacc.c */ #line 786 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 200: + +/* Line 1455 of yacc.c */ #line 791 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 218: + +/* Line 1455 of yacc.c */ #line 815 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 219: + +/* Line 1455 of yacc.c */ #line 817 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 220: + +/* Line 1455 of yacc.c */ #line 822 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 221: + +/* Line 1455 of yacc.c */ #line 824 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); @@ -3850,6 +4108,8 @@ yyreduce: break; case 222: + +/* Line 1455 of yacc.c */ #line 830 "../parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3861,6 +4121,8 @@ yyreduce: break; case 223: + +/* Line 1455 of yacc.c */ #line 837 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3874,6 +4136,8 @@ yyreduce: break; case 224: + +/* Line 1455 of yacc.c */ #line 847 "../parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3885,6 +4149,8 @@ yyreduce: break; case 225: + +/* Line 1455 of yacc.c */ #line 855 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3898,6 +4164,8 @@ yyreduce: break; case 226: + +/* Line 1455 of yacc.c */ #line 867 "../parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3909,6 +4177,8 @@ yyreduce: break; case 227: + +/* Line 1455 of yacc.c */ #line 874 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3922,6 +4192,8 @@ yyreduce: break; case 228: + +/* Line 1455 of yacc.c */ #line 884 "../parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3933,6 +4205,8 @@ yyreduce: break; case 229: + +/* Line 1455 of yacc.c */ #line 892 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3946,18 +4220,24 @@ yyreduce: break; case 230: + +/* Line 1455 of yacc.c */ #line 904 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 231: + +/* Line 1455 of yacc.c */ #line 907 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 232: + +/* Line 1455 of yacc.c */ #line 912 "../parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head; @@ -3970,6 +4250,8 @@ yyreduce: break; case 233: + +/* Line 1455 of yacc.c */ #line 921 "../parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head; (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node; @@ -3982,49 +4264,67 @@ yyreduce: break; case 234: + +/* Line 1455 of yacc.c */ #line 932 "../parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 235: + +/* Line 1455 of yacc.c */ #line 933 "../parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 236: + +/* Line 1455 of yacc.c */ #line 937 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 237: + +/* Line 1455 of yacc.c */ #line 941 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 238: + +/* Line 1455 of yacc.c */ #line 945 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;} break; case 239: + +/* Line 1455 of yacc.c */ #line 949 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 240: + +/* Line 1455 of yacc.c */ #line 951 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 241: + +/* Line 1455 of yacc.c */ #line 957 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 242: + +/* Line 1455 of yacc.c */ #line 960 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), @@ -4034,24 +4334,32 @@ yyreduce: break; case 243: + +/* Line 1455 of yacc.c */ #line 968 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 244: + +/* Line 1455 of yacc.c */ #line 970 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 245: + +/* Line 1455 of yacc.c */ #line 972 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 246: + +/* Line 1455 of yacc.c */ #line 975 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, @@ -4061,6 +4369,8 @@ yyreduce: break; case 247: + +/* Line 1455 of yacc.c */ #line 981 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations), @@ -4071,6 +4381,8 @@ yyreduce: break; case 248: + +/* Line 1455 of yacc.c */ #line 988 "../parser/Grammar.y" { ForInNode* node = new ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node); @@ -4083,6 +4395,8 @@ yyreduce: break; case 249: + +/* Line 1455 of yacc.c */ #line 997 "../parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column); @@ -4092,6 +4406,8 @@ yyreduce: break; case 250: + +/* Line 1455 of yacc.c */ #line 1003 "../parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column); @@ -4103,16 +4419,22 @@ yyreduce: break; case 251: + +/* Line 1455 of yacc.c */ #line 1013 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 253: + +/* Line 1455 of yacc.c */ #line 1018 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 255: + +/* Line 1455 of yacc.c */ #line 1023 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4121,6 +4443,8 @@ yyreduce: break; case 256: + +/* Line 1455 of yacc.c */ #line 1027 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4129,6 +4453,8 @@ yyreduce: break; case 257: + +/* Line 1455 of yacc.c */ #line 1031 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4137,6 +4463,8 @@ yyreduce: break; case 258: + +/* Line 1455 of yacc.c */ #line 1035 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4145,6 +4473,8 @@ yyreduce: break; case 259: + +/* Line 1455 of yacc.c */ #line 1042 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4152,6 +4482,8 @@ yyreduce: break; case 260: + +/* Line 1455 of yacc.c */ #line 1045 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4159,6 +4491,8 @@ yyreduce: break; case 261: + +/* Line 1455 of yacc.c */ #line 1048 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4166,6 +4500,8 @@ yyreduce: break; case 262: + +/* Line 1455 of yacc.c */ #line 1051 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4173,6 +4509,8 @@ yyreduce: break; case 263: + +/* Line 1455 of yacc.c */ #line 1057 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4180,6 +4518,8 @@ yyreduce: break; case 264: + +/* Line 1455 of yacc.c */ #line 1060 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4187,6 +4527,8 @@ yyreduce: break; case 265: + +/* Line 1455 of yacc.c */ #line 1063 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4194,6 +4536,8 @@ yyreduce: break; case 266: + +/* Line 1455 of yacc.c */ #line 1066 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4201,6 +4545,8 @@ yyreduce: break; case 267: + +/* Line 1455 of yacc.c */ #line 1072 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); @@ -4208,6 +4554,8 @@ yyreduce: break; case 268: + +/* Line 1455 of yacc.c */ #line 1078 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants); @@ -4215,11 +4563,15 @@ yyreduce: break; case 269: + +/* Line 1455 of yacc.c */ #line 1084 "../parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;} break; case 270: + +/* Line 1455 of yacc.c */ #line 1086 "../parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations), @@ -4229,11 +4581,15 @@ yyreduce: break; case 271: + +/* Line 1455 of yacc.c */ #line 1094 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;} break; case 273: + +/* Line 1455 of yacc.c */ #line 1099 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node); (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head; @@ -4244,6 +4600,8 @@ yyreduce: break; case 274: + +/* Line 1455 of yacc.c */ #line 1105 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head; (yyval.clauseList).m_node.tail = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node); @@ -4255,26 +4613,36 @@ yyreduce: break; case 275: + +/* Line 1455 of yacc.c */ #line 1115 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;} break; case 276: + +/* Line 1455 of yacc.c */ #line 1116 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;} break; case 277: + +/* Line 1455 of yacc.c */ #line 1120 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;} break; case 278: + +/* Line 1455 of yacc.c */ #line 1121 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;} break; case 279: + +/* Line 1455 of yacc.c */ #line 1125 "../parser/Grammar.y" { LabelNode* node = new LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4282,6 +4650,8 @@ yyreduce: break; case 280: + +/* Line 1455 of yacc.c */ #line 1131 "../parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4290,6 +4660,8 @@ yyreduce: break; case 281: + +/* Line 1455 of yacc.c */ #line 1135 "../parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4298,6 +4670,8 @@ yyreduce: break; case 282: + +/* Line 1455 of yacc.c */ #line 1142 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations), @@ -4308,6 +4682,8 @@ yyreduce: break; case 283: + +/* Line 1455 of yacc.c */ #line 1148 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), @@ -4318,6 +4694,8 @@ yyreduce: break; case 284: + +/* Line 1455 of yacc.c */ #line 1155 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations), @@ -4328,23 +4706,31 @@ yyreduce: break; case 285: + +/* Line 1455 of yacc.c */ #line 1164 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 286: + +/* Line 1455 of yacc.c */ #line 1166 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 287: + +/* Line 1455 of yacc.c */ #line 1171 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast((yyval.statementNode).m_node)); ;} break; case 288: + +/* Line 1455 of yacc.c */ #line 1173 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4356,11 +4742,15 @@ yyreduce: break; case 289: + +/* Line 1455 of yacc.c */ #line 1183 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;} break; case 290: + +/* Line 1455 of yacc.c */ #line 1185 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0); @@ -4371,11 +4761,15 @@ yyreduce: break; case 291: + +/* Line 1455 of yacc.c */ #line 1191 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 292: + +/* Line 1455 of yacc.c */ #line 1193 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4386,6 +4780,8 @@ yyreduce: break; case 293: + +/* Line 1455 of yacc.c */ #line 1202 "../parser/Grammar.y" { (yyval.parameterList).m_node.head = new ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)); (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; @@ -4393,6 +4789,8 @@ yyreduce: break; case 294: + +/* Line 1455 of yacc.c */ #line 1205 "../parser/Grammar.y" { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head; (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); @@ -4400,27 +4798,37 @@ yyreduce: break; case 295: + +/* Line 1455 of yacc.c */ #line 1211 "../parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 296: + +/* Line 1455 of yacc.c */ #line 1212 "../parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 297: + +/* Line 1455 of yacc.c */ #line 1216 "../parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;} break; case 298: + +/* Line 1455 of yacc.c */ #line 1217 "../parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features, (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;} break; case 299: + +/* Line 1455 of yacc.c */ #line 1222 "../parser/Grammar.y" { (yyval.sourceElements).m_node = new SourceElements(GLOBAL_DATA); (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node); @@ -4432,6 +4840,8 @@ yyreduce: break; case 300: + +/* Line 1455 of yacc.c */ #line 1229 "../parser/Grammar.y" { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations); @@ -4442,188 +4852,261 @@ yyreduce: break; case 304: + +/* Line 1455 of yacc.c */ #line 1243 "../parser/Grammar.y" { ;} break; case 305: + +/* Line 1455 of yacc.c */ #line 1244 "../parser/Grammar.y" { ;} break; case 306: + +/* Line 1455 of yacc.c */ #line 1245 "../parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 307: + +/* Line 1455 of yacc.c */ #line 1246 "../parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 308: + +/* Line 1455 of yacc.c */ #line 1250 "../parser/Grammar.y" { ;} break; case 309: + +/* Line 1455 of yacc.c */ #line 1251 "../parser/Grammar.y" { ;} break; case 310: + +/* Line 1455 of yacc.c */ #line 1252 "../parser/Grammar.y" { ;} break; case 311: + +/* Line 1455 of yacc.c */ #line 1253 "../parser/Grammar.y" { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;} break; case 312: + +/* Line 1455 of yacc.c */ #line 1254 "../parser/Grammar.y" { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;} break; case 316: + +/* Line 1455 of yacc.c */ #line 1264 "../parser/Grammar.y" { ;} break; case 317: + +/* Line 1455 of yacc.c */ #line 1265 "../parser/Grammar.y" { ;} break; case 318: + +/* Line 1455 of yacc.c */ #line 1267 "../parser/Grammar.y" { ;} break; case 322: + +/* Line 1455 of yacc.c */ #line 1274 "../parser/Grammar.y" { ;} break; case 517: + +/* Line 1455 of yacc.c */ #line 1642 "../parser/Grammar.y" { ;} break; case 518: + +/* Line 1455 of yacc.c */ #line 1643 "../parser/Grammar.y" { ;} break; case 520: + +/* Line 1455 of yacc.c */ #line 1648 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 521: + +/* Line 1455 of yacc.c */ #line 1652 "../parser/Grammar.y" { ;} break; case 522: + +/* Line 1455 of yacc.c */ #line 1653 "../parser/Grammar.y" { ;} break; case 525: + +/* Line 1455 of yacc.c */ #line 1659 "../parser/Grammar.y" { ;} break; case 526: + +/* Line 1455 of yacc.c */ #line 1660 "../parser/Grammar.y" { ;} break; case 530: + +/* Line 1455 of yacc.c */ #line 1667 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 533: + +/* Line 1455 of yacc.c */ #line 1676 "../parser/Grammar.y" { ;} break; case 534: + +/* Line 1455 of yacc.c */ #line 1677 "../parser/Grammar.y" { ;} break; case 539: + +/* Line 1455 of yacc.c */ #line 1694 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 555: + +/* Line 1455 of yacc.c */ #line 1725 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 557: + +/* Line 1455 of yacc.c */ #line 1727 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 559: + +/* Line 1455 of yacc.c */ #line 1732 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 561: + +/* Line 1455 of yacc.c */ #line 1734 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 563: + +/* Line 1455 of yacc.c */ #line 1739 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 565: + +/* Line 1455 of yacc.c */ #line 1741 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 568: + +/* Line 1455 of yacc.c */ #line 1753 "../parser/Grammar.y" { ;} break; case 569: + +/* Line 1455 of yacc.c */ #line 1754 "../parser/Grammar.y" { ;} break; case 578: + +/* Line 1455 of yacc.c */ #line 1778 "../parser/Grammar.y" { ;} break; case 580: + +/* Line 1455 of yacc.c */ #line 1783 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 585: + +/* Line 1455 of yacc.c */ #line 1794 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 592: + +/* Line 1455 of yacc.c */ #line 1810 "../parser/Grammar.y" { ;} break; -/* Line 1267 of yacc.c. */ -#line 4627 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 5110 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4699,7 +5182,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -4716,7 +5199,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4774,14 +5257,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -4806,7 +5286,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4817,7 +5297,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered @@ -4843,6 +5323,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 1826 "../parser/Grammar.y" diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h index 99dbd4c..293aa73 100644 --- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h +++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -104,78 +104,16 @@ AUTOMINUSMINUS = 320 }; #endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../parser/Grammar.y" { + +/* Line 1676 of yacc.c */ +#line 157 "../parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -205,13 +143,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 1489 of yacc.c. */ -#line 211 "Grammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "Grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -230,3 +170,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index e084e27..368d2b5 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - e65b4879116f4a8b0ee8b09607eef666c68c61d6 + eb4957a561d3f85d4cd5602832375c66f378b521 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index c3b6c37..be6922f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,81 @@ +2008-12-18 Bernhard Rosenkraenzer + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=22205 + Fix compatibility with bison 2.4, partially based on older patch by + Priit Laes + + * WebCore/css/CSSGrammar.y: Made compatible with bison 2.4 + +2009-07-13 Cédric Luthi + + Reviewed by Tor Arne Vestbø. + + Fix NPWindow clip rect in PluginViewMac + + The rect should be in window-coordinates. This bug can be observed + with Flash 10 here: http://www.permadi.com/tutorial/cursorTracker/ + + * plugins/mac/PluginViewMac.cpp: + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Fix Qt implementation of WebCore::directoryName to return the absolute + directory name instead of the base file name. + + * platform/qt/FileSystemQt.cpp: + (WebCore::directoryName): + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Fix WebCore::Path::isEmpty() for the Qt port to return true + if there is no element in the path. + + QPainterPath::isEmpty() returns also true if there is one single + MoveTo element inside, which makes sense but doesn't patch Webcore's + is-empty definition. + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::isEmpty): Use elementCount() == 0. + +2009-01-11 Simon Fraser + + Reviewed by Oliver Hunt + + https://bugs.webkit.org/show_bug.cgi?id=23242 + + Fix CanvasRenderingContext2D::transform to do a pre-multiply, + rather than a post-multiply into m_transform. This bug did not affect + drawing, but did cause m_transform to be incorrect, which impacted + willDraw(), and isPointInPath. + + Test: fast/canvas/canvas-incremental-repaint-2.html + + * html/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::transform): + +2009-07-04 Sriram Yadavalli + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=26439 + + QtWebKit fails in loading www.nytimes.com in Windows/Linux + + QNetworkReplyHandler is ignoring content associated with 401 error. + This causes the XHR response handling to fail. + + Simon: Added also ProxyAuthenticationRequiredError, to handle the same + case when going through proxies, as suggested by Prasanth. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::finish): + 2009-06-25 Simon Hausmann Reviewed by and done with Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y index 9ee9c93..31f1c8b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y +++ b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y @@ -94,6 +94,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %expect 49 +%nonassoc LOWEST_PREC + %left UNIMPORTANT_TOK %token WHITESPACE SGML_CD @@ -349,7 +351,7 @@ maybe_charset: closing_brace: '}' - | %prec maybe_sgml TOKEN_EOF + | %prec LOWEST_PREC TOKEN_EOF ; charset: @@ -1355,10 +1357,10 @@ term: $$.string = $1; } /* We might need to actually parse the number from a dimension, but we can't just put something that uses $$.string into unary_term. */ - | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } - | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } + | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } + | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_URI; } - | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE } + | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */ diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp index b980a0a..03a7829 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,157 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse cssyyparse -#define yylex cssyylex -#define yyerror cssyyerror -#define yylval cssyylval -#define yychar cssyychar -#define yydebug cssyydebug -#define yynerrs cssyynerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOKEN_EOF = 0, - UNIMPORTANT_TOK = 258, - WHITESPACE = 259, - SGML_CD = 260, - INCLUDES = 261, - DASHMATCH = 262, - BEGINSWITH = 263, - ENDSWITH = 264, - CONTAINS = 265, - STRING = 266, - IDENT = 267, - NTH = 268, - HEX = 269, - IDSEL = 270, - IMPORT_SYM = 271, - PAGE_SYM = 272, - MEDIA_SYM = 273, - FONT_FACE_SYM = 274, - CHARSET_SYM = 275, - NAMESPACE_SYM = 276, - WEBKIT_RULE_SYM = 277, - WEBKIT_DECLS_SYM = 278, - WEBKIT_KEYFRAME_RULE_SYM = 279, - WEBKIT_KEYFRAMES_SYM = 280, - WEBKIT_VALUE_SYM = 281, - WEBKIT_MEDIAQUERY_SYM = 282, - WEBKIT_SELECTOR_SYM = 283, - WEBKIT_VARIABLES_SYM = 284, - WEBKIT_DEFINE_SYM = 285, - VARIABLES_FOR = 286, - WEBKIT_VARIABLES_DECLS_SYM = 287, - ATKEYWORD = 288, - IMPORTANT_SYM = 289, - MEDIA_ONLY = 290, - MEDIA_NOT = 291, - MEDIA_AND = 292, - QEMS = 293, - EMS = 294, - EXS = 295, - PXS = 296, - CMS = 297, - MMS = 298, - INS = 299, - PTS = 300, - PCS = 301, - DEGS = 302, - RADS = 303, - GRADS = 304, - TURNS = 305, - MSECS = 306, - SECS = 307, - HERZ = 308, - KHERZ = 309, - DIMEN = 310, - PERCENTAGE = 311, - FLOATTOKEN = 312, - INTEGER = 313, - URI = 314, - FUNCTION = 315, - NOTFUNCTION = 316, - UNICODERANGE = 317, - VARCALL = 318 - }; -#endif -/* Tokens. */ -#define TOKEN_EOF 0 -#define UNIMPORTANT_TOK 258 -#define WHITESPACE 259 -#define SGML_CD 260 -#define INCLUDES 261 -#define DASHMATCH 262 -#define BEGINSWITH 263 -#define ENDSWITH 264 -#define CONTAINS 265 -#define STRING 266 -#define IDENT 267 -#define NTH 268 -#define HEX 269 -#define IDSEL 270 -#define IMPORT_SYM 271 -#define PAGE_SYM 272 -#define MEDIA_SYM 273 -#define FONT_FACE_SYM 274 -#define CHARSET_SYM 275 -#define NAMESPACE_SYM 276 -#define WEBKIT_RULE_SYM 277 -#define WEBKIT_DECLS_SYM 278 -#define WEBKIT_KEYFRAME_RULE_SYM 279 -#define WEBKIT_KEYFRAMES_SYM 280 -#define WEBKIT_VALUE_SYM 281 -#define WEBKIT_MEDIAQUERY_SYM 282 -#define WEBKIT_SELECTOR_SYM 283 -#define WEBKIT_VARIABLES_SYM 284 -#define WEBKIT_DEFINE_SYM 285 -#define VARIABLES_FOR 286 -#define WEBKIT_VARIABLES_DECLS_SYM 287 -#define ATKEYWORD 288 -#define IMPORTANT_SYM 289 -#define MEDIA_ONLY 290 -#define MEDIA_NOT 291 -#define MEDIA_AND 292 -#define QEMS 293 -#define EMS 294 -#define EXS 295 -#define PXS 296 -#define CMS 297 -#define MMS 298 -#define INS 299 -#define PTS 300 -#define PCS 301 -#define DEGS 302 -#define RADS 303 -#define GRADS 304 -#define TURNS 305 -#define MSECS 306 -#define SECS 307 -#define HERZ 308 -#define KHERZ 309 -#define DIMEN 310 -#define PERCENTAGE 311 -#define FLOATTOKEN 312 -#define INTEGER 313 -#define URI 314 -#define FUNCTION 315 -#define NOTFUNCTION 316 -#define UNICODERANGE 317 -#define VARCALL 318 - - +#define yyparse cssyyparse +#define yylex cssyylex +#define yyerror cssyyerror +#define yylval cssyylval +#define yychar cssyychar +#define yydebug cssyydebug +#define yynerrs cssyynerrs /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "../css/CSSGrammar.y" @@ -261,6 +131,9 @@ using namespace HTMLNames; +/* Line 189 of yacc.c */ +#line 136 "WebCore/tmp/../generated/CSSGrammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -279,10 +152,88 @@ using namespace HTMLNames; # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOKEN_EOF = 0, + LOWEST_PREC = 258, + UNIMPORTANT_TOK = 259, + WHITESPACE = 260, + SGML_CD = 261, + INCLUDES = 262, + DASHMATCH = 263, + BEGINSWITH = 264, + ENDSWITH = 265, + CONTAINS = 266, + STRING = 267, + IDENT = 268, + NTH = 269, + HEX = 270, + IDSEL = 271, + IMPORT_SYM = 272, + PAGE_SYM = 273, + MEDIA_SYM = 274, + FONT_FACE_SYM = 275, + CHARSET_SYM = 276, + NAMESPACE_SYM = 277, + WEBKIT_RULE_SYM = 278, + WEBKIT_DECLS_SYM = 279, + WEBKIT_KEYFRAME_RULE_SYM = 280, + WEBKIT_KEYFRAMES_SYM = 281, + WEBKIT_VALUE_SYM = 282, + WEBKIT_MEDIAQUERY_SYM = 283, + WEBKIT_SELECTOR_SYM = 284, + WEBKIT_VARIABLES_SYM = 285, + WEBKIT_DEFINE_SYM = 286, + VARIABLES_FOR = 287, + WEBKIT_VARIABLES_DECLS_SYM = 288, + ATKEYWORD = 289, + IMPORTANT_SYM = 290, + MEDIA_ONLY = 291, + MEDIA_NOT = 292, + MEDIA_AND = 293, + QEMS = 294, + EMS = 295, + EXS = 296, + PXS = 297, + CMS = 298, + MMS = 299, + INS = 300, + PTS = 301, + PCS = 302, + DEGS = 303, + RADS = 304, + GRADS = 305, + TURNS = 306, + MSECS = 307, + SECS = 308, + HERZ = 309, + KHERZ = 310, + DIMEN = 311, + PERCENTAGE = 312, + FLOATTOKEN = 313, + INTEGER = 314, + URI = 315, + FUNCTION = 316, + NOTFUNCTION = 317, + UNICODERANGE = 318, + VARCALL = 319 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 57 "../css/CSSGrammar.y" { + +/* Line 214 of yacc.c */ +#line 57 "../css/CSSGrammar.y" + bool boolean; char character; int integer; @@ -304,18 +255,21 @@ typedef union YYSTYPE WebKitCSSKeyframeRule* keyframeRule; WebKitCSSKeyframesRule* keyframesRule; float val; -} -/* Line 187 of yacc.c. */ -#line 310 "WebCore/tmp/../generated/CSSGrammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 263 "WebCore/tmp/../generated/CSSGrammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 81 "../css/CSSGrammar.y" @@ -331,8 +285,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) -/* Line 216 of yacc.c. */ -#line 336 "WebCore/tmp/../generated/CSSGrammar.tab.c" +/* Line 264 of yacc.c */ +#line 290 "WebCore/tmp/../generated/CSSGrammar.tab.c" #ifdef short # undef short @@ -407,14 +361,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -495,9 +449,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -531,12 +485,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -547,10 +501,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 28 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1274 +#define YYLAST 1315 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 84 +#define YYNTOKENS 85 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 90 /* YYNRULES -- Number of rules. */ @@ -560,7 +514,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 318 +#define YYMAXUTOK 319 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -571,16 +525,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 82, 2, 83, 2, 2, - 72, 73, 19, 75, 74, 78, 17, 81, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 16, 71, - 2, 80, 77, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 83, 2, 84, 2, 2, + 73, 74, 20, 76, 75, 79, 18, 82, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 17, 72, + 2, 81, 78, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 18, 2, 79, 2, 2, 2, 2, 2, 2, + 2, 19, 2, 80, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 69, 20, 70, 76, 2, 2, 2, + 2, 2, 2, 70, 21, 71, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -595,11 +549,11 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 15, 16, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68 + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 }; #if YYDEBUG @@ -639,130 +593,130 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 85, 0, -1, 96, 95, 99, 100, 101, 102, -1, - 87, 94, -1, 89, 94, -1, 91, 94, -1, 92, - 94, -1, 93, 94, -1, 90, 94, -1, 88, 94, - -1, 103, -1, 108, -1, 27, 69, 94, 86, 94, - 70, -1, 29, 69, 94, 132, 94, 70, -1, 28, - 69, 94, 154, 70, -1, 37, 69, 94, 111, 70, - -1, 31, 69, 94, 159, 70, -1, 32, 4, 94, - 124, 70, -1, 33, 69, 94, 140, 70, -1, -1, - 94, 4, -1, -1, 95, 5, -1, 95, 4, -1, - -1, 98, -1, 70, -1, 0, -1, 25, 94, 11, - 94, 71, -1, 25, 1, 172, -1, 25, 1, 71, - -1, -1, 99, 108, 95, -1, 168, -1, -1, 100, - 109, 95, -1, -1, 101, 115, 95, -1, -1, 102, - 104, 95, -1, 139, -1, 127, -1, 135, -1, 136, - -1, 129, -1, 103, -1, 171, -1, 167, -1, 169, - -1, -1, 105, 107, 95, -1, 139, -1, 135, -1, - 136, -1, 129, -1, 106, -1, 171, -1, 167, -1, - 169, -1, 170, -1, 21, 94, 117, 94, 125, 71, - -1, 21, 94, 117, 94, 125, 172, -1, 21, 1, - 71, -1, 21, 1, 172, -1, 34, 94, 125, 69, - 94, 111, 70, -1, 35, 94, 110, 69, 94, 111, - 70, -1, -1, 36, 4, 126, -1, 113, -1, 112, - 113, -1, 112, -1, 1, 173, 1, -1, 1, -1, - 112, 1, -1, 113, 71, 94, -1, 113, 173, 71, - 94, -1, 1, 71, 94, -1, 1, 173, 1, 71, - 94, -1, 112, 113, 71, 94, -1, 112, 1, 71, - 94, -1, 112, 1, 173, 1, 71, 94, -1, 114, - 16, 94, 159, -1, 114, 94, 69, 94, 154, 70, - 94, -1, 114, 1, -1, 114, 16, 94, 1, 159, - -1, 114, 16, 94, -1, 114, 16, 94, 1, -1, - 12, 94, -1, 26, 94, 116, 117, 94, 71, -1, - 26, 1, 172, -1, 26, 1, 71, -1, -1, 12, - 4, -1, 11, -1, 64, -1, 12, 94, -1, -1, - 16, 94, 159, 94, -1, 72, 94, 118, 94, 119, - 73, 94, -1, 120, -1, 121, 94, 42, 94, 120, - -1, -1, 42, 94, 121, -1, -1, 40, -1, 41, - -1, 121, -1, 123, 94, 128, 122, -1, -1, 126, - -1, 124, -1, 126, 74, 94, 124, -1, 126, 1, - -1, 23, 94, 126, 69, 94, 105, 166, -1, 23, - 94, 69, 94, 105, 166, -1, 12, 94, -1, 30, - 94, 130, 94, 69, 94, 131, 70, -1, 12, -1, - 11, -1, -1, 131, 132, 94, -1, 133, 94, 69, - 94, 154, 70, -1, 134, -1, 133, 94, 74, 94, - 134, -1, 61, -1, 12, -1, 22, 1, 172, -1, - 22, 1, 71, -1, 24, 94, 69, 94, 154, 70, - 94, -1, 24, 1, 172, -1, 24, 1, 71, -1, - 75, 94, -1, 76, 94, -1, 77, 94, -1, 78, - -1, 75, -1, 140, 69, 94, 154, 97, -1, 142, - -1, 140, 74, 94, 142, -1, 140, 1, -1, 142, - 4, -1, 144, -1, 141, -1, 141, 144, -1, 142, - 137, 144, -1, 142, 1, -1, 20, -1, 19, 20, - -1, 12, 20, -1, 145, -1, 145, 146, -1, 146, - -1, 143, 145, -1, 143, 145, 146, -1, 143, 146, - -1, 12, -1, 19, -1, 147, -1, 146, 147, -1, - 146, 1, -1, 15, -1, 14, -1, 148, -1, 150, - -1, 153, -1, 17, 12, -1, 12, 94, -1, 18, - 94, 149, 79, -1, 18, 94, 149, 151, 94, 152, - 94, 79, -1, 18, 94, 143, 149, 79, -1, 18, - 94, 143, 149, 151, 94, 152, 94, 79, -1, 80, - -1, 6, -1, 7, -1, 8, -1, 9, -1, 10, - -1, 12, -1, 11, -1, 16, 12, -1, 16, 16, - 12, -1, 16, 65, 13, 73, -1, 16, 65, 63, - 73, -1, 16, 65, 12, 73, -1, 16, 66, 94, - 144, 94, 73, -1, 156, -1, 155, 156, -1, 155, - -1, 1, 173, 1, -1, 1, -1, 155, 1, -1, - 155, 173, -1, 156, 71, 94, -1, 156, 173, 71, - 94, -1, 1, 71, 94, -1, 1, 173, 1, 71, - 94, -1, 155, 156, 71, 94, -1, 155, 1, 71, - 94, -1, 155, 1, 173, 1, 71, 94, -1, 157, - 16, 94, 159, 158, -1, 163, 94, -1, 157, 1, - -1, 157, 16, 94, 1, 159, 158, -1, 157, 16, - 94, 159, 158, 1, -1, 39, 94, -1, 157, 16, - 94, -1, 157, 16, 94, 1, -1, 157, 172, -1, - 12, 94, -1, 39, 94, -1, -1, 161, -1, 159, - 160, 161, -1, 159, 1, -1, 81, 94, -1, 74, - 94, -1, -1, 162, -1, 138, 162, -1, 11, 94, - -1, 12, 94, -1, 60, 94, -1, 138, 60, 94, - -1, 64, 94, -1, 67, 94, -1, 165, -1, 82, - 94, -1, 164, -1, 163, 94, -1, 83, 94, -1, - 63, 94, -1, 62, 94, -1, 61, 94, -1, 46, - 94, -1, 47, 94, -1, 48, 94, -1, 49, 94, - -1, 50, 94, -1, 51, 94, -1, 52, 94, -1, - 53, 94, -1, 54, 94, -1, 55, 94, -1, 56, - 94, -1, 57, 94, -1, 58, 94, -1, 59, 94, - -1, 44, 94, -1, 43, 94, -1, 45, 94, -1, - 68, -1, 65, 94, 159, 73, 94, -1, 65, 94, - 1, -1, 14, 94, -1, 15, 94, -1, 97, -1, - 1, 97, -1, 38, 1, 172, -1, 38, 1, 71, - -1, 167, 95, -1, 168, 167, 95, -1, 108, -1, - 127, -1, 1, 172, -1, 69, 1, 173, 1, 97, - -1, 69, 1, 97, -1, 172, -1, 173, 1, 172, + 86, 0, -1, 97, 96, 100, 101, 102, 103, -1, + 88, 95, -1, 90, 95, -1, 92, 95, -1, 93, + 95, -1, 94, 95, -1, 91, 95, -1, 89, 95, + -1, 104, -1, 109, -1, 28, 70, 95, 87, 95, + 71, -1, 30, 70, 95, 133, 95, 71, -1, 29, + 70, 95, 155, 71, -1, 38, 70, 95, 112, 71, + -1, 32, 70, 95, 160, 71, -1, 33, 5, 95, + 125, 71, -1, 34, 70, 95, 141, 71, -1, -1, + 95, 5, -1, -1, 96, 6, -1, 96, 5, -1, + -1, 99, -1, 71, -1, 0, -1, 26, 95, 12, + 95, 72, -1, 26, 1, 173, -1, 26, 1, 72, + -1, -1, 100, 109, 96, -1, 169, -1, -1, 101, + 110, 96, -1, -1, 102, 116, 96, -1, -1, 103, + 105, 96, -1, 140, -1, 128, -1, 136, -1, 137, + -1, 130, -1, 104, -1, 172, -1, 168, -1, 170, + -1, -1, 106, 108, 96, -1, 140, -1, 136, -1, + 137, -1, 130, -1, 107, -1, 172, -1, 168, -1, + 170, -1, 171, -1, 22, 95, 118, 95, 126, 72, + -1, 22, 95, 118, 95, 126, 173, -1, 22, 1, + 72, -1, 22, 1, 173, -1, 35, 95, 126, 70, + 95, 112, 71, -1, 36, 95, 111, 70, 95, 112, + 71, -1, -1, 37, 5, 127, -1, 114, -1, 113, + 114, -1, 113, -1, 1, 174, 1, -1, 1, -1, + 113, 1, -1, 114, 72, 95, -1, 114, 174, 72, + 95, -1, 1, 72, 95, -1, 1, 174, 1, 72, + 95, -1, 113, 114, 72, 95, -1, 113, 1, 72, + 95, -1, 113, 1, 174, 1, 72, 95, -1, 115, + 17, 95, 160, -1, 115, 95, 70, 95, 155, 71, + 95, -1, 115, 1, -1, 115, 17, 95, 1, 160, + -1, 115, 17, 95, -1, 115, 17, 95, 1, -1, + 13, 95, -1, 27, 95, 117, 118, 95, 72, -1, + 27, 1, 173, -1, 27, 1, 72, -1, -1, 13, + 5, -1, 12, -1, 65, -1, 13, 95, -1, -1, + 17, 95, 160, 95, -1, 73, 95, 119, 95, 120, + 74, 95, -1, 121, -1, 122, 95, 43, 95, 121, + -1, -1, 43, 95, 122, -1, -1, 41, -1, 42, + -1, 122, -1, 124, 95, 129, 123, -1, -1, 127, + -1, 125, -1, 127, 75, 95, 125, -1, 127, 1, + -1, 24, 95, 127, 70, 95, 106, 167, -1, 24, + 95, 70, 95, 106, 167, -1, 13, 95, -1, 31, + 95, 131, 95, 70, 95, 132, 71, -1, 13, -1, + 12, -1, -1, 132, 133, 95, -1, 134, 95, 70, + 95, 155, 71, -1, 135, -1, 134, 95, 75, 95, + 135, -1, 62, -1, 13, -1, 23, 1, 173, -1, + 23, 1, 72, -1, 25, 95, 70, 95, 155, 71, + 95, -1, 25, 1, 173, -1, 25, 1, 72, -1, + 76, 95, -1, 77, 95, -1, 78, 95, -1, 79, + -1, 76, -1, 141, 70, 95, 155, 98, -1, 143, + -1, 141, 75, 95, 143, -1, 141, 1, -1, 143, + 5, -1, 145, -1, 142, -1, 142, 145, -1, 143, + 138, 145, -1, 143, 1, -1, 21, -1, 20, 21, + -1, 13, 21, -1, 146, -1, 146, 147, -1, 147, + -1, 144, 146, -1, 144, 146, 147, -1, 144, 147, + -1, 13, -1, 20, -1, 148, -1, 147, 148, -1, + 147, 1, -1, 16, -1, 15, -1, 149, -1, 151, + -1, 154, -1, 18, 13, -1, 13, 95, -1, 19, + 95, 150, 80, -1, 19, 95, 150, 152, 95, 153, + 95, 80, -1, 19, 95, 144, 150, 80, -1, 19, + 95, 144, 150, 152, 95, 153, 95, 80, -1, 81, + -1, 7, -1, 8, -1, 9, -1, 10, -1, 11, + -1, 13, -1, 12, -1, 17, 13, -1, 17, 17, + 13, -1, 17, 66, 14, 74, -1, 17, 66, 64, + 74, -1, 17, 66, 13, 74, -1, 17, 67, 95, + 145, 95, 74, -1, 157, -1, 156, 157, -1, 156, + -1, 1, 174, 1, -1, 1, -1, 156, 1, -1, + 156, 174, -1, 157, 72, 95, -1, 157, 174, 72, + 95, -1, 1, 72, 95, -1, 1, 174, 1, 72, + 95, -1, 156, 157, 72, 95, -1, 156, 1, 72, + 95, -1, 156, 1, 174, 1, 72, 95, -1, 158, + 17, 95, 160, 159, -1, 164, 95, -1, 158, 1, + -1, 158, 17, 95, 1, 160, 159, -1, 158, 17, + 95, 160, 159, 1, -1, 40, 95, -1, 158, 17, + 95, -1, 158, 17, 95, 1, -1, 158, 173, -1, + 13, 95, -1, 40, 95, -1, -1, 162, -1, 160, + 161, 162, -1, 160, 1, -1, 82, 95, -1, 75, + 95, -1, -1, 163, -1, 139, 163, -1, 12, 95, + -1, 13, 95, -1, 61, 95, -1, 139, 61, 95, + -1, 65, 95, -1, 68, 95, -1, 166, -1, 83, + 95, -1, 165, -1, 164, 95, -1, 84, 95, -1, + 64, 95, -1, 63, 95, -1, 62, 95, -1, 47, + 95, -1, 48, 95, -1, 49, 95, -1, 50, 95, + -1, 51, 95, -1, 52, 95, -1, 53, 95, -1, + 54, 95, -1, 55, 95, -1, 56, 95, -1, 57, + 95, -1, 58, 95, -1, 59, 95, -1, 60, 95, + -1, 45, 95, -1, 44, 95, -1, 46, 95, -1, + 69, -1, 66, 95, 160, 74, 95, -1, 66, 95, + 1, -1, 15, 95, -1, 16, 95, -1, 98, -1, + 1, 98, -1, 39, 1, 173, -1, 39, 1, 72, + -1, 168, 96, -1, 169, 168, 96, -1, 109, -1, + 128, -1, 1, 173, -1, 70, 1, 174, 1, 98, + -1, 70, 1, 98, -1, 173, -1, 174, 1, 173, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 263, 263, 264, 265, 266, 267, 268, 269, 270, - 274, 275, 279, 285, 291, 297, 303, 317, 324, 334, - 335, 338, 340, 341, 344, 346, 351, 352, 356, 362, - 364, 368, 370, 375, 379, 381, 388, 390, 393, 395, - 403, 404, 405, 406, 407, 411, 412, 413, 414, 418, - 419, 430, 431, 432, 433, 437, 438, 439, 440, 441, - 446, 449, 452, 455, 461, 465, 471, 475, 481, 484, - 489, 492, 495, 498, 504, 507, 510, 513, 516, 521, - 524, 530, 534, 538, 542, 546, 551, 558, 564, 569, - 570, 574, 575, 579, 580, 584, 590, 593, 599, 606, - 611, 618, 621, 627, 630, 633, 639, 644, 652, 655, - 659, 664, 669, 675, 678, 684, 690, 697, 698, 702, - 703, 711, 717, 722, 731, 732, 756, 759, 765, 769, - 772, 778, 779, 780, 784, 785, 789, 795, 804, 812, - 818, 824, 827, 831, 847, 867, 873, 874, 875, 879, - 884, 891, 897, 907, 919, 932, 940, 948, 951, 964, - 970, 978, 990, 991, 992, 996, 1007, 1018, 1023, 1029, - 1037, 1049, 1052, 1055, 1058, 1061, 1064, 1070, 1071, 1075, - 1100, 1115, 1133, 1151, 1170, 1185, 1188, 1193, 1196, 1199, - 1202, 1205, 1211, 1214, 1217, 1220, 1223, 1228, 1231, 1237, - 1251, 1263, 1267, 1274, 1279, 1284, 1289, 1294, 1301, 1307, - 1308, 1312, 1317, 1331, 1337, 1340, 1343, 1349, 1350, 1351, - 1352, 1358, 1359, 1360, 1361, 1362, 1363, 1365, 1368, 1371, - 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, - 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, - 1398, 1406, 1415, 1431, 1432, 1439, 1442, 1448, 1451, 1457, - 1458, 1462, 1468, 1474, 1492, 1493, 1497, 1498 + 0, 265, 265, 266, 267, 268, 269, 270, 271, 272, + 276, 277, 281, 287, 293, 299, 305, 319, 326, 336, + 337, 340, 342, 343, 346, 348, 353, 354, 358, 364, + 366, 370, 372, 377, 381, 383, 390, 392, 395, 397, + 405, 406, 407, 408, 409, 413, 414, 415, 416, 420, + 421, 432, 433, 434, 435, 439, 440, 441, 442, 443, + 448, 451, 454, 457, 463, 467, 473, 477, 483, 486, + 491, 494, 497, 500, 506, 509, 512, 515, 518, 523, + 526, 532, 536, 540, 544, 548, 553, 560, 566, 571, + 572, 576, 577, 581, 582, 586, 592, 595, 601, 608, + 613, 620, 623, 629, 632, 635, 641, 646, 654, 657, + 661, 666, 671, 677, 680, 686, 692, 699, 700, 704, + 705, 713, 719, 724, 733, 734, 758, 761, 767, 771, + 774, 780, 781, 782, 786, 787, 791, 797, 806, 814, + 820, 826, 829, 833, 849, 869, 875, 876, 877, 881, + 886, 893, 899, 909, 921, 934, 942, 950, 953, 966, + 972, 980, 992, 993, 994, 998, 1009, 1020, 1025, 1031, + 1039, 1051, 1054, 1057, 1060, 1063, 1066, 1072, 1073, 1077, + 1102, 1117, 1135, 1153, 1172, 1187, 1190, 1195, 1198, 1201, + 1204, 1207, 1213, 1216, 1219, 1222, 1225, 1230, 1233, 1239, + 1253, 1265, 1269, 1276, 1281, 1286, 1291, 1296, 1303, 1309, + 1310, 1314, 1319, 1333, 1339, 1342, 1345, 1351, 1352, 1353, + 1354, 1360, 1361, 1362, 1363, 1364, 1365, 1367, 1370, 1373, + 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, + 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, + 1400, 1408, 1417, 1433, 1434, 1441, 1444, 1450, 1453, 1459, + 1460, 1464, 1470, 1476, 1494, 1495, 1499, 1500 }; #endif @@ -771,27 +725,28 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "TOKEN_EOF", "error", "$undefined", "UNIMPORTANT_TOK", "WHITESPACE", - "SGML_CD", "INCLUDES", "DASHMATCH", "BEGINSWITH", "ENDSWITH", "CONTAINS", - "STRING", "IDENT", "NTH", "HEX", "IDSEL", "':'", "'.'", "'['", "'*'", - "'|'", "IMPORT_SYM", "PAGE_SYM", "MEDIA_SYM", "FONT_FACE_SYM", - "CHARSET_SYM", "NAMESPACE_SYM", "WEBKIT_RULE_SYM", "WEBKIT_DECLS_SYM", - "WEBKIT_KEYFRAME_RULE_SYM", "WEBKIT_KEYFRAMES_SYM", "WEBKIT_VALUE_SYM", - "WEBKIT_MEDIAQUERY_SYM", "WEBKIT_SELECTOR_SYM", "WEBKIT_VARIABLES_SYM", - "WEBKIT_DEFINE_SYM", "VARIABLES_FOR", "WEBKIT_VARIABLES_DECLS_SYM", - "ATKEYWORD", "IMPORTANT_SYM", "MEDIA_ONLY", "MEDIA_NOT", "MEDIA_AND", - "QEMS", "EMS", "EXS", "PXS", "CMS", "MMS", "INS", "PTS", "PCS", "DEGS", - "RADS", "GRADS", "TURNS", "MSECS", "SECS", "HERZ", "KHERZ", "DIMEN", - "PERCENTAGE", "FLOATTOKEN", "INTEGER", "URI", "FUNCTION", "NOTFUNCTION", - "UNICODERANGE", "VARCALL", "'{'", "'}'", "';'", "'('", "')'", "','", - "'+'", "'~'", "'>'", "'-'", "']'", "'='", "'/'", "'#'", "'%'", "$accept", - "stylesheet", "valid_rule_or_import", "webkit_rule", - "webkit_keyframe_rule", "webkit_decls", "webkit_variables_decls", - "webkit_value", "webkit_mediaquery", "webkit_selector", "maybe_space", - "maybe_sgml", "maybe_charset", "closing_brace", "charset", "import_list", - "variables_list", "namespace_list", "rule_list", "valid_rule", "rule", - "block_rule_list", "block_valid_rule", "block_rule", "import", - "variables_rule", "variables_media_list", "variables_declaration_list", + "TOKEN_EOF", "error", "$undefined", "LOWEST_PREC", "UNIMPORTANT_TOK", + "WHITESPACE", "SGML_CD", "INCLUDES", "DASHMATCH", "BEGINSWITH", + "ENDSWITH", "CONTAINS", "STRING", "IDENT", "NTH", "HEX", "IDSEL", "':'", + "'.'", "'['", "'*'", "'|'", "IMPORT_SYM", "PAGE_SYM", "MEDIA_SYM", + "FONT_FACE_SYM", "CHARSET_SYM", "NAMESPACE_SYM", "WEBKIT_RULE_SYM", + "WEBKIT_DECLS_SYM", "WEBKIT_KEYFRAME_RULE_SYM", "WEBKIT_KEYFRAMES_SYM", + "WEBKIT_VALUE_SYM", "WEBKIT_MEDIAQUERY_SYM", "WEBKIT_SELECTOR_SYM", + "WEBKIT_VARIABLES_SYM", "WEBKIT_DEFINE_SYM", "VARIABLES_FOR", + "WEBKIT_VARIABLES_DECLS_SYM", "ATKEYWORD", "IMPORTANT_SYM", "MEDIA_ONLY", + "MEDIA_NOT", "MEDIA_AND", "QEMS", "EMS", "EXS", "PXS", "CMS", "MMS", + "INS", "PTS", "PCS", "DEGS", "RADS", "GRADS", "TURNS", "MSECS", "SECS", + "HERZ", "KHERZ", "DIMEN", "PERCENTAGE", "FLOATTOKEN", "INTEGER", "URI", + "FUNCTION", "NOTFUNCTION", "UNICODERANGE", "VARCALL", "'{'", "'}'", + "';'", "'('", "')'", "','", "'+'", "'~'", "'>'", "'-'", "']'", "'='", + "'/'", "'#'", "'%'", "$accept", "stylesheet", "valid_rule_or_import", + "webkit_rule", "webkit_keyframe_rule", "webkit_decls", + "webkit_variables_decls", "webkit_value", "webkit_mediaquery", + "webkit_selector", "maybe_space", "maybe_sgml", "maybe_charset", + "closing_brace", "charset", "import_list", "variables_list", + "namespace_list", "rule_list", "valid_rule", "rule", "block_rule_list", + "block_valid_rule", "block_rule", "import", "variables_rule", + "variables_media_list", "variables_declaration_list", "variables_decl_list", "variables_declaration", "variable_name", "namespace", "maybe_ns_prefix", "string_or_uri", "media_feature", "maybe_media_value", "media_query_exp", "media_query_exp_list", @@ -816,47 +771,47 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 58, 46, 91, 42, - 124, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 265, 266, 267, 268, 269, 270, 271, 58, 46, 91, + 42, 124, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 123, - 125, 59, 40, 41, 44, 43, 126, 62, 45, 93, - 61, 47, 35, 37 + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 123, 125, 59, 40, 41, 44, 43, 126, 62, 45, + 93, 61, 47, 35, 37 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 84, 85, 85, 85, 85, 85, 85, 85, 85, - 86, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 94, 95, 95, 95, 96, 96, 97, 97, 98, 98, - 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, - 103, 103, 103, 103, 103, 104, 104, 104, 104, 105, - 105, 106, 106, 106, 106, 107, 107, 107, 107, 107, - 108, 108, 108, 108, 109, 109, 110, 110, 111, 111, - 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, - 112, 113, 113, 113, 113, 113, 113, 114, 115, 115, - 115, 116, 116, 117, 117, 118, 119, 119, 120, 121, - 121, 122, 122, 123, 123, 123, 124, 124, 125, 125, - 126, 126, 126, 127, 127, 128, 129, 130, 130, 131, - 131, 132, 133, 133, 134, 134, 135, 135, 136, 136, - 136, 137, 137, 137, 138, 138, 139, 140, 140, 140, - 141, 142, 142, 142, 142, 142, 143, 143, 143, 144, - 144, 144, 144, 144, 144, 145, 145, 146, 146, 146, - 147, 147, 147, 147, 147, 148, 149, 150, 150, 150, - 150, 151, 151, 151, 151, 151, 151, 152, 152, 153, - 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, - 154, 154, 155, 155, 155, 155, 155, 155, 155, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 157, 158, - 158, 159, 159, 159, 160, 160, 160, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 0, 85, 86, 86, 86, 86, 86, 86, 86, 86, + 87, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, + 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, + 104, 104, 104, 104, 104, 105, 105, 105, 105, 106, + 106, 107, 107, 107, 107, 108, 108, 108, 108, 108, + 109, 109, 109, 109, 110, 110, 111, 111, 112, 112, + 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, + 113, 114, 114, 114, 114, 114, 114, 115, 116, 116, + 116, 117, 117, 118, 118, 119, 120, 120, 121, 122, + 122, 123, 123, 124, 124, 124, 125, 125, 126, 126, + 127, 127, 127, 128, 128, 129, 130, 131, 131, 132, + 132, 133, 134, 134, 135, 135, 136, 136, 137, 137, + 137, 138, 138, 138, 139, 139, 140, 141, 141, 141, + 142, 143, 143, 143, 143, 143, 144, 144, 144, 145, + 145, 145, 145, 145, 145, 146, 146, 147, 147, 147, + 148, 148, 148, 148, 148, 149, 150, 151, 151, 151, + 151, 152, 152, 152, 152, 152, 152, 153, 153, 154, + 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, + 155, 155, 156, 156, 156, 156, 156, 156, 156, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 158, 159, + 159, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 163, 164, 164, 165, 165, 166, 166, 167, 167, 168, - 168, 169, 170, 171, 172, 172, 173, 173 + 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, + 164, 165, 165, 166, 166, 167, 167, 168, 168, 169, + 169, 170, 171, 172, 173, 173, 174, 174 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -966,75 +921,75 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -299 +#define YYPACT_NINF -435 static const yytype_int16 yypact[] = { - 466, 425, -26, -20, 75, 118, 189, 139, 151, 263, - -299, -299, -299, -299, -299, -299, -299, -299, -299, 359, - 300, -299, -299, -299, -299, -299, -299, -299, -299, 278, - 278, 278, 278, 278, 278, 278, 33, 338, -299, -299, - -299, -299, 749, 313, 32, 1074, 12, 545, 44, -299, - -299, 345, 346, -299, 335, 223, 194, 354, -299, -299, - 419, 380, -299, 383, -299, 403, 408, -299, 163, -299, - -299, -299, -299, -299, -299, -299, -299, -299, 86, 561, - 199, 620, -299, 626, 161, -299, -299, -299, -299, 374, - -299, -299, -299, 351, 239, 378, 179, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, 645, 882, -299, -299, -299, - -299, -299, -299, -299, -299, -299, 30, -299, 363, 82, - 402, -299, 364, 185, 410, 190, 421, 28, -299, 301, - -299, -299, -299, -299, -299, 423, -299, -299, -299, 426, - 337, -299, -299, 35, -299, 542, 397, 640, 1, 691, - 26, 448, 220, -299, -299, -299, -299, -299, -299, -299, - -299, -299, 561, -299, -299, 626, 343, 381, -299, -299, - -299, 443, 278, 278, -299, 705, 377, 27, -299, 59, - -299, -299, -299, 278, 242, 178, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 1012, 278, 278, 278, -299, -299, -299, -299, - -299, -299, 1132, 278, 201, 368, 312, -299, -299, -299, - 464, 278, -299, 706, 395, -299, 87, -299, -299, 188, - -299, -299, -299, -299, 442, -299, 301, 301, 223, -299, - 409, 413, 414, 545, 354, 383, 488, 69, -299, -299, - -299, -299, -299, -299, -299, -299, -299, 135, -299, -299, - -299, -299, -299, -299, -299, 313, 545, 278, 278, 278, - -299, 554, 278, 709, -299, 475, -299, 432, 278, -299, - 539, -299, -299, -299, -299, 947, 278, 278, 278, -299, - -299, -299, -299, -299, 462, 278, 712, -299, 528, -299, - 278, -299, 744, -299, 294, 165, 382, 1229, -299, 301, - -299, -299, -299, -299, -299, -299, 278, -299, 209, -299, - -299, -299, -299, -299, -299, -299, -299, 339, 278, -299, - -299, -299, 313, 257, 174, 210, -299, 278, 713, 278, - 278, 1132, 463, 313, 32, -299, 278, 42, 181, 278, - -299, -299, -299, 278, 754, 278, 278, 1132, 604, 313, - 467, 97, 531, 473, 764, 329, 432, -299, -299, -299, - -299, -299, -299, 301, 61, -299, -299, 458, 765, 1204, - 278, 12, 477, -299, -299, 278, -299, 463, -299, 172, - 478, -299, 278, -299, 479, -299, 181, 278, -299, 669, - 486, -299, 10, -299, -299, -299, 562, 217, -299, 301, - -299, 458, -299, -299, -299, -299, -299, 223, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, 1204, -299, -299, 278, 278, -299, 278, -299, -299, - 1074, -299, 30, 278, -299, 44, 152, 44, -299, -299, - -299, 2, -299, 301, -299, 278, 307, 817, 278, 278, - 497, 504, 225, 15, -299, -299, -299, 278, -299, -299, - -299, -299, 278 + 818, 44, -36, -18, 112, 127, 66, 141, 162, 243, + -435, -435, -435, -435, -435, -435, -435, -435, -435, 239, + 43, -435, -435, -435, -435, -435, -435, -435, -435, 250, + 250, 250, 250, 250, 250, 250, 37, 304, -435, -435, + -435, -435, 763, 354, 31, 1114, 144, 622, 49, -435, + -435, 346, 344, -435, 332, 27, 23, 358, -435, -435, + 401, 370, -435, 371, -435, 381, 406, -435, 193, -435, + -435, -435, -435, -435, -435, -435, -435, -435, 171, 702, + 143, 631, -435, 756, 159, -435, -435, -435, -435, 240, + -435, -435, -435, 329, 303, 254, 199, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, 949, 903, -435, -435, -435, + -435, -435, -435, -435, -435, -435, 34, -435, 342, 4, + 274, -435, 353, 59, 291, 223, 331, 395, -435, 438, + -435, -435, -435, -435, -435, 437, -435, -435, -435, 448, + 24, -435, -435, 415, -435, 349, 295, 377, 375, 399, + 198, 421, 190, -435, -435, -435, -435, -435, -435, -435, + -435, -435, 702, -435, -435, 756, 334, 380, -435, -435, + -435, 463, 250, 250, -435, 409, 398, 180, -435, 15, + -435, -435, -435, 250, 221, 182, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 1052, 250, 250, 250, -435, -435, -435, -435, + -435, -435, 1172, 250, 188, 166, 301, -435, -435, -435, + 472, 250, -435, 412, 404, -435, 62, -435, -435, 220, + -435, -435, -435, -435, 458, -435, 438, 438, 27, -435, + 413, 417, 430, 622, 358, 371, 473, 158, -435, -435, + -435, -435, -435, -435, -435, -435, -435, 172, -435, -435, + -435, -435, -435, -435, -435, 354, 622, 250, 250, 250, + -435, 555, 250, 420, -435, 502, -435, 459, 250, -435, + 535, -435, -435, -435, -435, 976, 250, 250, 250, -435, + -435, -435, -435, -435, 496, 250, 423, -435, 541, -435, + 250, -435, 754, -435, 424, 36, 552, 685, -435, 438, + -435, -435, -435, -435, -435, -435, 250, -435, 277, -435, + -435, -435, -435, -435, -435, -435, -435, 856, 250, -435, + -435, -435, 354, 226, 65, 203, -435, 250, 428, 250, + 250, 1172, 462, 354, 31, -435, 250, 53, 186, 250, + -435, -435, -435, 250, 429, 250, 250, 1172, 608, 354, + 479, 83, 538, 485, 482, 320, 459, -435, -435, -435, + -435, -435, -435, 438, 78, -435, -435, 447, 489, 1244, + 250, 144, 487, -435, -435, 250, -435, 462, -435, 205, + 491, -435, 250, -435, 492, -435, 186, 250, -435, 681, + 497, -435, 5, -435, -435, -435, 558, 150, -435, 438, + -435, 447, -435, -435, -435, -435, -435, 27, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, 1244, -435, -435, 250, 250, -435, 250, -435, -435, + 1114, -435, 34, 250, -435, 49, 178, 49, -435, -435, + -435, 1, -435, 438, -435, 250, 306, 827, 250, 250, + 498, 504, 151, 14, -435, -435, -435, 250, -435, -435, + -435, -435, 250 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -1, -21, -299, -51, -299, -299, -299, -299, -299, 265, - -299, 200, -299, -299, 258, -299, -299, 352, -299, 472, - -299, -299, -299, 186, -299, -299, 238, 240, -299, -299, - -45, 279, -176, -238, -299, -194, -299, -299, 149, -299, - 293, -116, -66, -299, -299, -48, 663, -299, 429, 568, - -61, 661, -50, -55, -299, 460, -299, 391, 303, -299, - -298, -299, 692, -299, 330, -185, -299, 533, 675, -35, - -299, -299, 349, -19, -299, 469, -299, 470, -16, -3 + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -1, -21, -435, -51, -435, -435, -435, -435, -435, 229, + -435, 147, -435, -435, 256, -435, -435, -434, -435, 425, + -435, -435, -435, 130, -435, -435, 214, 174, -435, -435, + -45, 241, -176, -389, -435, -227, -435, -435, 116, -435, + 231, -154, -137, -435, -435, -130, 566, -435, 310, 449, + -61, 547, -50, -55, -435, 348, -435, 278, 194, -435, + -298, -435, 581, -435, 261, -185, -435, 443, 546, -35, + -435, -435, 218, -19, -435, 352, -435, 364, -16, -3 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1044,324 +999,332 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -217 static const yytype_int16 yytable[] = { - 20, 148, 297, 39, 163, 40, 40, 374, 97, 29, - 30, 31, 32, 33, 34, 35, 40, 53, 186, 40, - 42, 43, 44, 45, 46, 47, 48, -191, 317, 199, - 40, 196, 159, 197, -19, 160, 40, 49, 50, 40, - 56, 142, 143, 21, 98, 150, 40, 284, 40, 22, - 142, 143, 142, 143, 285, 64, 151, 325, 433, 97, - 317, 173, 272, 273, 176, 40, 178, 180, 181, 182, - 295, 51, -19, 144, 422, 359, 360, 361, 362, 363, - 212, 504, 144, 183, 144, 430, 201, 183, 317, 202, - 203, 207, 209, 99, 511, 300, 213, -191, 369, 214, + 20, 148, 297, 39, 163, 183, 40, 374, 97, 29, + 30, 31, 32, 33, 34, 35, 317, 53, 186, 40, + 42, 43, 44, 45, 46, 47, 48, 161, 40, 199, + 461, 196, 159, 197, 21, 160, 40, 280, 281, -19, + 56, 40, 49, 50, 98, 19, 142, 143, 40, -19, + 150, 500, 22, 501, 40, 41, -19, 325, 40, 97, + 263, 173, 151, 317, 176, 161, 178, 180, 181, 182, + 433, 25, 151, 402, 422, 258, 51, -19, 144, 185, + 212, 504, 461, 40, 369, 430, 201, 319, 282, 202, + 203, 207, 209, 99, 511, 166, 213, 37, 162, 214, 215, 440, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 319, 310, 244, 245, 450, 382, 369, 276, 253, 277, - 271, 199, 199, 254, 23, 311, 256, 260, 364, 365, - 261, 266, 258, 369, 269, 184, 185, 398, 341, 289, - 185, 294, 198, 299, 179, -151, -109, -19, -109, 40, - 283, 371, -199, 478, 161, 58, 59, 60, 61, 62, - 210, 461, 40, 305, 306, 40, 263, 24, 307, 308, - 309, 267, 40, 25, -19, 211, 427, 151, 40, 312, - 187, 402, 315, 188, 370, 40, 268, 318, 26, 371, - 320, 187, 439, 330, 188, 359, 360, 361, 362, 363, - 27, -67, 355, 161, 40, 462, 371, 350, 290, 40, - -151, -151, -19, 461, -151, -151, -151, -151, -151, -187, - 205, -199, -199, -199, 162, 326, 40, 322, 37, 327, - 328, 90, 323, 144, 349, -70, 199, 343, 335, -19, - 338, 40, 351, 28, 340, 166, 486, 342, -137, -137, - 97, 344, 345, -137, 189, 190, 191, 462, 91, -138, - -138, 291, 40, 356, -138, 189, 190, 191, 415, 365, - 304, 367, 37, 162, 368, 497, 510, 351, 40, 372, - 72, 351, 373, 463, 40, 49, 50, 92, 37, -187, - 158, 41, 321, 377, 89, 379, 40, 40, 380, 98, - 351, 383, 384, 424, 333, 90, 423, 413, 410, 386, - 387, 388, 389, 40, 142, 143, 393, 97, 395, 55, - 396, 446, 399, 40, 198, 405, 156, -154, 97, 280, - 281, -103, 91, 464, 414, 463, 356, 58, 59, 60, - 61, 62, 351, -108, 97, 417, 144, 65, 99, 420, - 421, 465, 40, 51, 167, 425, 472, 505, 351, 142, - 143, 92, 198, 404, 432, -150, -19, 449, 445, 436, - 448, 437, 172, -19, -19, 58, 59, 60, 61, 62, - 282, 40, 456, 174, 175, 464, 492, -19, 290, 177, - 332, 144, -154, -154, -19, 451, -154, -154, -154, -154, - -154, 204, 474, 465, 278, 475, 19, 477, 37, -19, - 38, 168, 480, 257, 262, 169, -19, 483, 279, 493, - 485, 448, 487, 37, 313, 200, -19, 37, 316, 208, - -150, -150, 40, 491, -150, -150, -150, -150, -150, 301, - 302, 291, 40, -210, 248, 336, 339, -19, 346, 452, - 453, 37, 495, 259, -216, -216, 378, -216, -216, 37, - 498, 265, 352, 499, 170, 171, 353, 354, 502, 503, - 37, 1, 270, 2, 3, 4, 507, 5, 6, 7, - 357, 37, 428, 8, 390, 512, -216, -216, -216, -216, + -70, 310, 244, 245, 341, 382, 162, 276, 253, 277, + 271, 199, 199, 254, 187, 311, 256, 260, 188, 40, + 261, 266, 450, -109, 269, -109, 40, 398, 371, 289, + 198, 294, 290, 299, -151, 359, 360, 361, 362, 363, + 283, 40, 183, 369, 58, 59, 60, 61, 62, 369, + -191, 317, 23, 305, 306, 142, 143, 40, 307, 308, + 309, 40, 462, 40, 179, 40, 427, 24, -19, 312, + 210, 330, 315, 40, 187, -199, 478, 318, 188, 332, + 320, 26, 439, -137, -137, 291, 211, 144, -137, 189, + 190, 191, 355, 510, 267, 40, 40, 350, -19, -151, + -151, 40, 27, -151, -151, -151, -151, -151, 364, 365, + 268, 184, 370, 28, 462, 326, 185, 371, -67, 327, + 328, -191, 322, 371, 349, 40, 199, 323, 335, 144, + 338, 304, 351, -19, 340, 463, 486, 342, 300, 37, + 97, 344, 345, -138, -138, -199, -199, -199, -138, 189, + 190, 191, 464, 356, 359, 360, 361, 362, 363, 465, + 343, 367, 321, -19, 368, 497, 423, 351, 72, 372, + 40, 351, 373, -187, 205, 55, 40, 290, 158, 37, + 37, 38, 200, 377, 333, 379, 90, 463, 380, 98, + 351, 383, 384, 424, 37, 40, 208, 413, 410, 386, + 387, 388, 389, 446, 464, 198, 393, 97, 395, -154, + 396, 465, 399, 91, 37, 405, 259, 156, 97, 58, + 59, 60, 61, 62, 414, 89, 356, 415, 365, 40, + 291, 37, 351, 265, 97, 417, 65, 90, 99, 420, + 421, 51, 92, 37, -187, 425, 472, 505, 351, 167, + 40, 198, 175, 172, 432, -150, -19, 449, 445, 436, + 448, 437, 174, -19, 91, 58, 59, 60, 61, 62, + 204, 37, 456, 270, -154, -154, 492, 177, -154, -154, + -154, -154, -154, 257, 168, 451, 142, 143, 169, 37, + 40, 288, 474, 92, 262, 475, 40, 477, 284, 40, + 272, 273, 480, 301, 302, 285, 64, 483, 278, 493, + 485, 448, 487, 49, 50, 295, -19, 37, 144, 293, + -150, -150, 40, 491, -150, -150, -150, -150, -150, 452, + 453, 279, -210, 248, 313, 142, 143, 170, 171, 37, + 316, 298, 495, 336, -216, -216, 339, -216, -216, 37, + 498, 314, 37, 499, 337, 346, 357, 352, 502, 503, + 37, 353, 376, 37, -108, 392, 507, 144, 37, 37, + 426, 438, 428, 378, 354, 512, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, -216, 394, - -216, -216, -210, -210, -210, 442, 441, 250, -216, -205, - 381, -216, 443, 40, 251, -216, -216, 473, 479, 40, - 103, 104, 481, 105, 106, 198, 484, 57, -153, 58, - 59, 60, 61, 62, 63, 64, 488, 508, 58, 59, - 60, 61, 62, 57, 509, 58, 59, 60, 61, 62, - 63, 64, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 248, 130, 92, -205, -205, - -205, 37, 407, 288, 131, -216, -216, 132, -216, -216, - 471, 133, 134, -153, -153, 264, 435, -153, -153, -153, - -153, -153, 193, 489, 58, 59, 60, 61, 62, 194, - 58, 59, 60, 61, 62, 506, 418, -216, -216, -216, + -216, -216, -216, -216, -216, -216, -216, -216, -216, 37, + -216, -216, -210, -210, -210, -205, 381, 250, -216, 390, + 40, -216, 394, 442, 251, -216, -216, 103, 104, 441, + 105, 106, 37, 404, 444, 443, 198, -19, 473, 37, + -153, 455, 479, 488, -19, -19, 481, 471, 484, 508, + 58, 59, 60, 61, 62, 509, 407, 489, 264, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 435, 130, 92, -205, -205, -205, 418, 248, + 482, 131, 506, 149, 132, 431, 375, -19, 133, 134, + -216, -216, 286, -216, -216, -153, -153, 40, 195, -153, + -153, -153, -153, -153, 358, 57, 416, 58, 59, 60, + 61, 62, 63, 64, 193, 490, 58, 59, 60, 61, + 62, 194, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, + -216, -216, -216, -216, -216, 206, -216, -216, -81, -81, + -81, 247, 248, 250, -216, -2, 406, -216, 476, 494, + 251, -216, -216, -216, -216, 329, -216, -216, 57, 411, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 412, 0, 0, 0, 57, 69, 58, 59, 60, + 61, 62, 63, 64, 51, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - 248, -216, -216, -81, -81, -81, 482, 431, 250, -216, - -216, -216, -216, -216, -216, 251, -216, -216, 107, 108, + -216, -216, -216, -216, -216, -216, -216, -216, 0, -216, + -216, -84, -84, -84, 0, 397, 250, -216, 0, 40, + -216, 0, 0, 251, -216, -216, 103, 104, 40, 105, + 106, 58, 59, 60, 61, 62, 57, 0, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, + 0, 0, 0, 0, 69, 0, 0, 0, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 246, 125, 126, 127, 37, - 149, 293, -216, -216, -216, -216, -216, -216, -216, -216, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 92, -85, -85, -85, 0, 248, 0, + 131, 0, -19, 132, 0, 0, 0, 133, 134, -216, + -216, 0, -216, -216, 1, 0, 2, 3, 4, 0, + 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 0, -103, + 0, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, 375, -216, -216, -84, -84, - -84, 286, 195, 250, -216, 397, 358, -216, 40, 416, - 251, -216, -216, 40, 490, 103, 104, 476, 105, 106, - 37, 57, 298, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 37, 37, 314, 337, 37, 69, - 376, 37, 37, 392, 426, 329, 206, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 247, 130, 92, -85, -85, -85, 411, 412, 248, 131, - 494, -19, 132, 37, 0, 438, 133, 134, -216, -216, - 0, -216, -216, 37, 37, 444, 455, 500, 0, 501, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -216, -216, -216, -216, 0, -216, -216, 142, 143, 0, + 0, -19, 250, -216, 248, 0, -216, 0, 0, 251, + -216, -216, 0, 0, 0, -216, -216, 0, -216, -216, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, 248, -216, -216, 0, 0, 0, 0, - -19, 250, -216, -216, -216, -216, -216, -216, 251, -216, - -216, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -216, -216, -216, -216, -216, + 0, -216, -216, 0, 249, 0, 0, 248, 250, -216, + 0, 0, -216, 0, 0, 251, -216, -216, -216, -216, + 0, -216, -216, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 246, 125, 126, 127, 0, 0, 0, 0, 0, 0, + -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, 248, -216, - -216, 0, 249, 0, 0, 0, 250, -216, -216, -216, - -216, -216, -216, 251, -216, -216, 0, 0, 0, 0, + -216, -216, -216, 0, -216, -216, 0, 0, 0, 0, + 385, 250, -216, 324, 0, -216, 0, 40, 251, -216, + -216, 0, 0, 0, 103, 104, 0, 105, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, 324, -216, -216, 40, 0, 0, 0, - 385, 250, -216, 103, 104, -216, 105, 106, 251, -216, - -216, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 40, + 130, 92, 0, 0, 0, 0, 103, 104, 131, 105, + 106, 132, 0, 0, 0, 133, 134, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 92, 103, 104, 0, 105, 106, 0, + 131, 0, 0, 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 40, 130, - 92, 0, 0, 0, 0, 103, 104, 131, 105, 106, - 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 92, 0, 0, 161, 457, 0, 0, 131, 0, + 0, 132, 0, 0, 0, 133, 134, 57, 0, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, + 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 92, 103, 104, 0, 105, 106, 0, 131, - 0, 0, 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 92, 0, 0, 0, 161, 457, 0, 131, 0, 0, - 132, 0, 0, 0, 133, 134, 57, 0, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, -2, - 406, 0, 0, 0, 69, 0, 0, 0, 0, 0, - 0, 57, 51, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, - 0, 0, 0, 0, 162 + 0, 0, 0, 0, 0, 162 }; static const yytype_int16 yycheck[] = { - 1, 46, 178, 19, 55, 4, 4, 305, 43, 10, - 11, 12, 13, 14, 15, 16, 4, 36, 79, 4, - 21, 22, 23, 24, 25, 26, 27, 0, 1, 84, - 4, 81, 53, 83, 4, 54, 4, 4, 5, 4, - 41, 40, 41, 69, 12, 1, 4, 12, 4, 69, - 40, 41, 40, 41, 19, 20, 12, 242, 16, 94, - 1, 62, 34, 35, 65, 4, 67, 68, 69, 70, - 69, 38, 42, 72, 372, 6, 7, 8, 9, 10, - 96, 79, 72, 1, 72, 383, 89, 1, 1, 90, - 91, 94, 95, 61, 79, 69, 97, 70, 1, 100, + 1, 46, 178, 19, 55, 1, 5, 305, 43, 10, + 11, 12, 13, 14, 15, 16, 1, 36, 79, 5, + 21, 22, 23, 24, 25, 26, 27, 0, 5, 84, + 419, 81, 53, 83, 70, 54, 5, 13, 14, 5, + 41, 5, 5, 6, 13, 1, 41, 42, 5, 5, + 1, 485, 70, 487, 5, 12, 12, 242, 5, 94, + 1, 62, 13, 1, 65, 0, 67, 68, 69, 70, + 17, 5, 13, 37, 372, 71, 39, 43, 73, 75, + 96, 80, 471, 5, 1, 383, 89, 72, 64, 90, + 91, 94, 95, 62, 80, 72, 97, 70, 71, 100, 101, 399, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 71, 192, 133, 134, 73, 320, 1, 158, 139, 160, - 156, 196, 197, 144, 69, 195, 147, 150, 79, 80, - 151, 154, 70, 1, 155, 69, 74, 342, 71, 175, - 74, 177, 1, 179, 1, 4, 69, 4, 71, 4, - 171, 74, 0, 1, 0, 14, 15, 16, 17, 18, - 1, 419, 4, 184, 185, 4, 1, 69, 189, 190, - 191, 1, 4, 4, 4, 16, 381, 12, 4, 200, - 1, 36, 205, 4, 69, 4, 16, 208, 69, 74, - 211, 1, 397, 12, 4, 6, 7, 8, 9, 10, - 69, 69, 283, 0, 4, 419, 74, 278, 11, 4, - 69, 70, 69, 471, 73, 74, 75, 76, 77, 0, - 1, 69, 70, 71, 70, 246, 4, 69, 69, 250, - 251, 12, 74, 72, 275, 70, 311, 69, 259, 69, - 263, 4, 278, 0, 265, 71, 442, 268, 69, 70, - 305, 272, 273, 74, 75, 76, 77, 471, 39, 69, - 70, 64, 4, 284, 74, 75, 76, 77, 79, 80, - 70, 292, 69, 70, 295, 480, 71, 313, 4, 300, - 42, 317, 303, 419, 4, 4, 5, 68, 69, 70, - 52, 11, 70, 314, 1, 316, 4, 4, 319, 12, - 336, 322, 323, 374, 12, 12, 69, 348, 347, 330, - 331, 332, 333, 4, 40, 41, 337, 372, 339, 1, - 341, 12, 343, 4, 1, 346, 1, 4, 383, 12, - 13, 12, 39, 419, 355, 471, 357, 14, 15, 16, - 17, 18, 378, 69, 399, 366, 72, 21, 61, 370, - 371, 419, 4, 38, 20, 376, 421, 70, 394, 40, - 41, 68, 1, 1, 385, 4, 4, 408, 404, 390, - 406, 392, 12, 11, 12, 14, 15, 16, 17, 18, - 63, 4, 418, 20, 1, 471, 457, 4, 11, 1, - 42, 72, 69, 70, 11, 416, 73, 74, 75, 76, - 77, 70, 423, 471, 1, 426, 1, 428, 69, 4, - 71, 12, 433, 70, 70, 16, 11, 438, 12, 460, - 441, 457, 443, 69, 1, 71, 64, 69, 71, 71, - 69, 70, 4, 454, 73, 74, 75, 76, 77, 11, - 12, 64, 4, 0, 1, 1, 71, 64, 26, 11, - 12, 69, 473, 71, 11, 12, 1, 14, 15, 69, - 481, 71, 73, 484, 65, 66, 73, 73, 489, 490, - 69, 25, 71, 27, 28, 29, 497, 31, 32, 33, - 12, 69, 39, 37, 42, 506, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 1, - 67, 68, 69, 70, 71, 4, 69, 74, 75, 0, - 1, 78, 69, 4, 81, 82, 83, 70, 70, 4, - 11, 12, 73, 14, 15, 1, 70, 12, 4, 14, - 15, 16, 17, 18, 19, 20, 4, 70, 14, 15, - 16, 17, 18, 12, 70, 14, 15, 16, 17, 18, - 19, 20, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 1, 67, 68, 69, 70, - 71, 69, 347, 71, 75, 11, 12, 78, 14, 15, - 420, 82, 83, 69, 70, 153, 388, 73, 74, 75, - 76, 77, 12, 447, 14, 15, 16, 17, 18, 19, - 14, 15, 16, 17, 18, 496, 367, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 1, 67, 68, 69, 70, 71, 436, 384, 74, 75, - 11, 12, 78, 14, 15, 81, 82, 83, 43, 44, + 71, 192, 133, 134, 72, 320, 71, 158, 139, 160, + 156, 196, 197, 144, 1, 195, 147, 150, 5, 5, + 151, 154, 74, 70, 155, 72, 5, 342, 75, 175, + 1, 177, 12, 179, 5, 7, 8, 9, 10, 11, + 171, 5, 1, 1, 15, 16, 17, 18, 19, 1, + 0, 1, 70, 184, 185, 41, 42, 5, 189, 190, + 191, 5, 419, 5, 1, 5, 381, 70, 5, 200, + 1, 13, 205, 5, 1, 0, 1, 208, 5, 43, + 211, 70, 397, 70, 71, 65, 17, 73, 75, 76, + 77, 78, 283, 72, 1, 5, 5, 278, 5, 70, + 71, 5, 70, 74, 75, 76, 77, 78, 80, 81, + 17, 70, 70, 0, 471, 246, 75, 75, 70, 250, + 251, 71, 70, 75, 275, 5, 311, 75, 259, 73, + 263, 71, 278, 70, 265, 419, 442, 268, 70, 70, + 305, 272, 273, 70, 71, 70, 71, 72, 75, 76, + 77, 78, 419, 284, 7, 8, 9, 10, 11, 419, + 70, 292, 71, 70, 295, 480, 70, 313, 42, 300, + 5, 317, 303, 0, 1, 1, 5, 12, 52, 70, + 70, 72, 72, 314, 13, 316, 13, 471, 319, 13, + 336, 322, 323, 374, 70, 5, 72, 348, 347, 330, + 331, 332, 333, 13, 471, 1, 337, 372, 339, 5, + 341, 471, 343, 40, 70, 346, 72, 1, 383, 15, + 16, 17, 18, 19, 355, 1, 357, 80, 81, 5, + 65, 70, 378, 72, 399, 366, 22, 13, 62, 370, + 371, 39, 69, 70, 71, 376, 421, 71, 394, 21, + 5, 1, 1, 13, 385, 5, 5, 408, 404, 390, + 406, 392, 21, 12, 40, 15, 16, 17, 18, 19, + 71, 70, 418, 72, 70, 71, 457, 1, 74, 75, + 76, 77, 78, 71, 13, 416, 41, 42, 17, 70, + 5, 72, 423, 69, 71, 426, 5, 428, 13, 5, + 35, 36, 433, 12, 13, 20, 21, 438, 1, 460, + 441, 457, 443, 5, 6, 70, 65, 70, 73, 72, + 70, 71, 5, 454, 74, 75, 76, 77, 78, 12, + 13, 13, 0, 1, 1, 41, 42, 66, 67, 70, + 72, 72, 473, 1, 12, 13, 72, 15, 16, 70, + 481, 72, 70, 484, 72, 27, 13, 74, 489, 490, + 70, 74, 72, 70, 70, 72, 497, 73, 70, 70, + 72, 72, 40, 1, 74, 506, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 70, + 68, 69, 70, 71, 72, 0, 1, 75, 76, 43, + 5, 79, 1, 5, 82, 83, 84, 12, 13, 70, + 15, 16, 70, 1, 72, 70, 1, 5, 71, 70, + 5, 72, 71, 5, 12, 13, 74, 420, 71, 71, + 15, 16, 17, 18, 19, 71, 347, 447, 153, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 69, - 47, 71, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 306, 67, 68, 69, 70, - 71, 173, 81, 74, 75, 1, 286, 78, 4, 358, - 81, 82, 83, 4, 451, 11, 12, 427, 14, 15, - 69, 12, 71, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 69, 69, 71, 71, 69, 30, - 71, 69, 69, 71, 71, 252, 94, 43, 44, 45, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 388, 68, 69, 70, 71, 72, 367, 1, + 436, 76, 496, 47, 79, 384, 306, 65, 83, 84, + 12, 13, 173, 15, 16, 70, 71, 5, 81, 74, + 75, 76, 77, 78, 286, 13, 358, 15, 16, 17, + 18, 19, 20, 21, 13, 451, 15, 16, 17, 18, + 19, 20, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 94, 68, 69, 70, 71, + 72, 135, 1, 75, 76, 0, 1, 79, 427, 471, + 82, 83, 84, 12, 13, 252, 15, 16, 13, 347, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 347, -1, -1, -1, 13, 31, 15, 16, 17, + 18, 19, 20, 21, 39, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, + 69, 70, 71, 72, -1, 1, 75, 76, -1, 5, + 79, -1, -1, 82, 83, 84, 12, 13, 5, 15, + 16, 15, 16, 17, 18, 19, 13, -1, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, + -1, -1, -1, -1, 31, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 135, 67, 68, 69, 70, 71, 347, 347, 1, 75, - 471, 4, 78, 69, -1, 71, 82, 83, 11, 12, - -1, 14, 15, 69, 69, 71, 71, 485, -1, 487, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 66, -1, 68, 69, 70, 71, 72, -1, 1, -1, + 76, -1, 5, 79, -1, -1, -1, 83, 84, 12, + 13, -1, 15, 16, 26, -1, 28, 29, 30, -1, + 32, 33, 34, -1, -1, -1, 38, -1, -1, -1, + -1, 5, -1, -1, -1, -1, -1, -1, -1, 13, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 1, 67, 68, -1, -1, -1, -1, - 73, 74, 75, 11, 12, 78, 14, 15, 81, 82, - 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 1, 67, - 68, -1, 70, -1, -1, -1, 74, 75, 11, 12, - 78, 14, 15, 81, 82, 83, -1, -1, -1, -1, + 63, 64, 65, 66, -1, 68, 69, 41, 42, -1, + -1, 74, 75, 76, 1, -1, 79, -1, -1, 82, + 83, 84, -1, -1, -1, 12, 13, -1, 15, 16, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + -1, 68, 69, -1, 71, -1, -1, 1, 75, 76, + -1, -1, 79, -1, -1, 82, 83, 84, 12, 13, + -1, 15, 16, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, -1, -1, -1, -1, + 74, 75, 76, 1, -1, 79, -1, 5, 82, 83, + 84, -1, -1, -1, 12, 13, -1, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 1, 67, 68, 4, -1, -1, -1, - 73, 74, 75, 11, 12, 78, 14, 15, 81, 82, - 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 4, 67, - 68, -1, -1, -1, -1, 11, 12, 75, 14, 15, - 78, -1, -1, -1, 82, 83, -1, -1, -1, -1, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 5, + 68, 69, -1, -1, -1, -1, 12, 13, 76, 15, + 16, 79, -1, -1, -1, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 43, 44, 45, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - -1, 67, 68, 11, 12, -1, 14, 15, -1, 75, - -1, -1, 78, -1, -1, -1, 82, 83, -1, -1, + 66, -1, 68, 69, 12, 13, -1, 15, 16, -1, + 76, -1, -1, 79, -1, -1, -1, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, -1, 67, - 68, -1, -1, -1, 0, 1, -1, 75, -1, -1, - 78, -1, -1, -1, 82, 83, 12, -1, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, - 1, -1, -1, -1, 30, -1, -1, -1, -1, -1, - -1, 12, 38, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, - -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, - -1, -1, -1, -1, 70 + 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, + 68, 69, -1, -1, 0, 1, -1, -1, 76, -1, + -1, 79, -1, -1, -1, 83, 84, 13, -1, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, + -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 71 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 25, 27, 28, 29, 31, 32, 33, 37, 85, - 87, 88, 89, 90, 91, 92, 93, 96, 98, 1, - 94, 69, 69, 69, 69, 4, 69, 69, 0, 94, - 94, 94, 94, 94, 94, 94, 95, 69, 71, 172, - 4, 11, 94, 94, 94, 94, 94, 94, 94, 4, - 5, 38, 99, 167, 168, 1, 94, 12, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 30, - 86, 103, 108, 127, 129, 135, 136, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 150, 153, 1, - 12, 39, 68, 154, 155, 156, 157, 163, 12, 61, - 132, 133, 134, 11, 12, 14, 15, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 67, 75, 78, 82, 83, 138, 159, 161, 162, 163, - 164, 165, 40, 41, 72, 120, 121, 123, 124, 140, - 1, 12, 111, 112, 113, 114, 1, 100, 108, 95, - 167, 0, 70, 97, 172, 173, 71, 20, 12, 16, - 65, 66, 12, 94, 20, 1, 94, 1, 94, 1, - 94, 94, 94, 1, 69, 74, 144, 1, 4, 75, - 76, 77, 137, 12, 19, 145, 146, 146, 1, 147, - 71, 173, 94, 94, 70, 1, 156, 173, 71, 173, - 1, 16, 172, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 60, 162, 1, 70, - 74, 81, 160, 94, 94, 94, 94, 70, 70, 71, - 173, 94, 70, 1, 113, 71, 173, 1, 16, 94, - 71, 172, 34, 35, 101, 109, 95, 95, 1, 12, - 12, 13, 63, 94, 12, 19, 143, 149, 71, 172, - 11, 64, 117, 71, 172, 69, 124, 126, 71, 172, - 69, 11, 12, 130, 70, 94, 94, 94, 94, 94, - 144, 146, 94, 1, 71, 173, 71, 1, 94, 71, - 94, 70, 69, 74, 1, 159, 94, 94, 94, 161, - 12, 118, 42, 12, 128, 94, 1, 71, 173, 71, - 94, 71, 94, 69, 94, 94, 26, 102, 115, 95, - 97, 172, 73, 73, 73, 144, 94, 12, 149, 6, - 7, 8, 9, 10, 79, 80, 151, 94, 94, 1, - 69, 74, 94, 94, 154, 142, 71, 94, 1, 94, - 94, 1, 159, 94, 94, 73, 94, 94, 94, 94, - 42, 122, 71, 94, 1, 94, 94, 1, 159, 94, - 125, 126, 36, 110, 1, 94, 1, 103, 104, 108, - 167, 169, 171, 95, 94, 79, 151, 94, 125, 105, - 94, 94, 154, 69, 97, 94, 71, 159, 39, 158, - 154, 134, 94, 16, 119, 120, 94, 94, 71, 159, - 154, 69, 4, 69, 71, 172, 12, 116, 172, 95, - 73, 94, 11, 12, 152, 71, 172, 1, 97, 106, - 107, 127, 129, 135, 136, 139, 166, 167, 169, 170, - 171, 105, 124, 70, 94, 94, 158, 94, 1, 70, - 94, 73, 121, 94, 70, 94, 126, 94, 4, 117, - 152, 94, 97, 95, 166, 94, 131, 159, 94, 94, - 111, 111, 94, 94, 79, 70, 132, 94, 70, 70, - 71, 79, 94 + 0, 26, 28, 29, 30, 32, 33, 34, 38, 86, + 88, 89, 90, 91, 92, 93, 94, 97, 99, 1, + 95, 70, 70, 70, 70, 5, 70, 70, 0, 95, + 95, 95, 95, 95, 95, 95, 96, 70, 72, 173, + 5, 12, 95, 95, 95, 95, 95, 95, 95, 5, + 6, 39, 100, 168, 169, 1, 95, 13, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 31, + 87, 104, 109, 128, 130, 136, 137, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 151, 154, 1, + 13, 40, 69, 155, 156, 157, 158, 164, 13, 62, + 133, 134, 135, 12, 13, 15, 16, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 68, 76, 79, 83, 84, 139, 160, 162, 163, 164, + 165, 166, 41, 42, 73, 121, 122, 124, 125, 141, + 1, 13, 112, 113, 114, 115, 1, 101, 109, 96, + 168, 0, 71, 98, 173, 174, 72, 21, 13, 17, + 66, 67, 13, 95, 21, 1, 95, 1, 95, 1, + 95, 95, 95, 1, 70, 75, 145, 1, 5, 76, + 77, 78, 138, 13, 20, 146, 147, 147, 1, 148, + 72, 174, 95, 95, 71, 1, 157, 174, 72, 174, + 1, 17, 173, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 61, 163, 1, 71, + 75, 82, 161, 95, 95, 95, 95, 71, 71, 72, + 174, 95, 71, 1, 114, 72, 174, 1, 17, 95, + 72, 173, 35, 36, 102, 110, 96, 96, 1, 13, + 13, 14, 64, 95, 13, 20, 144, 150, 72, 173, + 12, 65, 118, 72, 173, 70, 125, 127, 72, 173, + 70, 12, 13, 131, 71, 95, 95, 95, 95, 95, + 145, 147, 95, 1, 72, 174, 72, 1, 95, 72, + 95, 71, 70, 75, 1, 160, 95, 95, 95, 162, + 13, 119, 43, 13, 129, 95, 1, 72, 174, 72, + 95, 72, 95, 70, 95, 95, 27, 103, 116, 96, + 98, 173, 74, 74, 74, 145, 95, 13, 150, 7, + 8, 9, 10, 11, 80, 81, 152, 95, 95, 1, + 70, 75, 95, 95, 155, 143, 72, 95, 1, 95, + 95, 1, 160, 95, 95, 74, 95, 95, 95, 95, + 43, 123, 72, 95, 1, 95, 95, 1, 160, 95, + 126, 127, 37, 111, 1, 95, 1, 104, 105, 109, + 168, 170, 172, 96, 95, 80, 152, 95, 126, 106, + 95, 95, 155, 70, 98, 95, 72, 160, 40, 159, + 155, 135, 95, 17, 120, 121, 95, 95, 72, 160, + 155, 70, 5, 70, 72, 173, 13, 117, 173, 96, + 74, 95, 12, 13, 153, 72, 173, 1, 98, 107, + 108, 128, 130, 136, 137, 140, 167, 168, 170, 171, + 172, 106, 125, 71, 95, 95, 159, 95, 1, 71, + 95, 74, 122, 95, 71, 95, 127, 95, 5, 118, + 153, 95, 98, 96, 167, 95, 132, 160, 95, 95, + 112, 112, 95, 95, 80, 71, 133, 95, 71, 71, + 72, 80, 95 }; #define yyerrok (yyerrstatus = 0) @@ -1546,17 +1509,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1590,11 +1556,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1874,10 +1840,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1896,10 +1860,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1923,74 +1886,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -2020,7 +1984,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -2028,7 +1991,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2051,9 +2013,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2064,7 +2025,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2074,6 +2034,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2082,16 +2045,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2123,20 +2086,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2176,35 +2135,45 @@ yyreduce: switch (yyn) { case 12: -#line 279 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 281 "../css/CSSGrammar.y" { static_cast(parser)->m_rule = (yyvsp[(4) - (6)].rule); ;} break; case 13: -#line 285 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 287 "../css/CSSGrammar.y" { static_cast(parser)->m_keyframe = (yyvsp[(4) - (6)].keyframeRule); ;} break; case 14: -#line 291 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 293 "../css/CSSGrammar.y" { /* can be empty */ ;} break; case 15: -#line 297 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 299 "../css/CSSGrammar.y" { /* can be empty */ ;} break; case 16: -#line 303 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 305 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(4) - (5)].valueList)) { @@ -2219,7 +2188,9 @@ yyreduce: break; case 17: -#line 317 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 319 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); p->m_mediaQuery = p->sinkFloatingMediaQuery((yyvsp[(4) - (5)].mediaQuery)); @@ -2227,7 +2198,9 @@ yyreduce: break; case 18: -#line 324 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 326 "../css/CSSGrammar.y" { if ((yyvsp[(4) - (5)].selectorList)) { CSSParser* p = static_cast(parser); @@ -2238,13 +2211,17 @@ yyreduce: break; case 25: -#line 346 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 348 "../css/CSSGrammar.y" { ;} break; case 28: -#line 356 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 358 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.rule) = static_cast(parser)->createCharsetRule((yyvsp[(3) - (5)].string)); @@ -2254,19 +2231,25 @@ yyreduce: break; case 29: -#line 362 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 364 "../css/CSSGrammar.y" { ;} break; case 30: -#line 364 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 366 "../css/CSSGrammar.y" { ;} break; case 32: -#line 370 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 372 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2275,13 +2258,17 @@ yyreduce: break; case 33: -#line 375 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 377 "../css/CSSGrammar.y" { ;} break; case 35: -#line 381 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 383 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2290,7 +2277,9 @@ yyreduce: break; case 39: -#line 395 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 397 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2299,12 +2288,16 @@ yyreduce: break; case 49: -#line 418 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 420 "../css/CSSGrammar.y" { (yyval.ruleList) = 0; ;} break; case 50: -#line 419 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 421 "../css/CSSGrammar.y" { (yyval.ruleList) = (yyvsp[(1) - (3)].ruleList); if ((yyvsp[(2) - (3)].rule)) { @@ -2316,70 +2309,90 @@ yyreduce: break; case 60: -#line 446 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 448 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createImportRule((yyvsp[(3) - (6)].string), (yyvsp[(5) - (6)].mediaList)); ;} break; case 61: -#line 449 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 451 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 62: -#line 452 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 454 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 63: -#line 455 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 457 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 64: -#line 461 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 463 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), true); ;} break; case 65: -#line 465 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 467 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), false); ;} break; case 66: -#line 471 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 473 "../css/CSSGrammar.y" { (yyval.mediaList) = static_cast(parser)->createMediaList(); ;} break; case 67: -#line 475 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 477 "../css/CSSGrammar.y" { (yyval.mediaList) = (yyvsp[(3) - (3)].mediaList); ;} break; case 68: -#line 481 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 483 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 69: -#line 484 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 486 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); if ((yyvsp[(2) - (2)].boolean)) @@ -2388,63 +2401,81 @@ yyreduce: break; case 70: -#line 489 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 491 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 71: -#line 492 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 494 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 72: -#line 495 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 497 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 73: -#line 498 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 500 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 74: -#line 504 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 506 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (3)].boolean); ;} break; case 75: -#line 507 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 509 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 76: -#line 510 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 512 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 77: -#line 513 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 515 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 78: -#line 516 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 518 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); if ((yyvsp[(2) - (4)].boolean)) @@ -2453,49 +2484,63 @@ yyreduce: break; case 79: -#line 521 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 523 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); ;} break; case 80: -#line 524 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 526 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (6)].boolean); ;} break; case 81: -#line 530 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 532 "../css/CSSGrammar.y" { (yyval.boolean) = static_cast(parser)->addVariable((yyvsp[(1) - (4)].string), (yyvsp[(4) - (4)].valueList)); ;} break; case 82: -#line 534 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 536 "../css/CSSGrammar.y" { (yyval.boolean) = static_cast(parser)->addVariableDeclarationBlock((yyvsp[(1) - (7)].string)); ;} break; case 83: -#line 538 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 540 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 84: -#line 542 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 544 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 85: -#line 546 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 548 "../css/CSSGrammar.y" { /* @variables { varname: } Just reduce away this variable with no value. */ (yyval.boolean) = false; @@ -2503,7 +2548,9 @@ yyreduce: break; case 86: -#line 551 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 553 "../css/CSSGrammar.y" { /* if we come across rules with invalid values like this case: @variables { varname: *; }, just discard the property/value pair */ (yyval.boolean) = false; @@ -2511,14 +2558,18 @@ yyreduce: break; case 87: -#line 558 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 560 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 88: -#line 564 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 566 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if (p->m_styleSheet) @@ -2527,38 +2578,50 @@ yyreduce: break; case 91: -#line 574 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 576 "../css/CSSGrammar.y" { (yyval.string).characters = 0; ;} break; case 92: -#line 575 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 577 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 95: -#line 584 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 586 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 96: -#line 590 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 592 "../css/CSSGrammar.y" { (yyval.valueList) = 0; ;} break; case 97: -#line 593 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 595 "../css/CSSGrammar.y" { (yyval.valueList) = (yyvsp[(3) - (4)].valueList); ;} break; case 98: -#line 599 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 601 "../css/CSSGrammar.y" { (yyvsp[(3) - (7)].string).lower(); (yyval.mediaQueryExp) = static_cast(parser)->createFloatingMediaQueryExp((yyvsp[(3) - (7)].string), (yyvsp[(5) - (7)].valueList)); @@ -2566,7 +2629,9 @@ yyreduce: break; case 99: -#line 606 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 608 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaQueryExpList) = p->createFloatingMediaQueryExpList(); @@ -2575,7 +2640,9 @@ yyreduce: break; case 100: -#line 611 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 613 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = (yyvsp[(1) - (5)].mediaQueryExpList); (yyval.mediaQueryExpList)->append(static_cast(parser)->sinkFloatingMediaQueryExp((yyvsp[(5) - (5)].mediaQueryExp))); @@ -2583,42 +2650,54 @@ yyreduce: break; case 101: -#line 618 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 620 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = static_cast(parser)->createFloatingMediaQueryExpList(); ;} break; case 102: -#line 621 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 623 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = (yyvsp[(3) - (3)].mediaQueryExpList); ;} break; case 103: -#line 627 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 629 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::None; ;} break; case 104: -#line 630 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 632 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::Only; ;} break; case 105: -#line 633 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 635 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::Not; ;} break; case 106: -#line 639 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 641 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaQuery) = p->createFloatingMediaQuery(p->sinkFloatingMediaQueryExpList((yyvsp[(1) - (1)].mediaQueryExpList))); @@ -2626,7 +2705,9 @@ yyreduce: break; case 107: -#line 644 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 646 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyvsp[(3) - (4)].string).lower(); @@ -2635,14 +2716,18 @@ yyreduce: break; case 108: -#line 652 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 654 "../css/CSSGrammar.y" { (yyval.mediaList) = static_cast(parser)->createMediaList(); ;} break; case 110: -#line 659 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 661 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaList) = p->createMediaList(); @@ -2651,7 +2736,9 @@ yyreduce: break; case 111: -#line 664 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 666 "../css/CSSGrammar.y" { (yyval.mediaList) = (yyvsp[(1) - (4)].mediaList); if ((yyval.mediaList)) @@ -2660,35 +2747,45 @@ yyreduce: break; case 112: -#line 669 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 671 "../css/CSSGrammar.y" { (yyval.mediaList) = 0; ;} break; case 113: -#line 675 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 677 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createMediaRule((yyvsp[(3) - (7)].mediaList), (yyvsp[(6) - (7)].ruleList)); ;} break; case 114: -#line 678 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 680 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createMediaRule(0, (yyvsp[(5) - (6)].ruleList)); ;} break; case 115: -#line 684 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 686 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 116: -#line 690 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 692 "../css/CSSGrammar.y" { (yyval.rule) = (yyvsp[(7) - (8)].keyframesRule); (yyvsp[(7) - (8)].keyframesRule)->setNameInternal((yyvsp[(3) - (8)].string)); @@ -2696,12 +2793,16 @@ yyreduce: break; case 119: -#line 702 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 704 "../css/CSSGrammar.y" { (yyval.keyframesRule) = static_cast(parser)->createKeyframesRule(); ;} break; case 120: -#line 703 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 705 "../css/CSSGrammar.y" { (yyval.keyframesRule) = (yyvsp[(1) - (3)].keyframesRule); if ((yyvsp[(2) - (3)].keyframeRule)) @@ -2710,14 +2811,18 @@ yyreduce: break; case 121: -#line 711 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 713 "../css/CSSGrammar.y" { (yyval.keyframeRule) = static_cast(parser)->createKeyframeRule((yyvsp[(1) - (6)].valueList)); ;} break; case 122: -#line 717 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 719 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = p->createFloatingValueList(); @@ -2726,7 +2831,9 @@ yyreduce: break; case 123: -#line 722 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 724 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = (yyvsp[(1) - (5)].valueList); @@ -2736,12 +2843,16 @@ yyreduce: break; case 124: -#line 731 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 733 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (1)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 125: -#line 732 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 734 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; CSSParserString& str = (yyvsp[(1) - (1)].string); @@ -2755,74 +2866,98 @@ yyreduce: break; case 126: -#line 756 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 758 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 127: -#line 759 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 761 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 128: -#line 766 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 768 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createFontFaceRule(); ;} break; case 129: -#line 769 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 771 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 130: -#line 772 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 774 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 131: -#line 778 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 780 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::DirectAdjacent; ;} break; case 132: -#line 779 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 781 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::IndirectAdjacent; ;} break; case 133: -#line 780 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 782 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::Child; ;} break; case 134: -#line 784 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 786 "../css/CSSGrammar.y" { (yyval.integer) = -1; ;} break; case 135: -#line 785 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 787 "../css/CSSGrammar.y" { (yyval.integer) = 1; ;} break; case 136: -#line 789 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 791 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createStyleRule((yyvsp[(1) - (5)].selectorList)); ;} break; case 137: -#line 795 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 797 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (1)].selector)) { CSSParser* p = static_cast(parser); @@ -2835,7 +2970,9 @@ yyreduce: break; case 138: -#line 804 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 806 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (4)].selectorList) && (yyvsp[(4) - (4)].selector)) { CSSParser* p = static_cast(parser); @@ -2847,35 +2984,45 @@ yyreduce: break; case 139: -#line 812 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 814 "../css/CSSGrammar.y" { (yyval.selectorList) = 0; ;} break; case 140: -#line 818 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 820 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (2)].selector); ;} break; case 141: -#line 824 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 826 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 142: -#line 828 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 830 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 143: -#line 832 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 834 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if (!(yyvsp[(1) - (2)].selector)) @@ -2894,7 +3041,9 @@ yyreduce: break; case 144: -#line 847 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 849 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(3) - (3)].selector); if (!(yyvsp[(1) - (3)].selector)) @@ -2918,29 +3067,39 @@ yyreduce: break; case 145: -#line 867 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 869 "../css/CSSGrammar.y" { (yyval.selector) = 0; ;} break; case 146: -#line 873 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 875 "../css/CSSGrammar.y" { (yyval.string).characters = 0; (yyval.string).length = 0; ;} break; case 147: -#line 874 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 876 "../css/CSSGrammar.y" { static UChar star = '*'; (yyval.string).characters = ☆ (yyval.string).length = 1; ;} break; case 148: -#line 875 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 877 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 149: -#line 879 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 881 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -2949,7 +3108,9 @@ yyreduce: break; case 150: -#line 884 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 886 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if ((yyval.selector)) { @@ -2960,7 +3121,9 @@ yyreduce: break; case 151: -#line 891 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 893 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); CSSParser* p = static_cast(parser); @@ -2970,7 +3133,9 @@ yyreduce: break; case 152: -#line 897 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 899 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(1) - (2)].string); CSSParser* p = static_cast(parser); @@ -2984,7 +3149,9 @@ yyreduce: break; case 153: -#line 907 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 909 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(3) - (3)].selector); if ((yyval.selector)) { @@ -3000,7 +3167,9 @@ yyreduce: break; case 154: -#line 919 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 921 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if ((yyval.selector)) { @@ -3014,7 +3183,9 @@ yyreduce: break; case 155: -#line 932 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 934 "../css/CSSGrammar.y" { CSSParserString& str = (yyvsp[(1) - (1)].string); CSSParser* p = static_cast(parser); @@ -3026,7 +3197,9 @@ yyreduce: break; case 156: -#line 940 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 942 "../css/CSSGrammar.y" { static UChar star = '*'; (yyval.string).characters = ☆ @@ -3035,14 +3208,18 @@ yyreduce: break; case 157: -#line 948 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 950 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 158: -#line 951 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 953 "../css/CSSGrammar.y" { if (!(yyvsp[(2) - (2)].selector)) (yyval.selector) = 0; @@ -3059,14 +3236,18 @@ yyreduce: break; case 159: -#line 964 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 966 "../css/CSSGrammar.y" { (yyval.selector) = 0; ;} break; case 160: -#line 970 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 972 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3078,7 +3259,9 @@ yyreduce: break; case 161: -#line 978 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 980 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (1)].string).characters[0] >= '0' && (yyvsp[(1) - (1)].string).characters[0] <= '9') { (yyval.selector) = 0; @@ -3094,7 +3277,9 @@ yyreduce: break; case 165: -#line 996 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 998 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3106,7 +3291,9 @@ yyreduce: break; case 166: -#line 1007 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1009 "../css/CSSGrammar.y" { CSSParserString& str = (yyvsp[(1) - (2)].string); CSSParser* p = static_cast(parser); @@ -3118,7 +3305,9 @@ yyreduce: break; case 167: -#line 1018 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1020 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->setAttribute(QualifiedName(nullAtom, (yyvsp[(3) - (4)].string), nullAtom)); @@ -3127,7 +3316,9 @@ yyreduce: break; case 168: -#line 1023 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1025 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->setAttribute(QualifiedName(nullAtom, (yyvsp[(3) - (8)].string), nullAtom)); @@ -3137,7 +3328,9 @@ yyreduce: break; case 169: -#line 1029 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1031 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(3) - (5)].string); CSSParser* p = static_cast(parser); @@ -3149,7 +3342,9 @@ yyreduce: break; case 170: -#line 1037 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1039 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(3) - (9)].string); CSSParser* p = static_cast(parser); @@ -3162,49 +3357,63 @@ yyreduce: break; case 171: -#line 1049 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1051 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Exact; ;} break; case 172: -#line 1052 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1054 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::List; ;} break; case 173: -#line 1055 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1057 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Hyphen; ;} break; case 174: -#line 1058 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1060 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Begin; ;} break; case 175: -#line 1061 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1063 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::End; ;} break; case 176: -#line 1064 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1066 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Contain; ;} break; case 179: -#line 1075 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1077 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->m_match = CSSSelector::PseudoClass; @@ -3233,7 +3442,9 @@ yyreduce: break; case 180: -#line 1100 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1102 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->m_match = CSSSelector::PseudoElement; @@ -3251,7 +3462,9 @@ yyreduce: break; case 181: -#line 1115 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1117 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3272,7 +3485,9 @@ yyreduce: break; case 182: -#line 1133 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1135 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3293,7 +3508,9 @@ yyreduce: break; case 183: -#line 1151 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1153 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3315,7 +3532,9 @@ yyreduce: break; case 184: -#line 1170 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1172 "../css/CSSGrammar.y" { if (!(yyvsp[(4) - (6)].selector)) (yyval.selector) = 0; @@ -3331,14 +3550,18 @@ yyreduce: break; case 185: -#line 1185 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1187 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 186: -#line 1188 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1190 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); if ( (yyvsp[(2) - (2)].boolean) ) @@ -3347,70 +3570,90 @@ yyreduce: break; case 187: -#line 1193 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1195 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 188: -#line 1196 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1198 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 189: -#line 1199 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1201 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 190: -#line 1202 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1204 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 191: -#line 1205 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1207 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 192: -#line 1211 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1213 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (3)].boolean); ;} break; case 193: -#line 1214 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1216 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 194: -#line 1217 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1219 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 195: -#line 1220 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1222 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 196: -#line 1223 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1225 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); if ((yyvsp[(2) - (4)].boolean)) @@ -3419,21 +3662,27 @@ yyreduce: break; case 197: -#line 1228 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1230 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); ;} break; case 198: -#line 1231 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1233 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (6)].boolean); ;} break; case 199: -#line 1237 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1239 "../css/CSSGrammar.y" { (yyval.boolean) = false; CSSParser* p = static_cast(parser); @@ -3450,7 +3699,9 @@ yyreduce: break; case 200: -#line 1251 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1253 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); p->m_valueList = new CSSParserValueList; @@ -3465,14 +3716,18 @@ yyreduce: break; case 201: -#line 1263 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1265 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 202: -#line 1267 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1269 "../css/CSSGrammar.y" { /* The default movable type template has letter-spacing: .none; Handle this by looking for error tokens at the start of an expr, recover the expr and then treat as an error, cleaning @@ -3482,7 +3737,9 @@ yyreduce: break; case 203: -#line 1274 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1276 "../css/CSSGrammar.y" { /* When we encounter something like p {color: red !important fail;} we should drop the declaration */ (yyval.boolean) = false; @@ -3490,7 +3747,9 @@ yyreduce: break; case 204: -#line 1279 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1281 "../css/CSSGrammar.y" { /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */ (yyval.boolean) = false; @@ -3498,7 +3757,9 @@ yyreduce: break; case 205: -#line 1284 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1286 "../css/CSSGrammar.y" { /* div { font-family: } Just reduce away this property with no value. */ (yyval.boolean) = false; @@ -3506,7 +3767,9 @@ yyreduce: break; case 206: -#line 1289 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1291 "../css/CSSGrammar.y" { /* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */ (yyval.boolean) = false; @@ -3514,7 +3777,9 @@ yyreduce: break; case 207: -#line 1294 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1296 "../css/CSSGrammar.y" { /* if we come across: div { color{;color:maroon} }, ignore everything within curly brackets */ (yyval.boolean) = false; @@ -3522,24 +3787,32 @@ yyreduce: break; case 208: -#line 1301 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1303 "../css/CSSGrammar.y" { (yyval.integer) = cssPropertyID((yyvsp[(1) - (2)].string)); ;} break; case 209: -#line 1307 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1309 "../css/CSSGrammar.y" { (yyval.boolean) = true; ;} break; case 210: -#line 1308 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1310 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 211: -#line 1312 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1314 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = p->createFloatingValueList(); @@ -3548,7 +3821,9 @@ yyreduce: break; case 212: -#line 1317 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1319 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = (yyvsp[(1) - (3)].valueList); @@ -3566,50 +3841,66 @@ yyreduce: break; case 213: -#line 1331 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1333 "../css/CSSGrammar.y" { (yyval.valueList) = 0; ;} break; case 214: -#line 1337 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1339 "../css/CSSGrammar.y" { (yyval.character) = '/'; ;} break; case 215: -#line 1340 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1342 "../css/CSSGrammar.y" { (yyval.character) = ','; ;} break; case 216: -#line 1343 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1345 "../css/CSSGrammar.y" { (yyval.character) = 0; ;} break; case 217: -#line 1349 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1351 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (1)].value); ;} break; case 218: -#line 1350 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1352 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(2) - (2)].value); (yyval.value).fValue *= (yyvsp[(1) - (2)].integer); ;} break; case 219: -#line 1351 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1353 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_STRING; ;} break; case 220: -#line 1352 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1354 "../css/CSSGrammar.y" { (yyval.value).id = cssValueKeywordID((yyvsp[(1) - (2)].string)); (yyval.value).unit = CSSPrimitiveValue::CSS_IDENT; @@ -3618,156 +3909,216 @@ yyreduce: break; case 221: -#line 1358 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION ;} + +/* Line 1455 of yacc.c */ +#line 1360 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;} break; case 222: -#line 1359 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(2) - (3)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION ;} + +/* Line 1455 of yacc.c */ +#line 1361 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(2) - (3)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;} break; case 223: -#line 1360 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1362 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_URI; ;} break; case 224: -#line 1361 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_UNICODE_RANGE ;} + +/* Line 1455 of yacc.c */ +#line 1363 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; ;} break; case 225: -#line 1362 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1364 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (1)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;} break; case 226: -#line 1363 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1365 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = CSSParserString(); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;} break; case 227: -#line 1365 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1367 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (1)].value); ;} break; case 228: -#line 1368 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1370 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (2)].value); ;} break; case 229: -#line 1371 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1373 "../css/CSSGrammar.y" {;} break; case 230: -#line 1375 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1377 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = true; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 231: -#line 1376 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1378 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 232: -#line 1377 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1379 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PERCENTAGE; ;} break; case 233: -#line 1378 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1380 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PX; ;} break; case 234: -#line 1379 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1381 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_CM; ;} break; case 235: -#line 1380 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1382 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MM; ;} break; case 236: -#line 1381 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1383 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_IN; ;} break; case 237: -#line 1382 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1384 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PT; ;} break; case 238: -#line 1383 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1385 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PC; ;} break; case 239: -#line 1384 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1386 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_DEG; ;} break; case 240: -#line 1385 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1387 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_RAD; ;} break; case 241: -#line 1386 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1388 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_GRAD; ;} break; case 242: -#line 1387 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1389 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_TURN; ;} break; case 243: -#line 1388 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1390 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MS; ;} break; case 244: -#line 1389 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1391 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_S; ;} break; case 245: -#line 1390 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1392 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_HZ; ;} break; case 246: -#line 1391 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1393 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_KHZ; ;} break; case 247: -#line 1392 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1394 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EMS; ;} break; case 248: -#line 1393 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1395 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSParserValue::Q_EMS; ;} break; case 249: -#line 1394 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1396 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EXS; ;} break; case 250: -#line 1398 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1400 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (1)].string); @@ -3776,7 +4127,9 @@ yyreduce: break; case 251: -#line 1406 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1408 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); CSSParserFunction* f = p->createFloatingFunction(); @@ -3789,7 +4142,9 @@ yyreduce: break; case 252: -#line 1415 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1417 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); CSSParserFunction* f = p->createFloatingFunction(); @@ -3802,67 +4157,86 @@ yyreduce: break; case 253: -#line 1431 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1433 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 254: -#line 1432 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1434 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 255: -#line 1439 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1441 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 256: -#line 1442 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1444 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 257: -#line 1448 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1450 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 258: -#line 1451 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1453 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 261: -#line 1462 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1464 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 262: -#line 1468 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1470 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 263: -#line 1474 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1476 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; -/* Line 1267 of yacc.c. */ -#line 3866 "WebCore/tmp/../generated/CSSGrammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 4240 "WebCore/tmp/../generated/CSSGrammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3873,7 +4247,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -3938,7 +4311,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -3955,7 +4328,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4012,9 +4385,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -4039,7 +4409,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4050,7 +4420,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -4076,6 +4446,8 @@ yyreturn: } -#line 1501 "../css/CSSGrammar.y" + +/* Line 1675 of yacc.c */ +#line 1503 "../css/CSSGrammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h index 1b60c68..84ad511 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h @@ -1,26 +1,25 @@ #ifndef CSSGRAMMAR_H #define CSSGRAMMAR_H -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -31,10 +30,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -42,140 +42,80 @@ know about them. */ enum yytokentype { TOKEN_EOF = 0, - UNIMPORTANT_TOK = 258, - WHITESPACE = 259, - SGML_CD = 260, - INCLUDES = 261, - DASHMATCH = 262, - BEGINSWITH = 263, - ENDSWITH = 264, - CONTAINS = 265, - STRING = 266, - IDENT = 267, - NTH = 268, - HEX = 269, - IDSEL = 270, - IMPORT_SYM = 271, - PAGE_SYM = 272, - MEDIA_SYM = 273, - FONT_FACE_SYM = 274, - CHARSET_SYM = 275, - NAMESPACE_SYM = 276, - WEBKIT_RULE_SYM = 277, - WEBKIT_DECLS_SYM = 278, - WEBKIT_KEYFRAME_RULE_SYM = 279, - WEBKIT_KEYFRAMES_SYM = 280, - WEBKIT_VALUE_SYM = 281, - WEBKIT_MEDIAQUERY_SYM = 282, - WEBKIT_SELECTOR_SYM = 283, - WEBKIT_VARIABLES_SYM = 284, - WEBKIT_DEFINE_SYM = 285, - VARIABLES_FOR = 286, - WEBKIT_VARIABLES_DECLS_SYM = 287, - ATKEYWORD = 288, - IMPORTANT_SYM = 289, - MEDIA_ONLY = 290, - MEDIA_NOT = 291, - MEDIA_AND = 292, - QEMS = 293, - EMS = 294, - EXS = 295, - PXS = 296, - CMS = 297, - MMS = 298, - INS = 299, - PTS = 300, - PCS = 301, - DEGS = 302, - RADS = 303, - GRADS = 304, - TURNS = 305, - MSECS = 306, - SECS = 307, - HERZ = 308, - KHERZ = 309, - DIMEN = 310, - PERCENTAGE = 311, - FLOATTOKEN = 312, - INTEGER = 313, - URI = 314, - FUNCTION = 315, - NOTFUNCTION = 316, - UNICODERANGE = 317, - VARCALL = 318 + LOWEST_PREC = 258, + UNIMPORTANT_TOK = 259, + WHITESPACE = 260, + SGML_CD = 261, + INCLUDES = 262, + DASHMATCH = 263, + BEGINSWITH = 264, + ENDSWITH = 265, + CONTAINS = 266, + STRING = 267, + IDENT = 268, + NTH = 269, + HEX = 270, + IDSEL = 271, + IMPORT_SYM = 272, + PAGE_SYM = 273, + MEDIA_SYM = 274, + FONT_FACE_SYM = 275, + CHARSET_SYM = 276, + NAMESPACE_SYM = 277, + WEBKIT_RULE_SYM = 278, + WEBKIT_DECLS_SYM = 279, + WEBKIT_KEYFRAME_RULE_SYM = 280, + WEBKIT_KEYFRAMES_SYM = 281, + WEBKIT_VALUE_SYM = 282, + WEBKIT_MEDIAQUERY_SYM = 283, + WEBKIT_SELECTOR_SYM = 284, + WEBKIT_VARIABLES_SYM = 285, + WEBKIT_DEFINE_SYM = 286, + VARIABLES_FOR = 287, + WEBKIT_VARIABLES_DECLS_SYM = 288, + ATKEYWORD = 289, + IMPORTANT_SYM = 290, + MEDIA_ONLY = 291, + MEDIA_NOT = 292, + MEDIA_AND = 293, + QEMS = 294, + EMS = 295, + EXS = 296, + PXS = 297, + CMS = 298, + MMS = 299, + INS = 300, + PTS = 301, + PCS = 302, + DEGS = 303, + RADS = 304, + GRADS = 305, + TURNS = 306, + MSECS = 307, + SECS = 308, + HERZ = 309, + KHERZ = 310, + DIMEN = 311, + PERCENTAGE = 312, + FLOATTOKEN = 313, + INTEGER = 314, + URI = 315, + FUNCTION = 316, + NOTFUNCTION = 317, + UNICODERANGE = 318, + VARCALL = 319 }; #endif -/* Tokens. */ -#define TOKEN_EOF 0 -#define UNIMPORTANT_TOK 258 -#define WHITESPACE 259 -#define SGML_CD 260 -#define INCLUDES 261 -#define DASHMATCH 262 -#define BEGINSWITH 263 -#define ENDSWITH 264 -#define CONTAINS 265 -#define STRING 266 -#define IDENT 267 -#define NTH 268 -#define HEX 269 -#define IDSEL 270 -#define IMPORT_SYM 271 -#define PAGE_SYM 272 -#define MEDIA_SYM 273 -#define FONT_FACE_SYM 274 -#define CHARSET_SYM 275 -#define NAMESPACE_SYM 276 -#define WEBKIT_RULE_SYM 277 -#define WEBKIT_DECLS_SYM 278 -#define WEBKIT_KEYFRAME_RULE_SYM 279 -#define WEBKIT_KEYFRAMES_SYM 280 -#define WEBKIT_VALUE_SYM 281 -#define WEBKIT_MEDIAQUERY_SYM 282 -#define WEBKIT_SELECTOR_SYM 283 -#define WEBKIT_VARIABLES_SYM 284 -#define WEBKIT_DEFINE_SYM 285 -#define VARIABLES_FOR 286 -#define WEBKIT_VARIABLES_DECLS_SYM 287 -#define ATKEYWORD 288 -#define IMPORTANT_SYM 289 -#define MEDIA_ONLY 290 -#define MEDIA_NOT 291 -#define MEDIA_AND 292 -#define QEMS 293 -#define EMS 294 -#define EXS 295 -#define PXS 296 -#define CMS 297 -#define MMS 298 -#define INS 299 -#define PTS 300 -#define PCS 301 -#define DEGS 302 -#define RADS 303 -#define GRADS 304 -#define TURNS 305 -#define MSECS 306 -#define SECS 307 -#define HERZ 308 -#define KHERZ 309 -#define DIMEN 310 -#define PERCENTAGE 311 -#define FLOATTOKEN 312 -#define INTEGER 313 -#define URI 314 -#define FUNCTION 315 -#define NOTFUNCTION 316 -#define UNICODERANGE 317 -#define VARCALL 318 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 57 "../css/CSSGrammar.y" { + +/* Line 1676 of yacc.c */ +#line 57 "../css/CSSGrammar.y" + bool boolean; char character; int integer; @@ -197,15 +137,18 @@ typedef union YYSTYPE WebKitCSSKeyframeRule* keyframeRule; WebKitCSSKeyframesRule* keyframesRule; float val; -} -/* Line 1489 of yacc.c. */ -#line 201 "WebCore/tmp/../generated/CSSGrammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 143 "WebCore/tmp/../generated/CSSGrammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + #endif diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp index 6f09be8..fd20f69 100644 --- a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,159 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse jscyyparse -#define yylex jscyylex -#define yyerror jscyyerror -#define yylval jscyylval -#define yychar jscyychar -#define yydebug jscyydebug -#define yynerrs jscyynerrs -#define yylloc jscyylloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NULLTOKEN = 258, - TRUETOKEN = 259, - FALSETOKEN = 260, - BREAK = 261, - CASE = 262, - DEFAULT = 263, - FOR = 264, - NEW = 265, - VAR = 266, - CONSTTOKEN = 267, - CONTINUE = 268, - FUNCTION = 269, - RETURN = 270, - VOIDTOKEN = 271, - DELETETOKEN = 272, - IF = 273, - THISTOKEN = 274, - DO = 275, - WHILE = 276, - INTOKEN = 277, - INSTANCEOF = 278, - TYPEOF = 279, - SWITCH = 280, - WITH = 281, - RESERVED = 282, - THROW = 283, - TRY = 284, - CATCH = 285, - FINALLY = 286, - DEBUGGER = 287, - IF_WITHOUT_ELSE = 288, - ELSE = 289, - EQEQ = 290, - NE = 291, - STREQ = 292, - STRNEQ = 293, - LE = 294, - GE = 295, - OR = 296, - AND = 297, - PLUSPLUS = 298, - MINUSMINUS = 299, - LSHIFT = 300, - RSHIFT = 301, - URSHIFT = 302, - PLUSEQUAL = 303, - MINUSEQUAL = 304, - MULTEQUAL = 305, - DIVEQUAL = 306, - LSHIFTEQUAL = 307, - RSHIFTEQUAL = 308, - URSHIFTEQUAL = 309, - ANDEQUAL = 310, - MODEQUAL = 311, - XOREQUAL = 312, - OREQUAL = 313, - OPENBRACE = 314, - CLOSEBRACE = 315, - NUMBER = 316, - IDENT = 317, - STRING = 318, - AUTOPLUSPLUS = 319, - AUTOMINUSMINUS = 320 - }; -#endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - - - +#define yyparse jscyyparse +#define yylex jscyylex +#define yyerror jscyyerror +#define yylval jscyylval +#define yychar jscyychar +#define yydebug jscyydebug +#define yynerrs jscyynerrs +#define yylloc jscyylloc /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 3 "../../JavaScriptCore/parser/Grammar.y" @@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD +/* Line 189 of yacc.c */ +#line 236 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NULLTOKEN = 258, + TRUETOKEN = 259, + FALSETOKEN = 260, + BREAK = 261, + CASE = 262, + DEFAULT = 263, + FOR = 264, + NEW = 265, + VAR = 266, + CONSTTOKEN = 267, + CONTINUE = 268, + FUNCTION = 269, + RETURN = 270, + VOIDTOKEN = 271, + DELETETOKEN = 272, + IF = 273, + THISTOKEN = 274, + DO = 275, + WHILE = 276, + INTOKEN = 277, + INSTANCEOF = 278, + TYPEOF = 279, + SWITCH = 280, + WITH = 281, + RESERVED = 282, + THROW = 283, + TRY = 284, + CATCH = 285, + FINALLY = 286, + DEBUGGER = 287, + IF_WITHOUT_ELSE = 288, + ELSE = 289, + EQEQ = 290, + NE = 291, + STREQ = 292, + STRNEQ = 293, + LE = 294, + GE = 295, + OR = 296, + AND = 297, + PLUSPLUS = 298, + MINUSMINUS = 299, + LSHIFT = 300, + RSHIFT = 301, + URSHIFT = 302, + PLUSEQUAL = 303, + MINUSEQUAL = 304, + MULTEQUAL = 305, + DIVEQUAL = 306, + LSHIFTEQUAL = 307, + RSHIFTEQUAL = 308, + URSHIFTEQUAL = 309, + ANDEQUAL = 310, + MODEQUAL = 311, + XOREQUAL = 312, + OREQUAL = 313, + OPENBRACE = 314, + CLOSEBRACE = 315, + NUMBER = 316, + IDENT = 317, + STRING = 318, + AUTOPLUSPLUS = 319, + AUTOMINUSMINUS = 320 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../../JavaScriptCore/parser/Grammar.y" { + +/* Line 214 of yacc.c */ +#line 157 "../../JavaScriptCore/parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -414,13 +363,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 187 of yacc.c. */ -#line 420 "Grammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 371 "Grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -440,8 +391,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 445 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 396 "Grammar.tab.c" #ifdef short # undef short @@ -516,14 +467,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -642,12 +593,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2714,10 +2666,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2741,88 +2692,97 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -2861,6 +2821,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2882,9 +2843,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2905,6 +2866,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2913,16 +2877,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2954,20 +2918,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -3008,31 +2968,43 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 290 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NullNode(GLOBAL_DATA), 0, 1); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 291 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, true), 0, 1); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 292 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, false), 0, 1); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 293 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 294 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;} break; case 7: + +/* Line 1455 of yacc.c */ #line 295 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; @@ -3046,6 +3018,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 304 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; @@ -3059,26 +3033,36 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 316 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 317 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 318 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 319 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 321 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -3091,6 +3075,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 332 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = new PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node); (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head; @@ -3099,6 +3085,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 336 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head; (yyval.propertyList).m_node.tail = new PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail); @@ -3107,51 +3095,71 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 344 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 345 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 347 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 351 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ThisNode(GLOBAL_DATA), ThisFeature, 0); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 354 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 355 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 359 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;} break; case 26: + +/* Line 1455 of yacc.c */ #line 360 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;} break; case 27: + +/* Line 1455 of yacc.c */ #line 361 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;} break; case 28: + +/* Line 1455 of yacc.c */ #line 365 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node); (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head; @@ -3160,6 +3168,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 370 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head; (yyval.elementList).m_node.tail = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node); @@ -3168,26 +3178,36 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 377 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 0; ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 382 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 1; ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 383 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;} break; case 35: + +/* Line 1455 of yacc.c */ #line 388 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 389 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3196,6 +3216,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 393 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3204,6 +3226,8 @@ yyreduce: break; case 38: + +/* Line 1455 of yacc.c */ #line 397 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3212,6 +3236,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 405 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3220,6 +3246,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 409 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3228,6 +3256,8 @@ yyreduce: break; case 42: + +/* Line 1455 of yacc.c */ #line 413 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3236,6 +3266,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 421 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3244,6 +3276,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 429 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3252,16 +3286,22 @@ yyreduce: break; case 47: + +/* Line 1455 of yacc.c */ #line 436 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 437 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 438 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3270,6 +3310,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 442 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3277,16 +3319,22 @@ yyreduce: break; case 51: + +/* Line 1455 of yacc.c */ #line 448 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 449 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 53: + +/* Line 1455 of yacc.c */ #line 450 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3295,6 +3343,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 454 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3303,16 +3353,22 @@ yyreduce: break; case 55: + +/* Line 1455 of yacc.c */ #line 461 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA), 0, 0); ;} break; case 56: + +/* Line 1455 of yacc.c */ #line 462 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 466 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node); (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head; @@ -3321,6 +3377,8 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 470 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head; (yyval.argumentList).m_node.tail = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node); @@ -3329,181 +3387,253 @@ yyreduce: break; case 64: + +/* Line 1455 of yacc.c */ #line 488 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 489 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 494 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 495 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 499 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 500 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 501 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 502 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 503 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 74: + +/* Line 1455 of yacc.c */ #line 504 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 75: + +/* Line 1455 of yacc.c */ #line 505 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 76: + +/* Line 1455 of yacc.c */ #line 506 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 77: + +/* Line 1455 of yacc.c */ #line 507 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 78: + +/* Line 1455 of yacc.c */ #line 508 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 509 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 523 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 86: + +/* Line 1455 of yacc.c */ #line 524 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 87: + +/* Line 1455 of yacc.c */ #line 525 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 531 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 533 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 535 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 540 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 541 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 547 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 97: + +/* Line 1455 of yacc.c */ #line 549 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 554 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 555 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 556 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 561 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 562 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 563 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 568 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 569 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 570 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 571 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 572 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3511,6 +3641,8 @@ yyreduce: break; case 112: + +/* Line 1455 of yacc.c */ #line 575 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3518,26 +3650,36 @@ yyreduce: break; case 114: + +/* Line 1455 of yacc.c */ #line 582 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 583 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 584 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 585 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 587 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3545,26 +3687,36 @@ yyreduce: break; case 120: + +/* Line 1455 of yacc.c */ #line 594 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 595 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 596 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 597 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 599 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3572,6 +3724,8 @@ yyreduce: break; case 125: + +/* Line 1455 of yacc.c */ #line 603 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3579,156 +3733,218 @@ yyreduce: break; case 127: + +/* Line 1455 of yacc.c */ #line 610 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 611 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 612 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 613 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 619 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 621 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 623 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 625 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 631 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 632 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 634 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 636 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 641 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 647 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 652 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 657 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 663 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 669 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 674 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 680 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 686 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 160: + +/* Line 1455 of yacc.c */ #line 691 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 697 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 703 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 166: + +/* Line 1455 of yacc.c */ #line 708 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 714 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 170: + +/* Line 1455 of yacc.c */ #line 719 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 172: + +/* Line 1455 of yacc.c */ #line 725 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 174: + +/* Line 1455 of yacc.c */ #line 731 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 176: + +/* Line 1455 of yacc.c */ #line 737 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 178: + +/* Line 1455 of yacc.c */ #line 743 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3736,6 +3952,8 @@ yyreduce: break; case 180: + +/* Line 1455 of yacc.c */ #line 751 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3743,6 +3961,8 @@ yyreduce: break; case 182: + +/* Line 1455 of yacc.c */ #line 759 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3750,99 +3970,137 @@ yyreduce: break; case 183: + +/* Line 1455 of yacc.c */ #line 765 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpEqual; ;} break; case 184: + +/* Line 1455 of yacc.c */ #line 766 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpPlusEq; ;} break; case 185: + +/* Line 1455 of yacc.c */ #line 767 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMinusEq; ;} break; case 186: + +/* Line 1455 of yacc.c */ #line 768 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMultEq; ;} break; case 187: + +/* Line 1455 of yacc.c */ #line 769 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpDivEq; ;} break; case 188: + +/* Line 1455 of yacc.c */ #line 770 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpLShift; ;} break; case 189: + +/* Line 1455 of yacc.c */ #line 771 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpRShift; ;} break; case 190: + +/* Line 1455 of yacc.c */ #line 772 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpURShift; ;} break; case 191: + +/* Line 1455 of yacc.c */ #line 773 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpAndEq; ;} break; case 192: + +/* Line 1455 of yacc.c */ #line 774 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpXOrEq; ;} break; case 193: + +/* Line 1455 of yacc.c */ #line 775 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpOrEq; ;} break; case 194: + +/* Line 1455 of yacc.c */ #line 776 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpModEq; ;} break; case 196: + +/* Line 1455 of yacc.c */ #line 781 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 198: + +/* Line 1455 of yacc.c */ #line 786 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 200: + +/* Line 1455 of yacc.c */ #line 791 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 218: + +/* Line 1455 of yacc.c */ #line 815 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 219: + +/* Line 1455 of yacc.c */ #line 817 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 220: + +/* Line 1455 of yacc.c */ #line 822 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 221: + +/* Line 1455 of yacc.c */ #line 824 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); @@ -3850,6 +4108,8 @@ yyreduce: break; case 222: + +/* Line 1455 of yacc.c */ #line 830 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3861,6 +4121,8 @@ yyreduce: break; case 223: + +/* Line 1455 of yacc.c */ #line 837 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3874,6 +4136,8 @@ yyreduce: break; case 224: + +/* Line 1455 of yacc.c */ #line 847 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3885,6 +4149,8 @@ yyreduce: break; case 225: + +/* Line 1455 of yacc.c */ #line 855 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3898,6 +4164,8 @@ yyreduce: break; case 226: + +/* Line 1455 of yacc.c */ #line 867 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3909,6 +4177,8 @@ yyreduce: break; case 227: + +/* Line 1455 of yacc.c */ #line 874 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3922,6 +4192,8 @@ yyreduce: break; case 228: + +/* Line 1455 of yacc.c */ #line 884 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3933,6 +4205,8 @@ yyreduce: break; case 229: + +/* Line 1455 of yacc.c */ #line 892 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3946,18 +4220,24 @@ yyreduce: break; case 230: + +/* Line 1455 of yacc.c */ #line 904 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 231: + +/* Line 1455 of yacc.c */ #line 907 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 232: + +/* Line 1455 of yacc.c */ #line 912 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head; @@ -3970,6 +4250,8 @@ yyreduce: break; case 233: + +/* Line 1455 of yacc.c */ #line 921 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head; (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node; @@ -3982,49 +4264,67 @@ yyreduce: break; case 234: + +/* Line 1455 of yacc.c */ #line 932 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 235: + +/* Line 1455 of yacc.c */ #line 933 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 236: + +/* Line 1455 of yacc.c */ #line 937 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 237: + +/* Line 1455 of yacc.c */ #line 941 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 238: + +/* Line 1455 of yacc.c */ #line 945 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;} break; case 239: + +/* Line 1455 of yacc.c */ #line 949 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 240: + +/* Line 1455 of yacc.c */ #line 951 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 241: + +/* Line 1455 of yacc.c */ #line 957 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 242: + +/* Line 1455 of yacc.c */ #line 960 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), @@ -4034,24 +4334,32 @@ yyreduce: break; case 243: + +/* Line 1455 of yacc.c */ #line 968 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 244: + +/* Line 1455 of yacc.c */ #line 970 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 245: + +/* Line 1455 of yacc.c */ #line 972 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 246: + +/* Line 1455 of yacc.c */ #line 975 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, @@ -4061,6 +4369,8 @@ yyreduce: break; case 247: + +/* Line 1455 of yacc.c */ #line 981 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations), @@ -4071,6 +4381,8 @@ yyreduce: break; case 248: + +/* Line 1455 of yacc.c */ #line 988 "../../JavaScriptCore/parser/Grammar.y" { ForInNode* node = new ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node); @@ -4083,6 +4395,8 @@ yyreduce: break; case 249: + +/* Line 1455 of yacc.c */ #line 997 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column); @@ -4092,6 +4406,8 @@ yyreduce: break; case 250: + +/* Line 1455 of yacc.c */ #line 1003 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column); @@ -4103,16 +4419,22 @@ yyreduce: break; case 251: + +/* Line 1455 of yacc.c */ #line 1013 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 253: + +/* Line 1455 of yacc.c */ #line 1018 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 255: + +/* Line 1455 of yacc.c */ #line 1023 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4121,6 +4443,8 @@ yyreduce: break; case 256: + +/* Line 1455 of yacc.c */ #line 1027 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4129,6 +4453,8 @@ yyreduce: break; case 257: + +/* Line 1455 of yacc.c */ #line 1031 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4137,6 +4463,8 @@ yyreduce: break; case 258: + +/* Line 1455 of yacc.c */ #line 1035 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4145,6 +4473,8 @@ yyreduce: break; case 259: + +/* Line 1455 of yacc.c */ #line 1042 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4152,6 +4482,8 @@ yyreduce: break; case 260: + +/* Line 1455 of yacc.c */ #line 1045 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4159,6 +4491,8 @@ yyreduce: break; case 261: + +/* Line 1455 of yacc.c */ #line 1048 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4166,6 +4500,8 @@ yyreduce: break; case 262: + +/* Line 1455 of yacc.c */ #line 1051 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4173,6 +4509,8 @@ yyreduce: break; case 263: + +/* Line 1455 of yacc.c */ #line 1057 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4180,6 +4518,8 @@ yyreduce: break; case 264: + +/* Line 1455 of yacc.c */ #line 1060 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4187,6 +4527,8 @@ yyreduce: break; case 265: + +/* Line 1455 of yacc.c */ #line 1063 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4194,6 +4536,8 @@ yyreduce: break; case 266: + +/* Line 1455 of yacc.c */ #line 1066 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4201,6 +4545,8 @@ yyreduce: break; case 267: + +/* Line 1455 of yacc.c */ #line 1072 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); @@ -4208,6 +4554,8 @@ yyreduce: break; case 268: + +/* Line 1455 of yacc.c */ #line 1078 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants); @@ -4215,11 +4563,15 @@ yyreduce: break; case 269: + +/* Line 1455 of yacc.c */ #line 1084 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;} break; case 270: + +/* Line 1455 of yacc.c */ #line 1086 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations), @@ -4229,11 +4581,15 @@ yyreduce: break; case 271: + +/* Line 1455 of yacc.c */ #line 1094 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;} break; case 273: + +/* Line 1455 of yacc.c */ #line 1099 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node); (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head; @@ -4244,6 +4600,8 @@ yyreduce: break; case 274: + +/* Line 1455 of yacc.c */ #line 1105 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head; (yyval.clauseList).m_node.tail = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node); @@ -4255,26 +4613,36 @@ yyreduce: break; case 275: + +/* Line 1455 of yacc.c */ #line 1115 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;} break; case 276: + +/* Line 1455 of yacc.c */ #line 1116 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;} break; case 277: + +/* Line 1455 of yacc.c */ #line 1120 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;} break; case 278: + +/* Line 1455 of yacc.c */ #line 1121 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;} break; case 279: + +/* Line 1455 of yacc.c */ #line 1125 "../../JavaScriptCore/parser/Grammar.y" { LabelNode* node = new LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4282,6 +4650,8 @@ yyreduce: break; case 280: + +/* Line 1455 of yacc.c */ #line 1131 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4290,6 +4660,8 @@ yyreduce: break; case 281: + +/* Line 1455 of yacc.c */ #line 1135 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4298,6 +4670,8 @@ yyreduce: break; case 282: + +/* Line 1455 of yacc.c */ #line 1142 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations), @@ -4308,6 +4682,8 @@ yyreduce: break; case 283: + +/* Line 1455 of yacc.c */ #line 1148 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), @@ -4318,6 +4694,8 @@ yyreduce: break; case 284: + +/* Line 1455 of yacc.c */ #line 1155 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations), @@ -4328,23 +4706,31 @@ yyreduce: break; case 285: + +/* Line 1455 of yacc.c */ #line 1164 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 286: + +/* Line 1455 of yacc.c */ #line 1166 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 287: + +/* Line 1455 of yacc.c */ #line 1171 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast((yyval.statementNode).m_node)); ;} break; case 288: + +/* Line 1455 of yacc.c */ #line 1173 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4356,11 +4742,15 @@ yyreduce: break; case 289: + +/* Line 1455 of yacc.c */ #line 1183 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;} break; case 290: + +/* Line 1455 of yacc.c */ #line 1185 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0); @@ -4371,11 +4761,15 @@ yyreduce: break; case 291: + +/* Line 1455 of yacc.c */ #line 1191 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 292: + +/* Line 1455 of yacc.c */ #line 1193 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4386,6 +4780,8 @@ yyreduce: break; case 293: + +/* Line 1455 of yacc.c */ #line 1202 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = new ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)); (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; @@ -4393,6 +4789,8 @@ yyreduce: break; case 294: + +/* Line 1455 of yacc.c */ #line 1205 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head; (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); @@ -4400,27 +4798,37 @@ yyreduce: break; case 295: + +/* Line 1455 of yacc.c */ #line 1211 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 296: + +/* Line 1455 of yacc.c */ #line 1212 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 297: + +/* Line 1455 of yacc.c */ #line 1216 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;} break; case 298: + +/* Line 1455 of yacc.c */ #line 1217 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features, (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;} break; case 299: + +/* Line 1455 of yacc.c */ #line 1222 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node = new SourceElements(GLOBAL_DATA); (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node); @@ -4432,6 +4840,8 @@ yyreduce: break; case 300: + +/* Line 1455 of yacc.c */ #line 1229 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations); @@ -4442,188 +4852,261 @@ yyreduce: break; case 304: + +/* Line 1455 of yacc.c */ #line 1243 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 305: + +/* Line 1455 of yacc.c */ #line 1244 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 306: + +/* Line 1455 of yacc.c */ #line 1245 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 307: + +/* Line 1455 of yacc.c */ #line 1246 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 308: + +/* Line 1455 of yacc.c */ #line 1250 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 309: + +/* Line 1455 of yacc.c */ #line 1251 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 310: + +/* Line 1455 of yacc.c */ #line 1252 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 311: + +/* Line 1455 of yacc.c */ #line 1253 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;} break; case 312: + +/* Line 1455 of yacc.c */ #line 1254 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;} break; case 316: + +/* Line 1455 of yacc.c */ #line 1264 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 317: + +/* Line 1455 of yacc.c */ #line 1265 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 318: + +/* Line 1455 of yacc.c */ #line 1267 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 322: + +/* Line 1455 of yacc.c */ #line 1274 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 517: + +/* Line 1455 of yacc.c */ #line 1642 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 518: + +/* Line 1455 of yacc.c */ #line 1643 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 520: + +/* Line 1455 of yacc.c */ #line 1648 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 521: + +/* Line 1455 of yacc.c */ #line 1652 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 522: + +/* Line 1455 of yacc.c */ #line 1653 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 525: + +/* Line 1455 of yacc.c */ #line 1659 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 526: + +/* Line 1455 of yacc.c */ #line 1660 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 530: + +/* Line 1455 of yacc.c */ #line 1667 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 533: + +/* Line 1455 of yacc.c */ #line 1676 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 534: + +/* Line 1455 of yacc.c */ #line 1677 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 539: + +/* Line 1455 of yacc.c */ #line 1694 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 555: + +/* Line 1455 of yacc.c */ #line 1725 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 557: + +/* Line 1455 of yacc.c */ #line 1727 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 559: + +/* Line 1455 of yacc.c */ #line 1732 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 561: + +/* Line 1455 of yacc.c */ #line 1734 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 563: + +/* Line 1455 of yacc.c */ #line 1739 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 565: + +/* Line 1455 of yacc.c */ #line 1741 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 568: + +/* Line 1455 of yacc.c */ #line 1753 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 569: + +/* Line 1455 of yacc.c */ #line 1754 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 578: + +/* Line 1455 of yacc.c */ #line 1778 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 580: + +/* Line 1455 of yacc.c */ #line 1783 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 585: + +/* Line 1455 of yacc.c */ #line 1794 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 592: + +/* Line 1455 of yacc.c */ #line 1810 "../../JavaScriptCore/parser/Grammar.y" { ;} break; -/* Line 1267 of yacc.c. */ -#line 4627 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 5110 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4699,7 +5182,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -4716,7 +5199,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4774,14 +5257,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -4806,7 +5286,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4817,7 +5297,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered @@ -4843,6 +5323,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 1826 "../../JavaScriptCore/parser/Grammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.h b/src/3rdparty/webkit/WebCore/generated/Grammar.h index 4805844..0073f41 100644 --- a/src/3rdparty/webkit/WebCore/generated/Grammar.h +++ b/src/3rdparty/webkit/WebCore/generated/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -104,78 +104,16 @@ AUTOMINUSMINUS = 320 }; #endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../../JavaScriptCore/parser/Grammar.y" { + +/* Line 1676 of yacc.c */ +#line 157 "../../JavaScriptCore/parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -205,13 +143,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 1489 of yacc.c. */ -#line 211 "Grammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "Grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -230,3 +170,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp index 1e67ca6..c47664b 100644 --- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,69 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse xpathyyparse -#define yylex xpathyylex -#define yyerror xpathyyerror -#define yylval xpathyylval -#define yychar xpathyychar -#define yydebug xpathyydebug -#define yynerrs xpathyynerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - MULOP = 258, - RELOP = 259, - EQOP = 260, - MINUS = 261, - PLUS = 262, - AND = 263, - OR = 264, - AXISNAME = 265, - NODETYPE = 266, - PI = 267, - FUNCTIONNAME = 268, - LITERAL = 269, - VARIABLEREFERENCE = 270, - NUMBER = 271, - DOTDOT = 272, - SLASHSLASH = 273, - NAMETEST = 274, - XPATH_ERROR = 275 - }; -#endif -/* Tokens. */ -#define MULOP 258 -#define RELOP 259 -#define EQOP 260 -#define MINUS 261 -#define PLUS 262 -#define AND 263 -#define OR 264 -#define AXISNAME 265 -#define NODETYPE 266 -#define PI 267 -#define FUNCTIONNAME 268 -#define LITERAL 269 -#define VARIABLEREFERENCE 270 -#define NUMBER 271 -#define DOTDOT 272 -#define SLASHSLASH 273 -#define NAMETEST 274 -#define XPATH_ERROR 275 - - +#define yyparse xpathyyparse +#define yylex xpathyylex +#define yyerror xpathyyerror +#define yylval xpathyylval +#define yychar xpathyychar +#define yydebug xpathyydebug +#define yynerrs xpathyynerrs /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 28 "../xml/XPathGrammar.y" @@ -144,6 +102,9 @@ using namespace XPath; +/* Line 189 of yacc.c */ +#line 107 "XPathGrammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -162,10 +123,43 @@ using namespace XPath; # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + MULOP = 258, + RELOP = 259, + EQOP = 260, + MINUS = 261, + PLUS = 262, + AND = 263, + OR = 264, + AXISNAME = 265, + NODETYPE = 266, + PI = 267, + FUNCTIONNAME = 268, + LITERAL = 269, + VARIABLEREFERENCE = 270, + NUMBER = 271, + DOTDOT = 272, + SLASHSLASH = 273, + NAMETEST = 274, + XPATH_ERROR = 275 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 56 "../xml/XPathGrammar.y" { + +/* Line 214 of yacc.c */ +#line 56 "../xml/XPathGrammar.y" + Step::Axis axis; Step::NodeTest* nodeTest; NumericOp::Opcode numop; @@ -176,18 +170,21 @@ typedef union YYSTYPE Vector* argList; Step* step; LocationPath* locationPath; -} -/* Line 187 of yacc.c. */ -#line 182 "XPathGrammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 178 "XPathGrammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 69 "../xml/XPathGrammar.y" @@ -196,8 +193,8 @@ void xpathyyerror(const char*) { } -/* Line 216 of yacc.c. */ -#line 201 "XPathGrammar.tab.c" +/* Line 264 of yacc.c */ +#line 198 "XPathGrammar.tab.c" #ifdef short # undef short @@ -272,14 +269,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -360,9 +357,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -396,12 +393,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -854,17 +851,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -898,11 +898,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1182,10 +1182,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1204,10 +1202,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1231,74 +1228,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1328,7 +1326,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1336,7 +1333,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1359,9 +1355,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1372,7 +1367,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1382,6 +1376,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1390,16 +1387,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1431,20 +1428,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1484,6 +1477,8 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 118 "../xml/XPathGrammar.y" { PARSER->m_topExpr = (yyvsp[(1) - (1)].expr); @@ -1491,6 +1486,8 @@ yyreduce: break; case 3: + +/* Line 1455 of yacc.c */ #line 125 "../xml/XPathGrammar.y" { (yyval.locationPath)->setAbsolute(false); @@ -1498,6 +1495,8 @@ yyreduce: break; case 4: + +/* Line 1455 of yacc.c */ #line 130 "../xml/XPathGrammar.y" { (yyval.locationPath)->setAbsolute(true); @@ -1505,6 +1504,8 @@ yyreduce: break; case 5: + +/* Line 1455 of yacc.c */ #line 137 "../xml/XPathGrammar.y" { (yyval.locationPath) = new LocationPath; @@ -1513,6 +1514,8 @@ yyreduce: break; case 6: + +/* Line 1455 of yacc.c */ #line 143 "../xml/XPathGrammar.y" { (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); @@ -1520,6 +1523,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 148 "../xml/XPathGrammar.y" { (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); @@ -1529,6 +1534,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 157 "../xml/XPathGrammar.y" { (yyval.locationPath) = new LocationPath; @@ -1539,6 +1546,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 165 "../xml/XPathGrammar.y" { (yyval.locationPath)->appendStep((yyvsp[(3) - (3)].step)); @@ -1547,6 +1556,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 171 "../xml/XPathGrammar.y" { (yyval.locationPath)->appendStep((yyvsp[(2) - (3)].step)); @@ -1557,6 +1568,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 181 "../xml/XPathGrammar.y" { if ((yyvsp[(2) - (2)].predList)) { @@ -1570,6 +1583,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 192 "../xml/XPathGrammar.y" { String localName; @@ -1590,6 +1605,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 210 "../xml/XPathGrammar.y" { if ((yyvsp[(3) - (3)].predList)) { @@ -1603,6 +1620,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 221 "../xml/XPathGrammar.y" { String localName; @@ -1623,6 +1642,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 245 "../xml/XPathGrammar.y" { (yyval.axis) = Step::AttributeAxis; @@ -1630,6 +1651,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 252 "../xml/XPathGrammar.y" { if (*(yyvsp[(1) - (3)].str) == "node") @@ -1645,6 +1668,8 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 265 "../xml/XPathGrammar.y" { (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); @@ -1654,6 +1679,8 @@ yyreduce: break; case 20: + +/* Line 1455 of yacc.c */ #line 272 "../xml/XPathGrammar.y" { (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, (yyvsp[(3) - (4)].str)->stripWhiteSpace()); @@ -1664,6 +1691,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 282 "../xml/XPathGrammar.y" { (yyval.predList) = 0; @@ -1671,6 +1700,8 @@ yyreduce: break; case 23: + +/* Line 1455 of yacc.c */ #line 291 "../xml/XPathGrammar.y" { (yyval.predList) = new Vector; @@ -1681,6 +1712,8 @@ yyreduce: break; case 24: + +/* Line 1455 of yacc.c */ #line 299 "../xml/XPathGrammar.y" { (yyval.predList)->append(new Predicate((yyvsp[(2) - (2)].expr))); @@ -1689,6 +1722,8 @@ yyreduce: break; case 25: + +/* Line 1455 of yacc.c */ #line 307 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); @@ -1696,6 +1731,8 @@ yyreduce: break; case 26: + +/* Line 1455 of yacc.c */ #line 314 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1704,6 +1741,8 @@ yyreduce: break; case 27: + +/* Line 1455 of yacc.c */ #line 322 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1712,6 +1751,8 @@ yyreduce: break; case 28: + +/* Line 1455 of yacc.c */ #line 328 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1720,6 +1761,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 336 "../xml/XPathGrammar.y" { (yyval.expr) = new VariableReference(*(yyvsp[(1) - (1)].str)); @@ -1729,6 +1772,8 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 343 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); @@ -1736,6 +1781,8 @@ yyreduce: break; case 31: + +/* Line 1455 of yacc.c */ #line 348 "../xml/XPathGrammar.y" { (yyval.expr) = new StringExpression(*(yyvsp[(1) - (1)].str)); @@ -1745,6 +1792,8 @@ yyreduce: break; case 32: + +/* Line 1455 of yacc.c */ #line 355 "../xml/XPathGrammar.y" { (yyval.expr) = new Number((yyvsp[(1) - (1)].str)->toDouble()); @@ -1754,6 +1803,8 @@ yyreduce: break; case 34: + +/* Line 1455 of yacc.c */ #line 366 "../xml/XPathGrammar.y" { (yyval.expr) = createFunction(*(yyvsp[(1) - (3)].str)); @@ -1765,6 +1816,8 @@ yyreduce: break; case 35: + +/* Line 1455 of yacc.c */ #line 375 "../xml/XPathGrammar.y" { (yyval.expr) = createFunction(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList)); @@ -1777,6 +1830,8 @@ yyreduce: break; case 36: + +/* Line 1455 of yacc.c */ #line 387 "../xml/XPathGrammar.y" { (yyval.argList) = new Vector; @@ -1787,6 +1842,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 395 "../xml/XPathGrammar.y" { (yyval.argList)->append((yyvsp[(3) - (3)].expr)); @@ -1795,6 +1852,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 409 "../xml/XPathGrammar.y" { (yyval.expr) = new Union; @@ -1807,6 +1866,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 421 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(1) - (1)].locationPath); @@ -1814,6 +1875,8 @@ yyreduce: break; case 43: + +/* Line 1455 of yacc.c */ #line 428 "../xml/XPathGrammar.y" { (yyvsp[(3) - (3)].locationPath)->setAbsolute(true); @@ -1825,6 +1888,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 437 "../xml/XPathGrammar.y" { (yyvsp[(3) - (3)].locationPath)->insertFirstStep((yyvsp[(2) - (3)].step)); @@ -1838,6 +1903,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 452 "../xml/XPathGrammar.y" { (yyval.expr) = new Filter((yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList)); @@ -1848,6 +1915,8 @@ yyreduce: break; case 48: + +/* Line 1455 of yacc.c */ #line 464 "../xml/XPathGrammar.y" { (yyval.expr) = new LogicalOp(LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1858,6 +1927,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 476 "../xml/XPathGrammar.y" { (yyval.expr) = new LogicalOp(LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1868,6 +1939,8 @@ yyreduce: break; case 52: + +/* Line 1455 of yacc.c */ #line 488 "../xml/XPathGrammar.y" { (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1878,6 +1951,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 500 "../xml/XPathGrammar.y" { (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1888,6 +1963,8 @@ yyreduce: break; case 56: + +/* Line 1455 of yacc.c */ #line 512 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp(NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1898,6 +1975,8 @@ yyreduce: break; case 57: + +/* Line 1455 of yacc.c */ #line 520 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp(NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1908,6 +1987,8 @@ yyreduce: break; case 59: + +/* Line 1455 of yacc.c */ #line 532 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp((yyvsp[(2) - (3)].numop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1918,6 +1999,8 @@ yyreduce: break; case 61: + +/* Line 1455 of yacc.c */ #line 544 "../xml/XPathGrammar.y" { (yyval.expr) = new Negative; @@ -1928,8 +2011,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1933 "XPathGrammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 2017 "XPathGrammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1940,7 +2024,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2005,7 +2088,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -2022,7 +2105,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2079,9 +2162,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -2106,7 +2186,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2117,7 +2197,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -2143,6 +2223,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 552 "../xml/XPathGrammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h index cabe35a..f6c314d 100644 --- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h +++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -59,33 +59,16 @@ XPATH_ERROR = 275 }; #endif -/* Tokens. */ -#define MULOP 258 -#define RELOP 259 -#define EQOP 260 -#define MINUS 261 -#define PLUS 262 -#define AND 263 -#define OR 264 -#define AXISNAME 265 -#define NODETYPE 266 -#define PI 267 -#define FUNCTIONNAME 268 -#define LITERAL 269 -#define VARIABLEREFERENCE 270 -#define NUMBER 271 -#define DOTDOT 272 -#define SLASHSLASH 273 -#define NAMETEST 274 -#define XPATH_ERROR 275 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 56 "../xml/XPathGrammar.y" { + +/* Line 1676 of yacc.c */ +#line 56 "../xml/XPathGrammar.y" + Step::Axis axis; Step::NodeTest* nodeTest; NumericOp::Opcode numop; @@ -96,14 +79,17 @@ typedef union YYSTYPE Vector* argList; Step* step; LocationPath* locationPath; -} -/* Line 1489 of yacc.c. */ -#line 102 "XPathGrammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 87 "XPathGrammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp index ceea77a..d50fef8 100644 --- a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp @@ -422,9 +422,7 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float return; TransformationMatrix transform(m11, m12, m21, m22, dx, dy); - - TransformationMatrix newTransform = state().m_transform; - newTransform.multiply(transform); + TransformationMatrix newTransform = transform * state().m_transform; if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; return; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp index e68be2b..5c39e11 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp @@ -275,7 +275,9 @@ void Path::clear() bool Path::isEmpty() const { - return m_path->isEmpty(); + // Don't use QPainterPath::isEmpty(), as that also returns true if there's only + // one initial MoveTo element in the path. + return m_path->elementCount() == 0; } String Path::debugString() const diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 3e9b239..83f4b1e 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -214,9 +214,11 @@ void QNetworkReplyHandler::finish() resetState(); start(); } else if (m_reply->error() != QNetworkReply::NoError - // a web page that returns 403/404 can still have content + // a web page that returns 401/403/404 can still have content && m_reply->error() != QNetworkReply::ContentOperationNotPermittedError - && m_reply->error() != QNetworkReply::ContentNotFoundError) { + && m_reply->error() != QNetworkReply::ContentNotFoundError + && m_reply->error() != QNetworkReply::AuthenticationRequiredError + && m_reply->error() != QNetworkReply::ProxyAuthenticationRequiredError) { QUrl url = m_reply->url(); ResourceError error(url.host(), m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), url.toString(), m_reply->errorString()); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp index 6dbe464..a369ddc 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp @@ -97,7 +97,7 @@ String pathGetFileName(const String& path) String directoryName(const String& path) { - return String(QFileInfo(path).baseName()); + return String(QFileInfo(path).absolutePath()); } Vector listDirectory(const String& path, const String& filter) diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp index 569ed37..b85c748 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp @@ -369,10 +369,10 @@ void PluginView::setNPWindowIfNeeded() m_npWindow.height = m_windowRect.height(); // TODO: (also clip against scrollbars, etc.) - m_npWindow.clipRect.left = 0; - m_npWindow.clipRect.top = 0; - m_npWindow.clipRect.right = m_windowRect.width(); - m_npWindow.clipRect.bottom = m_windowRect.height(); + m_npWindow.clipRect.left = max(0, m_windowRect.x()); + m_npWindow.clipRect.top = max(0, m_windowRect.y()); + m_npWindow.clipRect.right = m_windowRect.x() + m_windowRect.width(); + m_npWindow.clipRect.bottom = m_windowRect.y() + m_windowRect.height(); PluginView::setCurrentPluginView(this); JSC::JSLock::DropAllLocks dropAllLocks(false); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index afbc770..a7e176d 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -12,6 +12,25 @@ Reviewed by Simon Hausmann. + Fix crash with plugins when the plugin stream is cancelled. + + Similar to r26667 handle the case where didReceiveResponse on the + plugin view results in failure to set up the stream and + setMainDocumentError being called instead. This will set the + m_pluginView back to 0 and we need check for it before calling + didReceiveData. + + This was triggered by consecutive execution of + LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html + followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::committedLoad): + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + Fix a plugin bug in the WebKit code, similar to the one in WebCore. The problem is when a non visible QtPluginWidget would show it self diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index a2b33c0..680a67a 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -680,6 +680,11 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c if (m_pluginView) { if (!m_hasSentResponseToPlugin) { m_pluginView->didReceiveResponse(loader->response()); + // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in + // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // to null + if (!m_pluginView) + return; m_hasSentResponseToPlugin = true; } m_pluginView->didReceiveData(data, length); -- cgit v0.12 From 8e0121795a784a1bcedfe3108e2aaf77f26eff6f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:08:11 +0200 Subject: Fix initialization of the HTML 5 offline storage. Place the databases into the normal data location. Reviewed-by: Ariya --- demos/browser/browserapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp index 5ef3ce6..b27b5c1 100644 --- a/demos/browser/browserapplication.cpp +++ b/demos/browser/browserapplication.cpp @@ -205,6 +205,7 @@ void BrowserApplication::postLaunch() if (directory.isEmpty()) directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); QWebSettings::setIconDatabasePath(directory); + QWebSettings::setOfflineStoragePath(directory); setWindowIcon(QIcon(QLatin1String(":browser.svg"))); -- cgit v0.12 From dab07d0b8ec229bd601d99b6a20326bec3fd33c3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:14:23 +0200 Subject: Removed two generated files. They were added by accident. Nevermind :) Reviewed-by: Trust me --- .../webkit/JavaScriptCore/libJavaScriptCore.la | 28 ---------------------- .../JavaScriptCore/pkgconfig/JavaScriptCore.pc | 15 ------------ 2 files changed, 43 deletions(-) delete mode 100644 src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la delete mode 100644 src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc diff --git a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la b/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la deleted file mode 100644 index 10d3f1e..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la +++ /dev/null @@ -1,28 +0,0 @@ -# libJavaScriptCore.la - a libtool library file -# Generated by qmake/libtool (2.01a) (Qt 4.6.0) on: Mon Jun 15 18:55:09 2009 -# The name that we can dlopen(3). -dlname='' - -# Names of this library. -library_names=' ' - -# The name of the static archive. -old_library='libJavaScriptCore.a' - -# Libraries that this one depends upon. -dependency_libs='-L/depot/obuddenh/qt/lib -lQtGui -L/depot/obuddenh/qt/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl ' - -# Version information for libJavaScriptCore.la -current=46 -age=0 -revision=0 - -# Is this an already installed library. -installed=yes - -# Files to dlopen/dlpreopen. -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/depot/obuddenh/qt/lib' diff --git a/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc b/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc deleted file mode 100644 index fb90b0c..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc +++ /dev/null @@ -1,15 +0,0 @@ -prefix=/depot/obuddenh/qt -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/JavaScriptCore -qt_config=lex yacc debug uic resources qt incremental link_prl exceptions no_mocdepend debug stl qt_no_framework debug largefile stl precompile_header separate_debug_info mmx 3dnow sse sse2 dylib create_prl link_prl depend_includepath QTDIR_build use_libmysqlclient_r building-libs staticlib depend_includepath qt_install_headers qt depend_includepath qmake_cache target_qt hide_symbols create_libtool create_pc explicitlib moc thread static staticlib -moc_location=${prefix}/bin/moc -uic_location=${prefix}/bin/uic - -Name: Javascriptcore -Description: Javascriptcore Library -Version: 4.6.0 -Libs: -L${libdir} -lJavaScriptCore -Libs.private: -L/depot/obuddenh/qt/lib -lQtGui -L/depot/obuddenh/qt/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl -Cflags: -DQT_SHARED -I/depot/obuddenh/qt/include -I${includedir} - -- cgit v0.12 From e15d415acbd426e58fb1e967eb331fe41488dfff Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Tue, 12 May 2009 14:47:49 +0200 Subject: Added QTextListFormat::ListUpperRoman and QTextListFormat::ListLowerRoman for roman numbering of lists as supported by HTML/ODF Reviewed-by: Olivier Goffart Merge-request: 681 --- demos/textedit/textedit.cpp | 8 ++++++ src/gui/text/qcssparser.cpp | 10 ++++--- src/gui/text/qcssparser_p.h | 2 ++ src/gui/text/qtextdocument.cpp | 7 ++++- src/gui/text/qtextdocumentlayout.cpp | 6 ++++- src/gui/text/qtextformat.cpp | 2 ++ src/gui/text/qtextformat.h | 2 ++ src/gui/text/qtexthtmlparser.cpp | 6 +++++ src/gui/text/qtextlist.cpp | 49 ++++++++++++++++++++++++++++++++++ src/gui/text/qtextodfwriter.cpp | 8 +++++- tests/auto/qtextlist/tst_qtextlist.cpp | 36 +++++++++++++++++++++++++ 11 files changed, 129 insertions(+), 7 deletions(-) diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 17516b4..5eee855 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -336,6 +336,8 @@ void TextEdit::setupTextActions() comboStyle->addItem("Ordered List (Decimal)"); comboStyle->addItem("Ordered List (Alpha lower)"); comboStyle->addItem("Ordered List (Alpha upper)"); + comboStyle->addItem("Ordered List (Roman lower)"); + comboStyle->addItem("Ordered List (Roman upper)"); connect(comboStyle, SIGNAL(activated(int)), this, SLOT(textStyle(int))); @@ -573,6 +575,12 @@ void TextEdit::textStyle(int styleIndex) case 6: style = QTextListFormat::ListUpperAlpha; break; + case 7: + style = QTextListFormat::ListLowerRoman; + break; + case 8: + style = QTextListFormat::ListUpperRoman; + break; } cursor.beginEditBlock(); diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index ab69e5c..db5ed7c 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -199,6 +199,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "link", Value_Link }, { "link-visited", Value_LinkVisited }, { "lower-alpha", Value_LowerAlpha }, + { "lower-roman", Value_LowerRoman }, { "lowercase", Value_Lowercase }, { "medium", Value_Medium }, { "mid", Value_Mid }, @@ -230,6 +231,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "transparent", Value_Transparent }, { "underline", Value_Underline }, { "upper-alpha", Value_UpperAlpha }, + { "upper-roman", Value_UpperRoman }, { "uppercase", Value_Uppercase }, { "wave", Value_Wave }, { "window", Value_Window }, @@ -239,10 +241,10 @@ static const QCssKnownValue values[NumKnownValues - 1] = { }; //Map id to strings as they appears in the 'values' array above -static const short indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46, - 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16, - 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0, - 51, 44, 43 }; +static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47, + 29, 58, 59, 27, 51, 61, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 50, 24, 46, 67, 37, 3, 2, 40, 62, 16, + 11, 57, 14, 32, 64, 33, 65, 55, 66, 34, 69, 8, 28, 38, 12, 36, 60, 7, 9, 4, 68, 53, 22, 23, 30, 31, + 1, 15, 0, 52, 45, 44 }; QString Value::toString() const { diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 8056f4d..b07acd5 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -223,6 +223,8 @@ enum KnownValue { Value_Decimal, Value_LowerAlpha, Value_UpperAlpha, + Value_LowerRoman, + Value_UpperRoman, Value_SmallCaps, Value_Uppercase, Value_Lowercase, diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 3287f31..3531699 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2416,7 +2416,10 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment) static bool isOrderedList(int style) { return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha - || style == QTextListFormat::ListUpperAlpha; + || style == QTextListFormat::ListUpperAlpha + || style == QTextListFormat::ListUpperRoman + || style == QTextListFormat::ListLowerRoman + ; } void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block) @@ -2513,6 +2516,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) case QTextListFormat::ListSquare: html += QLatin1String("
    (object)->itemText(bl); size.setWidth(fontMetrics.width(itemText)); size.setHeight(fontMetrics.height()); @@ -1426,7 +1428,9 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p switch (style) { case QTextListFormat::ListDecimal: case QTextListFormat::ListLowerAlpha: - case QTextListFormat::ListUpperAlpha: { + case QTextListFormat::ListUpperAlpha: + case QTextListFormat::ListLowerRoman: + case QTextListFormat::ListUpperRoman: { QTextLayout layout(itemText, font, q->paintDevice()); layout.setCacheEnabled(true); QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 9bc62b1..4e43418 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -2078,6 +2078,8 @@ QList QTextBlockFormat::tabPositions() const \value ListDecimal decimal values in ascending order \value ListLowerAlpha lower case Latin characters in alphabetical order \value ListUpperAlpha upper case Latin characters in alphabetical order + \value ListLowerRoman lower case roman numerals (supports up to 4999 items only) + \value ListUpperRoman upper case roman numerals (supports up to 4999 items only) \omitvalue ListStyleUndefined */ diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index d269687..9697105 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -604,6 +604,8 @@ public: ListDecimal = -4, ListLowerAlpha = -5, ListUpperAlpha = -6, + ListLowerRoman = -7, + ListUpperRoman = -8, ListStyleUndefined = 0 }; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 1bff162..a88cd17 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1206,6 +1206,8 @@ void QTextHtmlParserNode::setListStyle(const QVector &cssValues) case QCss::Value_Decimal: hasOwnListStyle = true; listStyle = QTextListFormat::ListDecimal; break; case QCss::Value_LowerAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerAlpha; break; case QCss::Value_UpperAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperAlpha; break; + case QCss::Value_LowerRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerRoman; break; + case QCss::Value_UpperRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperRoman; break; default: break; } } @@ -1540,6 +1542,10 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) node->listStyle = QTextListFormat::ListLowerAlpha; } else if (value == QLatin1String("A")) { node->listStyle = QTextListFormat::ListUpperAlpha; + } else if (value == QLatin1String("i")) { + node->listStyle = QTextListFormat::ListLowerRoman; + } else if (value == QLatin1String("I")) { + node->listStyle = QTextListFormat::ListUpperRoman; } else { value = value.toLower(); if (value == QLatin1String("square")) diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index addd7a5..02b1c63 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -212,6 +212,55 @@ QString QTextList::itemText(const QTextBlock &blockIt) const } } break; + case QTextListFormat::ListLowerRoman: + case QTextListFormat::ListUpperRoman: + { + if (item < 5000) { + QByteArray romanNumeral; + + // works for up to 4999 items + static const char romanSymbolsLower[] = "iiivixxxlxcccdcmmmm"; + static const char romanSymbolsUpper[] = "IIIVIXXXLXCCCDCMMMM"; + QByteArray romanSymbols; // wrap to have "mid" + if (style == QTextListFormat::ListLowerRoman) + romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower)); + else + romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper)); + + int c[] = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 }; + int n = item; + for (int i = 12; i >= 0; n %= c[i], i--) { + int q = n / c[i]; + if (q > 0) { + int startDigit = i + (i+3)/4; + int numDigits; + if (i % 4) { + // c[i] == 4|5|9|40|50|90|400|500|900 + if ((i-2) % 4) { + // c[i] == 4|9|40|90|400|900 => with substraction (IV, IX, XL, XC, ...) + numDigits = 2; + } + else { + // c[i] == 5|50|500 (V, L, D) + numDigits = 1; + } + } + else { + // c[i] == 1|10|100|1000 (I, II, III, X, XX, ...) + numDigits = q; + } + + romanNumeral.append(romanSymbols.mid(startDigit, numDigits)); + } + } + result = QString::fromLatin1(romanNumeral); + } + else { + result = QLatin1String("?"); + } + + } + break; default: Q_ASSERT(false); } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index b0c16ee..883cf80 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -174,6 +174,10 @@ static QString bulletChar(QTextListFormat::Style style) return QString::fromLatin1("a"); case QTextListFormat::ListUpperAlpha: return QString::fromLatin1("A"); + case QTextListFormat::ListLowerRoman: + return QString::fromLatin1("i"); + case QTextListFormat::ListUpperRoman: + return QString::fromLatin1("I"); default: case QTextListFormat::ListStyleUndefined: return QString(); @@ -619,7 +623,9 @@ void QTextOdfWriter::writeListFormat(QXmlStreamWriter &writer, QTextListFormat f QTextListFormat::Style style = format.style(); if (style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha - || style == QTextListFormat::ListUpperAlpha) { + || style == QTextListFormat::ListUpperAlpha + || style == QTextListFormat::ListLowerRoman + || style == QTextListFormat::ListUpperRoman) { writer.writeStartElement(textNS, QString::fromLatin1("list-level-style-number")); writer.writeAttribute(styleNS, QString::fromLatin1("num-format"), bulletChar(style)); writer.writeAttribute(styleNS, QString::fromLatin1("num-suffix"), QString::fromLatin1(".")); diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp index 658b8bb..e41d3be 100644 --- a/tests/auto/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/qtextlist/tst_qtextlist.cpp @@ -67,6 +67,8 @@ private slots: void item(); void autoNumbering(); void autoNumberingRTL(); + void romanNumbering(); + void romanNumberingLimit(); void formatChange(); void cursorNavigation(); void partialRemoval(); @@ -142,6 +144,40 @@ void tst_QTextList::autoNumberingRTL() QVERIFY(cursor.currentList()->itemText(cursor.block()) == ".B"); } +void tst_QTextList::romanNumbering() +{ + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::ListUpperRoman); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 0; i < 4998; ++i) + cursor.insertBlock(); + + QVERIFY(list->count() == 4999); + + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4998); + QVERIFY(cursor.currentList()->itemText(cursor.block()) == "MMMMCMXCIX."); +} + +void tst_QTextList::romanNumberingLimit() +{ + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::ListLowerRoman); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 0; i < 4999; ++i) + cursor.insertBlock(); + + QVERIFY(list->count() == 5000); + + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4999); + QVERIFY(cursor.currentList()->itemText(cursor.block()) == "?."); +} + void tst_QTextList::formatChange() { // testing the formatChanged slot in QTextListManager -- cgit v0.12 From 9db4b800a2c8da5916a6d5da9e37a17d185cdc5e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 17:07:42 +0200 Subject: More tests for list numbering --- .../tst_qtextdocumentfragment.cpp | 10 ++++++ tests/auto/qtextlist/tst_qtextlist.cpp | 40 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 56f5e7a..4559daa 100644 --- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2758,6 +2758,16 @@ void tst_QTextDocumentFragment::css_listStyleType() QVERIFY(cursor.currentList()); QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperAlpha); + doc->setHtml("
    • Blah
    "); + cursor.movePosition(QTextCursor::End); + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperRoman); + + doc->setHtml("
    • Blah
    "); + cursor.movePosition(QTextCursor::End); + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerRoman); + // ignore the unsupported list-style-position inside the list-style shorthand property doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp index e41d3be..4ab6f5a 100644 --- a/tests/auto/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/qtextlist/tst_qtextlist.cpp @@ -77,6 +77,8 @@ private slots: void add(); void defaultIndent(); void blockUpdate(); + void numbering_data(); + void numbering(); private: QTextDocument *doc; @@ -336,5 +338,43 @@ void tst_QTextList::blockUpdate() QVERIFY(!layout->error); } +void tst_QTextList::numbering_data() +{ + QTest::addColumn("format"); + QTest::addColumn("number"); + QTest::addColumn("result"); + + QTest::newRow("E.") << int(QTextListFormat::ListUpperAlpha) << 5 << "E."; + QTest::newRow("abc.") << int(QTextListFormat::ListLowerAlpha) << (26 + 2) * 26 + 3 << "abc."; + QTest::newRow("12.") << int(QTextListFormat::ListDecimal) << 12 << "12."; + QTest::newRow("XXIV.") << int(QTextListFormat::ListUpperRoman) << 24 << "XXIV."; + QTest::newRow("VIII.") << int(QTextListFormat::ListUpperRoman) << 8 << "VIII."; + QTest::newRow("xxx.") << int(QTextListFormat::ListLowerRoman) << 30 << "xxx."; + QTest::newRow("xxix.") << int(QTextListFormat::ListLowerRoman) << 29 << "xxix."; +// QTest::newRow("xxx. alpha") << int(QTextListFormat::ListLowerAlpha) << (24 * 26 + 24) * 26 + 24 << "xxx."; //Too slow +} + +void tst_QTextList::numbering() +{ + QFETCH(int, format); + QFETCH(int, number); + QFETCH(QString, result); + + + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::Style(format)); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 1; i < number; ++i) + cursor.insertBlock(); + + QCOMPARE(list->count(), number); + + QVERIFY(cursor.currentList()); + QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), number - 1); + QCOMPARE(cursor.currentList()->itemText(cursor.block()), result); +} + QTEST_MAIN(tst_QTextList) #include "tst_qtextlist.moc" -- cgit v0.12 From ecffc68ab222309e30d83a55022169cef9acfd81 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:24:43 +0200 Subject: Fix WebKit import url Fix the contents of src/3rdparty/webkit/VERSION to point to gitorious.org Reviewed-by: Trust me --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index c26fdc1..f63bf22 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -268,7 +268,7 @@ rm -rf $srcdir/WebKitBuild cat >$srcdir/VERSION < Date: Mon, 13 Jul 2009 17:26:02 +0200 Subject: Fix import of WebKit from the trunk Don't try to remove the scons files, as they were removed upstream. Reviewed-by: Trust me --- util/webkit/mkdist-webkit | 2 -- 1 file changed, 2 deletions(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 1837dd5..9e9d656 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -154,10 +154,8 @@ files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp" files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp" files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl" -files_to_remove="$files_to_remove JavaScriptCore/SConstruct" files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl" -files_to_remove="$files_to_remove WebCore/SConstruct" files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl" files_to_remove="$files_to_remove WebCore/webcore-base.bkl" files_to_remove="$files_to_remove WebCore/webcore-wx.bkl" -- cgit v0.12 From b7598e32617ea8608d7c82800e1706d9180ddbd9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Jul 2009 17:53:49 +0200 Subject: make examples/activeqt/webbrowser work on Windows CE This example only worked on desktop Windows and Windows mobile. Windows CE uses the same GUID for the Internet Explorer ActiveX control like desktop Windows. Task-number: 255111 Reviewed-by: thartman --- examples/activeqt/webbrowser/main.cpp | 4 +- .../webbrowser/mainwindow_windowsmobile.ui | 299 +++++++++++++++++++++ examples/activeqt/webbrowser/webbrowser.pro | 2 +- examples/activeqt/webbrowser/wincemainwindow.ui | 299 --------------------- 4 files changed, 302 insertions(+), 302 deletions(-) create mode 100644 examples/activeqt/webbrowser/mainwindow_windowsmobile.ui delete mode 100644 examples/activeqt/webbrowser/wincemainwindow.ui diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp index ab14c0b..e83ef56 100644 --- a/examples/activeqt/webbrowser/main.cpp +++ b/examples/activeqt/webbrowser/main.cpp @@ -46,8 +46,8 @@ #include #include -#if defined(Q_OS_WINCE) -#include "ui_wincemainwindow.h" +#if defined(Q_WS_WINCE_WM) +#include "ui_mainwindow_windowsmobile.h" #include #else #include "ui_mainwindow.h" diff --git a/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui new file mode 100644 index 0000000..98a9ddb --- /dev/null +++ b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui @@ -0,0 +1,299 @@ + + MainWindow + + + MainWindow + + + + 0 + 0 + 812 + 605 + + + + Qt WebBrowser + + + + + unnamed + + + 0 + + + 6 + + + + + Frame3 + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + unnamed + + + 1 + + + 0 + + + + + WebBrowser + + + Qt::StrongFocus + + + {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44} + + + + + + + + + + + tbNavigate + + + Navigation + + + + + + + + + + + + tbAddress + + + Address + + + + lblAddress + + + Address + + + + + addressEdit + + + + + + + menubar + + + + PopupMenu + + + &File + + + + FileNewGroup_2 + + + New + + + + + + + + + + + unnamed + + + &Help + + + + + + + + + + actionGo + + + image0 + + + Go + + + + + actionBack + + + image1 + + + Back + + + Backspace + + + + + actionForward + + + image2 + + + Forward + + + + + actionStop + + + image3 + + + Stop + + + + + actionRefresh + + + image4 + + + Refresh + + + + + actionHome + + + image5 + + + Home + + + + + actionFileClose + + + Close + + + C&lose + + + + + actionSearch + + + image6 + + + Search + + + + + actionAbout + + + About + + + + + actionAboutQt + + + About Qt + + + + + + actionNewWindow + + + Window + + + Ctrl+N + + + + FileNewGroup + + + + + + addressEdit + returnPressed() + actionGo + trigger() + + + + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 + + + 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 + + + 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 + + + 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf + + + 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 + + + diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro index 992d871..32eac71 100644 --- a/examples/activeqt/webbrowser/webbrowser.pro +++ b/examples/activeqt/webbrowser/webbrowser.pro @@ -7,7 +7,7 @@ QTDIR_build:REQUIRES = shared HEADERS = webaxwidget.h SOURCES = main.cpp FORMS = mainwindow.ui -wince*: FORMS = wincemainwindow.ui +wincewm*: FORMS = mainwindow_windowsmobile.ui # install diff --git a/examples/activeqt/webbrowser/wincemainwindow.ui b/examples/activeqt/webbrowser/wincemainwindow.ui deleted file mode 100644 index 98a9ddb..0000000 --- a/examples/activeqt/webbrowser/wincemainwindow.ui +++ /dev/null @@ -1,299 +0,0 @@ - - MainWindow - - - MainWindow - - - - 0 - 0 - 812 - 605 - - - - Qt WebBrowser - - - - - unnamed - - - 0 - - - 6 - - - - - Frame3 - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - unnamed - - - 1 - - - 0 - - - - - WebBrowser - - - Qt::StrongFocus - - - {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44} - - - - - - - - - - - tbNavigate - - - Navigation - - - - - - - - - - - - tbAddress - - - Address - - - - lblAddress - - - Address - - - - - addressEdit - - - - - - - menubar - - - - PopupMenu - - - &File - - - - FileNewGroup_2 - - - New - - - - - - - - - - - unnamed - - - &Help - - - - - - - - - - actionGo - - - image0 - - - Go - - - - - actionBack - - - image1 - - - Back - - - Backspace - - - - - actionForward - - - image2 - - - Forward - - - - - actionStop - - - image3 - - - Stop - - - - - actionRefresh - - - image4 - - - Refresh - - - - - actionHome - - - image5 - - - Home - - - - - actionFileClose - - - Close - - - C&lose - - - - - actionSearch - - - image6 - - - Search - - - - - actionAbout - - - About - - - - - actionAboutQt - - - About Qt - - - - - - actionNewWindow - - - Window - - - Ctrl+N - - - - FileNewGroup - - - - - - addressEdit - returnPressed() - actionGo - trigger() - - - - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 - - - 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 - - - 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 - - - 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf - - - 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 - - - -- cgit v0.12 From 1cea2ed930377b1bb0d1ce583eacae87d999fc16 Mon Sep 17 00:00:00 2001 From: Thomas Sondergaard Date: Mon, 13 Jul 2009 17:32:02 +0200 Subject: QToolTip: Uses QPalette::ToolTipText default text color for rich text. Task-number: 248429 Merge-request: 786 Reviewed-by: Olivier Goffart --- src/gui/kernel/qwhatsthis.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index f38b0f6..f569c97 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -351,6 +351,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) rect.translate(-r.x(), -r.y()); p.setClipRect(rect); QAbstractTextDocumentLayout::PaintContext context; + context.palette.setColor(QPalette::Text, context.palette.toolTipText()); doc->documentLayout()->draw(&p, context); } else -- cgit v0.12 From c549bda8cd38a099118f3cf4c7e5462010cb7259 Mon Sep 17 00:00:00 2001 From: Noah White-Hamerslough Date: Mon, 13 Jul 2009 18:58:48 +0200 Subject: Fixes: The keyboard navigation of QComboBox don't work with the completion Merge-request: 653 Reviewed-by: Olivier Goffart Task-number: 247560 --- src/gui/util/qcompleter.cpp | 4 ++-- tests/auto/qcompleter/tst_qcompleter.cpp | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index f4adcea..d68e309 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1182,7 +1182,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case Qt::Key_Up: if (!curIndex.isValid()) { int rowCount = d->proxy->rowCount(); - QModelIndex lastIndex = d->proxy->index(rowCount - 1, 0); + QModelIndex lastIndex = d->proxy->index(rowCount - 1, d->column); d->setCurrentIndex(lastIndex); return true; } else if (curIndex.row() == 0) { @@ -1194,7 +1194,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case Qt::Key_Down: if (!curIndex.isValid()) { - QModelIndex firstIndex = d->proxy->index(0, 0); + QModelIndex firstIndex = d->proxy->index(0, d->column); d->setCurrentIndex(firstIndex); return true; } else if (curIndex.row() == d->proxy->rowCount() - 1) { diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index baea419..bbc01cc 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -146,6 +146,8 @@ private slots: void task253125_lineEditCompletion_data(); void task253125_lineEditCompletion(); + void task247560_keyboardNavigation(); + private: void filter(); void testRowCount(); @@ -1230,5 +1232,43 @@ void tst_QCompleter::task253125_lineEditCompletion() QCOMPARE(edit.text(), QString("iota")); } +void tst_QCompleter::task247560_keyboardNavigation() +{ + QStandardItemModel model; + + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + model.setItem(i, j, new QStandardItem(QString("row %1 column %2").arg(i).arg(j))); + } + } + + + QCompleter completer(&model); + completer.setCompletionColumn(1); + + QLineEdit edit; + edit.setCompleter(&completer); + edit.show(); + edit.setFocus(); + + QTest::qWait(100); + + QTest::keyClick(&edit, 'r'); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("row 1 column 1")); + + edit.clear(); + + QTest::keyClick(&edit, 'r'); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Up); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Up); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("row 3 column 1")); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" -- cgit v0.12 From 0c3068761598e9decd2bdc903be5431d093b8eac Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 19:09:33 +0200 Subject: Make test faster + fix whitespace --- tests/auto/qcompleter/tst_qcompleter.cpp | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index bbc01cc..fb03e1a 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -58,9 +58,9 @@ class CsvCompleter : public QCompleter Q_OBJECT public: CsvCompleter(QObject *parent = 0) : QCompleter(parent), csv(true) { } - - QString pathFromIndex(const QModelIndex& sourceIndex) const; - + + QString pathFromIndex(const QModelIndex& sourceIndex) const; + void setCsvCompletion(bool set) { csv = set; } protected: @@ -178,7 +178,7 @@ tst_QCompleter::~tst_QCompleter() } void tst_QCompleter::setSourceModel(ModelType type) -{ +{ QString text; QTreeWidgetItem *parent, *child; treeWidget->clear(); @@ -284,7 +284,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; - + // Plain text filter QTest::newRow("()") << "" << "" << "P0" << "P0"; QTest::newRow("()F") << "" << "F" << "P0" << "P0"; @@ -301,7 +301,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() QTest::newRow("(p)NNNN") << "p" << "NNNN" << "p4" << "p4"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(P0,)") << "P0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(P0,c)") << "P0,c" << "" << "c0P0" << "P0,c0P0"; @@ -335,7 +335,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::addColumn("completion"); QTest::addColumn("completionText"); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; @@ -354,7 +354,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -406,7 +406,7 @@ void tst_QCompleter::ciMatchingOnCsSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -458,7 +458,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p)NNN") << "p" << "NNN" << "p3" << "p3"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0p0" << "p0,c0p0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0p0" << "p0,c0p0"; @@ -471,7 +471,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p3,,c)") << "p3,,c" << "" << "" << ""; QTest::newRow("(p3,c0P3,)") << "p3,c0P3," << "" << "" << ""; QTest::newRow("(p,)") << "p," << "" << "" << ""; - + QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; } } @@ -509,13 +509,13 @@ void tst_QCompleter::directoryModel_data() QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; + QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; #else QTest::newRow("()") << "" << "" << "/" << "/"; #if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) QTest::newRow("(/h)") << "/h" << "" << "home" << "/home"; -#endif +#endif QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc"; QTest::newRow("(/etc/passw)") << "/etc/passw" << "" << "passwd" << "/etc/passwd"; #endif @@ -661,7 +661,7 @@ void tst_QCompleter::currentRow() completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); setSourceModel(CASE_INSENSITIVELY_SORTED_MODEL); - + // blank text completer->setCompletionPrefix(""); QCOMPARE(completer->currentRow(), 0); @@ -693,7 +693,7 @@ void tst_QCompleter::sortedEngineMapFromSource() QModelIndex si1, si2, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); // Fitering ON @@ -764,7 +764,7 @@ void tst_QCompleter::unsortedEngineMapFromSource() QModelIndex si, si2, si3, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); si = sourceModel->index(6, completionColumn); // "P3" @@ -846,7 +846,7 @@ void tst_QCompleter::historySearch() completer->setCaseSensitivity(Qt::CaseSensitive); setSourceModel(HISTORY_MODEL); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); // "p3,c3p3" and "p2,c4p2" are added in the tree root @@ -954,7 +954,7 @@ void tst_QCompleter::multipleWidgets() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&window); #endif - QTest::qWait(5000); + QTest::qWait(50); QTRY_VERIFY(qApp->focusWidget() == comboBox); comboBox->lineEdit()->setText("it"); QCOMPARE(comboBox->currentText(), QString("it")); // should not complete with setText @@ -967,7 +967,8 @@ void tst_QCompleter::multipleWidgets() lineEdit->setCompleter(&completer); lineEdit->show(); lineEdit->setFocus(); - QTest::qWait(5000); + QTest::qWait(50); + QTRY_VERIFY(qApp->focusWidget() == lineEdit); lineEdit->setText("it"); QCOMPARE(lineEdit->text(), QString("it")); // should not completer with setText QCOMPARE(comboBox->currentText(), QString("")); // combo box text must not change! @@ -1029,7 +1030,7 @@ void tst_QCompleter::dynamicSortOrder() QCOMPARE(completer.completionCount(), 12); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); - + root->sortChildren(0, Qt::DescendingOrder); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); -- cgit v0.12 From 449f033b88a18204404356664b654b85cc086092 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 20:49:43 +0200 Subject: Compile without qt3support --- src/gui/kernel/qwhatsthis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index f569c97..62b5863 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -351,7 +351,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) rect.translate(-r.x(), -r.y()); p.setClipRect(rect); QAbstractTextDocumentLayout::PaintContext context; - context.palette.setColor(QPalette::Text, context.palette.toolTipText()); + context.palette.setBrush(QPalette::Text, context.palette.toolTipText()); doc->documentLayout()->draw(&p, context); } else -- cgit v0.12 From fd302ab05face6c592944187fb594c1f55d62c5d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 21:55:57 +0200 Subject: Update to today's WebKit 4.6 snapshot --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 9e9d656..a843c83 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-29062009" +default_tag="qtwebkit-4.6-snapshot-13072009" if [ $# -eq 0 ]; then tag="$default_tag" -- cgit v0.12 From f23fa541a04abd1ddc36815a285ec824d5b5c5e0 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 22:00:20 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-13072009 ( b2abc0c271880b8135507861056af497f895adf5 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix qdoc warnings for QWebPage::shouldInterruptJavaScript() and mention how to re-implement it. * Api/qwebpage.cpp: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix crash with plugins when the plugin stream is cancelled. Similar to r26667 handle the case where didReceiveResponse on the plugin view results in failure to set up the stream and setMainDocumentError being called instead. This will set the m_pluginView back to 0 and we need check for it before calling didReceiveData. This was triggered by consecutive execution of LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::committedLoad): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Added QWebDatabase::removeAllDatabases, as a way to delete all databases from the offline storage path. Used by the Qt DRT. * Api/qwebdatabase.cpp: (QWebDatabase::removeAllDatabases): * Api/qwebdatabase.h: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Added loadStarted() and loadFinished() signals to QWebFrame, to allow load tracking of individual frames, as opposed to QWebPage's loadStarted/loadFinished signals that are emitted whenever _any_ child frame loads/finishes. * Api/qwebframe.cpp: Document new signals. * Api/qwebframe.h: Add new signals. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::setFrame): Connect new signals. 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Add hooks for the GCController JavaScript interface needed by the Qt DRT. Fixed sort order of includes in qwebframe.cpp. * Api/qwebframe.cpp: (qt_drt_javaScriptObjectsCount): (qt_drt_garbageCollector_collect): (qt_drt_garbageCollector_collectOnAlternateThread): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Add hooks for the GCController JavaScript interface needed by the Qt DRT. Fixed sort order of includes in qwebframe.cpp. * Api/qwebframe.cpp: (qt_drt_javaScriptObjectsCount): (qt_drt_garbageCollector_collect): (qt_drt_garbageCollector_collectOnAlternateThread): 2009-07-12 Brent Fulgham Speculative build fix after http://trac.webkit.org/changeset/45786. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::addMessageToConsole): * WebCoreSupport/ChromeClientQt.h: 2009-07-10 Yael Aharon Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=27136 Fix a bug where webkit hangs when executing infinite JavaScript loop. * Api/qwebpage.cpp: (QWebPage::shouldInterruptJavaScript): * Api/qwebpage.h: * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::shouldInterruptJavaScript): * tests/qwebpage/tst_qwebpage.cpp: (JSTestPage::JSTestPage): (JSTestPage::shouldInterruptJavaScript): (tst_QWebPage::infiniteLoopJS): 2009-07-10 Simon Hausmann Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=27108 Fix crash when in frame tree of a new frame before the new frame has been installed in the frame tree, similar to r35088. After calling Frame::init() the frame it may have been removed from the frame tree again through JavaScript. Detect this by checking the page() afterwards. To make this check safe the Frame::init() code was moved into QWebFrameData's constructor, where a RefPtr holds a reference to the frame. After the check back in FrameLoaderClientQt we would hold the single reference left and after release() the frame, its frame loader, its client as well as the QWebFrame should have disappeared then. * Api/qwebframe.cpp: (QWebFramePrivate::init): Only call Frame::init here, the rest is done in QWebFrameData's constructor. (QWebFrame::QWebFrame): * Api/qwebframe_p.h: Adjust declaration. (QWebFrameData::QWebFrameData): Create the Frame here. * Api/qwebpage.cpp: (QWebPagePrivate::createMainFrame): Adjust and simplify to new QWebFrame constructor. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createFrame): Adjust to new QWebFrame construction using QWebFrameData and add the check like in r35088. 2009-07-09 Beth Dakin Reviewed by Dave Hyatt. Make Widget RefCounted to fix: REGRESSION (TOT): In Mail, a crash occurs at WebCore::Widget::afterMouseDown() after clicking To Do's close box WER #16: Repro Access Violation in WebCore::PluginView::bindingInstance (1310178023) -and- WER #13: Crash in WebKit! WebCore::PluginView::performRequest+203 (1311461169) * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createPlugin): (WebCore::FrameLoaderClientQt::createJavaAppletWidget): * WebCoreSupport/FrameLoaderClientQt.h: 2009-07-08 Pradeepto Bhattacharya Reviewed by Ariya Hidayat. Build fix. * WebCoreSupport/FrameLoaderClientQt.h: Removed the slot slotCallPolicyFunction(). 2009-07-08 Simon Hausmann Reviewed by Tor Arne Vestbø. https://bugs.webkit.org/show_bug.cgi?id=27080 Fix DRT instability issues with fast/loader/submit-form-while-parsing-2.html When the form is submitted we call the policy function in the frame loader delayed with a queued connection. That queued connection sometimes interferes with the javascript timeout set in the testcase. Eliminate the entire delayed policy function mechanism and instead always call back directly, like in the other ports. In most other places we called the slot directly anyway. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): Remove m_policyFunction. (WebCore::FrameLoaderClientQt::callPolicyFunction): Call the policy function directly instead of emitting the queued signal. (WebCore::FrameLoaderClientQt::cancelPolicyCheck): Call callPolicyFunction directly. (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): Ditto. * WebCoreSupport/FrameLoaderClientQt.h: Remove m_policyFunction as well as the associated signal. 2009-07-07 Simon Hausmann Reviewed by Holger Freyther. Add Qt DRT hook for clearing the frame name. * Api/qwebframe.cpp: (qt_drt_clearFrameName): 2009-07-05 Simon Hausmann Reviewed by Holger Freyther. Fix two qdoc warnings. Added missing \property for QWebFrame::hasFocus and added \a tag for pos of QWebPage::frameAt. * Api/qwebframe.cpp: * Api/qwebpage.cpp: 2009-07-04 Holger Hans Peter Freyther Reviewed by Simon Hausmann. Use the recently introduced FocusController::setFocused Use the recently introduced FocusController::setFocused in the Qt platform. The SelectionController will be updated from within the FocusController now. * Api/qwebpage.cpp: (QWebPagePrivate::focusInEvent): (QWebPagePrivate::focusOutEvent): 2009-07-02 Simon Hausmann Reviewed by Ariya Hidayat. Improve documentation of QWebFrame::setFocus and hasFocus() Added missing Q_PROPERTY for QWebFrame::hasFocus. * Api/qwebframe.cpp: Clarify the docs. * Api/qwebframe.h: add Q_PROPERTY(focus). 2009-07-02 Joe Ligman Reviewed by Simon Hausmann. Bug 26855: [Qt] New methods for QWebFrame to check and set focus. Added new public methods QWebFrame::hasFocus() and QWebFrame::setFocus() Added auto test. * Api/qwebframe.cpp: (QWebFrame::hasFocus): (QWebFrame::setFocus): * Api/qwebframe.h: * tests/qwebframe/tst_qwebframe.cpp: 2009-07-01 Robert Hogan Reviewed by NOBODY. Fix Qt segfault when javascript disabled. If clients call addToJavaScriptWindowObject even though JavascriptEnabled is false webkit will segfault on the assert: ASSERTION FAILED: _rootObject (../../../WebCore/bridge/runtime.cpp:52 JSC::Bindings::Instance::Instance(WTF::PassRefPtr)) Fix is to ensure JavaScript is enabled when client calls addToJavaScriptWindowObject. https://bugs.webkit.org/show_bug.cgi?id=26906 * Api/qwebframe.cpp: (QWebFrame::addToJavaScriptWindowObject): 2009-07-01 Jakub Wieczorek Reviewed by Simon Hausmann. [Qt] Move some API headers from WebCore.pro to headers.pri so that they get installed when running make install from the build directory. * Api/headers.pri: 2009-07-01 Balazs Kelemen Reviewed by Simon Hausmann. Fixed robotized QtLauncher to work when there is no index.html in the user's home. * QtLauncher/main.cpp: (main): 2009-06-30 Brian Weinstein Reviewed by Adam Roben. Renamed scrollbarUnderPoint to scrollbarAtPoint to follow conventions. * Api/qwebpage.cpp: (QWebPage::swallowContextMenuEvent): 2009-06-30 Joe Ligman Reviewed by Adam Treat. Bug 26422: [Qt] QWebPagePrivate::frameAt calculates wrong frame Added a public method QWebPage::frameAt Removed QWebPagePrivate::frameAt, which calcuated the wrong frame Modified QWebPage::swallowContextMenuEvent to use the new frameAt method New test case for frameAt added to tst_qwebpage.cpp * Api/qwebpage.cpp: (QWebPage::frameAt): (QWebPage::swallowContextMenuEvent): * Api/qwebpage.h: * Api/qwebpage_p.h: * tests/qwebpage/frametest/iframe.html: Added. * tests/qwebpage/frametest/iframe2.html: Added. * tests/qwebpage/frametest/iframe3.html: Added. * tests/qwebpage/tst_qwebpage.cpp: (frameAtHelper): (tst_QWebPage::frameAt): * tests/qwebpage/tst_qwebpage.qrc: 2009-06-30 Jakub Wieczorek Reviewed by Simon Hausmann. Add QWebFrame::baseUrl() function that exposes the base URL of a frame. Autotests included. * Api/qwebframe.cpp: (QWebFrame::baseUrl): * Api/qwebframe.h: * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/ChangeLog | 69 + src/3rdparty/webkit/JavaScriptCore/ChangeLog | 461 ++ .../webkit/JavaScriptCore/JavaScriptCore.gypi | 452 ++ .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 25 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.h | 39 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 1 - .../bytecompiler/BytecodeGenerator.cpp | 87 +- .../bytecompiler/BytecodeGenerator.h | 14 +- .../webkit/JavaScriptCore/create_hash_table | 2 +- .../webkit/JavaScriptCore/debugger/Debugger.h | 2 +- .../JavaScriptCore/generated/ArrayPrototype.lut.h | 2 +- .../JavaScriptCore/generated/DatePrototype.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Grammar.cpp | 1002 +++- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- .../JavaScriptCore/generated/JSONObject.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Lexer.lut.h | 2 +- .../JavaScriptCore/generated/MathObject.lut.h | 2 +- .../generated/NumberConstructor.lut.h | 2 +- .../generated/RegExpConstructor.lut.h | 2 +- .../JavaScriptCore/generated/RegExpObject.lut.h | 2 +- .../JavaScriptCore/generated/StringPrototype.lut.h | 2 +- .../webkit/JavaScriptCore/interpreter/CallFrame.h | 19 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 562 +- .../JavaScriptCore/interpreter/Interpreter.h | 1 - src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 1 - .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 13 +- src/3rdparty/webkit/JavaScriptCore/jsc.cpp | 6 +- .../JavaScriptCore/parser/NodeConstructors.h | 5 + .../webkit/JavaScriptCore/parser/Nodes.cpp | 6 +- src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h | 2 + .../webkit/JavaScriptCore/runtime/JSActivation.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.cpp | 16 +- .../JavaScriptCore/runtime/LiteralParser.cpp | 6 +- .../webkit/JavaScriptCore/runtime/Lookup.h | 7 + .../webkit/JavaScriptCore/runtime/RegExp.cpp | 41 +- .../webkit/JavaScriptCore/runtime/RegExp.h | 3 +- .../JavaScriptCore/runtime/RegExpConstructor.cpp | 53 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 3 +- .../webkit/JavaScriptCore/wtf/FastMalloc.cpp | 21 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 7 + src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h | 16 +- .../webkit/JavaScriptCore/wtf/OwnPtrCommon.h | 3 + .../webkit/JavaScriptCore/wtf/OwnPtrWin.cpp | 7 + src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 18 +- .../webkit/JavaScriptCore/wtf/PtrAndFlags.h | 15 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp | 216 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 2 + src/3rdparty/webkit/VERSION | 6 +- src/3rdparty/webkit/WebCore/ChangeLog | 5485 ++++++++++++++++++++ src/3rdparty/webkit/WebCore/DerivedSources.cpp | 1 + src/3rdparty/webkit/WebCore/WebCore.gypi | 3334 ++++++++++++ src/3rdparty/webkit/WebCore/WebCore.order | 1 - src/3rdparty/webkit/WebCore/WebCore.pro | 48 +- .../WebCore/accessibility/AccessibilityObject.h | 5 +- .../accessibility/AccessibilityRenderObject.cpp | 46 +- .../accessibility/AccessibilityRenderObject.h | 1 + .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 93 + .../bindings/js/JSCustomXPathNSResolver.cpp | 2 +- .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 5 + .../webkit/WebCore/bindings/js/JSDOMBinding.h | 12 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 2 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 8 + .../bindings/js/JSDataGridColumnListCustom.cpp | 5 + .../WebCore/bindings/js/JSDataGridDataSource.cpp | 35 +- .../WebCore/bindings/js/JSDataGridDataSource.h | 5 +- .../webkit/WebCore/bindings/js/JSEventTarget.cpp | 14 + .../bindings/js/JSHTMLDataGridElementCustom.cpp | 10 + .../bindings/js/JSHTMLFormElementCustom.cpp | 2 +- .../WebCore/bindings/js/JSLazyEventListener.cpp | 8 +- .../WebCore/bindings/js/JSNamedNodesCollection.cpp | 4 +- .../webkit/WebCore/bindings/js/JSRGBColor.cpp | 4 +- .../bindings/js/JSSharedWorkerConstructor.cpp | 83 + .../bindings/js/JSSharedWorkerConstructor.h | 56 + .../WebCore/bindings/js/JSSharedWorkerCustom.cpp | 57 + .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 11 + .../webkit/WebCore/bindings/js/JSWorkerCustom.cpp | 1 + .../WebCore/bindings/js/ScriptController.cpp | 13 +- .../WebCore/bindings/js/ScriptObjectQuarantine.cpp | 2 +- .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 14 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 103 +- .../webkit/WebCore/bridge/qt/qt_instance.cpp | 2 +- .../webkit/WebCore/bridge/qt/qt_runtime.cpp | 2 +- .../webkit/WebCore/bridge/runtime_array.cpp | 8 +- .../webkit/WebCore/bridge/runtime_method.cpp | 7 +- .../webkit/WebCore/bridge/runtime_object.cpp | 4 +- .../webkit/WebCore/bridge/runtime_root.cpp | 1 + src/3rdparty/webkit/WebCore/bridge/runtime_root.h | 2 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 45 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 10 +- src/3rdparty/webkit/WebCore/css/CSSRule.idl | 1 + src/3rdparty/webkit/WebCore/css/CSSSelector.cpp | 12 + src/3rdparty/webkit/WebCore/css/CSSSelector.h | 3 + .../webkit/WebCore/css/CSSStyleSelector.cpp | 48 +- src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h | 7 + src/3rdparty/webkit/WebCore/css/CSSValue.idl | 1 + .../webkit/WebCore/css/CSSValueKeywords.in | 4 +- src/3rdparty/webkit/WebCore/css/MediaList.cpp | 2 +- src/3rdparty/webkit/WebCore/css/MediaQuery.h | 3 +- .../webkit/WebCore/css/MediaQueryEvaluator.cpp | 2 +- .../webkit/WebCore/css/MediaQueryEvaluator.h | 3 +- src/3rdparty/webkit/WebCore/css/MediaQueryExp.h | 6 +- src/3rdparty/webkit/WebCore/css/StyleSheet.idl | 1 + src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h | 2 +- src/3rdparty/webkit/WebCore/css/html.css | 613 +++ src/3rdparty/webkit/WebCore/css/html4.css | 617 --- src/3rdparty/webkit/WebCore/css/mediaControls.css | 13 +- .../webkit/WebCore/css/mediaControlsQT.css | 115 +- src/3rdparty/webkit/WebCore/css/themeWin.css | 2 +- src/3rdparty/webkit/WebCore/dom/Comment.h | 3 +- src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 2 + src/3rdparty/webkit/WebCore/dom/Document.cpp | 24 +- src/3rdparty/webkit/WebCore/dom/Document.h | 8 +- src/3rdparty/webkit/WebCore/dom/Document.idl | 2 +- .../webkit/WebCore/dom/DocumentFragment.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/DocumentFragment.h | 3 +- .../webkit/WebCore/dom/DynamicNodeList.cpp | 13 +- src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h | 9 +- src/3rdparty/webkit/WebCore/dom/EditingText.h | 3 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 32 +- src/3rdparty/webkit/WebCore/dom/Element.h | 2 + src/3rdparty/webkit/WebCore/dom/Event.idl | 1 + src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 7 + src/3rdparty/webkit/WebCore/dom/EventTarget.h | 6 + .../webkit/WebCore/dom/HTMLAllCollection.idl | 40 + src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp | 4 +- .../webkit/WebCore/dom/MessagePortChannel.cpp | 17 - .../webkit/WebCore/dom/MessagePortChannel.h | 2 + src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/Node.cpp | 28 +- src/3rdparty/webkit/WebCore/dom/Node.idl | 2 +- src/3rdparty/webkit/WebCore/dom/NodeRareData.h | 21 +- src/3rdparty/webkit/WebCore/dom/Notation.h | 3 +- .../webkit/WebCore/dom/ProcessingInstruction.h | 3 +- src/3rdparty/webkit/WebCore/dom/Range.cpp | 10 +- .../webkit/WebCore/dom/ScriptExecutionContext.h | 2 +- src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 13 + src/3rdparty/webkit/WebCore/dom/SelectElement.h | 3 +- src/3rdparty/webkit/WebCore/dom/StyledElement.cpp | 5 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 17 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 7 +- .../dom/default/PlatformMessagePortChannel.cpp | 21 + .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 4 +- .../WebCore/editing/CompositeEditCommand.cpp | 2 + .../WebCore/editing/DeleteSelectionCommand.cpp | 2 +- src/3rdparty/webkit/WebCore/editing/Editor.cpp | 12 +- .../webkit/WebCore/editing/EditorCommand.cpp | 3 +- .../WebCore/editing/IndentOutdentCommand.cpp | 10 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 3 + .../webkit/WebCore/editing/SelectionController.cpp | 3 +- .../webkit/WebCore/editing/SmartReplaceICU.cpp | 3 +- .../webkit/WebCore/editing/TextIterator.cpp | 96 +- .../WebCore/editing/gtk/SelectionControllerGtk.cpp | 4 +- .../webkit/WebCore/generated/ArrayPrototype.lut.h | 2 +- .../webkit/WebCore/generated/CSSGrammar.cpp | 877 +++- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 109 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 547 +- .../webkit/WebCore/generated/CSSValueKeywords.h | 426 +- .../webkit/WebCore/generated/DatePrototype.lut.h | 2 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 1002 +++- src/3rdparty/webkit/WebCore/generated/Grammar.h | 109 +- .../WebCore/generated/HTMLElementFactory.cpp | 28 + .../webkit/WebCore/generated/HTMLNames.cpp | 20 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 4 + src/3rdparty/webkit/WebCore/generated/JSAttr.cpp | 6 +- .../webkit/WebCore/generated/JSBarInfo.cpp | 4 +- .../webkit/WebCore/generated/JSCDATASection.cpp | 6 +- .../webkit/WebCore/generated/JSCSSCharsetRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSImportRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSMediaRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSPageRule.cpp | 6 +- .../WebCore/generated/JSCSSPrimitiveValue.cpp | 6 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 6 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 6 +- .../webkit/WebCore/generated/JSCSSStyleRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSStyleSheet.cpp | 6 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 6 +- .../webkit/WebCore/generated/JSCSSValueList.cpp | 6 +- .../generated/JSCSSVariablesDeclaration.cpp | 6 +- .../WebCore/generated/JSCSSVariablesRule.cpp | 6 +- .../webkit/WebCore/generated/JSCanvasGradient.cpp | 2 +- .../webkit/WebCore/generated/JSCanvasPattern.cpp | 2 +- .../generated/JSCanvasRenderingContext2D.cpp | 6 +- .../webkit/WebCore/generated/JSCharacterData.cpp | 6 +- .../webkit/WebCore/generated/JSClientRect.cpp | 6 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 6 +- .../webkit/WebCore/generated/JSClipboard.cpp | 6 +- .../webkit/WebCore/generated/JSComment.cpp | 6 +- .../webkit/WebCore/generated/JSConsole.cpp | 4 +- .../webkit/WebCore/generated/JSCoordinates.cpp | 4 +- .../webkit/WebCore/generated/JSCounter.cpp | 6 +- .../WebCore/generated/JSDOMApplicationCache.cpp | 4 +- .../WebCore/generated/JSDOMCoreException.cpp | 6 +- .../WebCore/generated/JSDOMImplementation.cpp | 6 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 6 +- .../webkit/WebCore/generated/JSDOMSelection.cpp | 4 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 71 +- .../webkit/WebCore/generated/JSDOMWindow.h | 7 + .../webkit/WebCore/generated/JSDataGridColumn.cpp | 11 +- .../webkit/WebCore/generated/JSDataGridColumn.h | 4 + .../WebCore/generated/JSDataGridColumnList.cpp | 11 +- .../WebCore/generated/JSDataGridColumnList.h | 4 + .../webkit/WebCore/generated/JSDatabase.cpp | 4 +- .../webkit/WebCore/generated/JSDocument.cpp | 6 +- .../WebCore/generated/JSDocumentFragment.cpp | 6 +- .../webkit/WebCore/generated/JSDocumentType.cpp | 6 +- .../webkit/WebCore/generated/JSElement.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSEntity.cpp | 6 +- .../webkit/WebCore/generated/JSEntityReference.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 6 +- .../webkit/WebCore/generated/JSEventException.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 6 +- .../webkit/WebCore/generated/JSFileList.cpp | 6 +- .../webkit/WebCore/generated/JSGeolocation.cpp | 4 +- .../webkit/WebCore/generated/JSGeoposition.cpp | 4 +- .../WebCore/generated/JSHTMLAnchorElement.cpp | 6 +- .../WebCore/generated/JSHTMLAppletElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLAreaElement.cpp | 6 +- .../WebCore/generated/JSHTMLAudioElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBRElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBaseElement.cpp | 6 +- .../WebCore/generated/JSHTMLBaseFontElement.cpp | 6 +- .../WebCore/generated/JSHTMLBlockquoteElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 6 +- .../WebCore/generated/JSHTMLButtonElement.cpp | 18 +- .../webkit/WebCore/generated/JSHTMLButtonElement.h | 1 + .../WebCore/generated/JSHTMLCanvasElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 6 +- .../WebCore/generated/JSHTMLDListElement.cpp | 6 +- .../generated/JSHTMLDataGridCellElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridCellElement.h | 4 + .../WebCore/generated/JSHTMLDataGridColElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridColElement.h | 4 + .../WebCore/generated/JSHTMLDataGridElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridElement.h | 4 + .../WebCore/generated/JSHTMLDataGridRowElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridRowElement.h | 4 + .../WebCore/generated/JSHTMLDirectoryElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLDivElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLDocument.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLElement.cpp | 6 +- .../generated/JSHTMLElementWrapperFactory.cpp | 24 + .../WebCore/generated/JSHTMLEmbedElement.cpp | 6 +- .../WebCore/generated/JSHTMLFieldSetElement.cpp | 18 +- .../WebCore/generated/JSHTMLFieldSetElement.h | 1 + .../webkit/WebCore/generated/JSHTMLFontElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLFormElement.cpp | 6 +- .../WebCore/generated/JSHTMLFrameElement.cpp | 6 +- .../WebCore/generated/JSHTMLFrameSetElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHRElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHeadElement.cpp | 6 +- .../WebCore/generated/JSHTMLHeadingElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.cpp | 6 +- .../WebCore/generated/JSHTMLIFrameElement.cpp | 6 +- .../WebCore/generated/JSHTMLImageElement.cpp | 6 +- .../WebCore/generated/JSHTMLInputElement.cpp | 18 +- .../webkit/WebCore/generated/JSHTMLInputElement.h | 1 + .../WebCore/generated/JSHTMLIsIndexElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLLIElement.cpp | 6 +- .../WebCore/generated/JSHTMLLabelElement.cpp | 6 +- .../WebCore/generated/JSHTMLLegendElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLLinkElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMapElement.cpp | 6 +- .../WebCore/generated/JSHTMLMarqueeElement.cpp | 6 +- .../WebCore/generated/JSHTMLMediaElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMenuElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMetaElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLModElement.cpp | 6 +- .../WebCore/generated/JSHTMLOListElement.cpp | 6 +- .../WebCore/generated/JSHTMLObjectElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptGroupElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptionElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptionsCollection.cpp | 4 +- .../WebCore/generated/JSHTMLParagraphElement.cpp | 6 +- .../WebCore/generated/JSHTMLParamElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLPreElement.cpp | 6 +- .../WebCore/generated/JSHTMLQuoteElement.cpp | 6 +- .../WebCore/generated/JSHTMLScriptElement.cpp | 6 +- .../WebCore/generated/JSHTMLSelectElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLSelectElement.h | 1 + .../WebCore/generated/JSHTMLSourceElement.cpp | 6 +- .../WebCore/generated/JSHTMLStyleElement.cpp | 6 +- .../generated/JSHTMLTableCaptionElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableCellElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableColElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableRowElement.cpp | 6 +- .../generated/JSHTMLTableSectionElement.cpp | 6 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 20 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 1 + .../WebCore/generated/JSHTMLTitleElement.cpp | 6 +- .../WebCore/generated/JSHTMLUListElement.cpp | 6 +- .../WebCore/generated/JSHTMLVideoElement.cpp | 6 +- .../webkit/WebCore/generated/JSHistory.cpp | 4 +- .../webkit/WebCore/generated/JSImageData.cpp | 6 +- .../WebCore/generated/JSInspectorController.cpp | 6 +- .../WebCore/generated/JSJavaScriptCallFrame.cpp | 4 +- .../webkit/WebCore/generated/JSKeyboardEvent.cpp | 6 +- .../webkit/WebCore/generated/JSLocation.cpp | 4 +- .../webkit/WebCore/generated/JSMediaError.cpp | 6 +- .../webkit/WebCore/generated/JSMediaList.cpp | 6 +- .../webkit/WebCore/generated/JSMessageChannel.cpp | 4 +- .../webkit/WebCore/generated/JSMessageEvent.cpp | 6 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 6 +- .../webkit/WebCore/generated/JSMimeType.cpp | 6 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 6 +- .../webkit/WebCore/generated/JSMouseEvent.cpp | 6 +- .../webkit/WebCore/generated/JSMutationEvent.cpp | 6 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 6 +- .../webkit/WebCore/generated/JSNavigator.cpp | 4 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 6 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 6 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 6 +- .../webkit/WebCore/generated/JSNodeList.cpp | 6 +- .../webkit/WebCore/generated/JSNotation.cpp | 6 +- .../webkit/WebCore/generated/JSONObject.lut.h | 2 +- .../webkit/WebCore/generated/JSOverflowEvent.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 6 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 6 +- .../webkit/WebCore/generated/JSPositionError.cpp | 6 +- .../WebCore/generated/JSProcessingInstruction.cpp | 6 +- .../webkit/WebCore/generated/JSProgressEvent.cpp | 6 +- .../webkit/WebCore/generated/JSRGBColor.lut.h | 2 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 6 +- .../webkit/WebCore/generated/JSRangeException.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 6 +- .../webkit/WebCore/generated/JSSQLError.cpp | 4 +- .../webkit/WebCore/generated/JSSQLResultSet.cpp | 4 +- .../WebCore/generated/JSSQLResultSetRowList.cpp | 4 +- .../webkit/WebCore/generated/JSSQLTransaction.cpp | 2 +- .../webkit/WebCore/generated/JSSVGAElement.cpp | 4 +- .../WebCore/generated/JSSVGAltGlyphElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 6 +- .../WebCore/generated/JSSVGAnimateColorElement.cpp | 2 +- .../WebCore/generated/JSSVGAnimateElement.cpp | 2 +- .../generated/JSSVGAnimateTransformElement.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedAngle.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedBoolean.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedEnumeration.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedInteger.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedLength.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedLengthList.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedNumber.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedNumberList.cpp | 4 +- .../generated/JSSVGAnimatedPreserveAspectRatio.cpp | 4 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedString.cpp | 4 +- .../generated/JSSVGAnimatedTransformList.cpp | 4 +- .../WebCore/generated/JSSVGAnimationElement.cpp | 4 +- .../WebCore/generated/JSSVGCircleElement.cpp | 4 +- .../WebCore/generated/JSSVGClipPathElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGColor.cpp | 6 +- .../JSSVGComponentTransferFunctionElement.cpp | 6 +- .../WebCore/generated/JSSVGCursorElement.cpp | 4 +- .../generated/JSSVGDefinitionSrcElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGDefsElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGDescElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGDocument.cpp | 4 +- .../webkit/WebCore/generated/JSSVGElement.cpp | 4 +- .../WebCore/generated/JSSVGElementInstance.cpp | 4 +- .../WebCore/generated/JSSVGElementInstanceList.cpp | 4 +- .../WebCore/generated/JSSVGEllipseElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGException.cpp | 6 +- .../WebCore/generated/JSSVGFEBlendElement.cpp | 6 +- .../generated/JSSVGFEColorMatrixElement.cpp | 6 +- .../generated/JSSVGFEComponentTransferElement.cpp | 4 +- .../WebCore/generated/JSSVGFECompositeElement.cpp | 6 +- .../generated/JSSVGFEDiffuseLightingElement.cpp | 4 +- .../generated/JSSVGFEDisplacementMapElement.cpp | 6 +- .../generated/JSSVGFEDistantLightElement.cpp | 4 +- .../WebCore/generated/JSSVGFEFloodElement.cpp | 6 +- .../WebCore/generated/JSSVGFEFuncAElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncBElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncGElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncRElement.cpp | 2 +- .../generated/JSSVGFEGaussianBlurElement.cpp | 4 +- .../WebCore/generated/JSSVGFEImageElement.cpp | 4 +- .../WebCore/generated/JSSVGFEMergeElement.cpp | 4 +- .../WebCore/generated/JSSVGFEMergeNodeElement.cpp | 4 +- .../WebCore/generated/JSSVGFEOffsetElement.cpp | 4 +- .../WebCore/generated/JSSVGFEPointLightElement.cpp | 4 +- .../generated/JSSVGFESpecularLightingElement.cpp | 4 +- .../WebCore/generated/JSSVGFESpotLightElement.cpp | 4 +- .../WebCore/generated/JSSVGFETileElement.cpp | 4 +- .../WebCore/generated/JSSVGFETurbulenceElement.cpp | 6 +- .../WebCore/generated/JSSVGFilterElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGFontElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceElement.cpp | 2 +- .../generated/JSSVGFontFaceFormatElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceNameElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceSrcElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceUriElement.cpp | 2 +- .../generated/JSSVGForeignObjectElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGGElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGGlyphElement.cpp | 2 +- .../WebCore/generated/JSSVGGradientElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGHKernElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGImageElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 6 +- .../webkit/WebCore/generated/JSSVGLengthList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGLineElement.cpp | 4 +- .../generated/JSSVGLinearGradientElement.cpp | 4 +- .../WebCore/generated/JSSVGMarkerElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGMaskElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGMatrix.cpp | 4 +- .../WebCore/generated/JSSVGMetadataElement.cpp | 2 +- .../WebCore/generated/JSSVGMissingGlyphElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGNumber.cpp | 4 +- .../webkit/WebCore/generated/JSSVGNumberList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPaint.cpp | 6 +- .../webkit/WebCore/generated/JSSVGPathElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 6 +- .../WebCore/generated/JSSVGPathSegArcAbs.cpp | 4 +- .../WebCore/generated/JSSVGPathSegArcRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegClosePath.cpp | 2 +- .../generated/JSSVGPathSegCurvetoCubicAbs.cpp | 4 +- .../generated/JSSVGPathSegCurvetoCubicRel.cpp | 4 +- .../JSSVGPathSegCurvetoCubicSmoothAbs.cpp | 4 +- .../JSSVGPathSegCurvetoCubicSmoothRel.cpp | 4 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.cpp | 4 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.cpp | 4 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp | 4 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoHorizontalRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegLinetoRel.cpp | 4 +- .../generated/JSSVGPathSegLinetoVerticalAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoVerticalRel.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPathSegList.cpp | 4 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.cpp | 4 +- .../WebCore/generated/JSSVGPathSegMovetoRel.cpp | 4 +- .../WebCore/generated/JSSVGPatternElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPoint.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPointList.cpp | 4 +- .../WebCore/generated/JSSVGPolygonElement.cpp | 4 +- .../WebCore/generated/JSSVGPolylineElement.cpp | 4 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 6 +- .../generated/JSSVGRadialGradientElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGRect.cpp | 4 +- .../webkit/WebCore/generated/JSSVGRectElement.cpp | 4 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 6 +- .../webkit/WebCore/generated/JSSVGSVGElement.cpp | 4 +- .../WebCore/generated/JSSVGScriptElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGSetElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGStopElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGStringList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGStyleElement.cpp | 4 +- .../WebCore/generated/JSSVGSwitchElement.cpp | 4 +- .../WebCore/generated/JSSVGSymbolElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTRefElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTSpanElement.cpp | 2 +- .../WebCore/generated/JSSVGTextContentElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGTextElement.cpp | 4 +- .../WebCore/generated/JSSVGTextPathElement.cpp | 6 +- .../generated/JSSVGTextPositioningElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTitleElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 6 +- .../WebCore/generated/JSSVGTransformList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 6 +- .../webkit/WebCore/generated/JSSVGUseElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGViewElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGZoomEvent.cpp | 4 +- src/3rdparty/webkit/WebCore/generated/JSScreen.cpp | 4 +- .../webkit/WebCore/generated/JSStorage.cpp | 6 +- .../webkit/WebCore/generated/JSStorageEvent.cpp | 6 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 6 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSText.cpp | 6 +- .../webkit/WebCore/generated/JSTextEvent.cpp | 6 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 6 +- .../webkit/WebCore/generated/JSTimeRanges.cpp | 4 +- .../webkit/WebCore/generated/JSTreeWalker.cpp | 6 +- .../webkit/WebCore/generated/JSUIEvent.cpp | 6 +- .../webkit/WebCore/generated/JSValidityState.cpp | 172 + .../webkit/WebCore/generated/JSValidityState.h | 79 + .../webkit/WebCore/generated/JSVoidCallback.cpp | 2 +- .../WebCore/generated/JSWebKitAnimationEvent.cpp | 6 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.cpp | 6 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.cpp | 6 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.cpp | 4 +- .../generated/JSWebKitCSSTransformValue.cpp | 6 +- .../webkit/WebCore/generated/JSWebKitPoint.cpp | 4 +- .../WebCore/generated/JSWebKitTransitionEvent.cpp | 6 +- .../webkit/WebCore/generated/JSWheelEvent.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSWorker.cpp | 20 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 35 +- .../webkit/WebCore/generated/JSWorkerContext.h | 3 + .../webkit/WebCore/generated/JSWorkerLocation.cpp | 6 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 4 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 4 +- .../generated/JSXMLHttpRequestException.cpp | 6 +- .../generated/JSXMLHttpRequestProgressEvent.cpp | 6 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 6 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 6 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 6 +- .../webkit/WebCore/generated/JSXPathException.cpp | 6 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 6 +- .../webkit/WebCore/generated/JSXPathNSResolver.cpp | 2 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/Lexer.lut.h | 2 +- .../webkit/WebCore/generated/MathObject.lut.h | 2 +- .../WebCore/generated/NumberConstructor.lut.h | 2 +- .../WebCore/generated/RegExpConstructor.lut.h | 2 +- .../webkit/WebCore/generated/RegExpObject.lut.h | 2 +- .../webkit/WebCore/generated/StringPrototype.lut.h | 2 +- .../WebCore/generated/UserAgentStyleSheets.h | 4 +- .../WebCore/generated/UserAgentStyleSheetsData.cpp | 243 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 418 +- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- .../webkit/WebCore/history/HistoryItem.cpp | 24 +- src/3rdparty/webkit/WebCore/history/HistoryItem.h | 9 +- .../WebCore/html/CanvasRenderingContext2D.cpp | 12 +- src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp | 4 +- .../webkit/WebCore/html/DOMDataGridDataSource.cpp | 44 + .../webkit/WebCore/html/DOMDataGridDataSource.h | 69 + .../webkit/WebCore/html/DataGridColumn.cpp | 11 + src/3rdparty/webkit/WebCore/html/DataGridColumn.h | 47 +- .../webkit/WebCore/html/DataGridColumn.idl | 3 +- .../webkit/WebCore/html/DataGridColumnList.cpp | 40 +- .../webkit/WebCore/html/DataGridColumnList.h | 21 +- .../webkit/WebCore/html/DataGridColumnList.idl | 3 +- .../webkit/WebCore/html/DataGridDataSource.h | 7 +- .../webkit/WebCore/html/HTMLAnchorElement.cpp | 4 +- .../webkit/WebCore/html/HTMLAppletElement.h | 3 +- .../webkit/WebCore/html/HTMLAttributeNames.in | 1 + .../webkit/WebCore/html/HTMLAudioElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLBRElement.h | 3 +- .../webkit/WebCore/html/HTMLBaseElement.cpp | 4 +- src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h | 4 +- .../webkit/WebCore/html/HTMLBaseFontElement.h | 3 +- .../webkit/WebCore/html/HTMLButtonElement.idl | 3 + .../webkit/WebCore/html/HTMLDListElement.h | 3 +- .../WebCore/html/HTMLDataGridCellElement.cpp | 5 + .../webkit/WebCore/html/HTMLDataGridCellElement.h | 4 + .../WebCore/html/HTMLDataGridCellElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridColElement.cpp | 75 +- .../webkit/WebCore/html/HTMLDataGridColElement.h | 23 +- .../webkit/WebCore/html/HTMLDataGridColElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridElement.cpp | 32 +- .../webkit/WebCore/html/HTMLDataGridElement.h | 10 +- .../webkit/WebCore/html/HTMLDataGridElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridRowElement.cpp | 5 + .../webkit/WebCore/html/HTMLDataGridRowElement.h | 4 + .../webkit/WebCore/html/HTMLDataGridRowElement.idl | 3 +- .../webkit/WebCore/html/HTMLDirectoryElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLElement.cpp | 9 +- .../webkit/WebCore/html/HTMLFieldSetElement.cpp | 2 +- .../webkit/WebCore/html/HTMLFieldSetElement.idl | 3 + .../webkit/WebCore/html/HTMLFormControlElement.cpp | 27 + .../webkit/WebCore/html/HTMLFormControlElement.h | 6 + .../webkit/WebCore/html/HTMLFormElement.cpp | 10 +- src/3rdparty/webkit/WebCore/html/HTMLFormElement.h | 2 +- src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp | 2 +- src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h | 3 +- .../webkit/WebCore/html/HTMLImageElement.h | 2 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 4 +- .../webkit/WebCore/html/HTMLInputElement.idl | 5 +- .../webkit/WebCore/html/HTMLIsIndexElement.h | 3 +- .../webkit/WebCore/html/HTMLLinkElement.cpp | 4 +- .../webkit/WebCore/html/HTMLMarqueeElement.cpp | 2 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 37 +- .../webkit/WebCore/html/HTMLMediaElement.h | 11 +- src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLModElement.h | 3 +- .../webkit/WebCore/html/HTMLOListElement.h | 3 +- .../webkit/WebCore/html/HTMLOptionElement.cpp | 8 +- .../webkit/WebCore/html/HTMLParamElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLParser.cpp | 18 +- src/3rdparty/webkit/WebCore/html/HTMLParser.h | 2 + .../webkit/WebCore/html/HTMLQuoteElement.h | 3 +- .../webkit/WebCore/html/HTMLSelectElement.cpp | 8 +- .../webkit/WebCore/html/HTMLSelectElement.idl | 3 + .../webkit/WebCore/html/HTMLStyleElement.h | 3 +- .../webkit/WebCore/html/HTMLTableCaptionElement.h | 3 +- .../webkit/WebCore/html/HTMLTableCellElement.h | 3 +- .../webkit/WebCore/html/HTMLTableColElement.h | 3 +- .../WebCore/html/HTMLTableSectionElement.cpp | 2 +- src/3rdparty/webkit/WebCore/html/HTMLTagNames.in | 11 +- .../webkit/WebCore/html/HTMLTextAreaElement.idl | 3 + .../webkit/WebCore/html/HTMLTitleElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 57 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h | 4 + .../webkit/WebCore/html/HTMLUListElement.h | 3 +- .../webkit/WebCore/html/HTMLVideoElement.cpp | 16 +- .../webkit/WebCore/html/HTMLVideoElement.h | 6 +- src/3rdparty/webkit/WebCore/html/ImageData.idl | 2 +- src/3rdparty/webkit/WebCore/html/TimeRanges.h | 3 +- src/3rdparty/webkit/WebCore/html/ValidityState.cpp | 43 + src/3rdparty/webkit/WebCore/html/ValidityState.h | 59 + src/3rdparty/webkit/WebCore/html/ValidityState.idl | 36 + .../webkit/WebCore/inspector/ConsoleMessage.cpp | 8 +- .../webkit/WebCore/inspector/ConsoleMessage.h | 5 +- .../WebCore/inspector/InspectorController.cpp | 24 +- .../webkit/WebCore/inspector/InspectorController.h | 4 +- .../webkit/WebCore/inspector/InspectorFrontend.cpp | 3 +- .../WebCore/inspector/JavaScriptCallFrame.cpp | 8 + .../webkit/WebCore/inspector/JavaScriptCallFrame.h | 1 + .../WebCore/inspector/JavaScriptDebugServer.cpp | 21 +- .../WebCore/inspector/JavaScriptDebugServer.h | 3 + .../inspector/front-end/CallStackSidebarPane.js | 57 + .../webkit/WebCore/inspector/front-end/Console.js | 94 +- .../inspector/front-end/KeyboardShortcut.js | 108 + .../webkit/WebCore/inspector/front-end/Resource.js | 4 +- .../WebCore/inspector/front-end/ResourcesPanel.js | 2 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 61 +- .../WebCore/inspector/front-end/TextPrompt.js | 5 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 2 + .../WebCore/inspector/front-end/inspector.css | 8 +- .../WebCore/inspector/front-end/inspector.html | 1 + .../WebCore/inspector/front-end/inspector.js | 1 + src/3rdparty/webkit/WebCore/loader/DocLoader.cpp | 2 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 9 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 77 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 8 +- .../webkit/WebCore/loader/FrameLoaderClient.h | 4 +- .../webkit/WebCore/loader/TextDocument.cpp | 2 + .../webkit/WebCore/loader/icon/IconDatabase.cpp | 4 + .../webkit/WebCore/loader/icon/IconDatabase.h | 4 +- .../WebCore/loader/icon/IconDatabaseNone.cpp | 21 + src/3rdparty/webkit/WebCore/loader/loader.cpp | 43 +- src/3rdparty/webkit/WebCore/loader/loader.h | 9 +- src/3rdparty/webkit/WebCore/page/ChromeClient.h | 5 +- src/3rdparty/webkit/WebCore/page/Console.cpp | 39 +- src/3rdparty/webkit/WebCore/page/Console.h | 19 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 2 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 9 +- src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 62 +- src/3rdparty/webkit/WebCore/page/EventHandler.h | 4 + .../webkit/WebCore/page/FocusController.cpp | 36 +- src/3rdparty/webkit/WebCore/page/FocusController.h | 4 + src/3rdparty/webkit/WebCore/page/Frame.cpp | 4 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 223 +- src/3rdparty/webkit/WebCore/page/FrameView.h | 34 +- .../WebCore/page/MouseEventWithHitTestResults.h | 5 +- src/3rdparty/webkit/WebCore/page/Settings.cpp | 12 + src/3rdparty/webkit/WebCore/page/Settings.h | 8 + src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 135 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.h | 24 +- .../WebCore/page/android/DragControllerAndroid.cpp | 2 +- .../WebCore/page/android/EventHandlerAndroid.cpp | 4 +- .../WebCore/page/animation/AnimationBase.cpp | 2 +- .../WebCore/page/animation/AnimationController.cpp | 18 +- .../WebCore/page/animation/CompositeAnimation.cpp | 147 +- .../WebCore/page/animation/CompositeAnimation.h | 2 - .../WebCore/page/animation/ImplicitAnimation.cpp | 4 + .../webkit/WebCore/page/qt/DragControllerQt.cpp | 3 +- .../webkit/WebCore/page/win/DragControllerWin.cpp | 3 +- src/3rdparty/webkit/WebCore/page/win/FrameWin.h | 2 +- .../webkit/WebCore/platform/CrossThreadCopier.h | 9 + src/3rdparty/webkit/WebCore/platform/DragImage.h | 4 +- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 38 +- .../webkit/WebCore/platform/LocalizedStrings.h | 3 + .../webkit/WebCore/platform/ScrollView.cpp | 56 +- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 16 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp | 31 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.h | 15 +- .../webkit/WebCore/platform/ScrollbarClient.h | 26 +- src/3rdparty/webkit/WebCore/platform/Theme.h | 2 +- src/3rdparty/webkit/WebCore/platform/ThemeTypes.h | 7 +- src/3rdparty/webkit/WebCore/platform/Widget.cpp | 106 +- src/3rdparty/webkit/WebCore/platform/Widget.h | 26 +- .../WebCore/platform/graphics/BitmapImage.cpp | 4 +- .../webkit/WebCore/platform/graphics/Color.h | 1 - .../WebCore/platform/graphics/GraphicsLayer.cpp | 1 + .../WebCore/platform/graphics/GraphicsLayer.h | 9 + .../webkit/WebCore/platform/graphics/Image.h | 16 +- .../webkit/WebCore/platform/graphics/IntPoint.h | 1 + .../WebCore/platform/graphics/MediaPlayer.cpp | 20 +- .../webkit/WebCore/platform/graphics/MediaPlayer.h | 4 + .../WebCore/platform/graphics/MediaPlayerPrivate.h | 7 +- .../WebCore/platform/mac/LocalizedStringsMac.mm | 16 + .../webkit/WebCore/platform/mac/ThemeMac.mm | 13 + .../WebCore/platform/mac/WebCoreSystemInterface.h | 7 +- .../WebCore/platform/mac/WebCoreSystemInterface.mm | 7 +- .../webkit/WebCore/platform/mac/WidgetMac.mm | 74 +- .../platform/network/ResourceHandleInternal.h | 4 +- .../platform/network/ResourceResponseBase.cpp | 2 +- .../platform/network/ResourceResponseBase.h | 2 - .../webkit/WebCore/platform/qt/Localizations.cpp | 10 + .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 2 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.cpp | 5 +- .../WebCore/platform/sql/SQLiteFileSystem.cpp | 123 + .../webkit/WebCore/platform/sql/SQLiteFileSystem.h | 114 + .../platform/text/TextBreakIteratorInternalICU.h | 4 +- .../text/android/TextBreakIteratorInternalICU.cpp | 7 + .../text/mac/TextBreakIteratorInternalICUMac.mm | 96 +- .../text/win/TextBreakIteratorInternalICUWin.cpp | 6 + src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 22 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 2 +- .../plugins/win/PluginMessageThrottlerWin.cpp | 3 + .../WebCore/plugins/win/PluginPackageWin.cpp | 11 +- .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 45 +- .../webkit/WebCore/rendering/AutoTableLayout.cpp | 4 +- .../webkit/WebCore/rendering/InlineBox.cpp | 38 +- src/3rdparty/webkit/WebCore/rendering/InlineBox.h | 39 +- .../webkit/WebCore/rendering/InlineFlowBox.cpp | 53 +- .../webkit/WebCore/rendering/InlineFlowBox.h | 12 +- .../webkit/WebCore/rendering/InlineTextBox.cpp | 4 +- .../WebCore/rendering/MediaControlElements.cpp | 308 +- .../WebCore/rendering/MediaControlElements.h | 97 +- .../webkit/WebCore/rendering/RenderApplet.cpp | 1 + .../webkit/WebCore/rendering/RenderArena.cpp | 2 +- .../webkit/WebCore/rendering/RenderBlock.cpp | 90 +- .../webkit/WebCore/rendering/RenderBlock.h | 21 +- .../WebCore/rendering/RenderBlockLineLayout.cpp | 2264 ++++++++ .../webkit/WebCore/rendering/RenderBox.cpp | 2 +- .../WebCore/rendering/RenderBoxModelObject.cpp | 71 +- .../webkit/WebCore/rendering/RenderDataGrid.cpp | 136 +- .../webkit/WebCore/rendering/RenderDataGrid.h | 22 +- .../webkit/WebCore/rendering/RenderFieldset.cpp | 2 +- .../webkit/WebCore/rendering/RenderFlexibleBox.cpp | 26 +- .../webkit/WebCore/rendering/RenderFrameSet.cpp | 2 +- .../webkit/WebCore/rendering/RenderFrameSet.h | 3 +- .../webkit/WebCore/rendering/RenderImage.cpp | 3 +- .../webkit/WebCore/rendering/RenderInline.cpp | 6 +- .../webkit/WebCore/rendering/RenderInline.h | 5 +- .../webkit/WebCore/rendering/RenderLayer.cpp | 152 +- .../webkit/WebCore/rendering/RenderLayer.h | 28 +- .../WebCore/rendering/RenderLayerBacking.cpp | 19 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 3 +- .../WebCore/rendering/RenderLayerCompositor.cpp | 180 +- .../WebCore/rendering/RenderLayerCompositor.h | 30 +- .../webkit/WebCore/rendering/RenderListBox.cpp | 70 +- .../webkit/WebCore/rendering/RenderListBox.h | 4 + .../webkit/WebCore/rendering/RenderMarquee.cpp | 3 +- .../webkit/WebCore/rendering/RenderMedia.cpp | 209 +- .../webkit/WebCore/rendering/RenderMedia.h | 25 +- .../webkit/WebCore/rendering/RenderMenuList.cpp | 7 + .../webkit/WebCore/rendering/RenderObject.cpp | 35 +- .../webkit/WebCore/rendering/RenderObject.h | 8 +- .../webkit/WebCore/rendering/RenderPart.cpp | 16 +- src/3rdparty/webkit/WebCore/rendering/RenderPart.h | 4 +- .../webkit/WebCore/rendering/RenderReplaced.cpp | 5 +- .../webkit/WebCore/rendering/RenderSVGImage.cpp | 14 +- .../webkit/WebCore/rendering/RenderSVGInline.cpp | 4 +- .../webkit/WebCore/rendering/RenderSVGInline.h | 2 +- .../WebCore/rendering/RenderSVGInlineText.cpp | 2 +- .../webkit/WebCore/rendering/RenderSVGText.cpp | 4 +- .../webkit/WebCore/rendering/RenderSVGText.h | 2 +- .../webkit/WebCore/rendering/RenderSlider.cpp | 90 +- .../webkit/WebCore/rendering/RenderSlider.h | 3 +- .../webkit/WebCore/rendering/RenderTable.cpp | 3 +- .../webkit/WebCore/rendering/RenderTableCol.h | 3 +- .../webkit/WebCore/rendering/RenderTextControl.cpp | 31 +- .../rendering/RenderTextControlSingleLine.cpp | 4 +- .../webkit/WebCore/rendering/RenderTheme.cpp | 23 +- .../webkit/WebCore/rendering/RenderTheme.h | 10 +- .../WebCore/rendering/RenderThemeChromiumMac.h | 2 +- .../WebCore/rendering/RenderThemeChromiumMac.mm | 30 +- .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 23 +- .../WebCore/rendering/RenderThemeChromiumSkia.h | 2 +- .../WebCore/rendering/RenderThemeChromiumWin.cpp | 10 +- .../webkit/WebCore/rendering/RenderThemeMac.h | 7 +- .../webkit/WebCore/rendering/RenderThemeSafari.cpp | 6 +- .../webkit/WebCore/rendering/RenderThemeSafari.h | 2 +- .../webkit/WebCore/rendering/RenderView.cpp | 4 +- .../webkit/WebCore/rendering/RenderWidget.cpp | 31 +- .../webkit/WebCore/rendering/RenderWidget.h | 7 +- .../webkit/WebCore/rendering/RootInlineBox.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.h | 3 +- .../webkit/WebCore/rendering/SVGInlineFlowBox.h | 2 +- .../webkit/WebCore/rendering/SVGInlineTextBox.h | 2 +- .../webkit/WebCore/rendering/SVGRootInlineBox.h | 2 +- .../WebCore/rendering/TextControlInnerElements.cpp | 10 + .../WebCore/rendering/TextControlInnerElements.h | 4 +- src/3rdparty/webkit/WebCore/rendering/bidi.cpp | 2231 -------- src/3rdparty/webkit/WebCore/rendering/bidi.h | 65 - .../webkit/WebCore/rendering/style/RenderStyle.cpp | 7 + .../webkit/WebCore/rendering/style/RenderStyle.h | 9 +- .../WebCore/rendering/style/RenderStyleConstants.h | 5 +- .../WebCore/rendering/style/SVGRenderStyleDefs.h | 4 +- .../WebCore/rendering/style/StyleInheritedData.h | 2 +- src/3rdparty/webkit/WebCore/storage/Database.cpp | 24 +- src/3rdparty/webkit/WebCore/storage/Database.h | 3 + src/3rdparty/webkit/WebCore/storage/DatabaseTask.h | 15 +- .../webkit/WebCore/storage/DatabaseThread.cpp | 27 + .../webkit/WebCore/storage/DatabaseThread.h | 8 + .../webkit/WebCore/storage/DatabaseTracker.cpp | 55 +- .../webkit/WebCore/storage/OriginUsageRecord.cpp | 12 +- .../webkit/WebCore/storage/StorageArea.cpp | 221 +- src/3rdparty/webkit/WebCore/storage/StorageArea.h | 44 +- .../webkit/WebCore/storage/StorageAreaImpl.cpp | 266 + .../webkit/WebCore/storage/StorageAreaImpl.h | 80 + .../webkit/WebCore/storage/StorageAreaSync.h | 3 +- .../webkit/WebCore/storage/StorageNamespace.cpp | 96 +- .../webkit/WebCore/storage/StorageNamespace.h | 26 +- .../WebCore/storage/StorageNamespaceImpl.cpp | 129 + .../webkit/WebCore/storage/StorageNamespaceImpl.h | 66 + .../webkit/WebCore/svg/GradientAttributes.h | 3 +- .../webkit/WebCore/svg/LinearGradientAttributes.h | 3 +- .../webkit/WebCore/svg/PatternAttributes.h | 3 +- .../webkit/WebCore/svg/RadialGradientAttributes.h | 3 +- .../webkit/WebCore/svg/SVGAnimatedPathData.h | 6 +- .../webkit/WebCore/svg/SVGAnimatedPoints.h | 6 +- .../webkit/WebCore/svg/SVGAnimationElement.h | 3 +- .../webkit/WebCore/svg/SVGClipPathElement.h | 3 +- .../webkit/WebCore/svg/SVGDocumentExtensions.cpp | 4 +- .../webkit/WebCore/svg/SVGElementInstance.h | 3 +- .../webkit/WebCore/svg/SVGElementInstance.idl | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.h | 6 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.cpp | 2 +- .../WebCore/svg/SVGFEComponentTransferElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFECompositeElement.cpp | 2 +- .../WebCore/svg/SVGFEDiffuseLightingElement.cpp | 2 +- .../WebCore/svg/SVGFEDisplacementMapElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEDistantLightElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFloodElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEFloodElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncAElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncBElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncGElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncRElement.h | 6 +- .../WebCore/svg/SVGFEGaussianBlurElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEImageElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEMergeElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEOffsetElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEPointLightElement.h | 6 +- .../WebCore/svg/SVGFESpecularLightingElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFESpotLightElement.h | 6 +- .../webkit/WebCore/svg/SVGFETileElement.cpp | 2 +- src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp | 3 +- src/3rdparty/webkit/WebCore/svg/SVGList.h | 3 +- src/3rdparty/webkit/WebCore/svg/SVGListTraits.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h | 3 +- .../webkit/WebCore/svg/SVGMetadataElement.h | 6 +- .../webkit/WebCore/svg/SVGParserUtilities.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.h | 3 +- src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl | 2 +- .../webkit/WebCore/svg/SVGPathSegClosePath.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSetElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h | 6 +- .../webkit/WebCore/svg/SVGTextPathElement.cpp | 2 +- .../webkit/WebCore/svg/SVGTextPathElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h | 6 +- .../webkit/WebCore/svg/SVGTransformDistance.cpp | 2 + .../webkit/WebCore/svg/SVGTransformList.cpp | 18 - src/3rdparty/webkit/WebCore/svg/SVGTransformList.h | 1 - .../webkit/WebCore/svg/SVGTransformable.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp | 2 +- .../webkit/WebCore/svg/animation/SMILTime.cpp | 9 +- .../webkit/WebCore/svg/animation/SVGSMILElement.h | 3 +- .../webkit/WebCore/svg/graphics/SVGImage.cpp | 4 +- .../webkit/WebCore/svg/graphics/SVGResource.cpp | 3 +- src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp | 4 +- .../webkit/WebCore/wml/WMLErrorHandling.cpp | 2 +- src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp | 2 +- .../webkit/WebCore/wml/WMLPostfieldElement.cpp | 2 +- .../webkit/WebCore/wml/WMLSelectElement.cpp | 336 +- src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h | 23 +- .../webkit/WebCore/wml/WMLSetvarElement.cpp | 2 +- .../webkit/WebCore/workers/AbstractWorker.cpp | 125 + .../webkit/WebCore/workers/AbstractWorker.h | 86 + .../webkit/WebCore/workers/AbstractWorker.idl | 52 + .../webkit/WebCore/workers/GenericWorkerTask.h | 70 + .../webkit/WebCore/workers/SharedWorker.cpp | 52 + src/3rdparty/webkit/WebCore/workers/SharedWorker.h | 61 + .../webkit/WebCore/workers/SharedWorker.idl | 42 + src/3rdparty/webkit/WebCore/workers/Worker.cpp | 17 +- src/3rdparty/webkit/WebCore/workers/Worker.h | 5 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 3 +- .../webkit/WebCore/workers/WorkerContext.cpp | 32 +- .../webkit/WebCore/workers/WorkerContext.h | 9 +- .../webkit/WebCore/workers/WorkerContext.idl | 8 +- .../webkit/WebCore/workers/WorkerContextProxy.h | 5 +- .../webkit/WebCore/workers/WorkerLoaderProxy.h | 2 +- .../WebCore/workers/WorkerMessagingProxy.cpp | 52 +- .../webkit/WebCore/workers/WorkerMessagingProxy.h | 8 +- .../webkit/WebCore/workers/WorkerObjectProxy.h | 7 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 3 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 36 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 1 + src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp | 8 +- src/3rdparty/webkit/WebCore/xml/XPathPath.h | 3 +- src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp | 2 +- src/3rdparty/webkit/WebKit.pri | 6 +- src/3rdparty/webkit/WebKit/ChangeLog | 39 + .../webkit/WebKit/StringsNotToBeLocalized.txt | 9 +- src/3rdparty/webkit/WebKit/qt/Api/headers.pri | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp | 14 + src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 197 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h | 9 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 10 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 71 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 4 + src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 3 - src/3rdparty/webkit/WebKit/qt/ChangeLog | 338 ++ .../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 7 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.h | 2 +- .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 70 +- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 8 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 60 + .../WebKit/qt/tests/qwebpage/frametest/iframe.html | 6 + .../qt/tests/qwebpage/frametest/iframe2.html | 7 + .../qt/tests/qwebpage/frametest/iframe3.html | 5 + .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 50 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.qrc | 3 + 904 files changed, 25388 insertions(+), 8713 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi create mode 100644 src/3rdparty/webkit/WebCore/WebCore.gypi create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/css/html.css delete mode 100644 src/3rdparty/webkit/WebCore/css/html4.css create mode 100644 src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl create mode 100644 src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSValidityState.h create mode 100644 src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.h create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.idl create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js create mode 100644 src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/bidi.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/bidi.h create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.h create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.h create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.idl create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index f2cc9a2..fa8e3ff 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,72 @@ +2009-07-13 Laszlo Gombos + + Reviewed by Tor Arne Vestbø. + + [Qt] Build fix for QtWebKit on Win + https://bugs.webkit.org/show_bug.cgi?id=27205 + + * WebKit.pri: Include the major version number in the QtWebKit + library file for Win. + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Add the test netscape plugin for the Qt DRT to the build. + + * WebKit.pro: + +2009-07-13 Drew Wilson + + Reviewed by David Levin. + + Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs + https://bugs.webkit.org/show_bug.cgi?id=26932 + + Added ENABLE(SHARED_WORKERS) flag. + + * configure.ac: + +2009-07-12 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump version in preparation for 1.1.11 release. + + * configure.ac: + +2009-07-07 Norbert Leser + + Reviewed by Simon Hausmann. + + Exclude DumpRenderTree.pro from symbian build + + * WebKit.pro: + +2009-07-09 Drew Wilson + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=26903 + + Turned on CHANNEL_MESSAGING by default because the MessageChannel API + can now be implemented for Web Workers and is reasonably stable. + + * configure.ac: enable CHANNEL_MESSAGING. + +2009-07-03 Jan Michael Alonzo + + Reviewed by Xan Lopez and Gustavo Noronha. + + Set user-agent from application + https://bugs.webkit.org/show_bug.cgi?id=17375 + + Define UA version macros to be used by the UA string. + Add new WebSettings unit test for the User-Agent string API. + + * GNUmakefile.am: + * configure.ac: + 2009-06-20 Gustavo Noronha Silva Reviewed by Jan Alonzo. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index c8bba0f..cd46bf5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,464 @@ +2009-07-13 Gustavo Noronha Silva + + Unreviewed make dist build fix. + + * GNUmakefile.am: + +2009-07-13 Drew Wilson + + Reviewed by David Levin. + + Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs + https://bugs.webkit.org/show_bug.cgi?id=26932 + + Added ENABLE(SHARED_WORKERS) flag (off by default). + + * Configurations/FeatureDefines.xcconfig: + +2009-07-07 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27058 + + Removed superfluous parenthesis around single expression. + Compilers on Symbian platform fail to properly parse and compile. + + * JavaScriptCore/wtf/Platform.h: + +2009-07-13 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27054 + + Renamed Translator to HashTranslator + + Codewarrior compiler (WINSCW) latest b482 cannot resolve typename + mismatch between template declaration and definition + (HashTranslator / Translator) + + * wtf/HashSet.h: + +2009-07-13 Norbert Leser + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=27053 + + Ambiguity in LabelScope initialization + + Codewarrior compiler (WINSCW) latest b482 on Symbian cannot resolve + type of "0" unambiguously. Set expression explicitly to + PassRefPtr